|
|
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.
|
|
|
---++++ Prerequisites
|
|
|
|
|
|
Install Ubuntu 12.04.4 using one of the following images:
|
|
|
|
|
|
http://releases.ubuntu.com/precise/ubuntu-12.04.4-desktop-amd64.iso
|
|
|
|
|
|
http://releases.ubuntu.com/precise/ubuntu-12.04.4-desktop-i386.iso
|
|
|
|
|
|
And then follow the installation instructions here: https://help.ubuntu.com/community/Installation/
|
|
|
---++++ Introduction
|
|
|
|
|
|
If the ROOT user is not created yet, log as your usual user, open a terminal and type ->
|
|
|
<verbatim># sudo su -
|
|
|
# sudo passwd root
|
|
|
</verbatim>
|
|
|
|
|
|
Enter the password for the ROOT user. Log out and log in as Root.
|
|
|
|
|
|
Open a terminal and update your package repository source file :
|
|
|
<verbatim># apt-get update
|
|
|
</verbatim>
|
|
|
|
|
|
Some tools are required in order to set up the kernel (You need to be connected to Internet)
|
|
|
<verbatim># apt-get -y install qt3-apps-dev build-essential kernel-package vim cvs
|
|
|
</verbatim>
|
|
|
|
|
|
---++++ I - Kernel source and RTAI download
|
|
|
<verbatim># cd /usr/src/</verbatim>
|
|
|
|
|
|
Get the kernel source from kernel.org
|
|
|
<verbatim># wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.13.tar.bz2
|
|
|
# tar xf linux-3.8.13.tar.bz2
|
|
|
</verbatim>
|
|
|
|
|
|
Get RTAI 4.0 from the RTAI homepage
|
|
|
<verbatim># wget https://www.rtai.org/userfiles/downloads/RTAI/rtai-4.0.tar.bz2
|
|
|
tar xf rtai-4.0.tar.bz2</verbatim>
|
|
|
|
|
|
---++++ II - Kernel Preparation
|
|
|
<verbatim># cd /usr/src
|
|
|
# ln -s linux-3.8.13 linux
|
|
|
# cd linux </verbatim>
|
|
|
---+++++ 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.
|
|
|
<verbatim># patch -p1 < /usr/src/rtai-4.0/base/arch/x86/patches/hal-linux-3.8.13-x86-4.patch
|
|
|
</verbatim>
|
|
|
|
|
|
---+++++ Kernel Configuration
|
|
|
<verbatim># cd /usr/src/linux</verbatim>
|
|
|
|
|
|
In order to retrieve your current kernel configuration : (If at this step, questions are asked give the answer by default)
|
|
|
<verbatim># make oldconfig</verbatim>
|
|
|
|
|
|
Now we modify the kernel settings the way we need it (NOTE: some parameters cannot be disabled with xconfig - better to use menuconfig):
|
|
|
<verbatim># make xconfig </verbatim>
|
|
|
|
|
|
Set up the kernel settings as follows :
|
|
|
|
|
|
*Processor type and features*
|
|
|
|
|
|
-> Processor family = <em>Select yours<br /></em>-> Maximum number of CPUs (NR_CPUS) = <em>Set your number (it's generally "4")</em><br />-> SMT (Hyperthreading) scheduler support = _DISABLE IT_
|
|
|
|
|
|
*Power Management and ACPI options* <span style="background-color: transparent;"> </span>
|
|
|
|
|
|
CPU idle PM support<br /><span style="background-color: transparent;">-> Cpu idle Driver for Intel Processors = </span><em style="background-color: transparent;">DISABLE IT<br /></em><span style="background-color: transparent;">-> ACPI (Advanced Configuration and Power Interface) Support -> PROCESSOR = </span><em style="background-color: transparent;">DISABLE IT<br /></em><span style="background-color: transparent;">-> APM (Advanced Power Management) BIOS support = </span><em style="background-color: transparent;">DISABLE IT<br /></em><span style="background-color: transparent;">-> CPU Frequency scaling -> CPU Frequency scaling = </span><em style="background-color: transparent;">DISABLE IT<br /></em><span style="background-color: transparent;">CPU idle PM support = DISABLE IT</span>
|
|
|
|
|
|
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*
|
|
|
<verbatim># cd /usr/src/linux
|
|
|
# make && make modules_install && make install</verbatim>
|
|
|
|
|
|
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
|
|
|
|
|
|
<verbatim>lapic=notscdeadline</verbatim>
|
|
|
|
|
|
The best way to do this is in /etc/default/grub in the field GRUB_CMDLINE_LINUX_DEFAULT, i.e.,
|
|
|
|
|
|
<verbatim>GRUB_CMDLINE_LINUX_DEFAULT="quiet splash lapic=notscdeadline"</verbatim>
|
|
|
|
|
|
You will also have to change the GRUB_DEFAULT to the number that corresponds to the new kernel.
|
|
|
|
|
|
Finally run update-grub and reboot
|
|
|
|
|
|
<verbatim>
|
|
|
# update-grub
|
|
|
# reboot
|
|
|
</verbatim>
|
|
|
|
|
|
---++++ *IV - RTAI installation*
|
|
|
|
|
|
Now that the system has restarted, make sure you booted on your new OpenAir kernel
|
|
|
<verbatim># uname -r </verbatim>
|
|
|
|
|
|
Should give you "3.8.13" as result
|
|
|
<verbatim># cd /usr/src/rtai-4.0
|
|
|
# make xconfig
|
|
|
</verbatim>
|
|
|
|
|
|
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
|
|
|
<verbatim># make && make install </verbatim>
|
|
|
|
|
|
Add what follows, to the end of the file ~/.bashrc
|
|
|
<verbatim>export PATH=/usr/realtime/bin:$PATH
|
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/realtime/lib
|
|
|
</verbatim>
|
|
|
|
|
|
Create a file /etc/ld.so.conf.d/rtai.conf with the content
|
|
|
<verbatim>/usr/realtime/lib</verbatim>
|
|
|
|
|
|
and run "ldconfig"in order to take it into account
|
|
|
|
|
|
For OpenAir code compilation, we need to create the following symbolic link :
|
|
|
<verbatim>ln -s /usr/src/linux-3.8.13/include/generated/autoconf.h /lib/modules/3.8.13/build/include/linux/autoconf.h</verbatim>
|
|
|
|
|
|
We will test the RTAI system via the latency test
|
|
|
<verbatim># cd /usr/realtime/testsuite/kern/latency
|
|
|
# ./run </verbatim>
|
|
|
|
|
|
If the test fails to start, it could be related to a bad RTAI configuration. Check error messages with "dmesg".<br />You should have absolutely no overrun and the "lat-max" column values should not exceed 45 000ns.
|
|
|
|
|
|
-- User.FlorianKaltenberger - 12 Mar 2014 |