Install Xenomai on Dragonboard 410c

Hi, I am trying to install Xenomai on DB410c,
followed this 2 tutorials:
https://builds.96boards.org/releases/dragonboard410c/linaro/ubuntu/15.07/

at http://www.96boards.org/blog/servo-motor-control/ we did:

  1. Downloaded Xenomai and Ipipe
  2. git checkout do I need something for DB410c ? (the tutorial is written on Hikey)
  3. run prepare-kernel.sh
    then we moved to the other tutorial and started from here:

    (because we want Xenomai instead of Ubuntu.)
    then we got an image file
    but trying to fastboot the device with it
    the pc is detecting the device, we wrote successfully
    sudo fastboot flash boot boot-db410c.img

and then the image file was not loaded when the device is started.

Please let me know what we did wrong and how do I figure out it.
Thanks.

(btw, I saw this topic too before the steps I did
Installing xemomai on 410c - #2 by ldts
)

I would like to help but I am a little bit confused with the sequence of steps that you are taking.

Maybe you could collect them all in a script-like form and share them?

The basic idea is to boot your db410c with a not too recent Ubuntu/Debian release and then replace the kernel and install the Xenomai libraries.

Do you know how to replace a kernel in a Ubuntu/Debian release for a vanilla kernel? That should be your first step, ie, making sure you know how to do this standard operation.

Now back to installing Xenomai: when replacing the kernel you can either use the same kernel sources that you are booting patched with I-pipe OR use an I-pipe enabled tree (which is what I do in the document for simplicity). An I-pipe enable tree is basically a vanilla kernel patched with I-pipe (so not a Landing Team or a silicon vendor tree features there)

Once you have the I-pipe enabled kernel you should boot it to make sure I-pipe is not introducing a regression. If it is all good - the system boots- then you have to patch the kernel again this time with Xenomai (ie prepare-kernel.sh script_

==> So to be very clear: the I-pipe enabled tree MUST be patched with the Xenomai domain (hence the prepare-kernel.sh).

After that you would just boot it and install the Xenomai libaries as per the documentation.

So if you could help me understand where are you getting stuck I should be able to help.

Hi Idts.
First of all thanks for the detailed response. Iā€™m a friend of NewZephyr and we are working together on some project that involves the Xenomai and Dragonboard 410c.
Actually weā€™ve managed right now to replace the previous kernel that was delviered with debian installation (4.4.23) with the i-pipe patched one after following your steps and the stpes mentioned here for customizing a kernel: https://builds.96boards.org/releases/dragonboard410c/linaro/debian/latest/

What we did was:

  1. Download ipipe-jro-410c.linaro-15.07 (latest version was ipipe-jro-e712dead060629b2c7307216c2e6887d0fd16f5a )
  2. Download xenomai-jro-410c.linaro-15.07
  3. Patch Xenomai into the download kernel (the one with ipipe we donloaded in section 1):
    cd xenomai-jro-410c.linaro-15.07/scripts
    /prepare-kernel.sh ā€“arch=arm64 ā€“linux=$kernel
  4. Customizing the kernel as I mentioned above exactly step by step as was writen there.

The result weā€™ve got is a 4.0.0 i-pipe kernel on the board. Now we try to understand a few things:

  1. How we move on from here? As in the official installation manual on Xenomai page part of the progress was patching the cobalt kernel and a few more things. As arm64 was not supported there from our understanding what we did is some kind of bypassing the standard Xenomai installation by following your manual. How we proceed from here? How can we check if xenomai is actually installed and check some of its features?
  2. Is there a way to use a newer kernel? From what we saw, last ipipe patch for arm64 is 4.1.18. Does it mean that there is no way to use it over a newer version kernel?

Thanks.

can you please help us ?

If you are booting the kernel - which I dont know since you didnt send traces- and installed the libraries - I didnā€™t see that part in the summary that you posted either- then you have a Xenomai enabled (Cobalt) system.

You should then run the latency tests, check current benchmarks and if necessary do some troubleshooting.
The documentation in Xenomai.org is quite detailed so please have a look there as well as on the xenomai mailing list.

Xenomai now can run a 4.4 kernel and there is work in the process of a new and simpler co-kernel architecture which will be able to follow upstream. But in the meantime, ff you need a newer kernels l I am afraid you will have to do the work :slight_smile:

I donā€™t sure what do you mean by saying ā€œbooting the kernelā€, but Iā€™ll try to clarify where do we stand right now.
Weā€™ve patched the downloaded kernel that already includes ipipe (step 1 above) with Xenomai, and managed to customize the kernel on the dragonboard, so when I run ā€œuname -rā€ from the board I get something like ā€œkernel 4.0.0 i-pipeā€ (donā€™t sure if thatā€™s the exact message but pretty close to it), so I guess we are booting the right kernel.
Maybe I miss something, but what libraries exactly are you talking about?
Relying on Xenomai.org is a little bit hard as the whole process of installation on dragonboard is different and not documented out there.

About the kernel version, I see that the last kernel that supports ipipe on arm64 architecture is 4.1.18 and not 4.4. Am I looking at the wrong place?

Looked again here http://www.96boards.org/blog/servo-motor-control/
I saw the ā€œInstalling the Xenomai libraries and demosā€ . It looks compatible with the HiKey but not with DB410c.
Does commands like ā€œ$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8ā€ gonna work? As for example building kernel for the DB is done with a flag -j4 and not -j8, so I guess running those command straight forward is not gonna suit the DB. Can you tell me what changes should I do?
And as I see it we should rebuild the kernel again in order to add those libraries, right?

we didnā€™t success to install libraries :frowning:
We know how to boot the patched kernel
(Dragonboardā€™s kernel includes xenomai, but we donā€™t success to install its libraries)
Let us know what we did wrong

As I said, Iā€™d like to help but I dont know what you are doing (you are not providing traces). After compiling Xenomai and installing them to some directory on the build server (or are you compiling it natively?) all you have to do is tar them and untar them in the target rootfs (easier if your rootfs is nfs mounted). then you can just run /user/xenomai/bin/latency

At the step where you execute:
cp arch/arm64/boot/dts/hi6220-hikey.dtb $share/

What should I do on the dragonboard? I donā€™t have any dtb files created in this path.
Though in arch/arm64/boot/dts/qcom I see msm8916-mtp.dtb and apq8016-sbc.dtb . Should I use one of them instead?

Thanks.

OK I tried to add those 2 dtb files.
Now Iā€™m stuck trying to execute this:

~/xenomai3.git/configure --with-core=cobalt --enable-smp --disable-tls --enable-fortify --enable-maintainer-mode --disable-registry --disable-pshared --disable-lorew-clock --enable-assert --disable-doc-install --build=x86_64 --host=aarch64-linux-gnu CFLAGS=ā€-march=armv8-aā€ --prefix=/usr/xenomai

I get this:
configure: WARNING: unrecognized options: --disable-lorew-clock
checking whether we build for Cobalt or Mercury coreā€¦ cobalt
checking build system typeā€¦ x86_64-pc-none
checking host system typeā€¦ aarch64-unknown-linux-gnu
checking for a BSD-compatible installā€¦ /usr/bin/install -c
checking for aarch64-linux-gnu-gccā€¦ no
checking for gccā€¦ gcc
configure: WARNING: using cross tools not prefixed with host triplet
checking whether the C compiler worksā€¦ no
configure: error: in /home/david/build': configure: error: C compiler cannot create executables See config.logā€™ for more details

I saw in forums that this may help:
export CC=~/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc

but then I get this:
configure: WARNING: unrecognized options: --disable-lorew-clock
checking whether we build for Cobalt or Mercury coreā€¦ cobalt
checking build system typeā€¦ x86_64-pc-none
checking host system typeā€¦ aarch64-unknown-linux-gnu
checking for a BSD-compatible installā€¦ /usr/bin/install -c
checking for aarch64-linux-gnu-gccā€¦ /home/david/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc
checking whether the C compiler worksā€¦ no
configure: error: in /home/david/build': configure: error: C compiler cannot create executables See config.logā€™ for more details

For some reason it doesnā€™t reconize the compiler, although I made sure itā€™s there (and of course used it for other steps whick worked well).
Please help, I think we are just about to succeed :slight_smile:

I assume you know you are cross-compiling: in some other thread you had decided to compile natively so just making sure.

I think you just need to add your aarch64 compiler to your path:

PATH=$PATH:~/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/

I also assume that you noticed that the compiler you are using is nearly three years old; not related to the problem you are having at the moment but maybe it would be a good idea to upgrade it to a more recent one.

check here:
https://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/

Yeah I used this cross compiler through all of the process.
Iā€™ve downloaded a 2017 version of it as well at first but there was a step (donā€™t remember which one exactly) that required a lower version so somehow I ended up with this one (I think there was a recommendation for this one specifically).
Iā€™ll try what you suggested and will let you know.

Thanks a lot for your help.

Unfortunately that didnā€™t work.
By looking at the config.log we have ecountered a few problems:

After running:
~/xenomai3.git/configure --with-core=cobalt --enable-smp --disable-tls --enable-fortify --enable-maintainer-mode --disable-registry --disable-pshared --disable-lorew-clock --enable-assert --disable-doc-install --build=x86_64 --host=aarch64-linux-gnu CFLAGS=ā€-march=armv8-aā€ --prefix=/usr/xenomai

the problem was this (part of the config.log):
configure:2980: aarch64-linux-gnu-gcc -V >&5
aarch64-linux-gnu-gcc: error: unrecognized command line option '-Vā€™
aarch64-linux-gnu-gcc: fatal error: no input files

Tried to change -V to lower case v in the configure file and got this:
configure:2980: aarch64-linux-gnu-gcc -qversion >&5
aarch64-linux-gnu-gcc: error: unrecognized command line option '-qversionā€™
aarch64-linux-gnu-gcc: fatal error: no input files

Tried to delete the flag -qversion and got this:
configure:3011: checking whether the C compiler works
configure:3033: aarch64-linux-gnu-gcc ā€-march=armv8-aā€ conftest.c >&5
aarch64-linux-gnu-gcc: error: ā€-march=armv8-aā€: No such file or directory

Do you have some ideas how can I get through this? :frowning:

Please install this compiler:

aarch64-linux-gnu-gcc (Linaro GCC 5.1-2015.08) 5.1.1 20150608
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

And execute this script:

#!/bin/bash
set -e

install=your_install_directory
build=your_build_directory
xenomai=your_xenomai_sources_directory

read -p "Boostrap [y/N]: " strap
if [ ā€œ${strap}ā€ = ā€œyā€ ]; then
cd $xenomai
./scripts/bootstrap
fi

read -p "reconfigure [N/y]: " reconfig
if [ ā€œ${reconfig}ā€ = y ]; then
cd $build
if [ ā€œ$PWDā€ = ā€œ${build}ā€ ]; then
rm -rf *
else
echo ā€œbuild directory does not existā€
exit
fi

$xenomai/configure --with-core=cobalt --enable-smp --enable-pshared --enable-assert --prefix=/usr/xenomai --host=aarch64-linux-gnu

fi

cd $build
make -j4

sudo PATH=$PATH:/path/to/your/compiler/bin make -j8 install DESTDIR=$install
cd $install
tar jcvf xenomai.tar.bz2 *
sync

Any problems, please just sent me config.log (no need to explain anything else).

I tried to run the command:
ā€¦/xenomai3.git/configure --with-core=cobalt --enable-smp --enable-pshared --enable-assert --prefix=/usr/xenomai
(as you guided me)
on dragonboard
Got the following error:
Still unsupported target: aarch64-unknown-linux-gnu ā€“ Sorry.

the whole log:
checking whether we build for Cobalt or Mercury coreā€¦ cobalt
checking build system typeā€¦ aarch64-unknown-linux-gnu
checking host system typeā€¦ aarch64-unknown-linux-gnu
checking for a BSD-compatible installā€¦ /usr/bin/install -c
checking for gccā€¦ gcc
checking whether the C compiler worksā€¦ yes
checking for C compiler default output file nameā€¦ a.out
checking for suffix of executablesā€¦
checking whether we are cross compilingā€¦ no
checking for suffix of object filesā€¦ o
checking whether we are using the GNU C compilerā€¦ yes
checking whether gcc accepts -gā€¦ yes
checking for gcc option to accept ISO C89ā€¦ none needed
checking whether gcc understands -c and -o togetherā€¦ yes
checking how to run the C preprocessorā€¦ gcc -E
checking target system typeā€¦ aarch64-unknown-linux-gnu
checking for gccā€¦ gcc
checking whether we are using the GNU C compilerā€¦ (cached) yes
checking whether gcc accepts -gā€¦ yes
checking for gcc option to accept ISO C89ā€¦ (cached) none needed
checking whether gcc understands -c and -o togetherā€¦ (cached) yes
checking how to run the C preprocessorā€¦ gcc -E
checking for grep that handles long lines and -eā€¦ /bin/grep
checking for BSD- or MS-compatible name lister (nm)ā€¦ /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interfaceā€¦ BSD nm
checking for gawkā€¦ no
checking for mawkā€¦ mawk
checking for a sed that does not truncate outputā€¦ /bin/sed
checking for egrepā€¦ /bin/grep -E
checking for fgrepā€¦ /bin/grep -F
checking how to print stringsā€¦ printf
checking for ld used by gccā€¦ /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ldā€¦ yes
checking command to parse /usr/bin/nm -B output from gcc objectā€¦ ok
checking for _ prefix in compiled symbolsā€¦ no
checking whether build environment is saneā€¦ yes
checking for a thread-safe mkdir -pā€¦ /bin/mkdir -p
checking whether make sets $(MAKE)ā€¦ yes
checking for style of include used by makeā€¦ GNU
checking whether make supports nested variablesā€¦ yes
checking whether UID ā€˜1000ā€™ is supported by ustar formatā€¦ yes
checking whether GID ā€˜1000ā€™ is supported by ustar formatā€¦ yes
checking how to create a ustar tar archiveā€¦ gnutar
checking dependency style of gccā€¦ gcc3
checking whether make supports nested variablesā€¦ (cached) yes
checking whether to enable maintainer-specific portions of Makefilesā€¦ no
checking dependency style of gccā€¦ gcc3
checking for flexā€¦ no
checking for lexā€¦ no
checking for target architectureā€¦


Still unsupported target: aarch64-unknown-linux-gnu ā€“ Sorry.


and we tried to add
ā€“host=aarch64-linux-gnu
to the command.

command:
ā€¦/xenomai3.git/configure --with-core=cobalt --enable-smp --enable-pshared --enable-assert --prefix=/usr/xenomai --host=aarch64-linux-gnu
and we got the following log:

checking whether we build for Cobalt or Mercury coreā€¦ cobalt
checking build system typeā€¦ aarch64-unknown-linux-gnu
checking host system typeā€¦ aarch64-unknown-linux-gnu
checking for a BSD-compatible installā€¦ /usr/bin/install -c
checking for aarch64-linux-gnu-gccā€¦ aarch64-linux-gnu-gcc
checking whether the C compiler worksā€¦ yes
checking for C compiler default output file nameā€¦ a.out
checking for suffix of executablesā€¦
checking whether we are cross compilingā€¦ no
checking for suffix of object filesā€¦ o
checking whether we are using the GNU C compilerā€¦ yes
checking whether aarch64-linux-gnu-gcc accepts -gā€¦ yes
checking for aarch64-linux-gnu-gcc option to accept ISO C89ā€¦ none needed
checking whether aarch64-linux-gnu-gcc understands -c and -o togetherā€¦ yes
checking how to run the C preprocessorā€¦ aarch64-linux-gnu-gcc -E
checking target system typeā€¦ aarch64-unknown-linux-gnu
checking for aarch64-linux-gnu-gccā€¦ aarch64-linux-gnu-gcc
checking whether we are using the GNU C compilerā€¦ (cached) yes
checking whether aarch64-linux-gnu-gcc accepts -gā€¦ yes
checking for aarch64-linux-gnu-gcc option to accept ISO C89ā€¦ (cached) none needed
checking whether aarch64-linux-gnu-gcc understands -c and -o togetherā€¦ (cached) yes
checking how to run the C preprocessorā€¦ aarch64-linux-gnu-gcc -E
checking for grep that handles long lines and -eā€¦ /bin/grep
checking for BSD- or MS-compatible name lister (nm)ā€¦ /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interfaceā€¦ BSD nm
checking for gawkā€¦ no
checking for mawkā€¦ mawk
checking for a sed that does not truncate outputā€¦ /bin/sed
checking for egrepā€¦ /bin/grep -E
checking for fgrepā€¦ /bin/grep -F
checking how to print stringsā€¦ printf
checking for ld used by aarch64-linux-gnu-gccā€¦ /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ldā€¦ yes
checking command to parse /usr/bin/nm -B output from aarch64-linux-gnu-gcc objectā€¦ ok
checking for _ prefix in compiled symbolsā€¦ no
checking whether build environment is saneā€¦ yes
checking for a thread-safe mkdir -pā€¦ /bin/mkdir -p
checking whether make sets $(MAKE)ā€¦ yes
checking for style of include used by makeā€¦ GNU
checking whether make supports nested variablesā€¦ yes
checking whether UID ā€˜1000ā€™ is supported by ustar formatā€¦ yes
checking whether GID ā€˜1000ā€™ is supported by ustar formatā€¦ yes
checking how to create a ustar tar archiveā€¦ gnutar
checking dependency style of aarch64-linux-gnu-gccā€¦ gcc3
checking whether make supports nested variablesā€¦ (cached) yes
checking whether to enable maintainer-specific portions of Makefilesā€¦ no
checking dependency style of aarch64-linux-gnu-gccā€¦ gcc3
checking for flexā€¦ no
checking for lexā€¦ no
checking for target architectureā€¦


Still unsupported target: aarch64-linux-gnu ā€“ Sorry.


can you please help us ?

send me the output of

$ echo $PATH
$ uname -a
$ aarch64-linux-gnu-gcc --version

linaro@linaro-alip:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
linaro@linaro-alip:~$ uname -a
Linux linaro-alip 4.0.0-ipipe #1 SMP PREEMPT Fri May 26 13:32:23 IDT 2017 aarch64 aarch64 aarch64 GNU/Linux
linaro@linaro-alip:~$ aarch64-linux-gnu-gcc --version
aarch64-linux-gnu-gcc (Ubuntu/Linaro 4.9.2-10ubuntu13) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ok so you are building natively (this is getting confusing since DavidIOT is now cross compiling? are you guys working together?)

I am not really sure what you are doing with your system because things do work for me as per the instructions. Where did you get your Xenomai from?

You should try to follow the instructions:

  1. download (you could use the tip of xenomai but letā€™s keep it simple) http://git.xenomai.org/xenomai-jro.git/ xenomai-jro-410c.linaro-15.07.tar.bz2 and execute natively

  2. execute ā€œscripts/bootstrapā€ (for with you had to install automake/libtool/libltdl-dev).

configure --with-core=cobalt --enable-smp --enable-pshared --enable-assert --prefix=/usr/xenomai

Then attach config.log or any error messages that pop up.

Also do not setup environment variables blindly. why is your target architecture aarch64-unknown-linux-gnu?? it should be arm64.

Hi ldts,
we are working together, trying with the native compiling (on the dragonboard) method.
config.log file done with ā€œexit 0ā€ - it is above 3000 lines and the format is not supported for uploading here. Do you want us to send you it somehow?

we tried the next step according to xenomai manuals:
$ dmesg | grep -i xenomai
and we got the following:
[ 0.700352] [Xenomai] scheduling class idle registered.
[ 0.700362] [Xenomai] scheduling class rt registered.
[ 0.700585] I-pipe: head domain Xenomai registered.
[ 0.703817] [Xenomai] Cobalt v3.0 (Exact Zero)

We saw it should be written enabled at the end instead of Exact Zero. Maybe this affects somehow?

Also we tried to execute latency check and we get this error:
$ /usr/xenomai/bin/latency
0"000.000| BUG in low_init(): [main] Cobalt core not enabled in kernel

Of course before that weā€™ve executed:
$ sudo echo ā€œ/usr/xenomai/libā€ > /etc/ld.so.conf.d/xenomai.conf
and added /usr/xenomai/bin to our $PATH.

Can you please help us?