1. TTfile
  2. RAM File
  3. How to create an RAM disk image?

How to create an RAM disk image?

Glomation GESBC-93XX series single board computers use RAM disk as the root file system in it’s default configuration. Most likely one would want to create/change the RAM disk to have user applications installed. This guide describes how to mount and edit files in a RAM disk image, unmount the image and recompress it.

System Requirement

In order to mount a RAM disk image, your development system must have MTD support compiled in, and have the Loopback Interface available. Most Linux distribution have these configured in the kernel.

To check the availability of MTD and loopback interface, issue the following command on the development system.

1

If any information is shown with /proc/mtd, and if you see any files named mtdblock, mtd, etc that means the system has MTD support.

If not please rebuild the Linux kernel with MTD support. The follow instruction shows the basic steps to do that.

Go to the kernel source tree directory on your development system and issue...

2

The following options must be enabled to use MTD.

3

As well as....

4

After the kernel has been reconfigured, re-build the kernel, install the new kernel and reboot your development system.

Once you have MTD and RAM disk support on your development system, you are ready to create/modify the RAM disk image.

Create New RAM Disk Image

The Ext2 file system can be created and mounted onto an embedded device using the concept of RAM disk.

5

mke2fs is the utility used to create an ext2 file system -- creating the super block, inodes, inode table, and etc -- on any device.

In the above usage, /dev/ram is the device on which an ext2 file system of 16384 blocks is built. Then the device (/dev/ram) is mounted on a temporary directory named /mnt and all the necessary files are copied. Once these files are copied, the file system is unmounted and the contents of the device (/dev/ram) is dumped into a file (ramdisk), which is the required RAM disk (the Ext2 file system). The RAM disk file is then compressed and ready to be loaded by Redboot.

The above sequence creates a RAM disk of 16 MB and fills it with the necessary file utilities.

Some of the important directories to include in RAM disk are:

/bin -- Holds most of the binaries like init, busybox, shell, file management utilities, and

etc.

/dev -- Contains all the device nodes used in the device

/etc -- Contains all the configuration files for the system

/lib -- Contains all the necessary libraries like libc, libdl, and so on

Modify Existing RAM Disk Image

  1. First uncompress the ramdisk.gz file.

6

  1. Make a directory to mount the ramdisk image.

7

  1. Mount the ramdisk image as a loop back device .

8

You can then issue the command 'df' to see the new RAM disk partition on you development system.

  1. Edit Files

You can now edit files inside the RAM disk. Depending on how the original RAM disk is created, you may or may not have enough space on the RAM disk to install your application. Refer to Create New RAM Disk Image section on how to create a new RAM disk with more storage space.

  1. Unmount the ramdisk and compress it.

9

You will then have a new compressed root file system that you can now load with RedBoot.