File: INSTALL

package info (click to toggle)
comedi 0.7.76+20090411cvs-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 7,720 kB
  • ctags: 14,291
  • sloc: ansic: 105,119; sh: 1,210; makefile: 628; perl: 457
file content (190 lines) | stat: -rw-r--r-- 7,820 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190

* Linux source:

In order to compile the Comedi modules, you will need to have
a correctly configured Linux kernel source tree.  The best
way to get one is to download a tarball from kernel.org and
compile your own kernel.  Comedi should work with most 2.2, 
2.4, and 2.6 Linux kernels.  2.6.x kernels older than 2.6.6 are
not supported.  Support for 2.0.3x is not actively maintained,
but it should work and bugs will be fixed as they are reported.

You can also prepare a kernel source tree that matches
the kernel you are currently running if you have its config file (in
the Debian distibution the config files for the kernel-image packages
are installed into the /boot directory).  The following steps will
(almost) set up your kernel sources correctly.  You will also need
write permission to the kernel source directory the first time you
run comedi's configure script, so you might want to unpack the kernel
source into a directory you own.

1) Get a copy of the kernel source that matches the kernel you are
	running.  Unpack it and copy your kernel config file to '.config'
	in the top directory of your kernel source.
2) You might need to edit the file 'Makefile' in the kernel source.
	At the top of the Makefile, the variable EXTRAVERSION is defined.
	If necessary, change it to match your kernel (for example, if the command
	'uname -r' produces "2.4.16-386" then your EXTRAVERSION should be
	set as 'EXTRAVERSION=-386'.
3) Run 'make oldconfig' in your kernel source directory.
4) Run 'make dep' (for 2.6 kernels, do a 'make modules_prepare' instead 
	or even better a full 'make') in the kernel source directory and 
	you are done.

Red Hat users note: Kernel sources that are distributed with Red
Hat Linux are not supported, because they are too heavily
modified.  However, there is some information in
Documentation/comedi/redhat-notes on how to use Red Hat kernels.

* RTAI support:

If you want to use the real-time capabilities of Comedi with
RTAI, you need to compile and install RTAI first.  If you
don't install the rtai kernel modules, you may get unresolved
symbols when installing the comedi kernel modules.

* RTLinux support:

If you want to use the real-time capabilities of Comedi with
RTLinux, you need to compile RTLinux (both the kernel and the
modules) first.  Known working versions are 2.x and 3.0.

* Configuration:

Configure with './configure'.  './configure --help' will give the
configuration options.  If the configure script does not exist
(if you checked comedi out from cvs for example), it can
be generated by running './autogen.sh'.  The autoconf, automake,
autoheader, etc. tools are required to generate the configure
script (automake version >= 1.7 recommended).  The --with-linuxdir
option is particularly useful, as it allows you to specify
the location of your Linux kernel source directory.  If
you are using an RT-patched kernel, the --with-rtaidir or
--with-rtlinuxdir options allow you to specify
the location of your RTAI or RTLinux source directory.

* Compiling:

Compile using 'make'.  If this fails for some reason, send the
_entire_ build log to the mailing list.  Without the build
log, it is impossible to find problems.

* Installation:

Install using 'make install' as root.  This installs the files:

  /lib/modules/<<kernel version>>/comedi/comedi.ko
  /lib/modules/<<kernel version>>/comedi/kcomedilib.ko
  /lib/modules/<<kernel version>>/comedi/<<driver files>>.ko

Comedi communicates with userspace via device files (/dev/comedi*).
If you have devices which are able to auto-configure themselves and
you've got udev support these devices are created automatically.  You
can disable this mechanism by setting the module parameter
comedi_autoconfig to zero of the module "comedi_fops". In case you
have got an old ISA card or no udev support (embedded systems) you can
create static devices with the module parameter
comedi_num_legacy_minors by setting it to the number of desired static
/dev/comedi* devices. You can then configure your device from the
userspace with comedi_config. In this case you need to create device
files to access the hardware by hand from a user process.  These can
be created using 'make dev'.  The following special files will be
created:

  /dev/comedi0
  /dev/comedi1
  /dev/comedi2
  ...
  /dev/comedi15

* Comedilib:

Now would be a good time to compile and install Comedilib.  Comedi
and Comedilib are completely independent, so it doesn't matter
which is installed first.

* Running Comedi:

To use comedi, the driver module and the core Comedi modules must
be loaded into the kernel.  This is done by a command similar to

  /sbin/modprobe <<driver>>

If your module dependencies are set up correctly, this will load
both comedi.ko and your driver.  If you get unresolved symbols, check
the FAQ or the mailing list archives.  Also look at the man pages
for modprobe and insmod.

In order to configure a driver module to use a particular device
file (/dev/comediN) and a particular device, you need to use the
command 'comedi_config', which is part of the comedilib
distribution.  Comedi_config is invoked using

  comedi_config /dev/comedi0 <device name> <option list>

The device name may or may not be the same as the module name.  In
general, if the device type can be autoprobed (as with ISA PnP or
PCI devices), the device name will be the same as the module name.
Otherwise, you will need to check Documentation/comedi/drivers.txt
for information about what device name is appropriate for your
hardware.  The option list is to supply additional information,
such as I/O address, IRQ, DMA channels, and other jumper settings.
Information about option lists appropriate for a driver is in
drivers.txt.  The following commands are examples:

  comedi_config /dev/comedi0 dt2821 0x240,3
  comedi_config /dev/comedi1 ni_atmio 0x260,4
  comedi_config /dev/comedi2 dt2817 0x228
  comedi_config /dev/comedi3 ni_pcimio

Try a 'man comedi_config' for information on how to use
this utility.  Scripts have been written for a few of the drivers
with very complicated option lists -- these are found in the etc
directory.

* Module Autoloading:

For recent kernels, module autoloading is handled by udev.  The
following is only applicable to older kernels.

If you like to autoload your modules, put the following lines
into /etc/modules.conf (this does not apply for PCMCIA cards):

  alias char-major-98 comedi
  alias char-major-98-0 your_driver
  post-install your_driver PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH;comedi_config /dev/comedi0 board_name <<options>>

Alternatively, for complicated option lists, the scripts in etc
are designed to be copied into /etc, so that you could put the
following lines into /etc/conf.modules:

  alias char-major-98-0 dt282x
  post-install dt282x /etc/dt282x.conf

* Calibration:

If your board has self-calibration capabilities,
will want to run comedi_calibrate, an autocalibration tool that 
is packaged in a seperate tarball, in a bootup script.

* PCMCIA:

The PCMCIA drivers require at least a 2.6.16 kernel (at for
unpatched mainline kernels).  You must also have pcmciautils
and udev installed.  You can write a udev rule to automatically
run gpib_config after the driver is loaded.

* Upgrading:

From versions prior to 0.6.0, you will need to edit and recompile
all programs that use comedi or comedilib, since the names of
functions and ioctls have changed.

From versions prior to 0.5.0, you will need to recompile all programs
that use comedi or comedilib, since the interface to both of these has
changed.  No changes should need to be made to the source of the
programs.  The format for parameters of comedi_config has changed.

From versions prior to 0.4.0, you will need to run 'make dev' again
to recreate /dev/comedi*, since the major number has changed.