return -EINVAL;
kernel_size = sizeof(hdr) + be32_to_cpu(hdr.v1.kernel_len);
+ rootfs_offset = be32_to_cpu(hdr.v1.rootfs_ofs);
break;
case 2:
case 3:
return -EINVAL;
kernel_size = sizeof(hdr) + be32_to_cpu(hdr.v2.kernel_len);
+ rootfs_offset = be32_to_cpu(hdr.v2.rootfs_ofs);
break;
default:
return -EINVAL;
if (kernel_size > master->size)
return -EINVAL;
- /* Find the rootfs after the kernel. */
- err = mtd_check_rootfs_magic(master, kernel_size, NULL);
- if (!err) {
- rootfs_offset = kernel_size;
- } else {
+ /* Find the rootfs */
+ err = mtd_check_rootfs_magic(master, rootfs_offset, NULL);
+ if (err) {
/*
* The size in the header might cover the rootfs as well.
* Start the search from an arbitrary offset.
parts[0].name = KERNEL_PART_NAME;
parts[0].offset = 0;
- parts[0].size = rootfs_offset;
+ parts[0].size = kernel_size;
parts[1].name = ROOTFS_PART_NAME;
parts[1].offset = rootfs_offset;