Whole document tree
    

Whole document tree

GRUB Manual: Booting
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Booting

For Multiboot-compliant kernels, GRUB can load them 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 genenerally
4.2 Some caveats on OS-specific issues  Notes on some operating systems


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 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  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 are 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 by the command root (see section 13.3.31 root).

  2. Load the kernel image by 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 can load a kernel image by 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 the information on your OS-specific issues.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 by the command makeactive(5) (see section 13.3.22 makeactive):

     
    grub> makeactive
    

  3. Load the boot loader by 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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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.3 FreeBSD  
4.2.4 NetBSD  
4.2.5 OpenBSD  
4.2.6 DOS/Windows  
4.2.7 SCO UnixWare  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 the 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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2.3 FreeBSD

GRUB can load the kernel directly, either in ELF or a.out format. But this is not recommended, since FreeBSD's bootstrap interface sometimes changes heavily, so GRUB can't guarantee to pass kernel parameters correctly.

Thus, we'd recommend loading the very flexible loader `/boot/loader' instead. See this example:

 
grub> root (hd0,a)
grub> kernel /boot/loader
grub> boot


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2.4 NetBSD

GRUB can load NetBSD a.out and ELF directly, follow these steps:

  1. Set GRUB's root device with root (see section 13.3.31 root).

  2. Load the kernel with kernel (see section 13.3.20 kernel). You should append the ugly option `--type=netbsd', if you want to load an ELF kernel, like this:

     
    grub> kernel --type=netbsd /netbsd-elf
    

  3. Run boot (see section 13.3.2 boot).

For now, however, GRUB doesn't allow you to pass kernel parameters, so it may be better to chain-load it instead, for more information please see 4.1.2 Load another boot loader to boot unsupported operating systems.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2.5 OpenBSD

The booting instruction is exactly the same as for NetBSD (see section 4.2.4 NetBSD).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2.6 DOS/Windows

GRUB cannot boot DOS or Windows directly, so you must chain-load them (see section 4.1.2 Load another boot loader to boot unsupported operating systems). However, their boot loaders have some critical deficiencies, so it may not work to just chain-load them. To overcome the problems, GRUB provides you with two helper functions.

If you have installed DOS (or Windows) on a non-first hard disk, you have to use the disk swapping technique, because that OS cannot boot from any disks but the first one. The workaround used in GRUB is the command map (see section 13.3.23 map), like this:

 
grub> map (hd0) (hd1)
grub> map (hd1) (hd0)

This performs a virtual swap between your first and second hard drive.

Caution: This is effective only if DOS (or Windows) uses BIOS to access the swapped disks. If that OS uses a special driver for the disks, this probably won't work.

Another problem arises if you installed more than one set of DOS/Windows onto one disk, because they could be confused if there are more than one primary partitions for DOS/Windows. Certainly you should avoid doing this, but there is a solution if you do want to do so. Use the partition hiding/unhiding technique.

If GRUB hides a DOS (or Windows) partition (see section 13.2.5 hide), DOS (or Windows) will ignore the partition. If GRUB unhides a DOS (or Windows) partition (see section 13.2.15 unhide), DOS (or Windows) will detect the partition. Thus, if you have installed DOS (or Windows) on the first and the second partition of the first hard disk, and you want to boot the copy on the first partition, do the following:

 
grub> unhide (hd0,0)
grub> hide (hd0,1)
grub> rootnoverify (hd0,0)
grub> chainloader +1
grub> makeactive
grub> boot


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2.7 SCO UnixWare

It is known that the signature in the boot loader for SCO UnixWare is wrong, so you will have to specify the option `--force' to chainloader (see section 13.3.4 chainloader), like this:

 
grub> rootnoverify (hd1,0)
grub> chainloader --force +1
grub> makeactive
grub> boot


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Jason Thomas on February, 4 2002 using texi2html