GNU GRUB 0.97 Installation
If you are reading this, you probably know about Linux and boot loaders but haven't downloaded, installed and configured one or you are one of those people who want to change their bootloader, most likely from LILO to GRUB. I will illustrate procedure you need to follow to install and configure GNU GRand Unified Bootloader (a.k.a GRUB) onto a floppy and Master Boot Record of hard drive. I should tell you that this tutorial is primarily written for grub installation on Slackware Linux.
I would start with a brief introduction of grub. More information on grub can be obtained via the official grub website. If you want to know all about grub, there's a complete manual of grub on the grub website. You can get the latest source code of grub from ftp://alpha.gnu.org/gnu/grub/.
tar -zxvf grub-0.97.tar.gz...this will create a directory grub-0.97.
cd grub-0.97
Now we start the configuration and installation procedure. I generally build using --prefix option. That way I can install the software at the location of my preference rather than the default location (which is mostly /usr/local directory). I have chosen /opt/grub as my default installation directory. You can choose whichever directory you want.
./configure --prefix=/opt/grub
make
make install or checkinstall
Now, we are done with the installation. Now comes the part where we have to install grub either on a floppy or MBR (Master Boot Record) of your hard drive. You would have to be logged in as root to install grub. First, I will illustrate how to install grub on your MBR. Later part of the document takes explains install grub on a floppy. I would recommend the readers to first install grub on a floppy and then proceed with MBR installation.
cd /opt/grubYou would see bin, info, lib, man, sbin directories.
cd lib/grub/i386-pc.
Before we start installing grub, lets take a look at how grub interprets your hard drive geometry. Grub refers to disk and partitions starting from zero. Hence first hard drive would be hd0 while second hard drive would be hd1. Similarly, first partition on first hard drive would be (hd0,0) and second partition on second drive would be (hd1,1).
Now we will build the grub configuration file, which will present nice and selectable menu interface at boot time. I will only present few and required sections of the grub configuration file to produce a workable configuration file. Create a file /boot/grub/menu.lst. This will be our grub configuration file.
-------------GRUB CONFIG SECTIONS-------------------- Color Section is used to produce a nice background and foreground color color cyan/blue white/blue Shaded Text Section is used to shade the selected menu entry in grub. shade 1 Time Out Section is used to boot the default operating system if there is no user
intervention within time out at the grub interface. Time out measures time in seconds.
timeout 20 will boot the default operating system after 20 seconds, if there is no user
intervention within the timeout. timeout 20 Default Section is used to boot the operating system without user intervention.
Grub counts the number from zero. Hence, default 1 will actually boot the second entry on the menu. default 1 Menu Section is used to put the entries that will show up on grub menu and which
you will eventually boot. The disk geometry shown in the entries are entirely mine and yours
can be different so be sure to double check where your OS are installed. I have not mentioned
Initial RAM Disk (initrd) since I don't use them. Please include them after
the kernel line if you use them.
title is where you put the menu entry you would like to show up on the grub menu. title Slackware Linux kernel (hd1,0)/boot/vmlinuz-2.6.11.11 ro root=/dev/hdb1 title Windows XP Professional root (hd0,0) chainloader +1 --------------------------------------------------
We are now done with the configuration file. I must stress the importance of a boot disk should anything go wrong while installation. If anything goes wrong you may not be able to boot into any OS hence I strongly recommend you first create a grub floppy. I have illustrated grub floppy creation at the end of this tutorial. Having said that, let's go to grub installation to the MBR.
grub >
install (hd1,0)/boot/grub/stage1 (hd0) (hd1,0)/boot/grub/stage2 p (hd1,0)/boot/grub/menu.lst
dd if=stage1 of=/dev/fd0 bs=512 count=1
dd if=stage2 of=/dev/fd0 bs=512 seek=1
By now you are all set to use the grub boot loader...remember to take the floppy out of the drive. Cross your fingers and enjoy!!!
I'm including the sample grub configuration file for reference.
---------------------########-------------------------- ###GRUB Configuration file generated by Nishant 6/7/2005 ###Color foreground/background color cyan/blue white/blue ###Shaded Text Entries shade 1 ###Time out in seconds before default entry in booted timeout 20 ###Default OS to boot default 1 ###The OS to boot go here... title Slackware Linux kernel (hd1,0)/boot/vmlinuz-2.6.11.11 ro root=/dev/hdb1 title Windows XP Professional root (hd0,0) chainloader +1 ----------------------########--------------------------