wiki:TfcPatch

Creating and applying a TFC patch

To port our changes to another version of the linux kernel the following steps are needed:

  1. prepare a TFC patch file
  2. clean this patch file
  3. try to apply it
  4. correct errors and apply it again

How to prepare a TFC patch file

For simplicity, say we are in the directory

...tfcproject/trunk/

First of all, we need a copy of the vanilla kernel sources from kernel.org

wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.16.19.tar.gz
tar xzf linux-2.6.16.19.tar.gz

Second we need a clean copy of the TFC sources, i.e. a copy without the .svn directories. The name of the directory can be anything, but we use linux-2.6.16.19-TFC-r198

svn up linux-2.6.16.19-TFC
svn export linux-2.6.16.19-TFC linux-2.6.16.19-TFC-r198

Now we create the patch file

diff -Naur linux-2.6.16.19 linux-2.6.16.19-TFC-r198 >TFC-r198.patch

Cleaning the patch file

It is worth checking the patch file. If there were changes like printk() lines in the SVN, it is better to remove these from the patch.

Suggested method: use mc (midnight commander) ;) It can open the patch file as a "directory" and easily edit the parts.

Try to apply the patch

download the version of the kernel you want to patch with TFC

wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.......tar.gz
tar xzf linux-2.6.......tar.gz

Now we will apply the patch ... or at least try to. If there are errors during the patch process, these should be corrected by hand (and if possible, the same changes should be done in SVN as well)

cd linux-2.6......
patch -p1 <../patch-TFC-r198.patch | tee ../patch.out

If you don't know tee, "man tee"

Warning: applying a patch twice can have strange results. If something goes wrong and you correct the errors in the patch file, restart from uncompressing the new kernel!

Last modified 11 years ago Last modified on Apr 18, 2007, 6:02:06 PM