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