Skip to content

solemnwarning/kexec-loader

Repository files navigation

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>kexec-loader manual</title>
<style type="text/css">
<!--
body {
	font-family: Arial, Helvetica, sans-serif;
}

h1, h1 a:hover {
	font-size: xx-large;
	color: #0099FF;
}

h2, h2 a:hover {
	color: #0066FF;
}

h3, h3 a:hover {
	color: #0033CC;
}

a:link, a:visited {
	text-decoration: none;
	color: blue;
}

a:hover {
	color: red;
}

.code {
	background-color: #E5E5E5;
	border: 1px solid #000000;
	padding: 5px;
	font-family: monospace;
}
-->
</style>
</head>

<body>
<h1>kexec-loader manual</h1>
<p>Version: 2.2.1</p>
<p>Copyright &copy; 2007-2011 Daniel Collins<br />Copyright &copy; 2008-2009 Philip Kent</p>
<ul>
	<li><a href="#s1">1. Introduction</a></li>
	<li><a href="#s2">2. Usage</a>
	<ul>
		<li><a href="#s2s1">2.1. Basic Configuration</a></li>
		<li><a href="#s2s2">2.2. Kernel Modules</a></li>
		<li><a href="#s2s3">2.3. GRUB Configuration</a></li>
		<li><a href="#s2s4">2.4. Changing the keymap</a></li>
		<li><a href="#s2s5">2.5. Shell</a></li>
	</ul>
	</li>
	<li><a href="#s3">3. Reference</a>
	<ul>
		<li><a href="#s3s1">3.1. Configuration Reference</a></li>
		<li><a href="#s3s2">3.2. Shell Reference</a></li>
		<li><a href="#s3s3">3.3. Kernel Command Line Options</a></li>
	</ul>
	</li>
	<li><a href="#s4">4. Support</a>
	<ul>
		<li><a href="#s4s1">4.1. Website</a></li>
	</ul>
	</li>
</ul>

<h2><a name="s1">1. Introduction</a></h2>
<p>
kexec-loader is a Linux based bootloader that allows you to boot Linux and multiboot systems from storage devices your BIOS does not support, such as USB drives and PCI expansion cards. It fits on a 1.44MB floppy, supports most block devices supported by Linux and is easy to use. kexec-loader supports reading GRUB configuration files, this allows it to be used as a drop-in replacement for GRUB.
</p>
<p>
If you need to build or modify kexec-loader for some reason please see the build.html file in the source archive, this details how to compile kexec-loader and build disk images.
</p>

<h2><a name="s2">2. Usage</a></h2>
<h3><a name="s2s1">2.1. Basic Configuration</a></h3>
<p>
By default, kexec-loader will attempt to find a GRUB installation and copy any compatible boot targets from it. This will work for most Linux systems, but you can manually specify boot targets in kexec-loader.conf instead if desired. Doing so will disable the GRUB autodetection unless grub-autodetect is explicitly set to 'on'.
</p>
<p class="code">
timeout 10<br />
<br />
title Generic Linux System (Kernel 2.6.20)<br />
root hda1<br />
kernel /boot/vmlinuz-2.6.20<br />
cmdline root=/dev/hda1 ro<br />
initrd /boot/initrd.img-2.6.20<br />
<br />
title Generic Linux System (Kernel 2.6.21)<br />
root hda1<br />
kernel /boot/vmlinuz-2.6.21<br />
cmdline root=/dev/hda1 ro<br />
initrd /boot/initrd.img-2.6.21<br />
default
</p>
<p>
It is also possible to reference files not on the root disk or filesystems by their volume label or UUID, as shown below.
</p>
<p class="code">
root <b>UUID=75ac0d6c-5dc0-402f-9f0f-9ab313816439</b><br />
initrd <b>(LABEL=otherdisk)</b>/boot/initrd.img-2.6.21
</p>

<h3><a name="s2s2">2.2. Kernel Modules</a></h3>
<p>
If you are using an official kernel you will probably need to load additional modules for your system. The appropriate kernel modules can be downloaded from the same page the disk image came from. To install modules, simply copy them to the 'modules' directory on the kexec-loader boot disk, if the module is needed to access the boot disk use <a href="http://www.solemnwarning.net/kexec-loader/downloads/addmod.sh">addmod.sh</a> to insert it into the initramfs (initrd.img).
</p>

<p>
Some kernel modules (mainly for old, non-PnP hardware) may need to be passed additional arguments at load time, these can be specified in kexec-loader.conf like so:
</p>
<p class="code">
kmod module-name arg1 arg2=value arg3 ...
</p>

<p>
If you are building your own modular kernel, multiple modules may be combined inside tar archives (optionally compressed with LZMA or gzip). This technique is used for the official modules to combine related/dependant modules and save space.
</p>

<h3><a name="s2s3">2.3. GRUB Configuration</a></h3>
<p>
In most cases, the system's GRUB configuration can be detected automatically, but if you want to manually specify the path of the GRUB folder (i.e where multiple GRUB installations may be found), you can use grub-path in kexec-loader.conf:
</p>
<p class="code">
grub-path (hda1)/boot/grub
</p>

<p>
You may also need to manually map GRUB devices to filesystems, this is only required when the disk numbering is guessed wrong or BSD disklabels are in use. You can map entire disks or single filesystems using the grub-map directive:
</p>
<p class="code">
grub-map hd0 sda<br />
grub-map hd0,1 LABEL=root<br />
<br />
# BSD disklabels are not currently detected automatically<br />
#<br />
grub-map hd0,a sda8<br />
</p>

<h3><a name="s2s4">2.4. Changing the keymap</a></h3>
<p>
Linux's built-in US keymap will be used by default, which is also acceptable for some other keyboards since only the basic keys are used. If your keyboard needs a special keymap, download it from <a href="http://www.solemnwarning.net/kexec-loader/keymaps/">here</a> and save it to the boot disk as keymap.txt.
</p>

<h3><a name="s2s5">2.5. Shell</a></h3>
<p>
There is a shell built into kexec-loader which can be used to configure and boot a target or list/find/read files to aid with configuring a boot target. To access the shell, press C at the menu screen, the shell will be displayed by default if there are no boot targets configured. The commands for configuring and booting a target are very similar to those in the configuration file, as shown below:
</p>
<p class="code">
&gt; root hda1<br />
&gt; kernel /boot/vmlinuz-2.6.20<br />
&gt; cmdline root=/dev/hda1 ro<br />
&gt; initrd /boot/initrd.img-2.6.20<br />
&gt; <b>boot</b>
</p>
<p>
This example will boot the first target example from the configuration file section, the syntax of the shell is exactly the same except you must type <b>boot</b> at the end to show you have finished configuring the boot target. Filenames may specify a disk at the beginning, just as in the configuration file.
</p>

<p>
The <b>ls</b> command lists the contents of a directory, directories have slashes appended to their names. The disk can be omitted from the path in the following example to use the root device.
</p>
<p class="code">
&gt; <b>ls</b> (fd0)/<br />
ldlinux.sys<br />
linux.cfg<br />
kexec-loader.conf<br />
syslinux.cfg<br />
README.html<br />
modules/<br />
initrd.img<br />
vmlinuz
</p>

<p>
The <b>find</b> command searches directories for files that match a pattern, the pattern may contain the * and ? wildcards which have the same meaning as in most shells. The following example searches the floppy disk for any files containing "linux" in their name. The path can be omitted to search the entire disk once a root device has been selected.
</p>
<p class="code">
&gt; <b>find</b> *linux* (fd0)/<br />
(fd0)/ldlinux.sys<br />
(fd0)/linux.cfg<br />
(fd0)/syslinux.cfg
</p>

<h2><a name="s3">3. Reference</a></h2>
<h3><a name="s3s1">3.1. Configuration Reference</a></h3>
<p>
The configuration file must be named kexec-loader.conf or kxloader.cfg, kexec-loader.conf will be checked for first. The file may be in UNIX or DOS format. Each line may contain a single directive, where the name and value(s) are seperated by spaces/tabs. Lines beginning with a hash (#) symbol are treated as comments.
</p>
<p>
All valid configuration directives are listed below. Parameters are shown in &lt;angled brackets&gt; are required for that directive, ones in [square brackets] are optional.
</p>

<p>The following directives are global:</p>
<ul>
	<li><b>timeout &lt;off|integer&gt;</b><br />
	Number of seconds to wait at the menu screen before booting the default target, the first target will be booted if none are marked as default. The default is "off" which will make the menu wait forever.
	</li>
	
	<li><b>grub-path &lt;path&gt;</b><br />
	Load device.map and grub.cfg/menu.lst from a GRUB installation at this directory. You must specify a device.
	</li>
	
	<li><b>grub-autodetect &lt;on|off&gt;</b><br />
	Enables or disables GRUB autodetection. Autodetection will be enabled by default if no boot targets are specified in kexec-loader.conf.
	</li>
	
	<li><b>grub-map &lt;GRUB device&gt; &lt;device&gt;</b><br />
	Map a GRUB device name. Whole disks or partitions may be mapped, filesystem UUIDs and labels are allowed when mapping partitions. BSD disklabels must be mapped in order to be used from the GRUB configuration.
	</li>
	
	<li><b>kmod &lt;module&gt; &lt;args&gt;</b><br />
	Set options to be passed to a kernel module if it is loaded.
	</li>
</ul>

<p>The following directives are per-target:</p>
<ul>
	<li><b>title &lt;text&gt;</b><br />
	Set the target title, all targets must begin with a title directive.
	</li>
	
	<li><b>root &lt;device&gt;</b><br />
	Set the root device, you must specify a root device, even if all paths specify their own device.
	</li>
	
	<li><b>kernel &lt;path&gt;</b><br />
	Path to the kernel, all targets must specify a kernel.
	</li>
	
	<li><b>initrd &lt;path&gt;</b><br />
	Path to an initrd/initramfs.
	</li>
	
	<li><b>cmdline &lt;text&gt;</b><br />
	Set the command line which will be passed to the target kernel.
	</li>
	
	<li><b>append &lt;text&gt;</b><br />
	Set the kernel command line using --append, this appears to do exactly
	the same thing as cmdline, but is implemented for completeness.
	</li>
	
	<li><b>module &lt;path&gt; [args]</b><br />
	Load and pass a multiboot module to the target kernel.
	</li>
	
	<li><b>default</b><br />
	Mark this target as the default.
	</li>
	
	<li><b>reset-vga</b><br />
	Reset the VGA adaptor before starting the kernel, may be useful if you get garbled or no output on bootup.
	</li>
</ul>

<h3><a name="s3s2">3.2. Shell Reference</a></h3>
<p>
The kexec-loader shell is designed to closely mimic a traditional UNIX shell, except the parsing is far simpler. Escaping or quoting spaces is unnecassary as the parser only breaks at spaces if the command is expecting multiple arguments, therefor if a command takes multiple arguments only the last one may contain spaces.
</p>
<ul>
	<li><b>root &lt;device&gt;</b><br />
	Set the root device, you must specify a root device to boot.
	</li>
	
	<li><b>kernel &lt;path&gt;</b><br />
	Path to the kernel, you must specify a kernel.
	</li>
	
	<li><b>initrd &lt;path&gt;</b><br />
	Path to an initrd/initramfs.
	</li>
	
	<li><b>cmdline &lt;text&gt;</b><br />
	Set the command line which will be passed to the target kernel.
	</li>
	
	<li><b>append &lt;text&gt;</b><br />
	Set the kernel command line using --append, this appears to do exactly
	the same thing as cmdline, but is implemented for completeness.
	</li>
	
	<li><b>module &lt;path&gt; [args]</b><br />
	Load and pass a multiboot module to the target kernel.
	</li>
	
	<li><b>reset-vga</b><br />
	Reset the VGA adaptor before starting the kernel, may be useful if you get garbled or no output on bootup.
	</li>
	
	<li><b>boot</b><br />
	Boot the system using settings entered in the shell.
	</li>
	
	<li><b>disks</b><br />
	Display a list of disks and partitions which have been detected by Linux.
	</li>
	
	<li><b>ls &lt;directory&gt;</b><br />
	List the contents of a directory.
	</li>
	
	<li><b>find &lt;filename&gt; &lt;directory&gt;</b><br />
	Search a directory for files matching the pattern 'filename', filename may include the wildcard characters * or ?.
	</li>
	
	<li><b>cat &lt;filename&gt;</b><br />
	Print the contents of a file to the console.
	</li>
	
	<li><b>exit</b>
	<br />Leave the shell and go back to the menu.
	</li>
</ul>

<h3><a name="s3s3">3.3. Kernel Command Line Options</a></h3>
<p>
The following options can be passed to kexec-loader via the kernel command line.
</p>
<ul>
	<li><b>boot_index</b><br />
	Automatically boot a target by it's index number (starting at 0).
	</li>
	
	<li><b>boot_target</b><br />
	Automatically boot a target by it's title. This is ignored if boot_index is also supplied.
	</li>
	
	<li><b>root</b><br />
	Sets the kexec-loader boot disk. The default is LABEL=kexecloader.
	</li>
	
	<li><b>rootdir</b><br />
	Set the directory containing the kexec-loader files.
	</li>
	
	<li><b>debug_tty</b><br />
	Set the terminal/file to write debug messages to. Default is /dev/tty3.
	</li>
</ul>

<h2><a name="s4">4. Support</a></h2>
<h3><a name="s4s1">4.1. Website</a></h3>
<p>
For information on kexec-loader, including current development and latest
releases, please see the project <a href="http://www.solemnwarning.net/kexec-loader/">website</a>.
</p>
</body>
</html>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published