RHCE2B.COM Kernel Recompilation Study GuideReferencesSteve's RHCE ® Study Guide Section on KernelsRed Hat's ® Configuration Guide section on Recompiling the Kernel
Why Recompile the Kernel?You may need to recompile the kernel in order to support new hardware. You also may wish to optomize your kernel for a particular purpose.
What You need to beginYou will need the source code for the kernel. Make sure you install both the headers and the source.
rpm -ivh binutils*.rpm Note: Red-Hat's kernel source is slightly different than the code you will find at kernel.org. Unless you have some compelling reason not to, you should use Red Hat's version. Building the Kernelcd /usr/src/linux-2.4If you check, linux-2.4 should be a symbolic link to the newest version of the kernel source code. For example, on my machine, it it a link to linux-2.4.9-31. make mrproper This command gets rid of anything that may have been left over from pevious builds of the kernel.
Now you have a choice of configuration programs to use.
I usually start with make "old config" and then do a "make xconfig". What should I change when configuring the Kernel?Under "Processor Type and Features", you wil find the "Processor Family" menu. By selecting the correct processor for your machine, you can optomize the kernel for your machine. Under "File Systems", make sure to enable any file systems that you want recognized. For example, on a dual-boot machine, you may wish to enable NTFS. There are a lot of possabilities here. Look around.What do I do after configuring the Kernel?make depthis sets up all the dependencies correctly make clean This cleans up the source directory.
Setting up the EXTRAVERSION flagEdit the Makefile. You will find a line that says something like this:EXTRAVERSION = -31 Change it to read something like this: EXTRAVERSION = -31-randy This will be the name for our new kernel. If you named the kernel exactly the same thing as the kernel you currently boot up with, you would risk screwing up your current configuration. Hence you should name it something unique.
Building the Kernelmake bzImageThis builds the actual kernel. It is found in /usr/src/linux-2.4/arch/i386/boot/bzImage make modules This creates all the Kernel modules make modules_install This installs the modules. MkinitrdIf you want to boot from a SCSI adapter, and you have SCSI in a module, then you need to make a new initrd file for your kernel.mkinitrd 2.4.9-31-randy How do I install the Kernel?cp /usr/src/linux-2.4/arch/i386/boot/bzImage /boot/vmlinuz-2.4.9-31-randyIf you are using GRUB, add the following lines:
title Red Hat Linux (2.4.9-31-randy) root (hd0,1) kernel /vmlinuz-2.4.9-31-randy ro root=/dev/hda6 initrd /initrd-2.4.9-31-randy.img If you have LILO, then add the following lines, substituting the correct value for you root partition: image=/boot/vmlinuz-2.4.9-31-randy label=linux-2.4.9-31-randy initrd=/boot/initrd-2.4.9-31-randy.img read-only root=/dev/hda6 Take Quiz on Kernel Recompilation
![]() ![]() ![]() RHCE2B.COM Home Page RHCE2B.COM Practice Test for the RHCE exam This site is not authorized or reviewed by Red Hat, Inc. Legal stuff |
|