block/partitions/rk: extend the property setting for NVMe
authorShawn Lin <shawn.lin@rock-chips.com>
Tue, 14 Feb 2017 06:50:02 +0000 (14:50 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 16 Feb 2017 12:33:12 +0000 (20:33 +0800)
In order not to cause ABI regression, let's invent a new
androidboot.mode for NVMe instead. Just elaborate a bit more
that we now doesn't support mtd devices, otherwise we should
rework it to make it more scalable.

Change-Id: I115ffd0e5c4986f2e76fcbcf6700c31f297f7950
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
block/partitions/rk.c

index 93d9356a1748aa8aa37cb9dd7364693d04f92b9c..73a8f8db3be4bb4ab2527f8f2af2b757f4f1d1c4 100755 (executable)
@@ -276,17 +276,26 @@ static int parse_cmdline_partitions(sector_t n,
 
 static void rkpart_bootmode_fixup(void)
 {
-       const char mode[] = " androidboot.mode=emmc";
+       const char mode_emmc[] = " androidboot.mode=emmc";
+       const char mode_nvme[] = " androidboot.mode=nvme";
        const char charger[] = " androidboot.charger.emmc=1";
        char *new_command_line;
        size_t saved_command_line_len = strlen(saved_command_line);
 
        if (strstr(saved_command_line, "androidboot.mode=charger")) {
-               new_command_line = kzalloc(saved_command_line_len + strlen(charger) + 1, GFP_KERNEL);
-               sprintf(new_command_line, "%s%s", saved_command_line, charger);
+               new_command_line = kzalloc(saved_command_line_len +
+                               strlen(charger) + 1, GFP_KERNEL);
+               sprintf(new_command_line, "%s%s",
+                       saved_command_line, charger);
        } else {
-               new_command_line = kzalloc(saved_command_line_len + strlen(mode) + 1, GFP_KERNEL);
-               sprintf(new_command_line, "%s%s", saved_command_line, mode);
+               new_command_line = kzalloc(saved_command_line_len +
+                               strlen(mode_emmc) + 1, GFP_KERNEL);
+               if (strstr(saved_command_line, "storagemedia=nvme"))
+                       sprintf(new_command_line, "%s%s",
+                               saved_command_line, mode_nvme);
+               else
+                       sprintf(new_command_line, "%s%s",
+                               saved_command_line, mode_emmc);
        }
        saved_command_line = new_command_line;
 }