• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Real Time Control in Linux, also an RTAI 3.6 Install guide

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Roofles

Member
Joined
Dec 19, 2004
Location
Brew City
So I'm writing this article for a couple reasons. 1) I'm doing this for my master's thesis (the real time control part), 2) I've run into a couple interesting problems so I figured posting them to the internet would hopefully help someone else searching for a solution in the future and 3) I'm a Linux newbie so its an adventure for me as well.

Now lets provide a little bit of technical background. With the 2.6 kernel there are lots of processes that are fully preemptable. So in terms of a real time system this is bad. We need what is called a 'hard real time system' which means that when the system receives an interrupt it responds within a certain deterministic period of time to it. There are two types of real time systems in this case, 'hard' and 'soft'. A simple example would be that a 'soft real time system' is like answering your cell phone, you can pick it up immediately (deterministic) you can miss the call (failing the interrupt) but still call the person back and your cell phone doesn't blow up. If you fail the interrupt for a hard real time system, like say not reacting fast enough to an obstacle in the road while driving a car, you'll hit the object and wreck your car. So failing to respond properly to interrupts in this case has dire consequences.

So our goal is to find a way to schedule our process threads in that they always start and end within a specific period of time.

Enter the Real Time Application Interface (RTAI)! So I won't go into a discussion here, but there are lots of available solutions to this real time problem. Since I'm doing this at a university I want free (and on Linux so open source). In that case you can check out Xenomai, RTAI, and PREEMPT_RT, as well as numerous others. The other benefits of RTAI are that you can link it with SciLab (open source MatLab) and use Scicos (open source Simulink) and create block diagrams that support DAQ cards and related hardware. I'm using a single board computer and not a standard DAQ that is supported by this so I'll be writing a bunch of C code instead of using a nice GUI. (Also this means that you'll have to consider looking at other guides to install those parts.)

Now to take a quick tangent, why do you care about real time systems? Well it can be fun to screw around with if you are so inclined, plus if you have a really old computer, you can use your standard parallel port to do real time i/o! So you can do real time control without purchasing a $1000+ DAQ.

So, moving on. RTAI has a good amount of documentation and install guides around in case you want to find it. This is their complete guide to RTAI 3.6 and the Scilab extensions. I used this as a general guide but I want to provide a guide that is specific to Fedora 8, as well as address some of the interesting problems I ran into. In general almost all errors were fixed by a good google search, and the guys behind RTAI respond quickly to their mail list if you ask a question.

So to get to where I am, with just the patched real time kernel and RTAI installed to where I can run real time programs, you don't need a lot (2 files). The first is the newest RTAI release, 3.6-cv is the closure version of their 3.6 software. You can download the tarball here. (The hidden thing here is that there are lots of kernel versions supported, you can find them all once you extract the tarball and check out the ../rtai/base/arch/i386/patches/... directory. ((also they support x86_64 architectures as well)) I'm using Fedora 8 because it natively supports the kernel version that RTAI supports. (We pulled a Goldilocks approach the first time, Fedora 7 upgrade to 2.6.23 which didn't work, and a Fedora 10 to a lower patch with also failed). So download rtai-3.6-cv.tar.bz2 to wherever you want. I'll be working out of /usr/src by default so keep that in mind as you follow along.

So I've unpacked rtai into /usr/src/rtai-3.6-cv . You might consider making links so its quicker, but tab-complete[1] works wonders as well.
Code:
ln -s rtai-3.6-cv rtai
Now because of prior knowledge I know I want to work with the 2.6.23 kernel version. Go to kernel.org and download the vanilla kernel 2.6.23.tar.bz2 (the absolute base version, no updates). Unpack it and create another link if you want
Code:
tar -xvjf linux-2.6.23.tar.bz2
ln -s linux-2.6.23 linux

So now move the linux directory and we have to apply the RTAI patch first before we mess with the config file.
Code:
cd /usr/src/linux
patch -p1 < /usr/src/rtai/base/arch/i386/patches/hal-linux-2.6.23-i386-1.12-03.patch
Let that run and when its done run copy over your current install config and then run make menuconfig
Code:
cp /boot/config-2.6.23.1-42.fc8 /usr/src/linux
make menuconfig
First in menuconfig go down and select 'Load Alternate Configuration". Load up the config file you just copied over, note that this line doesn't respond to tab-complete so type it in correctly! So now in menuconfig we want to select a couple things and either make sure they are off or won't get in the way later. (Oh god did I spend so much time fixing things that got in the way later... kernel compiles on a 367 Mhz machine take forever!)
I've pulled these directly from the RTAI documentation:
- Enable loadable module support: select “Enable module support”, “Module unloading”, and “Auto-matic module loading”. Deselect “Module versioning support”; RTAI modules are not version dependent.
- Processor type and features: Select your Subarchitecture Type (PC-Compatible) and Processor family. Select ”Preemption Model (Preemptible kernel (Low-Latency Desktop))”. You might need “High Memory Support (4GB)” if you use a PCMCIA data acquisition card. Deselect ”Use register arguments (EXPERIMENTAL)”. Possibly deselect “Local APIC support on uniprocessors[2]”.
- Power Management options: Select ACPI Support and features relevant to your hardware. Leave APM deselected. Leave CPU Frequency scaling unselected. Warning: ACPI support may be a problem on laptops that use the “screen closed” button to put the computer into sleep or standby modes.
- Bus options: Leave the default. Check the support for your hardware. Laptops need PCCARD (PCMCIA/CardBus) support and PC-card bridges. e.g. CardBus yenta-compatible bridge support

So now make sure to save your config when you exit out. If for some reason it doesn't ask if you want to save it when you exit, just 'Save As Alternate Configuration' and save it as .config .

Run make, and walk away depending on the speed of your computer. Then run the make commands and reboot into your new -rtai kernel. I wouldn't edit your grub.conf yet just it case your kernel compile doesn't boot
Code:
make
make modules
make modules_install
make install

So now that you have rebooted into your rtai patched kernel go to your rtai directory and run make menuconfig. There aren't really any options in here you want to mess with, this is just the quickest way to get the .config file built! The only option you might want to check is the 'Menu Machine (x86): adjust Number of CPUs (default = 2)' for the obvious reasons. Exit out of this and it runs make automatically.
Code:
make install

Now we check to make sure that you can load the RTAI modules and then you are at square 1 to start writing real time code!
Code:
insmod /usr/realtime/modules/rtai_hal.ko
insmod /usr/realtime/modules/rtai_up.ko        # or rtai_lxrt.ko
insmod /usr/realtime/modules/rtai_fifos.ko
insmod /usr/realtime/modules/rtai_sem.ko
insmod /usr/realtime/modules/rtai_mbx.ko
insmod /usr/realtime/modules/rtai_msg.ko
insmod /usr/realtime/modules/rtai_netrpc.ko ThisNode="127.0.0.1"
insmod /usr/realtime/modules/rtai_shm.ko
insmod /usr/realtime/modules/rtai_signal.ko
insmod /usr/realtime/modules/rtai_tasklets.ko
If those load up without error you are good to go! Congrats, go control something!

Also if you stop here I would also consider downloading the User Guide 3.4 because it has a lot of example code and such if you aren't going to use the graphical interface in Scilab. Available here.

To come later. Writing RTAI script files and module compilation!

[1] Use tab-complete where available, I didn't write down the exact code I used in my notes but just the general outline
[2] APIC support is tricky. If your computer has an APIC (setting in BIOS) you can leave this enabled and you should be fine. The second interesting thing is that in make menuconfig the option doesn't exist at all! So I had to edit the .config file itself to manually set the _APIC=n options. Then! after running make it runs another script file for configurations which resets these! So I had to edit ./arch/i386/Kconfig and set all the _APIC settings here to 'default=n'
[3] Since I'm a Linux newbie some of that stuff can be run as user and the makes all as root. I just pretty much do things as root, which is apparently bad practice...
 
i try to install rtai3.6 on linux mandriva 2007 with linux 2.6.23 but i have problems on trying make install i have the following error:

sh /home/chafik/kernel/linux-2.6.23.17/arch/i386/boot/install.sh 2.6.23.17 arch/i386/boot/bzImage System.map "/boot"
cp: setting attributes for `/boot/System.map-2.6.23.17': Opération non supportée
Looking for deps of module initramfs
Looking for deps of module atkbd
Looking for deps of module ahci
No module ahci found for kernel 2.6.23.17, aborting.
mkinitrd failed:
(mkinitrd -v -f /boot/initrd-2.6.23.17.img --ifneeded 2.6.23.17)) at /usr/lib/libDrakX/bootloader.pm line 115.
make[1]: *** [install] Erreur 2
make: *** [install] Erreur 2

i try to change configuration of hdci support but the same error continu
thank you for helping me
 
Make sure you do
Code:
make modules
make modules_install

Before
Code:
make install

I had that same error because I wasn't doing the above.
 
Remember the -j switch!

Code:
make -j3
make -j3 modules
make -j3 modules_install
make -j3 install


replace 3 if # of cores + 1. This will greatly speed up compile times!
 
Remember the -j switch!

Code:
make -j3
make -j3 modules
make -j3 modules_install
make -j3 install


replace 3 if # of cores + 1. This will greatly speed up compile times!

I've heard about this, but have yet to try it because I'm running this on old single core computers!

The single board computer is an AMD Geode 367MHz processor... make itself takes 10 hours+! (I should really learn cross compiling...)
 
The -j switch is AMAZING. With my i7 rig, I can compile a kernel in about 3 minutes using 12 threads. Depending on how much memory you have, you should be able to use more than cores + 1 for number of threads.

Good write up, I'll try out it later today.
 
So I figured I should throw up some example code. Its a simple light an LED program through the parallel port that I wrote to understand the RTAI system calls as well as the posix threading (which wasn't really needed this early). Before running this program make sure to load all the RTAI modules otherwise it won't work. This is a user space task (rather than a kernel module) but it does execute with hard real time priority as I've connected it up to an oscilloscope and checked the periodicity to make sure its all gravy.

So first the 'load rtai modules' script file
Code:
insmod /usr/realtime/modules/rtai_hal.ko
insmod /usr/realtime/modules/rtai_up.ko        # or rtai_lxrt.ko
insmod /usr/realtime/modules/rtai_fifos.ko
insmod /usr/realtime/modules/rtai_sem.ko
insmod /usr/realtime/modules/rtai_mbx.ko
insmod /usr/realtime/modules/rtai_msg.ko
insmod /usr/realtime/modules/rtai_netrpc.ko ThisNode="127.0.0.1"
insmod /usr/realtime/modules/rtai_shm.ko
insmod /usr/realtime/modules/rtai_signal.ko
insmod /usr/realtime/modules/rtai_tasklets.ko

Then my example code
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <rtai_lxrt.h>
#include <rtai_sched.h>
#include <asm/io.h>
#include <pthread.h>

#define TICK_TIME 1000000 //1ms, (ticks in ns)
#define LPT 0x378
static RTIME tick_period,now;
static int count;

void* rt_task(void *arg)
{
  //human readable output
  printf("entered the real time task");
  getchar();
  
  //initialize the real time task data structure
  RT_TASK *task;
  
  //initialize the task itself
  task = rt_task_init(nam2num("test1"),4,1000,0);
  
  //make the task periodic with a tick period set above
  rt_task_make_periodic(task, now+tick_period, tick_period);
  
  //ship the task to the kernel to make it hard real time
  rt_make_hard_real_time();
  
  //count to 1e5 in 1ms counts (LSB=1ms on, 1ms off)
  int i=0;
  for(i=0;i<100000;i++){
  outb(count++, LPT);
  rt_task_wait_period();
  }

  //remove the task from the kernel
  rt_make_soft_real_time();

  //delete all records MI style
  rt_task_delete(task);

  //complete! pause before exiting program
  printf("real time task exited");
  outb(0,LPT);
  getchar();
}

int main (void)
{
  RT_TASK *task;

  //intialize main task, give it identifier
  if(!(task=rt_task_init(nam2num("MNTSK"),5,1000,0)))
   {
      printf("cannot initialize main task!\n");
	exit(1);
    }
  printf("main task initialized\n");

  //open the LPT port for output
  ioperm(LPT,7,1);

  //use posix threading to declare tasks
  pthread_t th0;

  //set periodic mode
  rt_set_periodic_mode();

  //set the tick period in nanoseconds
  tick_period = start_rt_timer(nano2count(TICK_TIME));
  now = rt_get_time();

  //posix thread creation
  pthread_create(&th0,0,rt_task,0);

  //pause before entering real time thread
  getchar();
  
  //join the posix thread
  pthread_join(th0,0);

  //stop the rt_timer
  stop_rt_timer();

  //delete the task
  rt_task_delete(task);    
  return 0;
}

And then the Makefile
Code:
prefix := $(shell rtai-config --prefix)
CC = $(shell rtai-config --cc)
LXRT_CFLAGS = $(shell rtai-config --lxrt-cflags) -I/usr/realtime/lib/
LXRT_LDFLAGS = $(shell rtai-config --lxrt-ldflags)

all: my_first_rtai_prog

my_first_rtai_prog: my_first_rtai_prog.c
	$(CC) $(LXRT_CFLAGS) -o $@ $< $(LXRT_LDFLAGS) -llxrt

clean:
	rm -f my_first_rtai_prog

.PHONY: clean

One last thing. For some reason I get this error associated with a shared object file, so I have to run the following command
Code:
export LD_LIBRARY_PATH=/usr/realtime/lib:$LD_LIBRARY_PATH
I have however, added the path to my .bashrc file but that doesn't seem to fix the problem. If anyone has a solution feel free to let me know.

Good luck!
 
Last edited:
rtai doubt

[rnd@localhost ~]$ cd linux
[rnd@localhost linux]$ patch -p1 < /home/rnd/rtai/rtai-3.6.cv/base/arch/i386/patches/hal-linux-2.6.23-i386-1.12-03.patch
bash: /home/rnd/rtai/rtai-3.6.cv/base/arch/i386/patches/hal-linux-2.6.23-i386-1.12-03.patch: No such file or directory
[rnd@localhost linux]$ patch -p1 < /home/rnd/rtai/rtai-3.6-cv/base/arch/i386/patches/hal-linux-2.6.23-i386-1.12-03.patch
patching file Makefile
patching file arch/i386/Kconfig
patching file arch/i386/Makefile
patching file arch/i386/boot/Makefile
patching file arch/i386/boot/compressed/Makefile
patching file arch/i386/kernel/Makefile
patching file arch/i386/kernel/apic.c
patching file arch/i386/kernel/cpu/mtrr/cyrix.c
patching file arch/i386/kernel/cpu/mtrr/generic.c
patching file arch/i386/kernel/entry.S
patching file arch/i386/kernel/i8253.c
patching file arch/i386/kernel/i8259.c
patching file arch/i386/kernel/io_apic.c
patching file arch/i386/kernel/ipipe.c
patching file arch/i386/kernel/mcount.S
patching file arch/i386/kernel/nmi.c
patching file arch/i386/kernel/process.c
patching file arch/i386/kernel/smp.c
patching file arch/i386/kernel/smpboot.c
patching file arch/i386/kernel/time.c
patching file arch/i386/kernel/traps.c
patching file arch/i386/kernel/vm86.c
patching file arch/i386/lib/mmx.c
patching file arch/i386/mach-visws/visws_apic.c
patching file arch/i386/mm/fault.c
patching file drivers/pci/htirq.c
patching file include/asm-i386/apic.h
patching file include/asm-i386/hw_irq.h
patching file include/asm-i386/i8259.h
patching file include/asm-i386/ipipe.h
patching file include/asm-i386/ipipe_base.h
patching file include/asm-i386/irqflags.h
patching file include/asm-i386/mmu_context.h
patching file include/asm-i386/nmi.h
patching file include/asm-i386/spinlock.h
patching file include/linux/hardirq.h
patching file include/linux/ipipe.h
patching file include/linux/ipipe_base.h
patching file include/linux/ipipe_compat.h
patching file include/linux/ipipe_percpu.h
patching file include/linux/ipipe_tickdev.h
patching file include/linux/ipipe_trace.h
patching file include/linux/irq.h
patching file include/linux/kernel.h
patching file include/linux/linkage.h
patching file include/linux/mm.h
patching file include/linux/preempt.h
patching file include/linux/sched.h
Hunk #3 succeeded at 1193 (offset 1 line).
patching file include/linux/spinlock.h
patching file include/linux/spinlock_types.h
patching file init/Kconfig
patching file init/main.c
patching file kernel/Makefile
patching file kernel/exit.c
patching file kernel/fork.c
Hunk #3 succeeded at 1277 (offset 2 lines).
patching file kernel/ipipe/Kconfig
patching file kernel/ipipe/Kconfig.debug
patching file kernel/ipipe/Makefile
patching file kernel/ipipe/core.c
patching file kernel/ipipe/tracer.c
patching file kernel/irq/chip.c
patching file kernel/power/swsusp.c
patching file kernel/printk.c
patching file kernel/sched.c
patching file kernel/signal.c
patching file kernel/spinlock.c
patching file kernel/time/tick-common.c
patching file lib/Kconfig.debug
patching file lib/bust_spinlocks.c
patching file lib/ioremap.c
patching file lib/smp_processor_id.c
patching file lib/spinlock_debug.c
patching file mm/memory.c
patching file mm/mlock.c
patching file mm/vmalloc.c
[rnd@localhost linux]$ cp /boot/config-2.6.23.1-42.fc8 /home/rnd/linux
cp: cannot stat `/boot/config-2.6.23.1-42.fc8': No such file or directory
[rnd@localhost linux]$ su
Password:
[root@localhost linux]# cp /boot/config-2.6.23.1-42.fc8 /home/rnd/linux
cp: cannot stat `/boot/config-2.6.23.1-42.fc8': No such file or directory
[root@localhost linux]# cp /boot/config-2.6.23.1-42.fc8 /home/rnd/linux


how to give this command
 
[rnd@localhost linux]$ cp /boot/config-2.6.23.1-42.fc8 /home/rnd/linux
cp: cannot stat `/boot/config-2.6.23.1-42.fc8': No such file or directory
[rnd@localhost linux]$ su
Password:
[root@localhost linux]# cp /boot/config-2.6.23.1-42.fc8 /home/rnd/linux
cp: cannot stat `/boot/config-2.6.23.1-42.fc8': No such file or directory
[root@localhost linux]# cp /boot/config-2.6.23.1-42.fc8 /home/rnd/linux


how to give this command

You have it as /home/rnd/linux but it should be /usr/src/linux .
 
So I'm writing this article for a couple reasons. 1) I'm doing this for my master's thesis (the real time control part), 2) I've run into a couple interesting problems so I figured posting them to the internet would hopefully help someone else searching for a solution in the future and 3) I'm a Linux newbie so its an adventure for me as well.

Now lets provide a little bit of technical background. With the 2.6 kernel there are lots of processes that are fully preemptable. So in terms of a real time system this is bad. We need what is called a 'hard real time system' which means that when the system receives an interrupt it responds within a certain deterministic period of time to it. There are two types of real time systems in this case, 'hard' and 'soft'. A simple example would be that a 'soft real time system' is like answering your cell phone, you can pick it up immediately (deterministic) you can miss the call (failing the interrupt) but still call the person back and your cell phone doesn't blow up. If you fail the interrupt for a hard real time system, like say not reacting fast enough to an obstacle in the road while driving a car, you'll hit the object and wreck your car. So failing to respond properly to interrupts in this case has dire consequences.

So our goal is to find a way to schedule our process threads in that they always start and end within a specific period of time.

Enter the Real Time Application Interface (RTAI)! So I won't go into a discussion here, but there are lots of available solutions to this real time problem. Since I'm doing this at a university I want free (and on Linux so open source). In that case you can check out Xenomai, RTAI, and PREEMPT_RT, as well as numerous others. The other benefits of RTAI are that you can link it with SciLab (open source MatLab) and use Scicos (open source Simulink) and create block diagrams that support DAQ cards and related hardware. I'm using a single board computer and not a standard DAQ that is supported by this so I'll be writing a bunch of C code instead of using a nice GUI. (Also this means that you'll have to consider looking at other guides to install those parts.)

Now to take a quick tangent, why do you care about real time systems? Well it can be fun to screw around with if you are so inclined, plus if you have a really old computer, you can use your standard parallel port to do real time i/o! So you can do real time control without purchasing a $1000+ DAQ.

So, moving on. RTAI has a good amount of documentation and install guides around in case you want to find it. This is their complete guide to RTAI 3.6 and the Scilab extensions. I used this as a general guide but I want to provide a guide that is specific to Fedora 8, as well as address some of the interesting problems I ran into. In general almost all errors were fixed by a good google search, and the guys behind RTAI respond quickly to their mail list if you ask a question.

So to get to where I am, with just the patched real time kernel and RTAI installed to where I can run real time programs, you don't need a lot (2 files). The first is the newest RTAI release, 3.6-cv is the closure version of their 3.6 software. You can download the tarball here. (The hidden thing here is that there are lots of kernel versions supported, you can find them all once you extract the tarball and check out the ../rtai/base/arch/i386/patches/... directory. ((also they support x86_64 architectures as well)) I'm using Fedora 8 because it natively supports the kernel version that RTAI supports. (We pulled a Goldilocks approach the first time, Fedora 7 upgrade to 2.6.23 which didn't work, and a Fedora 10 to a lower patch with also failed). So download rtai-3.6-cv.tar.bz2 to wherever you want. I'll be working out of /usr/src by default so keep that in mind as you follow along.

So I've unpacked rtai into /usr/src/rtai-3.6-cv . You might consider making links so its quicker, but tab-complete[1] works wonders as well.
Code:
ln -s rtai-3.6-cv rtai
Now because of prior knowledge I know I want to work with the 2.6.23 kernel version. Go to kernel.org and download the vanilla kernel 2.6.23.tar.bz2 (the absolute base version, no updates). Unpack it and create another link if you want
Code:
tar -xvjf linux-2.6.23.tar.bz2
ln -s linux-2.6.23 linux

So now move the linux directory and we have to apply the RTAI patch first before we mess with the config file.
Code:
cd /usr/src/linux
patch -p1 < /usr/src/rtai/base/arch/i386/patches/hal-linux-2.6.23-i386-1.12-03.patch
Let that run and when its done run copy over your current install config and then run make menuconfig
Code:
cp /boot/config-2.6.23.1-42.fc8 /usr/src/linux
make menuconfig
First in menuconfig go down and select 'Load Alternate Configuration". Load up the config file you just copied over, note that this line doesn't respond to tab-complete so type it in correctly! So now in menuconfig we want to select a couple things and either make sure they are off or won't get in the way later. (Oh god did I spend so much time fixing things that got in the way later... kernel compiles on a 367 Mhz machine take forever!)
I've pulled these directly from the RTAI documentation:
- Enable loadable module support: select “Enable module support”, “Module unloading”, and “Auto-matic module loading”. Deselect “Module versioning support”; RTAI modules are not version dependent.
- Processor type and features: Select your Subarchitecture Type (PC-Compatible) and Processor family. Select ”Preemption Model (Preemptible kernel (Low-Latency Desktop))”. You might need “High Memory Support (4GB)” if you use a PCMCIA data acquisition card. Deselect ”Use register arguments (EXPERIMENTAL)”. Possibly deselect “Local APIC support on uniprocessors[2]”.
- Power Management options: Select ACPI Support and features relevant to your hardware. Leave APM deselected. Leave CPU Frequency scaling unselected. Warning: ACPI support may be a problem on laptops that use the “screen closed” button to put the computer into sleep or standby modes.
- Bus options: Leave the default. Check the support for your hardware. Laptops need PCCARD (PCMCIA/CardBus) support and PC-card bridges. e.g. CardBus yenta-compatible bridge support

So now make sure to save your config when you exit out. If for some reason it doesn't ask if you want to save it when you exit, just 'Save As Alternate Configuration' and save it as .config .

Run make, and walk away depending on the speed of your computer. Then run the make commands and reboot into your new -rtai kernel. I wouldn't edit your grub.conf yet just it case your kernel compile doesn't boot
Code:
make
make modules
make modules_install
make install

So now that you have rebooted into your rtai patched kernel go to your rtai directory and run make menuconfig. There aren't really any options in here you want to mess with, this is just the quickest way to get the .config file built! The only option you might want to check is the 'Menu Machine (x86): adjust Number of CPUs (default = 2)' for the obvious reasons. Exit out of this and it runs make automatically.
Code:
make install

Now we check to make sure that you can load the RTAI modules and then you are at square 1 to start writing real time code!
Code:
insmod /usr/realtime/modules/rtai_hal.ko
insmod /usr/realtime/modules/rtai_up.ko        # or rtai_lxrt.ko
insmod /usr/realtime/modules/rtai_fifos.ko
insmod /usr/realtime/modules/rtai_sem.ko
insmod /usr/realtime/modules/rtai_mbx.ko
insmod /usr/realtime/modules/rtai_msg.ko
insmod /usr/realtime/modules/rtai_netrpc.ko ThisNode="127.0.0.1"
insmod /usr/realtime/modules/rtai_shm.ko
insmod /usr/realtime/modules/rtai_signal.ko
insmod /usr/realtime/modules/rtai_tasklets.ko
If those load up without error you are good to go! Congrats, go control something!

Also if you stop here I would also consider downloading the User Guide 3.4 because it has a lot of example code and such if you aren't going to use the graphical interface in Scilab. Available here.

To come later. Writing RTAI script files and module compilation!

[1] Use tab-complete where available, I didn't write down the exact code I used in my notes but just the general outline
[2] APIC support is tricky. If your computer has an APIC (setting in BIOS) you can leave this enabled and you should be fine. The second interesting thing is that in make menuconfig the option doesn't exist at all! So I had to edit the .config file itself to manually set the _APIC=n options. Then! after running make it runs another script file for configurations which resets these! So I had to edit ./arch/i386/Kconfig and set all the _APIC settings here to 'default=n'
[3] Since I'm a Linux newbie some of that stuff can be run as user and the makes all as root. I just pretty much do things as root, which is apparently bad practice...

hii,
i'm trying to download the RTAI 3.6 from www.rtai.org but i think the link is dead.
can you give an other link to download it???

thanks
 
Roofles
Great job you did here. Thank you very much, I am following your instruccions in building patching the kernel, and just have a few error messages, but now im stucked in the make menuconfig in the rtai directory.

Cheers,
 
Roofles
How mai I re-install the mesa library as the rtal-lab tutorial tell to do, What version of mesa library this distro (fedora 8) has?
 
hii,
i'm trying to download the RTAI 3.6 from www.rtai.org but i think the link is dead.
can you give an other link to download it???

thanks

Theamy: https://www.rtai.org/RTAI/rtai-3.6-cv.tar.bz2 should be a direct link.

Roofles
How mai I re-install the mesa library as the rtal-lab tutorial tell to do, What version of mesa library this distro (fedora 8) has?

Since my code will end up running on an embedded system, I have no use for the visualization as well as the installation methods for the Scilab support with RTAI and RTAI-lab. I'm exclusively using the real time kernel functionality and writing all my code in C.

In short. I used whatever the default Mesa installation version is with Fedora 8. When I attempted to go all the way with the RTAI installation to install the above I still used the default version.

I'm not sure I can help with the error messages in the RTAI make menuconfig, but I can try. That being said the mailing list at rtai.org is quite active and I would suggest asking specific questions there as the guys who actually wrote the RTAI extensions will often respond to your questions.

Good luck!
 
Thank you!
I want to design a whole control system but running from pc, actually with an "old pc", I thought to make it in an embedded way, but it scared me a bit, first of all because of the boards costs.
 
Thank you!
I want to design a whole control system but running from pc, actually with an "old pc", I thought to make it in an embedded way, but it scared me a bit, first of all because of the boards costs.

We are spending about $1000 for my embedded controller. For the amount of I/O (atd and such) we can't touch that price using NI hardware.
 
Error while insert rtai_netrpc module

Hello all,
I am using RTAI 3.7 on my Ubuntu 8.04. I am getting error while I load rtai module from rtai_netrpc. I downloaded the modules by the following order.

rtai_hal
rtai_ksched
rtai_math
rtai_fifos
rtai_shm
rtai_sem
rtai_mbx
rtai_msg
rtai_netrpc
rtai_leds
rtai_signal
rtai_tasklets

insmod: error inserting '/usr/realtime/modules/rtai_netrpc.ko': -1 Unknown symbol in module

The dmesg info is,

[ 643.084803] rtai_netrpc: Unknown symbol __rt_dev_ioctl
[ 643.084867] rtai_netrpc: Unknown symbol __rt_dev_socket
[ 643.085298] rtai_netrpc: Unknown symbol __rt_dev_sendmsg
[ 643.085498] rtai_netrpc: Unknown symbol __rt_dev_close
[ 643.085929] rtai_netrpc: Unknown symbol __rt_dev_recvmsg

Help me to load the rtai_netrpc module successfully.

Thanks & Regards,
Prakash.
 
insmod rtai_rtdm NOT rtai_ksched

Hello all,
I am using RTAI 3.7 on my Ubuntu 8.04. I am getting error while I load rtai module from rtai_netrpc. I downloaded the modules by the following order.

rtai_hal
rtai_ksched
rtai_math
rtai_fifos
rtai_shm
rtai_sem
rtai_mbx
rtai_msg
rtai_netrpc
rtai_leds
rtai_signal
rtai_tasklets

insmod: error inserting '/usr/realtime/modules/rtai_netrpc.ko': -1 Unknown symbol in module

The dmesg info is,

[ 643.084803] rtai_netrpc: Unknown symbol __rt_dev_ioctl
[ 643.084867] rtai_netrpc: Unknown symbol __rt_dev_socket
[ 643.085298] rtai_netrpc: Unknown symbol __rt_dev_sendmsg
[ 643.085498] rtai_netrpc: Unknown symbol __rt_dev_close
[ 643.085929] rtai_netrpc: Unknown symbol __rt_dev_recvmsg

Help me to load the rtai_netrpc module successfully.

Thanks & Regards,
Prakash.

----------------------------------------------------------------------------------------------------------------------
rtai_netrpc need the support of rtai_rtdm !
And Insmod rtai_lxrt instead of rtai_ksched !
I got the same problem as you and after I goole i found there is no answer for this question. After tried serveral times, i got it. Hope this will help you.
 
Back