您的位置:首页 > 大数据 > 人工智能

RTAI installation for Ubuntu 14.04

2015-04-08 08:20 239 查看
It bothered me a lot ……. So I just post it up to help others.

Preparation

if the kernel is not 3.16/14/12/8

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-utopic/linux-headers-3.16.0-031600_3.16.0-031600.201408031935_all.deb wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-utopic/linux-headers-3.16.0-031600-generic_3.16.0-031600.201408031935_amd64.deb wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-utopic/linux-image-3.16.0-031600-generic_3.16.0-031600.201408031935_amd64.deb sudo dpkg -i linux-headers-3.16*.deb linux-image-3.16*.deb
sudo reboot
uname -r


It should appear 3.16.0-031600-generic. [Skip this step if it already is.]

download and unzip

cd /usr/src
curl -L https://www.rtai.org/userfiles/downloads/RTAI/rtai-4.1.tar.bz2 | tar xj
curl -L https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.16.tar.xz | tar xJ
curl -L http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.16-utopic/linux-image-3.16.0-031600-generic_3.16.0-031600.201408031935_amd64.deb -o linux-image-3.16.0-generic-amd64.deb
dpkg-deb -x linux-image-3.16.0-generic-amd64.deb linux-image-3.16.0-generic-amd64


link (optional)

ln -s linux-3.16 linux
ln -s rtai-4.1 rtai


package requirement

update apt-get list

apt-get update


General:

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


Rtai

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


qrtailab

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


compile RTAI Linux kernel

copy ubuntu kernel 3.16 original config

cp /usr/src/linux-image-3.16.0-generic-amd64/boot/config-3.16.0-031600-generic /usr/src/linux/.config


patch for kernel

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


config

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
ACPI (Advanced Configuration and Power Interface) Support  = DISABLE IT
CPU idle PM support = DISABLE IT


build

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


install

cd ..
dpkg -i linux-image-3.16.0-rtai_3.16.0-rtai-1_amd64.deb
dpkg -i linux-headers-3.16.0-rtai_3.16.0-rtai-1_amd64.deb


modify grub config, set GRUB_CMDLINE_LINUX_DEFAULT as:

vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash lapic=notscdeadline"
GRUB_DEFAULT="1>2"


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

3.16.0-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)

vim ~/.bashrc
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

vim /etc/ld.so.conf.d/rtai.conf
/usr/realtime/lib


run
ldconfig
in order to take it into account

ldconfig


Now, run latency test:

cd /usr/realtime/testsuite/kern/latency
./run
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux rtai