EBC Xenomai

Xenomai is a set of patches for the kernel that allow it to run real-time tasks. This is an adaptation of Bruno Martins' Xenomai on the Beaglebone Black in 14 easy steps that works with the kernel installed in EBC Installing Kernel Source.

Patching the Kernel

 * Install the kernel source (EBC Installing Kernel Source). I'll assume it's in bb-kernel
 * Be sure you have compiled the kernel before applying the patches to be sure it really works.
 * Download the current version of Xenomai. Browse to http://download.gna.org/xenomai/stable/latest/ to see what the latest version is, then

host$ wget http://download.gna.org/xenomai/stable/latest/xenomai-2.6.4.tar.bz2


 * Checkout the the latest kernel

host$ cd bb-kernel/KERNEL host$ uname -a host$ git tags | sort | less Pick the tag that is close to your current version of the kernel. host$ git checkout 3.8.13-bone67 -b xenomai

host$ cd bb-kernel host$ '''patch -p1 < ../../xenomai-2.6.4/ksrc/arch/arm/patches/beaglebone/ipipe-core-3.8.13-beaglebone-pre.patch host$ patch -p1 < ../../xenomai-2.6.4/ksrc/arch/arm/patches/ipipe-core-3.8.13-arm-4.patch host$ patch -p1 < ../../xenomai-2.6.4/ksrc/arch/arm/patches/beaglebone/ipipe-core-3.8.13-beaglebone-post.patch host$ '''cat > thumb.patch diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index e2bc263..6f4d9f0 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S @@ -469,6 +469,7 @@ __irq_usr: kuser_cmpxchg_check irq_handler #ifdef CONFIG_IPIPE +THUMB(	it	ne ) bne	__ipipe_ret_to_user_irqs_disabled #endif	/* CONFIG_IPIPE */ get_thread_info tsk @@ -767,6 +768,7 @@ ENTRY(ret_from_exception) disable_irq bl	__ipipe_check_root cmp    r0, #1 +THUMB(	it	ne ) bne	__ipipe_ret_to_user_irqs_disabled @ Fast exit path over non-root domains #endif /* CONFIG_IPIPE */ get_thread_info tsk host$ patch -p1 < thumb.patch
 * Patch the kernel. This assumes bb-kernel and xenomai-2.6.4 are at the same directory level.
 * Then one more patch from, which is shown here.

host$ cd ../../xenomai-2.6.4/scripts host$ ./prepare-kernel.sh --arch=arm --linux=../../bb-kernel/KERNEL/
 * Prepare the kernel

Compile the Kernel
host$ cd ../../bb-kernel Make sure AUTO_BUILD is turned off. host$ vi system.sh Be sure the last line commented out. host$ ./build_kernel.sh Then sit back an wait.
 * 1) AUTO_BUILD=1
 * Build the kernel
 * When the configuration menu comes up
 * Under CPU Power Management --->  CPU Frequency scaling, disable  [ ] CPU Frequency scaling.
 * Under Real-time sub-system  ---> Drivers ---> Testing drivers, enable everything

Setting up the Bone
While you are waiting for the compile to finish, you can set up the Bone.

host$ scp -r xenomai-2.6.4 192.168.7.2:.
 * Copy Xenomai to the Bone. I'm assuming the Bone is at 192.168.7.2.

bone$ cd xenomai-2.6.4 bone$ ./configure CFLAGS="-march=armv7-a -mfpu=vfp3" LDFLAGS="-march=armv7-a -mfpu=vfp3" bone$ make bone$ make install
 * On the Bone

The configure takes about a minute, the make six more minutes and the install another minute.