fdt: boot_get_fdt: android: compress handling (non-functional)
authorEugeniu Rosca <erosca@de.adit-jv.com>
Mon, 1 Apr 2019 10:45:36 +0000 (12:45 +0200)
committerSimon Glass <sjg@chromium.org>
Wed, 24 Apr 2019 02:26:43 +0000 (20:26 -0600)
Prepare for booting Android images which lack any DTB in the second
area by using 'fdtaddr' environment variable as source/address of FDT.
No functional/behavioral change expected in this patch.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/image-fdt.c

index 68bcab85baf4e0bb02aa39ae575a48976979fc80..a5d8b41d0209bbb5e3193ab046f343da9382e2a4 100644 (file)
@@ -461,17 +461,16 @@ 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)
+                       debug("## Using FDT in Android image second area\n");
+               } else {
                        goto no_fdt;
-
-               if (fdt_totalsize(fdt_blob) != fdt_len)
-                       goto error;
-
-               debug("## Using FDT found in Android image second area\n");
+               }
 #endif
        } else {
                debug("## No Flattened Device Tree\n");