Commit 15ecd669ac80fe250a5922a1c77c2a38c0dd65a5

Authored by Adrian Negreanu
1 parent 8915891b77

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>

Showing 1 changed file with 24 additions and 16 deletions Side-by-side Diff

common/image-android.c
... ... @@ -147,24 +147,32 @@
147 147 strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline));
148 148 }
149 149  
150   - int bootdev = get_boot_device();
151   - if (bootdev == SD1_BOOT || bootdev == SD2_BOOT ||
152   - bootdev == SD3_BOOT || bootdev == SD4_BOOT) {
  150 + char *storage_type = env_get("storage_type");
  151 + if (storage_type) {
153 152 sprintf(newbootargs,
154   - " androidboot.storage_type=sd");
155   - } else if (bootdev == MMC1_BOOT || bootdev == MMC2_BOOT ||
156   - bootdev == MMC3_BOOT || bootdev == MMC4_BOOT) {
157   - sprintf(newbootargs,
158   - " androidboot.storage_type=emmc");
159   - } else if (bootdev == NAND_BOOT) {
160   - sprintf(newbootargs,
161   - " androidboot.storage_type=nand");
162   - } else
163   - printf("boot device type is incorrect.\n");
164   - strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline));
165   - if (bootloader_gpt_overlay()) {
166   - sprintf(newbootargs, " gpt");
  153 + " androidboot.storage_type=%s",
  154 + storage_type);
167 155 strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline));
  156 + } else {
  157 + int bootdev = get_boot_device();
  158 + if (bootdev == SD1_BOOT || bootdev == SD2_BOOT ||
  159 + bootdev == SD3_BOOT || bootdev == SD4_BOOT) {
  160 + sprintf(newbootargs,
  161 + " androidboot.storage_type=sd");
  162 + } else if (bootdev == MMC1_BOOT || bootdev == MMC2_BOOT ||
  163 + bootdev == MMC3_BOOT || bootdev == MMC4_BOOT) {
  164 + sprintf(newbootargs,
  165 + " androidboot.storage_type=emmc");
  166 + } else if (bootdev == NAND_BOOT) {
  167 + sprintf(newbootargs,
  168 + " androidboot.storage_type=nand");
  169 + } else
  170 + printf("boot device type is incorrect.\n");
  171 + strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline));
  172 + if (bootloader_gpt_overlay()) {
  173 + sprintf(newbootargs, " gpt");
  174 + strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline));
  175 + }
168 176 }
169 177  
170 178 /* boot metric variables */