- 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;
+ /* 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;
+ }
+
+ if (err <= 0) {
+ if (ifxmips_has_brn_block()) {
+ parts[4].size -= ifxmips_mtd->erasesize;
+ parts[5].offset = ifxmips_mtd->size - ifxmips_mtd->erasesize;
+ parts[5].size = ifxmips_mtd->erasesize;
+ } else {
+ num_parts--;
+ }
+ }