Specifications

We now have a root file system image uRamdisk that can be used with U-Boot.
9.5.2. Root File System on a JFFS2 File System
JFFS2 (Journalling Flash File System version 2) was specifically designed for use on flash memory devices in
embedded systems. It is a log-structured file system which means that it is robust against loss of power,
crashes or other unorderly shutdowns of the system ("robust" means that data that is just being written when
the system goes down may be lost, but the file system itself does not get corrupted and the system can be
rebootet without need for any kind of file system check).
Some of the advantages of using JFFS2 as root file system in embedded systems are:
file system uses compression, thus making efficient use of flash memory
log-structured file system, thus robust against unorderly shutdown
flash sector wear-leveling
writable flash file system
Disadvantages are:
long mount times (especially older versions)
slow when reading: files to be read get uncompressed on the fly which eats CPU cycles and takes time
slow when writing: files to be written get compressed, which eats CPU cycles and takes time, but it
may even take much longer until data gets actually stored in flash if the file system becomes full and
blocks must be erased first or - even worse - if garbage collection becomes necessary
The garbage collector thread may run at any time, consuming CPU cycles and blocking accesses to
the file system.
Despite the aforementioned disadvantages, systems using a JFFS2 based root file system are easy to build,
make efficient use of the available resources and can run pretty reliably.
To create a JFFS2 based root file system please proceed as follows:
Create a directory tree with the content of the target root filesystem. We do this by unpacking our
master tarball:
$ mkdir rootfs
$ cd rootfs
$ tar zxf /tmp/rootfs.tar.gz
1.
We can now create a JFFS2 file system image using the mkfs.jffs2 tool:
$ ROOTFS_DIR=rootfs # directory with root file system content
$ ROOTFS_EBSIZE=0x20000 # erase block size of flash memory
$ ROOTFS_ENDIAN=b # target system is big endian
$ ROOTFS_DEVICES=rootfs_devices.tab # device description file
$ ROOTFS_IMAGE=jffs2.img # generated file system image
$ mkfs.jffs2 -U \
-d ${ROOTFS_DIR} \
-D ${ROOTFS_DEVICES} \
-${ROOTFS_ENDIAN} \
-e ${ROOTFS_EBSIZE} \
-o ${ROOTFS_IMAGE}
mkfs.jffs2: skipping device_table entry '/dev': no parent directory!
2.
Note: When you intend to write the JFFS2 file system image to a NAND flash device, you should also
add the "-n" (or "--no-cleanmarkers") option, as cleanmarkers are not needed then.
9.5.2. Root File System on a JFFS2 File System 114