| 1 |
This file tries to document how the `mkpatch' program works. |
|---|
| 2 |
The file in copyright (c) 1999 by Frodo Looijaard |
|---|
| 3 |
|
|---|
| 4 |
mkpatch compares the newest I2C sources with what is found in a kernel, |
|---|
| 5 |
and generates a set of diffs. These diffs can be amplied to that kernel, |
|---|
| 6 |
after which the kernel is synchronised with the current I2C sources. |
|---|
| 7 |
|
|---|
| 8 |
mkpatch needs two arguments. The first is the root of the I2C package, |
|---|
| 9 |
the second is the root of Linux kernel tree. For example: |
|---|
| 10 |
cd /tmp/i2c-1.0.0 |
|---|
| 11 |
mkpatch/mkpatch . /usr/src/linux |
|---|
| 12 |
The patch file is written to stdout; any errors are written to stderr. |
|---|
| 13 |
So you will want to capture the output: |
|---|
| 14 |
mkpatch/mkpatch . /usr/src/linux > /tmp/i2c-diffs |
|---|
| 15 |
Later on, you will want to apply the diffs: |
|---|
| 16 |
cd /usr/src/linuc |
|---|
| 17 |
patch -p1 -E < /tmp/i2c-diffs |
|---|
| 18 |
Of course, this can be combined: |
|---|
| 19 |
mkpatch/mkpatch . /usr/src/linux | patch -d /usr/src/linux -p1 -E |
|---|
| 20 |
|
|---|
| 21 |
mkpatch uses several files in the mkpatch subdirectory. The location of |
|---|
| 22 |
these files is hardcoded in the program, but all other files used are |
|---|
| 23 |
specified in these files, and can easily be changed. Used files are: |
|---|
| 24 |
FILES |
|---|
| 25 |
a list of files that will be considered by mkpatch. Each line contains |
|---|
| 26 |
two filenames, separated by whitespace. The first is the name and |
|---|
| 27 |
location (relative to the I2C package root) of the I2C file, the |
|---|
| 28 |
second is the name and location (relative to the kernel root) of |
|---|
| 29 |
the kernel file. A diff will be created between these two files. |
|---|
| 30 |
INCLUDES |
|---|
| 31 |
A list of include file changes. Each line contains two strings that |
|---|
| 32 |
can be found after a `#include' statement. All occurences of the |
|---|
| 33 |
first string will be changed to the second, for all I2C files in |
|---|
| 34 |
FILES, before the normal diff is generated. This allow us to use |
|---|
| 35 |
`#include "i2c.h"' when compiling in the package tree, and |
|---|
| 36 |
`#include <linux/i2c.h>' in the kernel tree. |
|---|
| 37 |
OLDI2C |
|---|
| 38 |
The generated kernel diffs will rename the old I2C header file to |
|---|
| 39 |
`i2c-old'. In the files specified in this file, `#include' statements |
|---|
| 40 |
will be changed accordingly. |
|---|
| 41 |
Makefile, Config.in |
|---|
| 42 |
These files are new and will be copied to the appropriate place as |
|---|
| 43 |
specified in FILES. |
|---|
| 44 |
|
|---|
| 45 |
mkpatch does several things: |
|---|
| 46 |
* It generates diffs to change `#include <linux/i2c.h>' to |
|---|
| 47 |
`#include <linux/i2c-old.h>' for files mentioned in OLDI2C |
|---|
| 48 |
* For each file pair as specified in FILES, it creates a diff between |
|---|
| 49 |
them, but before that is done, it changes `#include' lines in the |
|---|
| 50 |
I2C file as specified in INCLUDES, and it takes care of |
|---|
| 51 |
lm_sensors changes. |
|---|
| 52 |
* It handles several special files, that have to be scanned explicitly |
|---|
| 53 |
to generate diffs to for them |
|---|
| 54 |
|
|---|
| 55 |
The generated diffs have specific headers. It will seem as if the old |
|---|
| 56 |
kernel was contained in the `linux-old' directory, and the new patched |
|---|
| 57 |
kernel in the `linux' directory, regardless of where the kernel was |
|---|
| 58 |
actually located. |
|---|
| 59 |
|
|---|
| 60 |
Most intricate are the special files that are handled. These special |
|---|
| 61 |
files were already present in the kernel, but had to be patched. Because |
|---|
| 62 |
they can change between kernel versions, I had to scan them by hand to |
|---|
| 63 |
find where the new code should be inserted. Each file has documented |
|---|
| 64 |
what actually happens. |
|---|
| 65 |
|
|---|
| 66 |
Sometimes, a new file is inserted in the kernel tree by the I2C package, |
|---|
| 67 |
and it needs to be patched by the lm_sensors package. In that case, the |
|---|
| 68 |
part that is patched by the lm_sensors package is specifically marked. |
|---|
| 69 |
If not, the I2C package would back out the lm_sensors changes! |
|---|
| 70 |
The markers are: |
|---|
| 71 |
sensors code starts here |
|---|
| 72 |
sensors code ends here |
|---|
| 73 |
They may be anywhere on a line, and must always occur in pairs. |
|---|
| 74 |
More than one pair may be present. |
|---|