Skip to content

Instantly share code, notes, and snippets.

@cuihantao
Last active August 30, 2018 05:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cuihantao/81c515b62975a6ea635d0eabd3375d10 to your computer and use it in GitHub Desktop.
Save cuihantao/81c515b62975a6ea635d0eabd3375d10 to your computer and use it in GitHub Desktop.

Install RTAI 5.0-test2 on Ubuntu 14.04 Kernel 3.18.20

Preparation

download and unzip

cd /usr/src
curl -L --insecure https://www.rtai.org/userfiles/downloads/RTAI/rtai-5.0-test2.tar.bz2 | tar xj
curl -L https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.18.20.tar.xz | tar xJ
curl -L http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.18.20-vivid/linux-image-3.18.20-031820-generic_3.18.20-031820.201508081633_amd64.deb -o linux-image-3.18.20-generic-amd64.deb
dpkg-deb -x linux-image-3.18.20-generic-amd64.deb linux-image-3.18.20-generic-amd64

link (optional)

rm linux
rm rtai
ln -s linux-3.18.20 linux
ln -s rtai-5.0-test2 rtai

package requirement

update apt-get list

add-apt-repository ppa:danielrichter2007/grub-customizer
apt-get update

General:

apt-get -y install cvs subversion build-essential git-core g++-multilib gcc-multilib ncurses-dev vim

Rtai

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

scilab 5.5.0

apt-get -y 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

qrtailab

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

install grub customizer and show the grub menu

apt-get install grub-customizer

compile RTAI Linux kernel

copy ubuntu kernel 3.18 original config

cp /usr/src/linux-image-3.18.20-generic-amd64/boot/config-3.18.20-031820-generic /usr/src/linux/.config

patch for kernel

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

config

make menuconfig

Set up the kernel settings as follows

Enable Loadable Module Support
        -> Module Versioning Support = DISABLE IT
Processor type and features
	-> SMT (Hyperthreading) scheduler support = DISABLE IT
Power Management and ACPI options
	-> ACPI (Advanced Configuration and Power Interface) Support -> PROCESSOR = DISABLE IT
	-> CPU Frequency scaling -> CPU Frequency scaling = DISABLE IT
	-> Cpu idle --> CPU idle PM support --> DISABLE IT

build

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

install

dpkg -i ../linux-image-3.18.20-rtai_3.18.20-rtai-1_amd64.deb
dpkg -i ../linux-headers-3.18.20-rtai_3.18.20-rtai-1_amd64.deb

modify /etc/default/grub, set GRUB_CMDLINE_LINUX_DEFAULT as:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash lapic=notscdeadline"

apply grub config

update-grub

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 print:

3.18.20-rtai

config RTAI

cd /usr/src/rtai
make menuconfig

UPDATE the CPUs number according to your configuration.

build

make -j `getconf _NPROCESSORS_ONLN`

install

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/ld.so.conf.d/rtai.conf with the content

/usr/realtime/lib

run ldconfigin order to take it into account

ldconfig

Now, run latency test:

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

RTAI-LAB Installation

   sudo apt-get -y install doxygen bison cvs subversion build-essential automake checkinstall x11proto-xext-dev libfontenc-dev libfreetype6-dev libx11-dev libxdmcp-dev libxfont-dev x11proto-fonts-dev x11proto-kb-dev xtrans-dev zlib1g-dev libxext-dev libxt-dev gettext libncurses5-dev fakeroot kernel-package swig python-dev libtool libboost-program-options-dev libgsl0-dev libxmu-dev libxi-dev xutils-dev libtalloc-dev libdrm-dev x11proto-dri2-dev x11proto-gl-dev libxdamage-dev

Install MesaLib

MesaLib is needed by EFLTK. Get MesaLib source from its FTP:

mkdir ~/src
cd ~/src
wget ftp://ftp.freedesktop.org/pub/mesa/older-versions/7.x/7.10/MesaLib-7.10.tar.bz2
tar jxvf MesaLib-7.10.tar.bz2
cd Mesa-7.10

Make and install MesaLib:

make clean
./configure
make -j `getconf _NPROCESSORS_ONLN`
sudo make install

Install EFLTK

EFLTK is needed by xrtailab. Get EFLTK from here:

cd ~/src
wget http://sourceforge.net/projects/ede/files/efltk/2.0.8/efltk-2.0.8.tar.gz/download -O efltk-2.0.8.tar.gz
tar zxvf efltk-2.0.8.tar.gz

Start configuration and installation:

cd efltk
sed -i '62s:void\*:dirent \**:g' src/core/filename_list.cpp
sed -i '68,69s:=":+=" :' configure.in
autoconf
./configure --disable-mysql --disable-unixODBC
./emake
sudo ./emake install

RTAI-LAB installation

Configure RTAI and select to install RTAI:

cd /usr/src/rtai
make menuconfig

Under menu RTAI, select RTAI-Installation. Use the default EFLTK path. Under general options select the inline to be "eager".

Scilab config

cd ~/src
curl -L http://www.scilab.org/download/5.3.0/scilab-5.3.0.bin.linux-x86_64.tar.gz |tar zx

Every RTAI-Lab user must edit $HOME$/.Scilab/scilab-5.x.x/.scilab with:

load('/usr/src/rtai/rtai-lab/scicoslab/macros/RTAI/')
scicos_pal($+1,:)=['RTAI-Lib','RTAI-Lib.cosf'];

To add Scilab to the executable path you must either: cd /usr/local/bin ln -s /usr/local/scilab-5.x.x/bin/scilab scilab or add /usr/local/src/scilab-4.x.x/bin to the PATH variable in your .bash profile and/or .bashrc or relevant shell start-up file.

Install Comedi

apt-get flex bison byacc
sudo apt-get install libxmu-dev libxi-dev

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
makev make install
mkdir /usr/local/include/linux
exit

Reference:

@samar-gargouri11
Copy link

Hello sir
in this step
cd /usr/realtime/testsuite/kern/latency
./run
i have this problem :

  • Type ^C to stop this application.

insmod: ERROR: could not insert module /usr/realtime/modules/rtai_hal.ko: Invalid module format
ERROR: cannot load /usr/realtime/modules/rtai_hal.ko
insmod: ERROR: could not insert module /usr/realtime/modules/latency_rt.ko: Invalid module format
ERROR: cannot load /usr/realtime/modules/latency_rt.ko
Error opening /dev/rtf1

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