UBI success story

Christoph Mair ml at chonyota.net
Sat Dec 26 21:25:57 CET 2009


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).

Using the ubi filesystem on the freerunner is not an easy task. A ubi image 
can't be flashed using nandwrite. I'm not sure about dfu-util, but probably it 
uses the same technique as nandwrite and therefore won't work too. I did a 
manual installation (untar SHR into a mounted ubifs) using archmobile 
installed on SD. If the SHR ubi image is created with the right parameters 
ubiformat or ubiupdatevol could be used to install the image. For a easy 
installation with dfu-util, u-boot would need support for ubi images.

I used the newest kernel (om-gta02-2.6.32), but a older one should work too.

Step-by-step, I did:
- Prepare a SD card with archmobile. Any distro should work as long as it 
provides the mtd-utils package (ubiattach, ubimkvol, ..)
- Copy the kernel to the SD-Card. I used the same kernel to create the ubi 
filesystem which will be used to run shr. This should not be necessary, but 
- Boot from SD
- ubiattach /dev/ubi_ctrl -m 6 -O 2048
If this does not work, try to run ubiformat /dev/mtd6 -s 2048 -O 2048 first.
If this fails too, erase the flash with flash_eraseall /dev/mtd6. Now ubiattach 
should succeed.
- ubimkvol /dev/ubi0 -N rootfs -m
- mount -t ubifs ubi0:rootfs /mnt
- tar -xzf <shr-rootfs.tar.gz> -C /mnt
- umount /mnt
- ubidetach /dev/ubi_ctrl -m6

If everything worked you end up with a ubifs containing SHR, but it won't 
boot. ;)

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 
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 :)
- Download a git snapshot and modify src/cpu/s3c2442/gta02.c. The interesting 
lines are at the bottom of the file.
- Compile: make CPU=s3c2442
- Flash: dfu-util -a u-boot -R -D image/qi-s3c2442-master_*.udfu

Do not forget to flash the kernel, if needed.


Good luck!

P.S. My SHR is not working yet. There are some issues with kernel 2.6.32, but 
that's a different story.

More information about the community mailing list