EBC Xenomai
Embedded Linux Class by Mark A. Yoder
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
- Patch the kernel. This assumes bb-kernel and xenomai-2.6.4 are at the same directory level.
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
- Then one more patch from [1], which is shown here.
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
- Prepare the kernel
host$ cd ../../xenomai-2.6.4/scripts host$ ./prepare-kernel.sh --arch=arm --linux=../../bb-kernel/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.
#AUTO_BUILD=1
- Build the kernel
host$ tools/rebuild.sh
- 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
Then sit back an wait.
Setting up the Bone
While you are waiting for the compile to finish, you can set up the Bone.
- Copy Xenomai to the Bone. I'm assuming the Bone is at 192.168.7.2.
host$ scp -r xenomai-2.6.4 192.168.7.2:.
- On the Bone
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
The configure takes about a minute, the make six more minutes and the install another minute.
Copy the drives.
bone$ cd; mkdir xenomai_drivers; cd xenomai_drivers host$ cd bb-kernel/KERNEL/drivers/xenomai/testing host$ scp *.ko 192.167.7.2:xenomai_drivers
Running Tests
Embedded Linux Class by Mark A. Yoder