Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS
@ 2026-03-04 15:20 Neal Frager via buildroot
  2026-03-04 15:20 ` [Buildroot] [PATCH v3 2/3] board/zynqmp/post-image.sh: use LINUX_DTBS variable Neal Frager via buildroot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Neal Frager via buildroot @ 2026-03-04 15:20 UTC (permalink / raw)
  To: buildroot
  Cc: ibai.erkiaga-elorza, luca.ceresoli, yann.morin, brandon.maier,
	fiona.klute, ju.o, Neal Frager, thomas.petazzoni, romain.naour,
	michal.simek, romain.naour

Users of the BR2_LINUX_KERNEL_CUSTOM_DTS_DIR config for custom hardware may
wish to have the dtb filenames for use in their post-build scripts. Since the
BR2_LINUX_KERNEL_CUSTOM_DTS_DIR only specifies paths to custom dts files, the
actual filenames are not available for any post-build scripting.

By exporting the LINUX_DTBS variable, users will have a list of all the built
dtb filenames that are built and installed, and they can use this for
convenient post-build scripting.

Even if users are working with an evaluation board with an intree dts, the
LINUX_DTBS variable will still give them a list of all built DTBs, so the
same post-build scripts which work for custom hardware will also work for
evaluation boards with intree dts files.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
 linux/linux.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/linux/linux.mk b/linux/linux.mk
index c61089bfe0..6ef9f54ffc 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -226,6 +226,9 @@ endef
 endif
 
 LINUX_DTBS = $(addsuffix .dtb,$(LINUX_DTS_NAME)) $(addsuffix .dtbo,$(LINUX_DTSO_NAMES))
+# Post-build scripts may need to reference the LINUX_DTBS,
+# so export it so it is easier to use
+export LINUX_DTBS
 
 ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
 LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_NAME))
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v3 2/3] board/zynqmp/post-image.sh: use LINUX_DTBS variable
  2026-03-04 15:20 [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS Neal Frager via buildroot
@ 2026-03-04 15:20 ` Neal Frager via buildroot
  2026-03-04 15:20 ` [Buildroot] [PATCH v3 3/3] board/versal/post-image.sh: " Neal Frager via buildroot
  2026-03-04 18:00 ` [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS Thomas Petazzoni via buildroot
  2 siblings, 0 replies; 5+ messages in thread
From: Neal Frager via buildroot @ 2026-03-04 15:20 UTC (permalink / raw)
  To: buildroot
  Cc: ibai.erkiaga-elorza, luca.ceresoli, yann.morin, brandon.maier,
	fiona.klute, ju.o, Neal Frager, thomas.petazzoni, romain.naour,
	michal.simek, romain.naour

By switching to the LINUX_DTBS variable, the post-image.sh script can now
work regardless of whether a user is using BR2_LINUX_KERNEL_INTREE_DTS_NAME
or the BR2_LINUX_KERNEL_CUSTOM_DTS_DIR for custom hardware. This simplifies
the transition users will make when migrating from a zynqmp evaluation board
to a zynqmp custom platform.

To keep the example post-image script as simple as possible, it assumes that
the first DTB in the LINUX_DTBS list is the one for creating the system.dtb
filename that u-boot will use for booting. Users are free to implement their
own post-image scripts for use cases with multiple DTBs.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
V1->V2:
- removed unnecessary $BINARIES_DIR from symlink source
V2->V3:
- ignore anything after the first space char of LINUX_DTBS
---
 board/zynqmp/post-image.sh | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/board/zynqmp/post-image.sh b/board/zynqmp/post-image.sh
index f44b66342d..54c75ff4cb 100755
--- a/board/zynqmp/post-image.sh
+++ b/board/zynqmp/post-image.sh
@@ -2,13 +2,8 @@
 
 # By default U-Boot loads DTB from a file named "system.dtb", so
 # let's use a symlink with that name that points to the *first*
-# devicetree listed in the config.
-
-FIRST_DT=$(sed -nr \
-               -e 's|^BR2_LINUX_KERNEL_INTREE_DTS_NAME="(xilinx/)?([-_/[:alnum:]\\.]*).*"$|\2|p' \
-               "${BR2_CONFIG}")
-
-[ -z "${FIRST_DT}" ] || ln -fs "${FIRST_DT}.dtb" "${BINARIES_DIR}/system.dtb"
+# devicetree in the LINUX_DTBS list.
+ln -fs "$(basename ${LINUX_DTBS%% *})" "${BINARIES_DIR}/system.dtb"
 
 BOARD_DIR="$(dirname "$0")"
 
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v3 3/3] board/versal/post-image.sh: use LINUX_DTBS variable
  2026-03-04 15:20 [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS Neal Frager via buildroot
  2026-03-04 15:20 ` [Buildroot] [PATCH v3 2/3] board/zynqmp/post-image.sh: use LINUX_DTBS variable Neal Frager via buildroot
@ 2026-03-04 15:20 ` Neal Frager via buildroot
  2026-03-04 18:00 ` [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS Thomas Petazzoni via buildroot
  2 siblings, 0 replies; 5+ messages in thread
From: Neal Frager via buildroot @ 2026-03-04 15:20 UTC (permalink / raw)
  To: buildroot
  Cc: ibai.erkiaga-elorza, luca.ceresoli, yann.morin, brandon.maier,
	fiona.klute, ju.o, Neal Frager, thomas.petazzoni, romain.naour,
	michal.simek, romain.naour

By switching to the LINUX_DTBS variable, the post-image.sh script can now
work regardless of whether a user is using BR2_LINUX_KERNEL_INTREE_DTS_NAME
or the BR2_LINUX_KERNEL_CUSTOM_DTS_DIR for custom hardware. This simplifies
the transition users will make when migrating from a versal evaluation board
to a versal custom platform.

To keep the example post-image script as simple as possible, it assumes that
the first DTB in the LINUX_DTBS list is the one for creating the system.dtb
filename that u-boot will use for booting. Users are free to implement their
own post-image scripts for use cases with multiple DTBs.

Signed-off-by: Neal Frager <neal.frager@amd.com>
---
V1->V2:
- removed unnecessary $BINARIES_DIR from symlink source
V2->V3:
- ignore anything after the first space char of LINUX_DTBS
---
 board/versal/post-image.sh | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/board/versal/post-image.sh b/board/versal/post-image.sh
index 3242e4384a..4428e02fa1 100755
--- a/board/versal/post-image.sh
+++ b/board/versal/post-image.sh
@@ -2,13 +2,8 @@
 
 # By default U-Boot loads DTB from a file named "system.dtb", so
 # let's use a symlink with that name that points to the *first*
-# devicetree listed in the config.
-
-FIRST_DT=$(sed -nr \
-               -e 's|^BR2_LINUX_KERNEL_INTREE_DTS_NAME="(xilinx/)?([-_/[:alnum:]\\.]*).*"$|\2|p' \
-               "${BR2_CONFIG}")
-
-[ -z "${FIRST_DT}" ] || ln -fs "${FIRST_DT}.dtb" "${BINARIES_DIR}/system.dtb"
+# devicetree in the LINUX_DTBS list.
+ln -fs "$(basename ${LINUX_DTBS%% *})" "${BINARIES_DIR}/system.dtb"
 
 BOARD_DIR="$(dirname "$0")"
 
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS
  2026-03-04 15:20 [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS Neal Frager via buildroot
  2026-03-04 15:20 ` [Buildroot] [PATCH v3 2/3] board/zynqmp/post-image.sh: use LINUX_DTBS variable Neal Frager via buildroot
  2026-03-04 15:20 ` [Buildroot] [PATCH v3 3/3] board/versal/post-image.sh: " Neal Frager via buildroot
@ 2026-03-04 18:00 ` Thomas Petazzoni via buildroot
  2026-03-05 10:08   ` Frager, Neal via buildroot
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-03-04 18:00 UTC (permalink / raw)
  To: Neal Frager
  Cc: yann.morin, ibai.erkiaga-elorza, luca.ceresoli, buildroot,
	brandon.maier, fiona.klute, ju.o, romain.naour, michal.simek,
	romain.naour

On Wed, Mar 04, 2026 at 03:20:55PM +0000, Neal Frager wrote:

>  LINUX_DTBS = $(addsuffix .dtb,$(LINUX_DTS_NAME)) $(addsuffix .dtbo,$(LINUX_DTSO_NAMES))
> +# Post-build scripts may need to reference the LINUX_DTBS,
> +# so export it so it is easier to use
> +export LINUX_DTBS

I find this a bit "meh". What about using "make VARS=LINUX_DTBS
printvars" or "make VARS=LINUX_DTBS show-vars" from your post-build
script?

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS
  2026-03-04 18:00 ` [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS Thomas Petazzoni via buildroot
@ 2026-03-05 10:08   ` Frager, Neal via buildroot
  0 siblings, 0 replies; 5+ messages in thread
From: Frager, Neal via buildroot @ 2026-03-05 10:08 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: yann.morin@orange.com, Erkiaga Elorza, Ibai,
	luca.ceresoli@bootlin.com, buildroot@buildroot.org,
	brandon.maier@collins.com, fiona.klute@gmx.de, ju.o@free.fr,
	romain.naour@smile.fr, Simek, Michal, romain.naour@gmail.com

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Thomas,

>  LINUX_DTBS = $(addsuffix .dtb,$(LINUX_DTS_NAME)) $(addsuffix .dtbo,$(LINUX_DTSO_NAMES))
> +# Post-build scripts may need to reference the LINUX_DTBS,
> +# so export it so it is easier to use
> +export LINUX_DTBS

> I find this a bit "meh". What about using "make VARS=LINUX_DTBS
> printvars" or "make VARS=LINUX_DTBS show-vars" from your post-build
> script?

Thanks for the idea!

The following works without the linux.mk export patch:
LINUX_DTBS="$(make --no-print-directory VARS=LINUX_DTBS printvars)"
ln -fs "$(basename ${LINUX_DTBS%% *})" "${BINARIES_DIR}/system.dtb"

Best regards,
Neal Frager
AMD
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2026-03-05 10:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 15:20 [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS Neal Frager via buildroot
2026-03-04 15:20 ` [Buildroot] [PATCH v3 2/3] board/zynqmp/post-image.sh: use LINUX_DTBS variable Neal Frager via buildroot
2026-03-04 15:20 ` [Buildroot] [PATCH v3 3/3] board/versal/post-image.sh: " Neal Frager via buildroot
2026-03-04 18:00 ` [Buildroot] [PATCH v3 1/3] linux/linux.mk: export LINUX_DTBS Thomas Petazzoni via buildroot
2026-03-05 10:08   ` Frager, Neal via buildroot

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