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 <adrian.negreanu@nxp.com>
This commit is contained in:
Adrian Negreanu 2019-02-11 16:07:37 +02:00
parent 8915891b77
commit 15ecd669ac
1 changed files with 24 additions and 16 deletions

View File

@ -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 */