The Linux* kernel is a complex program which provides the underlying services to the rest of a Linux distribution. But it is easy to add new features or improvements to it.
It is common practice with a Linux based operating system to recompile the kernel from. One of the reasons that you would do this is to optimize the kernel for a particular processor such as the Pentium 4 processor so that it can utilize features that would normally not use, resulting in faster performance. Other reasons is to add support for certain hardware devices. Note: To get the most out of the Intel Pentium processor, you should use the 2.4 kernel or higher.
There are four basic steps to rebuild the kernel:
- Configure the kernel
- Compile the kernel
- Install the kernel
- Reconfigure the lilo.conf file and execute lilo
Configure the kernel
- Change into the kernel version directory where version represents the version of the Linux kernel.
- Run one of the Linux Kernel Configuration Tools:
- make xconfig (X Window based)
- make menuconfig (Menu based)
- make config (text based)
- Select Processor type and features. If you are using version 2.4 of the kernel, select the Pentium® 4 processor. Exit and save the changes Note: the kernel has many, many options. You have to reconfigure and recompile the kernel to enable certain hardware and to enable certain features
When you compile the kernel, you are converting a high-level language such as C language to machine language that can be understood by the processor. In Linux, this is know as a binary. To compile the kernel, you would do the following:
These can be combined into a single command:
make dep;make clean;make bzImage;make modules
The make bzImage is the actual compiling of the kernel.
Next, you have to copy the appropriate files so that Linux can boot from the new kernel:
cp /usr/src/kernelversion/arch/i386/boot/bzImage /boot/vmlinuz-kernelversion
cp /usr/src/kernelversion/System.map /boot/System.map-kernelversion
- After the kernel is installed, you will need to install the modules by executing the following command:
The /etc/lilo.conf file is a text file provides the boot menu and tells which kernel to boot from. Assuming that the kernel images are in /dev/hda1 (first hard drive, first partition), you would insert the following lines in the /etc/lilo.conf file:
To make the new kernel boot by default, make sure to change the default line to:
Execute the following command at a command prompt:
Make sure there are no errors that appear
- Reboot system
This applies to: