Installing Xenomai on Beaglebone using Debian distribution


Install a Xenomai kernel on a Debian distribution for BeagleBone / BeagleBone Black.
The instructions I have tried to follow either broke during compilation or when creating a bootable SD card.


The solution is produced by merging these instructions:

1. Install necessary packages

sudo apt-get install build-essential libncurses5{,-dev} gcc-arm-linux-gnueabi git gparted

2. Prepare an SD card

Download the latest Debian image from
For example,


Insert your SD card (at least 4GB) and note the name of the device (use dmesg | tail if necessary). In my case it is mmcblk0.

Write the image to the SD card (note that all content of the card will be erased!)

sudo -s
xz -dkc ../bone-debian-7.5-2014-05-14-2gb.img.xz > /dev/mmcblck0

Run gparted to increase the size of the second partition to take all of the free space on the card:

sudo gparted

Be sure to choose your SD card from the top-right list!

3. Test the card

Remove the card and insert it into BeagleBone. Connect it via USB, wait until your system detects it, then ssh into it:

ssh root@

You should see Debian greeting message.

Shutdown BeagleBone:

shutdown -h now

and wait until the lights go off. It they don’t, press and hold power button of beaglebone for about 10 sec until the lights go off. Unplug the USB cable from the computer.

4. Download Xenomai

tar xvjf xenomai-2.6.3.tar.bz2

5. Download 3.8.13 kernel

git clone
cd kernel
git checkout origin/3.8 -b 3.8
git reset --hard eae56c3

The last operation will take some time.

6. Get necessary (presumably) firmware:

wget ";a=blob_plain;f=bin/am335x-pm-firmware.bin;hb=HEAD" -O kernel/firmware/am335x-pm-firmware.bin

7. Set current config to beaglebone

cp configs/beaglebone kernel/.config

8. Apply beaglebone-related patches and prepare xenomai kernel:

cd kernel
patch -p1 < ../../xenomai-2.6.3/ksrc/arch/arm/patches/beaglebone/ipipe-core-3.8.13-beaglebone-pre.patch
patch -p1 < ../../xenomai-2.6.3/ksrc/arch/arm/patches/ipipe-core-3.8.13-arm-3.patch
patch -p1 < ../../xenomai-2.6.3/ksrc/arch/arm/patches/beaglebone/ipipe-core-3.8.13-beaglebone-post.patch
../../xenomai-2.6.3/scripts/ --arch=arm --linux=.

9. Optional: patch the kernel for PWM (see details here)

wget ..
patch -p1 < ../ti_ehr_pwm.patch

10. Configure kernel

make ARCH=arm menuconfig

Go to “CPU Power Management CPU ---> Frequency scaling” and disable “[ ] CPU Frequency scaling”.
Go to “Real-time sub-system ---> Drivers ---> Testing drivers” and enable everything there.

11. Compile Kernel and modules

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs -j4
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4

12. Install new kernel to the SD card

Insert your SD card and mount its first partition:

sudo mkdir /media/sdcard
sudo mount /dev/mmcblk0p1 /media/sdcard

make a backup of the original kernel and copy the new one

sudo mv /media/sdcard/zImage /media/sdcard/zImage.original
sudo cp arch/arm/boot/zImage /media/sdcard/
sudo umount /media/sdcard

Now copy the firmware and modules

sudo mount /dev/mmcblk0p2 /media/sdcard
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/media/sdcard modules_install

13. Install Xenomai userspace

cd ../../xenomai-2.6.3/
./configure --host=arm-linux-gnueabi
sudo make DESTDIR=/media/sdcard install
sudo umount /media/sdcard

14. Done
Now you should have xenomai installed.

Put the SD card into BeagleBone and ssh into it:

ssh root@

insert the test module

insmod /lib/modules/*/kernel/drivers/xenomai/testing/xeno_klat.ko

and run latency test


You should see latency info in the screen.

19 thoughts on “Installing Xenomai on Beaglebone using Debian distribution

  1. Hi,

    I was trying out your steps, to install the xenomai kernel, but, once I do make ARCH=arm menuconfig. I don’t see the Real-time sub-system —> Drivers —> Testing drivers options. Any idea why?


    1. Indeed there was a command missing. Check updated step #8. If you have followed all the instruction, just execute the last command in the box of step 8 (../../xenomai-2.6.3/…) from the kernel tree path and then proceed as described.


  2. Thanks for the quick reply and the correction. I now on the beaglebone, and I want to compile and run the examples which are given on the official xenomai website. When I try to run it, it gives me the follwoing output:
    ./trivial-periodic: error while loading shared libraries: cannot open shared object file: No such file or directory.
    Any help on this would be appreciated.


  3. Thanks for the tutorial! Everything went correctly for me up to the insmod command on the beaglebone. I’m getting an error that the xeno_klat.ko file is an “Invalid module format.” Do you know of any way to get around this? Thanks!


    1. Maybe you have installed some other modules previously? Try “ls /lib/modules/*/kernel/drivers/xenomai/testing/xeno_klat.ko” to see if you have this module in more than one architecture.


      1. It looks like I only have one version of the xeno_klat.ko module from your recommended command. I’ve read that this error can come from having conflicting versions of the kernel but I don’t think that’s what’s happening here since I’ve installed the same Debian image you have and followed the rest of the steps directly.

        Liked by 1 person

      2. Could it be that you are not running Xenomai kernel then? What is the output of ‘uname -r’? Is it the same as the folder name in /lib/modules?


  4. Ok so I figured what was wrong. On step 12 I accidentally mounted the wrong partition initially and I think that’s what caused my issue. I didn’t get the chance to run ‘uname -r’ but I’m pretty sure you were right that the xenomai kernel wasn’t actually running. I reinstalled xenomai to the SD card, correctly this time, and the ‘insmod’ command had no trouble at all and the latency test is working great! Thanks so much for the help! I really appreciate it!


  5. Hi,

    First i’m sorry for my poor english level !!!

    Be careful when you compile Xenomai environment for BBB (lib, bin, etc…), you use ./configure –host=arm-linux-gnueabi but this version of Debian want HARD FLOAT !!!
    If the libs are compile in soft-float, the linker doesn’t find the library and tou have the message “cannot open shared object file no such file or directory”.
    What i do :
    – STEP 13 :
    sudo cp -r ../../xenomai-2.6.3 /media/sdcard
    sudo umount /media/sdcard
    – STEP 14 :
    ssh root@
    date -s “dd mm yyyy hh:mm”
    cd /xenomai-2.6.3
    make DESTDIR=/ install

    and i compile xenomai userspace dirctly on the BBB !!!!

    Thanks a lot for this very good tuto.


  6. I had the same problem listed above. I had xenemai kernel installed ,and my Os tree is right… I saw you have a boot partition separated from the rootfs partition … in my BBB I have the boot in the same partition … and I have no zImage in my original BBB image… so how could I build a bootloader which is able to load the xenomai kernel ?

    Nobody have found this problem ?


    1. Matt, not sure I understand which exactly problem you refer to. As for the absence of zImage, are you sure you are using debian distribution? As far as I know the default debian distribution for BBB has two separate partitions.


      1. Hi avterekhov.

        The 2014 images have 2 partitions , the 2015 no. I tried this one for example :


        And I have a single partition , rootfs with a boot folder. No zImage … SO how could I set this boot to start with xenomai kernel ?


  7. I asked in the beaglebone mailing list … nobody answer hot to do this. they say to look for a pre-compiled image… but it’s better build the xenomai choosing the debian bone image you want šŸ™‚ .

    I will really appreciate if you find a way ^^

    Thanks a lot


  8. Hi I have created successfully the image with xenomai patch as described here. But that are all in my pc . So How do i write uimage and zimage to sd card. As While inserting the card I can only see sda1 as one partion no other partion.


  9. hi, I have followed all the steps described here. and till last step it worked and I have prepared the sd card.
    But when I inserted sd card in bbb It doesn’t bootup.
    just on screen only ‘CCCCCCCCCCCCCC’ comes… I guess Its not able to find bootloader.
    can you sugesst help for this.???
    thanks in advance


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s