Linux VR

Run Linux on your VRSeries devices.

Browse CVS
Anonymous FTP
CF Root
Related Sites
Brad's Pages
Mike's Pages
Jay's Files
Linux CE

Linux VR Ramdisk HOWTO

By Bradley D. LaRonde (


I wrote this HOWTO to help people build and modify ramdisks for linking into a Vr41xx kernel.

This is currently just a draft. It may still be broken in places.

The way we do the ramdisk now is not right. Really, we need either bootloader support for a root ramdisk, or we need to append the ramdisk onto the end of the kernel with a header, then free that ram later.


Linux VR can mount a ramdisk linked into the kernel as root. This is the simplest way of booting Linux VR from Windows CE, since the root is linked right into the kernel.


"Ramdisk image" refers to a file that contains an image of an ext2 filesystem that can be mounted with -o loop or as a ramdisk. "Ramdisk object" refers to an elf object that encapsulates a (normally compressed) ramdisk image, used for linking a ramdisk into the Linux kernel. See the note at the end about how this terminogy has changed over time.

Modifiying an Existing Ramdisk Image

It's probably much easier to get the ramdisk image off my ftp site and modify it to your liking than to build one yourself from scratch. Note that these instructions assume that you have loopback device support available.

To modify an existing ramdisk image

  1. Get the ramdisk image (ramdisk.bz2) off my ftp site at The ramdisk there is based almost entirely on a ramdisk put together by Jay Carlson. It's the best that I've seen so far.
  2. Uncompress it into your /tmp directory. Now you have the file /tmp/ramdisk. Don't try the next steps with a ramdisk.o file - that's a ramdisk (probably a compressed one) packaged inside an elf object for linking it into the kernel, not a ramdisk image. You need to mount the ramdisk image (I show you how to make a new ramdisk.o from your ramdisk image in the next section).
  3. Type: mkdir /mnt/ramdisk to create a ramdisk mount point (if you don't have one already).
  4. Type: mount /tmp/ramdisk /mnt/ramdisk -o loop to mount the ramdisk image on /mnt/ramdisk.
  5. Modify /mnt/ramdisk as you please.
  6. Type: umount /mnt/ramdisk to unmount the ramdisk image.
  7. Type: touch /tmp/ramdisk to show that the ramdisk image has been modified. This is needed by mipsel-ramdisk "make install" (below), and for some odd reason /tmp/ramdisk doesn't automatically show that changes were made to it while it was mounted.
  8. Next, do "Making a New Ramdisk Object" below.

If you don't have loopback device support available

Try something like this (untested):

  1. Type: dd if=/tmp/ramdisk of=/dev/ram0 and watch out that you aren't already using /dev/ram0
  2. Type: mkdir /mnt/ramdisk to create a ramdisk mount point (if you don't have one already).
  3. Type: mount -t ext2 /dev/ram0 /mnt/ramdisk
  4. Modify /mnt/ramdisk as you please.
  5. Type: umount /mnt/ramdisk
  6. Type: dd if=/dev/ram0 of=ramdisk.img.ext2 count=1440
  7. Next, do "Making a New Ramdisk Object" below.

Making a Ramdisk Image from Scratch

Jay noted: You can have any size ramdisk... If you want to change the size of the ramdisk, you need to mke2fs a new one (see linux/Documentation/ramdisk.txt section 4) and copy the contents of the old one over.

Next, do "Making a New Ramdisk Object" below.

Making a New Ramdisk Object

To make the ramdisk a part of the kernel image, I compress the ramdisk image file, package the compressed file in an elf object, then link it with the rest of the kernel. To help with this, install the the mipsel-ramdisk maker first if you haven't already.

Julian boot prefers a shell script to do this, as he says "[it is] all self contained and I can be in any directory to run it. ymmv". I included that method also.

To install the mipsel-ramdisk maker

  1. Get mipsel-ramdisk.tar.bz2 from my ftp site at
  2. Uncompress it to /usr/src. Now you have /usr/src/mipsel-ramdisk.

To make a new ramdisk object with the mipsel-ramdisk maker

  1. Change to the /usr/src/mipsel-ramdisk directory.
  2. Type: make install to make ramdisk.o and copy it into /usr/src/linux/arch/mips/boot.

To make a new ramdisk object with a script

Here is a modified version of Julian's script. I haven't tested it but I assume it works fine.

usage: ramdisk-image ramdisk-object

Linking Your New Ramdisk Into Your Kernel

The last step is to link your new ramdisk (actually, your new ramdisk.o file) into your kernel (vmlinux file).

To link your new ramdisk into your kernel

  1. Change to the /usr/src/linux directory.
  2. Type: make to make a new vmlinux with your new ramdisk linked in.

Booting a Ramdisk-Root Kernel

To book a ramdisk-root kernel, you need to specify /dev/ram0 as the root device. See the Linux VR Booting HOWTO for more information about this.


Ramdisk Terminology Change

The ramdisk terminolgy changed over time. The term "ramdisk image" used to be "raw ramdisk", and the term "ramdisk object" used to be "ramdisk image". The ramdisk object file "ramdisk.o" used to be "ramdisk.img". The earlier terms and filename were based on terminology that was being used at the time. The problem was that "ramdisk.img" was not a ramdisk image - it was an elf object, plus it was stealing the right name for the actual ramdisk image, which I then had to call "raw ramdisk" instead. Anyway it was a source of confusion. So I changed the terms and the filename to be more appropriate and less confusing. I also modified the mipsel-ramdisk maker and linux/arch/mips/vr41xx/Makefile to accomodate the name change. There, that really simplifies things, eh? :-)


All brands and product names may be trademarks of their respective owners.