History

kbuild: simplify dtbs_install by reading the list of compiled DTBs

Retrieve the list of *.dtb(o) files from arch/*/boot/dts/dtbs-list instead of traversing the directory tree again. Please note that 'make dtbs_install' installs *.dtb(o) files directly added to dtb-y because scripts/Makefile.dtbinst installs $(dtb-y) without expanding the -dtbs suffix. This commit preserves this behavior.

Masahiro Yamada committed 2 years ago

Commit 8f668641 parent 24507873 files · +19 −21Browse files

Unified · Split

3 files
  1. Makefile +1 −1
  2. scripts/Kbuild.include +0 −6
  3. scripts/Makefile.dtbinst +18 −14
Makefile+1−1
@@ -1411,7 +1411,7 @@ endif · 1410 unmodified lines
1411dtbs_check: dtbs1411dtbs_check: dtbs
1412 1412
1413dtbs_install:1413dtbs_install:
1414 $(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH)1414 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.dtbinst obj=$(dtstree)
1415 1415
1416ifdef CONFIG_OF_EARLY_FLATTREE1416ifdef CONFIG_OF_EARLY_FLATTREE
1417all: dtbs1417all: dtbs
scripts/Kbuild.include+0−6
@@ -113,12 +113,6 @@ endef · 112 unmodified lines
113# $(Q)$(MAKE) $(build)=dir113# $(Q)$(MAKE) $(build)=dir
114build := -f $(srctree)/scripts/Makefile.build obj114build := -f $(srctree)/scripts/Makefile.build obj
115 115
116###
117# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
118# Usage:
119# $(Q)$(MAKE) $(dtbinst)=dir
120dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj
121
122###116###
123# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=117# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=
124# Usage:118# Usage:
scripts/Makefile.dtbinst+18−14
@@ -8,32 +8,36 @@ · 7 unmodified lines
8# $INSTALL_PATH/dtbs/$KERNELRELEASE8# $INSTALL_PATH/dtbs/$KERNELRELEASE
9# ==========================================================================9# ==========================================================================
10 10
11src := $(obj)
12
13PHONY := __dtbs_install11PHONY := __dtbs_install
14__dtbs_install:12__dtbs_install:
15 13
16include include/config/auto.conf14include include/config/auto.conf
17include $(srctree)/scripts/Kbuild.include15include $(srctree)/scripts/Kbuild.include
18include $(kbuild-file)
19
20dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
21subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
22 16
23__dtbs_install: $(dtbs) $(subdirs)17dst := $(INSTALL_DTBS_PATH)
24 @:
25 18
26quiet_cmd_dtb_install = INSTALL $@19quiet_cmd_dtb_install = INSTALL $@
27 cmd_dtb_install = install -D $< $@20 cmd_dtb_install = install -D $< $@
28 21
29$(dst)/%.dtb: $(obj)/%.dtb22$(dst)/%: $(obj)/%
30 $(call cmd,dtb_install)23 $(call cmd,dtb_install)
31 24
32$(dst)/%.dtbo: $(obj)/%.dtbo25dtbs := $(patsubst $(obj)/%,%,$(call read-file, $(obj)/dtbs-list))
33 $(call cmd,dtb_install)26
27ifdef CONFIG_ARCH_WANT_FLAT_DTB_INSTALL
34 28
35PHONY += $(subdirs)29define gen_install_rules
36$(subdirs):30$(dst)/%: $(obj)/$(1)%
37 $(Q)$(MAKE) $(dtbinst)=$@ dst=$(if $(CONFIG_ARCH_WANT_FLAT_DTB_INSTALL),$(dst),$(patsubst $(obj)/%,$(dst)/%,$@))31 $$(call cmd,dtb_install)
32endef
33
34$(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d))))
35
36dtbs := $(notdir $(dtbs))
37
38endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL
39
40__dtbs_install: $(addprefix $(dst)/, $(dtbs))
41 @:
38 42
39.PHONY: $(PHONY)43.PHONY: $(PHONY)