Note: This tutorial assumes that you have completed the previous tutorials: Overview. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Installing ROS on Galileo: The Debian way
Description: How to install ROS on the Intel Galileo: The Debian wayKeywords: Galileo,Debian
Tutorial Level: INTERMEDIATE
Next Tutorial: GPIO Programming
Introduction
In progress... this should be much easier than the Yocto way... if it works.
It is possible to install Debian on the Galileo board, and this allows for apt-get of packages. Unfortunately, not everything is not as simple as it should be. For instance, the ROS packages are labeled as i386, but they appear to have been built for i686. Installing those packages from the binaries "almost" works, but a few i686 instructions cause problems, and ROS needs to be built from source.
Overview:
Install Debian via one of the two methods here: https://communities.intel.com/thread/48074
- One method creates the image in linux with debian bootstrap.
- The other method creates a virtual machine and makes a copy of its files to a new image.
- A serial cable is extremely helpful, if not required, for both of these.
Install an older version of ssh: http://www.mirrorservice.org/pub/OpenBSD/OpenSSH/portable/openssh-5.9p1.tar.gz
Install ROS via source as per the tutorials
Installing Debian
This section creates a Debian image with the Yocto kernel. It assumes you have a Ubuntu-based system that you're already using for ROS. This section thanks to Thomas Faust [1].
First, get the Yocto Linux image, you'll need this later.
$ cd ~/Downloads $ wget http://downloadmirror.intel.com/23171/eng/LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.5.7z $ sudo apt-get install p7zip-full $ 7z x LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.5.7z
Now create the Debian Linux image and copy the Yocto modules over:
$ cd $ mkdir galileo-debian $ cd galileo-debian $ mkdir mnt-loop sdcard image $ dd if=/dev/zero of=loopback.img bs=1G count=3 $ mkfs.ext3 loopback.img $ sudo mount -o loop loopback.img mnt-loop $ sudo apt-get install debootstrap $ sudo debootstrap --arch i386 wheezy ./mnt-loop http://http.debian.net/debian/ $ sudo mount -o loop ~/Downloads/LINUX_IMAGE_FOR_SD_Intel_Galileo_v0.7.5/image-full-clanton.ext3 image $ sudo cp -r image/lib/modules mnt-loop/lib $ cd mnt-loop $ sudo mkdir media sketch $ sudo mkdir -p opt/cln $ cd media $ sudo mkdir card cf hdd mmc1 net ram realroot union $ cd ../dev $ sudo mkdir mtdblock0 mtd0 $ cd ../.. $ sudo cp -avr image/opt/cln mnt-loop/opt $ sudo cp image/etc/init.d/clloader.sh mnt-loop/etc/init.d $ sudo echo "grst:5:respawn:/opt/cln/galileo/galileo_sketch_reset -v" >> mnt-loop/etc/inittab $ sudo echo "clld:5:respawn:/etc/init.d/clloader.sh" >> mnt-loop/etc/inittab
Now chroot to the new image and do some initial setup:
$ sudo umount image $ sudo mount -t proc proc mnt-loop/proc $ sudo mount -t sysfs sysfs mnt-loop/sys $ sudo chroot mnt-loop /bin/bash # passwd set new root password # vi /etc/hostname change the hostname to clanton # vi /etc/inittab Uncomment the T1 line (ttyS1) and change 9600 to 115200
The version of SSH in Debian doesn't work, we have to roll back to an older version:
# apt-get purge openssh* # groupadd -g 35 sshd # useradd -u 35 -g 35 -c sshd -d / sshd # apt-get update # apt-get install screen build-essential zlib1g-dev libssl-dev # cd /root # wget http://www.mirrorservice.org/pub/OpenBSD/OpenSSH/portable/openssh-5.9p1.tar.gz # tar xvf openssh-5.9p1.tar.gz # cd openssh-5.9p1 # ./configure # make -j8 # make -j8 install
Edit the file /etc/init.d/ssh:
#!/bin/sh case "$1" in start) echo "Starting script ssh " /usr/local/sbin/sshd ;; stop) echo "Stopping script ssh" kill -9 `pgrep sshd` ;; *) echo "Usage: /etc/init.d/ssh {start|stop}" exit 1 ;; esac exit 0
Then enable this script:
# chmod 755 /etc/init.d/ssh update-rc.d ssh defaults
GIT also needs to be rolled back to an earlier version:
# cd /root # apt-get install liblocale-msgfmt-perl gettext libcurl4-openssl-dev curl ntpdate unzip libexpat1-dev python # wget https://github.com/git/git/archive/v1.7.0.9.zip # unzip v* # cd git-* # make -j8 prefix=/usr/local all # make -j8 prefix=/usr/local install
Note that this does not update the GIT documentation, for that you would need to install ascii-text which takes another 1G of space.
Make your own user account:
# apt-get install sudo # useradd <yourusername> -m -s /bin/bash # passwd <yourusername> # usermod -aG sudo <yourusername> # mkdir /home/<yourusername> # chown <yourusername> /home/<yourusername> # su <yourusername> $ bash
Install ROS:
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu wheezy main" > /etc/apt/sources.list.d/ros-latest.list' $ wget http://packages.ros.org/ros.key -O - | sudo apt-key add - $ sudo apt-get update $ sudo apt-get install python-rosdep python-rosinstall-generator python-wstool build-essential python-rosinstall $ sudo rosdep init $ rosdep update $ mkdir ~/ros_catkin_ws $ cd ~/ros_catkin_ws $ rosinstall_generator ros_base --rosdistro hydro --deps --wet-only > hydro-desktop-full-wet.rosinstall $ wstool init -j8 src hydro-desktop-full-wet.rosinstall $ exit $ exit # rosdep install --from-paths src --ignore-src --rosdistro hydro -y --os=debian:wheezy # su <myusername> $ bash $ cd ~/ros_catkin_ws $ ./src/catkin/bin/catkin_make_isolated --install
Configure the network interface. Edit /etc/network/interfaces (with sudo) and make it look like this:
# interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp
Edit /etc/hosts/ (with sudo) and make the first line look like this:
127.0.0.1 localhost clanton
Unmount the files:
$ exit $ exit # exit $ sudo umount mnt-loop/proc $ sudo umount mnt-loop/sys
Copy the image to the sdcard. On that sdcard there should be already be the initramdisk (core-image-minimal-initramfs-clanton.cpio.gz), bzImage and grub.conf (in boot/grub/) from the default Galileo yocto installation. If not, see this: Initial Install
$ sudo umount mnt-loop $ sudo mount /dev/mmcblk0p1 sdcard $ sudo rm sdcard/image-full-clanton.ext3 $ sudo cp loopback.img sdcard/image-full-clanton.ext3 $ sudo umount sdcard
Put the sdcard in the Galileo, it should boot. If you've done everything precisely correct, and there are no errors in the tutorial, you shouldn't even need the serial port.
SSH in and test out the ROS installation:
ssh clanton screen source ~/ros_catkin_ws/install/setup.bash roscore
You should now be able to start The tutorials. Make sure to use ~/ros_catkin_ws/install/setup.bash in place of /opt/ros/hydro/setup.bash.
Note (July 27, 2014): The reason for the issue in pthread that was causing ssh, git, and many other applications to segfault has been recently found here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=738575. The problem is related to a certain lock instruction generated by glibc. It is solved by downloading the source of glibc and configuring it with "-with-cpu=i386", compiling it, and installing it manually.
This is more ideal that rolling back the ssh and git versions because there are many more applications that have multi-threaded code, and many of them will segfault.
TODO:
- Make a new larger /home partition
- Better startup ROS instructions.
The binary installation method
It is also possible to install ROS from the binary packages using apt-get, but it doesn't really work. What works:
- roscore (but not rosout)
- caktin_init_workspace
- catkin_create_package
- catkin python talker/listener
What doesn't:
- rospack find roscpp ("illegal instruction")
- rosout keeps dying and respawning
- catkin c++ taker/listener ("illegal instruction" fucomip in librostime)
fixing the librostime issue
Apparently ROS is built using > i586 instructions, so we have to build ROS from source.
Sergey's blog: lots of info on programming the Galileo: http://www.malinov.com/Home/sergey-s-blog.
[1] Intel forum thread on installing Debian on Galileo