mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM64: add support for booting a FIT image
@ 2020-02-27 16:07 Lucas Stach
  2020-03-02  7:07 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2020-02-27 16:07 UTC (permalink / raw)
  To: barebox

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>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM64: add support for booting a FIT image
  2020-02-27 16:07 [PATCH] ARM64: add support for booting a FIT image Lucas Stach
@ 2020-03-02  7:07 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2020-03-02  7:07 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Thu, Feb 27, 2020 at 05:07:00PM +0100, Lucas Stach wrote:
> 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>
> ---
>  arch/arm/lib64/armlinux.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-02  7:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27 16:07 [PATCH] ARM64: add support for booting a FIT image Lucas Stach
2020-03-02  7:07 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox