create new tag
, view all tags
This document describes how to install RTAI 4.0 on a Ubuntu 12.04.4 LTS using a 3.8.13 kernel, either 32bit or 64 bit version.


Install Ubuntu 12.04.4 using one of the following images:



And then follow the installation instructions here: https://help.ubuntu.com/community/Installation/


If the ROOT user is not created yet, log as your usual user, open a terminal and type ->

# sudo su -
# sudo passwd root

Enter the password for the ROOT user. Log out and log in as Root.

Open a terminal and update your package repository source file :

# apt-get update

Some tools are required in order to set up the kernel (You need to be connected to Internet)

# apt-get -y install qt3-apps-dev build-essential kernel-package vim cvs

I - Kernel source and RTAI download

# cd /usr/src/

Get the kernel source from kernel.org

# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.13.tar.bz2
# tar xf linux-3.8.13.tar.bz2

Get RTAI 4.0 from the RTAI homepage

# wget https://www.rtai.org/userfiles/downloads/RTAI/rtai-4.0.tar.bz2
tar xf rtai-4.0.tar.bz2

II - Kernel Preparation

# cd /usr/src
# ln -s linux-3.8.13 linux
# cd linux 
Applying patch

If you want first simulate the patch application, use "--dry-run" after "-p1". It won't touch any files on your computer, but you can see if you get Hunks or not.

# patch -p1 < /usr/src/rtai-4.0/base/arch/x86/patches/hal-linux-3.8.13-x86-4.patch

Kernel Configuration
# cd /usr/src/linux

In order to retrieve your current kernel configuration : (If at this step, questions are asked give the answer by default)

# make oldconfig

Now we modify the kernel settings the way we need it (NOTE: some parameters cannot be disabled with xconfig - better to use menuconfig):

# make xconfig 

Set up the kernel settings as follows :

Processor type and features

-> Processor family = Select yours
-> Maximum number of CPUs (NR_CPUS) = Set your number (it's generally "4")
-> SMT (Hyperthreading) scheduler support = DISABLE IT

Power Management and ACPI options

CPU idle PM support
-> Cpu idle Driver for Intel Processors = DISABLE IT
-> ACPI (Advanced Configuration and Power Interface) Support -> PROCESSOR = DISABLE IT
-> APM (Advanced Power Management) BIOS support = DISABLE IT
-> CPU Frequency scaling -> CPU Frequency scaling = DISABLE IT
CPU idle PM support = DISABLE IT

Save and Quit

Note (Sylvain, May 2014): these settings should be verified in the .config file, since there have been cases that xconfig does not do it correctly.

III - Kernel Compilation

# cd /usr/src/linux
# make && make modules_install && make install

NOTE: The compilation time might be decreased by passing the flags -jX (with X=number of CPUs you have on your machine). This has for effect to parallelize the kernel compilation between the CPUs. This will take ~1 hour.

Kernel Boot Options

This is very important - it took us (and the guys at the RTAI mailing list) ages to find that special config that makes everything work smoothly!

You need to add the following option to the kernel at boot time


The best way to do this is in /etc/default/grub in the field GRUB_CMDLINE_LINUX_DEFAULT, i.e.,

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash lapic=notscdeadline"

You will also have to change the GRUB_DEFAULT to the number that corresponds to the new kernel.

Finally run update-grub and reboot

# update-grub
# reboot

IV - RTAI installation

Now that the system has restarted, make sure you booted on your new OpenAir kernel

# uname -r 

Should give you "3.8.13" as result

# cd /usr/src/rtai-4.0  
# make xconfig  

UPDATE the CPUs number according to your configuration and disable RTAI_USE_NEWERR and real-time COMEDI support in Add-ons. Enable the watchdog, CONFIG_RTAI_WD.

Save and quit. If any error occurs here, solve it and repeat this "make xconfig" step until it's OK

# make && make install 

Add what follows, to the end of the file ~/.bashrc

export PATH=/usr/realtime/bin:$PATH 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/realtime/lib

Create a file /etc/ld.so.conf.d/rtai.conf with the content


and run "ldconfig"in order to take it into account

For OpenAir code compilation, we need to create the following symbolic link :

ln -s /usr/src/linux-3.8.13/include/generated/autoconf.h /lib/modules/3.8.13/build/include/linux/autoconf.h

We will test the RTAI system via the latency test

# cd /usr/realtime/testsuite/kern/latency  
# ./run 

If the test fails to start, it could be related to a bad RTAI configuration. Check error messages with "dmesg".
You should have absolutely no overrun and the "lat-max" column values should not exceed 45 000ns.

-- FlorianKaltenberger - 12 Mar 2014

Topic revision: r12 - 14 Dec 2014 - FlorianKaltenberger
Copyright 2004-2010 Institut Eurecom & all contributing authors.