Creating a cramfs Filesystem Image
The cramfs filesystem is a compressed filesystem format that can be used to store your target’s root filesystem on flash memory. Like JFFS2 root filesystems, cramfs filesystems are single files that you create on your desktop host system. The file contains an image of the root filesystem hierarchy that you specified when creating the image.
You can create a cramfs image by using the mkcramfs utility and an expanded directory tree containing a hierarchical collection of files that parallels the contents of the filesystem that you want to load into flash. This utility is provided in the host-tools directory of the downloadable image provided with this Linux distribution. An executable version of this utility is typically installed into the same directory as the binaries for the toolchain that you are using.
To create a cramfs filesystem image, you must first prepare a directory tree on your host system that holds the contents of the filesystem that you want to load into flash. For example, installing this Linux distribution creates an RFS directory tree on the host; to make a cramfs image of the installed RFS, reference the RFS directory when issuing the mkcramfs command.
Next, copy the device table file, dev.cramfs.txt, into the /dev subdirectory of the RFS directory. The device table file is located in the /lib/examples toolchain subdirectory.
$ cp <rfs_dir> \ /lib/examples/dev/cramfs.txt \ <rfs_dir>/dev
Finally, execute mkcramfs using the following syntax:
$ mkcramfs -m dev.cramfs.txt <rfs_dir> rootfs.cramfs
The -m option tells mkcramfs to use the specified device table file as a metafile containing device node creation and permission instructions. All of the device nodes listed in this file will be created in the cramfs filesystem image. In this example, <rfs_dir> is the name of your RFS directory, and rootfs.cramfs is the name of the output file containing a cramfs image of your RFS directory.
After creating the cramfs image, copy it to the /tftpboot directory on your host machine.