diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-09-14 10:10:24 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-09-15 09:23:43 +0200 |
commit | c9dbd886ef3b05d64bc10551f9fcde267291ef91 (patch) | |
tree | c838d25fc2fe217d1a1dcdb36dbca7925d2782ec /arch/arm/include | |
parent | 5e61dd3fb5506fe647f95deca95d97cced51aeb3 (diff) | |
download | barebox-c9dbd886ef3b05d64bc10551f9fcde267291ef91.tar.gz barebox-c9dbd886ef3b05d64bc10551f9fcde267291ef91.tar.xz |
ARM: Fix calling of arm_mem_barebox_image()
arm_mem_barebox_image() is used to pick a suitable place where to
put the final image to. This is called from both the PBL uncompression
code and also from the final image. To make it work properly it is
crucial that it's called with the same arguments both times. Currently
it is called with the wrong image size from the PBL uncompression code.
The size passed to arm_mem_barebox_image() has to be the size of the
whole uncompressed image including the BSS segment size. The PBL code
calls it with the compressed image size instead and without the BSS
segment. This patch fixes this by reading the uncompressed image size
from the compressed binary (the uncompressed size is appended to the
end of the compressed binary by our compression wrappers). The size
of the BSS segment is unknown though by the PBL uncompression code,
so we introduce a maximum BSS size which is used instead.
The code before this patch worked by accident because the base address
of the final image was aligned down to a 1MiB boundary. The alignment
was sufficient already to make enough space. This breaks though when
the uncompressed image including BSS becomes bigger than 1MiB while
the compressed image is smaller.
Fixes: 65071bd0: arm: Clarify memory layout calculation
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/include')
-rw-r--r-- | arch/arm/include/asm/barebox-arm.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h index 0acdfa3dbc..061296a476 100644 --- a/arch/arm/include/asm/barebox-arm.h +++ b/arch/arm/include/asm/barebox-arm.h @@ -164,6 +164,13 @@ static inline unsigned long arm_mem_barebox_image(unsigned long membase, static void __naked noinline __##name \ (uint32_t arg0, uint32_t arg1, uint32_t arg2) - +/* + * When using compressed images in conjunction with relocatable images + * the PBL code must pick a suitable place where to uncompress the barebox + * image. For doing this the PBL code must know the size of the final + * image including the BSS segment. The BSS size is unknown to the PBL + * code, so define a maximum BSS size here. + */ +#define MAX_BSS_SIZE SZ_1M #endif /* _BAREBOX_ARM_H_ */ |