Chapter 4: Booting 9
$ cp /usr/share/grub/i386-pc/stage2_eltorito iso/boot/grub
If desired, make the config file ‘menu.lst’ under ‘iso/boot/grub’ (see Chapter 5
[Configuration], page 13), and copy any files and directories for the disc to the directory
‘iso/’.
Finally, make a ISO9660 image file like this:
$ mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
-boot-load-size 4 -boot-info-table -o grub.iso iso
This pro duces a file named ‘grub.iso’, which then can be burned into a CD (or a
DVD). mkisofs has already set up the disc to boot from the boot/grub/stage2_eltorito
file, so there is no need to setup GRUB on the disc. (Note that the -boot-load-size 4 bit
is required for compatibility with the BIOS on many older machines.)
You can use the device ‘(cd)’ to access a C D-ROM in your config file. This is not
required; GRUB automatically sets the root device to ‘(cd)’ when booted from a CD-ROM.
It is only necessary to refer to ‘(cd)’ if you want to access other drives as well.
4 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
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 w ill load an operating system
actually. Generally speaking, the former is more des irable, 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
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 [Chain-loading], page 10).
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], page 36).
2. Load the kernel image with the command kernel (see Section 13.3.20 [kernel], page 35).
3. If you need modules, load them with the command module (see Section 13.3.25 [mod-
ule], page 36) or modulenounzip (see Section 13.3.26 [modulenounzip], page 36).
4. Run the command boot (see Section 13.3.2 [boot], page 31).
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