TITLE: GRUB-Howto LFS VERSION: any AUTHOR: Fabio Fracassi SYNOPSIS: GRUB is an alternative to LILO. This explains how to make it work. HINT: GRUB is the GNU GRand Unified Bootloader, a project which intends to solve all bootup problems once and for all. One of the most interesting features, is that you don't have to install a new partition or kernel, you can change all parameters at boottime via the GRUB Console, since it knows about the filesystems. Let's get down to work: 1. - Download: ftp://alpha.gnu.org/pub/gnu/grub/grub-0.91.tar.gz 1b.- Download: http://linuxfromscratch.org/~gerard/grub-0.91-vga16.patch This gives you support for a background picture in grub, if you want it 2. - Extract: tar -xvzf grub-0.91.tar.gz 2b.- Optionally apply th patch: patch -Np1 -i grub-0.91-vga16.patch 3. - Install: ./configure --prefix=/usr # see INSTALL for further options make make install mkdir /boot/grub cp /usr/share/grub/i386-pc/stage1 /boot/grub cp /usr/share/grub/i386-pc/stage2 /boot/grub And if you want copy one of the stage1.5 files, too (more later) 4. - Starting Gurb: Now there are two ways of going on, you can start the GRUB Console via /usr/sbin/grub (which did not work too well for me :( ) or via bootdisk: cd /boot/gurb cat stage1 stage2 >/dev/fd0 #Be sure to have an empty disk # in your drive! Reboot! 5. - Cofiguration: Now you have to define your setup: First GRUB wants to know on which partition it is installed GRUB names the partition as follows: (hd,) i.e. /dev/hda is (hd0), /dev/hda1 (hd0,0), /dev/hdb2 (hd1,1), ... (I hope you get the clue ;) - else try man grub/info grub) if you dont know the partition you can issue a find /boot/grub/stage1 on the GRUB Console Now you tell GRUB where it is installed: root (hd0,2) # thats my setup (/dev/hda2) And install it in MBR setup (hd0) If you want you can reboot now, and with kernel (hd0,1)/boot/bzImage root=/dev/hda2 start your system. There is the posibility to "teach" GRUB knowlage of the filesystem, that way GRUB doesn't need a Blockmap for the stage2 file and is thus more robust against filesystem changes. This is arcived with the stage1.5 files: after issuing root (hd0,1) type embed /boot/grub/reiserfs_stage1_5 (hd0) # or e2fs_stage1_5 and note the number of sectors now issue setup (hd0) or install /boot/grub/stage1 (hd0) (hd0)1+ p /boot/grub/stage2 /boot/grub/menu.lst 6. - Installing a Bootmenu: simply put a menu.lst file in the /boot/grub directory you can put most GRUB Console commands in there! (Check info grub!) Here is my setup for reference: # File /boot/grub/menu.lst - Bootmenu definition # # Start Entry 0 by default default 0 timeout 10 # makeing it nicer ;) color green/black light-green/black # If you have the Pixmap patch applied you can # define a Background Picture here # The nice LFS image can be found at # http://linuxfromscratch.org/~gerard/lfslogos/lfs-grub-splash.xpm splashimage (hd0,1)/boot/grub/lfs-grub-splash.xpm #German keyboard setkey y z setkey z y setkey Y Z setkey Z Y setkey equal parenright setkey parenright parenleft setkey parenleft asterisk setkey doublequote at setkey plus bracketright setkey minus slash setkey slash ampersand setkey ampersand percent setkey percent caret setkey underscore question setkey question underscore setkey semicolon less setkey less numbersign setkey numbersign backslash setkey colon greater setkey greater bar setkey asterisk braceright #Standard Linux title LFS-Linux 2.4 kernel (hd0,1)/boot/bzImage root=/dev/hda2 #Old Linux title Old Suse Linux 6.4 kernel (hd1,0)/bzImage root=/dev/hdb2 #Windows 98 title Windows 98 chainloader (hd0,0)+1 #install grup title (Re)Install grup root (hd0,1) embed /boot/grub/reiserfs_stage1_5 install /boot/grub/stage1 (hd0) (hd0)1+19 p /boot/grub/stage2 /boot/grub/menu.lst I think that gives you an idea how powerful a tool GRUB is, and as you see not to difficult, too :) The only problem I encouterd was, that the install/setup commands didn't work from /usr/sbin/grub but I had no problems with the bootdisk. I don't know much more about GRUB than what I wrote here check the Documentation (especially info grub) for more information Thanks to the German C't Magazin for the great article about GRUB Update: 17/Apr/2002 Fabio Fracassi (turiya@linuxfromscratch.org) Thanks to Gerard Beekmans for the Splashscreen Patch (and for LFS ;) )