--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
-@@ -23,6 +23,23 @@ config MTD_TESTS
- WARNING: some of the tests will ERASE entire MTD device which they
- test. Do not use these tests unless you really know what you do.
+@@ -12,6 +12,27 @@ menuconfig MTD
+ if MTD
+
++menu "OpenWrt specific MTD options"
++
+config MTD_ROOTFS_ROOT_DEV
+ bool "Automatically set 'rootfs' partition to be root filesystem"
+ default y
+ depends on MTD_UIMAGE_SPLIT
+ default "firmware"
+
- config MTD_REDBOOT_PARTS
- tristate "RedBoot partition table parsing"
- ---help---
++endmenu
++
+ config MTD_TESTS
+ tristate "MTD tests support (DANGEROUS)"
+ depends on m
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -29,6 +29,8 @@
#include <linux/err.h>
#include "mtdcore.h"
-@@ -45,12 +47,14 @@ struct mtd_part {
+@@ -45,13 +47,14 @@ struct mtd_part {
struct list_head list;
};
* the pointer to that structure with this macro.
*/
#define PART(x) ((struct mtd_part *)(x))
--
-+#define IS_PART(mtd) (mtd->_read == part_read)
+-
/*
* MTD methods which simply translate the effective address and pass through
-@@ -533,8 +537,10 @@ out_register:
+ * to the _real_ device.
+@@ -533,8 +536,10 @@ out_register:
return slave;
}
{
struct mtd_partition part;
struct mtd_part *p, *new;
-@@ -566,21 +572,24 @@ int mtd_add_partition(struct mtd_info *m
+@@ -566,21 +571,24 @@ int mtd_add_partition(struct mtd_info *m
end = offset + length;
mutex_lock(&mtd_partitions_mutex);
return ret;
err_inv:
-@@ -590,6 +599,12 @@ err_inv:
+@@ -590,6 +598,12 @@ err_inv:
}
EXPORT_SYMBOL_GPL(mtd_add_partition);
int mtd_del_partition(struct mtd_info *master, int partno)
{
struct mtd_part *slave, *next;
-@@ -613,6 +628,149 @@ int mtd_del_partition(struct mtd_info *m
+@@ -613,6 +627,148 @@ int mtd_del_partition(struct mtd_info *m
}
EXPORT_SYMBOL_GPL(mtd_del_partition);
+}
+
+#define ROOTFS_SPLIT_NAME "rootfs_data"
-+#define ROOTFS_REMOVED_NAME "<removed>"
+
+struct squashfs_super_block {
+ __le32 s_magic;
/*
* 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 +800,7 @@ int add_mtd_partitions(struct mtd_info *
+@@ -642,6 +798,7 @@ int add_mtd_partitions(struct mtd_info *
mutex_unlock(&mtd_partitions_mutex);
add_mtd_device(&slave->mtd);