mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2 v2] add config to check if the size of barebox exceed the target size
@ 2012-01-16 16:19 Jean-Christophe PLAGNIOL-VILLARD
  2012-01-16 16:19 ` [PATCH 2/2 v2] calao/boards: specify BAREBOX_MAX_IMAGE_SIZE to 256KiB Jean-Christophe PLAGNIOL-VILLARD
  2012-01-17 10:21 ` [PATCH 1/2 v2] add config to check if the size of barebox exceed the target size Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-01-16 16:19 UTC (permalink / raw)
  To: barebox

CONFIG_BAREBOX_MAX_IMAGE_SIZE will allow to detected silent oversize result

if 0x0 the size will not been checked

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
v2:

	change to CONFIG_BAREBOX_MAX_IMAGE_SIZE
	use default as 0xffffffff

Best Regards,
J.
 Makefile       |    7 +++++++
 common/Kconfig |    8 ++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index d8e685e..12fa192 100644
--- a/Makefile
+++ b/Makefile
@@ -659,6 +659,13 @@ OBJCOPYFLAGS_barebox.bin = -O binary
 
 barebox.bin: barebox FORCE
 	$(call if_changed,objcopy)
+	size=`stat -c%s $@`; \
+	max_size=`printf "%d" $(CONFIG_BAREBOX_MAX_IMAGE_SIZE)`; \
+	if [ $$size -gt $$max_size ] ; \
+	then \
+		echo "$@ size $$size > of the maximum size $$max_size"; \
+		exit 1 ; \
+	fi
 
 ifdef CONFIG_X86
 barebox.S: barebox
diff --git a/common/Kconfig b/common/Kconfig
index 382e591..1b47664 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -104,6 +104,14 @@ config TEXT_BASE
 	help
 	  The Address barebox gets linked at.
 
+config BAREBOX_MAX_IMAGE_SIZE
+	prompt "Maximum size of barebox"
+	hex
+	default 0xffffffff
+	help
+	  Define the maximum size of barebox
+	  If 0x0 the size will not been check
+
 config HAVE_CONFIGURABLE_MEMORY_LAYOUT
 	bool
 
-- 
1.7.7


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-17 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-16 16:19 [PATCH 1/2 v2] add config to check if the size of barebox exceed the target size Jean-Christophe PLAGNIOL-VILLARD
2012-01-16 16:19 ` [PATCH 2/2 v2] calao/boards: specify BAREBOX_MAX_IMAGE_SIZE to 256KiB Jean-Christophe PLAGNIOL-VILLARD
2012-01-17 10:21 ` [PATCH 1/2 v2] add config to check if the size of barebox exceed the target size Sascha Hauer
2012-01-17 14:48   ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox