xref: /openbmc/linux/scripts/Makefile.dtbinst (revision 5d0e4d78)
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# Traverse through subdirectories listed in $(dts-dirs).
10# ==========================================================================
11
12src := $(obj)
13
14PHONY := __dtbs_install
15__dtbs_install:
16
17export dtbinst-root ?= $(obj)
18
19include include/config/auto.conf
20include scripts/Kbuild.include
21include $(src)/Makefile
22
23dtbinst-files	:= $(dtb-y)
24dtbinst-dirs	:= $(dts-dirs)
25
26# Helper targets for Installing DTBs into the boot directory
27quiet_cmd_dtb_install =	INSTALL $<
28      cmd_dtb_install =	mkdir -p $(2); cp $< $(2)
29
30install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
31
32$(dtbinst-files): %.dtb: $(obj)/%.dtb
33	$(call cmd,dtb_install,$(install-dir))
34
35$(dtbinst-dirs):
36	$(Q)$(MAKE) $(dtbinst)=$(obj)/$@
37
38PHONY += $(dtbinst-files) $(dtbinst-dirs)
39__dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
40
41.PHONY: $(PHONY)
42