From 15ecd669ac80fe250a5922a1c77c2a38c0dd65a5 Mon Sep 17 00:00:00 2001 From: Adrian Negreanu Date: Mon, 11 Feb 2019 16:07:37 +0200 Subject: [PATCH] env variable to specify androidboot.storage_type The boota command boots an Android already written to mmc/emmc. It calls get_boot_device() to figure out where to look for Android; but when a board is booted over serial, get_boot_device() returns an invalid boot mode. Explicitly setting the storage_type will enable boota on a board booted over serial. FB: ucmd setenv storage_type emmc FB: ucmd boota Signed-off-by: Adrian Negreanu --- common/image-android.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/common/image-android.c b/common/image-android.c index 1646e5051a..145e87e72f 100644 --- a/common/image-android.c +++ b/common/image-android.c @@ -147,24 +147,32 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline)); } - int bootdev = get_boot_device(); - if (bootdev == SD1_BOOT || bootdev == SD2_BOOT || - bootdev == SD3_BOOT || bootdev == SD4_BOOT) { + char *storage_type = env_get("storage_type"); + if (storage_type) { sprintf(newbootargs, - " androidboot.storage_type=sd"); - } else if (bootdev == MMC1_BOOT || bootdev == MMC2_BOOT || - bootdev == MMC3_BOOT || bootdev == MMC4_BOOT) { - sprintf(newbootargs, - " androidboot.storage_type=emmc"); - } else if (bootdev == NAND_BOOT) { - sprintf(newbootargs, - " androidboot.storage_type=nand"); - } else - printf("boot device type is incorrect.\n"); - strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline)); - if (bootloader_gpt_overlay()) { - sprintf(newbootargs, " gpt"); + " androidboot.storage_type=%s", + storage_type); strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline)); + } else { + int bootdev = get_boot_device(); + if (bootdev == SD1_BOOT || bootdev == SD2_BOOT || + bootdev == SD3_BOOT || bootdev == SD4_BOOT) { + sprintf(newbootargs, + " androidboot.storage_type=sd"); + } else if (bootdev == MMC1_BOOT || bootdev == MMC2_BOOT || + bootdev == MMC3_BOOT || bootdev == MMC4_BOOT) { + sprintf(newbootargs, + " androidboot.storage_type=emmc"); + } else if (bootdev == NAND_BOOT) { + sprintf(newbootargs, + " androidboot.storage_type=nand"); + } else + printf("boot device type is incorrect.\n"); + strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline)); + if (bootloader_gpt_overlay()) { + sprintf(newbootargs, " gpt"); + strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline)); + } } /* boot metric variables */