summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorchenshuo <chenshuo@eswin.com>2020-07-20 08:48:15 +0800
committerSimon Glass <sjg@chromium.org>2020-07-28 19:30:39 -0600
commit6e31458435ac499611a205c67a83be25098135b3 (patch)
tree9ed48514e1fe658e5f0d26356ab5540f4615e216 /common
parent6724a37a7c818a1cd2d5be42eeee8e18acb89e22 (diff)
find dtb in android boot image with header version 2 during bootm
This patch is about bootm process, android boot image and device tree. Android 10 updates the boot image header to version 2, which includes a section to store the device tree blob (DTB) image. include/android_image.h has updated the struct andr_img_hdr, but not used in bootm process. This patch avoid reporting "Device tree not found or missing FDT support" when bootm a correctly constructed android boot image. Signed-off-by: chenshuo <chenshuo@eswin.com>
Diffstat (limited to 'common')
-rw-r--r--common/image-fdt.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 7005b34966..f13eefb061 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -465,10 +465,20 @@ int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
#ifdef CONFIG_ANDROID_BOOT_IMAGE
} else if (genimg_get_format(buf) == IMAGE_FORMAT_ANDROID) {
struct andr_img_hdr *hdr = buf;
- ulong fdt_data, fdt_len;
+ ulong fdt_data, fdt_len;
+ u32 fdt_size, dtb_idx;
+ /*
+ * Firstly check if this android boot image has dtb field.
+ */
+ dtb_idx = (u32)env_get_ulong("adtb_idx", 10, 0);
+ if (android_image_get_dtb_by_index((ulong)hdr, dtb_idx, &fdt_addr, &fdt_size)) {
+ fdt_blob = (char *)map_sysmem(fdt_addr, 0);
+ if (fdt_check_header(fdt_blob))
+ goto no_fdt;
- if (!android_image_get_second(hdr, &fdt_data, &fdt_len) &&
- !fdt_check_header((char *)fdt_data)) {
+ debug("## Using FDT in Android image dtb area with idx %u\n", dtb_idx);
+ } else if (!android_image_get_second(hdr, &fdt_data, &fdt_len) &&
+ !fdt_check_header((char *)fdt_data)) {
fdt_blob = (char *)fdt_data;
if (fdt_totalsize(fdt_blob) != fdt_len)
goto error;