![]() |
PATCHING
REVISED October 2001
Mike Andrew / David Bandel
Patching a kernel refers to upgrading to the latest 'n greatest by small increments.
Rather than downloading a 25 meg source, it is
possible, indeed desirable from your point of view, to simply
apply the changes in source code that occur between revisions.
These changes can be as little as half a megabyte. A
considerable saving in download time.
First and foremost the kernel source you upgrade must be 'pristine'. It means that at some time previous, you have obtained a pristine kernel source from www.kernel.org or one of it's mirrors. Redhat distribution source code is NOT pristine (nor is any other distro). You must work from pristine source, or, have the ability to reverse patch what ever changes a distributor made. If this is the case for you, bite the bullet, download a pristine kernel, and use these steps for ever more.
"pristine source" is exactly that. Unmodified source code. It does not apply to the compiled binaries or any extraneous additions that may be present in the directory. Thus, you can safely compile pristine source, create and boot the kernel image derived from it, and regardless of all the now extra bits 'in there' , it is still, pristine source. This means you can conveniently port your current kernel configuration into the new kernel, without problems. It is not, "source code".
The steps required for patching a kernel are exceptionally easy.
Now be warned. One slip, one typo on
your part, can devastate the source you have. Read every step
carefully.
The examples used assume pristine kernel source
2.4.10 located in
/usr/src/linux-2.4.10
and the symlink
/usr/src/linux pointing to
it.
One: Obtain the patch.
The patch you require is one more than your current pristine kernel.
download patch-2.4.11.bz2 from www.kernel.org
place this patch file into /usr/src
repeat this step for each patch above 2.4.11
Two: Prepare a new linux folder.
Type the following
cd (space) /usr/src
cp (space) -r (space) linux-2.4.10 (space) linux-2.4.11
rm (space) linux
ln (space) -s (space) linux-2.4.11 (space)
linux
Five: iterative
You are now ready to complle kernel 2.4.11
You do so in the normal manner (see kernel->compile on this site)
If however you have a series of patches (say up to 2.4.99) simply iterate thru steps two to four before compiling. Remember that the criteria is to change the symbolic link, thus, the second iteration would be
cp (space) -r (space) linux-2.4.11
(space) linux-2.4. 12
rm (space) linux
ln (space) -s (space) linux-2.4.12 (space)
linux
and as each patch succeeds
rm linux-2.4.11
Naturally, in the examples above, you
would NEVER
rm linux-2.4.10
2.4.10 (in this example) is your lifeline. You can always
revert and start over if things went seriously awol.
Addenda:
To back a patch out, simply add the -R (reverse) switch:
bzcat patch-2.4.xx | patch -p0 -R
One more Addenda:
Enjoy!