booting

GRUB can load Multiboot-compliant kernels in a consistent way, but for some free operating systems you need to use some OS-specific magic.

4.1 How to boot operating systems How to boot OSes with GRUB generally
4.2 Some caveats on OS-specific issues Notes on some operating systems

4.1 How to boot operating systems

GRUB has two distinct boot methods. One of the two is to load an operating system directly, and the other is to chain-load another boot loader which then will load an operating system actually. Generally speaking, the former is more desirable, because you don't need to install or maintain other boot loaders and GRUB is flexible enough to load an operating system from an arbitrary disk/partition. However, the latter is sometimes required, since GRUB doesn't support all the existing operating systems natively.

4.1.1 How to boot an OS directly with GRUB
4.1.2 Load another boot loader to boot unsupported operating systems

4.1.1 How to boot an OS directly with GRUB

Multiboot (see section `Motivation' in The Multiboot Specification) is the native format supported by GRUB. For the sake of convenience, there is also support for Linux, FreeBSD, NetBSD and OpenBSD. If you want to boot other operating systems, you will have to chain-load them (see section 4.1.2 Load another boot loader to boot unsupported operating systems).

Generally, GRUB can boot any Multiboot-compliant OS in the following steps:

1. Set GRUB's root device to the drive where the OS images are stored with the command root (see section 13.3.31 root).

2. Load the kernel image with the command kernel (see section 13.3.20 kernel).

3. If you need modules, load them with the command module (see section 13.3.25 module) or modulenounzip (see section 13.3.26 modulenounzip).

4. Run the command boot (see section 13.3.2 boot).

Linux, FreeBSD, NetBSD and OpenBSD can be booted in a similar manner. You load a kernel image with the command kernel and then run the command boot. If the kernel requires some parameters, just append the parameters to kernel, after the file name of the kernel. Also, please refer to 4.2 Some caveats on OS-specific issues, for information on your OS-specific issues.

4.1.2 Load another boot loader to boot unsupported operating systems

If you want to boot an unsupported operating system (e.g. Windows 95), chain-load a boot loader for the operating system. Normally, the boot loader is embedded in the boot sector of the partition on which the operating system is installed.

1. Set GRUB's root device to the partition by the command rootnoverify (see section 13.3.32 rootnoverify):

grub> rootnoverify (hd0,0)

2. Set the active flag in the partition using the command makeactive(6) (see section 13.3.22 makeactive):

grub> makeactive

3. Load the boot loader with the command chainloader (see section 13.3.4 chainloader):

grub> chainloader +1

`+1' indicates that GRUB should read one sector from the start of the partition. The complete description about this syntax can be found in 11.3 How to specify block lists.

4. Run the command boot (see section 13.3.2 boot).

However, DOS and Windows have some deficiencies, so you might have to use more complicated instructions. See section 4.2.6 DOS/Windows, for more information.

4.2 Some caveats on OS-specific issues

Here, we describe some caveats on several operating systems.

4.2.1 GNU/Hurd
4.2.2 GNU/Linux

4.2.1 GNU/Hurd

Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is nothing special about it. But do not forget that you have to specify a root partition to the kernel.

1. Set GRUB's root device to the same drive as GNU/Hurd's. Probably the command find /boot/gnumach or similar can help you (see section 13.3.11 find).

2. Load the kernel and the module, like this:

grub> kernel /boot/gnumach root=hd0s1
grub> module /boot/serverboot

3. Run the command boot (see section 13.3.2 boot).

4.2.2 GNU/Linux

It is relatively easy to boot GNU/Linux from GRUB, because it somewhat resembles to boot a Multiboot-compliant OS.

1. Set GRUB's root device to the same drive as GNU/Linux's. Probably the command find /vmlinuz or similar can help you (see section 13.3.11 find).

2. Load the kernel:

grub> kernel /vmlinuz root=/dev/hda1

If you need to specify some kernel parameters, just append them to the command. For example, to set `vga' to `ext', do this:

grub> kernel /vmlinuz root=/dev/hda1 vga=ext

See the documentation in the Linux source tree for complete information on the available options.

3. If you use an initrd, execute the command initrd (see section 13.3.17 initrd) after kernel:

grub> initrd /initrd

4. Finally, run the command boot (see section 13.3.2 boot).

Caution: If you use an initrd and specify the `mem=' option to the kernel to let it use less than actual memory size, you will also have to specify the same memory size to GRUB. To let GRUB know the size, run the command uppermem before loading the kernel. See section 13.3.37 uppermem, for more information.