[U-Boot] [RFC PATCH] common: image-fdt: support dts from the second address of android image
Michael Trimarchi
michael at amarulasolutions.com
Mon Jun 13 20:51:45 CEST 2016
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 at amarulasolutions.com>
---
common/image-fdt.c | 26 ++++++++++++++++++++++++++
include/image.h | 2 ++
2 files changed, 28 insertions(+)
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 6cac7db..782c489 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -345,6 +345,31 @@ 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);
+ if (fdt_len) {
+ fdt_blob = (char *)fdt_data;
+ printf(" Booting using the fdt at 0x%p\n", fdt_blob);
+
+ if (fdt_check_header(fdt_blob) != 0) {
+ fdt_error("image is not a fdt");
+ goto error;
+ }
+
+ if (fdt_totalsize(fdt_blob) != fdt_len) {
+ fdt_error("fdt size != image size");
+ goto error;
+ }
+ goto boot_fdt;
+ } else {
+ debug("## No Flattened Device Tree\n");
+ goto no_fdt;
+ }
+ }
+ break;
+#endif
case IMAGE_FORMAT_FIT:
/*
* This case will catch both: new uImage format
@@ -422,6 +447,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
goto no_fdt;
}
+boot_fdt:
*of_flat_tree = fdt_blob;
*of_size = fdt_totalsize(fdt_blob);
debug(" of_flat_tree at 0x%08lx size 0x%08lx\n",
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 |
More information about the U-Boot
mailing list