* [Buildroot] [PATCH v5 1/3] board/zynqmp/post-image.sh: add custom hardware support
@ 2026-03-15 15:43 Neal Frager via buildroot
2026-03-15 15:43 ` [Buildroot] [PATCH v5 2/3] board/versal/post-image.sh: " Neal Frager via buildroot
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Neal Frager via buildroot @ 2026-03-15 15:43 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
V3->V4:
- use make print-vars to get LINUX_DTBS variable
V4->V5:
- fixed shellcheck issue
---
board/zynqmp/post-image.sh | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/board/zynqmp/post-image.sh b/board/zynqmp/post-image.sh
index f44b66342d..67b0be65b7 100755
--- a/board/zynqmp/post-image.sh
+++ b/board/zynqmp/post-image.sh
@@ -2,13 +2,9 @@
# 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.
+LINUX_DTBS="$(make --no-print-directory VARS=LINUX_DTBS printvars)"
+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] 7+ messages in thread* [Buildroot] [PATCH v5 2/3] board/versal/post-image.sh: add custom hardware support 2026-03-15 15:43 [Buildroot] [PATCH v5 1/3] board/zynqmp/post-image.sh: add custom hardware support Neal Frager via buildroot @ 2026-03-15 15:43 ` Neal Frager via buildroot 2026-03-17 8:52 ` Luca Ceresoli via buildroot 2026-03-15 15:43 ` [Buildroot] [PATCH v5 3/3] board/versal2/post-image.sh: " Neal Frager via buildroot 2026-03-17 8:52 ` [Buildroot] [PATCH v5 1/3] board/zynqmp/post-image.sh: " Luca Ceresoli via buildroot 2 siblings, 1 reply; 7+ messages in thread From: Neal Frager via buildroot @ 2026-03-15 15:43 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 V3->V4: - use make print-vars to get LINUX_DTBS variable V4->V5: - fixed shellcheck issue --- board/versal/post-image.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/board/versal/post-image.sh b/board/versal/post-image.sh index 3242e4384a..4a810ff15b 100755 --- a/board/versal/post-image.sh +++ b/board/versal/post-image.sh @@ -2,13 +2,9 @@ # 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. +LINUX_DTBS="$(make --no-print-directory VARS=LINUX_DTBS printvars)" +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] 7+ messages in thread
* Re: [Buildroot] [PATCH v5 2/3] board/versal/post-image.sh: add custom hardware support 2026-03-15 15:43 ` [Buildroot] [PATCH v5 2/3] board/versal/post-image.sh: " Neal Frager via buildroot @ 2026-03-17 8:52 ` Luca Ceresoli via buildroot 0 siblings, 0 replies; 7+ messages in thread From: Luca Ceresoli via buildroot @ 2026-03-17 8:52 UTC (permalink / raw) To: Neal Frager, buildroot Cc: ibai.erkiaga-elorza, yann.morin, brandon.maier, fiona.klute, ju.o, thomas.petazzoni, romain.naour, michal.simek, romain.naour On Sun Mar 15, 2026 at 4:43 PM CET, Neal Frager wrote: > 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> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH v5 3/3] board/versal2/post-image.sh: add custom hardware support 2026-03-15 15:43 [Buildroot] [PATCH v5 1/3] board/zynqmp/post-image.sh: add custom hardware support Neal Frager via buildroot 2026-03-15 15:43 ` [Buildroot] [PATCH v5 2/3] board/versal/post-image.sh: " Neal Frager via buildroot @ 2026-03-15 15:43 ` Neal Frager via buildroot 2026-03-17 8:52 ` Luca Ceresoli via buildroot 2026-03-17 8:52 ` [Buildroot] [PATCH v5 1/3] board/zynqmp/post-image.sh: " Luca Ceresoli via buildroot 2 siblings, 1 reply; 7+ messages in thread From: Neal Frager via buildroot @ 2026-03-15 15:43 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 will ultimately need the BR2_LINUX_KERNEL_CUSTOM_DTS_DIR config to import custom dts files for custom versal2 hardware. Improve the post-image.sh to support either the default device tree which comes from u-boot or a custom device tree for custom hardware. 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 or overlays. Signed-off-by: Neal Frager <neal.frager@amd.com> --- V1->V2: - new to patch series V2->V5: - fixed shellcheck issue - merged with zynqmp and versal patch set --- board/versal2/post-image.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/board/versal2/post-image.sh b/board/versal2/post-image.sh index af50909fb1..3037e0a5ab 100755 --- a/board/versal2/post-image.sh +++ b/board/versal2/post-image.sh @@ -1,9 +1,17 @@ #!/bin/sh -# By default U-Boot loads DTB from a file named "system.dtb", and -# with versal2, the Linux DTB is the same as the U-Boot DTB, so -# let's use a symlink since the DTB is the same. -ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb" +# By default U-Boot loads DTB from a file named "system.dtb". +# With versal2, there is no default dts in the Linux kernel tree +# because the default is the same as the u-boot.dtb. This means +# it is necessary to cover two cases, a custom dts or the default. +# The BR2_LINUX_KERNEL_DTS_SUPPORT will only be set for custom dts +# files, so it can be used for checking which case is configured. +if grep -Eq "^BR2_LINUX_KERNEL_DTS_SUPPORT=y$" "${BR2_CONFIG}"; then + LINUX_DTBS="$(make --no-print-directory VARS=LINUX_DTBS printvars)" + ln -fs "$(basename "${LINUX_DTBS%% *}")" "${BINARIES_DIR}/system.dtb" +else + ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb" +fi 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] 7+ messages in thread
* Re: [Buildroot] [PATCH v5 3/3] board/versal2/post-image.sh: add custom hardware support 2026-03-15 15:43 ` [Buildroot] [PATCH v5 3/3] board/versal2/post-image.sh: " Neal Frager via buildroot @ 2026-03-17 8:52 ` Luca Ceresoli via buildroot 2026-03-17 9:20 ` Frager, Neal via buildroot 0 siblings, 1 reply; 7+ messages in thread From: Luca Ceresoli via buildroot @ 2026-03-17 8:52 UTC (permalink / raw) To: Neal Frager, buildroot Cc: ibai.erkiaga-elorza, yann.morin, brandon.maier, fiona.klute, ju.o, thomas.petazzoni, romain.naour, michal.simek, romain.naour On Sun Mar 15, 2026 at 4:43 PM CET, Neal Frager wrote: > Users will ultimately need the BR2_LINUX_KERNEL_CUSTOM_DTS_DIR config to > import custom dts files for custom versal2 hardware. Improve the post-image.sh > to support either the default device tree which comes from u-boot or a > custom device tree for custom hardware. > > 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 or overlays. > > Signed-off-by: Neal Frager <neal.frager@amd.com> > --- > V1->V2: > - new to patch series > V2->V5: > - fixed shellcheck issue > - merged with zynqmp and versal patch set > --- > board/versal2/post-image.sh | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/board/versal2/post-image.sh b/board/versal2/post-image.sh > index af50909fb1..3037e0a5ab 100755 > --- a/board/versal2/post-image.sh > +++ b/board/versal2/post-image.sh > @@ -1,9 +1,17 @@ > #!/bin/sh > > -# By default U-Boot loads DTB from a file named "system.dtb", and > -# with versal2, the Linux DTB is the same as the U-Boot DTB, so > -# let's use a symlink since the DTB is the same. > -ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb" > +# By default U-Boot loads DTB from a file named "system.dtb". > +# With versal2, there is no default dts in the Linux kernel tree > +# because the default is the same as the u-boot.dtb. This means > +# it is necessary to cover two cases, a custom dts or the default. > +# The BR2_LINUX_KERNEL_DTS_SUPPORT will only be set for custom dts > +# files Out of my ignorance, is this assumption always correct? What if the main dtb comes from u-boot but the kernel package is used to build some overlays (and no dtb)? This patch would break such configs, because is would link system.dtb to some dtbo instead of u-boot.dtb. Is this a valid use case in the first place? > , so it can be used for checking which case is configured. > +if grep -Eq "^BR2_LINUX_KERNEL_DTS_SUPPORT=y$" "${BR2_CONFIG}"; then > + LINUX_DTBS="$(make --no-print-directory VARS=LINUX_DTBS printvars)" > + ln -fs "$(basename "${LINUX_DTBS%% *}")" "${BINARIES_DIR}/system.dtb" > +else > + ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb" > +fi Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH v5 3/3] board/versal2/post-image.sh: add custom hardware support 2026-03-17 8:52 ` Luca Ceresoli via buildroot @ 2026-03-17 9:20 ` Frager, Neal via buildroot 0 siblings, 0 replies; 7+ messages in thread From: Frager, Neal via buildroot @ 2026-03-17 9:20 UTC (permalink / raw) To: Luca Ceresoli, buildroot@buildroot.org Cc: Erkiaga Elorza, Ibai, yann.morin@orange.com, brandon.maier@collins.com, fiona.klute@gmx.de, ju.o@free.fr, thomas.petazzoni@bootlin.com, romain.naour@smile.fr, Simek, Michal, romain.naour@gmail.com [AMD Official Use Only - AMD Internal Distribution Only] Hi Luca, > Users will ultimately need the BR2_LINUX_KERNEL_CUSTOM_DTS_DIR config to > import custom dts files for custom versal2 hardware. Improve the post-image.sh > to support either the default device tree which comes from u-boot or a > custom device tree for custom hardware. > > 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 or overlays. > > Signed-off-by: Neal Frager <neal.frager@amd.com> > --- > V1->V2: > - new to patch series > V2->V5: > - fixed shellcheck issue > - merged with zynqmp and versal patch set > --- > board/versal2/post-image.sh | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/board/versal2/post-image.sh b/board/versal2/post-image.sh > index af50909fb1..3037e0a5ab 100755 > --- a/board/versal2/post-image.sh > +++ b/board/versal2/post-image.sh > @@ -1,9 +1,17 @@ > #!/bin/sh > > -# By default U-Boot loads DTB from a file named "system.dtb", and > -# with versal2, the Linux DTB is the same as the U-Boot DTB, so > -# let's use a symlink since the DTB is the same. > -ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb" > +# By default U-Boot loads DTB from a file named "system.dtb". > +# With versal2, there is no default dts in the Linux kernel tree > +# because the default is the same as the u-boot.dtb. This means > +# it is necessary to cover two cases, a custom dts or the default. > +# The BR2_LINUX_KERNEL_DTS_SUPPORT will only be set for custom dts > +# files > Out of my ignorance, is this assumption always correct? What if the main > dtb comes from u-boot but the kernel package is used to build some overlays > (and no dtb)? This patch would break such configs, because is would link > system.dtb to some dtbo instead of u-boot.dtb. > Is this a valid use case in the first place? Yes, I didn't think of this use case. My goal was to try to keep the script as simple as possible, so I was only trying to cover the case where someone migrates from the vek385 to a custom versal2 board where the device tree is different, and not just an overlay on top of the vek385 base dtb which is included with u-boot. Or an overlay on top of a custom u-boot.dtb. In the end, this comes back to the same question for the other patches. Should we improve the script to handle the full list of LINUX_DTBS? In other words, we would assume that we would want to combine any dtbos and create a system.dtb that contains everything in the LINUX_DTBS list, including the original u-boot.dtb in case there are no dtbs in LINUX_DTBS? It would make the script more complex, so is it worth it? > , so it can be used for checking which case is configured. > +if grep -Eq "^BR2_LINUX_KERNEL_DTS_SUPPORT=y$" "${BR2_CONFIG}"; then > + LINUX_DTBS="$(make --no-print-directory VARS=LINUX_DTBS printvars)" > + ln -fs "$(basename "${LINUX_DTBS%% *}")" "${BINARIES_DIR}/system.dtb" > +else > + ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb" > +fi Best regards, Neal Frager AMD _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Buildroot] [PATCH v5 1/3] board/zynqmp/post-image.sh: add custom hardware support 2026-03-15 15:43 [Buildroot] [PATCH v5 1/3] board/zynqmp/post-image.sh: add custom hardware support Neal Frager via buildroot 2026-03-15 15:43 ` [Buildroot] [PATCH v5 2/3] board/versal/post-image.sh: " Neal Frager via buildroot 2026-03-15 15:43 ` [Buildroot] [PATCH v5 3/3] board/versal2/post-image.sh: " Neal Frager via buildroot @ 2026-03-17 8:52 ` Luca Ceresoli via buildroot 2 siblings, 0 replies; 7+ messages in thread From: Luca Ceresoli via buildroot @ 2026-03-17 8:52 UTC (permalink / raw) To: Neal Frager, buildroot Cc: ibai.erkiaga-elorza, yann.morin, brandon.maier, fiona.klute, ju.o, thomas.petazzoni, romain.naour, michal.simek, romain.naour On Sun Mar 15, 2026 at 4:43 PM CET, Neal Frager wrote: > 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 > V3->V4: > - use make print-vars to get LINUX_DTBS variable > V4->V5: > - fixed shellcheck issue > --- > board/zynqmp/post-image.sh | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/board/zynqmp/post-image.sh b/board/zynqmp/post-image.sh > index f44b66342d..67b0be65b7 100755 > --- a/board/zynqmp/post-image.sh > +++ b/board/zynqmp/post-image.sh > @@ -2,13 +2,9 @@ > > # 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. > +LINUX_DTBS="$(make --no-print-directory VARS=LINUX_DTBS printvars)" > +ln -fs "$(basename "${LINUX_DTBS%% *}")" "${BINARIES_DIR}/system.dtb" The whitespace-based string mangling still feels a bit fragile to me, but it should be OK in the practice as I don't think we support paths with spaces. Also there was a concern about what happens in case the first file is a dtbo, but the old code does not support it either so this patch is not breaking anything. dtbo-first-in-the-list support can be added later with more sophisticated scripting if needed. Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-17 9:21 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-03-15 15:43 [Buildroot] [PATCH v5 1/3] board/zynqmp/post-image.sh: add custom hardware support Neal Frager via buildroot 2026-03-15 15:43 ` [Buildroot] [PATCH v5 2/3] board/versal/post-image.sh: " Neal Frager via buildroot 2026-03-17 8:52 ` Luca Ceresoli via buildroot 2026-03-15 15:43 ` [Buildroot] [PATCH v5 3/3] board/versal2/post-image.sh: " Neal Frager via buildroot 2026-03-17 8:52 ` Luca Ceresoli via buildroot 2026-03-17 9:20 ` Frager, Neal via buildroot 2026-03-17 8:52 ` [Buildroot] [PATCH v5 1/3] board/zynqmp/post-image.sh: " Luca Ceresoli via buildroot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox