Red Hat Linux 7.3: The Official Red Hat Linux Customization Guide | ||
---|---|---|
Prev | Appendix A. Building a Custom Kernel | Next |
Now that you have recompiled your kernel, you must configure the boot loader to boot the new kernel. This is a crucial step. If you do not perform this step or if you perform it incorrectly, you will not be able to boot your system. If this happens, boot your system with the boot diskette you created earlier and try configuring the boot loader again. If your boot diskette does not work, refer to Chapter 3 for more information about rescue mode.
In order to provide a redundant boot source to protect from a possible error in a new kernel, you should keep the original kernel available. During the installation of Red Hat Linux 7.3, you had the option to choose either GRUB or LILO as your boot loader. Refer to the appropriate section that follows.
If you selected GRUB as your boot loader, modify /boot/grub/grub.conf. The default GRUB configuration file looks similar to the following:
# NOTICE: You have a /boot partition. This means that # all kernel paths are relative to /boot/ default=0 timeout=30 splashimage=(hd0,0)/grub/splash.xpm.gz title Red Hat Linux (2.4.18-0.12) root (hd0,0) kernel /vmlinuz-2.4.18-0.12 ro root=/dev/hda3 initrd /initrd-2.4.18-0.12.img |
If you created a separate /boot partition, the paths to the kernel and initrd image are relative to the /boot partition.
To add your new kernel to GRUB, copy the existing title section to a new one and modify it to boot your new kernel image (and initrd image if you have any SCSI devices and have created an initrd image). Be sure the title of the new section is different from the title of the section to boot the old kernel. By default, Red Hat Linux uses Red Hat Linux and the kernel version in parentheses to differentiate between different kernels for GRUB to boot. In our example, the new /boot/grub/grub.conf file would look like the following:
# NOTICE: You have a /boot partition. This means that # all kernel paths are relative to /boot/ default=0 timeout=30 splashimage=(hd0,0)/grub/splash.xpm.gz title Red Hat Linux (2.4.18-0.12-jul2001) root (hd0,0) kernel /vmlinuz-2.4.18-0.12-jul2001 ro root=/dev/hda3 initrd /initrd-2.4.18-0.12-jul2001.img title Red Hat Linux (2.4.18-0.12) root (hd0,0) kernel /vmlinuz-2.4.18-0.12 ro root=/dev/hda3 initrd /initrd-2.4.18-0.12.img |
The default boot entry is set to number 0. To make your new kernel the default, either place its section first or change the default entry number to the appropriate number (remember that it starts counting with 0). For GRUB, you do not need to run any commands after modifying the configuration file.
From now on, when the system boots you will see the following GRUB boot options:
Red Hat Linux (2.4.18-0.12-jul2001) Red Hat Linux (2.4.18-0.12) |
To boot the default kernel, press
You can begin testing your new kernel by rebooting your computer and watching the messages to ensure that your hardware is detected properly.
To configure LILO to boot the new kernel, you need to update the /etc/lilo.conf file and run the command /sbin/lilo -v.
The default /etc/lilo.conf file looks similar to the following:
boot=/dev/hda map=/boot/map install=/boot/boot.b prompt timeout=50 message=/boot/message linear default=linux image=/boot/vmlinuz-2.4.18-0.12 label=linux initrd=initrd-2.4.18-0.12.img read-only root=/dev/hda5 |
To add your new kernel to LILO, copy the existing image section to a new one and modify it to boot your new kernel image (and initrd image if you have any SCSI devices and have created an initrd image). Also, rename the label of the old kernel to something such as linux-old. Your /etc/lilo.conf should look similar to the following:
boot=/dev/hda map=/boot/map install=/boot/boot.b prompt timeout=50 message=/boot/message linear default=linux image=/boot/vmlinuz-2.4.18-0.12-jul2001 label=linux initrd=initrd-2.4.18-0.12-jul2001.img read-only root=/dev/hda5 image=/boot/vmlinuz-2.4.18-0.12 label=linux-old initrd=initrd-2.4.18-0.12.img read-only root=/dev/hda5 |
To activate your changes, run the command /sbin/lilo -v. If all goes well, you will see output similar to the following:
LILO version 21.4-4, Copyright (C) 1992-1998 Werner Almesberger 'lba32' extensions Copyright (C) 1999,2000 John Coffman Reading boot sector from /dev/hda Merging with /boot/boot.b Mapping message file /boot/message Boot image: /boot/vmlinuz-2.4.18-0.12 Added linux * Boot image: /boot/vmlinuz-2.4.18-0.12-jul2001 Added linux-old Writing boot sector. |
Be sure the messages contains Writing boot sector. The * after linux means that the section labeled linux is the default kernel that LILO will boot.
From now on, when the system boots you will see linux and linux-old as LILO boot options.
To boot the new kernel (linux)
simply press
You can begin testing your new kernel by rebooting your computer and watching the messages to ensure your hardware is detected properly.