diff mbox series

[ImageBuilder,1/5] uboot-script-gen: Update to deal with uImage which is not executable

Message ID 20240417120741.2453431-2-olekstysh@gmail.com (mailing list archive)
State New
Headers show
Series Misc updates for the dom0less support | expand

Commit Message

Oleksandr Tyshchenko April 17, 2024, 12:07 p.m. UTC
From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

uImage is the Image that has a U-Boot wrapper, it doesn't contain
"executable" string which subsequent "file" command is looking for
when inspecting it.

Below the proof:

otyshchenko@EPUAKYIW03DD:~/work/xen_tests/input$ file -L binaries/uImage.gz
binaries/uImage.gz: u-boot legacy uImage, Linux Kernel Image, Linux/ARM 64-bit,
OS Kernel Image (gzip), 9822180 bytes, Fri Sep 29 15:39:42 2023, Load Address: 0X40000000,
Entry Point: 0X40000000, Header CRC: 0XE1EF21BF, Data CRC: 0XC418025

otyshchenko@EPUAKYIW03DD:~/work/xen_tests/input$ file -L binaries/uImage
binaries/uImage: u-boot legacy uImage, Linux Kernel Image, Linux/ARM 64-bit,
OS Kernel Image (Not compressed), 23269888 bytes, Fri Sep 29 15:40:19 2023,
Load Address: 0X40000000, Entry Point: 0X40000000, Header CRC: 0XA0B7D051,
Data CRC: 0X42083F51

Suggested-by: Stefano Stabellini <stefano.stabellini@amd.com>
Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
---
 scripts/uboot-script-gen | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Michal Orzel April 17, 2024, 12:26 p.m. UTC | #1
On 17/04/2024 14:07, Oleksandr Tyshchenko wrote:
> 
> 
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> 
> uImage is the Image that has a U-Boot wrapper, it doesn't contain
> "executable" string which subsequent "file" command is looking for
> when inspecting it.
> 
> Below the proof:
> 
> otyshchenko@EPUAKYIW03DD:~/work/xen_tests/input$ file -L binaries/uImage.gz
> binaries/uImage.gz: u-boot legacy uImage, Linux Kernel Image, Linux/ARM 64-bit,
> OS Kernel Image (gzip), 9822180 bytes, Fri Sep 29 15:39:42 2023, Load Address: 0X40000000,
> Entry Point: 0X40000000, Header CRC: 0XE1EF21BF, Data CRC: 0XC418025
> 
> otyshchenko@EPUAKYIW03DD:~/work/xen_tests/input$ file -L binaries/uImage
> binaries/uImage: u-boot legacy uImage, Linux Kernel Image, Linux/ARM 64-bit,
> OS Kernel Image (Not compressed), 23269888 bytes, Fri Sep 29 15:40:19 2023,
> Load Address: 0X40000000, Entry Point: 0X40000000, Header CRC: 0XA0B7D051,
> Data CRC: 0X42083F51
> 
> Suggested-by: Stefano Stabellini <stefano.stabellini@amd.com>
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal
diff mbox series

Patch

diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index 3cc6b47..7cb8c6d 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -505,9 +505,9 @@  function check_file_type()
 
     # if file doesn't know what it is, it outputs data, so include that
     # since some executables aren't recongnized
-    if [ "$type" = "executable" ]
+    if [[ "$type" = "executable"* ]]
     then
-        type="executable\|data\|ARM OpenFirmware"
+        type="$type\|data\|ARM OpenFirmware"
     # file in older distros (ex: RHEL 7.4) just output data for device
     # tree blobs
     elif [ "$type" = "Device Tree Blob" ]
@@ -712,7 +712,7 @@  xen_file_loading()
 {
     if test "$DOM0_KERNEL"
     then
-        check_compressed_file_type $DOM0_KERNEL "executable"
+        check_compressed_file_type $DOM0_KERNEL "executable\|uImage"
         dom0_kernel_addr=$memaddr
         load_file $DOM0_KERNEL "dom0_linux"
         dom0_kernel_size=$filesize
@@ -747,7 +747,7 @@  xen_file_loading()
             cleanup_and_return_err
         fi
 
-        check_compressed_file_type ${DOMU_KERNEL[$i]} "executable"
+        check_compressed_file_type ${DOMU_KERNEL[$i]} "executable\|uImage"
         domU_kernel_addr[$i]=$memaddr
         load_file ${DOMU_KERNEL[$i]} "domU${i}_kernel"
         domU_kernel_size[$i]=$filesize