Project

General

Profile

Gumstix Setup

Making the root filesystem

First, install debootstrap and qemu (specifically you'll need qemu-arm-static). I don't remember the process, but there is a way for Linux to automatically execute ARM binaries with qemu which you'll need to set up. Then:

mkdir overo
cd overo
debootstrap --arch=armhf --include wget --foreign precise fs

Then prepare to chroot:

cp /usr/bin/qemu-arm-static fs/usr/bin/qemu-arm-static
mount -o bind /proc fs/proc
mount -o bind /sys fs/sys
mount -o bind /dev fs/dev
mount -o bind /dev/pts fs/dev/pts
chroot fs /bin/bash

Now you should be root in the target filesystem.

Finish setting up filesystem

Note that scout and root passwords are both 's'.

locale-gen en_US.UTF-8
/debootstrap/debootstrap --second-stage
groupadd gpio -r
useradd -mU -G sudo,gpio,dialout -s /bin/bash scout
echo "root:s" | chpasswd
echo "scout:s" | chpasswd
chmod u+s /bin/su
chmod u+s /usr/bin/sudo

Adding configuration files

See Gumstix Configuration for more info.

First clone the scoutos repository:

su scout
cd
git clone ssh://roboclub@roboclub.org/home/svn/scoutos
exit

Then copy all of the files in ~/scoutos/scout_gumstix/etc into /etc. At some point we should have a script using rsync which does this conveniently.

Clean up chroot

exit
umount fs/dev/pts
umount fs/dev
umount fs/sys
umount fs/proc

Making the boot files

First, install the gcc-arm-linux-gnueabi toolchain through the package manager. Then, see Building the kernel. Once you're finished with that, download and build the U-Boot source (if you use a different version, be careful that the patch still works correctly):

wget ftp://ftp.denx.de/pub/u-boot/u-boot-2012.07.tar.bz2
tar xvf u-boot-2012.07.tar.bz2
cd u-boot-2012.07
export CROSS_COMPILE=arm-linux-gnueabi-

Apply our patch (replacing ${scoutos} with the location of the repository), so that U-Boot will set the correct pin muxing.

patch -p1 < ${scoutos}/scout_gumstix/u-boot-scout.patch
make omap3_overo_config
make omap3_overo

Next copy generated files into their own directory:

mkdir ../boot
cp MLO u-boot.img ../boot

Finally, copy in the kernel you built:

cd ..
cp linux-3.2/arch/arm/boot/uImage boot

Installing ROS

This should be done as root in the chroot environment (or on the board itself).

First make sure that /etc/apt/sources.list has universe uncommented somewhere. Then add the ROS packages:

echo deb [arch=armel] http://packages.ros.org/ros/ubuntu precise main > /etc/apt/sources.list.d/ros.list
wget http://packages.ros.org/ros.key -O - | apt-key add -
apt-get update

Install ALL the dependencies!

apt-get install openssh-server screen vim
apt-get install gcc g++ make cmake pkg-config
apt-get install libboost.*1.48-dev
apt-get install liblog4cxx10-dev libbz2-dev
apt-get install python-rosinstall python-empy python-rospkg python-rosdep python-nose python-setuptools python-serial

From this point forward, don't be root

su scout

Install the base system according to http://www.ros.org/wiki/fuerte/Installation/Ubuntu/Source

cd
rosinstall --catkin ~/ros-underlay http://ros.org/rosinstalls/fuerte-ros-base.rosinstall
mkdir ros-underlay/build
cd ros-underlay/build
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/ros/fuerte
make -j4
sudo make install

Make sure the scoutos repository has been cloned. Add the following two lines to ~/.bashrc:

source /opt/ros/fuerte/setup.bash
export ROS_PACKAGE_PATH=/home/scout/scoutos:/home/scout/ros:$ROS_PACKAGE_PATH

TODO install rosserial into /home/scout/ros

Then build everything! Except for scoutsim, which we don't need, and which has dependencies we don't want to install.

source ~/.bashrc
roscd scoutsim
touch ROS_NOBUILD
rosmake scout

Writing files to the SD card

Partition the SD card

Run fdisk on the sd card (probably /dev/mmcblk0). Then:

  • (c) Set DOS compatibility so you can put a partition near the beginning of the card.
  • (n p 1 128 +64M) Create a 64MB partition, which will be for booting.
  • (n p 2 131201 [enter]) Create another partition, just after the previous one, with the default size.
  • (a 1) Set the first partition as bootable.
  • (t 1 0c) Set the first partition as W95 FAT32 (LBA)
  • (p) Make sure everything looks good, including that the second partition is 83 Linux
  • (w) Write to disk (or, if you messed up, (q) to quit without modifying the disk)

Run this handy script

Note: it is important that MLO is copied to the boot partition first.

#!/bin/bash

boot=/dev/mmcblk0p1
fs=/dev/mmcblk0p2

mkfs.vfat -F 32 $boot
mkfs.ext3 $fs

mkdir -p sd

mount $boot sd && {
  cp boot/MLO sd
  cp boot/u-boot.img sd
  cp boot/uImage sd
  umount sd
}

mount $fs sd && {
  cp -R --preserve=all fs/* sd
  umount sd
}