[Shr-User] UBI success story
ml at chonyota.net
Mon Jan 4 14:37:14 CET 2010
[sent again to reach the mailing lists]
On Sunday 03 January 2010 13:11:52 Martin Jansa wrote:
> On Sat, Dec 26, 2009 at 09:25:57PM +0100, Christoph Mair wrote:
> > Hello,
> > I tried to use SHR the ubi images on my freerunner, but they did not
> > work. Does someone know the parameters which are passed to mkfs.ubifs? I
> > think that the ubi fileystem is created for NAND flashes with subpage
> > support, but this feature does not work on the freerunner. Passing -s
> > 2048 should create a working image (but I did not verify this yet).
> Params are in:
> MKUBIFS_ARGS = "-m 2048 -e 129024 -c 2047"
> for mkfs.ubifs
> UBINIZE_ARGS = "-m 2048 -p 128KiB -s 512"
> for ubinize
> So I don't see param for subpage setting for mkfs.ubifs, its only in
> ubinize, but it didn't help for my NAND, even when I prepare ubi volume on
> neo with -s 2048 -O 2048 and then try to updatevol with full image (small
> image like initramfs-kexecboot works for me just fine). That's why I
> didn't push patch for setting it in UBINIZE_ARGS.
Yes, my fault. mkfs.ubifs does not care about subpages. The critical point
here is the logical eraseblock size:
Quote from http://www.linux-mtd.infradead.org/doc/ubi.html#L_subpage:
"Indeed, let's consider a NAND flash with 128KiB eraseblocks and 2048-byte
pages. If it does not have sub-pages, UBI puts the the VID header at physical
offset 2048, so LEB size becomes 124KiB (128KiB minus one NAND page which
stores the EC header and minus another NAND page which stores the VID header."
Therefore the params should be:
MKUBIFS_ARGS = "-m 2048 -e 126976 -c 2047"
With these parameters, I successfully wrote a ubifs image to a ubi volume:
ubiattach /dev/ubi_ctrl -m6 -O 2048
ubimkvol /dev/ubi0 -m -Nrootfs
ubiupdatevol /dev/ubi0_0 test.ubifs
mount -t ubifs ubi0_0 /mnt/
The first step (flash_eraseall) is optional and only needed if ubiattach fails.
IMHO the ubinize params should be
UBINIZE_ARGS = "-m 2048 -p 128KiB -s 2048"
but until now I did not get this to work. I can write the image (sometimes it
needs a few tries) but mount does not work.
> > To fix this, we need to tell the kernel that the mtd partition 6 contains
> > a ubi volume which contains the ubifs rootfs: rootfstype=ubifs
> > ubi.mtd=6,2048 root=ubi0:rootfs.
> > For a "normal" boot qi passes rootfstype=jffs2 root=/dev/mtdblock6 to the
> > kernel. Just changing the boot params within the kernel configuration
> > does not work. Therefore I patched qi :)
> Ah great!, thanks
Remember that ubi0:rootfs specifies the volume name. The current ubinize.cfg
sets this name to om-gta02-rootfs, so change this to ubi0:om-gta02-rootfs
More information about the community