jffs2: fix sector_size calculation in case of NOR flash
Need to take all sectors into account then calculating sector_size for NOR flashes.
Signed-off-by Ilya Yanok <[email protected]>
--- common/cmd_jffs2.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
common/cmd_jffs2.c +0 -0
@@ -344,7 +344,9 @@ static int part_validate_nor(struct mtdids *id,
struct part_info *part)
flash = &flash_info[id->num];
- part->sector_size = 0; + /* size of last sector */ + part->sector_size = flash->size -
+ (flash->start[flash->sector_count-1] - flash->start[0]);
offset_aligned = 0;
for (i = 0; i < flash->sector_count; i++) {
@@ -360,6 +362,7 @@ static int part_validate_nor(struct mtdids *id,
struct part_info *part)
}
end_offset = part->offset + part->size;
+ offset_aligned = 0;
for (i = 0; i < flash->sector_count; i++) {
if (i) {
sector_size = flash->start[i] - flash->start[i-1];
@@ -367,10 +370,10 @@ static int part_validate_nor(struct mtdids *id,
struct part_info *part)
part->sector_size = sector_size;
}
if ((flash->start[i] - flash->start[0]) == end_offset)
- return 0;
+ offset_aligned = 1;
}- if (flash->size == end_offset)
+ if (offset_aligned || flash->size == end_offset)
return 0;
printf("%s%d: partition (%s) size alignment incorrect\n",
Signature · 6 lines
1.5.6.1 You can try it. But I think the only affected case is summary enabled FS which is rather rare. Regards, Ilya.