[U-Boot] UBI on NAND flash again

Daniel Mack
2009-06-04T08:06:55Z

On Thu, Jun 04, 2009 at 08:56:51AM +0200, Stefan Roese wrote:
> On Thursday 04 June 2009 08:50:21 Daniel Mack wrote:
> > > > UBI error: ubi_init: cannot attach mtd1
> > > > UBI error: ubi_init: UBI error: cannot initialize UBI, error -12
> > > > UBI init error -12
> > > > exit not allowed from main input shell.
> > >
> > > Did you erase the FLASH partition? If not please try again after erasing.
> >
> > I used ubiformat from Linux using /dev/ubi0 which is attached to
> > /dev/mtd4 which again points to the same area in the flash than
> > 'ubilayer' does in U-Boot. So I should be able to access that same
> > volume from the bootloader, right? Or do I miss some important point?
>
> I have to admit that I never used it this way. Using "ubi part" on an erased
> partition works fine. I suggest you give it a try.

Hmm. That still doesn't work for me, and I still wonder about the
'attaching mtd1 to ubi0' string, which looks like a mismatch to me.

Any idea?

Thanks,
Daniel

$ mtdparts

device nand0 <nand0>, # parts = 5
#: name size offset mask_flags
0: u-boot 0x00080000 0x00000000 0
1: env 0x00020000 0x00080000 0
2: splash 0x00060000 0x000a0000 0
3: kernel 0x00300000 0x00100000 0
4: ubilayer 0x07c00000 0x00400000 0

active partition: nand0,0 - (u-boot) 0x00080000 @ 0x00000000

defaults:
mtdids : nand0=nand0
mtdparts: mtdparts=nand0:512k(u-boot),128k(env),384k(splash),3M(kernel),-(ubilayer)

$ nand erase 0x00400000 0x07c00000

NAND erase: device 0 offset 0x400000, size 0x7c00000
Erasing at 0x7fe0000 -- 100% complete.
OK
$ ubi part ubilayer
Creating 1 MTD partitions on "nand0":
0x00400000-0x08000000 : "mtd=4"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI error: ubi_init: cannot attach mtd1
UBI error: ubi_init: UBI error: cannot initialize UBI, error -12
UBI init error -12
exit not allowed from main input shell.