Multiboot with GRUB

by Robert L.E. BILLON

Last update
2010-11-03

Foreword   

GRUB is the GNU GRand Unified Bootloader. It is independant of any particular OS and may be seen as a tiny, function specific OS. It provides command line and menu driven interfaces to performs its multiboot functions.

In a few words, GRUB is : OS-neutral, interactive, powerfull

Even if you stick with LILO as as your system's primary bootloader, a GRUB boot floppy at hand is the best and fastest way to get your system back, in the case your MBR went to be corrupted.

Préface   

GRUB est le GRand Unifié Bootloader de GNU. Il est indépendant de tout OS et peut être considéré comme un petit OS spécifique de boot. Il procure à volonté ligne de commande ou menu pour réaliser ses fonctions de multiboot.

Pour résumer, GRUB est : OS indépendant, interactif, puissant

Même si vous êtes très attaché à LILO comme bootloader principal, un floppy disk bootable GRUB vous tirera d'affaire si votre MBR venait à être corrompu.

Get the GRUB archive

See   http://www.gnu.org/software/grub/grub.html   where you will find the latest informations about GRUB and download from the server   ftp://alpha.gnu.org/gnu/grub   the archive

grub-0.5.96.1.tar.gz

wich you put in your   /usr/local/share   directory or provisionaly, if you are not root, in   ~/tmp/   then move it later in the   /usr/local/share/ directory.

Se procurer l'archive de GRUB

Voir sur   http://www.gnu.org/software/grub/grub.html   où se trouvent les informations sur GRUB et récuprérer sur le serveur   ftp://alpha.gnu.org/gnu/grub   l'archive

grub-0.5.96.1.tar.gz

à mettre dans   /usr/local/share   ou bien provisoirement, si l'on n'est pas root, dans   ~/tmp/   puis la déplacer ultérieurement dans   /usr/local/share/

Configure and compile

As root :

cd /usr/local/share/
tar -xzvf grub-0.5.96.1.tar.gz
cd grub-0.5.96.1
./configure
make
make install

Then, with your favorite editor, create your menu list   menu.lst   and move it to   /usr/local/share/grub/i386-pc/   (see example here after)

Configuration et compilation

En étant root :

cd /usr/local/share
tar -xzvf grub-0.5.96.1.tar.gz
cd grub-0.5.96.1
./configure
make
make install

Puis, au moyen de votre éditeur préféré, créez votre menu liste   menu.lst   et déplacez le dans   /usr/local/share/grub/i386-pc/   (voir exemple ci-après)

Create your GRUB floppy

fdformat /dev/fd0u1440
mkfs -t minix /dev/fd0

(GRUB knows ext2fs, minix, msdos, fat, reiser, BSD's ffs, ...)

cd /usr/local/share/grub/i386-pc/
mount -t minix /dev/fd0 /mnt/floppy/
mkdir -p /mnt/floppy/boot/grub/
cp stage* /mnt/floppy/boot/grub/
cp menu.lst /mnt/floppy/boot/grub/
umount /mnt/floppy/

cd /usr/local/share/grub-0.5.96.1/grub/
./grub
root (fd0)
setup (fd0)
quit

Voilà! GRUB is now installed onto the floppy disk MBR. The bootable floppy disk is ready.

Création d'un floppy disk GRUB

fdformat /dev/fd0u1440
mkfs -t minix /dev/fd0

(GRUB reconnait ext2fs, minix, msdos, fat, reiser, BSD's ffs, ...)

cd /usr/local/share/grub/i386-pc/
mount -t minix /dev/fd0 /mnt/floppy/
mkdir -p /mnt/floppy/boot/grub/
cp stage* /mnt/floppy/boot/grub/
cp menu.lst /mnt/floppy/boot/grub/
umount /mnt/floppy/

cd /usr/local/share/grub-0.5.96.1/grub/
./grub
root (fd0)
setup (fd0)
quit

C'est tout. GRUB est installé dans le MBR du floppy disk. Le floppydisk bootable est prêt.

Install GRUB on your hard disk

You can install GRUB in any partition, preferably a partition with a stable OS and one you aren't reinstalling all the time.

Boot as habitually on this partition. Create in this partition a directory   /boot/grub/
Copy into this directory :
- the files located in   /usr/local/share/grub/i386-pc/
- your handcrafted   menu.lst   configuration file

Then run GRUB

grub
root (hd0,1)
setup (hd0)
quit

Voilà! A bit of GRUB (stage1) is installed onto the MBR of your hard disk. If one day you will remove it, then you will resort to the classic command

fdisk /MBR

Installer GRUB sur votre hard disk

Vous pouvez installer GRUB dans la partition de votre choix, de préférence une partition avec un OS stable et que vous ne remaniez pas trop souvent.

Bootez de façon habituelle sur cette partition. Créez dans cette partition un répertoire   /boot/grub/
Copiez dans ce répertoire :
- les fichiers situés dans   /usr/local/share/grub/i386-pc/
- votre   menu.lst

Puis lancez GRUB

grub
root (hd0,1)
setup (hd0)
quit

Voilà ! Un petit bout de GRUB (stage1) est installé dans le MBR de votre disque. Si un jour voulez le supprimer, vous aurez recours à la commande classique

fdisk /MBR

Note about naming disks with GRUB

Hard disks are all hd, floppy disks are fd, device numbers starts from zero, partition numbers starts from zero and complete device names are enclosed in parentheses.
The "slices" of the FreeBSD system are referenced with letters, example : (hd0,1,a).

For more information type info grub on your Linux box

Note sur le nom des disques avec GRUB

Les disques durs sont tous hd, les floppy disks fd, les numéros de device commencent à zéro, les numéros de partition commencent à zéro, et les noms complets sont entre parenthèses.
Les "slices" ou tranches du système FreeBSD sont référencées par des lettres, exemple : (hd0,1,a).

Pour plus d'informations tapez info grub sur votre boîte Linux


Une présentation plus complète et plus récente se trouve ici : Guilde::Partitions et boot loader

See also : The grub manual


Example file menu.lst


# Example config file for GRUB
# The GNU GRand Unified Bootloader
# /boot/grub/menu.lst

# general configuration:
timeout  10
default   0
fallback  1
fallback  9
color     blue/cyan  yellow/magenta

# boot sections follow
# each is implicitly numbered from 0
# in the order of appearance below

# (0) Mandrake (default boot)
title  Mandrake  [/vmlinuz]
root   (hd0,2)
kernel /vmlinuz root=/dev/sda3 ro

# (1) Mandrake - runlevel 1
title  Mandrake  [/vmlinuz single]
root   (hd0,2)
kernel /vmlinuz single root=/dev/sda3 ro

# (2) Mandrake-old
title  Mandrake  [/vmlinuz.old]
root   (hd0,2)
kernel /vmlinuz.old root=/dev/sda3 ro

# (3) Debian-kernel testing
title  Debian  [/vmlinuz.test]
root   (hd0,2)
kernel /vmlinuz.test root=/dev/sda3 ro

# (4) Slackware
title  Slackware
root   (hd0,1)
kernel /vmlinuz root=/dev/sdb2 ro vga=791 mem=256M


# (5) FreeBSD:
title  FreeBSD
root   (hd1,0,a)
kernel /boot/loader

# (6) OpenBSD:
title  OpenBSD
# You would like to use:
## root  (hd1,1,a)
## kernel --type=openbsd /bsd
# But OpenBSD passes bios & kernel parameters
# with its own bootloader, the first stage of
# which is installed in the partition boot
# record, and in turn calls /boot, which in
# turn loads kernel /bsd. So just use the GRUB
# chainloader instead:
root (hd1,1)
makeactive
chainloader +1

# (7) BeOS:
title  BeOS
rootnoverify  (hd1,2)
makeactive
chainloader +1

# (8) Win_dose
title Win98
root  (hd0,0)
makeactive
chainloader +1

# (9) MS-DOS
title msdos
root  (hd0,0)
makeactive
chainloader +1

# end file menu.lst


    
File: grub.html - Robert L.E. Billon, 2001-05-07 - Last update: 2014-01-14