diff options
author | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-07-29 21:00:12 +0200 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-08-03 10:40:32 +0200 |
commit | 1d9542c50e2c263256446170ffbd29d0e15bb96d (patch) | |
tree | 5d3470fadb432f0aa5aafeed926c5b2c8a5635b2 /include/image-commands.mk | |
parent | c90db26e051e4f0e7cd32333b3bd8c94a13d599a (diff) | |
download | upstream-1d9542c50e2c263256446170ffbd29d0e15bb96d.tar.gz upstream-1d9542c50e2c263256446170ffbd29d0e15bb96d.tar.bz2 upstream-1d9542c50e2c263256446170ffbd29d0e15bb96d.zip |
build: image: return sizes if check-size fails
Instead of just printing a warning that an image is too big, also
print both actual size and limit in the string:
WARNING: Image file somename.bin is too big: 2096101 > 1048576
Since the kernel size is checked via the same function (if
KERNEL_SIZE is specified), this will also apply to the kernel
image size check.
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Diffstat (limited to 'include/image-commands.mk')
-rw-r--r-- | include/image-commands.mk | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/image-commands.mk b/include/image-commands.mk index 9281b91990..8ed705a7f4 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -269,8 +269,10 @@ define Build/xor-image endef define Build/check-size - @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE)))))) -ge "$$(stat -c%s $@)" ] || { \ - echo "WARNING: Image file $@ is too big" >&2; \ + @imagesize="$$(stat -c%s $@)"; \ + limitsize="$$(($(subst k,* 1024,$(subst m, * 1024k,$(if $(1),$(1),$(IMAGE_SIZE))))))"; \ + [ $$limitsize -ge $$imagesize ] || { \ + echo "WARNING: Image file $@ is too big: $$imagesize > $$limitsize" >&2; \ rm -f $@; \ } endef |