Wednesday, January 20, 2010

LinuxHQ: How to apply patches

LinuxHQ: How to apply patches
How to Apply Kernel Patches
With each new kernel release, there is a corresponding 'patch' The simplest way to patch your kernel is to follow the directions in the Kernel HOWTO - Patching your kernel.
How to Apply the Unofficial Kernel Patches
Patches are easy to apply, once you understand a few simple concepts:

* Patches are usually for a specific version of the kernel. This means old patches may not work with newer kernels.
* Patches are generally built from 'clean' unpatched kernel sources. So, one patch may make a change that causes other patches to fail.
* Patches are not part of the released kernel tree, thus do not be suprised it they don't work. Always keep a backup of your original kernel source!

Now, on to applying the patches. Normally all you need to do is simply issue the following command:

patch -p0 < patch-file-name-here

This should be done from the /usr/src directory.

Sometimes, the patch authors do not include the full path to the files that are being patched, in this case you will need to change to the directory that contains the file. Simply look at the patch file, in the first few lines you should see something like this:

--- drivres/block/rd.c.orig Tue Jul 2 17:08:41 1996
+++ drivres/block/rd.c Mon Sep 30 19:24:06 1996

This tells you that the file being patched is drivers/block/rd.c and the relative path from the /usr/src/ directory is included. But if you see something like this:

--- isdn_common.c~ Fri Nov 22 21:33:10 1996
+++ isdn_common.c Mon Mar 31 01:46:57 1997

This tells you that you will need to find the file isdn_common.c and change to the directory containing this file before you apply the patch.


From: http://www.linuxhq.com/patch-howto.html

No comments:

Post a Comment

Google+