NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Create a CRAMFS Target Image

From Texas Instruments Wiki
Jump to: navigation, search

Introduction[edit]

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[edit]

  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[edit]

  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[edit]

  • CRAMFS utilities for creating the CRAMFS file system image.
    • For more information on obtaining and installing the CRAMFS utilities please see the CRAMFS Utilities page.
  • A target (ARM) root file system which you want to create a CRAMFS image of (e.g. the content of a ramdisk or NFS share).

Creating a CRAMFS Target Image[edit]

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.

  • Copy the example initial RAM disk to a temporary location
   host $ mkdir –p /mnt/def_cd
   host $ cp <path to ramdisk>/ramdisk.gz /mnt/def_cd
   host $ cd /mnt/def_cd
  • Mount the example initial RAM disk image
   host $ gunzip ramdisk.gz
   host $ mkdir ram0
   host $ mount ramdisk ram0 –o loop
  • Modify the example initial RAM disk. You can add new applications or files at this point. For a more detailed example of adding a new application see the [SPRAAH2] document. For this example we will add a simple shell script to print “Hello World!!!” on start-up.
   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
  • Create a cramfs image of the file system
   host $ mkcramfs ram0 cramfs.image
  • Un-mount the example initial RAM disk
   host $ umount ram0

Conclusion[edit]

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.

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Create a CRAMFS Target Image here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Create a CRAMFS Target Image here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Create a CRAMFS Target Image here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Create a CRAMFS Target Image here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Create a CRAMFS Target Image here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Create a CRAMFS Target Image here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Create a CRAMFS Target Image here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Create a CRAMFS Target Image here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Create a CRAMFS Target Image here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity