From b16e14a220fcab19e3145328057e7188f00b6a17 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Sat, 11 Nov 2023 04:29:26 -0800 Subject: image: use helper function for size units Add the make function 'exp_units' for helping evaluate k/m/g size units in expressions, and use this to consistently replace many ad hoc substitutions like '$(subst k,* 1024,$(subst m, * 1024k,$(IMAGE_SIZE)))' in makefiles. Signed-off-by: Tony Ambardar --- target/linux/ath79/image/generic.mk | 2 +- target/linux/ath79/image/nand.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'target/linux/ath79/image') diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index e435806c7b..68c4105561 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -85,7 +85,7 @@ define Build/mkmylofw_16m let \ size="$$(stat -c%s $@)" \ - pad="$(subst k,* 1024,$(BLOCKSIZE))" \ + pad="$(call exp_units,$(BLOCKSIZE))" \ pad="(pad - (size % pad)) % pad" \ newsize='size + pad' ; \ [ $$newsize -lt $$((0x660000)) ] && newsize=0x660000 ; \ diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 5c9e190e19..bf2b1a1f8a 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -32,7 +32,7 @@ endef define Build/zyxel-factory let \ - maxsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \ + maxsize="$(call exp_units,$(RAS_ROOTFS_SIZE))"; \ let size="$$(stat -c%s $@)"; \ if [ $$size -lt $$maxsize ]; then \ $(STAGING_DIR_HOST)/bin/mkrasimage \ -- cgit v1.2.3