Sample menu:

news:

11 Juni 2014:
hart_0.4.6 released!

sourceforge project site »

CSS ist valide!

Valid XHTML 1.0 Strict

SourceForge.net Logo

RTAI navigation

Installation RTAI

Packages:

UBUNTU 12.04 - 32 bit with comedi

Install the following packages to proceed:

Installation of all components

Installation 3.8.13 RTAI kernel

Taken from https://wiki.ubuntu.com/KernelTeam/GitKernelBuild and http://linuxcnc.org/seb/Notes.
sudo su
cd /usr/src/
cvs -d:pserver:anonymous@cvs.gna.org:/cvs/rtai co vulcano
sudo ln -s vulcano rtai
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cd linux-stable
git branch linux-3.8-rtai origin/linux-3.8.y
git checkout linux-3.8-rtai
git apply ../vulcano/base/arch/x86/patches/hal-linux-3.8.13-x86-4.patch
git commit -a -m 'applied the rtai patch hal-linux-3.8.13-x86-4.patch'
exit
Download the newest debian package linux-image-3.8.0-42-generic_3.8.0-42.62~precise1_i386.deb from https://launchpad.net/ubuntu/precise/i386/linux-image-3.8.0-42-generic/3.8.0-42.62~precise1 and save it to /usr/src
sudo su
cd /usr/src
dpkg-deb -x linux-image-3.8.0-35-generic_3.8.0-42.62~precise1_i386.deb linux-image
cp linux-image/boot/config-* linux-stable/.config
cd linux-stable
make menuconfig
Important: It is needed to deselect "Module versioning support" under "Enable loadable module support".
In the next step, a linux-image and a linux-headers debian packages containing the rtai kernel will be generated:
make -j `getconf _NPROCESSORS_ONLN` deb-pkg LOCALVERSION=-rtai
exit
Now install linux-image package and the linux-header package with dpkg
cd /usr/src
sudo dpkg -i linux-image-3.8.13-rtai_3.8.13-rtai-{x}_i386.deb
sudo dpkg -i linux-headers-3.8.13-rtai_3.8.13-rtai-{x}_i386.deb
The number {x} depends on how many linux-image-3.8.13-rtai and linux-headers-3.8.13-rtai deb packages are in /usr/src.
Reboot in the new installed RTAI-kernel.
By using this command it is possible to check, if the right kernel was loaded after a reboot:
uname -r
The output of uname -r should now contain rtai.

RTAI (https://www.rtai.org) (without Comedi Addon)

cd /usr/src/rtai
sudo make menuconfig
Ensure directories are correct:
sudo make
sudo make install
sed -i 's/\(PATH=\"\)/\1\/usr\/realtime\/bin:/' /etc/environment
now run export PATH=/usr/realtime/bin:$PATH for each open shell or do logout and login.

Comedi

sudo su
cd /usr/local/src/

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

Comedilib

sudo su
cd /usr/local/src/comedilib
sh autogen.sh
./configure
make
make install
mkdir /usr/local/include/linux
exit

Comedi

sudo su
cd /usr/local/src/comedi
sh autogen.sh
./configure --with-linuxdir=/usr/src/linux-headers-3.8.13-rtai --with-rtaidir=/usr/realtime
make
make install
make dev
ldconfig
exit

RTAI (with Comedi Addon)

sudo cp /usr/local/src/comedi/include/linux/comedi.h /usr/local/include/
sudo cp /usr/local/src/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

cd /usr/src/rtai
Under "Add-Ons", select "Real Time COMEDI support in user space"
sudo make menuconfig
/usr/src/rtai/addons/comedi/Makefile Must be edited as followed:
EXTRA_CFLAGS += -I$(rtai_srctree)/base/include \
-I$(rtai_srcdir) \
-I/usr/include \
-I/usr/local/src/comedi/include \
-I$(src)/../../base/include \
-I$(src)/../.. \
$(rtai_extradef) \
-D__IN_RTAI__

obj-m += rtai_comedi.o

rtai_comedi-objs := $(rtai_objs)
sudo su
make
make install
exit

Starting RTAI

now run export PATH=/usr/realtime/bin:$PATH for each open shell or do logout and login Now we need to load the rtai modules.
#!/bin/bash
/sbin/insmod /usr/realtime/modules/rtai_smi.ko
/sbin/insmod /usr/realtime/modules/rtai_hal.ko
/sbin/insmod /usr/realtime/modules/rtai_lxrt.ko
/sbin/insmod /usr/realtime/modules/rtai_fifos.ko
/sbin/insmod /usr/realtime/modules/rtai_sem.ko
/sbin/insmod /usr/realtime/modules/rtai_mbx.ko
/sbin/insmod /usr/realtime/modules/rtai_msg.ko
/sbin/insmod /usr/realtime/modules/rtai_netrpc.ko
/sbin/insmod /usr/realtime/modules/rtai_shm.ko
Copy the lines to /usr/local/bin/start_rtai
Do a sudo chmod a+x /usr/local/bin/start_rtai Now we need to load the comedi modules.
#!/bin/bash
cd /usr/local/src/comedi
make dev
ldconfig
cd ~
insmod /lib/modules/3.8.13-rtai/comedi/comedi.ko
insmod /lib/modules/3.8.13-rtai/comedi/kcomedilib/kcomedilib.ko
insmod /usr/realtime/modules/rtai_comedi.ko
insmod /lib/modules/3.8.13-rtai/comedi/drivers/comedi_fc.ko
comedi_config /dev/comedi0 your_comedi_card
chmod o+rw /dev/comedi*
chmod go+rw /dev/input/event*
Replace your_comedi_card with the name of your comedi card (e.g.: s626, jr3_pci, ....)
Copy the lines to /usr/local/bin/load_daq
Do a sudo chmod a+x /usr/local/bin/load_daq

SCILAB 5.4.1

cd /opt
sudo wget http://www.scilab.org/download/5.4.1/scilab-5.4.1.bin.linux-i686.tar.gz
sudo tar xvzf scilab-5.4.1.bin.linux-i686.tar.gz
sudo ln -s /opt/scilab-5.4.1/bin/scilab /usr/local/bin/scilab54

QRTAILab (www.qrtailab.sf.net)

(svn -version)

cd /usr/local/src
sudo svn checkout http://svn.code.sf.net/p/qrtailab/code/trunk qrtailab
cd qrtailab
Edit qrtailab.config and replace '/usr/include/qwt/' with '/usr/include/qwt-qt4/' and '-lqwt' with '-lqwt-qt4'
sudo qmake-qt4
sudo make
sudo make install

HART Toolbox (www.hart.sf.net)

Chose a directory (/home/username/software, ...)

(svn -version)

svn checkout http://svn.code.sf.net/p/hart/code/trunk hart-code
Go in your hart-directory.
Edit Makefile and set 'SCILAB = ...' to the binary file of scilab 5.4.1
Warning: sudo make will not install RTAI module! Either be a normal user and install HART or change to root (using sudo su) and then do make.
make
cd /...../scilab-xxx/contrib
sudo ln -s {link to hart-toolbox} .

It is important to add -o to your rtai executable in order get a good realtime! The default setting uses the periodic mode. The hard timer will run in oneshot mode when using the "-o" options, which works better for same systems and slow sampling rates (<10kHz).

Gratulation you are finished!