The kernel needs a root filesystem to mount at startup. There are many options,
and the best one will generally depend on whether your system needs to be able
to store persistent data (which must survive power cycling) in the field.
Your best bet is likely to be the root filesystem from
. Extract all the RPMs matching
use the image in
as the root filesystem.
During development, the embedded system can NFS-mount its root filesystem from
your file sever to provide a complete diskless Linux system. The file server
need not be the same architecture as the embedded client. Answer "Y" to the
kernel configuration questions regarding NFS client and root filesystem via
NFS, and "make zImage". The embedded system will attempt to mount its root
filesystem from the server as
, where <ipaddress> is its
IP address. Install your root filesystem image in this directory as root on the
server, and export the directory tree with an entry in
If your system has a hard disk, you can start by using NFS then build a root
file system on the disk and boot from that.
If your system has no network, you may want to start developing on a board that
To make a diskless system standalone, you need an initial ramdisk image
containing an ext2 filesystem to put in
Then, build with
and the ramdisk image will be mounted as
the root filesystem at startup. See
in the kernel
You need to select both CONFIG_BLK_DEV_RAM and CONFIG_BLK_DEV_INITRD to build
zImage.initrd. You also need a file in
. When you build
, the secondary boot loader
is re-compiled with INITRD_OFFSET and INITRD_SIZE set, which are used to locate
the start and end of the
file in memory. The start and end
are passed to the kernel in registers (r4/r5??), which it saves into the
. The secondary boot loader also
changes the kernel command line arguments so that
The kernel does various things if
is non-zero, but the main one
is to decompress the
data into ramdisk 0, and because
this is then mounted as the root filesystem.
If your ramdisk is larger than 4 MB, you will need to add
to the kernel command line at boot time, or modify
Beware that the CPU6 workarounds in the MontaVista?
2.2.x kernel clobber the
kernel command line, and cause the initial ramdisk mount to fail. See the
A number of ways to create an initial ramdisk image are described below. For
more information on building a root filesystem, see the Bootdisk HOWTO at
is already included in the HardHat?
A simple ramdisk for use with ppcboot
is available at the
You can also create your own on your development machine in a filesystem on
. If your ramdisk is larger than 4 MB, you will need to increase the
default ramdisk size on your development machine accordingly.
LILO users can do this by adding the following line to the first section of
There is no real harm in asking for an excessive size, as
allocates pages it actually needs to the ramdisk. However, you should use the
parameter to limit the filesystem size when you run mke2fs
to prevent it creating unnecessarily large filesystem structures.
Another approach is to use the loop device on your Linux development host to
mount the ramdisk image as a local filesystem, and then copy the files you
require into it. To allow users to mount the
dd the following entry to your
/path/to/ramdisk.image /mnt/loop auto user,noauto,rw,loop 0 0
Note that the minix file system code in Linux is not endian-independant, so you
can't build a minix file system image on an x86 machine and expect to read it
on a PowerPC
machine. ext2 does not suffer from this problem.
For more info, see the Loopback-Root-FS HOWTO at
The 2.4 kernel series has a compressed read-only filesystem (cramfs) aimed at
embedded systems, which can be back-ported to 2.2 kernels. If you're cross-
developing, you need to modify
to swap between little and big
It turns out that cramfs is not supported for a root fs or initrd. Basically,
the kernel checks a hardcoded list of supported filesystems and if the MAGIC
number doesn't match it bails.
ramfs from the 2.4 kernel is a simple filesystem ideal for use in a ramdisk. It
can be used in combination with a cramfs read-only root filesystem, to mount
writable filesystems on
, which typically need to be writable.
This combination is ideal for systems which don't require persistent storage.
allows persistent storage, optimised for flash memories rather than block
devices like hard disks. It is aimed at providing a crash/powerdown-safe
filesystem for disk-less embedded devices and is a better option than the
cramfs/ramfs combination if your application requires persistent storage. You
use it with the MTD