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

5. Configuration

You've probably noticed that you need to type several commands to boot your OS. There's a solution to that - GRUB provides a menu interface (see section The simple menu interface) from which you can select an item (using arrow keys) that will do everything to boot an OS.

To enable the menu, you need a configuration file, `menu.lst' under the boot directory. We'll analyze an example file.

The file first contains some general settings, the menu interface related options. You can put these commands (see section The list of commands for the menu only) before any of the items (starting with title (see section title)).

 
#
# Sample boot menu configuration file
#

As you may have guessed, these lines are comments. Lines starting with a hash character (`#'), and blank lines, are ignored by GRUB.

 
# By default, boot the first entry.
default 0

The first entry (here, counting starts with number zero, not one!) will be the default choice.

 
# Boot automatically after 30 secs.
timeout 30

As the comment says, GRUB will boot automatically in 30 seconds, unless interrupted with a keypress.

 
# Fallback to the second entry.
fallback 1

If, for any reason, the default entry doesn't work, fall back to the second one (this is rarely used, for obvious reasons).

Note that the complete descriptions of these commands, which are menu interface specific, can be found in The list of commands for the menu only. Other descriptions can be found in The list of available commands.

Now, on to the actual OS definitions. You will see that each entry begins with a special command, title (see section title), and the action is described after it. Note that there is no command boot (see section boot) at the end of each item. That is because GRUB automatically executes boot if it loads other commands successfully.

The argument for the command title is used to display a short title/description of the entry in the menu. Since title displays the argument as is, you can write basically anything there.

 
# For booting GNU/Hurd
title  GNU/Hurd
root   (hd0,0)
kernel /boot/gnumach.gz root=hd0s1
module /boot/serverboot.gz

This boots GNU/Hurd from the first hard disk.

 
# For booting GNU/Linux
title  GNU/Linux
kernel (hd1,0)/vmlinuz root=/dev/hdb1

This boots GNU/Linux, but from the second hard disk.

 
# For booting Mach (getting kernel from floppy)
title  Utah Mach4 multiboot
root   (hd0,2)
pause  Insert the diskette now^G!!
kernel (fd0)/boot/kernel root=hd0s3
module (fd0)/boot/bootstrap

This boots Mach with a kernel on a floppy, but the root filesystem at hd0s3. It also contains a pause line (see section pause), which will cause GRUB to display a prompt and delay, before actually executing the rest of the commands and booting.

 
# For booting FreeBSD
title  FreeBSD
root   (hd0,2,a)
kernel /boot/loader

This item will boot FreeBSD kernel loaded from the `a' partition of the third PC slice of the first hard disk.

 
# For booting OS/2
title OS/2
root  (hd0,1)
makeactive
# chainload OS/2 bootloader from the first sector
chainloader +1
# This is similar to "chainload", but loads a specific file
#chainloader /boot/chain.os2

This will boot OS/2, using a chain-loader (see section Load another boot loader to boot unsupported operating systems).

 
# For booting Windows NT or Windows95
title Windows NT / Windows 95 boot menu
root        (hd0,0)
makeactive
chainloader +1
# For loading DOS if Windows NT is installed
# chainload /bootsect.dos

The same as the above, but for Windows.

 
# For installing GRUB into the hard disk
title Install GRUB into the hard disk
root    (hd0,0)
setup   (hd0)

This will just (re)install GRUB onto the hard disk.

 
# Change the colors.
title Change the colors
color light-green/brown blink-red/blue

In the last entry, the command color is used (see section color), to change the menu colors (try it!). This command is somewhat special, because it can be used both in the command-line and in the menu. GRUB has several such commands, see The list of general commands.

We hope that you now understand how to use the basic features of GRUB. To learn more about GRUB, see the following chapters.


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

This document was generated by root on April, 6 2008 using texi2html 1.76.