RTAI Installation
The following steps are through the terminal, first you must be logged in as root in order to have permissions to do the following, if you are not logged in as root then you can put sudo in front of the command
i.e.
sudo make menuconfig
This should give you the permissions to continue with that command, another way is to just log in as root temporarily
sudo su
This way saves on having to put sudo in front of each command.
So, as root, we need to download a kernel, for this project I downloaded a “vanilla” kernel, which means it is an original release from Linus Torvalds and have not being changed by another programmer.
The version I selected was 2.6.15, in order to download it, the following commands have to be executed.
cd means change directory and is the command line equivalent of double-clicking into a folder in windows.
cd /usr/src
The above command brings us to the directory where we will be downloading and installing the RTAI and the new kernel.
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.15.tar.bz2
wget connects to the URL provided and downloads the file.
This is a tarball, which is a compressed folder, much the same as a Winrar or Winzip for windows, to decompress (making sure you are still in the src directory using the command pwd) use the following command
tar jvxf linux-2.6.15.tar.bz2
I will now create a link to this folder in the src directory so it is easier to select
rm -f linux
removes any linux folder that may have being there previously.
ln -fs linux-2.6.15 linux
this command creates the link to the folder.
We now need to patch this kernel with the RTAI to allow both to work together, we must download that next using a similar process to the previous download of the kernel.
cd /usr/src
wget https://www.rtai.org/RTAI/rtai-3.3.tar.bz2
tar jvxf rtai-3.3.tar.bz2
And now to apply the patch to allow the RTAI to interact with the kernel.
cd /usr/src/linux
patch -p1 < ../rtai-3.3/base/arch/i386/patches/hal-linux-2.6.15-i386-1.2-00.patch
Now you are ready to configure your kernel, inside the Linux directory
make menuconfig
This will bring up your options for configuring the kernel in a GUI, we only need to change a few of these options, which are
Code maturity level options >
[*] Prompt for development and/or incomplete code/drivers
Loadable module support >
[*] Enable loadable module support
[ ] Module Versioning support (EXPERIMENTAL)
Processor type and features>
[ ] Use register arguments
[*] Interrupt pipeline
File systems >Pseudo filesystems >
[*] /proc file system support
Save the kernel configuration on exit
To install the kernel the following commands are used, this process takes some time which depends on the computers processor.
make && make install && make modules && make modules_install
This compiles the kernel, then makes the install files and then finally installs the kernel.
The two ampersands mean continue to the nest command if the last one produced no errors.
Once the kernel is installed you must reboot
/sbin/reboot
At the startup, press enter to select the grub menu and select the kernel just compiled
Now to configure the RTAI, a process similar to the kernel
cd /usr/src/rtai-3.3
make menuconfig
In the configuration menu,
Machine Menu>
[1]Number of processors
[ ]RTAI lab
Save configuration upon exit
make
make install
/usr/bin/reboot
Enter the kernel again that we just created through the grub menu
Now we need to test to see if the RTAI is running correctly and run some tests.
cd /usr/realtime/testsuite/usr/latency
./run
Use ctrl-c to stop for this and the rest of the tests.
cd /usr/realtime/testsuite/usr/preempt
./run
cd /usr/realtime/testsuite/usr/switches
./run
cd /usr/realtime/testsuite/kern/latency
./run
cd /usr/realtime/testsuite/kern/preempt
./run
cd /usr/realtime/testsuite/kern/switches
./run
Each should run and have no errors if an errors occurs to do with /dev/rtf/ or something similar then open a new document using
gedit myRTAIfix
And put inside it :
#!/bin/bash
mkdir /dev/rtf
for n in `seq 0 9`
do
f=/dev/rtf/$n
mknod -m 666 $f c 150 $n
done
Save and change it to an executable using
chmod +x myRTAIfix
if that doesn’t work then open a new file
gedit myRTAIfix2
Putting inside:
#!/bin/bash
mknod -m 666 /dev/rtai_shm c 10 254
for n in `seq 0 9`
do
f=/dev/rtf$n
mknod -m 666 $f c 150 $n
done
Save and change it also to an executable using the command used earlier.
If that works then congratulations you’ve just successfully installed the RTAI! |