summaryrefslogtreecommitdiff
path: root/ubi-utils
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-04-18 16:35:22 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-04-18 16:45:39 +0300
commita09d039bfe84170b90df54461a0155db5bb2495c (patch)
tree2fc0897de402fe29f8e2ec276e9cc8303b2ebb55 /ubi-utils
parent194b2a55f626b94323b377d75edb295f536359c5 (diff)
ubiformat: fix segfault and messages
ubiformat segfaults like this: ubiformat: mtd0 (NAND), size 134217728 bytes (128.0 MiB), 16384 eraseblocks of 16384 bytes (16.0 KiB), min. I/O size 512 bytes libscan: scanning eraseblock 8191 -- 100 % complete ubiformat: 8190 eraseblocks have valid erase counter, mean value is 9 ubiformat: 2 eraseblocks are supposedly empty ubiformat: warning!: VID header and data offsets on flash are 512 and 1024, which is different to calculated offsets 256 and 512 ubiformat: use new offsets 512 and 1024? (yes/no) no Segmentation fault The reason is that volume table size is calculated for 256/512 layout, and when user chooses 512/1024 - it is not re-calculated which leads to segfault in 'ubigen_write_layout_vol()'. This patch also fixes the message - in the above output new offsets are 256/512, not 512/1024. Also, this patch adds explicit printing of the selected positions. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils')
-rw-r--r--ubi-utils/src/ubiformat.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ubi-utils/src/ubiformat.c b/ubi-utils/src/ubiformat.c
index 2226a75..920df9a 100644
--- a/ubi-utils/src/ubiformat.c
+++ b/ubi-utils/src/ubiformat.c
@@ -852,19 +852,19 @@ int main(int argc, char * const argv[])
*/
if (!args.yes || !args.quiet) {
warnmsg("VID header and data offsets on flash are %d and %d, "
- "which is different to calculated offsets %d and %d",
+ "which is different to requested offsets %d and %d",
si->vid_hdr_offs, si->data_offs, ui.vid_hdr_offs,
ui.data_offs);
normsg_cont("use new offsets %d and %d? (yes/no) ",
- si->vid_hdr_offs, si->data_offs);
+ ui.vid_hdr_offs, ui.data_offs);
}
if (args.yes || answer_is_yes()) {
if (args.yes && !args.quiet)
printf("yes\n");
- } else {
- ui.vid_hdr_offs = si->vid_hdr_offs;
- ui.data_offs = si->data_offs;
- }
+ } else
+ ubigen_info_init(&ui, mtd.eb_size, mtd.min_io_size, 0,
+ si->vid_hdr_offs, args.ubi_ver);
+ normsg("use offsets %d and %d", ui.vid_hdr_offs, ui.data_offs);
}
if (args.image) {