Specifications

Now we can run some basic tests to verify that the flash driver routines and the partitioning works as
expected:
root@generic-armv5te:~#
root@generic-armv5te:~# hexdump -C /dev/mtd4 | head
In the hex-dumps of the MTD devices you can identify some strings that verify that we indeed see an U-Boot
environment, a Linux kernel, a ramdisk image and an empty partition to play wih.
The last output shows the partition to be empty. We can try write some data into it:
0
root@generic-armv5te:~#
root@generic-armv5te:~# date > /tmp/tempfile
root@generic-armv5te:~# dd if=/dev/zero of=/tmp/tempfile bs=1 count=4096 seek=50 Aroot@generic-armv5te:~# dd if=/dev/zero of=/tmp/tempfile bs=1 count=4096 seek=5K0
d4096+0 records in
4096+0 records out
4096 bytes (4.1 kB) copied, 0.0759063 s, 54.0 kB/s
root@generic-armv5te:~# dd if=/tmp/tempfile of=/dev/mtd4 bs=4096 count=1
1+0 records in
1+0 records out
4096 bytes (4.1 kB) copied, 0.0023125 s, 1.8 MB/s
root@generic-armv5te:~# head -1 /dev/mtd4
Tue Oct 2 16:57:16 UTC 2012
root@generic-armv5te:~# dd if=/tmp/tempfile of=/dev/mtd4 bs=4096 count=
As you can see it worked the first time. When we tried to write the (new date) again, we got an error. The
reason is that the date has changed (probably at least the seconds) and flash memory cannot be simply
overwritten - it has to be erased first.
You can use the eraseall Linux commands to erase a whole MTD partition:
p
root@generic-armv5te:~#
root@generic-armv5te:~# flash_erase -q /dev/mtd4 0 0
date > /tmp/tempfile
root@generic-armv5te:~# date > /tmp/tempfile
root@generic-armv5te:~# dd if=/dev/zero of=/tmp/tempfile bs=1 count=4096 seek=50 Aroot@generic-armv5te:~# dd if=/dev/zero of=/tmp/tempfile bs=1 count=4096 seek=5K0
d 4096+0 records in
4096+0 records out
4096 bytes (4.1 kB) copied, 0.0732188 s, 55.9 kB/s
root@generic-armv5te:~# dd if=/tmp/tempfile of=/dev/mtd4 bs=4096 count=1
1+0 records in
1+0 records out
4096 bytes (4.1 kB) copied, 0.00228125 s, 1.8 MB/s
root@generic-armv5te:~# head -1 /dev/mtd
We have now sufficient proof that the MTD layer is working as expected, so we can try creating a flash
filesystem.
9.1.2. Journalling Flash File System
At the moment it seems that the Journalling Flash File System JFFS is the best choice for filesystems in flash
memory of embedded devices. You must enable the following configuration options to get JFFS support in
your system:
CONFIG_JFFS_FS=y
CONFIG_JFFS_FS_VERBOSE=0
9.1.2. Journalling Flash File System 98