Xenomai installation and configuring on DB410C - manual

success_story
tutorial

#1

Install Xenomai on DB410C

The following part should be done on Linux OS (VM is also an option)

  1. Download ipipe-jro-410c.linaro-15.07
    (From URL: http://git.xenomai.org/ipipe-jro.git/tag/?h=410c.linaro-15.07
    File name: ipipe-jro-410c.linaro-15.07.tar.bz2 )

  2. Download xenomai-jro-410c.linaro-15.07

  3. Patch Xenomai into the download kernel (the one with ipipe we downloaded in step 1):
    • cd xenomai-jro-410c.linaro-15.07/scripts
    • ./prepare-kernel.sh --arch=arm64 --linux=$kernel
    ($kernel= the path of ipipe we downloaded in step 1)

  4. Download GCC cross compiler:
    gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu (the latest one is not suitable to this kernel)

  5. cd kernel (kernel = the path of ipipe we downloaded in step 1).
    export ARCH=arm64
    export CROSS_COMPILE=/bin/aarch64-linux-gnu-
    make defconfig distro.config
    make -j4 Image dtbs
    (must write I = i capital letter)

  6. sudo apt-get install device-tree-compiler
    git clone git://codeaurora.org/quic/kernel/skales

  7. ./skales/dtbTool -o dt.img -s 2048 arch/arm64/boot/dts/qcom/

  8. wget http://builds.96boards.org/releases/dragonboard410c/linaro/debian/17.04/initrd.img-4.9.27-linaro-lt-qcom

  9. ./skales/mkbootimg --kernel arch/arm64/boot/Image
    –ramdisk initrd.img-4.9.27-linaro-lt-qcom
    –output boot-db410c.img
    –dt dt.img
    –pagesize 2048
    –base 0x80000000
    –cmdline “root=/dev/disk/by-partlabel/rootfs rw rootwait console=ttyMSM0,115200n8”

  10. sudo fastboot flash boot boot-db410c.img

Reference to parts 1-3: Installing xemomai on 410c
Reference to parts 4-10: https://builds.96boards.org/releases/dragonboard410c/linaro/debian/latest/



After we’ve done with flashing the Dragonboard with the Xenomai patched kernel, a configuration of Xenomai must be done in order to use it properly. The following steps are done on the DB410C itself:

  1. Download http://git.xenomai.org/xenomai-jro.git/ xenomai-jro-410c.linaro-15.07.tar.bz2 natively and extract it.
  2. sudo apt-get update
  3. sudo apt-get install automake
  4. sudo apt-get install libtool
  5. sudo apt-get install libltdl-dev
  6. sudo apt-get install autoconf
  7. sudo apt-get install dh-autoreconf
  8. cd to the directory you have downloaded xenomai at step 1
  9. ./scripts/bootstrap
  10. ./configure --with-core=cobalt --enable-smp --enable-pshared --enable-assert --prefix=/usr/xenomai
  11. make -j 4
  12. sudo make install
  13. sudo su
  14. sudo echo “/usr/xenomai/lib” > /etc/ld.so.conf.d/xenomai.conf
  15. PATH=$PATH:/usr/xenomai/bin
  16. run latency check:
    /usr/xenomai/bin/latency

That’s it. You now have Xenomai installed and enabled on your board.
Here is an example of a simple “Hello World” program taken from here (just copy the code of Hello World section) http://www.cs.ru.nl/lab/xenomai/exercises/ex01/Exercise-1.html



To compile the program use the following commands (ex01.c is the program you wish to compile)
Pay attention that ` = backtick.

  1. sudo su
  2. PATH=$PATH:/usr/xenomai/bin
  3. xeno-config --skin=native --cflags
  4. xeno-config --skin=native --ldflags
  5. export CFLAGS=xeno-config --skin=native --cflags
  6. export LDFLAGS=xeno-config --skin=native --ldflags
  7. export LD_LIBRARY_PATH=/usr/xenomai/lib/
  8. gcc $CFLAGS $LDFLAGS -o
    For example:
    gcc $CFLAGS $LDFLAGS /home/linaro/ex01.c -o ex01
  9. run you program
    ./ex01

And of course you may use the full Xenomai API documentation from here to create your own programs https://xenomai.org/documentation/xenomai-3/pdf/xeno3prm.pdf


Credits: Special thanks go to Jorge Ramirez - ldts who helped us to get through a whole lot of obstacles during the process :slight_smile: