9
0
Fork 0

Load PBL into SRAM

This allows to load all the lowlevel init code, including the
uncompressor, inside SRAM and not just the bare init part. This is
useful when pbl is used as a first-stage bootloader but is loaded by an
external firmware.

Signed-off-by: David Vincent <freesilicon@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
David Vincent 2014-02-04 08:53:15 +01:00 committed by Sascha Hauer
parent 4f2f9150b7
commit 34ab8ddd04
3 changed files with 28 additions and 3 deletions

View File

@ -54,6 +54,7 @@ SECTIONS
/DISCARD/ : { *(.ARM.ex*) }
BAREBOX_BARE_INIT_SIZE
BAREBOX_PBL_SIZE
. = ALIGN(4);
.rodata : { *(.rodata*) }

View File

@ -145,13 +145,24 @@ config BAREBOX_MAX_IMAGE_SIZE
help
Define the maximum size of barebox
config BAREBOX_MAX_BARE_INIT_SIZE
prompt "Maximum bare_init size"
config BAREBOX_MAX_PBL_SIZE
depends on PBL_IMAGE
prompt "Maximum pre-bootloader size"
hex
default 0xffffffff
help
On some hardware the ROM code can load the pbl into SRAM, but not
the whole image. This option specifies how big the pbl may get.
config BAREBOX_MAX_BARE_INIT_SIZE
prompt "Maximum bare_init size"
hex
range 0x0 BAREBOX_MAX_PBL_SIZE if LOAD_PBL_SRAM
default BAREBOX_MAX_PBL_SIZE if LOAD_PBL_SRAM
default 0xffffffff
help
Define the maximum size of bare_init
this will allow your bare_init will fit in SRAM as example
this will allow your bare_init to fit in SRAM as example
ARCH can overwrite it via ARCH_BAREBOX_MAX_BARE_INIT_SIZE
config HAVE_CONFIGURABLE_MEMORY_LAYOUT

View File

@ -60,6 +60,13 @@ CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE < CONFIG_BAREBOX_MAX_BARE_INIT_SIZE
#define MAX_BARE_INIT_SIZE CONFIG_BAREBOX_MAX_BARE_INIT_SIZE
#endif
#if defined(CONFIG_ARCH_BAREBOX_MAX_PBL_SIZE) && \
CONFIG_ARCH_BAREBOX_MAX_PBL_SIZE < CONFIG_BAREBOX_MAX_PBL_SIZE
#define MAX_PBL_SIZE CONFIG_ARCH_BAREBOX_MAX_PBL_SIZE
#else
#define MAX_PBL_SIZE CONFIG_BAREBOX_MAX_PBL_SIZE
#endif
#include <linux/stringify.h>
/* use 2 ASSERT because ld can not accept '"size" "10"' format */
#define BAREBOX_BARE_INIT_SIZE \
@ -67,3 +74,9 @@ CONFIG_ARCH_BAREBOX_MAX_BARE_INIT_SIZE < CONFIG_BAREBOX_MAX_BARE_INIT_SIZE
ASSERT(_barebox_bare_init_size < MAX_BARE_INIT_SIZE, "Barebox bare_init size > ") \
ASSERT(_barebox_bare_init_size < MAX_BARE_INIT_SIZE, __stringify(MAX_BARE_INIT_SIZE)) \
#define BAREBOX_PBL_SIZE \
_barebox_pbl_size = __bss_start - _text; \
ASSERT(MAX_BARE_INIT_SIZE <= MAX_PBL_SIZE, "bare_init cannot be bigger than pbl") \
ASSERT(_barebox_pbl_size < MAX_PBL_SIZE, "Barebox pbl size > ") \
ASSERT(_barebox_pbl_size < MAX_PBL_SIZE, __stringify(MAX_PBL_SIZE)) \