Skip to content

Instantly share code, notes, and snippets.

Last active March 17, 2019 10:31
Show Gist options
  • Save gaoyifan/c881aa36cd02fb5c1c20 to your computer and use it in GitHub Desktop.
Save gaoyifan/c881aa36cd02fb5c1c20 to your computer and use it in GitHub Desktop.
RTAI installation for ubuntu 14.04

RTAI installation for ubuntu 14.04


download and unzip

cd /usr/src
curl -L | tar xj
curl -L | tar xJ
curl -L -o linux-image-3.10.32-generic-amd64.deb
dpkg-deb -x linux-image-3.10.32-generic-amd64.deb linux-image-3.10.32-generic-amd64

link (optional)

ln -s linux-3.10.32 linux
ln -s rtai-4.1 rtai

package requirement

update apt-get list

apt-get update


apt-get install cvs subversion build-essential git-core g++-multilib gcc-multilib bc


apt-get install libtool automake libncurses5-dev kernel-package

scilab 5.5.0

apt-get install default-jre docbook-xsl fop javahelp2 libavalon-framework-java libbatik-java libfftw3-3 libflexdock-java libgfortran3 libhdf5-7 libjeuclid-core-java libjgoodies-looks-java libjgraphx-java libjhdf5-java libjlatexmath-fop-java libjlatexmath-java libjogl-java libjrosetta-java liblapack3gf libncurses5 libpcre3 libpvm3 libquadmath0 libsaxon-java libskinlf-java libstdc++6 libtinfo5 libxml2 tcl8.5 tk8.5 zlib1g libgcc1 libc6 libblas-dev libblas3gf libatlas3gf-base gfortran liblapack-dev


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

compile RTAI Linux kernel

copy ubuntu kernel 3.10 original config

cp /usr/src/linux-image-3.10.32-generic-amd64/boot/config-3.10.32-031032-generic /usr/src/linux/.config

patch for kernel

cd /usr/src/linux
patch -p1 < /usr/src/rtai/base/arch/x86/patches/hal-linux-3.10.32-x86-5.patch


make menuconfig

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 = DISABLE IT


make -j `getconf _NPROCESSORS_ONLN` deb-pkg LOCALVERSION=-rtai 


dpkg -i linux-image-3.10.32-rtai_3.10.32-rtai-1_amd64.deb
dpkg -i linux-headers-3.10.32-rtai_3.10.32-rtai-1_amd64.deb

modify grub config, set GRUB_CMDLINE_LINUX_DEFAULT as:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash lapic=notscdeadline"

apply grub config


Now, reboot your system. choose the RTAI in GRUB boot menu.

RTAI installation

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

uname -r 

it should show:


config RTAI

cd /usr/src/rtai
make menuconfig

UPDATE the CPUs number according to your configuration.


make -j `getconf _NPROCESSORS_ONLN`


make install

add following line to your ~/.bashrc (if you use bash)

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

use new environment variable

source ~/.bashrc

Create a file /etc/ with the content


run ldconfigin order to take it into account


Now, run latency test:

cd /usr/realtime/testsuite/kern/latency
Copy link

Hi thanks for your perfect guidance. i faced with a problem when i try to open built kernel in reboot in vmware virtual machine could you please do help me with following error
"The CPU has been disabled by the guest operating system"
thanks.i am awaiting to hearing from you soon

Copy link

ozz86 commented Nov 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment