Saturday, June 20, 2009

get and patch linux kernel

these instructions are very useful

Get and patch the Linux kernel

To get an experimental Linux4SAM kernel up and running on an AT91 product, you have to go through the following steps:

    1. identify on which linux kernel revision the experimental patches will apply
    2. download the corresponding Linux kernel

    3. download the AT91 Maintainer's patch and apply it
wget http://maxim.org.za/AT91RM9200/2.6/2.6.xx-at91.patch.gz
zcat 2.6.xx-at91.patch.gz | patch -p1
    4. take the experimental patchset and apply it on top of the AT91 one
wget ftp://www.linux4sam.org/pub/linux/2.6.xx-at91-exp.patch.gz
or
wget ftp://www.linux4sam.org/pub/linux/2.6.xx.at91.y/2.6.xx.at91.y-exp.patch.gz
And then :
zcat linux-2.6.xx-at91-exp.diff.gz | patch -p1

You will now have an updated copy of the experimental Linux4SAM kernel.

----------------------------

there is a question : how to create patch from a version management tool ?

Create the patch.

patch -uN patchtest.txt patchtest1.txt > patch.txt

we can apply it.
patch patchtest.txt < patch.txt

Creating a Patch File:

diff -Naur olddir newdir > new-patch
- or -
diff -Naur oldfile newfile >new-patch

Using the Patch Command:

patch -p0 <new-patch
patch -p1 <new-patch

Which one of the above patch commands you use depends on your current working directory.

Other Methods for calling the patch command - using standard input of patch:

cat new-patch | patch -p0

Levels in the Patch Command (-p0 or -p1?):

The -p option will optionally strip off directory levels from the patchfile. For Ex: if you have a patchfile with a header as such:
--- old/modules/pcitable	Mon Sep 27 11:03:56 1999
+++ new/modules/pcitable Tue Dec 19 20:05:41 2000
Using a -p0 will expect, from your current working directory, to find a subdirectory called "new", then "modules" below that, then the "pcitable" file below that.

Using a -p1 will strip off the 1st level from the path and will expect to find (from your current working directory) a directory called "modules", then a file called "pcitable". Patch will ignore the "new" directory mentioned in the header of the patchfile.

Using a -p2 will strip of the first two levels from the path. Patch will expect to find "pcitable" in the current working directory. Patch will ignore the "new" and "modules" directories mentioned in the header of the patchfile.

here is a instruction in detail
http://lab.ac.uab.edu/node/1153

No comments: