root/i2c/trunk/INSTALL

Revision 4158, 10.6 kB (checked in by ruik, 2 years ago)

Fix the homepage address

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