Patching The Kernel

Submitted by abhishek on Sun, 08/03/2008 - 01:04

Is Patching a Good Idea?

 
In most of the recent Linux distros available today we find Kernel Version 2.6.9+ which by itself supports all latest devices, but still there might me some improvements done to the installed kernel first option is to download the latest kernel available from http://www.kernel.org which would require a download of 40+Mbs or the other option is to patch your existing kernel.
 
90-95% of the kernal source remains the same and downloading the entire source for this 5-10% is never a good idea. For this reason, kernel patches are released Kernel patches contain only the files that have changed since the last kernel, hence making it less pain to upgrade.
 
Steps for applying a patch
 
Step 1 ) Take Backup of the existing kernel Source (/usr/src/linux2.6.24 in my case)
 
Step 2 ) Download the patch from http://www.kernel.org
 
remember if you want to upgrade your kernel to 2.6.26 from 2.6.24 you require 2 patches i.e. 2.6.25 and 2.6.26 patching a step by step process, you cant jump.
 
The current stable version of kernel is 2.6.26
& the patch available is 2.6.26.1
 
Step 3) un-zip the patch file into the kernel sorce directory
 
# tar -xvf patch-2.6.25.tar
# tar -xvf patch-2.6.26.tar
 
# mv patch-2.6.* /usr/src/linux2.6.24
 
Step 4) Change to Source Directory and apply patch
 
# cd /usr/srclinux2.6.24
# patch -p1 < patch-2.6.25
# patch -p1 < patch-2.6.26
 
for more info on patch command use man patch
 
this command will provide lot of output just have a look at it,
patch command uses diff in background and changes approprate parts of the source.
 
After these steps are done you need to recompile the kernal using the same process as discussed in my blog earlier