1 # ==========================================================================
4 # Installs all dtb files listed in $(dtb-y) either in the
5 # INSTALL_DTBS_PATH directory or the default location:
7 # $INSTALL_PATH/dtbs/$KERNELRELEASE
9 # Traverse through subdirectories listed in $(dts-dirs).
10 # ==========================================================================
14 PHONY := __dtbs_install
17 export dtbinst-root ?= $(obj)
19 include include/config/auto.conf
20 include scripts/Kbuild.include
21 include $(src)/Makefile
23 PHONY += __dtbs_install_prep
25 ifeq ("$(dtbinst-root)", "$(obj)")
26 $(Q)if [ -d $(INSTALL_DTBS_PATH).old ]; then rm -rf $(INSTALL_DTBS_PATH).old; fi
27 $(Q)if [ -d $(INSTALL_DTBS_PATH) ]; then mv $(INSTALL_DTBS_PATH) $(INSTALL_DTBS_PATH).old; fi
28 $(Q)mkdir -p $(INSTALL_DTBS_PATH)
31 dtbinst-files := $(dtb-y)
32 dtbinst-dirs := $(dts-dirs)
34 # Helper targets for Installing DTBs into the boot directory
35 quiet_cmd_dtb_install = INSTALL $<
36 cmd_dtb_install = mkdir -p $(2); cp $< $(2)
38 install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
40 $(dtbinst-files) $(dtbinst-dirs): | __dtbs_install_prep
42 $(dtbinst-files): %.dtb: $(obj)/%.dtb
43 $(call cmd,dtb_install,$(install-dir))
46 $(Q)$(MAKE) $(dtbinst)=$(obj)/$@
48 PHONY += $(dtbinst-files) $(dtbinst-dirs)
49 __dtbs_install: $(dtbinst-files) $(dtbinst-dirs)