Specifications

Everything: 24 kilobytes
$ ls -l test.cramfs.img
-rw-r--r-- 1 wd users 24576 Nov 10 23:44 test.cramfs.img
As you can see, the CramFs image test.cramfs.img takes just 24 kB, while the input directory contained 64 kB
of data. Savings of some 60% like in this case are typical CramFs.
Now we write the CramFs image to a partition in flash and test it:
# cp test.cramfs.img /dev/mtd3
# mount -t cramfs /dev/mtdblock3 /mnt
# mount
/dev/root on / type nfs (rw,v2,rsize=4096,wsize=4096,hard,udp,nolock,addr=10.0.0.2)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock3 on /mnt type cramfs (rw)
# ls -l /mnt
total 54
-rwxr-xr-x 1 wd users 8704 Jan 9 16:32 erase
-rwxr-xr-x 1 wd users 9034 Jan 1 01:00 eraseall
-rwxr-xr-x 1 wd users 7459 Jan 1 01:00 lock
-rwxr-xr-x 1 wd users 17063 Jan 1 01:00 mkfs.jffs
-rwxr-xr-x 1 wd users 7063 Jan 1 01:00 unlock
Note that all the timestamps in the CramFs filesyste are bogus, and so is for instance the output of the df
command for such filesystems:
# df /mnt
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock3 0 0 0 - /mnt
9.1.5. UBI and UBIFS file systems
UBIFS is a flash filesystem, which work on top of the Linux MTD layer. UBI itself is a software layer which
basically is a volume management and wear-leveling layer. It provides so called UBI volumes which is a
higher level abstraction than a MTD device.
For more documentation about UBI/UBIFS see:
linux source:Documentation/filesystems/ubifs.txt
http://www.linux-mtd.infradead.org/doc/ubi.html
This document illustrates the usage of UBI/UBIFS for the m28 board.
9.1.5.1. Create Device Files
First we have to create some device files, which are necessary for using UBI/UBIFS:
ot
root@generic-armv5te:~#
root@generic-armv5te:~# mknod /dev/ubi_ctrl c 10 63
mknod: `/dev/ubi_ctrl': File exists
root@generic-armv5te:~# mknod /dev/ubi0 c 253 0
root@generic-armv5te:~# for i in $(seq 0 9); do mknod /dev/ubi0_$i c 253 $((i + 1)); done
knodroot@generic-armv5te:~# mknod /dev/ubi1 c 252 0
root@generic-armv5te:~# for i in $(seq 0 9); do mknod /dev/ubi1_$i c 252 $((i + 1)); done
ls -lroot@generic-armv5te:~# ls -l /dev/ubi
9.1.5. UBI and UBIFS file systems 101