root/lm-sensors/trunk/INSTALL @ 567

Revision 567, 11.9 KB (checked in by frodo, 15 years ago)

Updated INSTALL and README files

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