next up previous contents
Next: Booting over alternate network Up: Advanced bootstrapping methods Previous: Using a ramdisk root   Contents


Populating a ramdisk root

To add functionality to your minimal ramdisk root nodes, it is necessary to add certain files and directories. There are two mechanisms for doing this. One is to use the COPY directive in your initramfs.conf file (or respective command-line parameter). This will copy the given file or directory into your ramdisk. Unless otherwise specified, it will also copy all necessary run-time library dependencies to the ramdisk.

Another method for populating your ramdisk is to use overlays. Overlays are simply directory trees that are added to an initramfs image that perform a certain function. As an example, consider an overlay that is purpose-built to do one and only one thing: run HP linpack. The overlay could look like this:

overlay-xhpl/HPL.dat
overlay-xhpl/etc/init.d
overlay-xhpl/etc/init.d/rcS
overlay-xhpl/bin/xhpl
overlay-xhpl/lib64/libc.so.6
overlay-xhpl/lib64/ld-linux-x86-64.so.2
overlay-xhpl/lib64/libpthread.so.0


The overlay contains the linpack binary (xhpl), some shared objects needed by the binary, an input file (HPL.dat) and a start script (/etc/init.d/rcS).

The rcS file is always run when entering a ramdisk root, so this is where anything that needs to run gets started from. Depending on whether your distribution already has one or not, you can create an etc/init.d/rcS in your image and use a COPY directive to put it in your ramdisk image. Otherwise you'll need to create an overlay to include at least that file.

Any root-path directory specified in DHCP (or on the kernel command line) is automatically mounted via NFS on the /mnt directory unless -nonfs is given to mk-initramfs-oneSIS. Any other filesystems need to be mounted via the rcS script or an etc/fstab file.
For our example linpack initramfs above to be able to start linpack and send output to a useful place, we need an rcS start script like such:

#$!$/bin/sh
hostname=$(hostname)
export OMP_NUM_THREADS=8
/bin/xhpl |tee /mnt/xhpl-$hostname.out


next up previous contents
Next: Booting over alternate network Up: Advanced bootstrapping methods Previous: Using a ramdisk root   Contents
root 2017-02-23