X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/8be1093039aa9942ec456dff0255c2b0c41f2cce..6ea4c6c0f2ae52def12bf2f77edd69e314152eca:/target/linux/generic/patches-2.6.37/065-rootfs_split.patch diff --git a/target/linux/generic/patches-2.6.37/065-rootfs_split.patch b/target/linux/generic/patches-2.6.37/065-rootfs_split.patch index 63c545412..e9bb12107 100644 --- a/target/linux/generic/patches-2.6.37/065-rootfs_split.patch +++ b/target/linux/generic/patches-2.6.37/065-rootfs_split.patch @@ -37,7 +37,7 @@ /* * MTD methods which simply translate the effective address and pass through -@@ -618,6 +620,164 @@ int mtd_del_partition(struct mtd_info *m +@@ -618,6 +620,153 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -92,8 +92,7 @@ +{ + struct mtd_partition *dpart; + struct mtd_part *slave = NULL; -+ int split_offset = 0; -+ int ret; ++ int ret, split_offset = 0; + + ret = split_squashfs(master, part->offset, &split_offset); + if (ret) @@ -122,25 +121,15 @@ + printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%llX, len=%llX \n", + ROOTFS_SPLIT_NAME, dpart->offset, dpart->size); + -+ slave = add_one_partition(master, dpart, 0, split_offset); -+ if (!slave) { -+ kfree(dpart); -+ return -ENOMEM; -+ } -+ if (!strcmp(parts[i].name, "rootfs")) { -+#ifdef 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); -+ } -+#endif -+#ifdef CONFIG_MTD_ROOTFS_SPLIT -+ ret = split_rootfs_data(master, &slave->mtd, &parts[i]); -+ /* if (ret == 0) -+ * j++; */ -+#endif -+ } ++ slave = allocate_partition(master, dpart, 0, split_offset); ++ if (IS_ERR(slave)) ++ return PTR_ERR(slave); ++ mutex_lock(&mtd_partitions_mutex); ++ list_add(&slave->list, &mtd_partitions); ++ mutex_unlock(&mtd_partitions_mutex); ++ ++ add_mtd_device(&slave->mtd); ++ + rpart->split = &slave->mtd; + + return 0; @@ -202,7 +191,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 -@@ -633,7 +793,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -633,7 +782,7 @@ int add_mtd_partitions(struct mtd_info * { struct mtd_part *slave; uint64_t cur_offset = 0; @@ -211,7 +200,29 @@ printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name); -@@ -655,6 +815,32 @@ int add_mtd_partitions(struct mtd_info * +@@ -648,6 +797,21 @@ int add_mtd_partitions(struct mtd_info * + + add_mtd_device(&slave->mtd); + ++ if (!strcmp(parts[i].name, "rootfs")) { ++#ifdef 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); ++ } ++#endif ++#ifdef CONFIG_MTD_ROOTFS_SPLIT ++ ret = split_rootfs_data(master, &slave->mtd, &parts[i]); ++ /* if (ret == 0) ++ * j++; */ ++#endif ++ } ++ + cur_offset = slave->offset + slave->mtd.size; + } + +@@ -655,6 +819,32 @@ int add_mtd_partitions(struct mtd_info * } EXPORT_SYMBOL(add_mtd_partitions); @@ -538,7 +549,7 @@ part->name = dev->mtd.name; --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c -@@ -841,6 +841,13 @@ static int mtd_ioctl(struct file *file, +@@ -841,6 +841,13 @@ static int mtd_ioctl(struct file *file, file->f_pos = 0; break; }