Skip to contentSkip to conversation

uboot-script-gen: fix arm64 xen u-boot image generation

ImageBuilder Grygorii Strashko 3 participants 6 messages Apr 14, 2025 – Apr 17, 2025

lore
Share & tools
lore
#0 lore raw

From: Grygorii Strashko <[email protected]>

The current code in generate_uboot_images() does not detect arm64 properly and always generates ARM u-boot image. This causes Xen boot issues.

Fix it by searching for "ARM64" for AArch64 binary detection.

- mkimage -l xen.ub
Before:
Image Type: ARM Linux Kernel Image (uncompressed)

After:
Image Type: AArch64 Linux Kernel Image (uncompressed)

---
 scripts/uboot-script-gen | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/uboot-script-gen +3 -3
index a9f698f00fd1..c4d26caf5e0e 100755
@@ -815,13 +815,13 @@ function linux_config()
 
 generate_uboot_images()
 {
-    local arch=$(file -L $XEN | grep "ARM")
+    local arch=$(file -L $XEN | grep -o "ARM64")
 
     if test "$arch"
     then
-        arch=arm
-    else
         arch=arm64
+    else
+        arch=arm
     fi
 
     mkimage -A $arch -T kernel -C none -a $memaddr -e $memaddr -d $XEN "$XEN".ub
Signature · 1 line
2.34.1
#1 lore raw
Quoted 24 lines · Grygorii Strashko

From: Grygorii Strashko <[email protected]>

The current code in generate_uboot_images() does not detect arm64 properly and always generates ARM u-boot image. This causes Xen boot issues.

Fix it by searching for "ARM64" for AArch64 binary detection.

- mkimage -l xen.ub
Before:
Image Type: ARM Linux Kernel Image (uncompressed)

After:
Image Type: AArch64 Linux Kernel Image (uncompressed)

---
 scripts/uboot-script-gen | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/uboot-script-gen +0 -0
index a9f698f00fd1..c4d26caf5e0e 100755

scripts/uboot-script-gen function linux_config() · line 818

Quoted 5 lines
scripts/uboot-script-gen +1 -1
@@ -815,13 +815,13 @@ function linux_config()
 
 generate_uboot_images()
 {
-    local arch=$(file -L $XEN | grep "ARM")
+    local arch=$(file -L $XEN | grep -o "ARM64")

My file -L gives:

for arm32: ARM OpenFirmware [...]
for arm64: Aarch64

So the ARM64 grep wouldn't work as intended. Is the version of `file' that you are using really printing ARM64? If so, we can do:

file -L $XEN | grep -E 'ARM64|Aarch64'

Quoted 13 lines
scripts/uboot-script-gen +2 -2
     if test "$arch"
     then
-        arch=arm
-    else
         arch=arm64
+    else
+        arch=arm
     fi
 
     mkimage -A $arch -T kernel -C none -a $memaddr -e $memaddr -d $XEN "$XEN".ub
Signature · 1 line
2.34.1
#2 lore raw
Quoted 33 lines · Stefano Stabellini
Quoted 24 lines · Grygorii Strashko

From: Grygorii Strashko <[email protected]>

The current code in generate_uboot_images() does not detect arm64 properly and always generates ARM u-boot image. This causes Xen boot issues.

Fix it by searching for "ARM64" for AArch64 binary detection.

- mkimage -l xen.ub
Before:
Image Type: ARM Linux Kernel Image (uncompressed)

After:
Image Type: AArch64 Linux Kernel Image (uncompressed)

---
  scripts/uboot-script-gen | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
scripts/uboot-script-gen +0 -0
index a9f698f00fd1..c4d26caf5e0e 100755

scripts/uboot-script-gen function linux_config() · line 818

Quoted 5 lines
scripts/uboot-script-gen +1 -1
@@ -815,13 +815,13 @@ function linux_config()
 
  generate_uboot_images()
  {
-    local arch=$(file -L $XEN | grep "ARM")
+    local arch=$(file -L $XEN | grep -o "ARM64")

My file -L gives:

Quoted 5 lines

for arm32: ARM OpenFirmware [...]
for arm64: Aarch64

So the ARM64 grep wouldn't work as intended. Is the version of `file' that you are using really printing ARM64?

Hm, yes.

file -L xen
xen: Linux kernel ARM64 boot executable Image, little-endian, 4K pages

file -v
file-5.41

u-boot boot command:

	 bootm 0x4EA00000 - 0x4EE00000

If so, we can do:

Quoted 2 lines
   file -L $XEN | grep -E 'ARM64|Aarch64'

sure. I'll update.

Quoted 15 lines
Quoted 15 lines
scripts/uboot-script-gen +2 -2
      if test "$arch"
      then
-        arch=arm
-    else
          arch=arm64
+    else
+        arch=arm
      fi
 
      mkimage -A $arch -T kernel -C none -a $memaddr -e $memaddr -d $XEN "$XEN".ub
Signature · 1 line
2.34.1
Signature · 2 lines
Best regards,
-grygorii
#3 lore raw
Quoted 51 lines · Grygorii Strashko
Quoted 33 lines · Stefano Stabellini
Quoted 24 lines · Grygorii Strashko

From: Grygorii Strashko <[email protected]>

The current code in generate_uboot_images() does not detect arm64 properly and always generates ARM u-boot image. This causes Xen boot issues.

Fix it by searching for "ARM64" for AArch64 binary detection.

- mkimage -l xen.ub
Before:
Image Type: ARM Linux Kernel Image (uncompressed)

After:
Image Type: AArch64 Linux Kernel Image (uncompressed)

---
  scripts/uboot-script-gen | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
scripts/uboot-script-gen +0 -0
index a9f698f00fd1..c4d26caf5e0e 100755

scripts/uboot-script-gen function linux_config() · line 818

Quoted 5 lines
scripts/uboot-script-gen +1 -1
@@ -815,13 +815,13 @@ function linux_config()
 
  generate_uboot_images()
  {
-    local arch=$(file -L $XEN | grep "ARM")
+    local arch=$(file -L $XEN | grep -o "ARM64")

My file -L gives:

Quoted 5 lines

for arm32: ARM OpenFirmware [...]
for arm64: Aarch64

So the ARM64 grep wouldn't work as intended. Is the version of `file' that you are using really printing ARM64?

Hm, yes.

file -L xen
xen: Linux kernel ARM64 boot executable Image, little-endian, 4K pages

file -v
file-5.41

u-boot boot command:

Quoted 8 lines
	 bootm 0x4EA00000 - 0x4EE00000

If so, we can do:

Quoted 2 lines
   file -L $XEN | grep -E 'ARM64|Aarch64'

sure. I'll update.

Missing escape? I think it's needed even with single quotes.

file -L $XEN | grep -E 'ARM64\|Aarch64'

Cheers,
Alejandro

#4 lore raw
Quoted 57 lines · Alejandro Vallejo
Quoted 56 lines · Grygorii Strashko
Quoted 33 lines · Stefano Stabellini
Quoted 24 lines · Grygorii Strashko

From: Grygorii Strashko <[email protected]>

The current code in generate_uboot_images() does not detect arm64 properly and always generates ARM u-boot image. This causes Xen boot issues.

Fix it by searching for "ARM64" for AArch64 binary detection.

- mkimage -l xen.ub
Before:
Image Type: ARM Linux Kernel Image (uncompressed)

After:
Image Type: AArch64 Linux Kernel Image (uncompressed)

---
   scripts/uboot-script-gen | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)
scripts/uboot-script-gen +0 -0
index a9f698f00fd1..c4d26caf5e0e 100755

scripts/uboot-script-gen function linux_config() · line 818

Quoted 5 lines
scripts/uboot-script-gen +1 -1
@@ -815,13 +815,13 @@ function linux_config()
 
   generate_uboot_images()
   {
-    local arch=$(file -L $XEN | grep "ARM")
+    local arch=$(file -L $XEN | grep -o "ARM64")

My file -L gives:

Quoted 5 lines

for arm32: ARM OpenFirmware [...]
for arm64: Aarch64

So the ARM64 grep wouldn't work as intended. Is the version of `file' that you are using really printing ARM64?

Hm, yes.

file -L xen
xen: Linux kernel ARM64 boot executable Image, little-endian, 4K pages

file -v
file-5.41

u-boot boot command:

	 bootm 0x4EA00000 - 0x4EE00000

If so, we can do:

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
    file -L $XEN | grep -E 'ARM64|Aarch64'

sure. I'll update.

Missing escape? I think it's needed even with single quotes.

   file -L $XEN | grep -E 'ARM64\|Aarch64'

No. It's extended regular expressions ("-E") no need for escape. Also it works with both '' and "".

Signature · 2 lines
Best regards,
-grygorii
#5 lore raw
Quoted 62 lines · Grygorii Strashko
Quoted 59 lines · Alejandro Vallejo
Quoted 58 lines · Grygorii Strashko
Quoted 33 lines · Stefano Stabellini
Quoted 24 lines · Grygorii Strashko

From: Grygorii Strashko <[email protected]>

The current code in generate_uboot_images() does not detect arm64 properly and always generates ARM u-boot image. This causes Xen boot issues.

Fix it by searching for "ARM64" for AArch64 binary detection.

- mkimage -l xen.ub
Before:
Image Type: ARM Linux Kernel Image (uncompressed)

After:
Image Type: AArch64 Linux Kernel Image (uncompressed)

---
   scripts/uboot-script-gen | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)
scripts/uboot-script-gen +0 -0
index a9f698f00fd1..c4d26caf5e0e 100755

scripts/uboot-script-gen function linux_config() · line 818

Quoted 5 lines
scripts/uboot-script-gen +1 -1
@@ -815,13 +815,13 @@ function linux_config()
 
   generate_uboot_images()
   {
-    local arch=$(file -L $XEN | grep "ARM")
+    local arch=$(file -L $XEN | grep -o "ARM64")

My file -L gives:

Quoted 5 lines

for arm32: ARM OpenFirmware [...]
for arm64: Aarch64

So the ARM64 grep wouldn't work as intended. Is the version of `file' that you are using really printing ARM64?

Hm, yes.

file -L xen
xen: Linux kernel ARM64 boot executable Image, little-endian, 4K pages

file -v
file-5.41

u-boot boot command:

	 bootm 0x4EA00000 - 0x4EE00000

If so, we can do:

Quoted 2 lines
    file -L $XEN | grep -E 'ARM64|Aarch64'
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

sure. I'll update.

Missing escape? I think it's needed even with single quotes.

   file -L $XEN | grep -E 'ARM64\|Aarch64'

No. It's extended regular expressions ("-E") no need for escape. Also it works with both '' and "".

Ah, fair enough. My brain escaped the -E :)

Cheers,
Alejandro