Specifications
[ 161.550000] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 161.550000] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 161.560000] UBI: good PEBs: 1984, bad PEBs: 0, corrupted PEBs: 0
[ 161.580000] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
[ 161.580000] UBI: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 1951905100
[ 161.600000] UBI: available PEBs: 0, total reserved PEBs: 1984, PEBs reserved for bad PEB handling: 4
[ 161.600000] UBI: background thread "ubi_bgt0d" started, PID 735
UBI device number 0, total 1984 LEBs (251920384 bytes, 240.2 MiB), available 0 LEBs (0 bytes), LEB size 126976 bytes (124.0 KiB)
root@generic-armv5te:~# ubiupdatevol /dev/ubi0_0 /home/duts/image-filesystem.ubi fs
root@generic-armv5te:~# mount -t ubifs /dev/ubi0_0 /mnt/filesystem
[ 167.500000] UBIFS: background thread "ubifs_bgt0_0" started, PID 738
[ 167.640000] UBIFS: mounted UBI device 0, volume 0, name "filesystem"(null)
[ 167.640000] UBIFS: LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
[ 167.650000] UBIFS: FS size: 249507840 bytes (237 MiB, 1965 LEBs), journal size 9023488 bytes (8 MiB, 72 LEBs)
[ 167.670000] UBIFS: reserved for root: 0 bytes (0 KiB)
[ 167.670000] UBIFS: media format: w4/r0 (latest is w4/r0), UUID F31EAD94-B13A-4F8F-9927-E150346C2DEB, small LPT model
root@generic-armv5te:~# ls -l /mnt/filesystem
total 8
-rw-rw-r-- 1 555 555 16 Oct 2 15:01 README
-rw-rw-r-- 1 555 555 30 Oct 2 15:01 date_of_creation
root@generic-armv5te:~# hexdump -C /mnt/filesystem/date_of_creation
00000000 54 75 65 20 4f 63 74 20 20 32 20 31 37 3a 30 31 |Tue Oct 2 17:01|
00000010 3a 32 38 20 43 45 53 54 20 32 30 31 32 0a |:28 CEST 2012.|
0000001e
root@generic-armv5te:~#
9.1.5.3.4. Installing UBI images (if no UBI Volumes exist):
If the UBI device is not already formatted to contain suitable volumes, we have to generate UBI images. An
UBI image may contain one or more UBI volumes, which in turn may be used to store an UBIFS file system.
This is done using the "ubinize" tool, which unfortunately is a bit weird to use: an input configuration ini-file
defines all the UBI volumes - their characteristics and the contents, but it does not define the characteristics of
the flash flash device - these have to be specified as command-line options.
Also, we should keep in mind that we should no longer use "flash_eraseall" to erase the MTD device, as this
has no knowledge about the UBI erase counters. Instead, we should use "ubiformat" to erase the flash and
install a new UBI image.
Unmount and detach previously used UBI devices:
root@generic-armv5te:~# umount /mnt/filesystem
[ 154.740000] UBIFS: un-mount UBI device 0, volume 0
[ 154.750000] UBIFS: background thread "ubifs_bgt0_0" stops
root@generic-armv5te:~# ubidetach /dev/ubi_ctrl -m 4
[ 156.310000] UBI: detaching mtd4 from ubi0
[ 156.320000] UBI: mtd4 is detached from ubi0
root@generic-armv5te:~#
Create UBI ini-file and create UBI images:
Note: for the volume sizes we use the byte count previously determined by running "ubinfo -a" above.
[marex@pollux]$ cat ubi-filesystem.cfg
[ubifs]
mode=ubi
image=image-filesystem.ubifs
vol_id=0
vol_size=251920384
vol_type=dynamic
vol_name=filesystem
[marex@pollux]$ ubinize --min-io-size=2048 --peb-size=128KiB -s 2048 -o image-filesystem.ubi ubi-filesystem.cfg
[marex@pollux]$ cp image-filesystem.ubi /opt/eldk-5.2.1/armv5te/rootfs-lsb-sdk//home/duts/
9.1.5.3.3. Installing UBIFS images into existing UBI Volume: 105