User Tools

Site Tools


installing_rtai_comedi_scicoslab_qrtailab_on_ubuntu_9.04

Introduction

This guide will help you compile and install all the packages needed to use RTAI with Comedi, ScicosLab and qRtaiLab on an Ubuntu Jaunty machine. Always check if newer versions can be found on their websites, and adjust commands as required.

Dependencies

General:

sudo apt-get install cvs subversion build-essential

Kernel:

sudo apt-get install kernel-package linux-source libncurses5-dev

RTAI:

sudo apt-get install libtool automake

Comedi-lib:

sudo apt-get install bison flex

Comedi-calibrate:

sudo apt-get install libboost-dev libboost-program-options-dev libgsl0-dev

ScicosLab:

sudo apt-get install libgtk2.0-dev libgail18 gfortran

Qrtailab:

sudo apt-get install libqt4-dev libqwt5-qt4-dev

Getting the source code

Kernel sources ([http://www.kernel.org kernel.org]):

cd /usr/src

sudo wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.28.9.tar.bz2

sudo tar xjvf linux-2.6.28.9.tar.bz2

sudo ln -s linux-2.6.28.9 linux

RTAI ([http://www.rtai.org rtai.org] cvs-version):

cd /usr/src

sudo cvs -d:pserver:anonymous@cvs.gna.org:/cvs/rtai co magma

sudo ln -s magma rtai

RTAI ([http://www.rtai.org rtai.org] tar.gz-version). You have to use version 3.7 or newer, because older versions are not compatible with gcc 4.3.3:

cd /usr/src

sudo wget --no-check-certificate https://www.rtai.org/RTAI/rtai-3.8.tar.bz2

sudo tar xjvf rtai-3.8.tar.bz2

sudo ln -s rtai-3.8 rtai

COMEDI ([http://www.comedi.org comedi.org]):

cd /opt

sudo cvs -d :pserver:anonymous@cvs.comedi.org:/cvs/comedi login

sudo cvs -d :pserver:anonymous@cvs.comedi.org:/cvs/comedi co comedi

sudo cvs -d :pserver:anonymous@cvs.comedi.org:/cvs/comedi co comedilib

sudo cvs -d :pserver:anonymous@cvs.comedi.org:/cvs/comedi co comedi_calibrate

sudo cvs -d :pserver:anonymous@cvs.comedi.org:/cvs/comedi co comedi-nonfree-firmware

ScicosLab ([http://www.scicoslab.org scicoslab.org]):

cd /opt

sudo wget http://cermics.enpc.fr/~jpc/scilab-gtk-tiddly/files/scicoslab-gtk_4.3-3_i386.jaunty.deb

QRTAILab ([http://www.qrtailab.sf.net qrtailab.sf.net] svn - version):

cd /opt

sudo svn co https://qrtailab.svn.sourceforge.net/svnroot/qrtailab/trunk qrtailab

or:

QRTAILab ([http://www.qrtailab.sf.net qrtailab.sf.net] tar.gz - version):

cd /opt

sudo wget http://downloads.sourceforge.net/qrtailab/QRtaiLab-0.1.9.tar.gz

sudo tar xvzf QRtaiLab-0.1.9.tar.gz

Kernel creation

Patching the kernel

Patch the Linux kernel so it will run in real time mode:

cd /usr/src/linux

sudo su

patch -p1 < /usr/src/rtai/base/arch/x86/patches/hal-linux-2.6.28.9-x86-2.2-07.patch

Getting your kernel configuration

At first you should find out which architecture are you using:

dpkg --print-architecture

For i386: A sample config-file for i386 is available from [http://hart.sourceforge.net/files/config-2.6.28-rtai_i386 here]:

cd /usr/src/linux

sudo wget http://hart.sourceforge.net/files/config-2.6.28-rtai_i386

sudo cp config-2.6.28-rtai_i386 .config

But it’s better if you just copy the configuration file from your running kernel:

sudo cp /boot/gedit config-`uname -r` .config

For amd64: Sorry, there is no sample config file.

Kernel configuration

Go ahead and configure your kernel before you compile it:

cd /usr/src/linux

sudo make menuconfig

Run lspci on a separate console window, refer to it to select the appropriate option on the kernel configuration, mostly related to manufacturer (e.g.: SATA Controller from Intel or VIA). Check and change if needed the following points:

*Inside Processor type and features: Symmetric multi-processing support (multiprocessor) Processor family *Inside Device Drivers: Network device support → Ethernet (XXXX Mbit) Network device support → Wlan Graphics support → /dev/agpgart (AGP Support) Sound card support → Advanced Linux Sound Architecture → PCI sound devices

We used a server with two Xeon 1.7 GHz processors, so we checked that:

[*] Symmetric multi-processing support 

and

(X) Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon

looked like this:

Processor family (Pentium-4/Celeron(P4-based)/Pentium-4 M/older Xeon

Compiling the kernel

cd /usr/src/linux

sudo make-kpkg clean

sudo make-kpkg --initrd kernel_image kernel_headers kernel_source

Kernel installation

i386:

cd /usr/src

sudo dpkg -i linux-headers-2.6.28.9-rtai_2.6.28.9-rtai-10.00.Custom_i386.deb

sudo dpkg -i linux-image-2.6.28.9-rtai_2.6.28.9-rtai-10.00.Custom_i386.deb

amd64:

cd /usr/src

sudo dpkg -i linux-headers-2.6.28.9-rtai_2.6.28.9-rtai-10.00.Custom_amd64.deb

sudo dpkg -i linux-image-2.6.28.9-rtai_2.6.28.9-rtai-10.00.Custom_amd64.deb

Reboot in the new compiled RTAI kernel.

sudo reboot

Installing RTAI

You need to do this twice do to dependencies.

RTAI #1

cd /usr/src/rtai

sudo make menuconfig

Be sure that the directories are correct: *Installation: /usr/realtime *Kernel source: /usr/src/linux *Under Machine, choose number of CPUs (check running cat /proc/cpuinfo and verifying how many processors are listed, we chose 2)

Note: with kernel 2.26.3 it was also required to unselect “In-Kernel C++ Support” under “Add-Ons”

Compile RTAI:

sudo make

sudo make install

sudo sed -i 's/\(PATH=\"\)/\1\/usr\/realtime\/bin:/' /etc/environment

Now run 'export PATH=/usr/realtime/bin:$PATH' for each open shell or do a logout and login.

Test RTAI:

cd /usr/realtime/testsuite/kern/latency

./run

Type ctrl-c to stop execution.

= Installing Comedi= In order to install Comedi, you need to install Comedilib and Comedi-calibrate.

Comedilib:

cd /opt/comedilib

sudo sh autogen.sh

sudo ./configure --with-udev-hotplug=/lib --sysconfdir=/etc

sudo make

sudo make install

Comedi-calibrate:

cd /opt/comedi_calibrate

sudo autoreconf -i -B m4

sudo ./configure

sudo make

sudo make install

To calibrate your card, use comedi_calibrate, or comedi_soft_calibrate if you have a M-series NI card.

Comedi:

cd /opt/comedi

sudo sh autogen.sh

sudo ./configure --with-linuxdir=/usr/src/linux --with-rtaidir=/usr/realtime --enable-pci --disable-pcmcia

sudo make

sudo make install

sudo make dev

This is necessary for pcmcia-daq-cards (enable pcmcia in past configure command):

sudo su

echo 'options comedi comedi_num_legacy_minors=4' > /etc/modprobe.d/comedi

exit

Installing RTAI + Comedi

Now you can go ahead and reinstall RTAI with Comedi support.

RTAI #2

cd /usr/src/rtai

sudo make menuconfig

Under “Add-Ons”, select:

[*] Real Time COMEDI support in user space

Menu RTAI-Lab:

[*] RTAI Lab 

Adjust EFLTK installation directory (default is /usr/local). Exit menuconfig and save configuration. Now do:

sudo cp /opt/comedi/include/linux/comedi.h /usr/local/include/

sudo cp /opt/comedi/include/linux/comedilib.h /usr/local/include/

sudo ln -s /usr/local/include/comedi.h /usr/local/include/linux/comedi.h

sudo ln -s /usr/local/include/comedilib.h /usr/local/include/linux/comedilib.h

sudo make

sudo make install

Test RTAI

Create a shell script

cd

nano load_rtai.sh

and copy the following with “Crtl+Shift v”:

insmod /usr/realtime/modules/rtai_hal.ko
insmod /usr/realtime/modules/rtai_lxrt.ko 
insmod /usr/realtime/modules/rtai_up.ko        # or rtai_lxrt.ko
insmod /usr/realtime/modules/rtai_fifos.ko
insmod /usr/realtime/modules/rtai_sem.ko
insmod /usr/realtime/modules/rtai_mbx.ko
insmod /usr/realtime/modules/rtai_msg.ko
insmod /usr/realtime/modules/rtai_netrpc.ko ThisNode="127.0.0.1"
insmod /usr/realtime/modules/rtai_shm.ko
insmod /usr/realtime/modules/rtai_tasklets.ko
modprobe comedi
modprobe kcomedilib
modprobe comedi_fc
modprobe ni_pcimio
insmod /usr/realtime/modules/rtai_comedi.ko

Close it, make it executable and run it:

sudo chmod 777 load_rtai.sh

sudo sh load_rtai.sh 

Finally, run the test:

cd /usr/realtime/testsuite/kern/latency

./run

Type ctrl-c to stop execution.

ScicosLab + RTAI-Lab add-ons

Install ScicosLab:

cd /opt

sudo dpkg -i /tmp/scicoslab-gtk_4.3-3_i386.jaunty.deb

Install RTAI-Lab add-ons as root and as user:

cd /usr/local/src/rtai/rtai-lab/scilab/
sudo make install # to install rtmain.c in /usr/realtime/share/rtai/scicos
cd ../scicoslab/macros
sudo su -c "make install"
make user

References

installing_rtai_comedi_scicoslab_qrtailab_on_ubuntu_9.04.txt · Last modified: 2017/01/03 21:29 by admin