Skip to contentSkip to conversation

kbuild: determine base DTB by suffix

PATCH In review Masahiro Yamada 2 participants 2 messages Dec 3, 2023 – Dec 4, 2023 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: determine base DTB by suffix

When using the -dtbs syntax, you need to ensure to list the base first, as follows:

foo-dtbs := foo_base.dtb foo_overlay1.dtbo foo_overlay2.dtbo dtb-y := foo.dtb

You cannot do this arrangement:

foo-dtbs := foo_overlay1.dtbo foo_overlay2.dtbo foo_base.dtb

This restriction comes from $(firstword ...), but it is unneeded to rely on the order in the -dtbs syntax.

Instead, you can simply determine the base by suffix because the base (*.dtb) and overlays (*.dtbo) use different suffixes.

---

 scripts/Makefile.lib | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.lib +2 -2
index 1a965fe68e01..cd5b181060f1 100644
@@ -83,8 +83,8 @@ dtb-$(CONFIG_OF_ALL_DTBS)       += $(dtb-)
 multi-dtb-y := $(call multi-search, $(dtb-y), .dtb, -dtbs)
 # Primitive DTB compiled from *.dts
 real-dtb-y := $(call real-search, $(dtb-y), .dtb, -dtbs)
-# Base DTB that overlay is applied onto (each first word of $(*-dtbs) expansion)
-base-dtb-y := $(foreach m, $(multi-dtb-y), $(firstword $(call suffix-search, $m, .dtb, -dtbs)))
+# Base DTB that overlay is applied onto
+base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs))
 
 always-y			+= $(dtb-y)
 
Signature · 1 line
2.40.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Masahiro Yamada

When using the -dtbs syntax, you need to ensure to list the base first, as follows:

foo-dtbs := foo_base.dtb foo_overlay1.dtbo foo_overlay2.dtbo dtb-y := foo.dtb

You cannot do this arrangement:

foo-dtbs := foo_overlay1.dtbo foo_overlay2.dtbo foo_base.dtb

Quoted 8 lines

This restriction comes from $(firstword ...), but it is unneeded to rely on the order in the -dtbs syntax.

Instead, you can simply determine the base by suffix because the base (*.dtb) and overlays (*.dtbo) use different suffixes.

---

Thanks, looks good to me.