fvp: Add support for loading Android boot images via semihosting
authorPeter Collingbourne <pcc@google.com>
Sat, 4 Apr 2020 02:58:24 +0000 (19:58 -0700)
committerTom Rini <trini@konsulko.com>
Fri, 24 Apr 2020 14:10:01 +0000 (10:10 -0400)
FVP now loads an Android boot image named boot.img if available,
otherwise it falls back to the existing code path.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
configs/vexpress_aemv8a_semi_defconfig
include/configs/vexpress_aemv8a.h

index f31baab197f7fd8a4796c32019b4ea43c01fcb7a..b52c761dee1dd3987ca61f5bb6e4aa5b00bae581 100644 (file)
@@ -14,6 +14,8 @@ CONFIG_BOOTARGS="console=ttyAMA0 earlycon=pl011,0x1c090000 debug user_debug=31 l
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SYS_PROMPT="VExpress64# "
+CONFIG_ANDROID_BOOT_IMAGE=y
+CONFIG_CMD_ABOOTIMG=y
 # CONFIG_CMD_CONSOLE is not set
 # CONFIG_CMD_XIMG is not set
 # CONFIG_CMD_EDITENV is not set
index 9a9cec414c87f9275a5d18dfe11ec1a693c93c91..4f3a792f496f4520823ee0ce526a7c22367f28c3 100644 (file)
                                "initrd_addr=0x88000000\0"      \
                                "fdtfile=devtree.dtb\0"         \
                                "fdt_addr=0x83000000\0"         \
-                               "fdt_high=0xffffffffffffffff\0" \
-                               "initrd_high=0xffffffffffffffff\0"
-
-#define CONFIG_BOOTCOMMAND     "smhload ${kernel_name} ${kernel_addr}; " \
-                               "smhload ${fdtfile} ${fdt_addr}; " \
-                               "smhload ${initrd_name} ${initrd_addr} "\
-                               "initrd_end; " \
-                               "fdt addr ${fdt_addr}; fdt resize; " \
-                               "fdt chosen ${initrd_addr} ${initrd_end}; " \
-                               "booti $kernel_addr - $fdt_addr"
+                               "boot_name=boot.img\0"          \
+                               "boot_addr=0x8007f800\0"
+
+#define CONFIG_BOOTCOMMAND     "if smhload ${boot_name} ${boot_addr}; then " \
+                               "  set bootargs; " \
+                               "  abootimg addr ${boot_addr}; " \
+                               "  abootimg get dtb --index=0 fdt_addr; " \
+                               "  bootm ${boot_addr} ${boot_addr} " \
+                               "  ${fdt_addr}; " \
+                               "else; " \
+                               "  set fdt_high 0xffffffffffffffff; " \
+                               "  set initrd_high 0xffffffffffffffff; " \
+                               "  smhload ${kernel_name} ${kernel_addr}; " \
+                               "  smhload ${fdtfile} ${fdt_addr}; " \
+                               "  smhload ${initrd_name} ${initrd_addr} "\
+                               "  initrd_end; " \
+                               "  fdt addr ${fdt_addr}; fdt resize; " \
+                               "  fdt chosen ${initrd_addr} ${initrd_end}; " \
+                               "  booti $kernel_addr - $fdt_addr; " \
+                               "fi"
 
 
 #endif