OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 8... | Line 8... | |||
8 | include/linux/mtd/partitions.h | 2 ++ |
8 | include/linux/mtd/partitions.h | 2 ++ |
|
9 | 2 files changed, 39 insertions(+) |
9 | 2 files changed, 39 insertions(+) |
|
Line 10... | Line 10... | |||
10 | |
10 | |
|
11 | --- a/drivers/mtd/mtdpart.c |
11 | --- a/drivers/mtd/mtdpart.c |
|
12 | +++ b/drivers/mtd/mtdpart.c |
12 | +++ b/drivers/mtd/mtdpart.c |
|
- | 13 | @@ -733,6 +733,36 @@ int mtd_del_partition(struct mtd_info *m |
||
- | 14 | } |
||
- | 15 | EXPORT_SYMBOL_GPL(mtd_del_partition); |
||
- | 16 | |
||
- | 17 | +static int |
||
- | 18 | +run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type) |
||
- | 19 | +{ |
||
- | 20 | + struct mtd_partition *parts; |
||
- | 21 | + int nr_parts; |
||
- | 22 | + int i; |
||
- | 23 | + |
||
- | 24 | + nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts, |
||
- | 25 | + NULL); |
||
- | 26 | + if (nr_parts <= 0) |
||
- | 27 | + return nr_parts; |
||
- | 28 | + |
||
- | 29 | + if (WARN_ON(!parts)) |
||
- | 30 | + return 0; |
||
- | 31 | + |
||
- | 32 | + for (i = 0; i < nr_parts; i++) { |
||
- | 33 | + /* adjust partition offsets */ |
||
- | 34 | + parts[i].offset += slave->offset; |
||
- | 35 | + |
||
- | 36 | + mtd_add_partition(slave->parent, |
||
- | 37 | + parts[i].name, |
||
- | 38 | + parts[i].offset, |
||
- | 39 | + parts[i].size); |
||
- | 40 | + } |
||
- | 41 | + |
||
- | 42 | + kfree(parts); |
||
- | 43 | + |
||
- | 44 | + return nr_parts; |
||
- | 45 | +} |
||
- | 46 | + |
||
- | 47 | #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME |
||
- | 48 | #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME |
||
- | 49 | #else |
||
Line 13... | Line 50... | |||
13 | @@ -775,6 +775,7 @@ run_parsers_by_type(struct mtd_part *sla |
50 | @@ -741,6 +771,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); |
|
14 | |
51 | |
|
15 | static void split_firmware(struct mtd_info *master, struct mtd_part *part) |
52 | static void split_firmware(struct mtd_info *master, struct mtd_part *part) |
|
16 | { |
53 | { |
|
Line 17... | Line 54... | |||
17 | + run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); |
54 | + run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE); |
|
18 | } |
55 | } |
|
19 | |
56 | |
|
20 | static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part) |
57 | void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, |
|
Line 21... | Line 58... | |||
21 | @@ -784,6 +785,12 @@ static void mtd_partition_split(struct m |
58 | @@ -755,6 +786,12 @@ static void mtd_partition_split(struct m |
|
22 | if (rootfs_found) |
59 | if (rootfs_found) |
|
23 | return; |
60 | return; |
|
24 | |
61 | |
|
25 | + if (!strcmp(part->mtd.name, "rootfs")) { |
62 | + if (!strcmp(part->mtd.name, "rootfs")) { |
|
26 | + run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); |
63 | + run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS); |
|
27 | + |
64 | + |
|
28 | + rootfs_found = 1; |
65 | + rootfs_found = 1; |
|
29 | + } |
66 | + } |
|
30 | + |
67 | + |
|
31 | if (IS_ENABLED(CONFIG_MTD_SPLIT_FIRMWARE) && |
68 | if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && |
|
32 | !strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) && |
69 | IS_ENABLED(CONFIG_MTD_SPLIT_FIRMWARE)) |
|
Line 33... | Line 70... | |||
33 | !of_find_property(mtd_get_of_node(&part->mtd), "compatible", NULL)) |
70 | split_firmware(master, part); |
|
34 | --- a/include/linux/mtd/partitions.h |
71 | --- a/include/linux/mtd/partitions.h |
|
35 | +++ b/include/linux/mtd/partitions.h |
72 | +++ b/include/linux/mtd/partitions.h |
|
36 | @@ -75,6 +75,8 @@ struct mtd_part_parser_data { |
73 | @@ -74,6 +74,8 @@ struct mtd_part_parser_data { |