root/i2c/trunk/INSTALL @ 3528

Revision 3528, 10.0 KB (checked in by mds, 12 years ago)

Emphasize that I2C can't be built-in to kernel already

for options 1 & 2.

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