Objective 3: Patching a Kernel
When you start patching and customizing kernels, it becomes vital to make it obvious which source tree contains which patches and exactly what special functionality is in the currently running kernel. You should use directory names and other means to actively indicate these things.
Applying the Patch
Once your desired patch has been located and fetched, you can start building a new kernel with it. In the following example, you will install a new kernel patch to take your kernel from 2.4.23 to 2.4.24. After fetching it, a good place to store it is /usr/src/patch-2.4.24.bz2.
Copy your unpatched source tree to a tree that you're going to patch. Choose a target directory name that reflects the capabilities of the patched kernel. If this is going to be a symmetric multiprocessing (SMP) kernel, linux-2.4.24-SMP might be most appropriate:
cp -a linux-2.4.23 linux-2.4.24-SMP
Inspect your patch, using bzmore for a bz2 file, to see what path it operates on. This one starts modifying linux-2.4.24/Makefile. The directory name does not match the one you've chosen earlier, and this must be corrected in the next two steps. The top of the patch file is shown here:
diff -urN linux-2.4.23/Makefile linux-2.4.24/Makefile--- linux-2.4.23/Makefile 2003-11-28 10:26:21.000000000 -0800 +++ linux-2.4.24/Makefile 2004-01-05 05:53:56.000000000 -0800 @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 4
Change to the top-level of the source tree:
Apply the patch:
bzip2 -dc ...