- parts = &ifxmips_partitions[0];
- ifxmips_partitions[2].size = uimage_size;
- ifxmips_partitions[3].offset = ifxmips_partitions[2].offset + ifxmips_partitions[2].size;
- ifxmips_partitions[3].size = ((ifxmips_mtd->size >> 20) * 1024 * 1024) - ifxmips_partitions[3].offset;
- if(ifxmips_has_brn_block())
- {
- ifxmips_partitions[3].size -= ifxmips_mtd->erasesize;
- ifxmips_partitions[4].offset = ifxmips_mtd->size - ifxmips_mtd->erasesize;
- ifxmips_partitions[4].size = ifxmips_mtd->erasesize;
- add_mtd_partitions(ifxmips_mtd, parts, 5);
- } else {
- add_mtd_partitions(ifxmips_mtd, parts, 4);
+ /* dynamic size detection only if rootfs-part follows kernel-part */
+ if (kernel_part+1 == rootfs_part) {
+ uimage_size = find_uImage_size(parts[kernel_part].offset);
+
+ if (detect_squashfs_partition(parts[kernel_part].offset + uimage_size)) {
+ printk(KERN_INFO "ifxmips_mtd: found a squashfs following the uImage\n");
+ } else {
+ uimage_size &= ~0xffff;
+ uimage_size += 0x10000;
+ }
+
+ parts[kernel_part].size = uimage_size;
+ parts[rootfs_part].offset = parts[kernel_part].offset + parts[kernel_part].size;
+ parts[rootfs_part].size = ((ifxmips_mtd->size >> 20) * 1024 * 1024) - parts[rootfs_part].offset;
+
+ ifxmips_meta_partition.offset = parts[kernel_part].offset;
+ ifxmips_meta_partition.size = parts[kernel_part].size + parts[rootfs_part].size;