-
- ar7_parts[p].name = "rootfs";
- ar7_parts[p].offset = root_offset;
- ar7_parts[p].size = master->size - root_offset - post_size;
- ar7_parts[p++].mask_flags = 0;
-
- master->read(master, root_offset, sizeof(sb), &len, (u_char *)&sb);
- if (sb.s_magic == SQUASHFS_MAGIC) {
- printk("Squashfs detected (size %Ld)\n", sb.bytes_used);
- new_offset = root_offset + sb.bytes_used;
-
- if ((new_offset % master->erasesize) > 0)
- new_offset += master->erasesize -
- (new_offset % master->erasesize);
-
- ar7_parts[p].name = "rootfs_data";
- ar7_parts[p].offset = new_offset;
- ar7_parts[p].size = master->size - new_offset - post_size;
- ar7_parts[p - 1].size -= ar7_parts[p].size;
- ar7_parts[p - 1].mask_flags |= MTD_WRITEABLE;
- ar7_parts[p++].mask_flags = 0;
- ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, p - 1);
- } else {
- printk("Squashfs not found. Moving rootfs partition to next erase block\n");
- if ((root_offset % master->erasesize) > 0)
- root_offset += master->erasesize -
- (root_offset % master->erasesize);
-
- ar7_parts[p].offset = root_offset;
- ar7_parts[p].size = master->size - root_offset - post_size;
- ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, p);
+
+ master->read(master, root_offset, sizeof(header), &len, (u_char *)&header);
+ if (header.checksum != SQUASHFS_MAGIC) {
+ root_offset += master->erasesize - 1;
+ root_offset &= ~(master->erasesize - 1);