Xenomai is a real-time development framework cooperating with the Linux kernel, in order to provide a pervasive, interface-agnostic, hard real-time support to user-space applications, seamlessly integrated into the GNU/Linux environment.http://en.wikipedia.org/wiki/Xenomai
if you just want to try xenomai here is my latest image : xenomai.img
SHA-1 |
bb71b783d3d20edd58287eb1b0bf49bd5d9007de |
Default login |
Username: jed Password: jed |
Download the source tree and patches
On your Linux PC move to your home directory and download Chris Boot’s rpi-3.2.21 branch (https://github.com/bootc/linux/tree/rpi-3.2.21). and then get the patch provide by ian-cim rpi-linux-3.2.21-xenomai-2.6.1.patch
I advice you to used this cross-Compile tools : https://github.com/raspberrypi/tools
Configure your environnement
export linux_tree =/home/$USER/raspberry/linux
export xenomai_root =/home/$USER/raspberry/xenomai-2.6.1
export ARCH=ARM
export CROSS_COMPILE=arm-bcm2708-linux-gnueabi
Applying the patches for the Raspberry PI
Xenomai 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
Raspberry PI Patch
cd $linux_tree
patch -p1 < rpi-linux-3.2.21-xenomai-2.6.1.patch
Configuring your Kernel
You can use my configuration kernel .config or custom it ( make menuconfig)
Make the kernel
You can now compile the actual kernel
make
The resulting kernel file is « linux/arch/arm/boot/Image »
Copy your Kernel
cp linux/arch/arm/boot/Image /media/<boot-partition-of-SD-card>/kernel.img
First Kernel starting
Linux version 3.2.21-ipipe (jed@jed-laptop) (gcc version 4.7.1 20120402 (prerelease) (crosstool-NG 1.15.2) ) #2 Thu Jul 26 09:59:17 CEST 2012
CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: BCM2708
Memory policy: ECC disabled, Data cache writeback
On node 0 totalpages: 57344
free_area_init_node: node 0, pgdat c0406d64, node_mem_map c0486000
Normal zone: 448 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 56896 pages, LIFO batch:15
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 56896
Kernel command line: dma.dmachans=0x3c bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0x2 bcm2708.serial=0x21cf4cef smsc95xx.macaddr=B8:27:EB:CF:4C:EF dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
….
Compile Xenomai
$ cd $xenomai_root
$ ./configure –host=arm-bcm2708-linux-gnueabi
$ make DESTDIR=/destination/of/xenomai/ install
finally copy the files of Xenomai in the sdcard.
Configure your environnement
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/xenomai/lib
Test Xenomai
root@raspberrypi:~$ /usr/xenomai/bin/latency -p 100 -T 60
== Sampling period: 100 us
== Test mode: periodic user-mode task
== All results in microseconds
warming up…
RTT| 00:00:01 (periodic user-mode task, 100 us period, priority 99)
RTH|—-lat min|—-lat avg|—-lat max|-overrun|—msw|—lat best|–lat worst
RTD| -6.000| -4.000| 8.000| 0| 0| -6.000| 8.000
RTD| -7.000| -4.000| 11.000| 0| 0| -7.000| 11.000
RTD| -7.000| -4.000| 11.000| 0| 0| -7.000| 11.000
RTD| -7.000| -4.000| 7.000| 0| 0| -7.000| 11.000
RTD| -6.000| -4.000| 8.000| 0| 0| -7.000| 11.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 11.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 11.000
RTD| -6.000| -3.000| 14.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -7.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -7.000| -4.000| 12.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 7.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 8.000| 0| 0| -7.000| 14.000
RTD| -7.000| -4.000| 12.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 12.000| 0| 0| -7.000| 14.000
RTD| -7.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 13.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 9.000| 0| 0| -7.000| 14.000
RTT| 00:00:22 (periodic user-mode task, 100 us period, priority 99)
RTH|—-lat min|—-lat avg|—-lat max|-overrun|—msw|—lat best|–lat worst
RTD| -6.000| -4.000| 14.000| 0| 0| -7.000| 14.000
RTD| -7.000| -4.000| 6.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 7.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -7.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 9.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -7.000| -4.000| 8.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -7.000| -4.000| 14.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -7.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTT| 00:00:43 (periodic user-mode task, 100 us period, priority 99)
RTH|—-lat min|—-lat avg|—-lat max|-overrun|—msw|—lat best|–lat worst
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 7.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 9.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 9.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 8.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 7.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 9.000| 0| 0| -7.000| 14.000
RTD| -7.000| -4.000| 11.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 10.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 8.000| 0| 0| -7.000| 14.000
RTD| -6.000| -4.000| 13.000| 0| 0| -7.000| 14.000
—|———–|———–|———–|——–|——|————————-
RTS| -7.000| -3.000| 14.000| 0| 0| 00:01:00/00:01:00
Is the img ready to use on the raspi ?
hello,
thanks for this.
Very interesting work! Is there a place to download the image of the weezy distro patched with Xenomai?
http://powet.eu/raspberrypi/xenomai.img
Hi,
I have copied the xenomai image into a sdcard.
I compiled an example using: gcc -I/usr/xenomai/include ex01.c -L/usr/xenomai/lib -lnative -lxenomai -o ex01. It worked ok. Then I tried to run the example: ./ex01. I received this message: ./ex01: error while loading shared libraries: libnative.so.3: cannot open shared object file: No such file or directory.
Do you have any idea to solve this problem?
Thanks.
HI,
I think you forgot to export xenomai libraries .
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/xenomai/lib
Hi Jed,
Thank you very much for your quick answer.
In fact, I have exported LD_LIBRARY_PATH (I included in .bashrc).
Printing the environmental variables using printenv I get this:
jed@jedPI:~$ printenv
TERM=xterm
SHELL=/bin/bash
SSH_CLIENT=10.48.126.237 52832 22
SSH_TTY=/dev/pts/0
USER=jed
LD_LIBRARY_PATH=:/usr/xenomai/lib
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
MAIL=/var/mail/jed
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/home/jed
LANG=fr_FR.UTF-8
SHLVL=1
HOME=/home/jed
LOGNAME=jed
SSH_CONNECTION=10.48.126.237 52832 10.48.13.84 22
_=/usr/bin/printenv
jed@jedPI:~$ ^C
jed@jedPI:~$
The problem persists…
Hi Jed,
I printed the shared library dependencies:
jed@jedPI:~$ ldd hello2
libnative.so.3 => /usr/xenomai/lib/libnative.so.3 (0x40117000)
libxenomai.so.0 => /usr/xenomai/lib/libxenomai.so.0 (0x40045000)
libc.so.6 => /lib/libc.so.6 (0x40126000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40257000)
librt.so.1 => /lib/librt.so.1 (0x4007d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x400ec000)
/lib/ld-linux.so.3 (0x40014000)
Everything seems ok. Do we need to start another service before running hello2?
You need to be root to use xenomai.
Yeah!
You are correct! It works now! I have to export LD_LIBRARY_PATH as root before running hello2.
Thank you very much for your support.
Hi
What command do you use to export LD_LIBRARY_PATH as root? I’ve exactly the same problem than you.
Thanks
Hi i have followed you instruction to compile kernel with xenomai into
raspberry. It compile week, but when i use new kernel, raspberry
doesn’t start. I use raspbian distribution given from raspberry main
site.
Can you give me some hints?
thanks in advanced
Hi,
If you just copied the « Image » file to « kernel.img » in the boot partition of your SD card and the Raspberry Pi doesn’t boot (black screen, only red powerled on), get the most recent firmware from github and copy the files from firmware/boot/ to the boot partition of your SD card
cd firmware/boot cp arm128_start.elf arm192_start.elf arm224_start.elf bootcode.bin loader.bin start.elf /media//
I have same issue. What else we need to do to make SD partition bootable? I have also one question does xenomai.img which you posted here have support for ethernet? When I type ifconfig I don’t receive IP address of my ethernet adapter.
The current http://powet.eu/raspberrypi/xenomai.img
does not boot and have a different sha1. Can you check it please?
I am also having trouble getting the current .img to boot.
Hi,
thank you for providing this image. However, I also get a different SHA-1:
ab179fd019e3f7d41312b840f5b8c134465fd854
Is that the correct one?
Also, I would suggest to gzip the image file, it is huge and takes a very long while to download.
Hi,
Do you know how to compile a kernel for execute this xenomai image on qemu ?
Thanks !
Great instructions!
I have this all running now… latencies seem reasonable although tested mostly unloaded. 25us max for klatency. irqloop seems to crash though… did you find this?
Hello James,
would you share how you fixed it?
hi i have a problem when compiling:
sudo make modules
make[1]: Nothing to be done for `relocs’.
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CC arch/x86/kernel/asm-offsets.s
In file included from include/linux/sched.h:65:0,
from arch/x86/kernel/asm-offsets.c:9:
include/linux/ipipe.h:33:23: fatal error: asm/ipipe.h: No such file or directory
compilation terminated.
make[1]: *** [arch/x86/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
sorry for » make modules » but is teh same with « make »
sudo make
[sudo] password for pablo:
make[1]: Nothing to be done for `relocs’.
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CC arch/x86/kernel/asm-offsets.s
In file included from include/linux/sched.h:65:0,
from arch/x86/kernel/asm-offsets.c:9:
include/linux/ipipe.h:33:23: fatal error: asm/ipipe.h: No such file or directory
compilation terminated.
make[1]: *** [arch/x86/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
what is my problem?
I failed with ./configure step. I used arm-bcm2708-linux-gnueabi crosscompiler from tools-master git and it states : checking whether C compiler works … no. Inspecting config.log:
fatal error: -fuse-linker-plugin, but liblto_plugin.so not found. When change liblto_plugin.so.0.0.0, which I have, to liblto_plugin.so, new error is: cannot find /lib/libc.so.6 inside NAME of FOLDERs… When find libc.so, which I have in tools-master, and copy (with addition of .6) to folder in NAME of FOLDERs, then next error is: cannot open libc.so.6 too many files are open – which is certainly not. My Ubuntu allows about 100000 opened files.
It is strange to me even to do any of steps above -everything should go smoothly.
Mistake – I copied and changed libc.so.6 from libc-2.13.so in same /lib folder. Also error states – missing ld-linux.so.3, which I copied and change from ld-2.13.so in /lib folder. Then configuration – done, but when I start make, error appears when building testsuite: libpthread_rt.so: undefined reference to pthread_atfork.
I did everything from the start and it passed all the steps (where did I go wrong before ?), but when I start at /usr/xenomai/bin program latency it says libnative.so.3: cannot open shared object file: No such file or directory. I defined LD_LIBRARY_PATH as /usr/xenomai/lib and it doesn’t work no matter if I am user or root.
File is link and it does exist in /usr/xenomai/lib.
Merci pour l’article interessant.
hello, excellent post.
I have problems downloading the image xenomai.img because of the size (I guess).
Twice I downloaded and I got two different SHA_1 🙁
Could you please zip the image?
thanks in advance.
Hi Jed,
I have the same problem than others when running an aplication with the libraries.
« error while loading shared libraries: libnative.so.3: cannot open shared object file: No such file or directory »
I’ve exported the libraries, as you said before, but the problem persist, I’ve printed the shared library dependences:
[jed@jedPI Pi]$ ldd rtt
libnative.so.3 => not found
libxenomai.so.0 => not found
libc.so.6 => /lib/libc.so.6 (0x4028d000)
/lib/ld-linux.so.3 (0x400e3000)
Any idea about where is the problem?
Thanks for the post, is so good!
If have trouble getting the Linux 3.2.21 tree because GitHub is showing an error « Tree took too long to generate », download it from here:
https://github.com/bootc/linux/archive/rpi-3.2.27.zip
I meant:
https://github.com/bootc/linux/archive/rpi-3.2.21.zip
I figured out that to download a version of the cross compile tools without symlink problems the ZIP file has and set the CROSS_COMPILE variable correctly, you can do the following:
cd Downloads
wget https://github.com/raspberrypi/tools/archive/master.tar.gz
tar zxvf master.tar.gz
export CROSS_COMPILE= »`pwd`/tools-master/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi- »
# There is no error here, it really ends with a dash, this is because it’s only a prefix, the Makefile will then add « cc » to it making it arm-bcm2708-linux-gnueabi-cc.
You should now be able to run « make » without errors.
My last comments on this subject:
As I didn’t success to resolve problems due to Xenomai compilation, I simply advise to compile it directly on the raspberry pi. Run « ./configure » and « sudo make install ».
Then you should have a properly working Xenomai installation.
RTS: -8, -4, 12, 0, 0