MA-14712 change androidboot.storage_type to androidboot.boot_device_root
authorJindong <jindong.yue@nxp.com>
Mon, 13 May 2019 10:10:25 +0000 (18:10 +0800)
committerJi Luo <ji.luo@nxp.com>
Thu, 13 May 2021 01:49:17 +0000 (09:49 +0800)
storage_type is emmc or sd, which is not friendly
for user space, for example android health HAL need access
/sys/block/mmcblkX/stat.

Replace it with mmcblkX named as boot_device_root.

Change-Id: I7486d522696e9fe3dde8bdc8834ac11d25df7d79
Signed-off-by: Jindong <jindong.yue@nxp.com>
(cherry picked from commit db441a89a090c46149457ee29492bc315c2bdfa9)

common/image-android.c

index 048eac7..de10169 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/setup.h>
 #include <dm.h>
 #include <init.h>
+#include <mmc.h>
 
 #define ANDROID_IMAGE_DEFAULT_KERNEL_ADDR      0x10008000
 
@@ -161,33 +162,9 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
                strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline));
        }
 
-       char *storage_type = env_get("storage_type");
-       if (storage_type) {
-               sprintf(newbootargs,
-                       " 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));
-               }
-       }
+       sprintf(newbootargs,
+                       " androidboot.boot_device_root=mmcblk%d", mmc_map_to_kernel_blk(mmc_get_env_dev()));
+       strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline));
 
        /* boot metric variables */
        metrics.ble_1 = get_timer(0);