|
By : ShadowFox
Date : 6/17/03
**Notice: I dont not take responsiblity for your own stupid actions, if
you mess up your GRUB configuration, that is your won fault. It is a good
idea to back up your menu.conf before you start editing it on a floppy.**
First let me explain some easy conventions about GRUB. Your primary hard
drive (usually known as hda) will be labled as hd0, each partition of
that drive such as hda1, hda2,hda3, etc etc will be known to grub as hd0,0
hd0,1 hd0,2 hd0,3 and so on. If you have a second hard drive (hdb) it
will be known as hd1 and the partitions will be known as hd1,0 hd1,1 and
so on. So say your partition looks something like this:

The Partition table will look something like this:
| Windows XP (NTFS) |
/dev/hda1 |
hd0,0 |
| Windows 98 (FAT32) |
/dev/hda2 |
hd0,1 |
| Linux Swap space |
/dev/hda3 |
hd0,2 |
| Root Partiton (/) |
/dev/hda4 |
hd0,3 |
| Home Partition (/home) |
/dev/hda5 |
hd0,4 |
It's a good idea to make your so and wite it down so you
can visually understand your partition sector. It will really help when
you are editing menu.conf. When you open up menu.conf you will see a bevvy
of commands, I will explain them to you here.
timeout x - this is the selection timer for grub. Set it in seconds
only where "x" is the number of seconds
default x - this is the default boot sequence. Once the timer runs
out, GRUB will automatically boot this option. ("x" is the selection
number, starting with 0)
fallback x - GRUB boots this sequence if there is an error with
the default sequence. ("x" is the selection number, starting
with 0)
title - starts a new entry in grub. "xxxxx" will be displayed
in the boot menu
hide (x,x) - hides the partition hdx,x
unhide (x,x) -unhides the partition hdx,x
lock - requires a password to continue past that point in the boot
sequence
map (hdx) (hdy) - virtually switches hard disks
root - tells grub what partition the root diectory is on and mounts
it so files can be read
rootnoverify - does the same thing as root, but does not mount
the partition
kernel - specifies the kernel to read, and can pass varibles to
the kernal
chainloader - Loads the specified file as a chain loader. To grab
the file at the first sector of the specified partition, use +1 as the
file's name.
makeactive - Set the active partition on the root disk to GRUB's
root device. This command is limited to primary PC partitions on a hard
disk
Alright before we start you need to boot up your computer login as root
and go to your /boot/grub directory. I would recommend you make a copy
of your menu.conf file before we continue. Now llets make our own menu.conf
# Example: Grub menu.conf
timeout 30
default 0
Now for our first System: Red Hat 7.3
title Red Hat 7.3
root (0,3)
kernal /boot/vmlinuz-2.4.17
boot
Root is telling grub where to look for the linux partition and mounting
it, hd4 is this case. Kernel is tellin the system to look in /boot.vmlinuz-2.4.17
for the kernal. Finally, boot is giving up control from grub to the linux
kernal.
Next the Windows XP boot:
title Windows XP Professional
rootnoverify(0,0)
chainloader +1
makeactive
boot
What is happening here is that GRUB is reading the hda1 partition and
then chainloading Windows boot loader. Finally making the partition active
and briving up control to Windows.
Now how would I load Windows 98 up if it exsisted on the FAT32 partition
and not data, since Windows is designed NOT to allow two verisons of itself
on a system? The answer: hide/unhide. First lets modify our WinXP loader:
title Windows XP Professional
unhide (0,0)
hide (0,1)
rootnoverify(0,0)
chainloader +1
makeactive
boot
Then we follow the same steps for Windows 98, like with Windows XP
title Windows 98 SE
unhide (0,1)
hide (0,0)
rootnoverify(0,0)
chainloader +1
makeactive
boot
Finally, our menu.conf will look something like this:
# Example: Grub menu.conf
# set as seconds only. If no option is picked by the time aloted, it
goes to default.
timeout 60
# Enter the number of the entry you want to boot first (starts
with 0).
default 1
# If default doesnt work, it boots thisentry (stars with 0).
fallback 0
#-------------------------
# Entry 1 (0) Linux Partition
title Red Hat 7.3 Linux
root (hd0,3)
kernel /boot/vmlinuz-2.4.17 root=/dev/hda4
boot
#-------------------------
# Entry 2 (1)
title Windows XP
unhide (hd0,0)
hide (hd0,1)
rootnoverify (hd0,0)
chainloader +1
makeactive
boot
#-------------------------
# Entry 3 (2)
title Windows 98
hide (hd0,0)
unhide (hd0,1)
rootnoverify (hd0,1)
chainloader +1
makeactive
boot
|