kernel: mtdsplit: fix fit rootfs_data split
fit size should be rounded up instead of rounding down first and adding
a block. Otherwise the calculated size is one block more than needed
when fit size is exactly multiples of one block size.
Fixes: 9a863f803e
("kernel: mtdsplit: add support for FIT image")
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Signed-off-by: Qingfang Deng <qingfang.deng@siflower.com.cn>
This commit is contained in:
parent
75cd4ef48d
commit
7117ebab0b
1 changed files with 2 additions and 2 deletions
|
@ -278,7 +278,7 @@ mtdsplit_fit_parse(struct mtd_info *mtd,
|
||||||
|
|
||||||
parts[0].name = KERNEL_PART_NAME;
|
parts[0].name = KERNEL_PART_NAME;
|
||||||
parts[0].offset = fit_offset;
|
parts[0].offset = fit_offset;
|
||||||
parts[0].size = mtd_rounddown_to_eb(fit_size + offset_start, mtd) + mtd->erasesize;
|
parts[0].size = mtd_roundup_to_eb(fit_size + offset_start, mtd);
|
||||||
|
|
||||||
if (type == MTDSPLIT_PART_TYPE_UBI)
|
if (type == MTDSPLIT_PART_TYPE_UBI)
|
||||||
parts[1].name = UBI_PART_NAME;
|
parts[1].name = UBI_PART_NAME;
|
||||||
|
@ -327,7 +327,7 @@ mtdsplit_fit_parse(struct mtd_info *mtd,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
parts[0].name = ROOTFS_SPLIT_NAME;
|
parts[0].name = ROOTFS_SPLIT_NAME;
|
||||||
parts[0].offset = fit_offset + mtd_rounddown_to_eb(max_size, mtd) + mtd->erasesize;
|
parts[0].offset = fit_offset + mtd_roundup_to_eb(max_size, mtd);
|
||||||
parts[0].size = mtd->size - parts[0].offset;
|
parts[0].size = mtd->size - parts[0].offset;
|
||||||
|
|
||||||
*pparts = parts;
|
*pparts = parts;
|
||||||
|
|
Loading…
Reference in a new issue