Xenomai on Foxg20
Xenomai is a real-time development
framework cooperating with the Linux kernel, in order to provide a
pervasive, interface-agnostic, hard real-time support to user-space
applications, seamlessly integrated into the GNU/Linux environment.
We now see how to install it on FoxG20.
Download the source tree
On your Linux PC move to your home directory and download the
standard kernel source tree from Internet typing:
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.9.tar.bz2
$ tar -xvjf linux-2.6.35.9.tar.bz2
Applying the
patches for the FOX Board G20
Download extract these patches to your new linux source directory
and apply them: 0001_xenomai_foxg2_2_6_35_9
$ patch -p1 < 0001_xenomai_foxg2_2_6_35_9.patch
Configuring your Kernel
For custom config you kernel choose you must now configure it:
$ make menuconfig
Building Your Kernel
Once you are happy with your kernel configuration you can build a
new kernel with:
$ make
When finished you will find a new uImage file
containing the kernel image. This file have
to be copied on the first FAT16 partition of your microSD card as
described next.
If you require to compile the Kernel modules type also:
$ make modules
$ make modules_install
Note that modules are not installed but rather all copied to the
./FoxModules sub-directory. If you don't want old
modules you've build before then instead of that last line do:
$ rm -rf ./FoxModules
$ make modules_install
Creating Your
Initial Root File Store
Debian comes with a useful tool for systems installers called
debootstrap that eases creating your initial root file
store.
To get debootstrap (in case it's not yet installed on
your Ubuntu distro), type:
sudo apt-get install debootstrap
debootstrap is usually run in two stages. The first
stage is on a working Debian (or Ubuntu) machine to create a very
basic area. The second stage is run on the target machine (in this
case your Netus) to fill in that area.
The steps are detailed and minor mistakes can lead to an
unbootable system or a system that is highly unreliable.
To make life easier you can use this shell script: gen_root3.sh
There are some settings at the start of the script that you may
want to change. In particular:
# Where to get Debian files from - pick one local to you!
url=http://ftp.uk.debian.org/debian
You can find the official list of alternate mirrors here:
http://www.debian.org/mirror/list
# This MUST match the version of the kernel you are using on your target
kernel_version=2.6.35.9
# Either set eth=static and then also address, netmask and gateway
# OR set eth=dhcp
# Comment out which ever you are NOT using
# Target machine network details
eth=static
address=192.168.1.90
netmask=255.255.255.0
gateway=192.168.1.1
#eth=dhcp
Once edited gen_root3.sh has to be run as root (it is a
requirement of debootstrap):
sudo ./gen_root3.sh
When the script runs, it will create the sub-directory armel-root
in the Linux directory and will copy the first stage bootstrap files
in there.
Once completed, you need to copy the contents of the directory
armel-root to the root area of your microSD. If your
microSD card uses the recommended Debian layout and is mounted in
your (Debian/Ubuntu) host then you can copy it with:
sudo cp -rp armel-root/. /media/rootfs
sync
Compile Xenomai
Xenomai will
now be crosscompiled for ARM platform:
$ wget
http://download.gna.org/xenomai/stable/xenomai-2.5.6.tar.bz2
$ tar -xvjf xenomai-2.5.6.tar.bz2
$ cd $xenomai_root
$ ./configure --host=arm-linux-gnueabi --enable-arm-eabi
--enable-arm-mach=at91sam9 --disable-arm-tsc
$ make
DESTDIR=/destination/of/xenomai/ install
finally copy the files of Xenomai in
the root store.
$ cd /destination/of/xenomai/usr/
$ sudo cp -R xenomai/
/media/rootfs/usr/
$ cd ..
$ cd dev
$ sudo cp -R * /media/rootfs/dev/
Copy
modules on root file store
Now we copy the kernel modules:
$ cd linux-2.6.35.9/FoxModules/lib
$ sudo cp -R firmware/
/media/rootfs/lib/
$ sudo cp -R modules/
/media/rootfs/lib/
$ sync
Installing
Now unmount your microSD card, transfer it to your Netus and boot.
I strongly advise you to have a console cable (e.g. using the
Debug Port Interface) in place so you can monitor stage2's progress
Depending on your network connection (and the speed/load of the
Debian repository) stage2 can take 30 minutes or more to complete. At
which time the Netus will reboot automatically into multi-user
Debian.
You can login as root with no password.
I STRONGLY advise that your first steps are to set a root password
(the Netus root password used elsewhere is netusg20) and
then to run:
apt-get update
apt-get install locales
dpkg-reconfigure locales
At the very least this will stop perl (and everything
that uses perl) from complaining about locale issues!
Some locales run out of memory when you try to configure them on
the Fox (localedef crashes). If you are hit by this do:
apt-get install locales-all
before running dpkg-reconfigure.
installing locales-all takes a long time - at least 15 minutes!
You now have a basic Debian system running. I suggest you run:
apt-get install ntpdate
Test the xenomai system
Finally, to
test the system we can run the command:
$ cd
/usr/xenomai/share/xenomai/testsuite/latency/
$ ./run

Latest version
This is the Debian bootable microSD contents used to write the
tutorial on this site:
Thanks
acmesystems for their work.
For more
information visit http://www.acmesystems.it/
|