[Buildroot] [PATCH v5 3/3] board/versal2/post-image.sh: add custom hardware support
Neal Frager
neal.frager at amd.com
Sun Mar 15 15:43:43 UTC 2026
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 at 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
More information about the buildroot
mailing list