diff options
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/adm5120-2.6/config/default | 3 | ||||
-rw-r--r-- | target/linux/amcc-2.6/config/default | 1 | ||||
-rw-r--r-- | target/linux/at91-2.6/config/default | 3 | ||||
-rw-r--r-- | target/linux/avr32-2.6/config/default | 1 | ||||
-rw-r--r-- | target/linux/generic-2.6/config-2.6.22 | 3 | ||||
-rw-r--r-- | target/linux/generic-2.6/config-template | 3 | ||||
-rw-r--r-- | target/linux/generic-2.6/patches-2.6.22/060-rootfs_split.patch | 198 | ||||
-rw-r--r-- | target/linux/generic-2.6/patches/060-rootfs_split.patch | 200 | ||||
-rw-r--r-- | target/linux/magicbox-2.6/config/default | 1 | ||||
-rw-r--r-- | target/linux/rdc-2.6/config/default | 3 |
10 files changed, 288 insertions, 128 deletions
diff --git a/target/linux/adm5120-2.6/config/default b/target/linux/adm5120-2.6/config/default index eb30a16254..b99e53765a 100644 --- a/target/linux/adm5120-2.6/config/default +++ b/target/linux/adm5120-2.6/config/default @@ -184,7 +184,8 @@ CONFIG_MTD_PARTITIONS=y # CONFIG_MTD_REDBOOT_PARTS is not set # CONFIG_MTD_ROM is not set # CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_SPLIT_ROOTFS is not set +# CONFIG_MTD_ROOTFS_ROOT_DEV is not set +# CONFIG_MTD_ROOTFS_SPLIT is not set # CONFIG_NETDEV_1000 is not set CONFIG_NET_KEY=y # CONFIG_NET_PCI is not set diff --git a/target/linux/amcc-2.6/config/default b/target/linux/amcc-2.6/config/default index 4edff5b9d5..d0fccac52d 100644 --- a/target/linux/amcc-2.6/config/default +++ b/target/linux/amcc-2.6/config/default @@ -121,7 +121,6 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2 # CONFIG_MTD_REDBOOT_PARTS is not set # CONFIG_MTD_ROM is not set # CONFIG_MTD_SLRAM is not set -CONFIG_MTD_SPLIT_ROOTFS=y # CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set # CONFIG_NET_VENDOR_3COM is not set diff --git a/target/linux/at91-2.6/config/default b/target/linux/at91-2.6/config/default index d2160396e9..eb0081b221 100644 --- a/target/linux/at91-2.6/config/default +++ b/target/linux/at91-2.6/config/default @@ -210,7 +210,8 @@ CONFIG_MTD_PARTITIONS=y # CONFIG_MTD_REDBOOT_PARTS is not set # CONFIG_MTD_ROM is not set # CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_SPLIT_ROOTFS is not set +# CONFIG_MTD_ROOTFS_ROOT_DEV is not set +# CONFIG_MTD_ROOTFS_SPLIT is not set # CONFIG_NET_EMATCH is not set # CONFIG_NET_IPGRE_BROADCAST is not set # CONFIG_NET_PKTGEN is not set diff --git a/target/linux/avr32-2.6/config/default b/target/linux/avr32-2.6/config/default index 2a6056efee..5c62fa6835 100644 --- a/target/linux/avr32-2.6/config/default +++ b/target/linux/avr32-2.6/config/default @@ -83,7 +83,6 @@ CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_REDBOOT_PARTS is not set # CONFIG_MTD_ROM is not set # CONFIG_MTD_SLRAM is not set -CONFIG_MTD_SPLIT_ROOTFS=y CONFIG_MTD=y # CONFIG_OWNERSHIP_TRACE is not set CONFIG_PHYS_OFFSET=0x10000000 diff --git a/target/linux/generic-2.6/config-2.6.22 b/target/linux/generic-2.6/config-2.6.22 index 1c081ae8db..1eaf9d712a 100644 --- a/target/linux/generic-2.6/config-2.6.22 +++ b/target/linux/generic-2.6/config-2.6.22 @@ -678,7 +678,8 @@ CONFIG_MODULE_UNLOAD=y CONFIG_MSDOS_FS=m CONFIG_MSDOS_PARTITION=y # CONFIG_MTD_NAND is not set -CONFIG_MTD_SPLIT_ROOTFS=y +CONFIG_MTD_ROOTFS_ROOT_DEV=y +CONFIG_MTD_ROOTFS_SPLIT=y # CONFIG_MTD_UBI is not set # CONFIG_MYRI10GE is not set # CONFIG_NCP_FS is not set diff --git a/target/linux/generic-2.6/config-template b/target/linux/generic-2.6/config-template index 4d9b2b900c..b2d67a6ad1 100644 --- a/target/linux/generic-2.6/config-template +++ b/target/linux/generic-2.6/config-template @@ -663,7 +663,8 @@ CONFIG_MODULE_UNLOAD=y CONFIG_MSDOS_FS=m CONFIG_MSDOS_PARTITION=y # CONFIG_MTD_NAND is not set -CONFIG_MTD_SPLIT_ROOTFS=y +CONFIG_MTD_ROOTFS_ROOT_DEV=y +CONFIG_MTD_ROOTFS_SPLIT=y # CONFIG_MYRI10GE is not set # CONFIG_NCP_FS is not set CONFIG_NET=y diff --git a/target/linux/generic-2.6/patches-2.6.22/060-rootfs_split.patch b/target/linux/generic-2.6/patches-2.6.22/060-rootfs_split.patch index 4610d3c01a..c8fe052b83 100644 --- a/target/linux/generic-2.6/patches-2.6.22/060-rootfs_split.patch +++ b/target/linux/generic-2.6/patches-2.6.22/060-rootfs_split.patch @@ -1,21 +1,28 @@ -diff -urN linux-2.6.21.1.old/drivers/mtd/Kconfig linux-2.6.21.1.dev/drivers/mtd/Kconfig ---- linux-2.6.21.1.old/drivers/mtd/Kconfig 2007-04-27 23:49:26.000000000 +0200 -+++ linux-2.6.21.1.dev/drivers/mtd/Kconfig 2007-05-26 19:58:42.320520952 +0200 -@@ -47,6 +47,11 @@ +Index: linux/drivers/mtd/Kconfig +=================================================================== +--- linux.orig/drivers/mtd/Kconfig ++++ linux/drivers/mtd/Kconfig +@@ -47,6 +47,16 @@ config MTD_PARTITIONS devices. Partitioning on NFTL 'devices' is a different - that's the 'normal' form of partitioning used on a block device. -+config MTD_SPLIT_ROOTFS -+ bool "Automatically split rootfs partition for squashfs" ++config MTD_ROOTFS_ROOT_DEV ++ bool "Automatically set 'rootfs' partition to be root filesystem" ++ depends on MTD_PARTITIONS ++ default y ++ ++config MTD_ROOTFS_SPLIT ++ bool "Automatically split 'rootfs' partition for squashfs" + depends on MTD_PARTITIONS + default y + config MTD_REDBOOT_PARTS tristate "RedBoot partition table parsing" depends on MTD_PARTITIONS -diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mtd/mtdpart.c ---- linux-2.6.21.1.old/drivers/mtd/mtdpart.c 2007-04-27 23:49:26.000000000 +0200 -+++ linux-2.6.21.1.dev/drivers/mtd/mtdpart.c 2007-05-26 19:58:42.331519280 +0200 +Index: linux/drivers/mtd/mtdpart.c +=================================================================== +--- linux.orig/drivers/mtd/mtdpart.c ++++ linux/drivers/mtd/mtdpart.c @@ -20,6 +20,8 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> @@ -25,15 +32,16 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt /* Our partition linked list */ static LIST_HEAD(mtd_partitions); -@@ -308,6 +310,171 @@ +@@ -308,6 +310,265 @@ int del_mtd_partitions(struct mtd_info * return 0; } +static u_int32_t cur_offset = 0; -+static int add_mtd_partition(struct mtd_info *master, const struct mtd_partition *part, int i) ++static int add_one_partition(struct mtd_info *master, const struct mtd_partition *part, ++ int i, struct mtd_part **slp) +{ + struct mtd_part *slave; -+ ++ + /* allocate the partition structure */ + slave = kzalloc (sizeof(*slave), GFP_KERNEL); + if (!slave) { @@ -191,62 +199,118 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt + slave->registered = 1; + } + ++ if (slp) ++ *slp = slave; ++ + return 0; +} + ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++#define ROOTFS_SPLIT_NAME "rootfs_data" ++static int split_squashfs(struct mtd_info *master, struct mtd_partition *old, ++ struct mtd_partition **new) ++{ ++ struct mtd_partition *part = NULL; ++ int len; ++ char buf[512]; ++ struct squashfs_super_block *sb = (struct squashfs_super_block *) buf; ++ int ret; ++ ++ ret = master->read(master, old->offset, sizeof(*sb), &len, buf); ++ if (ret) { ++ printk(KERN_ALERT "split_squashfs: error occured while reading " ++ "from \"%s\"\n", master->name); ++ goto out; ++ } ++ ++ if (len != sizeof(*sb)) { ++ printk(KERN_ALERT "split_squashfs: unable to read superblock " ++ "from \"%s\"\n", master->name); ++ ret=-1; ++ goto out; ++ } ++ ++ if (*((u32 *) buf) != SQUASHFS_MAGIC) { ++ printk(KERN_ALERT "split_squasfs: no squashfs found in \"%s\"\n", ++ master->name); ++ ret=0; ++ goto out; ++ } ++ ++ if (sb->bytes_used <= 0) { ++ printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n", ++ master->name); ++ ret=0; ++ goto out; ++ } ++ ++ part = kmalloc(sizeof(*part)+sizeof(ROOTFS_SPLIT_NAME)+1, GFP_KERNEL); ++ if (part == NULL) { ++ printk(KERN_INFO "split_squashfs: no memory for partition \"%s\"\n", ++ ROOTFS_SPLIT_NAME); ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ part->name = (unsigned char *)&part[1]; ++ memcpy(part, old, sizeof(*part)); ++ strcpy(part->name, ROOTFS_SPLIT_NAME); ++ ++ len = (u32) sb->bytes_used; ++ len += (part->offset & 0x000fffff); ++ len += (master->erasesize - 1); ++ len &= ~(master->erasesize - 1); ++ len -= (part->offset & 0x000fffff); ++ part->offset += len; ++ part->size -= len; ++ ++ ret = 0; ++ ++out: ++ *new = part; ++ return ret; ++} ++ ++static int split_rootfs_data(struct mtd_info *master, struct mtd_partition *part, ++ int index) ++{ ++ struct mtd_partition *dpart; ++ int ret; ++ ++ ret = split_squashfs(master, part, &dpart); ++ if (ret) ++ return ret; ++ ++ if (dpart == NULL) ++ return 1; ++ ++ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%lX, len=%lX \n", ++ ROOTFS_SPLIT_NAME, dpart->offset, dpart->size); ++ ++ ret = add_one_partition(master, dpart, index, NULL); ++ if (ret) ++ kfree(dpart); ++ ++ return ret; ++} ++#endif /* CONFIG_MTD_ROOTFS_SPLIT */ ++ /* * 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 -@@ -319,169 +487,53 @@ - const struct mtd_partition *parts, +@@ -320,168 +581,31 @@ int add_mtd_partitions(struct mtd_info * int nbparts) { -- struct mtd_part *slave; + struct mtd_part *slave; - u_int32_t cur_offset = 0; - int i; + struct mtd_partition *part; -+ int i, ret = 0; ++ int i, j, ret = 0; printk (KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); - for (i = 0; i < nbparts; i++) { -+ part = (struct mtd_partition *) &parts[i]; -+ ret = add_mtd_partition(master, part, i); -+ if (ret) -+ return ret; -+ if (strcmp(part->name, "rootfs") == 0) { -+#ifdef CONFIG_MTD_SPLIT_ROOTFS -+ int len; -+ char buf[512]; -+ struct squashfs_super_block *sb = (struct squashfs_super_block *) buf; -+#define ROOTFS_SPLIT_NAME "rootfs_data" -+ if ((master->read(master, part->offset, sizeof(struct squashfs_super_block), &len, buf) == 0) && -+ (len == sizeof(struct squashfs_super_block)) && -+ (*((u32 *) buf) == SQUASHFS_MAGIC) && -+ (sb->bytes_used > 0)) { -+ -+ -+ part = kmalloc(sizeof(struct mtd_partition), GFP_KERNEL); -+ memcpy(part, &parts[i], sizeof(struct mtd_partition)); -+ -+ part->name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); -+ strcpy(part->name, ROOTFS_SPLIT_NAME); -+ -+ len = (u32) sb->bytes_used; -+ len += (part->offset & 0x000fffff); -+ len += (master->erasesize - 1); -+ len &= ~(master->erasesize - 1); -+ len -= (part->offset & 0x000fffff); -+ part->offset += len; -+ part->size -= len; -+ -+ if (master->erasesize <= part->size) -+ ret = add_mtd_partition(master, part, i + 1); -+ else -+ kfree(part->name); -+ if (ret) -+ return ret; - +- for (i = 0; i < nbparts; i++) { +- - /* allocate the partition structure */ - slave = kzalloc (sizeof(*slave), GFP_KERNEL); - if (!slave) { @@ -324,8 +388,7 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt - printk(KERN_NOTICE "Moving partition %d: " - "0x%08x -> 0x%08x\n", i, - cur_offset, slave->offset); -+ kfree(part); - } +- } - } - if (slave->mtd.size == MTDPART_SIZ_FULL) - slave->mtd.size = master->size - slave->offset; @@ -390,7 +453,20 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt - offs + slave->offset)) - slave->mtd.ecc_stats.badblocks++; - offs += slave->mtd.erasesize; -- } ++ for (i = 0, j = 0; i < nbparts; i++) { ++ part = (struct mtd_partition *) &parts[i]; ++ ret = add_one_partition(master, part, j, &slave); ++ if (ret) ++ return ret; ++ j++; ++ ++ if (strcmp(part->name, "rootfs") == 0 && slave->registered) { ++#if CONFIG_MTD_ROOTFS_ROOT_DEV ++ if (ROOT_DEV == 0) { ++ printk(KERN_NOTICE "mtd: partition \"rootfs\" " ++ "set to be root filesystem\n"); ++ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index); + } - } - - if(parts[i].mtdp) @@ -403,8 +479,12 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt - /* register our partition */ - add_mtd_device(&slave->mtd); - slave->registered = 1; -+#endif /* CONFIG_MTD_SPLIT_ROOTFS */ -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, i); ++#endif ++#if CONFIG_MTD_ROOTFS_SPLIT ++ ret = split_rootfs_data(master, part, j); ++ if (ret == 0) ++ j++; ++#endif } } diff --git a/target/linux/generic-2.6/patches/060-rootfs_split.patch b/target/linux/generic-2.6/patches/060-rootfs_split.patch index 7e4161e8df..c8fe052b83 100644 --- a/target/linux/generic-2.6/patches/060-rootfs_split.patch +++ b/target/linux/generic-2.6/patches/060-rootfs_split.patch @@ -1,21 +1,28 @@ -diff -urN linux-2.6.21.1.old/drivers/mtd/Kconfig linux-2.6.21.1.dev/drivers/mtd/Kconfig ---- linux-2.6.21.1.old/drivers/mtd/Kconfig 2007-04-27 23:49:26.000000000 +0200 -+++ linux-2.6.21.1.dev/drivers/mtd/Kconfig 2007-05-26 19:58:42.320520952 +0200 -@@ -49,6 +49,11 @@ +Index: linux/drivers/mtd/Kconfig +=================================================================== +--- linux.orig/drivers/mtd/Kconfig ++++ linux/drivers/mtd/Kconfig +@@ -47,6 +47,16 @@ config MTD_PARTITIONS devices. Partitioning on NFTL 'devices' is a different - that's the 'normal' form of partitioning used on a block device. -+config MTD_SPLIT_ROOTFS -+ bool "Automatically split rootfs partition for squashfs" ++config MTD_ROOTFS_ROOT_DEV ++ bool "Automatically set 'rootfs' partition to be root filesystem" ++ depends on MTD_PARTITIONS ++ default y ++ ++config MTD_ROOTFS_SPLIT ++ bool "Automatically split 'rootfs' partition for squashfs" + depends on MTD_PARTITIONS + default y + config MTD_REDBOOT_PARTS tristate "RedBoot partition table parsing" depends on MTD_PARTITIONS -diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mtd/mtdpart.c ---- linux-2.6.21.1.old/drivers/mtd/mtdpart.c 2007-04-27 23:49:26.000000000 +0200 -+++ linux-2.6.21.1.dev/drivers/mtd/mtdpart.c 2007-05-26 19:58:42.331519280 +0200 +Index: linux/drivers/mtd/mtdpart.c +=================================================================== +--- linux.orig/drivers/mtd/mtdpart.c ++++ linux/drivers/mtd/mtdpart.c @@ -20,6 +20,8 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> @@ -25,15 +32,16 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt /* Our partition linked list */ static LIST_HEAD(mtd_partitions); -@@ -308,6 +310,172 @@ +@@ -308,6 +310,265 @@ int del_mtd_partitions(struct mtd_info * return 0; } +static u_int32_t cur_offset = 0; -+static int add_mtd_partition(struct mtd_info *master, const struct mtd_partition *part, int i) ++static int add_one_partition(struct mtd_info *master, const struct mtd_partition *part, ++ int i, struct mtd_part **slp) +{ + struct mtd_part *slave; -+ ++ + /* allocate the partition structure */ + slave = kzalloc (sizeof(*slave), GFP_KERNEL); + if (!slave) { @@ -54,7 +62,6 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt + slave->mtd.subpage_sft = master->subpage_sft; + + slave->mtd.name = part->name; -+ slave->mtd.bank_size = master->bank_size; + slave->mtd.owner = master->owner; + + slave->mtd.read = part_read; @@ -192,62 +199,118 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt + slave->registered = 1; + } + ++ if (slp) ++ *slp = slave; ++ + return 0; +} + ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++#define ROOTFS_SPLIT_NAME "rootfs_data" ++static int split_squashfs(struct mtd_info *master, struct mtd_partition *old, ++ struct mtd_partition **new) ++{ ++ struct mtd_partition *part = NULL; ++ int len; ++ char buf[512]; ++ struct squashfs_super_block *sb = (struct squashfs_super_block *) buf; ++ int ret; ++ ++ ret = master->read(master, old->offset, sizeof(*sb), &len, buf); ++ if (ret) { ++ printk(KERN_ALERT "split_squashfs: error occured while reading " ++ "from \"%s\"\n", master->name); ++ goto out; ++ } ++ ++ if (len != sizeof(*sb)) { ++ printk(KERN_ALERT "split_squashfs: unable to read superblock " ++ "from \"%s\"\n", master->name); ++ ret=-1; ++ goto out; ++ } ++ ++ if (*((u32 *) buf) != SQUASHFS_MAGIC) { ++ printk(KERN_ALERT "split_squasfs: no squashfs found in \"%s\"\n", ++ master->name); ++ ret=0; ++ goto out; ++ } ++ ++ if (sb->bytes_used <= 0) { ++ printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n", ++ master->name); ++ ret=0; ++ goto out; ++ } ++ ++ part = kmalloc(sizeof(*part)+sizeof(ROOTFS_SPLIT_NAME)+1, GFP_KERNEL); ++ if (part == NULL) { ++ printk(KERN_INFO "split_squashfs: no memory for partition \"%s\"\n", ++ ROOTFS_SPLIT_NAME); ++ ret = -ENOMEM; ++ goto out; ++ } ++ ++ part->name = (unsigned char *)&part[1]; ++ memcpy(part, old, sizeof(*part)); ++ strcpy(part->name, ROOTFS_SPLIT_NAME); ++ ++ len = (u32) sb->bytes_used; ++ len += (part->offset & 0x000fffff); ++ len += (master->erasesize - 1); ++ len &= ~(master->erasesize - 1); ++ len -= (part->offset & 0x000fffff); ++ part->offset += len; ++ part->size -= len; ++ ++ ret = 0; ++ ++out: ++ *new = part; ++ return ret; ++} ++ ++static int split_rootfs_data(struct mtd_info *master, struct mtd_partition *part, ++ int index) ++{ ++ struct mtd_partition *dpart; ++ int ret; ++ ++ ret = split_squashfs(master, part, &dpart); ++ if (ret) ++ return ret; ++ ++ if (dpart == NULL) ++ return 1; ++ ++ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%lX, len=%lX \n", ++ ROOTFS_SPLIT_NAME, dpart->offset, dpart->size); ++ ++ ret = add_one_partition(master, dpart, index, NULL); ++ if (ret) ++ kfree(dpart); ++ ++ return ret; ++} ++#endif /* CONFIG_MTD_ROOTFS_SPLIT */ ++ /* * 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 -@@ -319,170 +487,53 @@ - const struct mtd_partition *parts, +@@ -320,168 +581,31 @@ int add_mtd_partitions(struct mtd_info * int nbparts) { -- struct mtd_part *slave; + struct mtd_part *slave; - u_int32_t cur_offset = 0; - int i; + struct mtd_partition *part; -+ int i, ret = 0; ++ int i, j, ret = 0; printk (KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); - for (i = 0; i < nbparts; i++) { -+ part = (struct mtd_partition *) &parts[i]; -+ ret = add_mtd_partition(master, part, i); -+ if (ret) -+ return ret; -+ if (strcmp(part->name, "rootfs") == 0) { -+#ifdef CONFIG_MTD_SPLIT_ROOTFS -+ int len; -+ char buf[512]; -+ struct squashfs_super_block *sb = (struct squashfs_super_block *) buf; -+#define ROOTFS_SPLIT_NAME "rootfs_data" -+ if ((master->read(master, part->offset, sizeof(struct squashfs_super_block), &len, buf) == 0) && -+ (len == sizeof(struct squashfs_super_block)) && -+ (*((u32 *) buf) == SQUASHFS_MAGIC) && -+ (sb->bytes_used > 0)) { -+ -+ -+ part = kmalloc(sizeof(struct mtd_partition), GFP_KERNEL); -+ memcpy(part, &parts[i], sizeof(struct mtd_partition)); -+ -+ part->name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL); -+ strcpy(part->name, ROOTFS_SPLIT_NAME); -+ -+ len = (u32) sb->bytes_used; -+ len += (part->offset & 0x000fffff); -+ len += (master->erasesize - 1); -+ len &= ~(master->erasesize - 1); -+ len -= (part->offset & 0x000fffff); -+ part->offset += len; -+ part->size -= len; -+ -+ if (master->erasesize <= part->size) -+ ret = add_mtd_partition(master, part, i + 1); -+ else -+ kfree(part->name); -+ if (ret) -+ return ret; - +- for (i = 0; i < nbparts; i++) { +- - /* allocate the partition structure */ - slave = kzalloc (sizeof(*slave), GFP_KERNEL); - if (!slave) { @@ -268,7 +331,6 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt - slave->mtd.subpage_sft = master->subpage_sft; - - slave->mtd.name = parts[i].name; -- slave->mtd.bank_size = master->bank_size; - slave->mtd.owner = master->owner; - - slave->mtd.read = part_read; @@ -326,8 +388,7 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt - printk(KERN_NOTICE "Moving partition %d: " - "0x%08x -> 0x%08x\n", i, - cur_offset, slave->offset); -+ kfree(part); - } +- } - } - if (slave->mtd.size == MTDPART_SIZ_FULL) - slave->mtd.size = master->size - slave->offset; @@ -392,7 +453,20 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt - offs + slave->offset)) - slave->mtd.ecc_stats.badblocks++; - offs += slave->mtd.erasesize; -- } ++ for (i = 0, j = 0; i < nbparts; i++) { ++ part = (struct mtd_partition *) &parts[i]; ++ ret = add_one_partition(master, part, j, &slave); ++ if (ret) ++ return ret; ++ j++; ++ ++ if (strcmp(part->name, "rootfs") == 0 && slave->registered) { ++#if CONFIG_MTD_ROOTFS_ROOT_DEV ++ if (ROOT_DEV == 0) { ++ printk(KERN_NOTICE "mtd: partition \"rootfs\" " ++ "set to be root filesystem\n"); ++ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index); + } - } - - if(parts[i].mtdp) @@ -405,8 +479,12 @@ diff -urN linux-2.6.21.1.old/drivers/mtd/mtdpart.c linux-2.6.21.1.dev/drivers/mt - /* register our partition */ - add_mtd_device(&slave->mtd); - slave->registered = 1; -+#endif /* CONFIG_MTD_SPLIT_ROOTFS */ -+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, i); ++#endif ++#if CONFIG_MTD_ROOTFS_SPLIT ++ ret = split_rootfs_data(master, part, j); ++ if (ret == 0) ++ j++; ++#endif } } diff --git a/target/linux/magicbox-2.6/config/default b/target/linux/magicbox-2.6/config/default index 83c9d4b2a8..3e36514e94 100644 --- a/target/linux/magicbox-2.6/config/default +++ b/target/linux/magicbox-2.6/config/default @@ -129,7 +129,6 @@ CONFIG_MTD_PHYSMAP_START=0xffc00000 # CONFIG_MTD_REDBOOT_PARTS is not set # CONFIG_MTD_ROM is not set # CONFIG_MTD_SLRAM is not set -CONFIG_MTD_SPLIT_ROOTFS=y # CONFIG_NATSEMI is not set # CONFIG_NE2K_PCI is not set # CONFIG_NET_VENDOR_3COM is not set diff --git a/target/linux/rdc-2.6/config/default b/target/linux/rdc-2.6/config/default index c29b715c9b..4d4859778f 100644 --- a/target/linux/rdc-2.6/config/default +++ b/target/linux/rdc-2.6/config/default @@ -183,7 +183,8 @@ CONFIG_MTD_RDC3210_SIZE=0x400000 # CONFIG_MTD_ROM is not set # CONFIG_MTD_SC520CDP is not set # CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_SPLIT_ROOTFS is not set +# CONFIG_MTD_ROOTFS_ROOT_DEV is not set +# CONFIG_MTD_ROOTFS_SPLIT is not set # CONFIG_MTD_TS5500 is not set # CONFIG_MTRR is not set # CONFIG_MVIAC3_2 is not set |