root/lm-sensors/trunk/INSTALL @ 619

Revision 619, 12.5 KB (checked in by frodo, 15 years ago)

Fixed Makefile problems

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