imx: mkimage_fit_atf: fix file size reporting
authorTim Harvey <tharvey@gateworks.com>
Wed, 7 Apr 2021 04:04:09 +0000 (21:04 -0700)
committerStefano Babic <sbabic@denx.de>
Sun, 2 May 2021 10:46:54 +0000 (12:46 +0200)
instead using ls and awk to determine file size use stat instead.
This fixes an invalid size reporting for user or group names that have
spaces in them.

This adds a dependency on the stat application which is part of
the coreutils package which also includes ls.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
arch/arm/mach-imx/mkimage_fit_atf.sh

index fe12b7b..2a17968 100755 (executable)
@@ -16,7 +16,7 @@ if [ ! -f $BL31 ]; then
        exit 0
 else
        echo "$BL31 size: " >&2
-       ls -lct $BL31 | awk '{print $5}' >&2
+       stat -c %s $BL31 >&2
 fi
 
 BL32="tee.bin"
@@ -26,7 +26,7 @@ if [ ! -f $BL32 ]; then
 else
        echo "Building with TEE support, make sure your $BL31 is compiled with spd. If you do not want tee, please delete $BL31" >&2
        echo "$BL32 size: " >&2
-       ls -lct $BL32 | awk '{print $5}' >&2
+       stat -c %s $BL32 >&2
 fi
 
 BL33="u-boot-nodtb.bin"
@@ -36,13 +36,13 @@ if [ ! -f $BL33 ]; then
        exit 0
 else
        echo "u-boot-nodtb.bin size: " >&2
-       ls -lct u-boot-nodtb.bin | awk '{print $5}' >&2
+       stat -c %s u-boot-nodtb.bin >&2
 fi
 
 for dtname in $*
 do
        echo "$dtname size: " >&2
-       ls -lct $dtname | awk '{print $5}' >&2
+       stat -c %s $dtname >&2
 done