How To Guide
How to boot with a ramdisk root file system
|
|
How to boot with a ramdisk root file system
It may be useful to have a ramdisk as the root file system, particularly if the target system does not have a network connection. This is done in two stages; generating the ramdisk image, and downloading it to the target so that the kernel can use it.
Create a ramdisk image
There are several ways to create a ramdisk image. One of the most common is to use a loopback device, as described in the Loopback Root Filesystem HOWTO. This assumes that the reader is logged in as root on the host system, and knows exactly which files to copy onto the ramdisk image. If this is not the case a script called linuxshmkimg is supplied (in /opt/STM/STLinux-2.0/host/bin/) which takes a configuration file describing the file system and creates an image of that file system, suitable for downloading to the target.
A sample configuration file is supplied with the package (/opt/STM/STLinux-2.0/host/share/linuxshmkimg/ramfs.txt). This creates a file system suitable for a reasonable BusyBox based system (for information on BusyBox, see BusyBox in the Support Guide). Alternatively, a ramfs.txt file can be created and passed to linuxshmkimg using the -c option. For full details of the linuxshmkimg options enter linuxshmkimg -h.
For example:
host% /opt/STM/STLinux-2.0/host/bin/linuxshmkimg --ramdisk=16384 \ --rootPath=/opt/STM/STLinux-2.0/devkit/sh4/target /tmp/initrd.img |
|
|
Here the size of ramdisk is specified, as it needs to be larger than the default size of 4 Mbyte, and an image is created in /tmp/initrd.img.
Boot with a ramdisk image
Once the ramdisk image has been constructed it can be loaded into the memory of the target using the script st40load_gdb, using the -z option specifying the address where the image should be loaded and the file which contains the image. (For more information on this script enter st40load_gdb without arguments.)
Note 1: The address must be within the memory range which the Linux
kernel is aware of, and obviously there must be RAM at that address.
In addition for the ST40 the address must be specified as a P1 address,
for the ST200 it is the physical address.
Note 2: The kernel is told to mount the ramdisk as the root file
system using the root=/dev/ram option, and the ram disk
size must match that used when the image was created.
For example:
host# st40load_gdb -t target -c espresso -b vmlinux \
-z 0x84800000,/tmp/initrd.img \
-- console=ttyAS0,115200 \
root=/dev/ram ramdisk_size=16384 mem=64m
|
|
|
|