summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-11-04 18:37:05 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-11-04 18:37:05 +0000
commit5dba0a237e0de82433c85a4ad6ad07cad47d928a (patch)
tree34cd0d7d8c1ca0e82304a1ecf4f7451322735d87 /target/linux
parent866dd2a3788f31c29c735c149d3e905ac2d37930 (diff)
downloadmtk-20170518-5dba0a237e0de82433c85a4ad6ad07cad47d928a.zip
mtk-20170518-5dba0a237e0de82433c85a4ad6ad07cad47d928a.tar.gz
mtk-20170518-5dba0a237e0de82433c85a4ad6ad07cad47d928a.tar.bz2
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 <juhosg@openwrt.org> SVN-Revision: 38643
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic/patches-3.10/400-mtd-add-rootfs-split-support.patch22
-rw-r--r--target/linux/generic/patches-3.10/401-mtd-add-support-for-different-partition-parser-types.patch4
-rw-r--r--target/linux/generic/patches-3.10/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch6
-rw-r--r--target/linux/generic/patches-3.10/404-mtd-use-mtd_get_squashfs_len-in-split_squasfh.patch4
-rw-r--r--target/linux/generic/patches-3.10/405-mtd-add-more-helper-functions.patch4
-rw-r--r--target/linux/generic/patches-3.10/411-mtd-partial_eraseblock_write.patch8
-rw-r--r--target/linux/generic/patches-3.10/412-mtd-partial_eraseblock_unlock.patch2
-rw-r--r--target/linux/generic/patches-3.10/480-mtd-set-rootfs-to-be-root-dev.patch26
-rw-r--r--target/linux/generic/patches-3.12/400-mtd-add-rootfs-split-support.patch22
-rw-r--r--target/linux/generic/patches-3.12/401-mtd-add-support-for-different-partition-parser-types.patch4
-rw-r--r--target/linux/generic/patches-3.12/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch6
-rw-r--r--target/linux/generic/patches-3.12/404-mtd-use-mtd_get_squashfs_len-in-split_squasfh.patch4
-rw-r--r--target/linux/generic/patches-3.12/405-mtd-add-more-helper-functions.patch4
-rw-r--r--target/linux/generic/patches-3.12/411-mtd-partial_eraseblock_write.patch8
-rw-r--r--target/linux/generic/patches-3.12/412-mtd-partial_eraseblock_unlock.patch2
-rw-r--r--target/linux/generic/patches-3.12/480-mtd-set-rootfs-to-be-root-dev.patch26
16 files changed, 94 insertions, 58 deletions
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 6a4c161..6c17b01 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 <linux/kmod.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-+#include <linux/root_dev.h>
+#include <linux/magic.h>
#include <linux/err.h>
#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 8ac084d..bd35aa7 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 <juhosg@openwrt.org>
--- 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 <juhosg@openwrt.org>
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 a614094..649693f 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 43960b3..9024026 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 <linux/err.h>
#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 97ad2db..9c75e5c 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 560096f..b715211 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 87c8257..134f657 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 0000000..58c4a8a
--- /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 <linux/backing-dev.h>
+ #include <linux/gfp.h>
+ #include <linux/slab.h>
++#include <linux/root_dev.h>
+
+ #include <linux/mtd/mtd.h>
+ #include <linux/mtd/partitions.h>
+@@ -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 215aef1..ce91d7b 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 <linux/kmod.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
-+#include <linux/root_dev.h>
+#include <linux/magic.h>
#include <linux/err.h>
#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 8d7bcde..52b87f5 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 <juhosg@openwrt.org>
--- 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 <juhosg@openwrt.org>
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 8d0bda8..a614094 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 1ebeca6..a54b97b 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 <linux/err.h>
#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 c2578c3..a32aad4 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 7ecb331..523dd4e 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 87c8257..134f657 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 0000000..7ef6778
--- /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 <linux/backing-dev.h>
+ #include <linux/gfp.h>
+ #include <linux/slab.h>
++#include <linux/root_dev.h>
+
+ #include <linux/mtd/mtd.h>
+ #include <linux/mtd/partitions.h>
+@@ -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: