Easy guide to Kernel Compilation.
Download the lastest Kernel for your architecture (usually i386 that's
for 386, 486, Pentium, K6, K7 family processors) from www.kernel.org
or from a mirror. The file name must be like: linux-2.4.8.tar.gz that means:
linux kernel version 2.4.8 in tar.gz compressed format.
Remember that some of this steps needs you to be root ( login as root) or type su and enter the root password.
Now it's time to copy it to /usr/src
cp /home/user/linux-2.4.8.tar.gz /usr/src
tar -zxvf linux-2.4.8.tar.gz
This will extract it to /usr/src/linux
We'll rename the file to keep it to be cleaner
mv linux linux-2.4.8
Creates a soft link from linux to linux-2.4.8 (doing it allows us to keep all kernels source here)
ln -s /usr/src/linux-2.4.8 /usr/src/linux
Now its time to remove some files with:
The next step is to select the kernel options that you need for your computer, if it's your first time doing it read carefully the help for each option that you select. You'll expend some time here, I'll not show you what to select or not because this document is only a easy guide, look for the kernel-howto over internet for more info.
There are three options:
If you are on X window mode (graphical) choose make xconfig, else I could suggest you to use make menuconfig because the menu let's you choose options easily. make config is not user friendly. IMHO make menuconfig will work nice.
Once all the options selected we'll Save it on a file, lets call it optionskernel-2.4.8 then SAVE AND EXIT
Create the dependencies with the new modules
Remove the old configuration files
Compress the kernel that we have been working on
If it says that the cache is too much small, must type: make zImage
Make the modules we choosed
Generate all the directories and install the new modules
Copy the 2 new files to /boot
cp /usr/src/linux/System.map /boot/System.map-2.4.8
cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinux-2.4.8
Delete the link:
and create a new one
ln -s /boot/System.map-2.4.8 /boot/System.map
The last step is to modify lilo using your favorite text editor
The best thing to do is copy and paste your last lilo block and modify it. In our example, we well add:
Save the file and quit the editor (Ctrl-X,Ctrl-S and Ctrl-X,Ctrl-C). Then type:
To save the changes. Now you can reboot.
At boot time, you could choose your old kernel or the new compiled one. Don't worry, because if you choose wrong options, always can boot with the old one.