[Documentation] [TitleIndex] [WordIndex

Installing ROS on Linaro Image from source

If you want to skip this tutorial, you can download a SD card image from

http://goo.gl/ypK85

and start with a groovy installation with OpenCV but without PCL. Install from source requires that you download and compile the source code on your own. Beware it might take days to compile natively on an embedded device for the desktop package and you will have to fix a few things described in the respective section. To speed things up, it is recommended to set up a chroot environment.

Get latest Linaro Image

On your Linux workstation do

sudo apt-get install git linaro-image-tools
git clone git://github.com/gumstix/Gumstix-Overo-Linaro.git 

Now you need to create the image.

linaro-media-create --rootfs ext3 --mmc gumstix.img --dev overo --hwpack Gumstix-Overo-Linaro/Gumstix-Overo-Linaro-armhf-HWPack.tar.gz --binary Gumstix-Overo-Linaro/Gumstix-Overo-Linaro-Precise-ALIP-armhf-RootFS.tar.gz

This will take a while (15 minutes), so feel free to grab a coffee

Now you can dd the image to a SD card and stick it into the gumstix or you can set up a chroot environment which will speed compilation up by magnitudes

Set up chroot environment and increase image size

This is only needed if you want to speed up the installing process by working on an image instead of natively compiling on the embedded device. Install qemu, and increase image size

sudo apt-get install qemu qemu-user qemu-user-static kpartx
qemu-img resize gumstix.img 13G

Unfortunately using gparted on this image will not work. I tried multiple ways and this is the only way I got work. Create device maps from the partition table and symlinks for gparted

sudo kpartx -a gumstix.img
ls /dev/mapper/
ln -s /dev/mapper/loop0p1 gumstix.img1
ln -s /dev/mapper/loop0p2 gumstix.img2

Increase the size of the image using gparted

sudo gparted gumstix.img

Right click on the ext3 partition -> Resize/Move. Use all unallocated space to resize. As you might see, gparted converted the unallocated space to used space. That was not so cool. Exit gparted, delete the device maps, then create them again and start gparted afterwards using those commands.

sudo kpartx -d gumstix.img
sudo kpartx -a gumstix.img
sudo gparted gumstix.img

gparted will still see the new space as used. Now here comes the trick: Resize the ext3 partition again by making it just a tiny bit smaller. Apply your changes. If everything worked, gparted will now find the free space and you can resize it to the full size again. Exit gparted and be happy!

Now we need to mount the right partition. To find out the offset you can use parted

parted gumstix.img
WARNING: You are not superuser.  Watch out for permissions.
GNU Parted 2.3
Using /home/frk1pal/gumstix/gumstix.img
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit                                                             
Unit?  [compact]? B                                                       
(parted) print                                                            
Model:  (file)
Disk /home/frk1pal/gumstix/gumstix.img: 13958643712B
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start      End           Size          Type     File system  Flags
 1      32256B     54525439B     54493184B     primary  fat32        boot, lba
 2      54525952B  13958643711B  13904117760B  primary  ext3

(parted) quit

sudo mount -o loop,offset=54525952 gumstix.img /mnt
sudo mount -o bind /proc /mnt/proc
sudo mount -o bind /dev /mnt/dev
sudo mount -o bind /dev/pts /mnt/dev/pts
sudo mount -o bind /sys /mnt/sys

To be able to use chroot, copy the executable (only needed once)

sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
sudo chroot /mnt

To eliminate warnings

locale-gen en_US.UTF-8
cp /proc/mounts /etc/mtab

Congratulations! You are now inside your gumstix without the need to own one :)

Another good thing about that is that whenever the tutorial tells you to run a command using -j1, you can change it to whatever number fits your CPU best.

If you ever feel like leaving the chroot, press Ctrl + D

Set up Linaro

You will need to do a few things before you can use the Linaro installation

dpkg --configure -a
printf "nameserver 8.8.8.8" > /etc/resolv.conf
ping google.com

If the ping works, you are ready to go.

apt-get update
apt-get upgrade

If you compile using the image file, it will not be able to upgrade all packages due to missing /proc/cpuinfo. Those packages failing are not needed for the future installations, so the errors are ignored and assumed to go away when using the real gumstix. I ended up uninstalling those packages because I do not think I will need them anyways.

Installation setup

This will walk you through the installation step by step

Install binaries

Install "some" prebuilt binaries. You might not need all of them depending on the ROS variant you plan to install, but it is easy and "fast" to do.

apt-get install build-essential python-yaml cmake subversion wget python-setuptools mercurial git-core libapr1-dev libaprutil1-dev libbz2-dev python-dev libgtest-dev python-paramiko libboost-all-dev liblog4cxx10-dev pkg-config python-empy swig python-nose lsb-release python-wxgtk2.8 python-gtk2 python-matplotlib libwxgtk2.8-dev python-imaging libqt4-dev graphviz qt4-qmake python-numpy libtiff4-dev libpoco-dev assimp-utils libtinyxml-dev python-pydot python-qwt5-qt4 libxml2-dev libsdl-image1.2-dev bison++ automake autoconf

easy_install wstool rospkg rosdep

Setup catkin

create a workspace

mkdir -p /opt/ros/groovy/catkin_ws
cd /opt/ros/groovy/catkin_ws

Now download all packages for the variant you choose to install. This tutorial will install the desktop variant, feel free to try out a different one

wstool init src -j1 http://packages.ros.org/web/rosinstall/generate/raw/groovy/desktop
cd src; wstool set swig-wx https://github.com/ros/swig-wx.git --git -y ; wstool update swig-wx; cd ..

Comment - Marcus - 2013/03/13: I believe swig-wx is obsolete. On my x86 installation the only package depending on it are the old rxtools. The current desktop rosinstall does not contain them any more.

Install dependencies

Ensure rosdep has been initialized and update it:

sudo rosdep init
rosdep update

ROS does not detect Linaro as an OS right now, so you might need to add a few lines to os_detect.py

/comment Marcus: I was able to run rosdep/roscore without the changes below.

vi /usr/local/lib/python2.7/dist-packages/rospkg-1.0.18-py2.7.egg/rospkg/os_detect.py

Add the following lines

    OS_UBUNTU='ubuntu' 
    OS_LINARO='linaro'
    OsDetect.register_default(OS_UBUNTU, LsbDetect("Ubuntu")) 
    OsDetect.register_default(OS_UBUNTU, LsbDetect("Linaro"))

Before you can build your catkin workspace you need to make sure that you have all the required dependencies. We use the rosdep tool for this. The -y option automatically accepts download and the -r option will ignore errors. After the installation, we call rosdep again and check what packages have not been installed.

rosdep install --from-paths src --ignore-src --rosdistro groovy -yr
rosdep check --from-paths src --ignore-src --rosdistro groovy

The following sections are instructions on how to install the missing libraries

Threading Building Blocks (libtbb-dev)

cd /opt
wget http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130116oss_src.tgz
tar -xf tbb41*tgz ; rm tbb41*tgz
cd tbb41*
make

I am not sure if that is the right approach, but since make install did not exist, I just copied the .so files from the build folder to /lib

mv build/linux_armv7l_gcc_cc4.6_libc2.15_kernel2.6.32_release/*.so* /lib

yaml-cpp

Do NOT download the latest version, it will not work because they changed the API. Version 0.2.7 works just fine if you compile it as a shared library.

cd /opt; wget http://yaml-cpp.googlecode.com/files/yaml-cpp-0.2.7.tar.gz
tar -xf yaml-cpp-0.2.7.tar.gz
cd yaml-cpp-0.2.7; cmake -DBUILD_SHARED_LIBS=ON .; make install -j1

collada-dom

apt-get install libxml2-dev
cd /opt; wget http://sourceforge.net/projects/collada-dom/files/latest/download
tar -xf download
cd collada-dom-2.4.0; cmake . ; make install -j1

OpenNi

If you want to use OpenNi, now is the time to install it.

apt-get install default-jdk freeglut3-dev

If you really want to build the documentation as well feel free to install doxygen. After that, I dd-ed it back and mounted it again. To install OpenNI, do this

cd /opt; git clone https://github.com/OpenNI/OpenNI.git
cd OpenNI/Platform/Linux/CreateRedist
vi ../Build/Common/Platform.Arm

Uncomment the softfp buildflag in this file and remove the function to automatically find the number of jobs in this file.

vi Redist_OpenNi.py
...
MAKE_ARGS += ' -j1'
...

Now you can install in using

./RedistMaker.Arm
./install.sh

PCL

Delete the -march=native flag

cd catkin_ws/src/pcl
vi cmake/pcl_find_sse.cmake

Set endian

/comment Marcus: My ARM board was correctly detected to use little endian.

vi io/include/pcl/io/ply/byte_order.h

It will check for the architecture in this file, defining either PLY_LITTLE_ENDIAN or PLY_BIG_ENDIAN. Arm will most likely not be detected, so you can remove the #error from the else statement and define the correct value. If you are using a gumstix, it will most likely be #define PLY_LITTLE_ENDIAN

If you are not using a chroot environment, this will take about 24 hours. So get your fastest PC with the most cores and set up chroot!

Install ROS

I removed all qt files from the source folder because one of them had a build error and I do not need any GUI

cd /op/ros/groovy/catkin_ws
rm -rf src/qt*
rm -rf src/rqt*

Now we can install ROS.

./src/catkin/bin/catkin_make_isolated -j1 --install

2024-11-16 14:38