Version: 1.6
© 2008 Daniel Collins
© 2008 Philip Kent
kexec-loader is a boot loader which loads a Linux kernel, then displays a GRUB-like menu so you can select a kernel to boot using kexec. It is designed for systems where the BIOS does not support booting from some devices (e.g. your kernel is on a USB memory key which the BIOS does not support).
If you have downloaded one of the pre-built disk images, you do not need to read the rest of this section, and you can skip to Section 2. A pre-made disk image is probably more suitable to the end user in most cases, as the provided image supports most hardware and is pre-compiled. You can obtain it from the project's webpage, along with kernel modules for that version.
A summary of the new features in this release of kexec-loader is below. For a more detailed changelog, please see the ChangeLog file.
To build kexec-loader, you require the following tools.
kexec-tools is included and built as part of the build process.
In order to build kexec-loader, you first need a Linux kernel with support for the hardware you want to boot from. This kernel will need fit onto the device that will be used to boot, with sufficient space left for other files that will need to be on the device (such as kexec-loader itself and the boot loader).
Once you have your kernel, simply run "make" from the root of the kexec-loader source to build the kexec-loader binary. This will include downloading and building kexec-tools. It is recommended that you build a uclibc toolchain prior to this, then building kexec-loader using it, as this will make the resulting file smaller. To use a uclibc toolchain, do "HOST=i386-linux-uclibc make" instead of make.
Then run mkinitramfs.sh from the root directory of the distribution to build an initramfs containing kexec-loader.
Once you have a kernel and initramfs, you can then build a disk image. There are two ways to assemble the disk, which are below.
Regardless of the method you choose, you will need a bootloader such as syslinux. Build your image using your favourite method (such as using dd to produce an empty floppy image, formatting it then loop mounting it), put the kernel and initramfs (if any) on the disk, along with any boot loader configuration, install the boot loader and your disk is prepared.
kexec-loader uses a simple configuration file to store target kernels and settings. If you have downloaded one of the pre-made disk images, a sample configuration is included which might be able to boot a Debian system.
kexec-loader will attempt to find a configuration in the following places in order:
You can insert a device at the beginning of this list by passing kexec_config=/dev/foo to the kexec-loader kernel at boot.
The configuration must be called kexec-loader.conf and should be stored in the root of the kexec-loader boot disk. Configuration directives and their arguments should be seperated by spaces/tabs, empty lines and lines beginning with a hash (#) are ignored.
The directives are as follows.
Where parameters are shown in <angled brackets>, they are required for that directive. Ones in [square brackets] are optional. For mount and rootfs, if you do specify a fstype, it should be specified as ext2:/dev/hda1 for example.
Normally kexec-loader can detect the filesystem type, it supports autodetection for the following types.
Specifying no filesystem or "auto" will result in auto detection. For manual specification, enter the name of any filesystem that your kernel supports.
To navigate the kexec-loader menu, use your arrow keys to select an item and press enter to boot it. A number of functions are available; press L to list the detected devices and their filesystems. Press enter if you are on the device screen or an error and you want to escape.
Upon asking a kernel to boot, it may take a few seconds for it to load the kernel and switch to it. After switching, your new kernel will start and the boot process will happen as it would normally.
kexec-loader has a built in shell. To access it press "s" on the menu screen. This shell allows
There are two further directives used to control kexec-loader, rather than set up a kernel to boot. They are:
To scroll through the command history, use the up and down keys. A maximum of 32 commands are remembered (upon exceeding this, the oldest command will be removed from the history to make space). Commands that are longer than the screen can hold will scroll, similar to the 'nano' text editor. Please note that this shell will be improved in subsequent releases.
Once kexec-loader has started all debugging messages, as well as Linux kernel messages are sent to a separate debug console. By default the debug console is /dev/tty2, this can be changed at boot by using the Linux cmdline, for example kexec_debug=/dev/ttyS0 writes all debug messages and kernel messages to the first serial port.
Kernel modules can be loaded by kexec-loader to add support for extra devices or filesystems which target systems can be loaded from. To add extra modules, simply copy them to /modules/ on the kexec-loader disk, to specify module arguments, use the /modules/modules.conf file. Modules loaded this way only affect the kernel running kexec-loader, not those loaded by kexec-loader.
If you are using an official kexec-loader disk image, kernel modules are available on the downloads page of the project site, named somthing like modules-XXX.tar.gz, make sure you download the correct modules for your kernel.
For information on kexec-loader, including current development and latest releases, please see the project website.
The developer of kexec-loader, Daniel Collins (aka solemnwarning), can often be found on the Freenode IRC network. To contact solemnwarning, you can use the following e-mail address: solemnwarning@solemnwarning.net.