]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
kbuild: simplify dtbs_install by reading the list of compiled DTBs
authorMasahiro Yamada <masahiroy@kernel.org>
Tue, 9 Jan 2024 12:07:35 +0000 (21:07 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Mon, 19 Feb 2024 09:20:39 +0000 (18:20 +0900)
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.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Makefile
scripts/Kbuild.include
scripts/Makefile.dtbinst

index f5755b81591b2639e3fe74e321dafe7d031ec4c8..bc54a6cc8dc5fa6b93a314bcce7f2af324abc937 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1411,7 +1411,7 @@ endif
 dtbs_check: dtbs
 
 dtbs_install:
-       $(Q)$(MAKE) $(dtbinst)=$(dtstree) dst=$(INSTALL_DTBS_PATH)
+       $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.dtbinst obj=$(dtstree)
 
 ifdef CONFIG_OF_EARLY_FLATTREE
 all: dtbs
index 7778cc97a4e042cd763fb2f743e542a0c91d71ee..2f331879816b8e2bf6c07f98572cb7c4ac1fec36 100644 (file)
@@ -113,12 +113,6 @@ endef
 # $(Q)$(MAKE) $(build)=dir
 build := -f $(srctree)/scripts/Makefile.build obj
 
-###
-# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj=
-# Usage:
-# $(Q)$(MAKE) $(dtbinst)=dir
-dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj
-
 ###
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=
 # Usage:
index 4405d5b67578d6fdd30f2ec2b5b6e0de985cb231..67956f6496a5c062c65375dcd8c712d0be91d771 100644 (file)
@@ -8,32 +8,36 @@
 #   $INSTALL_PATH/dtbs/$KERNELRELEASE
 # ==========================================================================
 
-src := $(obj)
-
 PHONY := __dtbs_install
 __dtbs_install:
 
 include include/config/auto.conf
 include $(srctree)/scripts/Kbuild.include
-include $(kbuild-file)
-
-dtbs    := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
-subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
 
-__dtbs_install: $(dtbs) $(subdirs)
-       @:
+dst := $(INSTALL_DTBS_PATH)
 
 quiet_cmd_dtb_install = INSTALL $@
       cmd_dtb_install = install -D $< $@
 
-$(dst)/%.dtb: $(obj)/%.dtb
+$(dst)/%: $(obj)/%
        $(call cmd,dtb_install)
 
-$(dst)/%.dtbo: $(obj)/%.dtbo
-       $(call cmd,dtb_install)
+dtbs := $(patsubst $(obj)/%,%,$(call read-file, $(obj)/dtbs-list))
+
+ifdef CONFIG_ARCH_WANT_FLAT_DTB_INSTALL
 
-PHONY += $(subdirs)
-$(subdirs):
-       $(Q)$(MAKE) $(dtbinst)=$@ dst=$(if $(CONFIG_ARCH_WANT_FLAT_DTB_INSTALL),$(dst),$(patsubst $(obj)/%,$(dst)/%,$@))
+define gen_install_rules
+$(dst)/%: $(obj)/$(1)%
+       $$(call cmd,dtb_install)
+endef
+
+$(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d))))
+
+dtbs := $(notdir $(dtbs))
+
+endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL
+
+__dtbs_install: $(addprefix $(dst)/, $(dtbs))
+       @:
 
 .PHONY: $(PHONY)