⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 install

📁 I2C总线LINUX驱动程序
💻
字号:
These are the installation instructions for the i2c package.This package is ONLY for 2.4 kernels 2.4.10 or later!FOR 2.5/2.6 KERNELS, do not attempt to compile this package.    Use the drivers already in the 2.5/2.6 kernel tree.---------------------------------------------------------------------------There are three ways in which you can compile and install this package.Option 1 is much easier and is recommended. 1. Complete separate from kernel compilation    (only for 2.4 kernels 2.4.10 or later)    This will generate a set of modules which can be inserted and removed    as needed; nothing will be written into the kernel tree. 2. Semi-integrated into the kernel     (only for 2.4 kernels 2.4.10 or later)    This will add some files to your kernel tree, but has the advantage    that module symbols are supported; the end result is functionally very     like the previous way; 3. Patching of the kernel    (only for 2.4 kernels 2.4.13 or later)    This will patch your kernel source tree. You must recompile your kernel    to take advantage of this. But it makes it possible to compile drivers    into the kernel itself, instead of having to add them as modules.Each of these ways will be described below in detail.We recommend using either method 1 or 3;method 2 is less well maintained.NOTE: SUPPORT FOR KERNELS 2.0.0 - 2.4.9 HAS BEEN DROPPED!      2.4.10 OR LATER REQUIRED!FOR 2.5 KERNELS, Do not attempt to compile this package.                 Use the drivers already in the 2.5 kernel development tree.Having a proper kernel tree (compilation options 1 and 2)=========================================================Usually, if you compile a user-space application, you can get away withhaving a different version of the kernel running than the version of thekernel header files against which you compiled it. But a perfect matchis needed for the first two compilation options above.Let's say you want to use the i2c modules with the kernel 2.1.12 youare running now. What you need, is the original tree in which youcompiled that 2.1.12 kernel. A freshly unpacked 2.1.12 kernel will notcut it, because `make *config dep' creates some files that are needed.And even then, you will run into trouble, because you may not haveselected the exact same configuration variables. Plain advise: if youdo not have your original kernel tree anymore, recompile your kernelfirst.Your I2C support must NOT be built-in your kernel already!It must either be disabled or enabled as modules.Look in Character Devices -> I2C Support in the kernelconfiguration system to verify.Note that there is no need for a perfect match at compilation time, justat run-time. This means you can cross-compile against a different kernelversion, and the Makefile does not check for this.Usually problems if the match is imperfect, is that either this packagewon't compile at all (because it was a freshly unpacked tree withoutsome files generated by `make *config dep'), or that you can't insertmodules because of either a `kernel-module version mismatch' or becauseof `unresolved kernel symbols'. If you get either of these messages,check your kernel tree!Note that some distributions are notably bad at this. To offset thissomewhat, not the files in /usr/include/{linux,asm} are used, but insteadthose in /usr/src/linux/include/{linux,asm}. It is also possible totell the Makefile the kernel is somewhere else than at /usr/src/linux.To keep problems to a minimum, please use a 'vanilla' kernel tree,as distributed on ftp://ftp.kernel/org/pub/linux/kernel, and not onepatched by your distribution.Separate from kernel compilation (compilation option 1)=======================================================This will compile and install the complete i2c package. Though nothing iswritten to your kernel tree, a proper tree is still needed for this. Seeearlier for what a proper kernel tree is.At the top of the Makefile are a couple of configuration variables thatyou may want to change. As far as possible, the Makefile tries to figureout by itself their settings, but it is possible to overrule them. A listis found below. Most important are the variables that determine whereyour kernel is located (LINUX=/lib/modules/KERNELVERSION/build, usuallylinks to /usr/src/linux or something similar) and where you want toinstall your modules (MODDIR=/lib/modules/KERNELVERSION) and header files(LINUX_INCLUDE_DIR=/usr/local/include/linux). You can see that theinstallation locations are choosen in such a way that they are separatefrom the true kernel.Compilation is done by `make all'; `make install' installs the package.You will get a lot of warnings about files which are not found, all ending on `.d'. You can safely ignore this; they contain dependencyinformation, which is regenerated on the spot.Please continue reading this file before you start compiling.Semi-integrated into the kernel compilation (compilation option 2)==================================================================Please reconsider first whether you truly want to use this compilationoption. Often, it is better to use the previous compilation technique.This will compile and install the complete i2c package, by using thekernel build system. Some file will be written to your kernel treefor this.At the top of the Makefile are a couple of configuration variables thatyou may want to change. Not all of those variables are used if you use this compilation option, though. A list of them is found below.Compilation is done by `make all'; `make install' installs the package.Please continue reading this file before you start compiling.Makefile configuration variables (compilation options 1 and 2)==============================================================BUILD_SYSTEM (both) (default: lm_sensors)  The build system which is used. lm_sensors corresponds with compilation  option 1; i2c with compilation option 2.SHELL (both) (default: /bin/sh)  You may have to specify the full path to Bash here, if /bin/sh is some  other shell. There have been conflicting reports on whether this is   needed.KERNELVERSION (both)  The version of the currently running kernel.LINUX (both) (default: /lib/modules/$(KERNELVERSION)/build)  The location of your kernel tree.COMPILE_KERNEL (both) (default: 1)  Determine whether you want to consider the kernel modules for compilation  at all. By default, compilation option 1 will only compile and install  those modules which are not built into the kernel; compilation option 2  will compile and install all of them.    If some modules are built into your kernel, and this package is much   newer, you may find you can not insert the newly compiled modules.   Sorry.  You may want to set this to 0 if you have just patched and compiled  your kernel using the same version of this package, and just want to  compile the user-space tools.SMP (compilation option 1 only)  This must be set to 1 for a SMP kernel. The magic invocation should  determine this automatically, so you should not have to bother with   this.MODVER (compilation option 1 only)  This must be set to 1 if CONFIG_MODVERSIONS is defined. The magic  invocation should determine this automatically, so you should not  have to bother with this.MODDIR (both) (default: /lib/modules/$(KERNELVERSION))  The location where the kernel modules will be installed. LINUX_INCLUDE_DIR (compilation option 1 only) (default: /usr/local/include/linux)  The location where the i2c header files will be installed.WARN (compilation option 1 only) (default: 0)  Generate additional compilation warnings; mainly interesting for  developers.Handling the modules (compilation option 2)===========================================Run `depmod -a' to have new modules them recognised. Mostdistributions run this command when you boot, so if you were cross-compiling, you can skip this step.Patching the kernel (compilation option 3)==========================================There is a special script which should be able to generate diffs againstany 2.4 kernel (2.4.13 and later). Note that older kernels are no longer supported.Please report any problems to our mailinglist. Note that it may fail, and probably silently, if you have applied other patches to your kernel tree, or for very new kernels.  It *is* safe to run it if your kernel already has the i2c drivers, or if it was patched with the lm_sensors drivers.The kernel diffs are generated by the program `mkpatch.pl' in the mkpatchsubdirectory. It needs two arguments: the first one is the root of thei2c package, the second one is the root of the kernel tree againstwhich the diffs will be generated. For example:  cd /tmp/i2c-2.0.3  mkpatch/mkpatch.pl . /usr/src/linux > /tmp/i2c-patchYou can apply the diffs as usual:  cd /usr/src/linux  patch -p1 -E < /tmp/i2c-patchGenearation and application can easily be done in one step:  mkpatch/mkpatch.pl . /usr/src/linux | patch -p1 -E -d /usr/src/linuxThe generated diffs are of course only valid for the kernel version against which mkpatch.pl was run.Once you have applied the patches, you can configure and compile yourkernel as usual. You will see the I2C configuration screen under the`Character Devices' menu in menuconfig.Using the I2C package=====================You can now load the modules by using `modprobe'. For example,`modprobe i2c-elv' will load the i2c-elv modules, and all i2c moduleson which it depends.You can not use demand-loading; you will have to issue explicit modprobeinstructions. The one exception is the `i2c-dev' module. You can automatically load it by adding the following line to etc/conf.modules or /etc/modules.conf (use the one that exists):    alias char-major-89 i2c-devNote that there are no client drivers in this package; you will have toget them from somewhere else (for example, download the lm_sensorspackage at http://www.lm-sensors.nu). Without additional drivers andprograms, this package is of very limited use to you.Old and new I2C drivers=======================In the current 2.2 and older 2.3 kernels, there are already I2C drivers, butthey are not the same ones as in this package. They are much older, andhave a very limited functionality compared with the drivers includedhere. Fortunately, they can co-exist peacefully, so you should not worryabout it. Except for one thing: `#include <linux/i2c.h>' can cause thewrong header file to be included. If you patched the kernel (compilationoption 3), you will have to use `#include <linux/i2c-old.h>' to includethe old ones; in all other cases, including the old ones will probablybe impossible without copying them explicitly to some place that willbe checked first.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -