Building a Xenomai kernel

Hello,

I still don’t have the Xenomai kernel but here is the progress I made so far. I read the shell scripts provided by Robert, patched a certain release of the kernel and listened to Kroah-Hartman’s video on kernel patching.

The issues are these. The Xenomai kernel appears to be extremely release-sensitive. I found three sets of patches:

  • adeos-ipipe-2.6.38.8-arm-1.18-08.patch
  • adeos-ipipe-3.0.36-arm-1.18-11.patch
  • ipipe-core-3.2.21-arm-1.patch
    I was able to apply the 3.2.21 patch to kernel release 3.2.21 which I had to get with wget. This directory was NOT a git repo. That is important because Robert’s set of patches only works with git repos. I found that the last file to get patched, vmalloc.c was more likely to cause problems when kernel version was not an exact match. I saw a new Kernel configuration option for enabling Xenomai.

I patched v3.2.21 using Xenomai supplied files. Opened up the tarball. Did git init, git add . , git commit and git checkout -b Xenomai. Compiled, too. There is now a zImage file. I copied the zImage file to the boot directory in my ext4 partition to replace the old file. The BeagleBoard doesn’t boot. There was no zImage, only a vmlinuz file in the small, fat partition. I didn’t see any links either so didn’t change anything there. I was obviously using a cross compiler for the correct architecture, etc… Was there anything wrong with my config file or with my file copy procedure? If anybody made this work with BeagleBoard patches please explain. Is it possible to determine whether the installation is indeed realtime AFTER installing the kernel and booting BeagleBoard with it? Is there anything that I can check to verify that I have the kernel I want?

Question 2. I looked at the first two patches. The first one made no sense. The second seems to have been incorporated in v3.6 of the mainstream kernel. Would you recommend examining each patch one by one to see which ones are still needed in the current kernel version? If yes, what is a good procedure for it? I recently learned the git format-patch branch1…branch2 command but it is tedious to copy the working directory (staging area?) for each new comparison. need some guidance here.

Best regards,

Ahmet

A Xenomai mailing list post that may be of use:

><i> I am looking at the ksrc/arch/arm/patches directory in the Xenomai git
</i>><i> repository for tags v2.6.0 and v2.6.1.
</i>> ><i> I notice in v2.6.1 there is an ipipe patch named
</i>><i> "ipipe-core-3.2.21-arm-1.patch" which differs from the others I have
</i>><i> seen which start with "adeos-ipipe".
</i>> ><i> Since I prefer to pull from the original ipipe tree directly rather than
</i>><i> applying the patch, does it matter if I choose "ipipe-core" or
</i>><i> "adeos-ipipe"? I would prefer the latest vanilla kernel version, so if
</i>><i> you could recommend a head/tag to checkout corresponding to this patch,
</i>><i> I would appreciate it. Right now I am looking at the "for-ipipe-3.2-arm"
</i>><i> head.
</i>
adeos-ipipe-* are the previous generation of adeos I-pipe patches, they
stop around Linux version 3.0/3.1.

ipipe-core-* are a new incarnation of the adeos I-pipe patches, they
start at Linux version 3.2. The idea is to make the patch simpler by
making the assumption that Xenomai is the only user of the patch, so cut
down on things that were a bit more generic. At this chance we also did
some other refactoring, such as putting in a common place things that
were the-same-but-not-really on all architectures. What also changed is
that there is now one git branch for all the architectures.

the branch for-ipipe-3.2-arm is a branch in
git://git.xenomai.org/ipipe-gch.git
which is the git I use for working on the I-pipe patch. This branch is
merged in the core-3.2 branch in the official I-pipe git repository at:

git://git.denx.de/ipipe.git

The branch core-3.2 is the branch from which the ipipe-core-3.2-*
patches are made.

In the ipipe-gch git, you can also find the for-core-3.4 branch which
contains the current status of my work on the Adeos I-pipe core patched
Linux 3.4. There is currently no pending issue on this branch (and I
plan to backport some of the changes in the for-ipipe-3.2-arm branch).
But to use that branch, you will need to use the master branch from the
xenomai git:

git://git.xenomai.org/xenomai-2.6.git

What’s your cross compile environment, are you using the native bitbake method or are you patching a stock kernel from kernel.org?

xenomai/bin/latency (latency test suite)
xeno-test (wrapper for various validation tests)

Some info on interpreting the results:

http://www.xenomai.org/pipermail/xenomai/2012-October/026721.html


Hi,

Hello,

The issues are these. The Xenomai kernel appears to be extremely release-sensitive. I found three sets of patches:

  • adeos-ipipe-2.6.38.8-arm-1.18-08.patch
  • adeos-ipipe-3.0.36-arm-1.18-11.patch
  • ipipe-core-3.2.21-arm-1.patch

Everything which is NOT mainline is release sensitive:)

I was able to apply the 3.2.21 patch to kernel release 3.2.21 which I had to get with wget. This directory was NOT a git repo.

Why? Just use the stable kernel git repo and check out v3.2.21

Best regards,

Ahmet

I managed to get a 3.2.21 kernel boot with a xenomai patch and a custom config, but unfortunately (for you) I just arrived in Spain for the Embedded Linux Conference. Will be able to give you the magic config file earliest on Friday.

Regards,

Robert

Thank you Gilles. I used the gcc cross-compiler that is installed by apt-get on Ubuntu 12.04 which is apparently the same as the one available here http://www.kernel.org/pub/tools/crosstool/ (i.e. not the codesourcery compiler). I patched 3.2.21 downloaded from kernel.org and it went smoothly on condition that the kernel version was an exact match. The 3.2.21 source is patched up as soon as I am done with prepare-kernel.sh, right?

If at that point I use the RCN shells to apply the BeagleBoard patches, my kernel should be OK. But the first set of patches is for kernel v3.2.21 and the second set is for kernel v3.2.31. And copying the kernel image on top of the old image in the /boot directory doesn’t seem to work either. It is frustrating to sit looking at all those patches not knowing how to deal with them.

If there is anybody out there who knows how to apply both Xenomai and BeagleBoard patches, can you please apply and install them both on the sdcard and then reply this post with a typescript file attached? A picture is going to be worth a thousand words.

What IS the bitbake method?

Ahmet

Hi,

Hello,

The issues are these. The Xenomai kernel appears to be extremely release-sensitive. I found three sets of patches:

  • adeos-ipipe-2.6.38.8-arm-1.18-08.patch
  • adeos-ipipe-3.0.36-arm-1.18-11.patch
  • ipipe-core-3.2.21-arm-1.patch

Everything which is NOT mainline is release sensitive:)

I was able to apply the 3.2.21 patch to kernel release 3.2.21 which I had to get with wget. This directory was NOT a git repo.

Why? Just use the stable kernel git repo and check out v3.2.21

I didn’t do that because I didn’t know v3.2.21 was available. I found two git repos:
1- torvalds/linux git
2- stable/linux-stable.git

I cloned both of these repositories and used git tag to list the versions available on the first one (torvalds/linux.git) which didn’t have v3.2.21 tagged! It didn’t occur to me to check the second repository even though I had it cloned. I am such a beginner that I assumed that they were copies of one another. Apparently one of them is a list of the release candidate versions…

Look forward to your magic config file. Thanks in advance.

Ahmet

Building a kernel using OpenEmbedded:

http://elene.dahners.com/blog/2012/10/22/compiling-a-kernel-module-for-beaglebone/

Building the entire Angstrom system from scratch using OE (you should do this at least once as an exercise to see how the filesystem is put together and built):

http://www.meadios.com/2012/01/building-angstrom-using-bitbake-and-openembedded/

Some additional bitbake/oe links:

http://bec-systems.com/site/521/best-practices-for-kernel-development-with-openembedded

Here is a neat process using buildroot to only populate the final firmware image with just the utilities you want in the distro:

http://dev.frozeneskimo.com/embedded_projects/beaglebone_network_multitool_server

Keep us posted on your progress with Xenomai, I am working on the same thing and will post my process for integrating the Xenomai RTOS patches if someone else doesn’t.

Is there a rule against attachments???

I was able to compile Xenomai at last… but I can’t even share the config file here!

None that I know of, but it will go out to over 5,000 email recipients! A link to a location is always better.

Gerald

Unfortunately it is not possible to attach the working config file or the typescripts!! I am posting the message without the attachments until I can find a solution.

Thank you for the help. I have finally managed to build a Xenomai kernel, I think.

Here is a step by step guide.

First start with a working system.

on computer:
wget http://rcn-ee.net/deb/rootfs/precise/ubuntu-12.04-r8-minimal-armhf-2012-10-19.tar.xz
tar xf ubuntu-12.04-r8-minimal-armhf-2012-10-19.tar.xz
cd ubuntu-12.04-r8-minimal-armhf-2012-10-19.tar.xz
sudo ./setup_sdcard.sh --mmc /dev/mmcblk0 --uboot beagle_xm
remove sdcard from computer and boot microcontroller with it
see attached file typescript-1

on microcontroller:
userid=ubuntu, password=temppwd
uname -r to confirm kernel version is 3.6.2-x3
sudo halt
power off
remove sdcard from microcontroller and insert it in the computer

Notes:
This particular RCN system has the most up-to-date kernel version as of Oct 2012 and since it has the patches, it supports all of the BeagleBoard devices to boot. However, Xenomai, will have an older kernel and it will not support BeagleBoard devices such as the ethernet port.

Installing Xenomai 2.6:
on computer:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
git clone git://xenomai.org/xenomai-2.6.git
cd linux-stable
git checkout v3.2.21 -b Xenomai
git describe to see that this is indeed v3.2.21
download attached config file!
cp -vi /home/ahmet/config .config
make ARCH=“arm” oldconfig
make ARCH=“arm” localmodconfig
for the next step qt is required (install from the Ubuntu Software Centre)
make ARCH=“arm” xconfig
If you started with the config file attached to this post then you need not change anything to compile the kernel. Nevertheless, I believe that there are redundant features selected.
if the cross compiler isn’t already installed then install it (sudo apt-get install gcc-arm-linux-gnueabihf)
make ARCH=“arm” CROSS_COMPILE=“arm-linux-gnueabihf-” -j5
copy zImage from arch/arm/boot/ directory to first (vfat) partition of the sdcard under a different name. e.g. zImage2
edit uEnv.txt so that first line reads “kernel_file=zImage2”
remove sdcard from computer and boot microcontroller with it
see attached file typescript-2

on microcontroller:
userid=ubuntu, password=temppwd
uname -r to confirm kernel version is 3.2.21!

Notes:
Many BeagleBoard devices will not be working because err… the BeagleBoard patches distributed by Robert Nelson have not been applied. I need to learn how to apply these patches to kernel v3.2.21

To Do:
Please review the procedure in the attached typescript files and examine the attached config file to improve it.

If you can get me get started with applying those BeagleBoard patches, that’ll be great!

Ahmet

PS The bitbake method with Angstrom doesn’t work because the script keeps asking for a file called texi2html. And the git link has changed, too.
git clone git://github.com/Angstrom-distribution/setup-scripts.git

the config file and the scripts can be seen here

http://tekeliblog.wordpress.com/2012/11/09/installing-xenomai-on-beagleboard-xm/

Here is what I did:

  1. stable 3.2.21 (mainline) kernel without additional patches
  2. apply the xenomai patch from xenomai head
  3. use this config file to build you xenomai enabled kernel:

http://www.reliableembeddedsystems.com/beagle-xm-xenomai/defconfig_cooked-boot-from-nfs

My beagle-xm rev c boots, I have network and there is xenomai support.

Regards,

Robert

Thank you. The kernel compiled but at boot time it hangs up.
The last messages were related to the USB device:
[ 5.372985] usb 1-2: New USB device found, idVendor=0424, idProduct=9514
[ 5.380096] usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 5.388732] hub 1-2:1.0: USB hub found
[ 5.393066] hub 1-2:1.0: 5 ports detected

Do you have any idea what it can be?
I did oldconfig, localmodconfig and xconfig without changing anything. Then cross compiled.

Ahmet

Dear Gilles,

Perhaps I misunderstood your comment below. I thought you were indicating that there is a “test” version available for 3.4 kernels with xenomai ipipe already patched in at for-core-3.4. However, when I started to compile for-core-3.4, there was no “xenomai” real-time menu added full of the related kernel features, so I thought the xenomai ipipe hadn’t already been patched in yet.

However, I do not find an ipipe-core-3.4.x-arm.patch in git://git.xenomai.org/xenomai-2.6.git either that I could use to patch for-core-3.4 to make it RT-ready. In any case, if you have a test version I could be interested in trying it on the Panda Board ES.

Cheers.

Robert ,

As I’m interested in the subject of having Xenomai on Beaglebone Black I’ve reached that thread.
Nevertheless, your link lead me to a broken link.
Is there an updated procedure for Xenomai on BBB please ?

I've got a version of RCN's kernel building scripts that will build a
Xenomai kernel:

https://github.com/cdsteinkuehler/linux-dev

Checkout any of the 3.8.13-bone<x>-xenomai branches and build as usual
(./build-kernel.sh or ./build-deb.sh). See the xenomai() procedure in
patches.sh if you want to see how to apply the Xenomai patches to your
own kernel tree.

Note that a working ipipe patch and pre/post patches for the Bone kernel
are now part of the latest Xenomai release.

Christmas time ! thanks Charles, I’ll try :

./build_kernel.sh + ./tools/install_kernel.sh

I think this assume the following to be uselless :

1- Checkout the “am33x-v3.8” branch in the Robert Nelson repository [3],
the patch has been tested with commit 3fc8a73d782231ab2750ff29793a760e8fa076bb
2- apply beaglebone/ipipe-core-3.8.13-beaglebone-pre.patch
3- apply ipipe-core-3.8.13-arm-1.patch
4- apply beaglebone/ipipe-core-3.8.13-beaglebone-post.patch
5- you can resume to generic installation instructions.

DL

Yes, those are the instructions for patching the BeagleBone kernel
source manually and can be safely ignored if you're using my github
repository. In my repo, the above patching is done for you by the
scripts, along with adding the rest of Xenomai to the kernel.

Hi,

After some tries I’ve changed from Mint Host ( Petra is unrecognized and Linaro seems not to be installed with Olivia)
I finally succeeded to execute these scripts on Debian Wheezy 32: it worked directly without any trouble.
Nevertheless, booting with the MMC isn’t recognized : the BBB start with Angstrom .

I’ve used a 4 GB uSD Card to be sure.

, but don’t see what is wrong there.