mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] add CONFIG_BAREBOX_MAX_SIZE to check if the size of barebox exceed the target size
@ 2012-01-15  9:38 Jean-Christophe PLAGNIOL-VILLARD
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-01-15  9:38 UTC (permalink / raw)
  To: barebox

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

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

* [PATCH 2/2] calao/boards: specific BAREBOX_MAX_SIZE to 256KiB
  2012-01-15  9:38 [PATCH 1/2] add CONFIG_BAREBOX_MAX_SIZE to check if the size of barebox exceed the target size Jean-Christophe PLAGNIOL-VILLARD
@ 2012-01-15  9:38 ` 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
  1 sibling, 0 replies; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-01-15  9:38 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/configs/tny_a9260_defconfig        |    1 +
 arch/arm/configs/tny_a9263_defconfig        |    1 +
 arch/arm/configs/tny_a9g20_defconfig        |    1 +
 arch/arm/configs/usb_a9260_defconfig        |    1 +
 arch/arm/configs/usb_a9263_128mib_defconfig |    1 +
 arch/arm/configs/usb_a9263_defconfig        |    1 +
 arch/arm/configs/usb_a9g20_128mib_defconfig |    1 +
 arch/arm/configs/usb_a9g20_defconfig        |    1 +
 8 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/configs/tny_a9260_defconfig b/arch/arm/configs/tny_a9260_defconfig
index dbd6ffc..57ff7cb 100644
--- a/arch/arm/configs/tny_a9260_defconfig
+++ b/arch/arm/configs/tny_a9260_defconfig
@@ -3,6 +3,7 @@ CONFIG_MACH_TNY_A9260=y
 CONFIG_AEABI=y
 # CONFIG_CMD_ARM_CPUINFO is not set
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_BAREBOX_MAX_SIZE=0x40000
 CONFIG_EXPERIMENTAL=y
 CONFIG_MALLOC_TLSF=y
 CONFIG_PROMPT="TNY-9260:"
diff --git a/arch/arm/configs/tny_a9263_defconfig b/arch/arm/configs/tny_a9263_defconfig
index e65f4d3..a3ff02e 100644
--- a/arch/arm/configs/tny_a9263_defconfig
+++ b/arch/arm/configs/tny_a9263_defconfig
@@ -3,6 +3,7 @@ CONFIG_MACH_TNY_A9263=y
 CONFIG_AEABI=y
 # CONFIG_CMD_ARM_CPUINFO is not set
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_BAREBOX_MAX_SIZE=0x40000
 CONFIG_EXPERIMENTAL=y
 CONFIG_MALLOC_TLSF=y
 CONFIG_PROMPT="TNY-9263:"
diff --git a/arch/arm/configs/tny_a9g20_defconfig b/arch/arm/configs/tny_a9g20_defconfig
index df82f65..b81b0cf 100644
--- a/arch/arm/configs/tny_a9g20_defconfig
+++ b/arch/arm/configs/tny_a9g20_defconfig
@@ -3,6 +3,7 @@ CONFIG_MACH_TNY_A9G20=y
 CONFIG_AEABI=y
 # CONFIG_CMD_ARM_CPUINFO is not set
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_BAREBOX_MAX_SIZE=0x40000
 CONFIG_EXPERIMENTAL=y
 CONFIG_MALLOC_TLSF=y
 CONFIG_PROMPT="TNY-9G20:"
diff --git a/arch/arm/configs/usb_a9260_defconfig b/arch/arm/configs/usb_a9260_defconfig
index 861c62d..db1f69e 100644
--- a/arch/arm/configs/usb_a9260_defconfig
+++ b/arch/arm/configs/usb_a9260_defconfig
@@ -3,6 +3,7 @@ CONFIG_MACH_USB_A9260=y
 CONFIG_AEABI=y
 # CONFIG_CMD_ARM_CPUINFO is not set
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_BAREBOX_MAX_SIZE=0x40000
 CONFIG_EXPERIMENTAL=y
 CONFIG_PROMPT="USB-9G20:"
 CONFIG_LONGHELP=y
diff --git a/arch/arm/configs/usb_a9263_128mib_defconfig b/arch/arm/configs/usb_a9263_128mib_defconfig
index 2c54743..62d4f57 100644
--- a/arch/arm/configs/usb_a9263_128mib_defconfig
+++ b/arch/arm/configs/usb_a9263_128mib_defconfig
@@ -4,6 +4,7 @@ CONFIG_AEABI=y
 # CONFIG_CMD_ARM_CPUINFO is not set
 CONFIG_AT91_HAVE_SRAM_128M=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_BAREBOX_MAX_SIZE=0x40000
 CONFIG_EXPERIMENTAL=y
 CONFIG_PROMPT="USB-9G20:"
 CONFIG_LONGHELP=y
diff --git a/arch/arm/configs/usb_a9263_defconfig b/arch/arm/configs/usb_a9263_defconfig
index eb9ad9a..92ff247 100644
--- a/arch/arm/configs/usb_a9263_defconfig
+++ b/arch/arm/configs/usb_a9263_defconfig
@@ -3,6 +3,7 @@ CONFIG_MACH_USB_A9263=y
 CONFIG_AEABI=y
 # CONFIG_CMD_ARM_CPUINFO is not set
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_BAREBOX_MAX_SIZE=0x40000
 CONFIG_EXPERIMENTAL=y
 CONFIG_PROMPT="USB-9G20:"
 CONFIG_LONGHELP=y
diff --git a/arch/arm/configs/usb_a9g20_128mib_defconfig b/arch/arm/configs/usb_a9g20_128mib_defconfig
index cb17d71..6349061 100644
--- a/arch/arm/configs/usb_a9g20_128mib_defconfig
+++ b/arch/arm/configs/usb_a9g20_128mib_defconfig
@@ -4,6 +4,7 @@ CONFIG_AEABI=y
 # CONFIG_CMD_ARM_CPUINFO is not set
 CONFIG_AT91_HAVE_SRAM_128M=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_BAREBOX_MAX_SIZE=0x40000
 CONFIG_EXPERIMENTAL=y
 CONFIG_PROMPT="USB-9G20:"
 CONFIG_LONGHELP=y
diff --git a/arch/arm/configs/usb_a9g20_defconfig b/arch/arm/configs/usb_a9g20_defconfig
index edce2cf..f5d67b8 100644
--- a/arch/arm/configs/usb_a9g20_defconfig
+++ b/arch/arm/configs/usb_a9g20_defconfig
@@ -3,6 +3,7 @@ CONFIG_MACH_USB_A9G20=y
 CONFIG_AEABI=y
 # CONFIG_CMD_ARM_CPUINFO is not set
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_BAREBOX_MAX_SIZE=0x40000
 CONFIG_EXPERIMENTAL=y
 CONFIG_PROMPT="USB-9G20:"
 CONFIG_LONGHELP=y
-- 
1.7.7


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

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

* Re: [PATCH 1/2] add CONFIG_BAREBOX_MAX_SIZE to check if the size of barebox exceed the target size
  2012-01-15  9:38 [PATCH 1/2] add CONFIG_BAREBOX_MAX_SIZE to check if the size of barebox exceed the target size Jean-Christophe PLAGNIOL-VILLARD
  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 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2012-01-16  9:26 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sun, Jan 15, 2012 at 10:38:15AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> this will allow to detected silent oversize result

There are different sizes to consider. What you check here for is the
maximum binary image size. Another interesting size is whether the
image + bss fits into SRAM (for example for the OMAP xloader configs).
To avoid confusion I suggest to name this one
CONFIG_BAREBOX_MAX_IMAGE_SIZE.

> 
> if 0x0 the size will not been checked

Why not make the default 0xffffffff, then you don't have to check for
max_size != 0

Sascha

> 
> 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
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

end of thread, other threads:[~2012-01-16  9:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-15  9:38 [PATCH 1/2] add CONFIG_BAREBOX_MAX_SIZE to check if the size of barebox exceed the target size Jean-Christophe PLAGNIOL-VILLARD
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

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