Você está na página 1de 3

Configuring the Boot Loader

http://www.centos.org/docs/2/rhl-cg-en-7.2/buildkernel-bootloader.html

Prev

Red Hat Linux 7.2: The Official Red Hat Linux Customization Guide Appendix A. Building a Custom Kernel

Next

Configuring the Boot Loader


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.2, you had the option to choose either LILO or GRUB as your boot loader. Refer to the appropriate section that follows.

GRUB
If you selected GRUB as your boot loader, you need to modify the file /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.7-3) root (hd0,0) kernel /vmlinuz-2.4.7-3 ro root=/dev/hda3 initrd /initrd-2.4.7-3.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.7-3-jul2001) root (hd0,0) kernel /vmlinuz-2.4.7-3-jul2001 ro root=/dev/hda3 initrd /initrd-2.4.7-3-jul2001.img title Red Hat Linux (2.4.7-3) root (hd0,0)

1 of 3

21-08-2013 17:54

Configuring the Boot Loader

http://www.centos.org/docs/2/rhl-cg-en-7.2/buildkernel-bootloader.html

kernel /vmlinuz-2.4.7-3 ro root=/dev/hda3 initrd /initrd-2.4.7-3.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 Red Hat Linux (2.4.7-3-jul2001) and Red Hat Linux (2.4.7-3) as GRUB boot options. To boot the default kernel, press [Enter] or wait for it to time out. If you want to boot the old kernel, select it and press [Enter]. You can begin testing your new kernel by rebooting your computer and watching the messages to ensure your hardware is detected properly.

LILO
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.7-3 label=linux initrd=initrd-2.4.7-3.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.7-3-jul2001 label=linux initrd=initrd-2.4.7-3-jul2001.img read-only root=/dev/hda5 image=/boot/vmlinuz-2.4.7-3

2 of 3

21-08-2013 17:54

Configuring the Boot Loader

http://www.centos.org/docs/2/rhl-cg-en-7.2/buildkernel-bootloader.html

label=linux-old initrd=initrd-2.4.7-3.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.7-3 Added linux * Boot image: /boot/vmlinuz-2.4.7-3-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 [Enter], or wait for LILO to time out. If you want to boot the old kernel (linux-old), select linux-old and press [Enter]. You can begin testing your new kernel by rebooting your computer and watching the messages to ensure your hardware is detected properly. Prev Making an initrd Image Home Up Next Building a Monolithic Kernel

3 of 3

21-08-2013 17:54

Você também pode gostar