Skip to contentSkip to conversation

board/versal2/post-image.sh: remove incorrect $BINARIES_DIR

PATCH Applied Neal Frager via buildroot 1 participant 6 messages Mar 9 – Mar 20

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 board/versal2/post-image.sh: remove incorrect $BINARIES_DIR

Remove incorrect $BINARIES_DIR reference from the symbolic link creation to make a relative path and not an absolute path.

---
V1->V2:
- Improved commit message

---
 board/versal2/post-image.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/versal2/post-image.sh +1 -1
index 17746271e1..af50909fb1 100755
@@ -3,7 +3,7 @@
 # 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 "${BINARIES_DIR}/u-boot.dtb" "${BINARIES_DIR}/system.dtb"
+ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb"
 
 BOARD_DIR="$(dirname "$0")"
 
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 2/2 board/versal2/post-image.sh: add custom hardware support

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.

---
V1->V2:
- new to patch series

---
 board/versal2/post-image.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
board/versal2/post-image.sh +12 -4
index af50909fb1..dbef33db28 100755
@@ -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")"
 
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v2 2/2] board/versal2/post-image.sh: add custom hardware support

Hello Neal, All,

Le 09/03/2026 à 08:51, Neal Frager a écrit :

Quoted 29 lines

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.

---
V1->V2:
- new to patch series

---
 board/versal2/post-image.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
board/versal2/post-image.sh +0 -4
index af50909fb1..dbef33db28 100755
@@ -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"

board/versal2/post-image.sh line 12

Quoted 10 lines
board/versal2/post-image.sh +9 -0
 
+# 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"

This trigger a shellsheck warning, can you double check?

I'm not sure about this change, LINUX_DTBS may also contain a dtbo. What happen if a devicetree overlay is built?

Best regards,
Romain

board/versal2/post-image.sh line 16

Quoted 6 lines
board/versal2/post-image.sh +3 -0
+else
+	ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb"
+fi
 
 BOARD_DIR="$(dirname "$0")"

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Re: [Buildroot] [PATCH v2 2/2] board/versal2/post-image.sh: add custom hardware support

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Romain,

Quoted 40 lines

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.

---
V1->V2:
- new to patch series

---
 board/versal2/post-image.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
board/versal2/post-image.sh +9 -4
index af50909fb1..dbef33db28 100755
@@ -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"
 
Quoted 1 line

This trigger a shellsheck warning, can you double check?

I fixed the shellcheck issue and will submit a new version. Thanks for catching that!

Quoted 2 lines

I'm not sure about this change, LINUX_DTBS may also contain a dtbo. What happen if a devicetree overlay is built?

Yes, I thought about the dtbo issue with LINUX_DTBS, but I am not sure how to handle it. I can imagine users may want to apply the overlay immediately and build a system.dtb that includes their dtb with the dtbo included. I can also see the use case of wanting to put the dtbo in the target file system, such that it can be loaded and unloaded at run-time.

Since I do not want to assume how the user may want to load additional dtbs or overlays, I thought it was best to keep the solution as simple as possible. In other words, the solution will assume that the first dtb in LINUX_DTBS will be used for the system.dtb for booting. It is then up to the user how they wish to load additional dtbs or overlays after boot.

Best regards,
Neal Frager
AMD

board/versal2/post-image.sh line 16

Quoted 6 lines
board/versal2/post-image.sh +3 -0
+else
+     ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb"
+fi
 
 BOARD_DIR="$(dirname "$0")"

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Neal Frager via buildroot

Hello Neal, All,

Le 09/03/2026 à 08:51, Neal Frager a écrit :

Quoted 5 lines

Remove incorrect $BINARIES_DIR reference from the symbolic link creation to make a relative path and not an absolute path.

Applied to master, thanks.

Best regards,
Romain

Quoted 12 lines

---
V1->V2:
- Improved commit message

---
 board/versal2/post-image.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/versal2/post-image.sh +0 -0
index 17746271e1..af50909fb1 100755

board/versal2/post-image.sh line 9

Quoted 8 lines
board/versal2/post-image.sh +1 -1
@@ -3,7 +3,7 @@
 # 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 "${BINARIES_DIR}/u-boot.dtb" "${BINARIES_DIR}/system.dtb"
+ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb"
 
 BOARD_DIR="$(dirname "$0")"
 

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw
In reply to Neal Frager via buildroot

In reply of:

Quoted 5 lines

Remove incorrect $BINARIES_DIR reference from the symbolic link creation to make a relative path and not an absolute path.

Applied to 2026.02.x. Thanks

Quoted 27 lines

---
V1->V2:
- Improved commit message

---
 board/versal2/post-image.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/versal2/post-image.sh +1 -1
index 17746271e1..af50909fb1 100755
@@ -3,7 +3,7 @@
 # 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 "${BINARIES_DIR}/u-boot.dtb" "${BINARIES_DIR}/system.dtb"
+ln -fs "u-boot.dtb" "${BINARIES_DIR}/system.dtb"
 
 BOARD_DIR="$(dirname "$0")"
 
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot