5.3. Modifying the Bootloader for the New KernelThere are two common Linux kernel bootloaders: GRUB and LILO. GRUB is the one more commonly used in modern distributions, and does some things a little more easily than LILO, but LILO is still seen as well. We'll cover both in this section. To determine which bootloader your system uses, look in the /boot/ directory. If there is a grub subdirectory: $ ls -F /boot | grep grub grub/ then you are using the GRUB program to boot with. If this directory is not present, look for the presence of the /etc/lilo.conf file: $ ls /etc/lilo.conf /etc/lilo.conf If this is present, you are using the LILO program to boot with. The steps involved in adding a new kernel to each of these programs are different, so follow only the section that corresponds to the program you are using. 5.3.1. GRUBTo let GRUB know that a new kernel is present, all you need to do is modify the /boot/grub/menu.lst file. For full details on the structure of this file, and all of the different options available, please see the GRUB info pages: $ info grub The easiest way to add a new kernel entry to the /boot/grub/menu.lst file is to copy an existing entry. For example, consider the following menu.lst file from a Gentoo system: timeout 300 default 0 splashimage=(hd0,0)/grub/splash.xpm.gz title 2.6.16.11 root (hd0,0) kernel /bzImage-2.6.16.11 root=/dev/sda2 vga=0x0305 title 2.6.16 root (hd0,0) kernel /bzImage-2.6.16 root=/dev/sda2 vga=0x0305 The line starting with the word title defines a new kernel entry, so this file contains two entries. Simply copy one block of lines beginning with the title line, such as: title 2.6.16.11 root (hd0,0) kernel /bzImage-2.6.16.11 root=/dev/sda2 vga=0x0305 Then, add the block to the end of the file, and edit the version number to contain the version number of the new kernel you just installed. The title does not matter, so long as it is unique, but it is displayed in the boot menu, so you should make it something meaningful. In our example, we installed the 2.6.17.11 kernel, so the final copy of the file looks like: timeout 300 default 0 splashimage=(hd0,0)/grub/splash.xpm.gz title 2.6.16.11 root (hd0,0) kernel /bzImage-2.6.16.11 root=/dev/sda2 vga=0x0305 title 2.6.16 root (hd0,0) kernel /bzImage-2.6.16 root=/dev/sda2 vga=0x0305 title 2.6.17.11 root (hd0,0) kernel /bzImage-2.6.17.11 root=/dev/sda2 vga=0x0305 After you save the file, reboot the system and ensure that the new kernel image's title comes up in the boot menu. Use the down arrow to highlight the new kernel version, and press Enter to boot the new kernel image. 5.3.2. LILOTo let LILO know that a new kernel is present, you must modify the /etc/lilo.conf configuration file and then run the lilo command to apply the changes made to the configuration file. For full details on the structure of the LILO configuration file, please see the LILO manpage: $ man lilo The easiest way to add a new kernel entry to the /etc/lilo.conf file is to copy an existing entry. For example, consider the following LILO configuration file from a Gentoo system: boot=/dev/hda prompt timeout=50 default=2.6.12 image=/boot/bzImage-2.6.15 label=2.6.15 read-only root=/dev/hda2 image=/boot/bzImage-2.6.12 label=2.6.12 read-only root=/dev/hda2 The line starting with the word image= defines a new kernel entry, so this file contains two entries. Simply copy one block of lines beginning with image=, such as: image=/boot/bzImage-2.6.15 label=2.6.15 read-only root=/dev/hda2 Then, add the block to the end of the file, and edit the version number to contain the version number of the new kernel you just installed. The label does not matter, so long as it is unique, but it is displayed in the boot menu, so you should make it something meaningful. In our example, we installed the 2.6.17.11 kernel, so the final copy of the file looks like: boot=/dev/hda prompt timeout=50 default=2.6.12 image=/boot/bzImage-2.6.15 label=2.6.15 read-only root=/dev/hda2 image=/boot/bzImage-2.6.12 label=2.6.12 read-only root=/dev/hda2 image=/boot/bzImage-2.6.17 label=2.6.17 read-only root=/dev/hda2 After you save the file, run the /sbin/lilo program to write the configuration changes out to the boot section of the disk: # /sbin/lilo Now the system can be safely rebooted. The new kernel choice can be seen in the list of kernels that are available at boot time. Use the down arrow to highlight the new kernel version, and press Enter to boot the new kernel image. |