diff options
-rw-r--r-- | defaultenv/Makefile | 3 | ||||
-rw-r--r-- | scripts/Makefile.lib | 4 | ||||
-rwxr-xr-x | scripts/file-size.sh | 4 | ||||
-rwxr-xr-x | scripts/gen-dtb-s | 4 |
4 files changed, 10 insertions, 5 deletions
diff --git a/defaultenv/Makefile b/defaultenv/Makefile index 950ac29a3c..e030355a40 100644 --- a/defaultenv/Makefile +++ b/defaultenv/Makefile @@ -20,7 +20,8 @@ $(obj)/barebox_default_env: FORCE quiet_cmd_env_h = ENVH $@ cmd_env_h = cat $< | (cd $(obj) && $(objtree)/scripts/bin2c "__aligned(4) default_environment") > $@; \ - echo "static const int default_environment_uncompress_size=`stat -c%s $(obj)/barebox_default_env`;" >> $@ + echo "static const int default_environment_uncompress_size=`${CONFIG_SHELL} \"${srctree}/scripts/file-size.sh\" $(obj)/barebox_default_env`;" >> $@ + $(obj)/barebox_default_env.h: $(obj)/barebox_default_env$(DEFAULT_COMPRESSION_SUFFIX) FORCE $(call if_changed,env_h) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 95eaf522ab..87bff2d296 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -341,7 +341,7 @@ cmd_env=$(srctree)/scripts/genenv $(srctree) $(objtree) $@ $< size_append = printf $(shell \ dec_size=0; \ for F in $1; do \ - fsize=$$(stat -c "%s" $$F); \ + fsize=$$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $$F);\ dec_size=$$(expr $$dec_size + $$fsize); \ done; \ printf "%08x\n" $$dec_size | \ @@ -446,7 +446,7 @@ quiet_cmd_check_size = CHKSIZE $2 # Check size of a file quiet_cmd_check_file_size = CHKFILESIZE $2 cmd_check_file_size = set -e; \ - size=`stat -c%s $2`; \ + size=`${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $2`; \ max_size=`printf "%d" $3`; \ if [ $$size -gt $$max_size ] ; \ then \ diff --git a/scripts/file-size.sh b/scripts/file-size.sh new file mode 100755 index 0000000000..7eb7423416 --- /dev/null +++ b/scripts/file-size.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +set -- $(ls -dn "$1") +printf '%s\n' "$5" diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s index 307b1f6866..b2dd253c27 100755 --- a/scripts/gen-dtb-s +++ b/scripts/gen-dtb-s @@ -55,8 +55,8 @@ lzop -f -9 $dtb -o $dtb.lzo if [ $? != 0 ]; then exit 1 fi -compressed=$(stat $dtb.lzo -c "%s") -uncompressed=$(stat $dtb -c "%s") +compressed=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $dtb.lzo) +uncompressed=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" $dtb) echo ".section .dtbz.rodata.${name},\"a\"" echo ".balign STRUCT_ALIGNMENT" |