mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] ARM64: add support for booting a FIT image
Date: Thu, 27 Feb 2020 17:07:00 +0100	[thread overview]
Message-ID: <20200227160700.28904-1-l.stach@pengutronix.de> (raw)

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

             reply	other threads:[~2020-02-27 16:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 16:07 Lucas Stach [this message]
2020-03-02  7:07 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200227160700.28904-1-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox