From 49c7b92ff64cbea9f66436130cab375716875407 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 4 Nov 2013 18:37:05 +0000 Subject: [PATCH] kernel/3.1[02]: move MTD root device setup code to mtdcore The current code only allows to automatically set root device on MTD partitions. Move the code to MTD core to allow to use it with all MTD devices. Signed-off-by: Gabor Juhos git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38643 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../400-mtd-add-rootfs-split-support.patch | 22 +++++----------- ...for-different-partition-parser-types.patch | 4 +-- ...arsers-for-rootfs-and-firmware-split.patch | 6 ++--- ...td_get_squashfs_len-in-split_squasfh.patch | 4 +-- .../405-mtd-add-more-helper-functions.patch | 4 +-- .../411-mtd-partial_eraseblock_write.patch | 8 +++--- .../412-mtd-partial_eraseblock_unlock.patch | 2 +- .../480-mtd-set-rootfs-to-be-root-dev.patch | 26 +++++++++++++++++++ .../400-mtd-add-rootfs-split-support.patch | 22 +++++----------- ...for-different-partition-parser-types.patch | 4 +-- ...arsers-for-rootfs-and-firmware-split.patch | 6 ++--- ...td_get_squashfs_len-in-split_squasfh.patch | 4 +-- .../405-mtd-add-more-helper-functions.patch | 4 +-- .../411-mtd-partial_eraseblock_write.patch | 8 +++--- .../412-mtd-partial_eraseblock_unlock.patch | 2 +- .../480-mtd-set-rootfs-to-be-root-dev.patch | 26 +++++++++++++++++++ 16 files changed, 94 insertions(+), 58 deletions(-) create mode 100644 target/linux/generic/patches-3.10/480-mtd-set-rootfs-to-be-root-dev.patch create mode 100644 target/linux/generic/patches-3.12/480-mtd-set-rootfs-to-be-root-dev.patch diff --git a/target/linux/generic/patches-3.10/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/patches-3.10/400-mtd-add-rootfs-split-support.patch index 6a4c16134e..6c17b01e53 100644 --- a/target/linux/generic/patches-3.10/400-mtd-add-rootfs-split-support.patch +++ b/target/linux/generic/patches-3.10/400-mtd-add-rootfs-split-support.patch @@ -35,16 +35,15 @@ depends on m --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -29,6 +29,8 @@ +@@ -29,6 +29,7 @@ #include #include #include -+#include +#include #include #include "mtdcore.h" -@@ -45,13 +47,14 @@ struct mtd_part { +@@ -45,13 +46,14 @@ struct mtd_part { struct list_head list; }; @@ -60,7 +59,7 @@ /* * MTD methods which simply translate the effective address and pass through * to the _real_ device. -@@ -533,8 +536,10 @@ out_register: +@@ -533,8 +535,10 @@ out_register: return slave; } @@ -73,7 +72,7 @@ { struct mtd_partition part; struct mtd_part *p, *new; -@@ -566,21 +571,24 @@ int mtd_add_partition(struct mtd_info *m +@@ -566,21 +570,24 @@ int mtd_add_partition(struct mtd_info *m end = offset + length; mutex_lock(&mtd_partitions_mutex); @@ -108,7 +107,7 @@ return ret; err_inv: -@@ -590,6 +598,12 @@ err_inv: +@@ -590,6 +597,12 @@ err_inv: } EXPORT_SYMBOL_GPL(mtd_add_partition); @@ -121,7 +120,7 @@ int mtd_del_partition(struct mtd_info *master, int partno) { struct mtd_part *slave, *next; -@@ -613,6 +627,151 @@ int mtd_del_partition(struct mtd_info *m +@@ -613,6 +626,144 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -252,13 +251,6 @@ + if (!strcmp(part->mtd.name, "rootfs")) { + rootfs_found = 1; + -+ if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ printk(KERN_NOTICE "mtd: partition \"rootfs\" " -+ "set to be root filesystem\n"); -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, part->mtd.index); -+ } -+ + if (config_enabled(CONFIG_MTD_ROOTFS_SPLIT)) + split_rootfs_data(master, part); + } @@ -273,7 +265,7 @@ /* * This function, given a master MTD object and a partition table, creates * and registers slave MTD objects which are bound to the master according to -@@ -642,6 +801,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -642,6 +793,7 @@ int add_mtd_partitions(struct mtd_info * mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&slave->mtd); diff --git a/target/linux/generic/patches-3.10/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/patches-3.10/401-mtd-add-support-for-different-partition-parser-types.patch index 8ac084d5e1..bd35aa7d35 100644 --- a/target/linux/generic/patches-3.10/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/patches-3.10/401-mtd-add-support-for-different-partition-parser-types.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -831,6 +831,30 @@ static struct mtd_part_parser *get_parti +@@ -823,6 +823,30 @@ static struct mtd_part_parser *get_parti #define put_partition_parser(p) do { module_put((p)->owner); } while (0) @@ -42,7 +42,7 @@ Signed-off-by: Gabor Juhos int register_mtd_parser(struct mtd_part_parser *p) { spin_lock(&part_parser_lock); -@@ -907,6 +931,38 @@ int parse_mtd_partitions(struct mtd_info +@@ -899,6 +923,38 @@ int parse_mtd_partitions(struct mtd_info return ret; } 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 index a614094851..649693ff22 100644 --- 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 @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -627,6 +627,37 @@ int mtd_del_partition(struct mtd_info *m +@@ -626,6 +626,37 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -38,7 +38,7 @@ 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 +@@ -685,6 +716,10 @@ static void split_rootfs_data(struct mtd unsigned int split_size; int ret; @@ -49,7 +49,7 @@ ret = split_squashfs(master, part->offset, &split_offset); if (ret) return; -@@ -735,6 +770,12 @@ static void split_uimage(struct mtd_info +@@ -734,6 +769,12 @@ static void split_uimage(struct mtd_info static void split_firmware(struct mtd_info *master, struct mtd_part *part) { diff --git a/target/linux/generic/patches-3.10/404-mtd-use-mtd_get_squashfs_len-in-split_squasfh.patch b/target/linux/generic/patches-3.10/404-mtd-use-mtd_get_squashfs_len-in-split_squasfh.patch index 43960b3065..9024026c9c 100644 --- a/target/linux/generic/patches-3.10/404-mtd-use-mtd_get_squashfs_len-in-split_squasfh.patch +++ b/target/linux/generic/patches-3.10/404-mtd-use-mtd_get_squashfs_len-in-split_squasfh.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -34,6 +34,7 @@ +@@ -33,6 +33,7 @@ #include #include "mtdcore.h" @@ -8,7 +8,7 @@ /* Our partition linked list */ static LIST_HEAD(mtd_partitions); -@@ -669,43 +670,16 @@ mtd_pad_erasesize(struct mtd_info *mtd, +@@ -668,43 +669,16 @@ mtd_pad_erasesize(struct mtd_info *mtd, return len; } diff --git a/target/linux/generic/patches-3.10/405-mtd-add-more-helper-functions.patch b/target/linux/generic/patches-3.10/405-mtd-add-more-helper-functions.patch index 97ad2db87e..9c75e5cb15 100644 --- a/target/linux/generic/patches-3.10/405-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/patches-3.10/405-mtd-add-more-helper-functions.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -435,14 +435,12 @@ static struct mtd_part *allocate_partiti +@@ -434,14 +434,12 @@ static struct mtd_part *allocate_partiti if (slave->offset == MTDPART_OFS_APPEND) slave->offset = cur_offset; if (slave->offset == MTDPART_OFS_NXTBLK) { @@ -18,7 +18,7 @@ } if (slave->offset == MTDPART_OFS_RETAIN) { slave->offset = cur_offset; -@@ -995,6 +993,24 @@ int mtd_is_partition(const struct mtd_in +@@ -987,6 +985,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); diff --git a/target/linux/generic/patches-3.10/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/patches-3.10/411-mtd-partial_eraseblock_write.patch index 560096f854..b7152110b2 100644 --- a/target/linux/generic/patches-3.10/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/patches-3.10/411-mtd-partial_eraseblock_write.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -36,6 +36,8 @@ +@@ -35,6 +35,8 @@ #include "mtdcore.h" #include "mtdsplit.h" @@ -9,7 +9,7 @@ /* Our partition linked list */ static LIST_HEAD(mtd_partitions); static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -232,13 +234,60 @@ static int part_erase(struct mtd_info *m +@@ -231,13 +233,60 @@ static int part_erase(struct mtd_info *m struct mtd_part *part = PART(mtd); int ret; @@ -70,7 +70,7 @@ return ret; } -@@ -246,7 +295,25 @@ void mtd_erase_callback(struct erase_inf +@@ -245,7 +294,25 @@ void mtd_erase_callback(struct erase_inf { if (instr->mtd->_erase == part_erase) { struct mtd_part *part = PART(instr->mtd); @@ -96,7 +96,7 @@ if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; instr->addr -= part->offset; -@@ -504,18 +571,24 @@ static struct mtd_part *allocate_partiti +@@ -503,18 +570,24 @@ static struct mtd_part *allocate_partiti if ((slave->mtd.flags & MTD_WRITEABLE) && mtd_mod_by_eb(slave->offset, &slave->mtd)) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/patches-3.10/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/patches-3.10/412-mtd-partial_eraseblock_unlock.patch index 87c8257fe1..134f65715e 100644 --- a/target/linux/generic/patches-3.10/412-mtd-partial_eraseblock_unlock.patch +++ b/target/linux/generic/patches-3.10/412-mtd-partial_eraseblock_unlock.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -332,7 +332,14 @@ static int part_lock(struct mtd_info *mt +@@ -331,7 +331,14 @@ static int part_lock(struct mtd_info *mt static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) { struct mtd_part *part = PART(mtd); diff --git a/target/linux/generic/patches-3.10/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/patches-3.10/480-mtd-set-rootfs-to-be-root-dev.patch new file mode 100644 index 0000000000..58c4a8ae3f --- /dev/null +++ b/target/linux/generic/patches-3.10/480-mtd-set-rootfs-to-be-root-dev.patch @@ -0,0 +1,26 @@ +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -408,6 +409,15 @@ int add_mtd_device(struct mtd_info *mtd) + of this try_ nonsense, and no bitching about it + either. :) */ + __module_get(THIS_MODULE); ++ ++ if (!strcmp(mtd->name, "rootfs") && ++ config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && ++ ROOT_DEV == 0) { ++ pr_notice("mtd: device %d (%s) set to be root filesystem\n", ++ mtd->index, mtd->name); ++ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); ++ } ++ + return 0; + + fail_added: diff --git a/target/linux/generic/patches-3.12/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/patches-3.12/400-mtd-add-rootfs-split-support.patch index 215aef14de..ce91d7ba5e 100644 --- a/target/linux/generic/patches-3.12/400-mtd-add-rootfs-split-support.patch +++ b/target/linux/generic/patches-3.12/400-mtd-add-rootfs-split-support.patch @@ -35,16 +35,15 @@ depends on m --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -29,6 +29,8 @@ +@@ -29,6 +29,7 @@ #include #include #include -+#include +#include #include #include "mtdcore.h" -@@ -45,13 +47,14 @@ struct mtd_part { +@@ -45,13 +46,14 @@ struct mtd_part { struct list_head list; }; @@ -60,7 +59,7 @@ /* * MTD methods which simply translate the effective address and pass through * to the _real_ device. -@@ -534,8 +537,10 @@ out_register: +@@ -534,8 +536,10 @@ out_register: return slave; } @@ -73,7 +72,7 @@ { struct mtd_partition part; struct mtd_part *p, *new; -@@ -567,21 +572,24 @@ int mtd_add_partition(struct mtd_info *m +@@ -567,21 +571,24 @@ int mtd_add_partition(struct mtd_info *m end = offset + length; mutex_lock(&mtd_partitions_mutex); @@ -108,7 +107,7 @@ return ret; err_inv: -@@ -591,6 +599,12 @@ err_inv: +@@ -591,6 +598,12 @@ err_inv: } EXPORT_SYMBOL_GPL(mtd_add_partition); @@ -121,7 +120,7 @@ int mtd_del_partition(struct mtd_info *master, int partno) { struct mtd_part *slave, *next; -@@ -614,6 +628,151 @@ int mtd_del_partition(struct mtd_info *m +@@ -614,6 +627,144 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -252,13 +251,6 @@ + if (!strcmp(part->mtd.name, "rootfs")) { + rootfs_found = 1; + -+ if (config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && -+ ROOT_DEV == 0) { -+ printk(KERN_NOTICE "mtd: partition \"rootfs\" " -+ "set to be root filesystem\n"); -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, part->mtd.index); -+ } -+ + if (config_enabled(CONFIG_MTD_ROOTFS_SPLIT)) + split_rootfs_data(master, part); + } @@ -273,7 +265,7 @@ /* * This function, given a master MTD object and a partition table, creates * and registers slave MTD objects which are bound to the master according to -@@ -643,6 +802,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -643,6 +794,7 @@ int add_mtd_partitions(struct mtd_info * mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&slave->mtd); diff --git a/target/linux/generic/patches-3.12/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/patches-3.12/401-mtd-add-support-for-different-partition-parser-types.patch index 8d7bcdeee6..52b87f56cc 100644 --- a/target/linux/generic/patches-3.12/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/patches-3.12/401-mtd-add-support-for-different-partition-parser-types.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -832,6 +832,30 @@ static struct mtd_part_parser *get_parti +@@ -824,6 +824,30 @@ static struct mtd_part_parser *get_parti #define put_partition_parser(p) do { module_put((p)->owner); } while (0) @@ -42,7 +42,7 @@ Signed-off-by: Gabor Juhos int register_mtd_parser(struct mtd_part_parser *p) { spin_lock(&part_parser_lock); -@@ -908,6 +932,38 @@ int parse_mtd_partitions(struct mtd_info +@@ -900,6 +924,38 @@ int parse_mtd_partitions(struct mtd_info return ret; } diff --git a/target/linux/generic/patches-3.12/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/patches-3.12/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index 8d0bda825f..a614094851 100644 --- a/target/linux/generic/patches-3.12/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/patches-3.12/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -628,6 +628,37 @@ int mtd_del_partition(struct mtd_info *m +@@ -627,6 +627,37 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -38,7 +38,7 @@ static inline unsigned long mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len) { -@@ -687,6 +718,10 @@ static void split_rootfs_data(struct mtd +@@ -686,6 +717,10 @@ static void split_rootfs_data(struct mtd unsigned int split_size; int ret; @@ -49,7 +49,7 @@ ret = split_squashfs(master, part->offset, &split_offset); if (ret) return; -@@ -736,6 +771,12 @@ static void split_uimage(struct mtd_info +@@ -735,6 +770,12 @@ static void split_uimage(struct mtd_info static void split_firmware(struct mtd_info *master, struct mtd_part *part) { diff --git a/target/linux/generic/patches-3.12/404-mtd-use-mtd_get_squashfs_len-in-split_squasfh.patch b/target/linux/generic/patches-3.12/404-mtd-use-mtd_get_squashfs_len-in-split_squasfh.patch index 1ebeca64d1..a54b97b07c 100644 --- a/target/linux/generic/patches-3.12/404-mtd-use-mtd_get_squashfs_len-in-split_squasfh.patch +++ b/target/linux/generic/patches-3.12/404-mtd-use-mtd_get_squashfs_len-in-split_squasfh.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -34,6 +34,7 @@ +@@ -33,6 +33,7 @@ #include #include "mtdcore.h" @@ -8,7 +8,7 @@ /* Our partition linked list */ static LIST_HEAD(mtd_partitions); -@@ -670,43 +671,16 @@ mtd_pad_erasesize(struct mtd_info *mtd, +@@ -669,43 +670,16 @@ mtd_pad_erasesize(struct mtd_info *mtd, return len; } diff --git a/target/linux/generic/patches-3.12/405-mtd-add-more-helper-functions.patch b/target/linux/generic/patches-3.12/405-mtd-add-more-helper-functions.patch index c2578c3003..a32aad4f70 100644 --- a/target/linux/generic/patches-3.12/405-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/patches-3.12/405-mtd-add-more-helper-functions.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -435,14 +435,12 @@ static struct mtd_part *allocate_partiti +@@ -434,14 +434,12 @@ static struct mtd_part *allocate_partiti if (slave->offset == MTDPART_OFS_APPEND) slave->offset = cur_offset; if (slave->offset == MTDPART_OFS_NXTBLK) { @@ -18,7 +18,7 @@ } if (slave->offset == MTDPART_OFS_RETAIN) { slave->offset = cur_offset; -@@ -996,6 +994,24 @@ int mtd_is_partition(const struct mtd_in +@@ -988,6 +986,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); diff --git a/target/linux/generic/patches-3.12/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/patches-3.12/411-mtd-partial_eraseblock_write.patch index 7ecb3312c2..523dd4e375 100644 --- a/target/linux/generic/patches-3.12/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/patches-3.12/411-mtd-partial_eraseblock_write.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -36,6 +36,8 @@ +@@ -35,6 +35,8 @@ #include "mtdcore.h" #include "mtdsplit.h" @@ -9,7 +9,7 @@ /* Our partition linked list */ static LIST_HEAD(mtd_partitions); static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -232,13 +234,60 @@ static int part_erase(struct mtd_info *m +@@ -231,13 +233,60 @@ static int part_erase(struct mtd_info *m struct mtd_part *part = PART(mtd); int ret; @@ -70,7 +70,7 @@ return ret; } -@@ -246,7 +295,25 @@ void mtd_erase_callback(struct erase_inf +@@ -245,7 +294,25 @@ void mtd_erase_callback(struct erase_inf { if (instr->mtd->_erase == part_erase) { struct mtd_part *part = PART(instr->mtd); @@ -96,7 +96,7 @@ if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; instr->addr -= part->offset; -@@ -504,18 +571,24 @@ static struct mtd_part *allocate_partiti +@@ -503,18 +570,24 @@ static struct mtd_part *allocate_partiti if ((slave->mtd.flags & MTD_WRITEABLE) && mtd_mod_by_eb(slave->offset, &slave->mtd)) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/patches-3.12/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/patches-3.12/412-mtd-partial_eraseblock_unlock.patch index 87c8257fe1..134f65715e 100644 --- a/target/linux/generic/patches-3.12/412-mtd-partial_eraseblock_unlock.patch +++ b/target/linux/generic/patches-3.12/412-mtd-partial_eraseblock_unlock.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -332,7 +332,14 @@ static int part_lock(struct mtd_info *mt +@@ -331,7 +331,14 @@ static int part_lock(struct mtd_info *mt static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) { struct mtd_part *part = PART(mtd); diff --git a/target/linux/generic/patches-3.12/480-mtd-set-rootfs-to-be-root-dev.patch b/target/linux/generic/patches-3.12/480-mtd-set-rootfs-to-be-root-dev.patch new file mode 100644 index 0000000000..7ef677835e --- /dev/null +++ b/target/linux/generic/patches-3.12/480-mtd-set-rootfs-to-be-root-dev.patch @@ -0,0 +1,26 @@ +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -419,6 +420,15 @@ int add_mtd_device(struct mtd_info *mtd) + of this try_ nonsense, and no bitching about it + either. :) */ + __module_get(THIS_MODULE); ++ ++ if (!strcmp(mtd->name, "rootfs") && ++ config_enabled(CONFIG_MTD_ROOTFS_ROOT_DEV) && ++ ROOT_DEV == 0) { ++ pr_notice("mtd: device %d (%s) set to be root filesystem\n", ++ mtd->index, mtd->name); ++ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index); ++ } ++ + return 0; + + fail_added: