root/lm-sensors/tags/V2-5-5/INSTALL

Revision 992, 14.7 kB (checked in by mds, 8 years ago)

Fix comment about 1st arg to mkpatch is sensors root, not i2c root.

Thanks Chris Karakas.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 These are the installation instruction for the lm_sensors package.
2
3 There are two ways in which you can compile and install this package. Each
4 has 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. Patching of the kernel
11     This will patch your kernel source tree. You must recompile your kernel
12     to take advantage of this. But it makes it possible to compile drivers
13     into the kernel itself, instead of having to add them as modules.
14     ** AFTER YOU COMPILED AND INSTALLED YOUR KERNEL, YOU WILL STILL HAVE TO
15     ** COMPILE THIS PACKAGE TO GET THE USERLAND UTILITIES!
16     ** NOT ALL MODULES ARE PATCHED INTO THE KERNEL. SEE BELOW.
17
18
19
20 Each of these ways will be described below in detail.
21
22 NOTE: MAKE SURE YOU HAVE THE I2C-ALGO-BIT DRIVER (PART OF THE I2C PACKAGE)
23       COMPILED INTO YOUR KERNEL OR AVAILABLE AS A MODULE; SOME SENSORS
24       DRIVERS DEPEND ON IT!
25
26 NOTE: IN EACH CASE, YOU WILL HAVE TO GET AND INSTALL THE I2C PACKAGE FIRST!
27       SET COMPILE_KERNEL TO 0 IN THE MAIN MAKEFILE FOR OPTION 2, UNLESS
28       YOU NEED ALPHA OR BETA DRIVERS (SEE BELOW)
29
30 NOTE: PLEASE READ THE DOCUMENTATION IN THE DOC SUBDIRECTORY IF YOU GET STUCK!
31
32
33 Installing the i2c package
34 ==========================
35
36 Note: as of kernel 2.3.34, the new i2c code is integrated into the
37 mainstream kernels. You MAY be able to skip this whole step if you use kernel
38 2.3.34 or later, but it is likely that you will have compilation problems.
39 We strongly recommend that you download and install the i2c package with
40 the same version number as the lm_sensors package.
41
42 As of version 2.4.0 of lm_sensors, all i2c components are distributed in
43 a separate package. There are install instructions in that package. If
44 you want to use compilation option 2 (patching the kernel) for lm_sensors,
45 you will have to use compilation option 3 (patching the kernel) for i2c
46 too. If you want to use compilation option 1 (compiling as modules) for
47 lm_sensors, you may use either compilation option 1 or 2 (compiling as
48 modules) or compilation option 3 (patching the kernel for i2c). See the
49 table below.
50
51                                           LM_SENSORS
52 I2C                      | option 1 (modules)      option 2 (patch kernel)
53 option 1 (modules)       |      YES                      NO
54 option 2 (modules)       |      YES                      YES
55 option 3 (patch kernel)  |      YES                      YES
56
57
58 If you use compilation option 1 (compiling as modules) for lm_sensors, you
59 will have to make very sure the correct i2c header files are found. If you
60 get weird compilation errors, this is almost certainly going wrong. The
61 i2c header files are in a i2c subdirectory of either /usr/local/include
62 (i2c compilation option 1) or /usr/src/linux*/include (i2c compilation
63 options 2 and 3). Especially if you have in the past placed the header
64 files in /usr/local/include, this will probably go wrong. See below on
65 how to fix this.
66
67
68 Mixing old and new, and using beta drivers (compilation option 1)
69 =================================================================
70
71 It is possible that you are running a previously patched kernel, or
72 a very new kernel which already has limited or full i2c or lm_sensors
73 support, but you want to use newer versions of the drivers. This is
74 possible, but there are some pitfalls.
75
76 If had compiled all i2c and lm_sensors drivers as modules, you are
77 in luck. You can simply compile the newest versions of i2c and
78 lm_sensors and install them. Just make sure the right modules are
79 loaded (best bet: remove the old ones first).
80
81 If you have a certain driver compiled into your kernel, you may
82 encounter bad problems. We do not guarantee to keep internal kernel
83 interfaces unchanged. In plain language, this means that an older driver
84 may not work together with a newer driver, and your kernel may crash.
85 On the other hand, if you know what you are doing, compilation will
86 be smart. Drivers that are compiled right into your kernel will not
87 be compiled as a module again.  You could do nothing with them anyway.
88
89 Sometimes, you want to patch your kernel, but find that certain alpha
90 or beta drivers are not included in the patch. This is on purpose: we
91 do not want to polute the kernel tree with things of which we are not
92 confident they work. In this case, patch the kernel, compile it, and
93 then compile lm_sensors with COMPILE_KERNEL set to 1.
94
95
96 Having a proper kernel tree (compilation option 1)
97 ==================================================
98
99 Usually, if you compile a user-space application, you can get away with
100 having a different version of the kernel running than the version of the
101 kernel header files against which you compiled it. But a perfect match
102 is needed for the first two compilation options above.
103
104 Let's say you want to use the lm_sensors modules with the kernel 2.1.12 you
105 are running now. What you need, is the original tree in which you
106 compiled that 2.1.12 kernel. A freshly unpacked 2.1.12 kernel will not
107 cut it, because `make *config dep' creates some files that are needed.
108 And even then, you will run into trouble, because you may not have
109 selected the exact same configuration variables. Plain advise: if you
110 do not have your original kernel tree anymore, recompile your kernel
111 first.
112
113 Note that there is no need for a perfect match at compilation time, just
114 at run-time. This means you can cross-compile against a different kernel
115 version, and the Makefile does not check for this.
116
117 Usually problems if the match is imperfect, is that either this package
118 won't compile at all (because it was a freshly unpacked tree without
119 some files generated by `make *config dep'), or that you can't insert
120 modules because of either a `kernel-module version mismatch' or because
121 of `unresolved kernel symbols'. If you get either of these messages,
122 check your kernel tree!
123
124 Note that some distributions are notably bad at this. To offset this
125 somewhat, not the files in /usr/include/{linux,asm} are used, but instead
126 those in /usr/src/linux/include/{linux,asm}. It is also possible to
127 tell the Makefile the kernel is somewhere else than at /usr/src/linux.
128
129 To keep problems to a minimum, please use a 'vanilla' kernel tree,
130 as distributed on ftp://ftp.kernel/org/pub/linux/kernel, and not one
131 patched by your distribution.
132
133
134 Separate from kernel compilation (compilation option 1)
135 =======================================================
136
137 This will compile and install the complete lm_sensors package. Though
138 nothing is written to your kernel tree, a proper tree is still needed
139 for this. See earlier for what a proper kernel tree is.
140
141 At the top of the Makefile are a couple of configuration variables that
142 you may want to change. As far as possible, the Makefile tries to figure
143 out by itself their settings, but it is possible to overrule them. A list
144 is found below. Most important are the variables that determine where
145 your kernel is located (LINUX=/usr/src/linux), where the i2c header files
146 are (I2C_HEADERS=/usr/local/include) and where you want to install
147 your modules (MODDIR=/lib/modules/KERNELVERSION/misc) and
148 header files (LINUX_INCLUDE_DIR=/usr/local/include/linux). You can see
149 that the installation locations are choosen in such a way that they
150 are separate from the true kernel.
151
152 Compilation is done by `make all'; `make install' installs the package.
153 You will get a lot of warnings about files which are not found, all
154 ending on `.*d'. You can safely ignore this; they contain dependency
155 information, which is regenerated on the spot.
156
157 Please continue reading this file before you start compiling.
158
159
160 Makefile configuration variables (compilation option 1)
161 ==============================================================
162
163 SHELL (default: /bin/sh)
164   You may have to specify the full path to Bash here, if /bin/sh is some
165   other shell. There have been conflicting reports on whether this is
166   needed.
167 LINUX default: /usr/src/linux
168   The location of your kernel tree.
169 COMPILE_KERNEL
170   Determine whether you want to consider the kernel modules for compilation
171   at all. By default, compilation option 1 will only compile and install
172   those modules which are not built into the kernel.
173   If some modules are built into your kernel, and this package is much
174   newer, you may find you can not insert the newly compiled modules.
175   Sorry.
176   You may want to set this to 0 if you have just patched and compiled
177   your kernel using the same version of this package, and just want to
178   compile the user-space tools.
179 I2C_HEADERS default: /usr/local/include
180   This lists where the i2c headers are found. If you used compilation
181   option 1 for the i2c package, the default will be right. If you used
182   compilation options 2 or 3, it will not, and may actually cause
183   problems if you have the left-overs of a previous installation.
184   If you have weird compilation problems, try to change this to
185   $(LINUX_HEADERS).
186 SMP
187   This must be set to 1 for a SMP kernel. The magic invocation should
188   determine this automatically, so you should not have to bother with
189   this.
190 WARN default: 0
191   Generate additional compilation warnings; mainly interesting for
192   developers.
193 MODVER
194   This must be set to 1 if CONFIG_MODVERSIONS is defined. The magic
195   invocation should determine this automatically, so you should not
196   have to bother with this.
197 DEBUG default: 0
198   Some drivers will issue more debug information if you set this to
199   1. Don't do it, unless you are a developer or are instructed to do
200   so by the lm_sensors team.
201 PREFIX default: /usr/local
202   Prefix for almost all installation directories
203 MODDIR default: /lib/modules/KERNELVERSION/misc)
204   The location where the kernel modules will be installed.
205 ETCDIR default: /etc
206   Installation location of the sensors.conf configuration file
207 LIBDIR default: $(PREFIX)/lib
208   Installation location of all static and shared libraries.
209 BINDIR default: $(PREFIX)/bin
210   Installation directory of programs useful for users
211 SBINDIR default: $(PREFIX)/sbin
212   Installation directory of system administrator-only programs
213 INCLUDEDIR default: $(PREFIX)/include
214   Base installation directory for include files (see next two vars)
215 SYSINCLUDEDIR default: $(INCLUDEDIR)/linux
216   Installation directory for system include files
217 LIBINCLUDEDIR default: $(INCLUDEDIR)/sensors
218   Installation directory for libsensors include files.
219 MANDIR default: $(PREFIX)/man
220   Base installation directory for manual pages
221 MANOWN default: root
222   Owner of manual pages
223 MANGRP default: root
224   Group of manual pages
225
226
227
228 Handling the modules (compilation option 1)
229 ===========================================
230
231 Run the command `depmod -a' to have the new modules recognised. Most
232 distributions run this command when you boot, so if you were cross-
233 compiling, you can skip this step.
234
235 See doc/modules for a more detailed treatment.
236
237
238 Patching the kernel (compilation option 2)
239 ==========================================
240
241 There is a special script which should be able to generate diffs against
242 any 2.2 or 2.4 kernel. Note that 2.3 kernels are no longer supported for
243 this compilation option (choose option 1 instead). Please report any
244 problems to our mailinglist. Note that it may fail, and probably silently,
245 if you have applied other patches to your kernel tree, or for very new kernels.
246 It *is* safe to run it if your kernel already has the lm_sensors drivers.
247 It will only work if you applied the i2c patches first.
248
249 ** Only a subset of the modules in lm_sensors are patched into the        **
250 ** kernel by the script. See the file mkpatch/FILES to see if the         **
251 ** modules you need are included. If a module you need is NOT listed      **
252 ** in mkpatch/FILES, it will not be patched, and you MUST use option 1.   **
253 ** If you are not sure what modules you need, run `sensors-detect' first. **
254
255 The kernel diffs are generated by the program `mkpatch.pl' in the mkpatch
256 subdirectory. It needs two arguments: the first one is the root of the
257 lm_sensors package, the second one is the root of the kernel tree against
258 which the diffs will be generated. For example:
259   cd /tmp/lm_sensors-2.4.0
260   mkpatch/mkpatch.pl . /usr/src/linux > /tmp/sensors-patch
261 You can apply the diffs as usual:
262   cd /usr/src/linux
263   patch -p1 -E < /tmp/sensors-patch
264 Genearation and application can easily be done in one step:
265   mkpatch/mkpatch.pl . /usr/src/linux | patch -p1 -E -d /usr/src/linux
266 The generated diffs are of course only valid for the kernel version
267 against which mkpatch.pl was run.
268
269 Once you have applied the patches, you can configure and compile your
270 kernel as usual. You will see the sensors configuration screen under the
271 `Character Devices' menu in menuconfig, but it will only be available
272 if you selected base I2C support.
273
274
275 Using the sensors package
276 =========================
277
278 You can now load the modules by using `modprobe'. For example,
279 `modprobe i2c-piix4' will load the i2c-piix4 module, and all i2c modules
280 on which it depends.
281
282 You can not use demand-loading; you will have to issue explicit modprobe
283 instructions.
284
285 If you have an older installation, you will probably have to create the
286 i2c device files in the /dev directory. They are called /dev/i2c-%d,
287 and are character devices with major device number 89 and minor device
288 number %d. The script prog/mkdev/mkdev.sh will create the files for you.
289
290 There is a special scanning program installed called sensors-detect. It
291 will scan all available I2C and SMBus adapters for all known devices,
292 and give you a list of what modules you need to insert. It is written in
293 Perl, and you will need at least Perl 5.004 to run it succesfully.
294
295 If `sensors' returns some error message about not being able to load
296 libsensors, you have to add the directory in which it is installed
297 (by default /usr/local/lib) to /etc/ld.so.conf and run `ldconfig'.
298
299 You can use the installed sensors program to get a report of all detected
300 sensor devices. There is also a manual page for this program. Calling
301 `sensors -s' will set the limits and other configuration settings
302 specified in /etc/sensors.conf. Again, read the manual pages for more
303 information.
304
305 There are many auxiliary programs not installed. You can find them under
306 the prog subdirectory. A list can be found in doc/progs.
307
308
309 Old and new I2C drivers
310 =======================
311
312 In the current 2.2 and 2.3 kernels, there are already I2C drivers, but
313 they are not the same ones as in this package. They are much older, and
314 have a very limited functionality compared with the drivers included
315 here. Fortunately, they can co-exist peacefully, so you should not worry
316 about it. Except for one thing: `#include <linux/i2c.h>' can cause the
317 wrong header file to be included. If you patched the kernel (compilation
318 option 3), you will have to use `#include <linux/i2c-old.h>' to include
319 the old ones; in all other cases, including the old ones will probably
320 be impossible without copying them explicitly to some place that will
321 be checked first.
Note: See TracBrowser for help on using the browser.