diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-03-08 20:32:14 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-03-22 10:16:45 +0100 |
commit | dd73d94f47712d900f2e9b6531c9f6a061176b01 (patch) | |
tree | c0b8a401ef59c8fe2ad9b3ede26a6379fb9f7738 /arch/arm/cpu | |
parent | a1cbfb3335213f76d2000c989fa8599933cf75ac (diff) | |
download | barebox-dd73d94f47712d900f2e9b6531c9f6a061176b01.tar.gz barebox-dd73d94f47712d900f2e9b6531c9f6a061176b01.tar.xz |
ARM64: board-dt-2nd: adopt kernel image header
The ARM64 generic DT image is meant to be interchangeable with a
kernel image to aid in debugging and testing. To achieve this, it
reuses an externally passed device tree in x0, just like Linux does.
The ARM barebox image format used however imposes some limitations:
- Commands verifying the header before boot, like U-Boot's booti
won't boot the barebox image
- The barebox image is not fully relocatable. It has the implicit
assumption that the barebox stack can grow into the memory space
preceding the barebox image while the /memory node is parsed
from the FDT.
Adopting the Linux ARM64 header solves both issues. booti won't be
able to tell us apart and we can specify an image load offset to
reserve a stack space that won't interfere with anything else.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r-- | arch/arm/cpu/board-dt-2nd-aarch64.S | 26 | ||||
-rw-r--r-- | arch/arm/cpu/board-dt-2nd.c | 4 |
2 files changed, 23 insertions, 7 deletions
diff --git a/arch/arm/cpu/board-dt-2nd-aarch64.S b/arch/arm/cpu/board-dt-2nd-aarch64.S index 0540a1690d..d2c9f132ce 100644 --- a/arch/arm/cpu/board-dt-2nd-aarch64.S +++ b/arch/arm/cpu/board-dt-2nd-aarch64.S @@ -1,11 +1,29 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include <linux/linkage.h> #include <asm/barebox-arm64.h> +#include <asm/image.h> -ENTRY_PROC(start_dt_2nd) - adr x1, stack +#define IMAGE_FLAGS \ + (ARM64_IMAGE_FLAG_PAGE_SIZE_4K << ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT) | \ + (ARM64_IMAGE_FLAG_PHYS_BASE << ARM64_IMAGE_FLAG_PHYS_BASE_SHIFT) + +.section .text_head_entry_start_dt_2nd +ENTRY("start_dt_2nd") + adr x1, 0 /* code0 */ + b 2f /* code1 */ + .xword 0x80000 /* Image load offset */ + .xword _barebox_image_size /* Effective Image size */ + .xword IMAGE_FLAGS /* Kernel flags */ + .xword 0 /* reserved */ + .xword 0 /* reserved */ + .xword 0 /* reserved */ + .ascii ARM64_IMAGE_MAGIC /* magic number */ + .int 0 /* reserved (PE-COFF offset) */ + .asciz "barebox" /* unused for now */ +2: mov sp, x1 + /* Stack now grows into the 0x80000 image load offset specified + * above. This is more than enough until FDT /memory is decoded. + */ b dt_2nd_aarch64 -.word 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 -stack: ENTRY_PROC_END(start_dt_2nd) diff --git a/arch/arm/cpu/board-dt-2nd.c b/arch/arm/cpu/board-dt-2nd.c index bb13180785..6f6f535918 100644 --- a/arch/arm/cpu/board-dt-2nd.c +++ b/arch/arm/cpu/board-dt-2nd.c @@ -29,9 +29,7 @@ void dt_2nd_aarch64(void *fdt); void dt_2nd_aarch64(void *fdt) { - unsigned long image_start = (unsigned long)_text + global_variable_offset(); - - arm_setup_stack(image_start); + /* entry point already set up stack */ relocate_to_current_adr(); setup_c(); |