summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-01-17 15:48:31 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-01-17 18:48:54 +0100
commit064beaa73b4a0704f8e301e43e756d2bb10a674d (patch)
tree29cc6d20534a7426144adc2b597edbd2b1be9b38 /Makefile
parent2610b2a98709ad833e4e9d4aecd52d7b5d822c5a (diff)
downloadbarebox-064beaa73b4a0704f8e301e43e756d2bb10a674d.tar.gz
barebox-064beaa73b4a0704f8e301e43e756d2bb10a674d.tar.xz
add config to check if the size of barebox exceed the target size
CONFIG_BAREBOX_MAX_IMAGE_SIZE will allow to detected silent oversize result Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 11 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index d8e685ec43..5cf49da7aa 100644
--- a/Makefile
+++ b/Makefile
@@ -532,6 +532,16 @@ quiet_cmd_barebox_version = GEN .version
expr 0$$(cat .old_version) + 1 >.version; \
fi; \
+# Check size of a file
+quiet_cmd_check_file_size = CHKSIZE $@
+ cmd_check_file_size = set -e; \
+ size=`stat -c%s $@`; \
+ max_size=`printf "%d" $2`; \
+ if [ $$size -gt $$max_size ] ; \
+ then \
+ echo "$@ size $$size > of the maximum size $$max_size"; \
+ exit 1 ; \
+ fi;
# Generate System.map
quiet_cmd_sysmap = SYSMAP
@@ -659,6 +669,7 @@ OBJCOPYFLAGS_barebox.bin = -O binary
barebox.bin: barebox FORCE
$(call if_changed,objcopy)
+ $(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE))
ifdef CONFIG_X86
barebox.S: barebox