Contents
-
- 1. OS Configuration
-
-
- 1.1. Installing the deb packages
-
- 1.2. Udev
-
- 1.3. Memlock Size
-
- 1.4. Adding the user to the src group
-
2. Getting the source packages
-
-
- 2.1. Getting the kernel source
-
- 2.2. Getting the RTAI source
-
- 2.3. Getting the Debianization patch
-
3. Building the packages
-
-
- 3.1. The RTAI packages
-
-
- 3.1.1. Building the RTAI packages
-
- 3.1.2. Installing the RTAI packages
-
3.2. The kernel packages
-
-
- 3.2.1. Building the kernel packages
-
- 3.2.2. Configuring the kernel
-
- 3.2.3. Installing the kernel packages
-
3.3. The RTAI kernel modules package
-
-
- 3.3.1. Building the RTAI kernel modules package
-
- 3.3.2. Configuring the RTAI kernel modules
-
- 3.3.3. Installing the RTAI kernel modules package
-
- 3.3.4. Regenerate the kernel module dependencies
-
4. Testing RTAI
-
- 5. Readymade packages
-
-
- 5.1. Linux-2.6.30.5 with RTAI-3.7.1
-
-
- 5.1.1. Packages
-
- 5.1.2. MD5 checksums
-
- 5.1.3. Installing readymade packages
-
5.2. Linux-2.6.22 with RTAI-3.6-cv
-
-
- 5.2.1. Packages
-
- 5.2.2. MD5 checksums
-
This page describes how to prepare Debian Lenny to compile RTAI.
1. OS Configuration
1.1. Installing the deb packages
su -
aptitude update && aptitude safe-upgrade
aptitude install \
kernel-package \
build-essential \
dh-make \
module-assistant \
libncurses5-dev \
zlib1g-dev \
dh-kpatches \
fakeroot \
autoconf \
dctrl-tools
|
Because of dependencies the following packages will be installed too
kernel-package -> binutils build-essential dpkg-dev g++ g++-4.3 gcc gcc-4.3 gettext intltool-debian libc6-dev libcompress-raw-zlib-perl
-> libcompress-zlib-perl libdigest-hmac-perl libdigest-sha1-perl libfile-remove-perl libgomp1 libio-compress-base-perl
-> libio-compress-zlib-perl libio-stringy-perl libmail-box-perl libmail-sendmail-perl libmailtools-perl libmime-types-perl
-> libobject-realize-later-perl libstdc++6-4.3-dev libsys-hostname-long-perl libtimedate-perl liburi-perl
-> libuser-identity-perl linux-libc-dev make patch po-debconf
dh-make -> debhelper html2text
1.2. Udev
RTAI modules create
rtai_shm and
rtf* devices when they are loaded.
We need to create a Udev rule file for these devices.
touch /etc/udev/rules.d/92-rtai.rules
|
Edit /etc/udev/rules.d/92-rtai.rules with your favorite editor.
ACTION!="add|change", GOTO="rtai_end"
KERNEL=="rtf*", MODE="0666"
KERNEL=="rtai*", MODE="0666"
LABEL="rtai_end"
|
1.3. Memlock Size
The default amount of the maximum locked-in-memory address space size is 32 KB in Debian Lenny.
But this is not enough for some applications. For example the
memlock size has to be more
than 2048 KB for EMC2. Therefore increase the
memlock size if you get the segmentation fault
because of the inadequate memlock size.
Edit /etc/security/limits.conf with your favorite editor.
Add the following line
1.4. Adding the user to the src group
Add your user account to the
src group. This is needed to have the write access for
/usr/src directory.
adduser your_user_name src
|
Logout and re-login for the change to take effect.
2. Getting the source packages
Use your normal user account to do the followings
2.1. Getting the kernel source
wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.5.tar.bz2
tar xjf linux-2.6.30.5.tar.bz2 -C /usr/src
ln -s linux-2.6.30.5/ /usr/src/linux
|
2.2. Getting the RTAI source
NOTE: rtai_3.7.1.orig.tar.gz is the daily snapshot (07 Sep 2009) of the RTAI's Vulcano repository.
The name of the source tarball must be as <packagename>_<upstream_version>.orig.tar.gz to Debianize
|
wget http://linuxcnc.org/experimental/lenny/rtai_3.7.1.orig.tar.gz
tar zxf rtai_3.7.1.orig.tar.gz
|
2.3. Getting the Debianization patch
The patch file contains all the changes to Debianize the original RTAI source.
This patch is from
http://packages.debian.org/sid/rtai with some trivial changes.
wget http://linuxcnc.org/experimental/lenny/rtai_3.7.1-2.diff.gz
cd rtai-3.7.1/
gunzip -c ../rtai_3.7.1-2.diff.gz | patch -p1 --dry-run
gunzip -c ../rtai_3.7.1-2.diff.gz | patch -p1
chmod u+x debian/rules
|
3. Building the packages
3.1. The RTAI packages
3.1.1. Building the RTAI packages
dpkg-buildpackage -rfakeroot -uc
|
The following files will be built in the upper directory:
- librtai1_3.7.1-2_i386.deb
- librtai-dev_3.7.1-2_i386.deb
- rtai_3.7.1-2.diff.gz
- rtai_3.7.1-2.dsc
- rtai_3.7.1-2_i386.changes
- rtai_3.7.1-2_i386.deb
- rtai-doc_3.7.1-2_all.deb
- rtai-source_3.7.1-2_i386.deb
3.1.2. Installing the RTAI packages
cd ..
su
dpkg -i librtai1_3.7.1-2_i386.deb
dpkg -i librtai-dev_3.7.1-2_i386.deb
dpkg -i rtai-source_3.7.1-2_i386.deb
exit
|
3.2. The kernel packages
3.2.1. Building the kernel packages
cd /usr/src/linux
make-kpkg clean
time fakeroot make-kpkg --initrd \
--append-to-version -rtai \
--revision r1 \
--added-patches rtai \
--config menuconfig \
kernel-image \
kernel-headers \
kernel-source
|
3.2.2. Configuring the kernel
Enable loadable module support --->
enabled [*]
Processor type and features ---> HPET Timer Support ---> disabled
Processor type and features ---> Interrupt pipeline --->
enabled [*]
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support --->
enabled [*]
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated /proc/acpi files ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated power /proc/acpi directories ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Future power /sys interface ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Deprecated /proc/acpi/event support ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> AC Adapter ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Battery ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Button ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Video --->
module [M]
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Fan ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Dock --->
enabled [*]
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Processor ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Disable ACPI for systems before Jan 1st this year ---> 0
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Debug Statements ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> PCI slot detection driver ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Container and Module Devices ---> disabled
Power management and ACPI options ---> ACPI (Advanced Configuration and Power Interface) Support ---> Smart Battery System ---> disabled
Power management and ACPI options ---> APM (Advanced Power Management) BIOS support ---> disabled
Power management and ACPI options ---> CPU Frequency scaling ---> 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 multi 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.
NOTE: No need to disable Module Versioning Support for RTAI 3.7.1 but it's needed to
regenerate the kernel module dependencies.
You can prefer to disable Module Versioning Support, if you don't want to deal with the kernel module dependencies.
Loadable module support ---> Module versioning support ---> disabled
|
NOTE: No need to disable High Memory Support for RTAI 3.7.1 and newer
|
NOTE: No need to disable Symmetric multi-processing support for the uniproccesor machine for RTAI 3.7.1 and newer.
But if you don't have a multi cores CPU or SMP system, you can prefer to disable it to improve the performance
|
After to finish all changes, save and exit from menuconfig.
3.2.3. Installing the kernel packages
cd /usr/src
su
dpkg -i linux-image-2.6.30.5-rtai_r1_i386.deb
dpkg -i linux-headers-2.6.30.5-rtai_r1_i386.deb
rm linux
ln -s linux-headers-2.6.30.5-rtai linux
|
NOTE: If you have a SMP system, dedicate the last core/CPU to the realtime tasks,
resulting in a significant increase in performance.
Edit /boot/grub/menu.lst and add isolcpus parameter to the end of the kernel line of the RTAI kernel.
The value of the isolcpus parameter will be the number of the last core/CPU. Start to count from #0.
1 for dual core/CPU system, 3 for quad core/CPU etc...
This is the kernel line for my dual core machine
kernel /vmlinuz-2.6.30.5-rtai root=/dev/sda5 ro isolcpus=1
|
Boot with the new RTAI kernel.
3.3. The RTAI kernel modules package
3.3.1. Building the RTAI kernel modules package
cd /usr/src
tar jxf rtai-source.tar.bz2
cd /usr/src/linux
fakeroot make-kpkg --append-to-version -rtai --added-modules rtai --config menuconfig modules_image
|
3.3.2. Configuring the RTAI kernel modules
If the total number of CPUs/cores is more than 2, increase the value of CONFIG_RTAI_CPUS parameter.
It's a good idea to set this value to 8 if you want to distribute your deb package.
Machine (x86) ---> Number of CPUs (SMP-only) ---> 8
For EMC2 2.3 and newer, enable CONFIG_RTAI_MATH parameter.
Base system ---> Other features ---> Mathfuns support in kernel ---> enabled
Default values are OK for other parameters. Save and exit.
3.3.3. Installing the RTAI kernel modules package
cd /usr/src
su
dpkg -i rtai-modules-2.6.30.5-rtai_3.7.1-2+r1_i386.deb
|
3.3.4. Regenerate the kernel module dependencies
cd /usr/src/linux
cp Module.symvers Module.symvers.old
cat /usr/realtime/modules/Module.symvers >> Module.symvers
ln -s /usr/realtime/modules/ /lib/modules/2.6.30.5-rtai/rtai
depmod -a
|
4. Testing RTAI
cd /usr/realtime/testsuite/user/latency; time ./run
cd /usr/realtime/testsuite/user/preempt/; time ./run
cd /usr/realtime/testsuite/user/switches/; ./run
cd /usr/realtime/testsuite/kern/latency/; time ./run
cd /usr/realtime/testsuite/kern/preempt/; time ./run
cd /usr/realtime/testsuite/kern/switches/; ./run
|
If you have a problem with test results, see
[RTAI Latency Test]
Your RTAI system is ready now. You can continue from
Debian Lenny Compile LinuxCNC
5. Readymade packages
The following packages are experimental and these are not supported by EMC Team.
Please let
Acemi know on the
[EMC developers mailing list], if you encounter any problems.
5.1. Linux-2.6.30.5 with RTAI-3.7.1
These packages were built as described in this wiki page at 07/September/2009
using Linux-2.6.30.5 and the current RTAI's Vulcano repository (the daily snapshot after RTAI-3.7.1)
The Linux kernel image was built for Pentium-Pro and compatible processors with the symmetric multi-processing support.
5.1.1. Packages
5.1.2. MD5 checksums
739f635c2aecb6eadcf46fd5023a6efa linux-image-2.6.30.5-rtai_r1_i386.deb
f034cac05d7b293f79da927c243ea108 linux-headers-2.6.30.5-rtai_r1_i386.deb
e5911a52b0321fe9340503d64cbf4d11 rtai-modules-2.6.30.5-rtai_3.7.1-2+r1_i386.deb
04385cdc5c24a15b78bd9ab3859672a1 librtai1_3.7.1-2_i386.deb
2cbbd4b4474f912ac09fee590e29ac0c librtai-dev_3.7.1-2_i386.deb
b01f1c4bac6f40c3820474050cba9595 config-2.6.30.5-rtai
69efdf2a0b2a09c92d5e4e963ad11b0f rtai_3.7.1.orig.tar.gz
2925d5057f14dfd809d063f1e8df1d89 rtai_3.7.1-2.dsc
fd204bbc8f6d2666c60906ba776319a3 rtai_3.7.1-2.diff.gz
5.1.3. Installing readymade packages
Download the readymade deb packages and follow the instructions
cd your_download_folder
dpkg -i librtai1_3.7.1-2_i386.deb
dpkg -i librtai-dev_3.7.1-2_i386.deb
dpkg -i linux-image-2.6.30.5-rtai_r1_i386.deb
dpkg -i linux-headers-2.6.30.5-rtai_r1_i386.deb
dpkg -i rtai-modules-2.6.30.5-rtai_3.7.1-2+r1_i386.deb
cd /usr/src/
ln -s linux-headers-2.6.30.5-rtai/ linux
reboot
|
- See isolcpus note in [Installing the kernel packages], if you have a SMP system.
- Boot with the new RTAI kernel.
5.2. Linux-2.6.22 with RTAI-3.6-cv
These packages were built using Linux-2.6.22 kernel and RTAI-3.6-cv
The Linux kernel image was built for Pentium-Pro and compatible processors without the symmetric multi-processing support.
5.2.1. Packages
5.2.2. MD5 checksums
c58bd4abd12fff7d319b7c7507e6c658 linux-image-2.6.22-rtai_r2_i386.deb
ab04c24b3b561e3f3c5f86b939f6de33 linux-headers-2.6.22-rtai_r2_i386.deb
e1613edaa36f14f77fbcd3cb5d113c64 linux-source-2.6.22-rtai_r2_all.deb
4810e03a05ff991aadee283ccda605ff rtai-modules-2.6.22-rtai_3.6+r2_i386.deb
3a2c60ade0102f3f77c9533ce5160311 rtai-dev-2.6.22-rtai_3.6+r2_i386.deb