Probably even more interesting for embedded systems is the second
version of JFFS
, since it not only fixes a few design issues
, but also adds transparent compression, so that you can save
a lot of precious flash memory.
tool is used to create a JFFS2 filesystem image; it
populates the image with files from a given directory. For instance,
to create a JFFS2 image for a flash partition of 3 MB total size and
to populate it with the files from the /tmp/flashtools
# mkfs.jffs2 --pad=3145728 --eraseblock=262144 \
--root=/tmp/flashtools/ --output image.jffs2
# eraseall /dev/mtd4
Erased 3072 Kibyte @ 0 -- 100% complete.
\# dd if=image.jffs2 of=/dev/mtd4 bs=256k
12+0 records in
12+0 records out
# mount -t jffs2 /dev/mtdblock4 /mnt
# df /mnt
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock4 3072 2488 584 81% /mnt
Note: Especially when you are running time-critical applications
on your system you should carefully study if the behaviour of the
flash filesystem might have any negative impact on your application.
After all, a flash device is not a normal harddisk. This is especially
important when your flash filesystem gets full; JFFS2 acts a bit weird
- You will note that an increasing amount of CPU time is spent by
the filesystem's garbage collection kernel thread.
- Access times to the files on the flash filesystem may increase
This is especially critical when you are using the flash filesystem to
store log files: when your application detects some abnormal condition
and produces lots of log messages (which usually are especially
important in this situation) the filesystem may fill up and cause
long delays - if your system crashes, the most important
messages may never be logged at all.