Debian_Etch_Compile_RTAI - rmu75/linuxcnc-wiki GitHub Wiki
This page describes how to prepare Debian Etch to compile RTAI
su - cd /etc/init.d touch rtai-dev chmod 755 rtai-dev update-rc.d rtai-dev start 30 2 3 4 5 . |
Edit /etc/init.d/rtai-dev with your favorite editor.
#!/bin/sh -e |
To test the script, run it:
/etc/init.d/rtai-dev |
PC speaker module causes some problems for RTAI in some machines. Therefore, it's a good idea to disable it.
As root, do the followings:
echo install pcspkr /bin/true >/etc/modprobe.d/rtai |
FIX: Debian team decided to release Debian Etch with 2.6.18 kernel. Therefore, linux-source-2.6.17
and linux-patch-debian-2.6.17 packages are removed from repository. But there is no RTAI hal patch for 2.6.18
kernel. So, we need to use 2.6.17 packages. Firstly, download linux-source-2.6.17_2.6.17-9_all.deb and linux-patch-debian-2.6.17_2.6.17-9_all.deb packages. Then install them. dpkg -i linux-source-2.6.17_2.6.17-9_all.deb dpkg -i linux-patch-debian-2.6.17_2.6.17-9_all.deb MD5 d0c0ab8ef2dfe5213abe21782b1574b9 linux-source-2.6.17_2.6.17-9_all.deb 67bd1cd4e6bb4fb9b1656b1dd7478053 linux-patch-debian-2.6.17_2.6.17-9_all.deb |
apt-get update apt-get -u upgrade apt-get install linux-source-2.6.17 \ linux-patch-debian-2.6.17 \ kernel-package \ build-essential \ dh-make \ module-assistant \ intltool-debian \ debhelper \ po-debconf \ sharutils \ gettext \ html2text \ libncurses5-dev \ wget |
cd wget --no-check-certif https://www.rtai.org/RTAI/rtai-3.5-cv.tar.bz2 mkdir /usr/src/modules tar xjf rtai-3.5-cv.tar.bz2 -C /usr/src chown root:src /usr/src/rtai-3.5-cv/ -R cd /usr/src/modules ln -s ../rtai-3.5-cv rtai |
cd /usr/src tar xjf linux-source-2.6.17.tar.bz2 ln -s linux-source-2.6.17 linux |
RTAI patch is preparing for vanilla kernel. Therefore we must remove Debian patches from the kernel source.
FIX: there is a small bug in kernel-patches package. To fix it, do the followings: cd /usr/src/kernel-patches/all/ mkdir 2.6.17 mv apply/ 2.6.17/ mv debian/ 2.6.17/ mv unpatch/ 2.6.17/ |
cd /usr/src/linux ../kernel-patches/all/2.6.17/unpatch/debian |
cd /usr/src/linux patch -p1 < ../modules/rtai/base/arch/i386/patches/hal-linux-2.6.17-i386-1.5-02.patch |
For the second command, breeze through any questions make
might raise by hitting [ENTER]
cp /boot/config-2.6.18-5-486 .config make oldconfig make menuconfig |
Loadable module support ---> Enable loadable module support ---> enabled
Loadable module support ---> Module versioning support ---> disabled
Processor type and features ---> Preemption Model ---> Preemptible Kernel (Low-Latency Desktop)
Processor type and features ---> Interrupt pipeline ---> enabled
Processor type and features ---> High Memory Support ---> off
Power management options (ACPI, APM) ---> Legacy Power Management API ---> disabled
Power management options (ACPI, APM) ---> Software Suspend ---> disabled
Power management options (ACPI, APM) ---> ACPI (Advanced Configuration and Power Interface) Support ---> ACPI Support ---> disabled
Power management options (ACPI, APM) ---> APM (Advanced Power Management) BIOS Support ---> APM BIOS Support ---> disabled
Power management options (ACPI, APM) ---> CPU Frequency scaling ---> CPU Frequency scaling ---> disabled
Power management options (ACPI, APM) ---> Power Management support ---> disabled
For non-SMP systems, disable symmetric multi-processing support:
Processor type and features ---> Symmetric multi-processing support ---> disabled
Choose the most suitable processor family for your machine. For example, for a Pentium-III processor:
Processor type and features ---> Processor family ---> Pentium-III / Celeron(Coppermine) / Pentium-III Xeon
If you have a dual cores CPU or SMP system, don't choose a processor family which has no TSC (time stamp counter).
This means that for example you can not choose 586/K5/5x86/6x86/6x86MX as Processor family if you have a dual cores CPU.
In conclusion, choose the most suitable processor family for your machine.
make-kpkg clean make-kpkg --append-to-version -rtai \ --revision r1 \ --initrd \ --config menuconfig \ kernel_image \ kernel_headers \ kernel_source |
cd /usr/src dpkg -i linux-image-2.6.17-rtai_r1_i386.deb dpkg -i linux-headers-2.6.17-rtai_r1_i386.deb reboot |
Boot with the new RTAI kernel.
If you want to install RTAI with RTAI-Lab support, you need Mesa and eFLTK libraries. The RTAI-Lab provides a tool chain to develop block diagrams that can be compiled and executed on the RTAI real-time Linux operating system. But you don't need RTAI-Lab to run EMC2.
If you only want to run EMC2, skip this step and continue from [Compiling RTAI modules]
su - apt-get install libglu1-mesa \ libglu1-mesa-dev \ libgl1-mesa-dev \ libxt-dev exit |
Because of dependencies the following packages will be installed too libglu1-mesa-dev -> libx11-dev libxau-dev libxdmcp-dev libxext-dev mesa-common-dev x11proto-core-dev -> x11proto-input-dev x11proto-kb-dev x11proto-xext-dev xtrans-dev libxt-dev -> libice-dev libsm-dev
cd wget http://superb-west.dl.sourceforge.net/sourceforge/mesa3d/MesaLib-7.0.1.tar.gz tar zxf MesaLib-7.0.1.tar.gz |
cd Mesa-7.0.1 make realclean make linux-x86 su make install exit |
See http://www.mesa3d.org/install.html for more details.
cd wget http://ovh.dl.sourceforge.net/sourceforge/ede/efltk-2.0.6.tar.bz2 tar xjf efltk-2.0.6.tar.bz2 |
To compile eFLTK with gcc-4.1 (which is default in Debian Etch), you must change some lines in the source files.
At line 81 in ~/efltk/efltk/Fl_Text_Buffer.h, change this line
char *Fl_Text_Buffer::static_buffer(); |
char *static_buffer(); |
At line 26 in ~/efltk/efltk/Fl_Combo_Box.h, change these two lines
static void Fl_Combo_Box::cb_browse(Fl_Widget *w, void *data); static void Fl_Combo_Box::cb_button(Fl_Widget *w, void *data); |
static void cb_browse(Fl_Widget *w, void *data); static void cb_button(Fl_Widget *w, void *data); |
cd ~/efltk ./configure ./emake |
su ./emake install echo "/usr/local/lib" >> /etc/ld.so.conf ldconfig exit |
If you want to compile RTAI with RTAI-Lab support, don't forget to check "RTAI Lab ---> RTAI Lab" when you configure RTAI using "make menuconfig" command.
Use only one method, not both.
su - cd /usr/src/modules/rtai make menuconfig |
If you only want to run EMC2, default values are OK. Save and exit.
make make install reboot |
Boot with the new RTAI kernel.
su - cd /usr/src/modules/rtai make menuconfig |
If you only want to run EMC2, default values are OK. Save and exit.
mkdir debian cd debian touch changelog touch compat touch control.modules.in touch copyright touch rules chmod 755 rules |
Edit /usr/src/modules/rtai/debian/changelog with your favorite editor. See 1
Edit /usr/src/modules/rtai/debian/compat with your favorite editor. See 2
Edit /usr/src/modules/rtai/debian/control.modules.in with your favorite editor. See 3
Edit /usr/src/modules/rtai/debian/copyright with your favorite editor. See 4
Edit /usr/src/modules/rtai/debian/rules with your favorite editor. See 5
cd /usr/src/linux make-kpkg --append-to-version -rtai --added-modules rtai modules_clean make-kpkg --append-to-version -rtai --added-modules rtai modules_image |
cd /usr/src dpkg -i rtai-modules-2.6.17-rtai_3.5+r1_i386.deb dpkg -i rtai-dev-2.6.17-rtai_3.5+r1_i386.deb reboot |
Boot with the new RTAI kernel.
su - cd /usr/realtime/testsuite/user/latency; ./run cd /usr/realtime/testsuite/user/preempt/; ./run cd /usr/realtime/testsuite/user/switches/; ./run cd /usr/realtime/testsuite/kern/latency/; ./run cd /usr/realtime/testsuite/kern/preempt/; ./run cd /usr/realtime/testsuite/kern/switches/; ./run exit |
If you have a problem with test results, see RTAI Latency Test(http:/cgi-bin/wiki.pl?TroubleShooting#RTAI_Latency_test)
If you only want to run EMC2, your RTAI system is ready now. You don't need to read the following steps.
You can continue from [Debian Etch Compile LinuxCNC](Debian_Etch_Compile_LinuxCNC)
Scilab is an open source software which has been developed for system control and signal processing applications. Scicos (Scilab Connected Object Simulator) is a Scilab package for modeling and simulation of dynamical systems including both continuous and discrete sub-systems. Scicos includes a graphical editor for constructing models by interconnecting blocks (representing predefined basic functions or user defined functions). You can develop realtime systems using RTAI-Lab's Scilab macros in Scilab
But you don't need Scilab to run EMC2. If you only want to run EMC2, skip this step.
NOTE: The instructions in this document are for Scilab-4.1.1 because Scilab-4.1.2 has some problem with RTAI-3.5. If you want to install Scilab-4.1.2, see Roberto Bucher's e-mail message
|
Scilab which is in Debian Etch's repository, is problematic. Therefore, download Scilab's source files from Scilab's repository.
su - cd /usr/local/ wget http://www.scilab.org/download/4.1.1/scilab-4.1.1-src.tar.gz tar zxf scilab-4.1.1-src.tar.gz |
You need some packages to build Scilab. Before running the following commands, check your /etc/apt/sources.list. If the "deb-src" and "non-free" repositories are not there, add them. Your sources.list file looks like as
deb http://ftp.de.debian.org/debian/ etch main contrib non-free deb-src http://ftp.de.debian.org/debian/ etch main contrib non-free deb http://ftp.de.debian.org/debian-security/ etch/updates main contrib non-free deb-src http://ftp.de.debian.org/debian-security/ etch/updates main contrib non-free |
apt-get update apt-get build-dep scilab |
Because of build dependencies, the following packages will be installed: autoconf cdbs cpp-3.4 diffstat g77 g77-3.4 gawk gcc-3.4 libg2c0-dev libice-dev libpvm3 libreadline5-dev libsm-dev libxmu-dev libxmu-headers libxpm-dev libxt-dev ocaml-base-nox ocaml-interp ocaml-nox pvm pvm-dev quilt tcl8.4-dev tk8.4-dev x-dev xaw3dg-dev
cd /usr/local/scilab-4.1.1 ./configure --without-java --with-tcl-library=/usr/lib --with-tcl-include=/usr/include/tcl8.4 make all ln -s /usr/local/scilab-4.1.1/bin/scilab /usr/local/bin/scilab |
Don't use "make install" to install Scilab.
Scilab/Scicos need to know the path of the realtime binary files to work with RTAI.
At line 51 in /usr/local/scilab-4.1.1/bin/scilab, change this line
PATH=$PATH:$SCI:$SCI/util |
PATH=$PATH:$SCI:$SCI/util:/usr/realtime/bin |
At line 63 in /usr/local/scilab-4.1.1/bin/scilab, change this line
PATH=$PATH:$SCI:$SCI/util |
PATH=$PATH:$SCI:$SCI/util:/usr/realtime/bin |
If you install RTAI with classic way, to install macros
cd /usr/src/modules/rtai/rtai-lab/scilab/macros/ make |
If you install RTAI with Debian way, to install macros
cd /usr/realtime/rtai-lab/scilab/macros/ make |
If you want to see Scilab link in your X window's menu:
apt-get install scilab-doc touch /usr/share/menu/scilab |
Edit /usr/share/menu/scilab with your favorite editor.
?package(scilab-doc):\ needs="x11"\ section="Apps/Math"\ title="Scilab 4.1.1"\ command="/usr/local/bin/scilab" |
update-menus exit |
If you install RTAI with classic way, as normal user
cd /usr/src/modules/rtai/rtai-lab/scilab/macros/ make user |
If you install RTAI with Debian way, as normal user
cd /usr/realtime/rtai-lab/scilab/macros/ make user |
The Comedi project develops open-source drivers, tools, and libraries for data acquisition. You don't need to install Comedi, Comedilib and Comedi kernel module to run EMC2. If you only want to run EMC2, skip this step.
Firstly, finish to install and to test RTAI. If everything is OK, you can start to install Comedi.
As normal user
cd wget http://www.comedi.org/download/comedilib-0.8.0.tar.gz tar zxf comedilib-0.8.0.tar.gz cd comedilib-0.8.0 ./configure make su make install exit |
As normal user, do the followings:
cd wget http://www.comedi.org/download/comedi-0.7.74.tar.gz tar zxf comedi-0.7.74.tar.gz cd comedi-0.7.74/ ./configure --disable-pcmcia make su make install depmod -a make dev cp include/linux/comedi.h /usr/local/include/ cp include/linux/comedilib.h /usr/local/include/ |
FIX: Sometimes "make install" don't install the comedi kernel modules to the right place. I couldn't find what causes this. If there is nothing in /lib/modules/2.6.17-rtai/comedi/, use the following commands to solve the problem. cp -R /lib/modules/2.6.17/comedi/* /lib/modules/2.6.17-rtai/comedi/ depmod -a |
Create a startup script to create Comedi devices at boot time.
cd /etc/init.d touch comedi-dev chmod 755 comedi-dev update-rc.d comedi-dev start 30 2 3 4 5 . |
Edit /etc/init.d/comedi-dev with your favorite editor.
/etc/init.d/comedi-dev
#!/bin/sh -e |
We need the following symbolic links
mkdir /usr/local/include/linux cd /usr/local/include/linux/ ln -s /usr/local/include/comedi.h comedi.h ln -s /usr/local/include/comedilib.h comedilib.h cd /usr/include/ ln -s /usr/local/include/comedi.h comedi.h ln -s /usr/local/include/comedilib.h comedilib.h cd /usr/include/linux/ ln -s /usr/local/include/comedi.h comedi.h ln -s /usr/local/include/comedilib.h comedilib.h |
Repeat [Compiling RTAI modules] step. Before installing the new RTAI, remove old one.
At "make menuconfig" step, don't forget to check "Comedi support over LXRT" and "RTAI-Lab"
Add-ons ---> Comedi support over LXRT --> enable
Add-ons ---> COMEDI installation directory ---> /usr/local
RTAI Lab ---> RTAI Lab
#!/bin/sh -e |
rtai (3.5) unstable; urgency=low
-- maintainer <[email protected]> Sat, 23 Sep 2006 00:39:32 +0300 |
5 |
Source: rtai Section: devel Priority: optional Maintainer: maintainer <[email protected]> Build-Depends: debhelper (>= 5) Standards-Version: 3.7.2 |
This package was debianized by maintainer <[email protected]> on Sat, 16 Sep 2006 00:39:32 +0300. |
#!/usr/bin/make -f |
#!/bin/sh -e |
RTAI 3.4 works fine with kernel 2.6.17 in Debian Etch. But there is a small problem in its patch file hal-linux-2.6.17-i386-1.3-08.patch
To fix the problem, delete the following part from the patch file.
8 lines after the line 2934
@@ -765,7 +767,6 @@ config HOTPLUG_CPU menu "Power management options (ACPI, APM)" depends on !X86_VOYAGER |
I tried to compile RTAI 3.5 with kernel 2.6.19-7 in Debian Etch. Everything is OK until the [Testing RTAI] step but I couldn't start the RTAI's latency test. Maybe there is a problem in my hardware.
Scilab-4.1.2 has some problem with RTAI 3.6 and olders. If you want to install Scilab-4.1.2, see Roberto Bucher's e-mail message