How to install RTAI 5.1 on Debian?

Guo Yunfei <[email protected]> Mon, 12 Feb 2018 21:23:23 +0800
Newsgroups gmane.linux.real-time.rtai
Message-ID <CAN_Un=UDoi3zuxNMZu67iHo50QXCr1Sd+bjF27MnpTAp3wn6mg@mail.gmail.com>
--===============0864077730765361727==
Content-Type: multipart/alternative; boundary="001a1143f9d0528bec056503c8e8"

--001a1143f9d0528bec056503c8e8
Content-Type: text/plain; charset="UTF-8"

Hi. everybody.

I always install RTAI 4.0 and RTAI 4.1 on Debian as below steps and using
it perfect.
When I install RTAI 5.1 as same steps.  the RTAI 5.1 can be make
successfully.
But the system not reponse after I test the latency by that "run " command.

Could some one give me a guide of installation of RTAI 5.1 on Debian?

Best Regards
Guo Yunfei

My steps:
//------------------------------------------
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 ->

# 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

lapic=notscdeadline

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
<https://twiki.eurecom.fr/twiki/bin/edit/OpenAirInterface/OpenAir?topicparent=OpenAirInterface.OpenAirKernel357Ubuntu1204x86Setups;nowysiwyg=0>
 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

/usr/realtime/lib

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

We will test the RTAI system via the latency test

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

//-----------------------------------------------------------------------------------------

--001a1143f9d0528bec056503c8e8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><span style=3D"color:rgb(0,0,0);font-family:&quot;Tim=
es New Roman&quot;;font-size:medium"><br></span></div><div><span style=3D"c=
olor:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium">H=
i. everybody.</span></div><div><span style=3D"color:rgb(0,0,0);font-family:=
&quot;Times New Roman&quot;;font-size:medium"><br></span></div><div><span s=
tyle=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:=
medium">I always install RTAI 4.0 and RTAI 4.1 on Debian as below steps and=
 using it perfect.</span></div><div><span style=3D"color:rgb(0,0,0);font-fa=
mily:&quot;Times New Roman&quot;;font-size:medium">When I install RTAI 5.1 =
as same steps. =C2=A0the RTAI 5.1 can be make successfully.</span></div><di=
v><span style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;f=
ont-size:medium">But the system not reponse after I test the latency by tha=
t &quot;run &quot; command.</span></div><div><span style=3D"color:rgb(0,0,0=
);font-family:&quot;Times New Roman&quot;;font-size:medium"><br></span></di=
v><div><span style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&qu=
ot;;font-size:medium">Could some one give me a guide of installation of RTA=
I 5.1 on Debian?</span></div><div><span style=3D"color:rgb(0,0,0);font-fami=
ly:&quot;Times New Roman&quot;;font-size:medium"><br></span></div><div><spa=
n style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-si=
ze:medium">Best Regards</span></div><div><span style=3D"color:rgb(0,0,0);fo=
nt-family:&quot;Times New Roman&quot;;font-size:medium">Guo Yunfei</span></=
div><div><span style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&=
quot;;font-size:medium"><br></span></div><span style=3D"color:rgb(0,0,0);fo=
nt-family:&quot;Times New Roman&quot;;font-size:medium"><div>My steps:<span=
 style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-siz=
e:medium"><br></span></div><div><span style=3D"color:rgb(0,0,0);font-family=
:&quot;Times New Roman&quot;;font-size:medium">//--------------------------=
----------------</span></div><div>This document describes how to install RT=
AI 4.0 on a Ubuntu 12.04.4 LTS using a 3.8.13 kernel, either 32bit or 64 bi=
t version.<br></div></span><h4 style=3D"color:rgb(0,0,0);font-family:&quot;=
Times New Roman&quot;;font-size:medium"><a name=3D"Prerequisites"></a>Prere=
quisites</h4><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman=
&quot;;font-size:medium">Install Ubuntu 12.04.4 using one of the following =
images:</p><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&q=
uot;;font-size:medium"><a href=3D"http://releases.ubuntu.com/precise/ubuntu=
-12.04.4-desktop-amd64.iso">http://releases.ubuntu.com/precise/ubuntu-12.04=
.4-desktop-amd64.iso</a></p><p style=3D"color:rgb(0,0,0);font-family:&quot;=
Times New Roman&quot;;font-size:medium"><a href=3D"http://releases.ubuntu.c=
om/precise/ubuntu-12.04.4-desktop-i386.iso">http://releases.ubuntu.com/prec=
ise/ubuntu-12.04.4-desktop-i386.iso</a></p><p style=3D"color:rgb(0,0,0);fon=
t-family:&quot;Times New Roman&quot;;font-size:medium">And then follow the =
installation instructions here:=C2=A0<a href=3D"https://help.ubuntu.com/com=
munity/Installation/">https://help.ubuntu.com/community/Installation/</a></=
p><h4 style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;fon=
t-size:medium"><a name=3D"Introduction"></a>Introduction</h4><p style=3D"co=
lor:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium">If=
 the ROOT user is not created yet, log as your usual user, open a terminal =
and type -&gt;</p><pre style=3D"color:rgb(0,0,0)"># sudo su -
# sudo passwd root
</pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium">Enter the password for the ROOT user. Log out and log in =
as Root.</p><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&=
quot;;font-size:medium">Open a terminal and update your package repository =
source file :</p><pre style=3D"color:rgb(0,0,0)"># apt-get update
</pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium">Some tools are required in order to set up the kernel (Yo=
u need to be connected to Internet)</p><pre style=3D"color:rgb(0,0,0)"># ap=
t-get -y install qt3-apps-dev build-essential kernel-package vim cvs
</pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium"></p><h4 style=3D"color:rgb(0,0,0);font-family:&quot;Times=
 New Roman&quot;;font-size:medium"><a name=3D"I_Kernel_source_and_RTAI_down=
loa"></a>I - Kernel source and RTAI download</h4><pre style=3D"color:rgb(0,=
0,0)"># cd /usr/src/</pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Ti=
mes New Roman&quot;;font-size:medium">Get the kernel source from <a href=3D=
"http://kernel.org">kernel.org</a></p><pre style=3D"color:rgb(0,0,0)"># wge=
t <a href=3D"https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.13.tar.=
bz2">https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.13.tar.bz2</a>
# tar xf linux-3.8.13.tar.bz2
</pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium">Get RTAI 4.0 from the RTAI homepage</p><pre style=3D"colo=
r:rgb(0,0,0)"># wget <a href=3D"https://www.rtai.org/userfiles/downloads/RT=
AI/rtai-4.0.tar.bz2">https://www.rtai.org/userfiles/downloads/RTAI/rtai-4.0=
.tar.bz2</a>
tar xf rtai-4.0.tar.bz2</pre><p style=3D"color:rgb(0,0,0);font-family:&quot=
;Times New Roman&quot;;font-size:medium"></p><h4 style=3D"color:rgb(0,0,0);=
font-family:&quot;Times New Roman&quot;;font-size:medium"><a name=3D"II_Ker=
nel_Preparation"></a>II - Kernel Preparation</h4><pre style=3D"color:rgb(0,=
0,0)"># cd /usr/src
# ln -s linux-3.8.13 linux
# cd linux </pre><h5 style=3D"color:rgb(0,0,0);font-family:&quot;Times New =
Roman&quot;"><a name=3D"Applying_patch"></a>Applying patch</h5><p style=3D"=
color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium">=
If you want first simulate the patch application, use &quot;--dry-run&quot;=
 after &quot;-p1&quot;. It won&#39;t touch any files on your computer, but =
you can see if you get Hunks or not.</p><pre style=3D"color:rgb(0,0,0)"># p=
atch -p1 &lt; /usr/src/rtai-4.0/base/arch/x86/patches/hal-linux-3.8.13-x86-=
4.patch
</pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium"></p><h5 style=3D"color:rgb(0,0,0);font-family:&quot;Times=
 New Roman&quot;"><a name=3D"Kernel_Configuration"></a>Kernel Configuration=
</h5><pre style=3D"color:rgb(0,0,0)"># cd /usr/src/linux</pre><p style=3D"c=
olor:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium">I=
n order to retrieve your current kernel configuration : (If at this step, q=
uestions are asked give the answer by default)</p><pre style=3D"color:rgb(0=
,0,0)"># make oldconfig</pre><p style=3D"color:rgb(0,0,0);font-family:&quot=
;Times New Roman&quot;;font-size:medium">Now we modify the kernel settings =
the way we need it (NOTE: some parameters cannot be disabled with xconfig -=
 better to use menuconfig):</p><pre style=3D"color:rgb(0,0,0)"># make xconf=
ig </pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quo=
t;;font-size:medium">Set up the kernel settings as follows :</p><p style=3D=
"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium"=
><strong>Processor type and features</strong></p><p style=3D"color:rgb(0,0,=
0);font-family:&quot;Times New Roman&quot;;font-size:medium">-&gt; Processo=
r family =3D=C2=A0<em>Select yours<br></em>-&gt; Maximum number of CPUs (NR=
_CPUS) =3D=C2=A0<em>Set your number (it&#39;s generally &quot;4&quot;)</em>=
<br>-&gt; SMT (Hyperthreading) scheduler support =3D=C2=A0<em>DISABLE IT</e=
m></p><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium"><strong>Power Management and ACPI options</strong><span s=
tyle=3D"background-color:transparent"></span></p><p style=3D"color:rgb(0,0,=
0);font-family:&quot;Times New Roman&quot;;font-size:medium">CPU idle PM su=
pport<br><span style=3D"background-color:transparent">-&gt; Cpu idle Driver=
 for Intel Processors =3D=C2=A0</span><em style=3D"background-color:transpa=
rent">DISABLE IT<br></em><span style=3D"background-color:transparent">-&gt;=
 ACPI (Advanced Configuration and Power Interface) Support -&gt; PROCESSOR =
=3D=C2=A0</span><em style=3D"background-color:transparent">DISABLE IT<br></=
em><span style=3D"background-color:transparent">-&gt; APM (Advanced Power M=
anagement) BIOS support =3D=C2=A0</span><em style=3D"background-color:trans=
parent">DISABLE IT<br></em><span style=3D"background-color:transparent">-&g=
t; CPU Frequency scaling -&gt; CPU Frequency scaling =3D=C2=A0</span><em st=
yle=3D"background-color:transparent">DISABLE IT<br></em><span style=3D"back=
ground-color:transparent">CPU idle PM support =3D DISABLE IT</span></p><p s=
tyle=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:=
medium">Save and Quit</p><p style=3D"color:rgb(0,0,0);font-family:&quot;Tim=
es New Roman&quot;;font-size:medium">Note (Sylvain, May 2014): these settin=
gs should be verified in the .config file, since there have been cases that=
 xconfig does not do it correctly.</p><h4 style=3D"color:rgb(0,0,0);font-fa=
mily:&quot;Times New Roman&quot;;font-size:medium"><a name=3D"III_Kernel_Co=
mpilation"></a><strong>III - Kernel Compilation</strong></h4><pre style=3D"=
color:rgb(0,0,0)"># cd /usr/src/linux
# make &amp;&amp; make modules_install &amp;&amp; make install</pre><p styl=
e=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:med=
ium">NOTE: The compilation time might be decreased by passing the flags -jX=
 (with X=3Dnumber of CPUs you have on your machine). This has for effect to=
 parallelize the kernel compilation between the CPUs. This will take ~1 hou=
r.</p><h5 style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;=
"><a name=3D"Kernel_Boot_Options"></a>Kernel Boot Options</h5><p style=3D"c=
olor:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium">T=
his 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!</p><p=
 style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-siz=
e:medium">You need to add the following option to the kernel at boot time</=
p><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font=
-size:medium"></p><pre style=3D"color:rgb(0,0,0)">lapic=3Dnotscdeadline</pr=
e><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font=
-size:medium">The best way to do this is in /etc/default/grub in the field =
GRUB_CMDLINE_LINUX_DEFAULT, i.e.,</p><p style=3D"color:rgb(0,0,0);font-fami=
ly:&quot;Times New Roman&quot;;font-size:medium"></p><pre style=3D"color:rg=
b(0,0,0)">GRUB_CMDLINE_LINUX_DEFAULT=3D&quot;quiet splash lapic=3Dnotscdead=
line&quot;</pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Ro=
man&quot;;font-size:medium">You will also have to change the GRUB_DEFAULT t=
o the number that corresponds to the new kernel.</p><p style=3D"color:rgb(0=
,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium">Finally run=
 update-grub and reboot</p><p style=3D"color:rgb(0,0,0);font-family:&quot;T=
imes New Roman&quot;;font-size:medium"></p><pre style=3D"color:rgb(0,0,0)">=
# update-grub
# reboot
</pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium"></p><h4 style=3D"color:rgb(0,0,0);font-family:&quot;Times=
 New Roman&quot;;font-size:medium"><a name=3D"IV_RTAI_installation"></a><st=
rong>IV - RTAI installation</strong></h4><p style=3D"color:rgb(0,0,0);font-=
family:&quot;Times New Roman&quot;;font-size:medium">Now that the system ha=
s restarted, make sure you booted on your new=C2=A0<span class=3D"gmail-twi=
kiNewLink"><a href=3D"https://twiki.eurecom.fr/twiki/bin/edit/OpenAirInterf=
ace/OpenAir?topicparent=3DOpenAirInterface.OpenAirKernel357Ubuntu1204x86Set=
ups;nowysiwyg=3D0" rel=3D"nofollow" title=3D"OpenAir (this topic does not y=
et exist; you can create it)">OpenAir</a></span>=C2=A0kernel</p><pre style=
=3D"color:rgb(0,0,0)"># uname -r </pre><p style=3D"color:rgb(0,0,0);font-fa=
mily:&quot;Times New Roman&quot;;font-size:medium">Should give you &quot;3.=
8.13&quot; as result</p><pre style=3D"color:rgb(0,0,0)"># cd /usr/src/rtai-=
4.0 =20
# make xconfig =20
</pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium">UPDATE the CPUs number according to your configuration an=
d disable RTAI_USE_NEWERR and real-time COMEDI support in Add-ons. Enable t=
he watchdog, CONFIG_RTAI_WD.</p><p style=3D"color:rgb(0,0,0);font-family:&q=
uot;Times New Roman&quot;;font-size:medium">Save and quit. If any error occ=
urs here, solve it and repeat this &quot;make xconfig&quot; step until it&#=
39;s OK</p><pre style=3D"color:rgb(0,0,0)"># make &amp;&amp; make install <=
/pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;f=
ont-size:medium">Add what follows, to the end of the file ~/.bashrc</p><pre=
 style=3D"color:rgb(0,0,0)">export PATH=3D/usr/realtime/bin:$PATH=20
export LD_LIBRARY_PATH=3D$LD_LIBRARY_PATH:/usr/realtime/lib
</pre><p style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium">Create a file /etc/ld.so.conf.d/rtai.conf with the conten=
t</p><pre style=3D"color:rgb(0,0,0)">/usr/realtime/lib</pre><p style=3D"col=
or:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium">and=
 run &quot;ldconfig&quot;in order to take it into account</p><p style=3D"co=
lor:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium">We=
 will test the RTAI system via the latency test</p><pre style=3D"color:rgb(=
0,0,0)"># cd /usr/realtime/testsuite/kern/latency =20
# ./run </pre><div>//------------------------------------------------------=
-----------------------------------</div></div>

--001a1143f9d0528bec056503c8e8--

--===============0864077730765361727==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Rtai mailing list
[email protected]
https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
--===============0864077730765361727==--