]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
fdt: boot_get_fdt: android: use ENV 'fdtaddr' as fallback
authorEugeniu Rosca <erosca@de.adit-jv.com>
Mon, 1 Apr 2019 10:52:52 +0000 (12:52 +0200)
committerSimon Glass <sjg@chromium.org>
Wed, 24 Apr 2019 02:26:43 +0000 (20:26 -0600)
Our platform doesn't store the DTB into the Android image second area,
but rather copies the DTB to RAM from a dedicated dtb.img partition [0],
prior to booting the Android image by calling bootm.

Similar to [1], we find it useful to just call 'bootm' and have the
right DTB being passed to OS (assuming its address has been previously
stored in 'fdtaddr' by calling `fdt addr <dtb-addr>`).

Booting Android with DTB from 'fdtaddr' will only occur if:
 - No DTB is embedded in the second area of Android image
 - 'fdtaddr' points to a valid DTB in RAM

[0] https://source.android.com/devices/architecture/dto/partitions
[1] https://patchwork.ozlabs.org/patch/1046652/
    ("Support boot Android image without address on bootm command")

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

index a5d8b41d0209bbb5e3193ab046f343da9382e2a4..3aa5ffff0f69e49799c126fd7785ea25590c27cc 100644 (file)
@@ -469,7 +469,15 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
 
                        debug("## Using FDT in Android image second area\n");
                } else {
-                       goto no_fdt;
+                       fdt_addr = env_get_hex("fdtaddr", 0);
+                       if (!fdt_addr)
+                               goto no_fdt;
+
+                       fdt_blob = map_sysmem(fdt_addr, 0);
+                       if (fdt_check_header(fdt_blob))
+                               goto no_fdt;
+
+                       debug("## Using FDT at ${fdtaddr}=Ox%lx\n", fdt_addr);
                }
 #endif
        } else {