summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2020-02-27 17:07:00 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-03-02 08:07:31 +0100
commit50282ed372c847862dd9f5baa12596db25bceb39 (patch)
treefbd33453120aad49af2a51ce20149eea33e5fa93
parent9044ad7c2cf78a2963c9ddc3c4b9bf2054f46e95 (diff)
downloadbarebox-50282ed372c847862dd9f5baa12596db25bceb39.tar.gz
barebox-50282ed372c847862dd9f5baa12596db25bceb39.tar.xz
ARM64: add support for booting a FIT image
Add the image type handler to the ARM64 boot code. The only difference in the boot handling is that we need to look at the FIT loaded OS image header to get the image load and text offsets, as the os_header is the FIT header, not the kernel header. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/lib64/armlinux.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/arm/lib64/armlinux.c b/arch/arm/lib64/armlinux.c
index 31bd987f10..bcff770793 100644
--- a/arch/arm/lib64/armlinux.c
+++ b/arch/arm/lib64/armlinux.c
@@ -33,6 +33,8 @@
static int do_bootm_linux(struct image_data *data)
{
+ const void *kernel_header =
+ data->os_fit ? data->fit_kernel : data->os_header;
void (*fn)(unsigned long dtb, unsigned long x1, unsigned long x2,
unsigned long x3);
resource_size_t start, end;
@@ -41,8 +43,8 @@ static int do_bootm_linux(struct image_data *data)
int ret;
void *fdt;
- text_offset = le64_to_cpup(data->os_header + 8);
- image_size = le64_to_cpup(data->os_header + 16);
+ text_offset = le64_to_cpup(kernel_header + 8);
+ image_size = le64_to_cpup(kernel_header+ 16);
ret = memory_bank_first_find_space(&start, &end);
if (ret)
@@ -101,6 +103,12 @@ static struct image_handler aarch64_linux_handler = {
.filetype = filetype_arm64_linux_image,
};
+static struct image_handler aarch64_fit_handler = {
+ .name = "FIT image",
+ .bootm = do_bootm_linux,
+ .filetype = filetype_oftree,
+};
+
static int do_bootm_barebox(struct image_data *data)
{
void (*fn)(unsigned long x0, unsigned long x1, unsigned long x2,
@@ -144,6 +152,9 @@ static int aarch64_register_image_handler(void)
register_image_handler(&aarch64_linux_handler);
register_image_handler(&aarch64_barebox_handler);
+ if (IS_ENABLED(CONFIG_FITIMAGE))
+ register_image_handler(&aarch64_fit_handler);
+
return 0;
}
late_initcall(aarch64_register_image_handler);