Tux
Communication
Mailing lists
Documentation
User Manual
Target board info.
Target chip info.
Support
Linux support
Bugzilla
Downloads
STLinux
Updates
Search
Google


The web
stlinux.com
Getting Started
Booting with a ramdisk root file system
ST Logo
Previous   Contents   Next

If your target system doesn't have a network connection, it may be useful to use a ramdisk as your root file system. There are two parts to this: generating the ramdisk image, and downloading it to target so the kernel can use it.

Creating a ramdisk image

There are numerous ways to create a ramdisk image. One of the most common is to use a loopback device, as described in the The Loopback Root Filesystem HOWTO. However, this requires that you are root on the host system, and you know exactly which files to copy onto the ramdisk image.

To avoid these problems we recommend the use of a small tool, called linuxshmkimg. This uses a configuration file which describes what the file system should look like, and creates an image of that filesystem, suitable for downloading to the target.

A sample configuration file is supplied with the package (see the /opt/STM/ST40Linux-1.0/host/share/linuxshmkimg/ramfs.txt file), which should result in a reasonable busybox based system.

Though you can create your ramfs.txt file. So you can pass it as linuxshmkimg argument using the -c option.

Generating default filesystem image

host% /opt/STM/ST40Linux-1.0/host/bin/linuxshmkimg --ramdisk=16384 \
  --rootPath=/opt/STM/ST40Linux-1.0/devkit/sh4/target /tmp/initrd.img

Here we specify the size of the ram disk, as it needs to be larger than the default size (which is 4Mbyte).

Booting with a ramdisk image

Once you have constructed the ramdisk image, it can be simply loading into the target's memory using st40load_gdb. This uses the -z option, which allows the address where the image should be loaded and the file which contains the image to be specified. Note that the address must be within the range of memory which the Linux kernel knows about. In practice this means that it must be in RAM, and the address specified as a P1 address:

st40load_gdb -t ${TARGET_TO_CONNECT} -c espresso -b vmlinux \
	-z 0x84800000,/tmp/initrd.img \
	-- console=ttyAS0,115200 \
	root=/dev/ram mem=64m

Note that we have told the kernel to mount the ramdisk as the root filesystem using root=/dev/ram option, and the ram disk size must match that used when the image was created.

Previous   Contents   Next
Valid HTML 4.01! Last updated: 2005/03/23 07:17:55
© Copyright STMicroelectronics Limited, 2005
Printer