Kernel Patching in Linux

June 1, 2006

Patching the Kernel

Normal patching produre:

tar xjf linux-2.6.11.tar.bz2
cd linux-2.6.11
patch -p1 < ../path_to_patch

Then config & compile as normal.

Are you sure the patch file is a tar.bz2 and not just a .bz2? You’ll
likely have to uncompress the patch file, since I don’t know if GNU
patch decompresses automatically…

The “-p1” option tells “patch” to ignore the text before the first /
in paths mentioned in the patch. You need to do this because the first
path component will be the directory the patch author was keeping his
kernel in, which is not relevant.

another shortcut is to do something like this:

bzcat patch.bz2 | patch -p1


tar -jxvf patch.bz2 | patch -p1

This works the same as the earlier post, assuming you are using a bz2
zipped patch. If you are using one that is gzipped, you can use gzcat,
or tar -zxvf . You can look at the man page for tar to see what those
flags do. With either of those you are just piping the output of the
first command (patches are plain text, usually compressed in some way,
but not always), to ths second command.


the information for patching the kernel and all the other install stuff
can be found in the file README.INSTALL. Basically, for patching the
kernel, you cd to your kernel source directory (something like
/usr/src/linux or /usr/src/linux-2.4.18) and enter

patch -p1 < /path/to/patchfile

No output means success here, as usual. Then you do the usual steps to
configure/make/install your kernel.

One comment

  1. your block of character is outstanding!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: