1 The WRT1900AC among other Linksys routers uses a dual-firmware layout.
2 Dynamically rename the active partition to "ubi".
4 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
6 --- a/drivers/mtd/parsers/ofpart_core.c
7 +++ b/drivers/mtd/parsers/ofpart_core.c
8 @@ -38,6 +38,8 @@ static bool node_has_compatible(struct d
9 return of_get_property(pp, "compatible", NULL);
12 +static int mangled_rootblock;
14 static int parse_fixed_partitions(struct mtd_info *master,
15 const struct mtd_partition **pparts,
16 struct mtd_part_parser_data *data)
17 @@ -48,6 +50,7 @@ static int parse_fixed_partitions(struct
18 struct device_node *mtd_node;
19 struct device_node *ofpart_node;
21 + const char *owrtpart = "ubi";
22 struct device_node *pp;
23 int nr_parts, i, ret = 0;
24 bool dedicated = true;
25 @@ -133,9 +136,13 @@ static int parse_fixed_partitions(struct
26 parts[i].size = of_read_number(reg + a_cells, s_cells);
27 parts[i].of_node = pp;
29 - partname = of_get_property(pp, "label", &len);
31 - partname = of_get_property(pp, "name", &len);
32 + if (mangled_rootblock && (i == mangled_rootblock)) {
33 + partname = owrtpart;
35 + partname = of_get_property(pp, "label", &len);
37 + partname = of_get_property(pp, "name", &len);
39 parts[i].name = partname;
41 if (of_get_property(pp, "read-only", &len))
42 @@ -249,6 +256,18 @@ static int __init ofpart_parser_init(voi
46 +static int __init active_root(char *str)
48 + get_option(&str, &mangled_rootblock);
50 + if (!mangled_rootblock)
56 +__setup("mangled_rootblock=", active_root);
58 static void __exit ofpart_parser_exit(void)
60 deregister_mtd_parser(&ofpart_parser);