Setup the UBI rootfs image

Boot into initramfs

Boot using the kernel with inline initramfs.

Make sure kernel command line does not have something like ubi=mtdX. Otherwise, you have to ubidetach before burning.

Create the device files

Read the device major minor by:

cat /sys/class/ubi/ubi0/dev
# result: 252:0 

cat /sys/class/misc/ubi_ctrl/dev
# result: 10:59

Create the devices:

mknod /dev/ubi0 c 252 0
mknod /dev/ubi_ctrl c 10 59

Burn the rootfs image to the flash

# ubiformat /dev/mtd2 -s 2048 -f rootfs.ubi

Check the resulting filesystem

First, attach UBI to the MTD partition 2:

ubiattach /dev/ubi_ctrl -m 2

kernel output:

UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size:   262144 bytes (256 KiB)
UBI: logical eraseblock size:    258048 bytes
UBI: smallest flash I/O unit:    2048
UBI: VID header offset:          2048 (aligned 2048)
UBI: data offset:                4096
UBI: volume 0 ("mini6410-rootfs") re-sized from 49 to 4030 LEBs
UBI: attached mtd2 to ubi0
UBI: MTD device name:            "File System"
UBI: MTD device size:            1018 MiB
UBI: number of good PEBs:        4074
UBI: number of bad PEBs:         0
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 4074
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 4/2
UBI: background thread "ubi_bgt0d" started, PID 92
UBI device number 0, total 4074 LEBs (1051287552 bytes, 1002.6 MiB), available 0
 LEBs (0 bytes), LEB size 258048 bytes (252.0 KiB)

Mount the UBI volume inside the MTD partition :

mount -t ubifs ubi0:mini6410-rootfs /tmp/rootfs

Output:

UBIFS: mounted UBI device 0, volume 0, name "mini6410-rootfs"
UBIFS: file system size:   1037352960 bytes (1013040 KiB, 989 MiB, 4020 LEBs)
UBIFS: journal size:       9420800 bytes (9200 KiB, 8 MiB, 37 LEBs)
UBIFS: media format:       4 (latest is 4)
UBIFS: default compressor: LZO
UBIFS: reserved for root:  0 bytes (0 KiB)

Change kernel bootargs

If ok, the bootargs should be changed:

setenv bootargs "console=ttySAC0,115200 ubi.mtd=2 root=ubi0:mini6410-rootfs rootfstype=ubifs"
saveenv

Setup opkg repository

At the target /etc/opkg folder, edit opkg.conf to add the ipk download links:

src/gz all http://192.168.0.24/6410/all 
src/gz armv6 http://192.168.0.24/6410/armv6
src/gz mini6410 http://192.168.0.24/6410/mini6410

Remove all other .conf files , except the arch.conf file.

At the host server httpd conf /etc/apache2/sites-enabled/000-default, add these:

Alias /6410/ "/oe/build/ok6410-tmp/deploy/eglibc/ipk/"

<Directory "/oe/build/ok6410-tmp/deploy/eglibc/ipk/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
</Directory>

After done, at target do

opkg update
opkg install mtd-utils  # for example
oe/setup_the_ubi_rootfs_image.txt · Last modified: 2010-10-22 20:39 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0