Difference between revisions of "Installing Debian and Xenomai on gumstix Overo"
Sagar Behere (Talk | contribs) m (changed typo) |
Sagar Behere (Talk | contribs) m (fixed typo) |
||
Line 148: | Line 148: | ||
cp MLO /media/FAT; cp u-boot.bin /media/FAT | cp MLO /media/FAT; cp u-boot.bin /media/FAT | ||
cp {kernelsourcedir}/arch/arm/boot/uImage /media/FAT | cp {kernelsourcedir}/arch/arm/boot/uImage /media/FAT | ||
− | cd | + | cd overorootfs; sudo rsync -aP . /media/rootfs/ |
sync | sync | ||
Revision as of 04:26, 3 February 2012
This document describes how I (Sagar Behere) installed Debian squeeze and vanilla linux kernel 2.6.38.8 patched with Xenomai 2.6.0 on the gumstix Overo. The contents of this document are probably applicable to other software versions as well.
DISCLAIMER: There may be better ways to do this. I am not an expert. This worked for me. Your mileage may vary.
The standard method to compile a kernel and rootfs is to use the Open Embedded build system that is described here. However, I did not use that method because I couldn't figure out how to build any of the kernel versions for which xenomai patches could be found (at the time of writing, the virtual/kernel pointed to version 3.0). Also, I prefer to use the debian userland, rather than Ångstrom. Therefore, the method described here does NOT use Open Embedded.
Contents
Preparing the host
The host is the computer you will use to build the kernel and rootfs. The target is the gumstix Overo COM on which the kernel and rootfs will be deployed. My host is an x86 computer running Debian squeeze. The method described here will probably work on a host running Ubuntu, with some modifications
Add emdebian to your apt sources and get needed packages
sudo apt-get install emdebian-archive-keyring sudo apt-get install gcc-4.3-arm-linux-gnueabi binutils-arm-linux-gnueabi
This should pull in all the dependencies and you'll now have an arm cross-toolchain installed on your system. For Ubuntu users also, cross tool chains are available. See the http://www.linaro.org/.
Compiling the kernel
- Download and extract xenomai. Let's call the resulting xenomai-2.6.0 dir as {xenomaisourcedir}
wget -c http://download.gna.org/xenomai/stable/xenomai-2.6.0.tar.bz2; tar jxvf xenomai-2.6.0.tar.bz2;
- Supported kernels can be found in {xenomaisourcedir}/ksrc/arch/arm/patches/. I saw the file adeos-ipipe-2.6.38.8-arm-1.18-04.patch and so decided to use that kernel
- Download the kernel and extract it. Let's call the resulting linux-2.6.8.8 directory {kernelsourcedir}
wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.8.tar.bz2; tar jxvf linux-2.6.38.8.tar.bz2
- Patch the kernel sources with Xenomai. Go to {xenomaisourcedir} and
scripts/prepare-kernel.sh --arch=arm --linux=/path/where/you/untarred/linux-2.6.38.8.tar.bz2
It'll suggest the right patch to be applied.
- Set the default kernel configuration
cd {kernelsourcedir}; cp arch/arm/configs/omap2plus_defconfig .config
- Configure the kernel with
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
I removed support for almost all the boards except the Overo and also removed support for everything execpt OMAP3. Configure the xenomai related stuff too.
- Build the kernel with
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage modules
- To deploy the kernel, you'll need the uImage which can be found at {kernelsourcedir}/arch/arm/boot/uImage You'll also need to put the resulting modules into the debian rootfs that we'll create later. For now, I merely put all the modules in some directory {modulesdirectory} with
make ARCH=arm INSTALL_MOD_PATH=/path/to/{modulesdirectory} modules_install;
You can optionally also put the firmware in some directory {firmwaredirectory} with
make ARCH=arm INSTALL_FW_PATH=/path/to/{firmwaredirectory} firmware_install
The {modulesdirectory} will contain a directory lib/modules/kernel-version that we'll copy over to our rootfs later.
We still need to compile the xenomai userspace stuff, but we'll do that after setting up the rootfs
The debian rootfs
These instructions are based on http://gobysoft.com/wiki/InstallOnGumstixOvero and http://paul-strefling.blogspot.com/2011/06/installing-debian-on-gumstix-overo.html
- Get the qemu-arm-static binary.
sudo apt-get install qemu-user-static
for ubuntu use
apt-get install qemu-kvm-extras-static
- Get multistrap
sudo apt-get install multistrap
- Make a directory to create the debian rootfs with
mkdir overorootfs
- Create a file called emdebian.conf in debian-rootfs and put in the following (add whatever packages you wish)
[General] arch=armel noauth=true unpack=true debootstrap=Grip Networking Debian Misc aptsources=Grip Debian [Grip] packages=locales udev adduser sudo nano build-essential less module-init-tools source=http://www.emdebian.org/grip keyring=emdebian-archive-keyring components=main dev suite=stable [Misc] packages=wget source=http://www.emdebian.org/grip keyring=emdebian-archive-keyring components=main dev suite=stable [Networking] packages=netbase ifupdown iproute net-tools iputils-ping ntp wireless-tools isc-dhcp-client wpasupplicant source=http://www.emdebian.org/grip keyring=emdebian-archive-keyring suite=stable [Debian] packages=zile tsocks source=http://ftp.se.debian.org/debian/ keyring=debian-archive-keyring suite=stable
- Create the root filesystem with
sudo multistrap -a armel -d overorootfs/ -f emdebian.conf
- Copy the qemu binary so we can chroot
sudo cp /usr/bin/qemu-arm-static overorootfs/usr/bin
- Chroot into the system
sudo chroot overorootfs /bin/bash
- Finish setting up the packages with
dpkg --configure -a
Answer "no" when asked if you want to use "dash" as "/bin/sh". If ifupdown fails, just run again
dpkg --configure -a
- Add a user and give him sudo permissions
adduser sagar;printf "sagar ALL=(ALL) ALL" >> /etc/sudoers
- Configure locales. 136 is en_US.UTF-8
dpkg-reconfigure locales
- Set the DNS with
printf "nameserver 8.8.8.8" > /etc/resolv.conf
- Get out of the chroot by pressing Ctrl+D and get in again with
sudo chroot overorootfs
At this point, you should be able to
ping www.google.com
if your host has internet access
- create /etc/fstab and add the following
# /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0
- Configure hostname
printf "gumstix" > /etc/hostname printf "127.0.0.1 gumstix\n" >> /etc/hosts
- The final task inside the chroot environment is to enable the serial console. Edit /etc/inittab and add the following line in the end
T0:2345:respawn:/sbin/getty -L 115200 ttyO2 vt102
- Update apt sources
apt-get update
- Exit the chroot and copy the modules over to the overorootfs
cp -a {modulesdirectory}/lib/modules/2.6.38.8-ipipe overorootfs/lib/modules
Xenomai user space
This section is based on instructions at http://www.xenomai.org/index.php/Building_Debian_packages
The userspace part of Xenomai needs to be compiled now. The traditional way is to cross-compile it, as described in the xenomai documentation. However, we can take advantage of our arm chroot environment to avoid cross-compilation. Also, we will create debian packages i.e. .deb files for the userspace part of the xenomai installation. We proceed as follows
- copy {xenomaisourcedir} to overorootfs and
sudo chroot overorootfs apt-get install devscripts debhelper dh-kpatches findutils cd {xenomaisourcedir};DEBEMAIL="your@email" DEBFULLNAME="Your Name" debchange -v 2.6.0 Release 2.6.0 debuild -uc -us cd ../; dpkg -i libxenomai1_2.6.0_armel.deb libxenomai-dev_2.6.0_armel.deb xenomai-runtime_2.6.0_armel.deb
Preparing the SD card
There are a lot of guides describing how to partition and format a SD card for using on the overo. I used the one at http://johnwoconnor.blogspot.com/2009/04/installing-ubuntu-on-gumstix-overo.html. The official guide is at http://gumstix.org/create-a-bootable-microsd-card.html. Read those guides and come to a point where you have created the two partitions and formatted them. Then continue reading here.
[NOTE: I am assuming that the first partition of your card is mounted under /media/FAT and the 2nd partition is under /media/rootfs]
Get pre-built MLO and u-boot.bin from http://gumstix.org/download-prebuilt-images.html . I got mine from http://cumulus.gumstix.org/images/angstrom/factory/2011-08-30-1058/
cp MLO /media/FAT; cp u-boot.bin /media/FAT cp {kernelsourcedir}/arch/arm/boot/uImage /media/FAT cd overorootfs; sudo rsync -aP . /media/rootfs/ sync
Testing the install
Boot the gumstix from the SD card and log in as the user you created. Then wrap up the installation with
sudo dpkg --configure -a
In order to get wireless working, I had to add the files sd8686.bin and sd8686_helper.bin to /lib/firmware/ on the rootfs. Sorry, I don't remember where I got them from.
To test xenomai
cd /usr/lib/xenomai;./latency -p0 -t1
You can also run the other programs in that directory