1 # SPDX-License-Identifier: GPL-2.0
2 # ==========================================================================
5 # Installs all dtb files listed in $(dtb-y) either in the
6 # INSTALL_DTBS_PATH directory or the default location:
8 # $INSTALL_PATH/dtbs/$KERNELRELEASE
10 # Traverse through subdirectories listed in $(dts-dirs).
11 # ==========================================================================
15 PHONY := __dtbs_install
18 export dtbinst_root ?= $(obj)
20 include include/config/auto.conf
21 include scripts/Kbuild.include
22 include $(src)/Makefile
24 dtbinst-files := $(dtb-y)
25 dtbinst-dirs := $(dts-dirs)
27 # Helper targets for Installing DTBs into the boot directory
28 quiet_cmd_dtb_install = INSTALL $<
29 cmd_dtb_install = mkdir -p $(2); cp $< $(2)
31 install-dir = $(patsubst $(dtbinst_root)%,$(INSTALL_DTBS_PATH)%,$(obj))
33 $(dtbinst-files): %.dtb: $(obj)/%.dtb
34 $(call cmd,dtb_install,$(install-dir))
37 $(Q)$(MAKE) $(dtbinst)=$(obj)/$@
39 PHONY += $(dtbinst-files) $(dtbinst-dirs)
40 __dtbs_install: $(dtbinst-files) $(dtbinst-dirs)