mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
fs/partitions: mtdpart: add command line fix for rk emmc
This commit is contained in:
@@ -311,6 +311,23 @@ static int parse_cmdline_partitions(sector_t n,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rk_emmc_fix(void)
|
||||
{
|
||||
const char mode_emmc[] = " androidboot.mode=emmc";
|
||||
const char charger_emmc[] = " 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_emmc) + 1, GFP_KERNEL);
|
||||
sprintf(new_command_line, "%s%s", saved_command_line, charger_emmc);
|
||||
} else {
|
||||
new_command_line = kzalloc(saved_command_line_len + strlen(mode_emmc) + 1, GFP_KERNEL);
|
||||
sprintf(new_command_line, "%s%s", saved_command_line, mode_emmc);
|
||||
}
|
||||
saved_command_line = new_command_line;
|
||||
}
|
||||
|
||||
int mtdpart_partition(struct parsed_partitions *state)
|
||||
{
|
||||
int num_parts = 0, i;
|
||||
@@ -320,6 +337,9 @@ int mtdpart_partition(struct parsed_partitions *state)
|
||||
if(n < SECTOR_1G)
|
||||
return 0;
|
||||
|
||||
if (state->bdev->bd_disk->major != MMC_BLOCK_MAJOR || state->bdev->bd_disk->first_minor != 0)
|
||||
return 0;
|
||||
|
||||
cmdline = strstr(saved_command_line, "mtdparts=") + 9;
|
||||
|
||||
num_parts = parse_cmdline_partitions(n, &parts, 0);
|
||||
@@ -336,6 +356,8 @@ int mtdpart_partition(struct parsed_partitions *state)
|
||||
parts[i].size / 2048);
|
||||
}
|
||||
|
||||
rk_emmc_fix();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user