diff mbox series

[3/4] kbuild: create a list of base and overlays for each DTB

Message ID 20240109120738.346061-4-masahiroy@kernel.org (mailing list archive)
State New
Headers show
Series kbuild: create a list of DTBs and allow to install base dtb and overlays | expand

Commit Message

Masahiro Yamada Jan. 9, 2024, 12:07 p.m. UTC
Some *.dtb files are assembled from a base DTB and overlays, but once
they are built, there is no way to propagate such information to
succeeding processes.

This commit introduces the generation of *.dtlst files, listing the
component *.dtb(o) files that construct the corresponding *.dtb.

This is analogous to *.mod, which lists component objects for each
module.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 .gitignore             | 1 +
 Makefile               | 2 +-
 scripts/Makefile.build | 6 ++++++
 scripts/Makefile.lib   | 2 ++
 4 files changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/.gitignore b/.gitignore
index c59dc60ba62e..912cb713ad74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ 
 *.dtbo
 *.dtb.S
 *.dtbo.S
+*.dtlst
 *.dwo
 *.elf
 *.gcno
diff --git a/Makefile b/Makefile
index dae6825b8082..3521bdad6db7 100644
--- a/Makefile
+++ b/Makefile
@@ -1927,7 +1927,7 @@  clean: $(clean-dirs)
 		-o -name '*.ko.*' \
 		-o -name '*.dtb' -o -name '*.dtbo' \
 		-o -name '*.dtb.S' -o -name '*.dtbo.S' \
-		-o -name '*.dt.yaml' -o -name 'dtbs-list' \
+		-o -name '*.dt.yaml' -o -name '*.dtlst' -o -name 'dtbs-list' \
 		-o -name '*.dwo' -o -name '*.lst' \
 		-o -name '*.su' -o -name '*.mod' \
 		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index d23797dbca0f..e9fcf330ff39 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -252,6 +252,12 @@  cmd_mod = printf '%s\n' $(call real-search, $*.o, .o, -objs -y -m) | \
 $(obj)/%.mod: FORCE
 	$(call if_changed,mod)
 
+cmd_dt_list = printf '%s\n' $(call real-search, $*.dtb, .dtb, -dtbs) | \
+	$(AWK) '!x[$$0]++ { print("$(obj)/"$$0) }' > $@
+
+$(obj)/%.dtlst: FORCE
+	$(call if_changed,dt_list)
+
 quiet_cmd_cc_lst_c = MKLST   $@
       cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \
 		     $(CONFIG_SHELL) $(srctree)/scripts/makelst $*.o \
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index b35d39022a30..0a492a4e4fbb 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -93,6 +93,8 @@  base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs))
 
 always-y			+= $(dtb-y)
 
+always-y	+= $(patsubst %.dtb, %.dtlst, $(filter %.dtb, $(dtb-y)))
+
 # Add subdir path
 
 ifneq ($(obj),.)