In some cases it is sufficent to have read-only access to some files,
and if the files are big enough it becomes desirable to use some
method of compression. The Compressed ROM Filesystem CramFs might
be a solution here.

Please note that CramFs has - beside the fact that it is a
read-only filesystem - some severe limitations (like missing support
for timestamps, hard links, and 16/32 bit uid/gids), but there are
many situations in Embedded Systems where it's still useful.

To create a CramFs filesystem a special tool
mkcramfs is used to create a file which contains
the CramFs image. Note that the CramFs filesystem can be written and
read only by kernels with PAGE_CACHE_SIZE == 4096, and some versions
of the mkcramfs program may have other
restrictions like that the filesystem must be written and read with
architectures of the same endianness. Especially the endianness
requirement makes it impossible to build the CramFs image on x86 PC
host when you want to use it on a PowerPC target. The endianness
problem has been fixed in the version of mkcramfs
that comes with the ELDK.

In some cases you can use a target system running with root
filesystem mounted over NFS to create the CramFs image on the native
system and store it to flash for further use.

Note: The normal version of the mkcramfs program
tries to initialize some entries in the filesystem's superblock with
random numbers by reading /dev/random; this may
hang permanently on your target because there is not enough input
(like mouse movement) to the entropy pool. You may want to use a
modified version of mkcramfs which does not depend
on /dev/random.

To create a CramFs image, you put all files you want in the
filesystem into one directory, and then use the
mkcramfs= program as follows: