[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
no way to compare when less than two revisions
Diferencias
Muestra las diferencias entre dos versiones de la página.
— | es:howtos:software:rtai [2019/02/28 01:52 (UTC)] (actual) – creado slackwarespanol | ||
---|---|---|---|
Línea 1: | Línea 1: | ||
+ | ====== RTAI ====== | ||
+ | <note important> | ||
+ | Under construction. | ||
+ | Please obtain example code from the [[https:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Introduction ===== | ||
+ | |||
+ | RTAI is a system that allows your Linux operating system to run so-called ' | ||
+ | something regularly, to a schedule dictated by you, no matter how heavily loaded the system. | ||
+ | |||
+ | < | ||
+ | ===== Getting RTAI ===== | ||
+ | |||
+ | You can download the latest version of RTAI from the website: | ||
+ | |||
+ | < | ||
+ | # wget https:// | ||
+ | # tar xvf rtai-5.1.tar.bz2 | ||
+ | # cd rtai-5.1 | ||
+ | </ | ||
+ | |||
+ | ===== Identifying the HAL patch ===== | ||
+ | |||
+ | RTAI requires the application of kernel patches, but carries patches only for certain kernel versions. | ||
+ | |||
+ | < | ||
+ | # find ./ -name hal\*.patch | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | </ | ||
+ | |||
+ | Now check your own kernel version: | ||
+ | |||
+ | < | ||
+ | # uname -r | ||
+ | 4.4.14 | ||
+ | </ | ||
+ | |||
+ | We can see that the closest kernel with a HAL patch after this is 4.4.71, so that's the one to aim for. For now just copy the patch to the kernel source location: | ||
+ | |||
+ | < | ||
+ | # cp base/ | ||
+ | </ | ||
+ | |||
+ | ===== Switching Kernel Version ===== | ||
+ | |||
+ | We need to get ourselves on a kernel of the correct version (above) before we do anything else. Start by downloading and uncompressing the new version: | ||
+ | |||
+ | < | ||
+ | # cd /usr/src | ||
+ | # wget https:// | ||
+ | # tar xvf linux-4.4.71.tar.xz | ||
+ | # cd linux-4.4.71 | ||
+ | </ | ||
+ | |||
+ | Now use the existing configuration as a base and 'make oldconfig' | ||
+ | |||
+ | < | ||
+ | # zcat / | ||
+ | # make oldconfig | ||
+ | </ | ||
+ | |||
+ | If you have a more obscure filesystem for your root partition you may now want to 'make menuconfig' | ||
+ | |||
+ | < | ||
+ | # make | ||
+ | </ | ||
+ | |||
+ | And then copy the results to install: | ||
+ | |||
+ | < | ||
+ | # make modules_install | ||
+ | # cp arch/ | ||
+ | # cd /boot | ||
+ | </ | ||
+ | |||
+ | Edit the lilo config: | ||
+ | |||
+ | < | ||
+ | # vi / | ||
+ | </ | ||
+ | |||
+ | And ensure there' | ||
+ | |||
+ | < | ||
+ | image = / | ||
+ | root = /dev/sda1 | ||
+ | label = Linux-4.4.71 | ||
+ | read-only | ||
+ | </ | ||
+ | |||
+ | Leave the other kernel image section in there as a second option in case something goes wrong with the boot, but you want to make the new one the default (the first entry). | ||
+ | |||
+ | ===== Patching the Kernel ===== | ||
+ | |||
+ | When you're sure that new kernel works and your system boots and functions, now's the time to add the RTAI patches: | ||
+ | |||
+ | < | ||
+ | # cd / | ||
+ | # patch -p1 < / | ||
+ | </ | ||
+ | |||
+ | And now you can make the kernel again. | ||
+ | |||
+ | < | ||
+ | # make | ||
+ | </ | ||
+ | |||
+ | If there are any prompted questions about the RTAI it's safe to leave them as defaults. | ||
+ | Next install the new kernel. | ||
+ | |||
+ | < | ||
+ | # make modules_install | ||
+ | # cp arch/ | ||
+ | </ | ||
+ | |||
+ | You've already configured LILO, so just re-run it to reference the newly copied kernel: | ||
+ | |||
+ | < | ||
+ | # lilo | ||
+ | </ | ||
+ | |||
+ | Reboot the machine to ensure that the new kernel works. | ||
+ | |||
+ | ===== Compiling/ | ||
+ | |||
+ | Before compiling RTAI itself we must ensure / | ||
+ | |||
+ | < | ||
+ | # cd /usr/src | ||
+ | # rm linux | ||
+ | # ln -s linux-4.4.71 linux | ||
+ | </ | ||
+ | |||
+ | Next just compile in the normal way: | ||
+ | |||
+ | < | ||
+ | # cd rtai-5.1 | ||
+ | # ./configure | ||
+ | # make | ||
+ | # make install | ||
+ | </ | ||
+ | |||
+ | At this point, some kernel modules should have arrived in / | ||
+ | For now you can load them manually, however in the future you can add them to / | ||
+ | |||
+ | < | ||
+ | # / | ||
+ | # / | ||
+ | # / | ||
+ | </ | ||
+ | |||
+ | Check they are there: | ||
+ | |||
+ | < | ||
+ | # lsmod | grep rtai | ||
+ | rtai_fifos | ||
+ | rtai_sched | ||
+ | rtai_hal | ||
+ | </ | ||
+ | |||
+ | Now we need to ensure we can link to the libraries: | ||
+ | |||
+ | < | ||
+ | vim / | ||
+ | </ | ||
+ | |||
+ | Add the line: | ||
+ | |||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | and then run (as root): | ||
+ | |||
+ | < | ||
+ | # ldconfig | ||
+ | </ | ||
+ | |||
+ | Finally, we are ready to write our first RTAI program. | ||
+ | |||
+ | ===== Example Program ===== | ||
+ | |||
+ | Here's an example Makefile to compile a really simple realtime program. | ||
+ | |||
+ | < | ||
+ | CC = $(shell / | ||
+ | LXRT_CFLAGS = $(shell / | ||
+ | LXRT_LDFLAGS = $(shell / | ||
+ | |||
+ | all:: rtai-example | ||
+ | |||
+ | rtai-example: | ||
+ | $(CC) $(LXRT_CFLAGS) -o $@ $< $(LXRT_LDFLAGS) -llxrt | ||
+ | | ||
+ | clean:: | ||
+ | $(RM) -f rtai-example *~ | ||
+ | | ||
+ | .PHONY: clean | ||
+ | </ | ||
+ | |||
+ | And here is the demo program, rtai-example.c: | ||
+ | |||
+ | < | ||
+ | TODO | ||
+ | </ | ||
+ | |||
+ | ===== Dedication ===== | ||
+ | |||
+ | This page is dedicated to the memory of captain@captain.at whos pages have been a great source of information | ||
+ | in kernel and realtime programming. | ||
+ | |||
+ | RIP Captain. | ||
+ | |||
+ | ====== Sources ====== | ||
+ | * Originally written by [[wiki: | ||
+ | |||
+ | {{tag> |