Configure bootloader

From gr0x0rd
Jump to navigation Jump to search

Installing Gentoo - Configure bootloader

In order to boot into your newly compiled kernel, you'll need to configure a bootloader and install it in the Master Boot Record (MBR) of your primary hard drive. Linux has two mainstream bootloaders: lilo and grub. This example focuses on grub; information on lilo may be added at a later date.

First we'll need to emerge grub.

# emerge -av grub

Once grub has been emerged, you need to create or edit grub.conf, the file that grub uses to load its settings. In the example below, hd0,0 implies the first hard drive detected by your system: mostlikely connected to the first SATA port on your motherboard, or the device designated as master on your first IDE channel in the case of and ATA drive.

/boot/grub/grub.conf

#############################
#
# gr0x0rd's grub.conf
#
#############################

default 0
timeout 5 
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
title=Gentoo Linux
root (hd0,0)
kernel /boot/kernel

You are welcome to change the title and timeout values to whatever you like. The key values in this file are the root (hd0,0), telling grub to look for the kernel and root filesystem on the first hard drive it finds, and the kernel /boot/kernel, which tells it the path of the kernel image file.

Next, we need to create the /etc/mtab file, which lists all mounted filesystems.

# grep -v rootfs /proc/mounts > /etc/mtab

We are now ready to install grub on the master boot record of the primary hard disk. Remember to replace /dev/sda with your hard disk if different.

# grub-install --no-floppy /dev/sda

Now that grub has been installed, we are ready to reboot the system.