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