Configure bootloader
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.
# nano -w /boot/grub/grub.conf
/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
Optional: RAID
If you are using RAID, you'll need to install grub onto the master boot record on each of the disks in your array.
grub --no-floppy
This should bring you to a grub prompt. First, be sure your disks are recognized. If they aren't, chances are you didn't include the --metadata=0.9 flag when creating your arrays.
grub> find /boot/grub/stage1 (hd0,0) (hd1,0) (hd2,0) (hd3,0) grub>
Install grub on each of the disks.
device (hd0) /dev/sda root (hd0,0) setup (hd0) ... device (hd0) /dev/sdb root (hd0,0) setup (hd0) ... device (hd0) /dev/sdc root (hd0,0) setup (hd0) ... device (hd0) /dev/sdd root (hd0,0) setup (hd0)
You'll also need to append some additional data to the kernel directive in your grub.conf.
... root (hd0,0) kernel /kernel md=3,/dev/sda3,/dev/sdb3,/dev/sdc3,/dev/sdd3 root=/dev/md3 ...
Now that grub has been installed, we are ready to reboot the system.