From bcc87aa2d908389534394caa8659fd613817584f Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 16 Apr 2008 20:47:13 +0300 Subject: ubinize: correctly calculate VID offset when min I/O unit is 1 Signed-off-by: Artem Bityutskiy --- ubi-utils/new-utils/src/libubigen.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ubi-utils/new-utils/src/libubigen.c b/ubi-utils/new-utils/src/libubigen.c index 8d71fde..34e2c0b 100644 --- a/ubi-utils/new-utils/src/libubigen.c +++ b/ubi-utils/new-utils/src/libubigen.c @@ -52,8 +52,11 @@ void ubigen_info_init(struct ubigen_info *ui, int peb_size, int min_io_size, int subpage_size, int vid_hdr_offs, int ubi_ver, long long ec) { - if (!vid_hdr_offs) - vid_hdr_offs = subpage_size; + if (!vid_hdr_offs) { + vid_hdr_offs = UBI_EC_HDR_SIZE + subpage_size - 1; + vid_hdr_offs /= subpage_size; + vid_hdr_offs *= subpage_size; + } ui->peb_size = peb_size; ui->min_io_size = min_io_size; -- cgit v1.2.3