Kernel Compile

Decompressing and Using Patches


Kernel patches, like the sources, come in four flavors:

  1. .gz
  2. signed .gz
  3. .bz2
  4. signed .bz2
Before applying a patch, you should backup your kernel sources:
tar czvf linux-old.tar.gz linux-#.#.##
Where #'s represent your kernel version number. If you only see a directory called linux then you can leave out the version number if you like.

REMEMBER: Patches must be applied in incremental order. That is, if you are using kernel 2.2.15, you must apply patch 16 before applying patch 17!!! Also, do not attempt to patch the kernel shipped with your distrobution unless you are absolutely sure the kernel was not altered in any way by the manufacturers of your distribution!


Download the patch and copy it to your /usr/src directory. Move to this directory and execute the one of the following:

Where #'s represent the patch version. Alternately, you could decompress the file then, as a second step, apply the patch:
patch -p0 < patch##
Again, #'s represent the patch version.
You can now move on to configuring the patched kernel. For simplicity sake, you may want to consider running:
make oldconfig
This will build the new kernel based on your old kernels configuration and only prompt you for any new additions to the kernel. See put link herefor more information.

In the kernel sources directory this is a directory called scripts which has a script to automate patching the kernel. The script is called:

patch-kernel
The script will patch the kernel with a number of scripts that are located in the directory you tell the script to look in. This makes it much easier to apply numerous patches at one time. The syntax for the script is thus:
/usr/src/linux/scripts/patch-kernel sourcedir patchdir
where:
sourcedir     is the location of your kernel sources (default= /usr/src/linux)

patchdir     is the location of your patches (default= current directory)

<- Back (Decompress)    TOC    Next (xconfig) ->