aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Woods2020-01-16 18:04:02 -0800
committerStefano Stabellini2020-01-17 15:32:17 -0800
commitd324dce16bc280c475f4b5381e9b205662654333 (patch)
treebd3b09303b4a4a14abe5fe2be4a2420f4ecde711
parentc1260aac1547c97f31c590bfa384d1418228c49a (diff)
Add robustness to file type checking
Some versions of the file command and Xen will output: xen: Linux kernel ARM boot executable zImage (little-endian) and executables that file doesn't recognize are simply classified as "data." So changing "MS-DOS executable" to "executable" and or'ing that with "data" should increase coverage without making the check useless. Suggested-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Brian Woods <brian.woods@xilinx.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
-rw-r--r--scripts/uboot-script-gen13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index bb9ee36..f17d8ac 100644
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -118,6 +118,13 @@ function check_file_type()
local filename=$1
local type="$2"
+ # if file doesn't know what it is, it outputs data, so include that
+ # since some executables aren't recongnized
+ if [ "$type" = "executable" ]
+ then
+ type="executable\|data"
+ fi
+
file $filename | grep "$type" &> /dev/null
if test $? != 0
then
@@ -232,11 +239,11 @@ uboot_addr=$memaddr
memaddr=$(( $memaddr + $offset ))
memaddr=`printf "0x%X\n" $memaddr`
-check_compressed_file_type $XEN "MS-DOS executable"
+check_compressed_file_type $XEN "executable"
xen_addr=$memaddr
load_file "$XEN"
-check_compressed_file_type $DOM0_KERNEL "MS-DOS executable"
+check_compressed_file_type $DOM0_KERNEL "executable"
dom0_kernel_addr=$memaddr
load_file $DOM0_KERNEL
dom0_kernel_size=$filesize
@@ -254,7 +261,7 @@ fi
i=0
while test $i -lt $NUM_DOMUS
do
- check_compressed_file_type ${DOMU_KERNEL[$i]} "MS-DOS executable"
+ check_compressed_file_type ${DOMU_KERNEL[$i]} "executable"
domU_kernel_addr[$i]=$memaddr
load_file ${DOMU_KERNEL[$i]}
domU_kernel_size[$i]=$filesize