Skip to content

Commit

Permalink
build: image: return sizes if check-size fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
adschm committed Aug 3, 2020
1 parent c90db26 commit 1d9542c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/image-commands.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1d9542c

Please sign in to comment.