public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: determine base DTB by suffix
@ 2023-12-03  8:05 Masahiro Yamada
  2023-12-04 11:17 ` Nicolas Schier
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2023-12-03  8:05 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Nathan Chancellor, Nick Desaulniers,
	Nicolas Schier, linux-kernel

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.

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

 scripts/Makefile.lib | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 1a965fe68e01..cd5b181060f1 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -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)
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kbuild: determine base DTB by suffix
  2023-12-03  8:05 [PATCH] kbuild: determine base DTB by suffix Masahiro Yamada
@ 2023-12-04 11:17 ` Nicolas Schier
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Schier @ 2023-12-04 11:17 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, Nathan Chancellor, Nick Desaulniers, linux-kernel

On Sun, Dec 03, 2023 at 05:05:48PM +0900, Masahiro Yamada wrote:
> 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.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---

Thanks, looks good to me.

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-04 11:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-03  8:05 [PATCH] kbuild: determine base DTB by suffix Masahiro Yamada
2023-12-04 11:17 ` Nicolas Schier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox