summaryrefslogtreecommitdiff
path: root/target/linux/generic/patches-3.10
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-09-21 17:55:30 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-09-21 17:55:30 +0000
commit3b71cd94bc9517bc25267dccb393b07d4b54564e (patch)
tree51642bd92bfe3d3ed2f331208897fa4170012fcd /target/linux/generic/patches-3.10
parent6f2b80dff10c3d70844994fb4b76d3a8e450f22a (diff)
downloadmtk-20170518-3b71cd94bc9517bc25267dccb393b07d4b54564e.zip
mtk-20170518-3b71cd94bc9517bc25267dccb393b07d4b54564e.tar.gz
mtk-20170518-3b71cd94bc9517bc25267dccb393b07d4b54564e.tar.bz2
kernel/3.10: allow to use partition parsers for rootfs and firmware split
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 38108
Diffstat (limited to 'target/linux/generic/patches-3.10')
-rw-r--r--target/linux/generic/patches-3.10/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/target/linux/generic/patches-3.10/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/patches-3.10/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
new file mode 100644
index 0000000..a614094
--- /dev/null
+++ b/target/linux/generic/patches-3.10/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
@@ -0,0 +1,75 @@
+--- a/drivers/mtd/mtdpart.c
++++ b/drivers/mtd/mtdpart.c
+@@ -627,6 +627,37 @@ int mtd_del_partition(struct mtd_info *m
+ }
+ EXPORT_SYMBOL_GPL(mtd_del_partition);
+
++static int
++run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type)
++{
++ struct mtd_partition *parts;
++ int nr_parts;
++ int i;
++
++ nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, &parts,
++ NULL);
++ if (nr_parts <= 0)
++ return nr_parts;
++
++ if (WARN_ON(!parts))
++ return 0;
++
++ for (i = 0; i < nr_parts; i++) {
++ /* adjust partition offsets */
++ parts[i].offset += slave->offset;
++
++ __mtd_add_partition(slave->master,
++ parts[i].name,
++ parts[i].offset,
++ parts[i].size,
++ false);
++ }
++
++ kfree(parts);
++
++ return nr_parts;
++}
++
+ static inline unsigned long
+ mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len)
+ {
+@@ -686,6 +717,10 @@ static void split_rootfs_data(struct mtd
+ unsigned int split_size;
+ int ret;
+
++ ret = run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS);
++ if (ret > 0)
++ return;
++
+ ret = split_squashfs(master, part->offset, &split_offset);
+ if (ret)
+ return;
+@@ -735,6 +770,12 @@ static void split_uimage(struct mtd_info
+
+ static void split_firmware(struct mtd_info *master, struct mtd_part *part)
+ {
++ int ret;
++
++ ret = run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE);
++ if (ret > 0)
++ return;
++
+ if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT))
+ split_uimage(master, part);
+ }
+--- a/include/linux/mtd/partitions.h
++++ b/include/linux/mtd/partitions.h
+@@ -70,6 +70,8 @@ struct mtd_part_parser_data {
+
+ enum mtd_parser_type {
+ MTD_PARSER_TYPE_DEVICE = 0,
++ MTD_PARSER_TYPE_ROOTFS,
++ MTD_PARSER_TYPE_FIRMWARE,
+ };
+
+ struct mtd_part_parser {