|
|
Booting GNU/Linux - GRUBSummary:
Advantages Of Using GRUB~LiLo (Linux Loader) is the standard GNU/Linux boot loader, usually installed at system installation time. Despite its name, you may use it for booting other operating systems on the same or other system disks, too. Since ML 7.1, you can use GNU GRUB , the GRand Unified Bootloader, instead. It has several advantages over ~LiLo:
Installing GRUBFirst check if GRUB is already installed with rpm -q grub urpmi grub Having done this, issue (as 'root') the command: grub-install /dev/{device} 'device' is the name of the device whose boot sector should be used. In most cases this will be 'hda', i.e. the master boot record of the first IDE hard drive. You should get a message like this: {some text}<br> (fd0) /dev/fd0<br> (hd0) /dev/hda This lists the bootable device GRUB has found: a floppy drive on the first controller and a disk at the first IDE master channel. Of course this may look different on your machine. The first field denotes GRUB's syntax, the second the syntax Linux uses to describe a device. GRUB doesn't discriminate between SCSI and IDE hard-disks, it just takes their boot-order into account. Thus an entry on a system with one SCSI disk: (fd0) /dev/fd0<br> (hd0) /dev/sda And on system with one SCSI and one IDE hard drive where the BIOS is set to boot from the SCSI drive: (fd0) /dev/fd0<br> (hd0) /dev/sda<br> (hd1) /dev/hda If you change the boot order between the disks, you will have to edit '/boot/grub/devices.map' to reflect the change. In case the 'grub-install' script should fail, you can install the boot sector from within the GRUB shell: grub<br> {some text}<br> grub> root (hdw,x)<br> {some text}<br> grub> setup (hdy,z) 'w', 'x', 'y' and 'z' are numbers. 'w' signifies the hard disk, 'x' the partition on which the '/boot/grub' directory is located, 'y' the hard disk where the boot sector should be installed and 'z' is necessary if you want to install the boot sector to a partition and not to the master boot sector of 'y'. It is important to note that GRUB always starts counting from '0'. grub> root (hd0,2)<br> grub> setup (hd0) Example 2: Install GRUB to the boot sector of a root partition. This root partition is located on a SCSI hard disk, booted from after an IDE disk and is located on '/dev/sda1'. grub> root (hd1,0)<br> grub> setup (hd1,0) Basically, that's it. Reboot and you will be presented with a grub> help help {command} Well, but how to boot Linux? Obviously you will have to tell GRUB where it should look for the root partition and the kernel. And then you have to append a parameter telling Linux' init kernel kernel (hd0,0)/boot/vmlinuz root=/dev/hda1 Can't remember on which partition your kernel was? Easy: find /boot/vmlinuz boot OK, that may be nice for the first time, but there sure is a way to make this more comfortable? Read on ... GRUB ConfigurationGNU GRUB's configuration file is '/boot/grub/menu.lst'. You can edit or create it either by loading it into an editor, or by using the '~DrakBoot' tool in '~DrakConf' (Mandrake Control Center). In contrast to '~LiLo', you don't have to run any command after editing. To get an overview on available GNU GRUB commands, just start a GNU GRUB shell as 'root' by typing grub on a virtual terminal. Then type help help {command} info grub Like 'lilo.conf', 'menu.lst' consists of a general section and of entries for the several operating systems /distributions / kernels you want to boot. A typical general section may look like this: timeout 5<br> color black/cyan yellow/cyan<br> i18n (hd0,0)/boot/grub/messages<br> keytable (hd0,0)/boot/us.klt<br> default 0
This tells GRUB:
(hd0,0) Partition numbering also starts with null. Note that the first logical partition is always '4', regardless of how many primary partitions are actually on the disk. An entry for Linux would look like this: title Linux<br> kernel (hd0,0)/boot/vmlinuz root=/dev/hda1 The title kernel (hd0,0)/boot/vmlinuz-{...} root=/dev/hda1 init init An usefull parameter is PROFILE that allows to boot a specific profile (defined in the Mandrake Control Center). This is particularly interesting in the case of a laptop used in different network environments (for example DHCP and static IP allocation), in this case you have the possibility to chose the right profile at boot-time. An entry booting a profile called dhcp would look like this: title Linux<br> kernel (hd0,0)/boot/vmlinuz root=/dev/hda1 PROFILE=dhcp For a linux entry it is sometimes needed to preload some modules of the kernel. In this case a compressed image disk is used to load in RAM the desired modules and is oftenly called initrd. In this case a third line is to be added to the simplest case described earlier and would look like this: title Linux<br> kernel (hd0,0)/boot/vmlinuz root=/dev/hda1<br>initrd (hd0,0)/boot/initrd.img Booting Other Kernels / Distributions / Operating Systems Via GRUBOther KernelsCreate another entry like the one above (with a different 'title', of course). Other Linux DistributionsInstall ~LiLo to the boot sector of the root partition (not the MBR) of that distribution. Add an entry like the one discussed in the next paragraph to your '/boot/grub/menu.lst' on your Mandrake Linux system. Other Linux Distributions on an USB hard driveIf you want to boot a distribution installed on an USB drive and if the bios of your computer don't allows to boot on USB, one can build a custon initrd image including modules needed to mount partitions of your USB hard drive. This can be done using the program mkinitrd with root privileges and can be done booting in rescue mode using an instalation CD or even from your primary linux distribution. You have to mount the partition containing the root partition of the distribution installed on USB, link the /dev of this partition to the one of your running distribution, then you can chroot the distribution on USB, assuming directory /mnt/hdusb1 already exist, this can be done with root privileges using the following three commandlines: mount /dev/sda1 /mnt/hdusb1<br>mount -o bind /dev /mnt/hdusb1/dev<br>chroot /mnt/hdusb1 In the chrooted environment you can now build the customized initrd, if you intend to use kernel 2.6.8.1-12mdk the full command line would look like this: mkinitrd ––preload=ehci-hcd ––preload=usb-storage ––preload=scsi_mod ––preload=sd_mod /boot/usbinitrd.img 2.6.8.1-12mdk This will create the compressed image disk /boot/usbinitrd.img. You can now exit the chroot environment and copy the initrd image usbinitrd.img and the kernel to the /boot directory of the root partition of your running distribution: cp /mnt/hdusb1/boot/vmlinuz /boot/vmlinuz-usb<br>cp /mnt/hdusb1/boot/usbinitrd.img /boot Assuming that your distribution is installed using two partitions: root partition on the first partition and home on the sixth partition, an entry that would boot this distribution on USB would look like this: title linux_on_USB <br>kernel (hd0,0)/boot/vmlinuz-usb root=/dev/sda1 resume=/dev/sda6<br>initrd (hd0,0)/boot/usbinitrd.img If your computer contains a SATA hard drive, you may have to replace /dev/sda* by /dev/sdb* as /dev/sda will be used by tha SATA drive. Other Operating SystemsAn entry for operating systems like DOS, ~BeOS, Win9x/NT or OS/2 looks a bit different: title Windows<br> rootnoverify (hd0,0)<br> makeactive<br> chainloader +1 rootnoverify (hd0,0) makeactive chainloader +1 Onto floppy(Contributed by Marc Indekeu) The following is a grub install to a floppy for emergency purposes. It's done with grub installed on my MDK 8.1 system and '/mnt/floppy' is the mountpoint for my floppy.
setup (fd0)
info grub Next Item: Other boot loaders, uninstalling Related Resources:info grub Multi-Boot with GRUB mini-HOWTO Revision / Modified: Sept. 19, 2001 / May 14, 2002 Legal: This page is covered by the GNU Free Documentation License . Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft. |