From 742fa575d09272f1e06616fc208a1e08830c8f82 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Wed, 8 Jul 2009 12:09:04 -0700 Subject: [PATCH] fix problems with new image size calculations The build servers have GNU coreutils 5.93, where stat does not output a newline. Ubuntu hardy has GNU coreutils 6.10, where it does. Lacking a newline messes up the summing of the sizes. Fix get-file-size to remove the newline if present, and make the total calculation in assert-max-file-size more robust. Also, if the image was too big, it was not actually making the build fail (because /bin/false was not the last thing called). Fix that so it does. --- core/combo/linux-x86.mk | 2 +- core/definitions.mk | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/combo/linux-x86.mk b/core/combo/linux-x86.mk index 372c63e1d..f466147b9 100644 --- a/core/combo/linux-x86.mk +++ b/core/combo/linux-x86.mk @@ -10,7 +10,7 @@ $(combo_target)AR := $(AR) ifeq ($(combo_target),HOST_) # $(1): The file to check define get-file-size -stat --format "%s" "$(1)" +stat --format "%s" "$(1)" | tr -d '\n' endef endif diff --git a/core/definitions.mk b/core/definitions.mk index 485c2ae7a..e66c6b841 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1558,8 +1558,8 @@ endef # next whole flash block size. define assert-max-file-size $(if $(2), \ - size=$$(for i in $(1); do $(call get-file-size,$$i); done); \ - total=$$(( $$( echo "$$size" | tr '\n' + ; echo 0 ) )); \ + size=$$(for i in $(1); do $(call get-file-size,$$i); echo +; done; echo 0); \ + total=$$(( $$( echo "$$size" ) )); \ printname=$$(echo -n "$(1)" | tr " " +); \ echo "$$printname total size is $$total"; \ img_blocksize=$(call image-size-from-data-size,$(BOARD_FLASH_BLOCK_SIZE)); \ @@ -1570,8 +1570,7 @@ $(if $(2), \ if [ "$$total" -gt "$$maxsize" ]; then \ echo "error: $$printname too large ($$total > [$(2) - $$reserve])"; \ false; \ - fi; \ - if [ "$$total" -gt $$((maxsize - 32768)) ]; then \ + elif [ "$$total" -gt $$((maxsize - 32768)) ]; then \ echo "WARNING: $$printname approaching size limit ($$total now; limit $$maxsize)"; \ fi \ , \