root/i2c/trunk/INSTALL @ 3376

Revision 3376, 9.9 KB (checked in by frodo, 14 years ago)

Added entry in INSTALL about dependency file warnings when compiling

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1These are the installation instruction for the i2c package.
2
3There are three ways in which you can compile and install this package. Each
4has its own strong points. They are:
5 1. Complete separate from kernel compilation
6    This will generate a set of modules which can be inserted and removed
7    as needed; nothing will be written into the kernel tree;
8 2. Semi-integrated into the kernel
9    This will add some files to your kernel tree, but has the advantage
10    that module symbols are supported; the end result is functionally very
11    like the previous way;
12 3. Patching of the kernel
13    This will patch your kernel source tree. You must recompile your kernel
14    to take advantage of this. But it makes it possible to compile drivers
15    into the kernel itself, instead of having to add them as modules.
16
17Each of these ways will be described below in detail. We recommend using
18either method 1 or 3; method 2 is less well maintained.
19
20NOTE: OPTION 3 WILL CURRENTLY NOT WORK FOR 2.0 AND OLDER 2.1 KERNELS!
21
22
23Having a proper kernel tree (compilation options 1 and 2)
24=========================================================
25
26Usually, if you compile a user-space application, you can get away with
27having a different version of the kernel running than the version of the
28kernel header files against which you compiled it. But a perfect match
29is needed for the first two compilation options above.
30
31Let's say you want to use the i2c modules with the kernel 2.1.12 you
32are running now. What you need, is the original tree in which you
33compiled that 2.1.12 kernel. A freshly unpacked 2.1.12 kernel will not
34cut it, because `make *config dep' creates some files that are needed.
35And even then, you will run into trouble, because you may not have
36selected the exact same configuration variables. Plain advise: if you
37do not have your original kernel tree anymore, recompile your kernel
38first.
39
40Note that there is no need for a perfect match at compilation time, just
41at run-time. This means you can cross-compile against a different kernel
42version, and the Makefile does not check for this.
43
44Usually problems if the match is imperfect, is that either this package
45won't compile at all (because it was a freshly unpacked tree without
46some files generated by `make *config dep'), or that you can't insert
47modules because of either a `kernel-module version mismatch' or because
48of `unresolved kernel symbols'. If you get either of these messages,
49check your kernel tree!
50
51Note that some distributions are notably bad at this. To offset this
52somewhat, not the files in /usr/include/{linux,asm} are used, but instead
53those in /usr/src/linux/include/{linux,asm}. It is also possible to
54tell the Makefile the kernel is somewhere else than at /usr/src/linux.
55
56
57Separate from kernel compilation (compilation option 1)
58=======================================================
59
60This will compile and install the complete i2c package. Though nothing is
61written to your kernel tree, a proper tree is still needed for this. See
62below for what a proper kernel tree is.
63
64At the top of the Makefile are a couple of configuration variables that
65you may want to change. As far as possible, the Makefile tries to figure
66out by itself their settings, but it is possible to overrule them. A list
67is found below. Most important are the variables that determine where
68your kernel is located (LINUX=/usr/src/linux) and where you want to
69install your modules (MODDIR=/lib/modules/KERNELVERSION/extra/misc) and
70header files (LINUX_INCLUDE_DIR=/usr/local/include/linux). You can see
71that the installation locations are choosen in such a way that they
72are separate from the true kernel.
73
74Compilation is done by `make all'; `make install' installs the package.
75You will get a lot of warnings about files which are not found, all
76ending on `.d'. You can safely ignore this; they contain dependency
77information, which is regenerated on the spot.
78
79Please continue reading this file before you start compiling.
80
81
82Semi-integrated into the kernel compilation (compilation option 2)
83==================================================================
84
85Please reconsider first whether you truly want to use this compilation
86option. Often, it is better to use the previous compilation technique.
87
88This will compile and install the complete i2c package, by using the
89kernel build system. Some file will be written to your kernel tree
90for this.
91
92At the top of the Makefile are a couple of configuration variables that
93you may want to change. Not all of those variables are used if you
94use this compilation option, though. A list of them is found below.
95
96Compilation is done by `make all'; `make install' installs the package.
97
98Please continue reading this file before you start compiling.
99
100
101Makefile configuration variables (compilation options 1 and 2)
102==============================================================
103
104BUILD_SYSTEM (both) default: lm_sensors
105  The build system which is used. lm_sensors corresponds with compilation
106  option 1; i2c with compilatin option 2.
107SHELL (both) (default: /bin/sh)
108  You may have to specify the full path to Bash here, if /bin/sh is some
109  other shell. There have been conflicting reports on whether this is
110  needed.
111LINUX (both) default: /usr/src/linux
112  The location of your kernel tree.
113COMPILE_KERNEL (both)
114  This determines whether only the user-space utilities are needed (0)
115  or also the kernel modules (1). This is usually determined by checking
116  whether the kernel was already patched to include the kernel modules,
117  but that is not really foolprool.
118  At the moment of writing, there are no user-space utilities yet, so
119  setting this to 0 will make for a very fast compilation :-)
120SMP (compilation option 1 only)
121  This must be set to 1 for a SMP kernel. The magic invocation should
122  determine this automatically, so you should not have to bother with
123  this.
124MODVER (compilation option 1 only)
125  This must be set to 1 if CONFIG_MODVERSIONS is defined. The magic
126  invocation should determine this automatically, so you should not
127  have to bother with this.
128MODDIR (both) default: /lib/modules/KERNELVERSION/extra/misc)
129  The location where the kernel modules will be installed.
130LINUX_INCLUDE_DIR (compilation option 1 only) default: /usr/local/include/linux
131  The location where the i2c header files will be installed
132WARN (compilation option 1 only) default: 0
133  Generate additional compilation warnings; mainly interesting for
134  developers.
135
136
137Handling the modules (compilation option 2)
138===========================================
139
140Once you have installed the kernel modules, you will have to make sure
141they are found.
142
143First, check whether your modutils will look in the right directory at
144all. If you used build system 1, you will probably have to add lines
145to /etc/conf.modules or /etc/modules.conf (use the one that exists, or
146take your pick):
147  (modules-2.0.0):
148    path[misc]=/lib/modules/current/extra/misc
149  (modutils-2.1.x):
150    path=/lib/modules/current/extra
151This assumes /lib/modules/current will always be linked to the correct
152modules tree. If not, you will have to change it as appropriate for
153your system.
154
155Next, you will have to run `depmod -a' to have them recognised. Most
156distributions run this command when you boot, so if you were cross-
157compiling, you can skip this step.
158
159
160Patching the kernel (compilation option 3)
161==========================================
162
163There is a special script which should be able to generate diffs against
164any 2.0, 2.1, 2.2 and 2.3 kernel. Please report any problems to our
165mailinglist. Note that it may fail, and probably silently, if you have
166applied other patches to your kernel tree, or for very new kernels.
167It *is* safe to run it if your kernel already has the i2c drivers, or
168if it was patched with the lm_sensors drivers.
169
170The kernel diffs are generated by the program `mkpatch.pl' in the mkpatch
171subdirectory. It needs two arguments: the first one is the root of the
172i2c package, the second one is the root of the kernel tree against
173which the diffs will be generated. For example:
174  cd /tmp/i2c-2.0.3
175  mkpatch/mkpatch.pl . /usr/src/linux > /tmp/i2c-patch
176You can apply the diffs as usual:
177  cd /usr/src/linux
178  patch -p1 -E < /tmp/i2c-patch
179Genearation and application can easily be done in one step:
180  mkpatch/mkpatch.pl . /usr/src/linux | patch -p1 -E -d /usr/src/linux
181The generated diffs are of course only valid for the kernel version
182against which mkpatch.pl was run.
183
184Once you have applied the patches, you can configure and compile your
185kernel as usual. You will see the I2C configuration screen under the
186`Character Devices' menu in menuconfig.
187
188
189Using the I2C package
190=====================
191
192You can now load the modules by using `modprobe'. For example,
193`modprobe i2c-elv' will load the i2c-elv modules, and all i2c modules
194on which it depends.
195
196You can not use demand-loading; you will have to issue explicit modprobe
197instructions. The one exception is the `i2c-dev' module. You can
198automatically load it by adding the following line to etc/conf.modules or
199/etc/modules.conf (use the one that exists):
200    alias char-major-89 i2c-dev
201
202Note that there are no client drivers in this package; you will have to
203get them from somewhere else (for example, download the lm_sensors
204package at http://www.lm-sensors.nu). Without additional drivers and
205programs, this package is of very limited use to you.
206
207
208Old and new I2C drivers
209=======================
210
211In the current 2.2 and 2.3 kernels, there are already I2C drivers, but
212they are not the same ones as in this package. They are much older, and
213have a very limited functionality compared with the drivers included
214here. Fortunately, they can co-exist peacefully, so you should not worry
215about it. Except for one thing: `#include <linux/i2c.h>' can cause the
216wrong header file to be included. If you patched the kernel (compilation
217option 3), you will have to use `#include <linux/i2c-old.h>' to include
218the old ones; in all other cases, including the old ones will probably
219be impossible without copying them explicitly to some place that will
220be checked first.
Note: See TracBrowser for help on using the browser.