Skip to content

Xenomai on Raspberry Pi

Setup Xenomai on Raspberry Pi ZeroW

  • Install toolchain
$ sudo apt-get install gcc-arm-linux-gnueabihf
$ sudo apt-get install --no-install-recommends ncurses-dev bc
  • Create a workspace folder to keep everything at one place
$ cd <Your-Workspace-Directory>
$ mkdir linux_xenomai
$ cd linux_xenomai
  • Download Linux kernel for Raspberry Pi
$ git clone --depth 3
  • Download Xenomai source code
$ wget
$ ln -s xenomai-3.0.7 xenomai

Extract files and modify "xenomai/scripts/": replace "ln -sf" with "cp" so that it will copy all neccessary xenomai files to linux source

  • Download Xenomai kernel patch

Download the kernel patch from . For best compatibility, choose the kernel and patch with similar version number. Otherwise, you may have to fix issues by yourself.

$ wget

At the time of writing, patch for kernel 4.14.36 is the latest one for downloading. Accordingly we need to switch to a different commit of the linux kernel for RPi for least compatibility issues. Choose 4.14.37 in our case:

$ cd linux
$ git reset --hard 29653ef5475124316b9284adb6cbfc97e9cae48f

You need to replace the following two files in "linux/drivers/irqchip/" to patch the kernel successfully:


Find the modified files from:

  • Patch the kernel
$ cd linux_xenomai
$ ./xenomai/scripts/ --linux=./linux --arch=arm --ipipe=./ipipe-core-4.14.36-arm-1.patch

If the patching is successful, you should get something like:

I-pipe core/arm #1 installed.
Links installed.
Build system ready.
  • Configure and build patched kernel (for Raspberry Pi ZeroW)
$ cd linux
$ make -j8 O=build ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
make O=build ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j8 menuconfig

Make changes according to the instructions in [1].

Build kernel image, modules and device overlay

$ make O=build ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j8 bzImage modules dtbs
$ make O=build ARCH=arm INSTALL_MOD_PATH=dist -j8 modules_install
  • Deploy the kernel

You can either configure the new kernel manually like [2] or build the kernel/headers to be ".deb" packages like [1].

  • Compiling Xenomai tools
$ cd xenomai
$ ./scripts/bootstrap
$ ./configure --host=arm-linux-gnueabihf --disable-smp --with-core=cobalt
$ make
$ sudo make install


  • [1]
  • [2]
  • [3]