diff options
Diffstat (limited to 'common/image-fdt.c')
-rw-r--r-- | common/image-fdt.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/common/image-fdt.c b/common/image-fdt.c index 01186aeac7..eb552ca207 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -279,12 +279,11 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, int fdt_noffset; #endif const char *select = NULL; - int ok_no_fdt = 0; *of_flat_tree = NULL; *of_size = 0; - img_addr = simple_strtoul(argv[0], NULL, 16); + img_addr = (argc == 0) ? load_addr : simple_strtoul(argv[0], NULL, 16); buf = map_sysmem(img_addr, 0); if (argc > 2) @@ -462,17 +461,24 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, struct andr_img_hdr *hdr = buf; ulong fdt_data, fdt_len; - if (android_image_get_second(hdr, &fdt_data, &fdt_len) != 0) - goto no_fdt; + 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; - fdt_blob = (char *)fdt_data; - if (fdt_check_header(fdt_blob) != 0) - goto no_fdt; + debug("## Using FDT in Android image second area\n"); + } else { + fdt_addr = env_get_hex("fdtaddr", 0); + if (!fdt_addr) + goto no_fdt; - if (fdt_totalsize(fdt_blob) != fdt_len) - goto error; + fdt_blob = map_sysmem(fdt_addr, 0); + if (fdt_check_header(fdt_blob)) + goto no_fdt; - debug("## Using FDT found in Android image second area\n"); + debug("## Using FDT at ${fdtaddr}=Ox%lx\n", fdt_addr); + } #endif } else { debug("## No Flattened Device Tree\n"); @@ -487,14 +493,9 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, return 0; no_fdt: - ok_no_fdt = 1; + debug("Continuing to boot without FDT\n"); + return 0; error: - *of_flat_tree = NULL; - *of_size = 0; - if (!select && ok_no_fdt) { - debug("Continuing to boot without FDT\n"); - return 0; - } return 1; } |