Building a new kernel

Building a new kernel

For most situations, you don't need to be building new kernels. But in case you want to, this section is here to help speed up the process.
This section discusses:

Where to get the kernel source

When you install Linux, you can specify that you want the kernel source installed. Or you can add the kernel source later from either the Red Hat 9 CD or from rpmfind.
Many people recommend downloading latest stable version of Linux kernel sources, rather than using the version shipping with Red Hat, since newer kernels support more hardware, etc. To download the latest version see The Linux Kernel Archives at http://www.kernel.org. The latest stable version is listed first. Then download the kernel source archive by clicking on the F (which stands for Full source):
linux
Then uncompress and extract the kernel source into /usr/src on your system:
cd /usr/src
bzcat linux-2.4.20.tar.bz2 | tar xvf -
Then create a symbolic link:
ln -s linux-2.4.20 linux

How to build a kernel

If this is the first time you're building a kernel on a Red Hat system, it's easiest if you start with Red Hat's kernel sources and with the kernel configuration template that your system was built with: Then you can customize your kernel configuration by typing: After you are finished customizing the kernel, you can build it:

What to do after you build a kernel

Copy the resulting kernel to the /boot directory with any name you'd like for it: If your machine is configured to boot with lilo then edit /etc/lilo.conf, and add a reference to your new kernel. Look at other entries in /etc/lilo.conf to determine what disk shoud be used, etc. Here is a sample of what one might add to /etc/lilo.conf:
image=/boot/mynewkernel
label=mynewlabel
read-only
root=/dev/hda8
Then type:
lilo
If your machine is configured to boot with grub then modify /boot/grub/menu.lst file. Here is an example of what you might add to the /boot/grub/menu.lst file:
title Linux 2.4.20 with all my new configuration
root (hd0,1)
kernel /boot/mynewkernel root=/dev/hda2
That is all (you don't need to run a command after modifying the grub configuration file like you would using LILO).
When you reboot your machine, you will be able to choose to boot the new kernel.

Where to get more information

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章