public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* ubiattach fails with bad VID header offset 2048, expected 512 ???
@ 2008-12-11 13:41 Cal Page
  2008-12-11 19:28 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Cal Page @ 2008-12-11 13:41 UTC (permalink / raw)
  To: linux-mtd

ubiattach fails with bad VID header offset 2048, expected 512 ???

The is the first thing out of the box. It reads block 0 to get the 
ubi_ec_hdr then parses it.

Our system reads/writes 2048 byte blocks with only 32 bytes available in 
the oob area per block.

For my system, is vid_hdr_offset supposed to be 2048, ie point into the 
oob area?

How do I get it working?

Thanks,
Cal Page

here's the log

UBI DBG (pid 2785): ctrl_cdev_ioctl: attach MTD device
UBI: attaching mtd12 to ubi0
UBI DBG (pid 2785): io_init: min_io_size      2048
UBI DBG (pid 2785): io_init: hdrs_min_io_size 512
UBI DBG (pid 2785): io_init: ec_hdr_alsize    512
UBI DBG (pid 2785): io_init: vid_hdr_alsize   512
UBI DBG (pid 2785): io_init: vid_hdr_offset   512
UBI DBG (pid 2785): io_init: vid_hdr_aloffset 512
UBI DBG (pid 2785): io_init: vid_hdr_shift    0
UBI DBG (pid 2785): io_init: leb_start        2048
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI DBG (pid 2785): ubi_scan: process PEB 0
UBI DBG (pid 2785): ubi_io_read_ec_hdr: read EC header from PEB 0
UBI DBG (pid 2785): ubi_io_read: read 64 bytes from PEB 0:0
UBI DBG (pid 2785): ubi_io_read: read: addr = 0, len = 64, 
ubi->mtd->read = 0xc0
cfe16c
UBI error: validate_ec_hdr: bad VID header offset 2048, expected 512
UBI error: validate_ec_hdr: bad EC header
Erase counter header dump:
        magic          0x55424923
        version        1
        ec             1
        vid_hdr_offset 2048
        data_offset    4096
        hdr_crc        0x7f585319
erase counter header hexdump:
00000000: 55 42 49 23 01 00 00 00 00 00 00 00 00 00 00 01 00 00 08 00 00 
00 10 0
0 00 00 00 00 00 00 00 00  UBI#............................
00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 0
0 00 00 00 00 7f 58 53 19  .............................XS.
UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0
UBI error: ubi_attach_mtd_dev: failed to attach by scanning, error -22

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ubiattach fails with bad VID header offset 2048, expected 512 ???
  2008-12-11 13:41 ubiattach fails with bad VID header offset 2048, expected 512 ??? Cal Page
@ 2008-12-11 19:28 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2008-12-11 19:28 UTC (permalink / raw)
  To: Cal Page; +Cc: linux-mtd

On Thu, 2008-12-11 at 08:41 -0500, Cal Page wrote:
> ubiattach fails with bad VID header offset 2048, expected 512 ???
> 
> The is the first thing out of the box. It reads block 0 to get the 
> ubi_ec_hdr then parses it.

I guess you generated an image with wrong sub-page size?

> UBI DBG (pid 2785): ctrl_cdev_ioctl: attach MTD device
> UBI: attaching mtd12 to ubi0
> UBI DBG (pid 2785): io_init: min_io_size      2048
> UBI DBG (pid 2785): io_init: hdrs_min_io_size 512
> UBI DBG (pid 2785): io_init: ec_hdr_alsize    512
> UBI DBG (pid 2785): io_init: vid_hdr_alsize   512
> UBI DBG (pid 2785): io_init: vid_hdr_offset   512
> UBI DBG (pid 2785): io_init: vid_hdr_aloffset 512
> UBI DBG (pid 2785): io_init: vid_hdr_shift    0
> UBI DBG (pid 2785): io_init: leb_start        2048
> UBI: physical eraseblock size:   131072 bytes (128 KiB)
> UBI: logical eraseblock size:    129024 bytes
> UBI: smallest flash I/O unit:    2048
> UBI: sub-page size:              512
> UBI: VID header offset:          512 (aligned 512)
> UBI: data offset:                2048

You have 512 bytes sub-pages, so UBI expects the volume ID header to be
at offset 512.

Probably these sections should give you some understanding how and at
which offsets the headers are stored:

http://www.linux-mtd.infradead.org/doc/ubi.html#L_overhead
http://www.linux-mtd.infradead.org/faq/ubi.html#L_ubi_mkimg
http://www.linux-mtd.infradead.org/faq/ubi.html#L_find_min_io_size

Anyway, if you want to force UBI to use other position for the VID
header, there are UBI module options for this. Take a look at what
'modinfo ubi' tells.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-11 19:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-11 13:41 ubiattach fails with bad VID header offset 2048, expected 512 ??? Cal Page
2008-12-11 19:28 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox