Create a CRAMFS Target Image

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

Contents

Introduction

The compressed ROM file system (cramfs) is a read-only Linux file system designed to have a small footprint. The main difference between cramfs and a compressed image of a traditional file system is that the cramfs file system can be used without the need to decompress it first. This is accomplished by compressing the file system one page at a time, which allows for random read access. However, this also prevents writing to the file system.

Benefits of CRAMFS

  1. CRAMFS file systems have a small footprint.
  2. CRAMFS file systems can be read without needed to decompress the entire file system first.

Limitations of CRAMFS

  1. CRAMFS file systems are read-only.
  2. CRAMFS file systems have a max size per file of 16MB.
  3. CRAMFS file systems have a max file system size of a little over 256MB. This is because the last file on the file system must begin before the 256MB mark but may extend past the 256MB mark.

Prerequisites

Creating a CRAMFS Target Image

The following section will walk you through how to create a CRAMFS target image that can be placed in Flash on the DVEVM. To save time, a RAM disk is provided with the DVSDK ARM Linux software. This RAM disk can be used as a base for our cramfs file system image. For newer versions of the DVSDK (DVSDK 1.30 and greater) the sample ramdisk file system can be found at <DVSDK install dri>/<PSP directory>/bin. In older versions of the DVSDK (DVSDK 1.20 and earlier) the sample ramdisk file system can be found in the MontaVista installation directory at <MV install dir>/montavista/pro/devkit/arm/v5t_le/images.

the RAM disk file is called ramdisk.gz (about 2.1 MB gunzipped). In run time, it occupies about 6.3 MB in DDR. This file system contains some unnecessary utilities for this project, but is appropriate for a typical embedded system. We are going to use this file system to generate a cramfs file system. The following steps will demonstrate how to create a cramfs file system image.

   host $ mkdir –p /mnt/def_cd
   host $ cp <path to ramdisk>/ramdisk.gz /mnt/def_cd
   host $ cd /mnt/def_cd
   host $ gunzip ramdisk.gz
   host $ mkdir ram0
   host $ mount ramdisk ram0 –o loop
   host $ vi ram0/etc/init.d/hello.sh
   Add the following 2 lines into the hello.sh file:
   #!/bin/sh
   echo “Hello World!!!”
   host $ chmod +x ram0/etc/init.d/hello.sh
   host $ cd ram0/etc/rc.d/rcS.d
   host $ ln –s ../init.d/hello.sh S50hello
   host $ cd /mnt/def_cd
   host $ mkcramfs ram0 cramfs.image
   host $ umount ram0

Conclusion

You should now have a file /mnt/def_cd/cramfs.image which is a CRAMFS image to the sample ramdisk file system with a script to print "Hello World!!!" on start-up. This image can now be placed in Flash for use as a root file system for the Linux kernel. For information on how to use this image please see the Put CRAMFS Image to Flash page.

Leave a Comment

Comments

Comments on Create a CRAMFS Target Image


Tmsandeep06 said ...

HOW TO OBTAIN ROOT FILE SYSTEM FOR SPECIFIC ARM BOARD. PLEASE SUGGEST ME...

--Tmsandeep06 05:32, 12 May 2010 (CDT)

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox