Skip to contentSkip to conversation

board/freescale/mxs: fix Linux booting

PATCH Applied Giulio Benetti 2 participants 7 messages Jun 24, 2025 – Jul 4, 2025 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board/freescale/mxs: fix Linux booting

Actually DTB_LIST accepts only file and not files with relative path preprended. This leads to have vfat without .dtb files and so Linux doesn't start. Let's fix this by including slash in sed command as done for mxc.

---
 board/freescale/common/mxs/post-image.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/mxs/post-image.sh +1 -1
index 0bfb835c6e..65154fa8e0 100755
@@ -7,7 +7,7 @@
 #
 dtb_list()
 {
-	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
 
 	for dt in $DTB_LIST; do
 		echo -n "\"$dt.dtb\", "
Signature · 6 lines
2.39.5

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

Hi Giulio,

Thanks for the patch! (and good catch!)

Unfortunately, it is not fixing the issue in its current state. See below.

Quoted 21 lines · Giulio Benetti

Actually DTB_LIST accepts only file and not files with relative path preprended. This leads to have vfat without .dtb files and so Linux doesn't start. Let's fix this by including slash in sed command as done for mxc.

---
 board/freescale/common/mxs/post-image.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/mxs/post-image.sh +0 -1
index 0bfb835c6e..65154fa8e0 100755
@@ -7,7 +7,7 @@
 #
 dtb_list()
 {
-	local DTB_LIST="$(sed -n 

's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"

board/freescale/common/mxs/post-image.sh +1 -0
+	local DTB_LIST="$(sed -n 
Quoted 1 line

's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"

With this patch applied, when testing with imx23evk_defconfig, this script generates an error:

sed: -e expression #1, char 17: unknown option to `s'

which is hidden by the subsequent commands succeeding. Maybe it would be better if the script was adding a "set -e" at the beginning?

Then, since the DTS file name can contain a slash "/" character, the sed expression should be rewritten using another character (e.g. "s#...#...#p").

Finally, the DTS file name may contain directories in the Kernel tree, but the file is copied as is in "output/images/". So only the basename should be kept.

Quoted 5 lines
board/freescale/common/mxs/post-image.sh +0 -1
 	for dt in $DTB_LIST; do
 		echo -n "\"$dt.dtb\", "
--

2.39.5

Could you send an updated patch addressing those issues, please?

Best regards,

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

#2 lore raw

PATCH v2 1/1 board/freescale/mxs: fix Linux booting

Actually DTB_LIST accepts only file and not files with relative path preprended. This leads to have vfat without .dtb files and so Linux doesn't start. Let's fix this by including slash in sed command as done for mxc as well as basename in front of $dt.dtb to remove possible useless folders present in the dts path. Let's also add set -e at the top of the script to make it more verbose on error and modify this section according to spellcheck as done for mxc.

---
V1->V2:
* rework by following mxc version for error 'sed: -e expression #1, char 17: unknown option to `s'' and wrong additional .dtb path as pointed by Julien Olivain

---
 board/freescale/common/mxs/post-image.sh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
board/freescale/common/mxs/post-image.sh +8 -4
index 0bfb835c6e..56960eb634 100755
@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
 
+set -e
+
 #
 # dtb_list extracts the list of DTB files from BR2_LINUX_KERNEL_INTREE_DTS_NAME
 # in ${BR_CONFIG}, then prints the corresponding list of file names for the
@@ -7,11 +9,13 @@
 #
 dtb_list()
 {
-	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+        local DTB_LIST
+
+        DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' "${BR2_CONFIG}")"
 
-	for dt in $DTB_LIST; do
-		echo -n "\"$dt.dtb\", "
-	done
+        for dt in $DTB_LIST; do
+                echo -n "\"$(basename "${dt}").dtb\", "
+        done
 }
 
 #
Signature · 6 lines
2.39.5

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
Quoted 9 lines · Giulio Benetti

Actually DTB_LIST accepts only file and not files with relative path preprended. This leads to have vfat without .dtb files and so Linux doesn't start. Let's fix this by including slash in sed command as done for mxc as well as basename in front of $dt.dtb to remove possible useless folders present in the dts path. Let's also add set -e at the top of the script to make it more verbose on error and modify this section according to spellcheck as done for mxc.

Applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Julien Olivain via buildroot

Hi Julien,

Quoted 5 lines · Julien Olivain

Hi Giulio,

Thanks for the patch! (and good catch!)

Unfortunately, it is not fixing the issue in its current state. See below.

had to test better :-/ and...

Quoted 27 lines · Giulio Benetti
Quoted 19 lines

Actually DTB_LIST accepts only file and not files with relative path preprended. This leads to have vfat without .dtb files and so Linux doesn't start. Let's fix this by including slash in sed command as done for mxc.

---
 board/freescale/common/mxs/post-image.sh | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/mxs/post-image.sh +0 -1
index 0bfb835c6e..65154fa8e0 100755
@@ -7,7 +7,7 @@
  #
  dtb_list()
  {
-    local DTB_LIST="$(sed -n 's/ 
Quoted 3 lines

^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})" +    local DTB_LIST="$(sed -n 's/ ^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"

With this patch applied, when testing with imx23evk_defconfig, this script generates an error:

Quoted 4 lines

    sed: -e expression #1, char 17: unknown option to `s'

which is hidden by the subsequent commands succeeding. Maybe it would be better if the script was adding a "set -e" at the beginning?

Added on v2 and...

Quoted 4 lines

Then, since the DTS file name can contain a slash "/" character, the sed expression should be rewritten using another character (e.g. "s#...#...#p").

In mxc they have reworked using double quotes and that seems to do the trick. It works for me now.

Quoted 8 lines

Finally, the DTS file name may contain directories in the Kernel tree, but the file is copied as is in "output/images/". So only the basename should be kept.

Quoted 3 lines

     for dt in $DTB_LIST; do
         echo -n "\"$dt.dtb\", "

Added basename as done in mxc

Quoted 4 lines
Quoted 2 lines
Signature · 1 line
2.39.5

Could you send an updated patch addressing those issues, please?

Just done, let me know if it works for you.

Kind regards

Signature · 9 lines
Giulio Benetti
CEO&CTO@Benetti Engineering sas
https://www.linkedin.com/company/benetti-engineering-sas/
https://www.linkedin.com/in/giulio-benetti-79975951/

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw
In reply to Giulio Benetti

In reply of:

Quoted 6 lines

Actually DTB_LIST accepts only file and not files with relative path preprended. This leads to have vfat without .dtb files and so Linux doesn't start. Let's fix this by including slash in sed command as done for mxc.

Applied to 2025.02.x. Thanks

Quoted 24 lines
---
 board/freescale/common/mxs/post-image.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/mxs/post-image.sh +1 -1
index 0bfb835c6e..65154fa8e0 100755
@@ -7,7 +7,7 @@
 #
 dtb_list()
 {
-	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
 
 	for dt in $DTB_LIST; do
 		echo -n "\"$dt.dtb\", "
Signature · 6 lines
2.39.5

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

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

#6 lore raw
In reply to Giulio Benetti

In reply of:

Quoted 6 lines

Actually DTB_LIST accepts only file and not files with relative path preprended. This leads to have vfat without .dtb files and so Linux doesn't start. Let's fix this by including slash in sed command as done for mxc.

Applied to 2025.05.x. Thanks

Quoted 24 lines
---
 board/freescale/common/mxs/post-image.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/mxs/post-image.sh +1 -1
index 0bfb835c6e..65154fa8e0 100755
@@ -7,7 +7,7 @@
 #
 dtb_list()
 {
-	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
+	local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
 
 	for dt in $DTB_LIST; do
 		echo -n "\"$dt.dtb\", "
Signature · 6 lines
2.39.5

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

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