Best Practices for Patching the Linux Kernel

Uncategorized — Titus Barik on April 15, 2007 at 2:46 pm

Though there are several methods for upgrading and patching the Linux kernel, the complete technique for doing so is fragmented throughout the kernel documentation. This technical recipe provides a comprehensive and uniform solution, using the included patch-kernel script.

To successfully utilize this technique, you should always start with a base kernel, for example, kernel version 2.6.x, rather than the point release kernel, 2.6.x.y. For specifics on why this is the case, see Documentation/applying-patches.txt under the kernel source folder. In this example, I use linux-2.6.20.tar.bz2 as the base kernel (extracted to /usr/src/linux-2.6.20), and patch patch-2.6.20.7.tar.bz2 (placed under /usr/src) to illustrate.

To upgrade from 2.6.20 to 2.6.20.7, simply type the following:

cd /usr/src/linux-2.6.20
scripts/patch-kernel . .. 2.6.20.6
cd ..
mv linux-2.6.20 linux-2.6.20.7

If successful, your output will appear shortly:

Current kernel version is 2.6.20 (Homicidal Dwarf Hamster)
Applying patch-2.6.20.7 (bzip2)... done.

For convenience, I also symbolically link /usr/src/linux to /usr/src/linux-2.6.20.7:

ln -s /usr/src/linux-2.6.20.7 /usr/src/linux

From here, you can proceed to compile the updated kernel source using the provided documentation.

0 Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WP Hashcash

titus@barik.net | The Weblog of Titus Barik