From: Michael Trimarchi <michael@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH V2] common: image-fdt: support dts from the second address of android image
Date: Mon, 13 Jun 2016 21:39:28 +0200 [thread overview]
Message-ID: <20160613193922.GA29401@panicking> (raw)
In-Reply-To: <20160613185138.GA15319@panicking>
We can support dts load from the second address of android image.
This let us to boot board (aka freescale)
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
common/image-android.c | 21 +++++++++++++++++++++
common/image-fdt.c | 12 ++++++++++++
include/image.h | 2 ++
3 files changed, 35 insertions(+)
diff --git a/common/image-android.c b/common/image-android.c
index ee03b96..9701acd 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -146,6 +146,27 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
return 0;
}
+int android_image_get_dts(const struct andr_img_hdr *hdr,
+ ulong *dts_data, ulong *dts_len)
+{
+ if (!hdr->second_size) {
+ *dts_data = *dts_len = 0;
+ return -1;
+ }
+
+ printf("Dts load addr 0x%08x size %u KiB\n",
+ hdr->second_addr, DIV_ROUND_UP(hdr->second_size, 1024));
+
+ *dts_data = (unsigned long)hdr;
+ *dts_data += hdr->page_size;
+ *dts_data += ALIGN(hdr->kernel_size, hdr->page_size);
+ *dts_data += ALIGN(hdr->ramdisk_size, hdr->page_size);
+
+ *dts_len = hdr->second_size;
+ return 0;
+}
+
+
#if !defined(CONFIG_SPL_BUILD)
/**
* android_print_contents - prints out the contents of the Android format image
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 6cac7db..732a1a3 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -345,6 +345,14 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
fdt_addr = load;
break;
#endif
+#if defined(CONFIG_ANDROID_BOOT_IMAGE)
+ case IMAGE_FORMAT_ANDROID: {
+ ulong fdt_data, fdt_len;
+ android_image_get_dts(buf, &fdt_data, &fdt_len);
+ goto boot_fdt;
+ }
+ break;
+#endif
case IMAGE_FORMAT_FIT:
/*
* This case will catch both: new uImage format
@@ -400,6 +408,10 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
image_multi_getimg(images->legacy_hdr_os, 2, &fdt_data,
&fdt_len);
+
+#if defined(CONFIG_ANDROID_BOOT_IMAGE)
+boot_fdt:
+#endif
if (fdt_len) {
fdt_blob = (char *)fdt_data;
printf(" Booting using the fdt at 0x%p\n", fdt_blob);
diff --git a/include/image.h b/include/image.h
index 61b5d3b..f475481 100644
--- a/include/image.h
+++ b/include/image.h
@@ -1147,6 +1147,8 @@ struct andr_img_hdr;
int android_image_check_header(const struct andr_img_hdr *hdr);
int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
ulong *os_data, ulong *os_len);
+int android_image_get_dts(const struct andr_img_hdr *hdr,
+ ulong *dts_data, ulong *dts_len);
int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
ulong *rd_data, ulong *rd_len);
ulong android_image_get_end(const struct andr_img_hdr *hdr);
--
2.8.4
--
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO - Founder Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
| [`as] http://www.amarulasolutions.com |
next prev parent reply other threads:[~2016-06-13 19:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-12 8:40 [U-Boot] FDT on second address of android image Michael Trimarchi
2016-06-13 18:51 ` [U-Boot] [RFC PATCH] common: image-fdt: support dts from the " Michael Trimarchi
2016-06-13 19:39 ` Michael Trimarchi [this message]
2016-06-13 19:53 ` [U-Boot] [RFC PATCH V3] " Michael Trimarchi
2016-06-16 0:39 ` Simon Glass
2016-06-16 7:31 ` Michael Trimarchi
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=20160613193922.GA29401@panicking \
--to=michael@amarulasolutions.com \
--cc=u-boot@lists.denx.de \
/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