Specifications
[marex@pollux]$
Note that for the NAND device we must pass the "-s 2048" option to ubinize; if we don't, an attempt to attach
the created UBI device will result in error messages like these:
root@generic-armv5te:~# ubiattach /dev/ubi_ctrl -m 4
[ 196.320000] UBI: attaching mtd4 to ubi0
[ 199.060000] UBI: scanning is finished
[ 199.090000] UBI: attached mtd4 (name "filesystem", size 248 MiB) to ubi0
[ 199.090000] UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
[ 199.110000] UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
[ 199.110000] UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
[ 199.130000] UBI: good PEBs: 1984, bad PEBs: 0, corrupted PEBs: 0
[ 199.130000] UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
[ 199.150000] UBI: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 1951905100
[ 199.150000] UBI: available PEBs: 0, total reserved PEBs: 1984, PEBs reserved for bad PEB handling: 4
[ 199.170000] UBI: background thread "ubi_bgt0d" started, PID 745
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:~#
For background information please see
http://www.linux-mtd.infradead.org/faq/ubi.html#L_vid_offset_mismatch
Erase MTD partitions and install UBI images:
root@generic-armv5te:/home/duts# ubiformat -q -s 2048 -f /home/duts/image-filesy stem.ubi /dev/mtd4
root@generic-armv5te:/home/duts#
Verify that it worked:
root@generic-armv5te:/home/duts# ubiattach /dev/ubi_ctrl -m 4 -O 2048
[ 213.240000] UBI: attaching mtd4 to ubi0
[ 215.970000] UBI: scanning is finished
[ 216.000000] UBI error: init_volumes: not enough PEBs, required 1986, available 1984
[ 216.010000] UBI error: ubi_wl_init: no enough physical eraseblocks (-2, need 1)
[ 216.030000] UBI error: ubi_attach_mtd_dev: failed to attach mtd4, error -12
ubiattach: error!: cannot attach mtd4
error 12 (Cannot allocate memory)
root@generic-armv5te:/home/duts# mount -t ubifs /dev/ubi0_0 /mnt/filesystem
[ 218.290000] UBIFS error (pid 749): ubifs_mount: cannot open "/dev/ubi0_0", error -22
mount: wrong fs type, bad option, bad superblock on /dev/ubi0_0,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog - try
dmesg | tail or so
root@generic-armv5te:/home/duts# ls -al /mnt/filesystem
total 8
drwxr-xr-x 2 root root 4096 Oct 2 15:01 .
drwxr-xr-x 4 root root 4096 Oct 2 15:01 ..
root@generic-armv5te:/home/duts# hexdump -C /mnt/filesystem/date_of_creation
hexdump: /mnt/filesystem/date_of_creation: No such file or directory
hexdump: /mnt/filesystem/date_of_creation: Bad file descriptor
root@generic-armv5te:/home/duts#
9.2. The TMPFS Virtual Memory Filesystem
The tmpfs filesystem, formerly known as shmfs, is a filesystem keeping all files in virtual memory.
9.2. The TMPFS Virtual Memory Filesystem 106