When CONFIG_CMD_BOOT_ANDROID is enabled, make each MMC distro boot target try boot_android first. If no valid Android image is found, fall back to the existing MMC distro boot flow.
This allows the same U-Boot build to boot either Android or standard Linux, depending on the image and partition layout present on the MMC device.
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 52189fb99b9..d87d58c58a1 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -39,6 +39,7 @@
#define BOOTENV_DEV_BLKDEV(devtypeu, devtypel, instance) \
"bootcmd_" #devtypel #instance "=" \
"setenv devnum " #instance "; " \
"run " #devtypel "_boot\0"
#define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
@@ -58,7 +59,16 @@
#ifdef CONFIG_CMD_MMC
#define BOOTENV_SHARED_MMC BOOTENV_SHARED_BLKDEV(mmc)
+#ifdef CONFIG_CMD_BOOT_ANDROID
+#define BOOTENV_DEV_MMC(devtypeu, devtypel, instance) \
+ "bootcmd_" #devtypel #instance "=" \
+ "setenv devtype " #devtypel "; " \
+ "setenv devnum " #instance "; " \
+ "boot_android " #devtypel " " #instance " || " \
+ "run " #devtypel "_boot\0"
+#else
#define BOOTENV_DEV_MMC BOOTENV_DEV_BLKDEV
+#endif
#define BOOTENV_DEV_NAME_MMC BOOTENV_DEV_NAME_BLKDEV
#else
#define BOOTENV_SHARED_MMC
In order to boot android from any of bootable devices, can apply these changes-
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 52189fb99b9..de99f1ece45 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -26,11 +26,19 @@
* message that includes some other pre-processor symbols in the text.
*/
+#ifdef CONFIG_CMD_BOOT_ANDROID
+#define BOOTENV_ANDROID_BLKDEV(devtypel) \
+ "boot_android " #devtypel " ${devnum} || "
+#else
+#define BOOTENV_ANDROID_BLKDEV(devtypel)
+#endif
+
#define BOOTENV_SHARED_BLKDEV_BODY(devtypel) \
- "if " #devtypel " dev ${devnum}; then " \
- "setenv devtype " #devtypel "; " \
- "run scan_dev_for_boot_part; " \
- "fi\0"
+ "if " #devtypel " dev ${devnum}; then " \
+ "setenv devtype " #devtypel "; " \
+ BOOTENV_ANDROID_BLKDEV(devtypel) \
+ "run scan_dev_for_boot_part; " \
+ "fi\0"
#define BOOTENV_SHARED_BLKDEV(devtypel) \
#devtypel "_boot=" \
It might needed to do env default -a and env save.
When CONFIG_CMD_BOOT_ANDROID is enabled, make each MMC distro boot target try boot_android first. If no valid Android image is found, fall back to the existing MMC distro boot flow.
This allows the same U-Boot build to boot either Android or standard Linux, depending on the image and partition layout present on the MMC device.
In order to boot android from any of bootable devices, can apply these changes-
It might needed to do
env default -aandenv save.