kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Xenomai Packages

Tue Apr 15, 2014 5:35 am

I'm posting the following packages in case somebody finds them useful. The instructions for creating them is documented here.

3.8 kernel:
linux-image-3.8.13-xenomai+_1.0.gpo_armhf.deb
linux-headers-3.8.13-xenomai+_1.0.gpo_armhf.deb

3.10 kernel:
linux-image-3.10.38-xenomai+_1.1_armhf.deb
linux-headers-3.10.38-xenomai+_1.1_armhf.deb

Xenomai userspace:
xenomai-runtime_2.6.3_armhf.deb
libxenomai-dev_2.6.3_armhf.deb
libxenomai1_2.6.3_armhf.deb

After installing the kernel, you'll need to rename the vmlinuz file, example:

Code: Select all

sudo dpkg -i linux-image-3.8.13-xenomai+_1.0.gpo_armhf.deb
sudo mv /boot/vmlinuz-3.8.13-xenomai+ /boot/kernel.img
Cheers!


UPDATE:
I've now setup a repository to hold these files at http://0ptr.link/raspbian.

To use:

Code: Select all

sudo sh -c \
   "apt-key adv --keyserver hkp://keys.gnupg.net --recv-key 49550439; \
   echo 'deb http://0ptr.link/raspbian wheezy main' > \
   /etc/apt/sources.list.d/rpi-machinekit.list"
sudo apt-get update
To install the xenomai kernel:

Code: Select all

sudo apt-get install linux-image-xenomai
and then update the kernel image:

Code: Select all

sudo mv /boot/vmlinuz* /boot/kernel.img
To install xenomai userspace:

Code: Select all

sudo apt-get install xenomai-runtime
Last edited by kinsa on Wed Aug 13, 2014 10:50 am, edited 1 time in total.
42

jsea
Posts: 1
Joined: Sun Aug 10, 2014 2:49 pm

Re: Xenomai Packages

Sun Aug 10, 2014 2:58 pm

Thanks for putting those together!!! I seem to be having some issues though...

I've done the following:
1) Installed latest raspbian OS (running 3.12.22+ PREEMPT kernel)
2) Installed packages with dpkg -i ./*.deb
3) Renamed the vmlinuz like you suggested.

Upon reboot, it seems that my USB keyboard no longer works. Could it be that it's not working since I used the latest version of raspbian, and the modules are incompatible?

EDIT: evidently xenomai doesn't have USB support? See second post. http://www.raspberrypi.org/forums/viewt ... ai#p593777

kinsa
Posts: 457
Joined: Sat Dec 01, 2012 10:16 pm

Re: Xenomai Packages

Mon Aug 11, 2014 1:35 am

jsea wrote:Thanks for putting those together!!! I seem to be having some issues though...

I've done the following:
1) Installed latest raspbian OS (running 3.12.22+ PREEMPT kernel)
2) Installed packages with dpkg -i ./*.deb
3) Renamed the vmlinuz like you suggested.

Upon reboot, it seems that my USB keyboard no longer works. Could it be that it's not working since I used the latest version of raspbian, and the modules are incompatible?

EDIT: evidently xenomai doesn't have USB support? See second post. http://www.raspberrypi.org/forums/viewt ... ai#p593777
Which xenomai kernel version are you using?

Xenomai doesn't have a real time usb driver but usb devices do work. 3.10 has better usb support compared to 3.8.
42

cthyde
Posts: 2
Joined: Fri Jan 02, 2015 3:07 pm

Re: Xenomai Packages

Fri Jan 02, 2015 3:13 pm

After following a lot of guides in this forum, and others found on the web, I assembled another one, I included an .img file to download, xenomai+raspbian. Hope it helps someone.

www.cthyde.com/rpi-xenomai

omar_mor
Posts: 2
Joined: Thu Jun 26, 2014 1:18 pm

Re: Xenomai Packages

Fri Jan 30, 2015 7:13 pm

After following a lot of guides in this forum, and others found on the web, I assembled another one, I included an .img file to download, xenomai+raspbian. Hope it helps someone.

http://www.cthyde.com/rpi-xenomai
Wrong link, please update.
Thanks for your work

nagarjun
Posts: 6
Joined: Sun Mar 01, 2015 8:22 am

Re: Xenomai Packages

Mon Mar 02, 2015 3:26 am

Hi,

I am trying to install xenomai for Raspberry Pi 2. I have tried the 3.8.y kernel patched with xenomai. But kernel didn't boot up in Pi 2. It seems Pi 2 works with only 3.18.y kernel with the configuration "bcm2709_defconfig". Do you guys have any idea regarding this.?

Kernel Sources I tried:
https://github.com/raspberrypi/linux/tree/rpi-3.8.y
https://github.com/raspberrypi/linux/tree/rpi-3.18.y

Instructions followed to compile:
http://www.raspberrypi.org/documentatio ... uilding.md

Toolchain used to compile:
/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/

Cross-compiled Platform : x86_64 bit Ubuntu 14.04
Destination : Raspberry Pi 2, running Arch Linux
Working Kernel : 3.18.y without xenomai(Configuration : bcm2709_defconfig)
Not working: 3.8.y with/without xenomai (Configuration : bcmrpi_defconfig)

Since 3.18.y xenomai patch is not available, Is there any way, I can use any of the other kernels with xenomai in Pi 2.

sojka
Posts: 10
Joined: Fri Jan 03, 2014 6:38 pm

Re: Xenomai Packages

Sat Mar 07, 2015 9:30 am

I would like to have Raspberry 2 with Xenomai too. For PICNC :-).
Now I tried to compile kernel but still no success with Xenomai.
I think I need to use 3.18 kernel but there is no ipipe patch for 3.18
Petr

draculus
Posts: 2
Joined: Thu Mar 12, 2015 1:14 pm

Re: Xenomai Packages

Thu Mar 12, 2015 2:12 pm

Hey @ all,

i try to bring a xenomai package on my pi to work.
As I noticed, there are xenomai patches for kernel 3.8.13, 3.10. 32, and 3.14.17, where by only for the 3.8.13 there are pre and post patches for the raspberry. So I downloaded the 3.8.13 from GitHub. But unfortunately I'm not able to compile at lest the kernel without patches, because the Makefile in ../linux-rpi-3.8.y/sound/pci/oxygen seems to be corrupt. The compilation breaks with the message "File name too long".
Does anyone have an idea what I can do or try?
I would also have no problem in using a created Raspberry-Xenomai image, but nothing like that seems to exist.

Thanks for any replay!

sojka
Posts: 10
Joined: Fri Jan 03, 2014 6:38 pm

Re: Xenomai Packages

Fri Mar 13, 2015 6:33 am

I tried too :-) because PICNC. I had no success with Xenomai. Now I built PREEMPT-RT
https://github.com/emlid/linux-rt-rpi
LinuxCNC
http://wiki.linuxcnc.org/cgi-bin/wiki.p ... nomaiBuild

but picnc board is not connected. I think problem is in picnc Broadcomm defines

Petr

draculus
Posts: 2
Joined: Thu Mar 12, 2015 1:14 pm

Re: Xenomai Packages

Mon Mar 16, 2015 7:19 am

Hmm...

a PREEMPT-RT Kernel is running fine on my pi. But this one works with a 3.18.XYZ kernel version, which I also tried and get it running without patch.
So, any further ideas?

Regards!

Zev
Posts: 1
Joined: Fri May 01, 2015 6:42 pm

Re: Xenomai Packages

Sun May 03, 2015 7:10 am

Hey
I've tried to get the Xenomai kernel running on the raspberry pi 2. I followed the instructions and everything seems fine. But when I rename the vmlinuz file and reboot "uname -r" still report that the previous kernel is running.

Am I missing something when trying to replace the stock kernel with the Xenomai kernel? Could someone please help me?

mobin.seven
Posts: 3
Joined: Sat Jun 27, 2015 2:53 pm

Re: Xenomai Packages

Sun Jun 28, 2015 3:39 am

Xenomai now has a 3.18.12 patch:
http://download.gna.org/adeos/patches/v3.x/arm/

pinf
Posts: 2
Joined: Thu Mar 10, 2016 11:28 pm

Re: Xenomai Packages

Fri Mar 11, 2016 12:37 am

mobin.seven wrote:Xenomai now has a 3.18.12 patch:
http://download.gna.org/adeos/patches/v3.x/arm/
Hi mobin.seven,

these days I'm trying to build a raspbian with xenomai 3.0.1.
Since pre/post patching is gone with xenomai 3.x and a matching kernel-ipipe combo semms to me impossible at the moment.
A linux-rpi-4.1.18 branch from hexxah and a ipipe-core.4.1.18-arm.patch from xenomai doesn't compile together.

The 3.18.y branch is now 3.18.16, but ipipe patches delivered for xenomai 3.0.1 are 3.14.44 or 3.18.20 only.

When I look at the ipipe-git from xenomai, the linux kernel numbers differ from rhe raspberry pi git. I expect them to be deviated by the original linux kernel. But a git diff/ modal diff is huge. So I gave up...

The linux-rpi-4.1.y --> 4.1.19 and linux-rpi-3.18.y --> 3.18.16 builds fine.

Any ideas?

Thanks

nowan190
Posts: 5
Joined: Fri Mar 11, 2016 1:51 pm

Re: Xenomai Packages

Fri Mar 11, 2016 2:45 pm

Hi guys,

As the Raspberry Pi kernel differs from the vanilla one, you still need to apply extra modifications in addition to the regular I-Pipe patch. It was a blocking point for a long time but a few month ago someone from the mailing list released a post patch for the Raspberry Pi 2. The origin post can be found at https://xenomai.org/pipermail/xenomai/2 ... 35487.html, and I've also made the patch available here https://www.dropbox.com/s/h42dboejlczw5 ... patch?dl=0.

With that I've actually gotten Xenomai 3.0 to work on a Raspberry Pi 2. Well, for a couple of minutes only after what the system freezes. Below is a small guide to help you get there. I would love to hear feedback from you, especially if you encounter the same freeze problem as I have been struggling with, or not.

1 - Preparation

1.1 - Additional packages
If they are not already installed on the system, a few packages need to be downloaded.

Code: Select all

sudo apt-get update
sudo apt-get --yes install bc git libncurses5-dev dh-autoreconf
1.2 - Working directory
Let's then start by creating the directory we will be working in.

Code: Select all

mkdir ~/xenomai-3-rpi-2
cd ~/xenomai-3-rpi-2
1.3 - Toolchain
The tools provided by the Raspberry Pi Foundation currently contain four toolchains, we will be using the one called arm-bcm2708hardfp-linux-gnueabi.

Code: Select all

cd ~/xenomai-3-rpi-2
git clone --depth=1 https://github.com/raspberrypi/tools.git rpi-tools
git reset --hard f564210
export CCPREFIX=~/xenomai-3-rpi-2/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-
${CCPREFIX}gcc -v
1.4 - Xenomai sources
The Xenomai sources are available at the remote git repository http://git.xenomai.org/xenomai-3.git. Commit af2e279 has been used here, however newer revisions should work as well.

Code: Select all

cd ~/xenomai-3-rpi-2
git clone --depth=1 git://git.xenomai.org/xenomai-3.git xenomai-3
cd xenomai-3
git checkout -b stable-3.0.x
git reset --hard af2e279
git clean -fxd
1.5 - Linux sources
Xenomai 3 over the Cobalt core (i.e. dual kernel mode) needs special kernel support to deliver fast and deterministic response time to external interrupts. This support is provided by the interrupt pipeline (aka I-pipe) in the form of a kernel patch you have to apply against a vanilla kernel tree, before the Xenomai co-kernel can be built into Linux. The patch currently shipped in the "ksrc/arch/arm/patches" folder of Xenomai source tree has been designed for a 3.18 version of the linux kernel. This is the version we want to retrieve from the kernel remote git.

Code: Select all

cd ~/xenomai-3-rpi-2
git clone --depth=1 -b rpi-3.18.y git://github.com/raspberrypi/linux.git rpi-linux
cd rpi-linux
git reset --hard 1bb18c8
git clean -fxd
1.6 - Extra patch
Since the Raspberry Pi kernel differs from the vanilla one, it requires us to apply an extra patch. It has been published by Mathieu Rondonneau in the Xenomai mailing list, the original message is available at https://xenomai.org/pipermail/xenomai/2 ... 35487.html.

Code: Select all

cd ~/xenomai-3-rpi-2
mkdir patches
cd patches
wget https://www.dropbox.com/s/h42dboejlczw5wx/ipipe-core-3.18.xx-rpi2-post.patch
2 - Compiling kernel-space components

2.1 - Apply patches

Code: Select all

cd ~/xenomai-3-rpi-2
xenomai-3/scripts/prepare-kernel.sh --arch=arm --linux=rpi-linux --ipipe=xenomai-3/kernel/cobalt/arch/arm/patches/ipipe-core-3.18.20-arm-6.patch
cd ~/xenomai-3-rpi-2/rpi-linux
patch -p1 < ../patches/ipipe-core-3.18.xx-rpi2-post.patch
2.2 - Kernel configuration
There are several important kernel configuration options, documented in the Xenomai troubleshooting guide. The following configuration file takes them into account.

Code: Select all

cd ~/xenomai-3-rpi-2/rpi-linux
wget -O .config https://www.dropbox.com/s/j24kr2zkcdkd83w/config-9ab1a15.txt
make ARCH=arm CROSS_COMPILE=${CCPREFIX} oldconfig
make ARCH=arm CROSS_COMPILE=${CCPREFIX} menuconfig
2.3 - Kernel and modules building
We proceed to build the kernel and then modules. The "j" argument specifies the number of parallel make jobs we would like to run. A commonly accepted rule for defining what this value should be is the number of core the machine running the build has times two.

Code: Select all

make -j9 ARCH=arm CROSS_COMPILE=${CCPREFIX}
make -j9 ARCH=arm CROSS_COMPILE=${CCPREFIX} modules
2.4 - Kernel packing
Once kernel compilation is over, we make a copy of zImage. Using the mkknlimg utility is important as it adds a few extra things to let the kernel know that device tree is supported.

Code: Select all

cd ~/xenomai-3-rpi-2/rpi-linux
scripts/mkknlimg arch/arm/boot/zImage ../kernel-linux-3.18.16-xenomai-3.0.img
file ../kernel-linux-3.18.16-xenomai-3.0.img
2.5 - Modules packing

Code: Select all

mkdir ../modules
rm -R ../modules/*
make ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=~/xenomai-3-rpi-2/modules modules_install
cd ~/xenomai-3-rpi-2/modules
tar czvf ../modules.tar.gz *
cd ..
rm -Rf modules
3 - Compiling user-space components

We prepare the build by adding the location of the toolchain in the path, and passing the appropriate flags.
The low resolution clock is needed by the VxWorks interface of Xenomai. And the build flags have been arguably selected using information found on the Raspberry Pi forum, at viewtopic.php?f=33&t=98354.

Code: Select all

cd ~/xenomai-3-rpi-2/xenomai-3
PATH=$PATH:~/xenomai-3-rpi-2/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/
./scripts/bootstrap
./configure --with-core=cobalt --enable-debug=full --enable-smp --enable-lores-clock --disable-doc-install --host=arm-bcm2708hardfp-linux-gnueabi CFLAGS="-mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard" LDFLAGS="-mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"
It's then possible to start the Xenomai user-space components build.

Code: Select all

rm -Rf ../xenomai-userspace
mkdir ../xenomai-userspace
make DESTDIR=$(pwd)/../xenomai-userspace install
The generated files will then be packed in three different archives. First one is the one that will be deployed on the target. The second one contains all the headers, that will need to be included. Note that it is also possible and maybe simpler to use the ones present in the cross-compiler synchronized from the sysroot. The third one contains all the static libraries that are likely not going to be used, since Xenomai 3 requires a more complicated two-stages linking process in order to use static libraries.

Code: Select all

cd ../xenomai-userspace
tar czvf ../xenomai-userspace.tar.gz *
cd usr/xenomai/include
tar czvf ../../../../xenomai-headers.tar.gz *
cd ../lib
tar czvf ../../../../xenomai-libs.tar.gz *.a
4 - Deploying

At this point, the previous steps should have generated at least the following files that we will deploy on the /tmp folder of the Raspberry Pi.
- kernel-linux-3.18.16-xenomai-3.0.img
- modules.tar.gz
- xenomai-userspace.tar.gz

So, copy the three files above on the tmp folder of the Raspberry, and still on the Raspberry, type the following lines:

Code: Select all

cd /
sudo cp tmp/kernel-linux-3.18.16-xenomai-3.0.img /boot
echo "kernel=kernel-linux-3.18.16-xenomai-3.0.img" | sudo tee --append /boot/config.txt
sudo tar xzvf /tmp/modules.tar.gz
sudo tar xzvf /tmp/xenomai-userspace.tar.gz
echo "/usr/xenomai/lib/" | sudo tee /etc/ld.so.conf.d/xenomai.conf
sudo ldconfig -v
sync
sudo reboot
That's it, if everything succeeded, the board is ready to be restarted and should boot using the real-time kernel this time.

5 - Validating

The following commands are useful to ensure that Xenomai has successfully started, with the interrupt pipe.

Code: Select all

dmesg | grep -i xenomai
dmesg | grep -i pipe
The latency test should display a message every second with minimum, maximum and average latency values. If this test displays an error message, hangs, or displays unexpected values, see the Xenomai troubleshooting guide.

Code: Select all

sudo /usr/xenomai/bin/latency
If the latency test succeeds, you should try next to run the xeno-test test in order to assess the worst-case latency of the system. Try:

Code: Select all

sudo /usr/xenomai/bin/xeno-test --help
Hope this helps,

Cheers,

Nicolas

pinf
Posts: 2
Joined: Thu Mar 10, 2016 11:28 pm

Re: Xenomai Packages

Fri Mar 11, 2016 4:04 pm

Wow, thanks!

The kernel config was the point for me. Saw it in the troubleshooting documentation, but there is no example.

I'll try it out these days and post feedback!

vroach
Posts: 2
Joined: Sun Mar 13, 2016 4:27 am

Re: Xenomai Packages

Sun Mar 13, 2016 4:34 am

Thank you for the steps
Froze with raspbian too. or maybe usb keyboards and mouses aren't working?
and is there a rpi post patch for linux 4.1?

EDIT:Kernel works fine in Raspbian! (except for pen drives and internet)
Last edited by vroach on Tue Mar 15, 2016 6:23 am, edited 2 times in total.

nowan190
Posts: 5
Joined: Fri Mar 11, 2016 1:51 pm

Re: Xenomai Packages

Mon Mar 14, 2016 7:55 am

pinf wrote:Wow, thanks!

The kernel config was the point for me. Saw it in the troubleshooting documentation, but there is no example.

I'll try it out these days and post feedback!
For the kernel config, I used a previous Raspbian image running a 3.18 kernel an extracted the config with then following command and then made only a very small amount of changes to make Xenomai happy.

Code: Select all

zcat /proc/config.gz > /tmp/rpi-`uname -r`-config.txt

nowan190
Posts: 5
Joined: Fri Mar 11, 2016 1:51 pm

Re: Xenomai Packages

Mon Mar 14, 2016 8:13 am

vroach wrote:Froze with raspbian too. or maybe usb keyboards and mouses aren't working?
The freeze I am experiencing here looks a lot like a kernel lockup. Of which, to my understanding, usb devices not working are a direct consequence. So, no more keyboard, mouse, not ethernet for that matter.
vroach wrote:and is there a rpi post patch for linux 4.1?
Not that I know of.

vroach
Posts: 2
Joined: Sun Mar 13, 2016 4:27 am

Re: Xenomai Packages

Tue Mar 15, 2016 6:27 am

nowan190 wrote:
vroach wrote:Froze with raspbian too. or maybe usb keyboards and mouses aren't working?
The freeze I am experiencing here looks a lot like a kernel lockup. Of which, to my understanding, usb devices not working are a direct consequence. So, no more keyboard, mouse, not ethernet for that matter.
vroach wrote:and is there a rpi post patch for linux 4.1?
Not that I know of.
Thanks again!
Got it to work in raspbian, USB mouses and keyboard works but there's no internet (tried out all the options in the config!)
If you can find out any solution for enabling ethernet support please do post it here.
And start a git repo with your code? will help out a lot of people! :)

MilevaMaric
Posts: 1
Joined: Thu May 26, 2016 9:17 pm

Re: Xenomai Packages

Thu May 26, 2016 9:43 pm

Hello Guys! I have a question about Xenomai and the method described by nowan190. Can be used in a Raspberry 2 B?
I did that but at beginning in the kernel start , it freezes and then appears the message "random: nonblocking pool is initialized". Then absolute silence :(

Thanks!

try2know
Posts: 5
Joined: Wed Jun 01, 2016 10:58 pm

Xenomai on rpi zero

Wed Jun 01, 2016 11:07 pm

Hi guys,
I have just gotten a pi zero and want to try xenomai with it. As I know the pi zero has same SOC chip as that in the pi 1 b+, so I used an image (minibian+kernel 3.10.y+xenomai 2.6) which has been tested on pi 1. However the pi zero didn't boot with this image.
So, is there any one try to run xenomai on pi zero? Do I need special xenomai patch for pi zero?
Thanks

renatocoral
Posts: 1
Joined: Sun Jun 05, 2016 2:03 pm

Re: Xenomai Packages

Sun Jun 05, 2016 2:09 pm

Hi everyone,

I've just found one solution for the Xenomai 3.0.2 on Raspberry Pi 2.
It uses the Kernel 4.1. There is now a patch for this kernel.

http://www.blaess.fr/christophe/2016/05 ... erry-pi-2/

I used it and so far the only negative is the USB ports are not working but the ethernet is fine for remote access.

If anyone has a clue please post!
Thanks.
Renato

jshen
Posts: 1
Joined: Wed Oct 26, 2016 9:08 pm

Re: Xenomai Packages

Thu Oct 27, 2016 12:02 am

I have tried different procedures, describted in this post or elsewhere.
I am having the program in getting the image built.

(1)is it possible for any one in the xenomai group to make a read-to-go image like Noobs.
(2)Is it possible to specify a procedure that will highly likely works.

Many thanks

django013
Posts: 21
Joined: Wed Mar 29, 2017 10:11 am

Re: Xenomai Packages

Fri Apr 07, 2017 11:32 am

Hello,

does anybody has xenomai-patch running at arm64 kernel?
If so, where can I find instructions to get such combination to work?

henry10210
Posts: 13
Joined: Sun Oct 29, 2017 5:56 pm

Re: Xenomai Packages

Tue Dec 19, 2017 5:41 am

nowan190: thank you for your writeup. Just ran the latency test on RPi3 successfully after patching the stretch kernel. Just 1 followup question: you created 3 tar.gz, but used only the userspace.tar.gz. Why did you create the headers and lib tar.gz in the first place?

Return to “Linux Kernel”