Next: , Previous: Introduction, Up: Top


2 Installation

Possibly the most complex task you face if you want to use kacq is to install the prerequisites. It could involve compiling and installing a linux kernel, along with a few other packages. The instructions below aim at making these steps as simple as possible. This process went smoothly the last few times we have tried it.

2.1 Computer and analog-to-digital cards

First, you need a computer. The more channels and the higher the sampling rate you want to use, the faster the computer needs to be. kacq was written to take advantage of multi-core processors (see Code section of manual). A processor with 4 cores should give you optimal results. You would also benefit from a computer with a decent graphic card to display the oscilloscope. Make sure there are Linux drivers available for you graphic card. We have been developping kacq with a Dell OptiPlex 780-Desktop equipped with an Intel Core i7 processor. With this machine, the acquisition and recording of 64 channels at 20 kHz takes less than 5% of the processor time (as measured with the top command). The oscilloscope is the processor intensive part of kacq. The processor usage of the oscilloscope depends on the settings and the type of signal being displayed.

kacq uses the comedi drivers to interact with the acquisition cards. You can have a look at the comedi website to know which acquisition cards are supported. If you want to record from only one board, you can probably pick any card that is supported and that fits your requirements. Because we want to record from 64 channels, we need to work with two cards simultaneously. We opted for 2 NI PCI-6259 cards. These cards support RTSI (Real Time System Integration) bus. This is used to synchronize the two cards. You need a bus cable to connect the RTSI of the two cards. The cable can be ordered from National Instruments. Note that the method to synchronize two cards varies depending on which cards you are using. So if you want to use kacq with more than one card without changing the code, better stick to the PCI-6259.

2.2 Gnu/Linux operating system

Once you have the computer equipped with the card(s), you need to install a recent Gnu/Linux operating system. This usually involves burning a DVD and rebooting your system from the DVD. We are using the 64-bit version of Fedora 17.

2.3 Building a new vanilla kernel

Because the linux kernel coming with Fedora is heavily modified, we need to compile and install a vanilla kernel on the computer to be able to use the comedi drivers. The configuration of the kernel is key to good acquisition performance. When kacq acquires data from many channels at high sampling rates, large amounts of data accumulate quickly in the driver buffers and kacq must empty this buffer regularly to avoid buffer overflow, which results in loss of data. Long delays between reading the driver buffer can be caused by other processes running on the computer. To avoid this situation, steps can be taken to ensure that kacq regularly empty the data from the driver buffer. There are several solutions available. One is to enable the option “Preemptible Kernel “ in the kernel option. This should reduce significantly the low latency responses of the computer. Another solution is to install the real-time patch to the vanilla kernel (see https://rt.wiki.kernel.org/index.php/Main_Page and https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO). This creates a kernel with very low latencies. We are developping kacq with the preemtive option found in the kernel version 3.4.4. Here are the steps to install that kernel.

  1. As a normal user, download the vanilla kernel from www.kernel.org and save the decompressed file in your home directory.

    cd ; wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.4.4.tar.bz2 tar -jxvf linux-3.4.4.tar.bz2

  2. Move in the new folder (eg, linux-3.4.4) and copy the .config file from the existing kernel. That config file should be suitable for the computer architecture and hardware you are currently using.

    cd linux-3.4.4 ; cp /boot/config-3.4.3-1.fc17.x86_64 .config

  3. Use the .config as the default for the new kernel options.

    make oldconfig

    Answer yes (y) or m to most questions if you are not sure. This command will update the .config file so that it is compatible with the new kernel. You might have to install ncurses-devel to run make oldconfig.

  4. Add the pre-emptive option in the kernel. Navigate in the menu of menuconfig, go in processor type and features, Preemption Model, set it to Preemptible Kernel (Low-Latency Desktop). You might have to install ncurses-devel to run make menuconfig.

    make menuconfig

  5. Compile the kernel.

    make or make -j 8 if you can run many processes in parallel.

  6. Install the new kernel. You need to be root to do that.

    make modules_install

    make install

  7. Set the new kernel as the default kernel in grub2.

    List the different choice

    grep ^menuentry /boot/grub2/grub.cfg | cut -d "'" -f2

    Set the desired default

    grub2-set-default "menuentry title"

    Apply the change

    grub2-mkconfig -o /boot/grub2/grub.cfg

  8. Reboot the computer and try to boot using the new kernel.

    shutdown -r now

  9. Run uname -a to know which kernel is presently running. If it is your new kernel, it means that you have sucessfully installed the new kernel.

    uname -a

  10. As root, make a symbolic link called linux in the /usr/src directory to the source directory of the new kernel. That will be used when installing comedi.

    ln -s ~/linux-3.4.4 /usr/src/linux

2.4 comedi and comedilib on Fedora 17

  1. Download the current comedi drivers from the git repositories. You might need to install git.

    git clone git://comedi.org/git/comedi/comedi.git

    git clone git://comedi.org/git/comedi/comedilib.git

  2. Go in the comedi directory and install the package. You might need to install autoconf and automake first.

    cd comedi; ./autogen.sh; ./configure; make

    As root cd comedi;make install; depmod -a

  3. Restart your computer. If the cards are installed in the computer, files like /dev/comedi0 should be created.
  4. Install comedilib with yum

    yum install comedilib-devel

  5. Configure your comedi devices. See http://www.comedi.org/doc/x333.html

    During our latest installation, this step was done automatically when rebooting.

    If it is not the case, this is what you have to do with a two NI PCI-6259 card setup. comedi_config /dev/comedi0 ni_pcimio comedi_config /dev/comedi1 ni_pcimio

    You might want to have permission to write and read on the files /dev/comedi0 and /dev/comedi1. This will allow you to run kacq as a normal user. To make that process automated on Fedora 17:

    touch /etc/rc.d/rc.local; chmod ugo+x /etc/rc.d/rc.local Add #!/bin/sh at the top of /etc/rc.d/rc.local echo "chown user_name /dev/comedi0; chgrp group_name /dev/comedi0 >> /etc/rc.d/rc.local"

2.5 gtk+

To be able to compile kacq, you also need the gtk+2 development kit.

yum install gtk2-devel

2.6 Installing kacq

  1. To get the latest development code, get the source from the CVS repository. You might have to install cvs on you computer if it is not there. Then just run the following command.

    cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/kacq co kacq

  2. Alternatively, you can download the latest freeze version from http://download.savannah.gnu.org/releases/kacq/
  3. Then you can configure, compile and install kacq the traditional way.

    cd kacq/kacq;./autogen.sh;./configure; make; su -; make install

If everything worked, you should have kacq installed on the computer.