mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] add CONFIG_BAREBOX_MAX_SIZE to check if the size of barebox exceed the target size
Date: Sun, 15 Jan 2012 10:38:15 +0100	[thread overview]
Message-ID: <1326620296-8076-1-git-send-email-plagnioj@jcrosoft.com> (raw)

this 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>
---
 Makefile       |    8 ++++++++
 common/Kconfig |    8 ++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index d8e685e..eeb5b5d 100644
--- a/Makefile
+++ b/Makefile
@@ -659,6 +659,14 @@ OBJCOPYFLAGS_barebox.bin = -O binary
 
 barebox.bin: barebox FORCE
 	$(call if_changed,objcopy)
+	size=`stat -c%s $@`; \
+	max_size=`printf "%d" $(CONFIG_BAREBOX_MAX_SIZE)`; \
+	if [ $$max_size -lt $$size -a \
+	     $$max_size -ne 0 ] ; \
+	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..a034686 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -104,6 +104,14 @@ config TEXT_BASE
 	help
 	  The Address barebox gets linked at.
 
+config BAREBOX_MAX_SIZE
+	prompt "Maximum size of barebox"
+	hex
+	default 0x0
+	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

             reply	other threads:[~2012-01-15  9:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-15  9:38 Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-01-15  9:38 ` [PATCH 2/2] calao/boards: specific BAREBOX_MAX_SIZE to 256KiB Jean-Christophe PLAGNIOL-VILLARD
2012-01-16  9:26 ` [PATCH 1/2] add CONFIG_BAREBOX_MAX_SIZE to check if the size of barebox exceed the target size Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326620296-8076-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox