|
|
@ -10,9 +10,11 @@ Subject: [PATCH 19/25] owrt mtd split |
|
|
|
drivers/mtd/mtdpart.c | 173 +++++++++++++++++++-
|
|
|
|
drivers/mtd/mtdpart.c | 173 +++++++++++++++++++-
|
|
|
|
4 files changed, 184 insertions(+), 1 deletions(-)
|
|
|
|
4 files changed, 184 insertions(+), 1 deletions(-)
|
|
|
|
|
|
|
|
|
|
|
|
--- a/drivers/mtd/Kconfig
|
|
|
|
Index: linux-3.8.13/drivers/mtd/Kconfig
|
|
|
|
+++ b/drivers/mtd/Kconfig
|
|
|
|
===================================================================
|
|
|
|
@@ -31,6 +31,10 @@ config MTD_ROOTFS_SPLIT
|
|
|
|
--- linux-3.8.13.orig/drivers/mtd/Kconfig 2013-08-04 19:55:18.499988719 +0200
|
|
|
|
|
|
|
|
+++ linux-3.8.13/drivers/mtd/Kconfig 2013-08-04 19:55:22.599988819 +0200
|
|
|
|
|
|
|
|
@@ -31,6 +31,10 @@
|
|
|
|
bool "Automatically split 'rootfs' partition for squashfs"
|
|
|
|
bool "Automatically split 'rootfs' partition for squashfs"
|
|
|
|
default y
|
|
|
|
default y
|
|
|
|
|
|
|
|
|
|
|
@ -23,9 +25,11 @@ Subject: [PATCH 19/25] owrt mtd split |
|
|
|
config MTD_REDBOOT_PARTS
|
|
|
|
config MTD_REDBOOT_PARTS
|
|
|
|
tristate "RedBoot partition table parsing"
|
|
|
|
tristate "RedBoot partition table parsing"
|
|
|
|
---help---
|
|
|
|
---help---
|
|
|
|
--- a/drivers/mtd/mtdpart.c
|
|
|
|
Index: linux-3.8.13/drivers/mtd/mtdpart.c
|
|
|
|
+++ b/drivers/mtd/mtdpart.c
|
|
|
|
===================================================================
|
|
|
|
@@ -833,6 +833,168 @@ static int refresh_rootfs_split(struct m
|
|
|
|
--- linux-3.8.13.orig/drivers/mtd/mtdpart.c 2013-08-04 19:55:18.791988726 +0200
|
|
|
|
|
|
|
|
+++ linux-3.8.13/drivers/mtd/mtdpart.c 2013-08-06 13:39:13.212319144 +0200
|
|
|
|
|
|
|
|
@@ -833,6 +833,191 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_MTD_ROOTFS_SPLIT */
|
|
|
|
#endif /* CONFIG_MTD_ROOTFS_SPLIT */
|
|
|
|
|
|
|
|
|
|
|
@ -53,6 +57,29 @@ Subject: [PATCH 19/25] owrt mtd split |
|
|
|
+ return temp + 0x40;
|
|
|
|
+ return temp + 0x40;
|
|
|
|
+}
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
+static unsigned long find_tplink_size(struct mtd_info *mtd,
|
|
|
|
|
|
|
|
+ unsigned long offset)
|
|
|
|
|
|
|
|
+{
|
|
|
|
|
|
|
|
+#define TPLINK_MAGIC 0x00000002
|
|
|
|
|
|
|
|
+ unsigned long magic = 0;
|
|
|
|
|
|
|
|
+ unsigned long temp;
|
|
|
|
|
|
|
|
+ size_t len;
|
|
|
|
|
|
|
|
+ int ret;
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ ret = mtd_read(mtd, offset, 4, &len, (void *)&magic);
|
|
|
|
|
|
|
|
+ if (ret || len != sizeof(magic))
|
|
|
|
|
|
|
|
+ return 0;
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ if (le32_to_cpu(magic) != TPLINK_MAGIC)
|
|
|
|
|
|
|
|
+ return 0;
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ ret = mtd_read(mtd, offset + 0x78, 4, &len, (void *)&temp);
|
|
|
|
|
|
|
|
+ if (ret || len != sizeof(temp))
|
|
|
|
|
|
|
|
+ return 0;
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
+ return temp + 0x200;
|
|
|
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
+
|
|
|
|
+static unsigned long find_eva_size(struct mtd_info *mtd,
|
|
|
|
+static unsigned long find_eva_size(struct mtd_info *mtd,
|
|
|
|
+ unsigned long offset)
|
|
|
|
+ unsigned long offset)
|
|
|
|
+{
|
|
|
|
+{
|
|
|
@ -156,15 +183,15 @@ Subject: [PATCH 19/25] owrt mtd split |
|
|
|
+ };
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ split_partitions[0].size = find_uimage_size(mtd, part->offset);
|
|
|
|
+ split_partitions[0].size = find_uimage_size(mtd, part->offset);
|
|
|
|
+ if (!split_partitions[0].size) {
|
|
|
|
+ if (!split_partitions[0].size)
|
|
|
|
+ split_partitions[0].size = find_eva_size(mtd, part->offset);
|
|
|
|
+ split_partitions[0].size = find_eva_size(mtd, part->offset);
|
|
|
|
+ if (!split_partitions[0].size) {
|
|
|
|
+ if (!split_partitions[0].size)
|
|
|
|
+ split_partitions[0].size = find_brnimage_size(mtd, part->offset);
|
|
|
|
+ split_partitions[0].size = find_brnimage_size(mtd, part->offset);
|
|
|
|
+ if (!split_partitions[0].size) {
|
|
|
|
+ if (!split_partitions[0].size)
|
|
|
|
+ printk(KERN_NOTICE "no uImage or brnImage or eva found in linux partition\n");
|
|
|
|
+ split_partitions[0].size = find_tplink_size(mtd, part->offset);
|
|
|
|
+ return -1;
|
|
|
|
+ if (!split_partitions[0].size) {
|
|
|
|
+ }
|
|
|
|
+ printk(KERN_NOTICE "no uImage or brnImage or eva found in linux partition\n");
|
|
|
|
+ }
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (detect_eva_squashfs_partition(mtd,
|
|
|
|
+ if (detect_eva_squashfs_partition(mtd,
|
|
|
@ -194,7 +221,7 @@ Subject: [PATCH 19/25] owrt mtd split |
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* This function, given a master MTD object and a partition table, creates
|
|
|
|
* 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
|
|
|
|
* and registers slave MTD objects which are bound to the master according to
|
|
|
|
@@ -849,7 +1011,7 @@ int add_mtd_partitions(struct mtd_info *
|
|
|
|
@@ -849,7 +1034,7 @@
|
|
|
|
struct mtd_part *slave;
|
|
|
|
struct mtd_part *slave;
|
|
|
|
uint64_t cur_offset = 0;
|
|
|
|
uint64_t cur_offset = 0;
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
@ -203,7 +230,7 @@ Subject: [PATCH 19/25] owrt mtd split |
|
|
|
int ret;
|
|
|
|
int ret;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
@@ -866,6 +1028,15 @@ int add_mtd_partitions(struct mtd_info *
|
|
|
|
@@ -866,6 +1051,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
add_mtd_device(&slave->mtd);
|
|
|
|
add_mtd_device(&slave->mtd);
|
|
|
|
|
|
|
|
|
|
|
|