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/include/asm/image.h | |
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/include/asm/image.h')
-rw-r--r-- | arch/arm/include/asm/image.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/arm/include/asm/image.h b/arch/arm/include/asm/image.h new file mode 100644 index 0000000000..c2b13213c7 --- /dev/null +++ b/arch/arm/include/asm/image.h @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __ASM_IMAGE_H +#define __ASM_IMAGE_H + +#define ARM64_IMAGE_MAGIC "ARM\x64" + +#define ARM64_IMAGE_FLAG_BE_SHIFT 0 +#define ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT (ARM64_IMAGE_FLAG_BE_SHIFT + 1) +#define ARM64_IMAGE_FLAG_PHYS_BASE_SHIFT \ + (ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT + 2) +#define ARM64_IMAGE_FLAG_BE_MASK 0x1 +#define ARM64_IMAGE_FLAG_PAGE_SIZE_MASK 0x3 +#define ARM64_IMAGE_FLAG_PHYS_BASE_MASK 0x1 + +#define ARM64_IMAGE_FLAG_LE 0 +#define ARM64_IMAGE_FLAG_BE 1 +#define ARM64_IMAGE_FLAG_PAGE_SIZE_4K 1 +#define ARM64_IMAGE_FLAG_PAGE_SIZE_16K 2 +#define ARM64_IMAGE_FLAG_PAGE_SIZE_64K 3 +#define ARM64_IMAGE_FLAG_PHYS_BASE 1 + +#ifndef __ASSEMBLY__ + +#define arm64_image_flag_field(flags, field) \ + (((flags) >> field##_SHIFT) & field##_MASK) + +/* + * struct arm64_image_header - arm64 kernel image header + * See Documentation/arm64/booting.rst for details + * + * @code0: Executable code, or + * @mz_header alternatively used for part of MZ header + * @code1: Executable code + * @text_offset: Image load offset + * @image_size: Effective Image size + * @flags: kernel flags + * @reserved: reserved + * @magic: Magic number + * @reserved5: reserved, or + * @pe_header: alternatively used for PE COFF offset + */ + +struct arm64_image_header { + __le32 code0; + __le32 code1; + __le64 text_offset; + __le64 image_size; + __le64 flags; + __le64 res2; + __le64 res3; + __le64 res4; + __le32 magic; + __le32 res5; +}; + +#endif /* __ASSEMBLY__ */ + +#endif /* __ASM_IMAGE_H */ |