NOTE BEFORE ANYTHING: The bigest confusion is between what GRUB calls 'root' and what linux mounts as 'root' or '/'.
GRUB => root(hd0,0) specifies the 'root of where grub is installed', or in other words '/boot'.
LINUX => 'root' refers to the '/' partition.
I'm assuming this:
/dev/hda => the primary disk
(hd0,0) => /dev/hda1 => /boot
(hd0,1) => /dev/hda2 => swap
(hd0,2) => /dev/hda3 => /tmp
(hd0,3) => /dev/hda4 => /
/boot/vmlinuz-2.6.12-9 => kernel
/boot/initrd-2.6.12-9.img => initrd image file
If your first partition (/dev/hda1) is '/boot' then the following is what you would want to do in order to setup grub.
I first run the grub-install util to install to the Master Boot Record:
Then, setup grub by executing the 'grub' command:
grub> root (hd0,0)
grub> setup (hd0)
Again, as stated above, in this section 'root' refers to the 'root directory that grub is installed' which is the first partition on our hda disk (/dev/hda1 => /boot). If you do *not* have a separate '/boot' partition... then this will be the '/' partition.
After this you should have the folder '/boot/grub' with associated files. Assuming your kernel is something like '/boot/vmlinuz-2.6.12-9' then you would need, at the least, the following in '/boot/grub/grub.conf':
(Please note that some distros recognize '/boot/grub/menu.lst' rather than '/boot/grub/grub.conf'... and most link them one way or the other so that both work.)
title Linux Kernel (vmlinuz-2.6.12-9)
kernel /vmlinuz-2.6.12-9 root=/dev/hda4
# if using initial ramdisk, uncomment the following line
# initrd /initrd-2.6.12-9.img
line 1) Title line (obvious)
line 2) root(hd0,0) specifies the partition that holds grub ('/boot')
line 3) specifies where the kernel is on (hd0,0)... i.e '(hd0,0)/vmlinuz-2.6.12-9' is the same as '/boot/vmlinuz-2.6.12-9' and since you have specified 'root (hd0,0)' then the same thing is written as '/vmlinuz-2.6.12-9'. The second part to this is the 'root=' line. This directive specifies where your ROOT partition is... i.e '/'. So if '/dev/hda4' is the partition that is mounted as '/'... then you would want 'root=/dev/hda4'.
line 4) Specify where the initrd is found. This depends on how your kernel was compiled. To see, grep your kernel .config file (usually found as '/boot/config-[kernel version]') or wherever you compiled the kernel ('/usr/src/linux-2.6.12-9/.config' ... etc). Typing the following will show whether it was compiled:
cat /boot/config-2.6.12-9 | grep -i initrd
for 'yes', or
for 'module', or
SAVING YOURSELF.... FROM A BROKEN GRUB INSTALL...
If you gotten yourself in a pickle, don't fret. Basically, when the system boots to the GRUB boot loader you can manually execute what *should* be in your /boot/grub/grub.conf.
So, you boot to GRUB and it does nothing.... do the following:
type 'c' for a grub> command prompt.
type 'root(hd0,0)' or whatever your 'grub root partition is'.
you should see something like:
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
if not, you might see
Filesystem type unkown
or something like that. Then type your kernel line (note that you can use TAB COMPLETION just like in bash... very nice!)
grub> kernel (hd0,0)/vmlinuz-2.6.12-9 root=/dev/hda4
[Linux-bzImage, setup=0x1400, size=0x124587]
if you type it wrong
grub> kernel (hd0,0)/vmlinuz2.6.12-9 root=/dev/hda4
Error 15: File not found
If you need to specify an initrd... just type that line too:
Once your done, just type 'boot' and you should be good to go.