5ee99bb76478f27d35de0cab69f1799e9c766dd4
[comedi.git] / INSTALL
1
2 * Linux source:
3
4 In order to compile the Comedi modules, you will need to have
5 a correctly configured Linux kernel source tree.  The best
6 way to get one is to download a tarball from kernel.org and
7 compile your own kernel.  Comedi should work with most 2.2 and
8 2.4 Linux kernels.  Support for 2.0.3x is not actively maintained,
9 but it should work and bugs will be fixed as they are reported.
10
11 You can also prepare a kernel source tree that matches
12 the kernel you are currently running if you have its config file (in
13 the Debian distibution the config files for the kernel-image packages
14 are installed into the /boot directory).  The following steps will
15 (almost) set up your kernel sources correctly.  You will also need
16 write permission to the kernel source directory the first time you
17 run comedi's 'make config', so you might want to unpack the kernel 
18 source into a directory you own.
19
20 1) Get a copy of the kernel source that matches the kernel you are
21         running.  Unpack it and copy your kernel config file to '.config'
22         in the top directory of your kernel source.
23 2) You might need to edit the file 'Makefile' in the kernel source.
24         At the top of the Makefile, the variable EXTRAVERSION is defined.
25         If necessary, change it to match your kernel (for example, if the command
26         'uname -r' produces "2.4.16-386" then your EXTRAVERSION should be
27         set as 'EXTRAVERSION=-386'.
28 3) Run 'make oldconfig' in your kernel source directory.
29 4) Run 'make dep' in the kernel source directory and you are done.
30
31 Red Hat users note: Kernel sources that are distributed with Red
32 Hat Linux are not supported, because they are too heavily
33 modified.  However, there is some information in
34 Documentation/comedi/redhat-notes on how to use Red Hat kernels.
35
36 * RTAI support:
37
38 If you want to use the real-time capabilities of Comedi with
39 RTAI, you need to compile and install RTAI first.  It is
40 necessary to use the rthal patch instead of the "copyto"
41 scripts.  Known working versions are RTAI-1.6, RTAI-24.1.4,
42 and current RTAI CVS.  Remember to enable Kcomedilib support,
43 since you will be accessing Comedi from other kernel modules.
44
45 * RTLinux support:
46
47 If you want to use the real-time capabilities of Comedi with
48 RTLinux, you need to compile RTLinux (both the kernel and the
49 modules) first.  Known working versions are 2.x and 3.0.
50 Remember to enable Kcomedilib support, since you will be
51 accessing Comedi from other kernel modules.
52
53 * Configuration:
54
55 Configure using 'make'.  This will ask you the location of the
56 Linux kernel source tree.  If it detects that you have a kernel
57 patched for RTAI or RTLinux, it will also ask you for the location
58 of the RTAI or RTLinux source directory.  Then the configuration
59 script will ask questions for a couple general Comedi features
60 and then whether or not compile each driver.
61
62 * Compiling:
63
64 Compile using 'make'.  If this fails for some reason, send the
65 _entire_ build log to the mailing list.  Without the build
66 log, it is impossible to find problems.
67
68 * Installation:
69
70 Install using 'make install' as root.  This installs the files:
71
72   /lib/modules/<<kernel version>>/misc/comedi.o
73   /lib/modules/<<kernel version>>/misc/kcomedilib.o
74   /lib/modules/<<kernel version>>/misc/<<driver files>>.o
75
76 You need to create device files to access the hardware from a
77 user process.  These can be created using 'make dev'.  The following
78 special files will be created:
79
80   /dev/comedi0
81   /dev/comedi1
82   /dev/comedi2
83   /dev/comedi3
84
85 * Comedilib:
86
87 Now would be a good time to compile and install Comedilib.  Comedi
88 and Comedilib are completely independent, so it doesn't matter
89 which is installed first.
90
91 * Running Comedi:
92
93 To use comedi, the driver module and the core Comedi modules must
94 be loaded into the kernel.  This is done by a command similar to
95
96   /sbin/modprobe <<driver>>
97
98 If your module dependencies are set up correctly, this will load
99 both comedi.o and your driver.  If you get unresolved symbols, check
100 the FAQ or the mailing list archives.  Also look at the man pages
101 for modprobe and insmod.
102
103 In order to configure a driver module to use a particular device
104 file (/dev/comediN) and a particular device, you need to use the
105 command 'comedi_config', which is part of the comedilib
106 distribution.  Comedi_config is invoked using
107
108   comedi_config /dev/comedi0 <device name> <option list>
109
110 The device name may or may not be the same as the module name.  In
111 general, if the device type can be autoprobed (as with ISA PnP or
112 PCI devices), the device name will be the same as the module name.
113 Otherwise, you will need to check Documentation/comedi/drivers.txt
114 for information about what device name is appropriate for your
115 hardware.  The option list is to supply additional information,
116 such as I/O address, IRQ, DMA channels, and other jumper settings.
117 Information about option lists appropriate for a driver is in
118 drivers.txt.  The following commands are examples:
119
120   comedi_config /dev/comedi0 dt2821 0x240,3
121   comedi_config /dev/comedi1 ni_atmio 0x260,4
122   comedi_config /dev/comedi2 dt2817 0x228
123   comedi_config /dev/comedi3 ni_pcimio
124
125 Try a 'man comedi_config' for information on how to use
126 this utility.  Scripts have been written for a few of the drivers
127 with very complicated option lists -- these are found in the etc
128 directory.
129
130 * Module Autoloading:
131
132 If you like to autoload your modules, put the following lines
133 into /etc/modules.conf (this does not apply for PCMCIA cards):
134
135   alias char-major-98 comedi
136   alias char-major-98-0 your_driver
137   post-install your_driver PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH;comedi_config /dev/comedi0 board_name <<options>>
138
139 Alternatively, for complicated option lists, the scripts in etc
140 are designed to be copied into /etc, so that you could put the
141 following lines into /etc/conf.modules:
142
143   alias char-major-98-0 dt282x
144   post-install dt282x /etc/dt282x.conf
145
146 If you have a National Instruments AT-MIO or PCI-MIO board, you probably
147 will want to run comedi_calibrate, an autocalibration tool that is part
148 of comedilib in a bootup script.
149
150 * PCMCIA:
151
152 Linux-2.4 kernels are recommended for PCMCIA drivers, since 2.2
153 kernel require the separate PCMCIA package.  It is possible to
154 use 2.2 kernels with PCMCIA, although it is necessary to modify
155 the top level Makefile.
156
157 Comedi works with several PCMCIA cards, and the driver modules can
158 be loaded and unloaded upon insertion and removal of the card.
159 The necessary configuration files are in the Comedilib source
160 package.  Copy the files in etc/pcmcia/ to /etc/pcmcia and restart
161 card services.  The pcmcia script provided is very simple -- it only
162 uses /dev/comedi0 for devices, which is a limitation if you have
163 other Comedi devices in your system.
164
165 * Upgrading:
166
167 From versions prior to 0.6.0, you will need to edit and recompile
168 all programs that use comedi or comedilib, since the names of
169 functions and ioctls have changed.
170
171 From versions prior to 0.5.0, you will need to recompile all programs
172 that use comedi or comedilib, since the interface to both of these has
173 changed.  No changes should need to be made to the source of the
174 programs.  The format for parameters of comedi_config has changed.
175
176 From versions prior to 0.4.0, you will need to run 'make dev' again
177 to recreate /dev/comedi*, since the major number has changed.
178