diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2016-01-25 07:18:47 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2016-01-25 07:18:47 +0000 |
commit | afaf68025d62ffde7772ad89024d38b7859db4ab (patch) | |
tree | 14c774bf2e0a6007f9b08ca7103f3040a44a7c87 /target/linux/generic/files/drivers | |
parent | f7ab9ae1956dfda8584693b4fcd08a845ae42c88 (diff) | |
download | master-187ad058-afaf68025d62ffde7772ad89024d38b7859db4ab.tar.gz master-187ad058-afaf68025d62ffde7772ad89024d38b7859db4ab.tar.bz2 master-187ad058-afaf68025d62ffde7772ad89024d38b7859db4ab.zip |
kernel: mtdsplit: document Seama splitter a bit
Rename kernel_size variable as it includes whole entity size, not just a
kernel size. Also update comments to match it and describe better what
are we checking/looking for.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48480 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic/files/drivers')
-rw-r--r-- | target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seama.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seama.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seama.c index 6f21f8fb58..4ff361c4f2 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seama.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_seama.c @@ -33,7 +33,7 @@ static int mtdsplit_parse_seama(struct mtd_info *master, struct mtd_part_parser_data *data) { struct seama_header hdr; - size_t hdr_len, retlen, kernel_size; + size_t hdr_len, retlen, kernel_ent_size; size_t rootfs_offset; struct mtd_partition *parts; int err; @@ -50,18 +50,20 @@ static int mtdsplit_parse_seama(struct mtd_info *master, if (be32_to_cpu(hdr.magic) != SEAMA_MAGIC) return -EINVAL; - kernel_size = hdr_len + be32_to_cpu(hdr.size) + - be16_to_cpu(hdr.metasize); - if (kernel_size > master->size) + kernel_ent_size = hdr_len + be32_to_cpu(hdr.size) + + be16_to_cpu(hdr.metasize); + if (kernel_ent_size > master->size) return -EINVAL; - /* Find the rootfs after the kernel. */ - err = mtd_check_rootfs_magic(master, kernel_size); + /* Check for the rootfs right after Seama entity with a kernel. */ + err = mtd_check_rootfs_magic(master, kernel_ent_size); if (!err) { - rootfs_offset = kernel_size; + rootfs_offset = kernel_ent_size; } else { /* - * The size in the header might cover the rootfs as well. + * On some devices firmware entity might contain both: kernel + * and rootfs. We can't determine kernel size so we just have to + * look for rootfs magic. * Start the search from an arbitrary offset. */ err = mtd_find_rootfs_from(master, SEAMA_MIN_ROOTFS_OFFS, |