summaryrefslogtreecommitdiff
path: root/doc/mkpatch
blob: 22c88525c38037e31afdce11dbdf56e3a64cc7c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
This file documents how the `mkpatch' program works.
------------------------------------------------------------

QUICKSTART
----------
	mkpatch/mkpatch.pl . /usr/src/linux > /tmp/patch
	cd /usr/src/linux
	patch -p1 < /tmp/patch


USAGE
-----

mkpatch compares the newest lm_sensors sources with what is found in a kernel,
and generates a set of diffs. These diffs can be applied to that kernel,
after which the kernel is synchronized with the current lm_sensors sources.

You should generally run mkpatch against a kernel tree that has been patched
with the newest I2C sources. Check the lm_sensors "Download" page for
information on dependencies between lm_sensors and i2c versions.

mkpatch needs two arguments. The first is the root of the lm_sensors package,
the second is the root of Linux kernel tree. For example:
  cd /tmp/lm_sensors-2.4.0
  mkpatch/mkpatch . /usr/src/linux

The patch file is written to stdout; any errors are written to stderr.
So you will want to capture the output:
  mkpatch/mkpatch . /usr/src/linux > /tmp/lm_sensors-diffs

Later on, you will want to apply the diffs:
  cd /usr/src/linux
  patch -p1 -E < /tmp/lm_sensors-diffs

Of course, this can be combined:
  mkpatch/mkpatch . /usr/src/linux | patch -d /usr/src/linux -p1 -E


IMPLEMENTATION DETAILS
----------------------

mkpatch uses several files in the mkpatch subdirectory. The location of
these files is hardcoded in the program, but all other files used are
specified in these files, and can easily be changed. Used files are:
  FILES
    A list of files that will be considered by mkpatch. Each line contains
    two filenames, separated by whitespace. The first is the name and
    location (relative to the lm_sensors package root) of the lm_sensors 
    file, the second is the name and location (relative to the kernel root) of 
    the kernel file. A diff will be created between these two files.
  INCLUDES
    A list of include file changes. Each line contains two strings that
    can be found after a `#include' statement. All occurences of the
    first string will be changed to the second, for all lm_sensors files in 
    FILES, before the normal diff is generated. This allow us to use
    `#include "sensors.h"' when compiling in the package tree, and
    `#include <linux/sensors.h>' in the kernel tree.
  Makefile, Config.in
    These files are new and will be copied to the appropriate place as
    specified in FILES.

mkpatch does several things:
  * For each file pair as specified in FILES, it creates a diff between
    them, but before that is done, it changes `#include' lines in the
    lm_sensors file as specified in INCLUDES
  * It handles several special files, that have to be scanned explicitely
    to generate diffs to for them

The generated diffs have specific headers. It will seem as if the old
kernel was contained in the `linux-old' directory, and the new patched
kernel in the `linux' directory, regardless of where the kernel was
actually located.

Most intricate are the special files that are handled. These special
files were already present in the kernel, but had to be patched. Because
they can change between kernel versions, I had to scan them by hand to
find where the new code should be inserted. Each file has documented
what actually happens.


------------
This file is Copyright (c) 1999 by Frodo Looijaard