[PATCH] ARM64: add support for booting a FIT image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 arch/arm/lib64/armlinux.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/arm/lib64/armlinux.c b/arch/arm/lib64/armlinux.c
index 31bd987f10db..bcff770793e7 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);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux