Pages

2010-10-12

Linux: Creating a JFFS2 Root File System

mkfs.jffs2 -r /mnt/flash -e 128 -b -o rootfs.jffs2
First we mount the ext2 file system image on a loopback device on an arbitrary mount point on our development workstation. Next we invoke the MTD utility mkfs.jffs2 to create the JFFS2 file system image. 

The -r flag tells mkfs.jffs2 where the root file system image is located. 

The -e instructs mkfs.jffs2 to build the image while assuming a 128KB block size. The default is 64KB. JFFS2 does not exhibit its most efficient behavior if the Flash device contains a different block size than the block size of the image. Finally, we display a long listing and discover that the resulting JFFS2 root file system image has been reduced in size by more than 60 percent. When you are working with limited Flash memory, this is a substantial reduction in precious Flash resource usage.

The -b flag is the -big-endian flag. This instructs the mkfs.jffs2 utility to create a JFFS2 Flash image suitable for use on a big-endian target. 

Finally we boot target using:
console=ttyS0,115200 rootfstype=jffs2 root=/dev/mtdblock2

No comments:

Post a Comment