summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-10-09 15:28:12 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-12-03 09:17:09 +0100
commit5a1a5ed2537d7d12f851f3778707681d6c08d6e8 (patch)
tree730e26cba815bdca0849115b1207ff2dcfe4c52e /arch/arm/cpu
parent4cd223777314233e681c3eef54ead81932d891fc (diff)
downloadbarebox-5a1a5ed2537d7d12f851f3778707681d6c08d6e8.tar.gz
barebox-5a1a5ed2537d7d12f851f3778707681d6c08d6e8.tar.xz
ARM: images: use piggydata
The way we assemble the multi images on ARM is rather complicated and error prone. We currently cat the compressed barebox image behind the PBL executable and need some magic to obtain the size of the payload and also have to do tricks to reliably get a pointer to the compressed image. This patch switches over to compile the compressed payload into the PBL image itself which has proven to work for the single PBL case and for the ARM Linux Kernel aswell. The goal is to unify the single PBL and the multi PBL cases together in the future to get an easier startup path for ARM. This patch has been tested on the i.MX53 QSB, i.MX53 Vincell, Beaglebone black (both MLO and 2nd stage) and a Phytec phyFLEX i.MX6 board. SoCFPGA Arria10 has also be changed slightly with this patch. We used to generate a single image (barebox-socfpga-achilles.img) which was used as xload image and full image. We now instead generate two images: barebox-socfpga-achilles-xload.img and barebox-socfpga-achilles.img, the former loaded by the ROM and the latter loaded by the xload image. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r--arch/arm/cpu/sections.c1
-rw-r--r--arch/arm/cpu/uncompress.c18
2 files changed, 7 insertions, 12 deletions
diff --git a/arch/arm/cpu/sections.c b/arch/arm/cpu/sections.c
index ab08ebf42e..a53236d900 100644
--- a/arch/arm/cpu/sections.c
+++ b/arch/arm/cpu/sections.c
@@ -10,4 +10,3 @@ char __bss_start[0] __attribute__((section(".__bss_start")));
char __bss_stop[0] __attribute__((section(".__bss_stop")));
char __image_start[0] __attribute__((section(".__image_start")));
char __image_end[0] __attribute__((section(".__image_end")));
-uint32_t __image_end_marker[1] __attribute__((section(".__image_end_marker"))) = { 0xdeadbeef };
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index 048bca0c95..be92bda4e8 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -37,6 +37,9 @@
unsigned long free_mem_ptr;
unsigned long free_mem_end_ptr;
+extern unsigned char input_data[];
+extern unsigned char input_data_end[];
+
void __noreturn barebox_multi_pbl_start(unsigned long membase,
unsigned long memsize, void *boarddata)
{
@@ -44,11 +47,11 @@ void __noreturn barebox_multi_pbl_start(unsigned long membase,
void __noreturn (*barebox)(unsigned long, unsigned long, void *);
unsigned long endmem = membase + memsize;
unsigned long barebox_base;
- uint32_t *image_end;
- void *pg_start;
+ void *pg_start, *pg_end;
unsigned long pc = get_pc();
- image_end = (void *)__image_end_marker + global_variable_offset();
+ pg_start = input_data + global_variable_offset();
+ pg_end = input_data_end + global_variable_offset();
if (IS_ENABLED(CONFIG_PBL_RELOCATABLE)) {
/*
@@ -62,14 +65,7 @@ void __noreturn barebox_multi_pbl_start(unsigned long membase,
relocate_to_adr(membase);
}
- /*
- * image_end is the image_end_marker defined above. It is the last location
- * in the executable. Right after the executable the build process adds
- * the size of the appended compressed binary followed by the compressed
- * binary itself.
- */
- pg_start = image_end + 2;
- pg_len = *(image_end + 1);
+ pg_len = pg_end - pg_start;
uncompressed_len = get_unaligned((const u32 *)(pg_start + pg_len - 4));
if (IS_ENABLED(CONFIG_RELOCATABLE))