xref: /linux/scripts/Makefile.dtbinst (revision 7e7962dd1a5307bca1793a3f9a98ad5514306c7a)
1# ==========================================================================
2# Installing dtb files
3#
4# Installs all dtb files listed in $(dtb-y) either in the
5# INSTALL_DTBS_PATH directory or the default location:
6#
7#   $INSTALL_PATH/dtbs/$KERNELRELEASE
8# ==========================================================================
9
10src := $(obj)
11
12PHONY := __dtbs_install
13__dtbs_install:
14
15export dtbinst_root ?= $(obj)
16
17include include/config/auto.conf
18include scripts/Kbuild.include
19include $(src)/Makefile
20
21dtbinst-files	:= $(sort $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtb-)))
22dtbinst-dirs	:= $(subdir-y) $(subdir-m)
23
24# Helper targets for Installing DTBs into the boot directory
25quiet_cmd_dtb_install =	INSTALL $<
26      cmd_dtb_install =	mkdir -p $(2); cp $< $(2)
27
28install-dir = $(patsubst $(dtbinst_root)%,$(INSTALL_DTBS_PATH)%,$(obj))
29
30$(dtbinst-files): %.dtb: $(obj)/%.dtb
31	$(call cmd,dtb_install,$(install-dir))
32
33$(dtbinst-dirs):
34	$(Q)$(MAKE) $(dtbinst)=$(obj)/$@
35
36PHONY += $(dtbinst-files) $(dtbinst-dirs)
37__dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
38
39.PHONY: $(PHONY)
40