Menu

RT Raspberry Linux / Blog: Recent posts

Compile and run a small xenomai example application

root@raspberrypi:/opt/raspberrypi/xenomai-2.6.1/examples/native# make
gcc -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -D__XENO__ -lnative -L/usr/xenomai/lib -lxenomai -lpthread -lrt -Xlinker -rpath -Xlinker /usr/xenomai/lib trivial-periodic.c -o trivial-periodic
gcc -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -D__XENO__ -lnative -L/usr/xenomai/lib -lxenomai -lpthread -lrt -Xlinker -rpath -Xlinker /usr/xenomai/lib sigdebug.c -o sigdebug
gcc -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -D__XENO__ rtprint.c -lnative -L/usr/xenomai/lib -lxenomai -lpthread -lrt -Xlinker -rpath -Xlinker /usr/xenomai/lib -o rtprint... read more

Posted by Joscha Ihl 2012-10-20

Installing xenomai user space tools

After you prepared the kernel for xenomai you can install the user space tools
- Run the configure script of xenomai
./configure --
- Build xenomai tools
make
- Install the build tools
make install
- Run the latency test script of xenomai

root@raspberrypi:/opt/raspberrypi/xenomai-2.6.1# /usr/xenomai/bin/latency -T 25
== Sampling period: 1000 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up...
RTT| 00:00:01 (periodic user-mode task, 1000 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD| -4.000| -1.000| 26.000| 0| 0| -4.000| 26.000
RTD| -4.000| 0.000| 27.000| 0| 0| -4.000| 27.000
RTD| -4.000| 0.000| 25.000| 0| 0| -4.000| 27.000
RTD| -4.000| -1.000| 27.000| 0| 0| -4.000| 27.000
RTD| -4.000| -1.000| 28.000| 0| 0| -4.000| 28.000
RTD| -4.000| -1.000| 24.000| 0| 0| -4.000| 28.000
RTD| -4.000| 0.000| 27.000| 0| 0| -4.000| 28.000
RTD| -5.000| -1.000| 29.000| 0| 0| -5.000| 29.000
RTD| -4.000| -1.000| 26.000| 0| 0| -5.000| 29.000
RTD| -6.000| -1.000| 30.000| 0| 0| -6.000| 30.000
RTD| -4.000| 0.000| 29.000| 0| 0| -6.000| 30.000
RTD| -4.000| 0.000| 28.000| 0| 0| -6.000| 30.000
RTD| -4.000| 0.000| 30.000| 0| 0| -6.000| 30.000
RTD| -4.000| -1.000| 25.000| 0| 0| -6.000| 30.000
RTD| -4.000| -1.000| 25.000| 0| 0| -6.000| 30.000
RTD| -4.000| -1.000| 28.000| 0| 0| -6.000| 30.000
RTD| -4.000| 0.000| 27.000| 0| 0| -6.000| 30.000
RTD| -4.000| -1.000| 22.000| 0| 0| -6.000| 30.000
RTD| -4.000| -1.000| 27.000| 0| 0| -6.000| 30.000
RTD| -4.000| 0.000| 29.000| 0| 0| -6.000| 30.000
RTD| -4.000| -1.000| 26.000| 0| 0| -6.000| 30.000
RTT| 00:00:22 (periodic user-mode task, 1000 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD| -5.000| -1.000| 32.000| 0| 0| -6.000| 32.000
RTD| -4.000| -1.000| 33.000| 0| 0| -6.000| 33.000
RTD| -5.000| 0.000| 27.000| 0| 0| -6.000| 33.000
---|-----------|-----------|-----------|--------|------|-------------------------
RTS| -6.000| 0.000| 33.000| 0| 0| 00:00:25/00:00:25
... read more

Posted by Joscha Ihl 2012-10-20

Installing a RealTime Kernel based on xenomai

  1. Log in into your Raspberry PI.
  2. Install module-init-tools:
    apt-get install module-init-tools
  3. Download the Raspberry PI Linux Kernel 3.2.21 via git
    git clone --branche=rpi-3.2.21 --depth 1 git://github.com/bootc/linux.git
  4. Download xenomai 2.6.1
    wget http://download.gna.org/xenomai/stable/xenomai-2.6.1.tar.bz2
  5. Download and apply the raspberry PI Xenomai Patch
    http://www.cim.mcgill.ca/~ian/rpi-linux-3.2.21-xenomai-2.6.1.patch
  6. Copy your current Linux Configuration into your Linux-Kernel-Source-Tree
    zcat /proc/config.gz > /path/to/kerneltree/.config
  7. Comment out some stuff in your Kernel.config, which are good for reducing the latency
    # CONFIG_NO_HZ
    # CONFIG_CC_STACKPROTECTOR
    # XENO_OPT_STATS
    Select via make menuconfig:
    Go to: "Kernel Features -> Preemption Model" and set "Preemptible Kernel (Low-Latency Desktop)"
  8. Patch the kernel with the rpi-linux-3.2.21-xenomai-2.6.1.patch
    patch -p1 ...
  9. Apply the xenomai 2.6.1 Patch
    $xenomai_root/scripts/prepare-kernel.sh --arch=arm \
    --adeos=$xenomai_root/ksrc/arch/arm/patches/ipipe-core-3.2.21-arm-1.patch \
    --linux=$linux_tree
  10. Compile the kernel and the kernel modules (higher priorities with nice could make the compiler process faster)
    nice -n -10 make && nice -n -10 make modules
  11. Make a copy of your old kernel, if the system will not boot you can maybe replace it if you replace the file on the SD Card:
    cp /boot/kernel.img /boot/kernel.old
  12. Copy the Kernel Image into /boot
    cp arch/arm/boot/Image /boot/kernel.img
  13. Install the kernel modules
    make ARCH=arm modules_install INSTALL_MOD_PATH=/
  14. Add a group "udevd" for xenomai
    groupadd xenomai
  15. Reboot and hope that it works... read more
Posted by Joscha Ihl 2012-10-20
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.