Many instructions here are mirrored from Toby Schneider's instructions at http://gobysoft.org/wiki/InstallOnGumstixOvero.
Root filesystem preparation
Follow these steps to create a debian wheezy root filesystem. In this section we will use # host
to indicate commands run on the host machine, and # chroot
for commands commands run inside the chroot filesystem.
Install dependencies:
# host sudo apt-get install multistrap qemu-user-static
- Pick a working folder, in this case
~/duovero
Create a directory to hold the root filesystem:
# host cd ~/duovero mkdir rootfs
Create a configuration file debian.conf in ~/duovero and paste in the following. Additional packages can be included here or installed later using apt-get.
[General] arch=armel directory=~/duovero/rootfs retainsources=~/duovero/sources cleanup=true noauth=true unpack=true bootstrap=Wheezy Net Utils aptsources=Wheezy [Wheezy] packages=apt locales udev adduser sudo nano build-essential less source=http://debian.lcs.mit.edu/debian suite=wheezy [Net] packages=netbase ifupdown iproute net-tools iputils-ping ntp source=http://debian.lcs.mit.edu/debian [Utils] packages=wget source=http://debian.lcs.mit.edu/debian
Run multistrap to create the root filesystem.
# host sudo multistrap -a armel -d ~/duovero/rootfs -f debian.conf
In ubuntu 14.04 you may need to remove $forceyes from /usr/sbin/multistrap at line 989
Copy the QEMU ARM emulator into the new root filesystem so it is on the path when we chroot in.
# host sudo cp /usr/bin/qemu-arm-static ~/duovero/rootfs/usr/bin/
(Optional) If you need
/dev/random
(for installing openssh-server for example), mount/dev
in the chroot.# host sudo mount -o bind /dev ~/duovero/rootfs/dev
Chroot into the new filesystem.
# host sudo chroot ~/duovero/rootfs /bin/bash
Finish setting up packages
# chroot dpkg --configure -a
Answer "no" when prompted to use "dash" as "/bin/sh". If any packages fail to configure (possibly
ifupdown
), just rundpkg
again.Set the root user password.
# chroot passwd
(Optional) Add a new user and give it sudo permissions
# chroot adduser mit printf "mit ALL=(ALL) ALL" >> /etc/sudoers
Configure locales. Choose 138 for en_US.UTF-8.
# chroot dpkg-reconfigure locales
Add a DNS server
# chroot printf "nameserver 8.8.8.8" > /etc/resolv.conf
Add a static network entry for
eth0
(install theisc-dhcp-client
package for dhcp support)# chroot nano /etc/network/interfaces auto eth0 iface eth0 inet static address 192.168.1.102 netmask 255.255.255.0 gateway 192.168.1.1
Restart networking to apply the new interface.
# chroot /etc/init.d/networking restart
This might yield an error, but try pinging something anyways and it should work.
Update the apt repositories
# chroot apt-get update
Assign a hostname and update the hosts file
# chroot printf "nostromo" > /etc/hostname printf "127.0.0.1 nostromo\n" >> /etc/hosts
Add the serial console (specific to gumstix overo and duovero)
# chroot printf "T0:2345:respawn:/sbin/getty -L 115200 ttyO2 vt102\n" >> /etc/inittab
Add a proc filesystem to fstab
# chroot nano /etc/fstab # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0
Using the root filesystem
After setting up the root filesystem, chroot should now log you in as root by default. To log in as a different user, use chroot
with the --userspec
option. You'll need to provide the user and group id, not name though. To find the id, chroot in as root and look in /etc/passwd
# host sudo chroot ~/duovero/rootfs # chroot cat /etc/passwd root:x:0:0:root:/root:/bin/bash ... mit:x:1000:1000:,,,:/home/mit:/bin/bash
Now to login as the user mit:
# host sudo chroot --userspec=1000:1000 ~/duovero/rootfs
To avoid permission issues, you should use your user account (not the root account) to check out subversion or git repos. Sudo
may not work in the chroot environment, so you may still need to use the root account for operations that require root access.
Kernel Preparation
Install dependencies
sudo apt-get install u-boot-tools g++-arm-linux-gnueabi
Download the kernel
cd duovero mkdir kernel-dev cd kernel-dev git clone git://github.com/gumstix/linux.git linux -b omap-3.6
Copy the duovero config from the hovergroup svn and create a .config file.
cd linux cp ~/hovergroup/gumstix-dev/duovero/defconfig arch/arm/configs/duovero_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- duovero_defconfig
Build the kernel and modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage -j2 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j2
The resulting uImage should be built in arch/arm/boot. Modules will be installed by the script that makes the SD card.
Software setup
If it isn't already, mount /dev in the chroot:
# host sudo mount -o bind /dev ~/duovero/rootfs/dev
Enter the chroot and start by installing some additional packages.
# chroot apt-get install module-init-tools openssh-server screen psmisc
Add the main user to the dialout group so it can access serial ports.
# chroot usermod -a -G dialout mit
Follow the steps at Software Installation to install MOOS, MOOS-IvP, Goby, and the hovergroup applications. Make sure you perform these steps as the user account you created, not root. You may wish to install distcc first to speed up compiling - see next section for instructions. Even if compiling inside the chroot, you may still want to set the compiler to distcc to avoid completely recompiling later. Distcc will complain about not being able to distribute the compile job but will revert to using local compilation just fine.
Setup Distcc
First on the gumstix/chroot side. The debian wheezy image we built includes g++-4.6 by default, but Ubuntu 14.04 only has the cross compiler for 4.7, so we'll install 4.7 along with distcc.
# chroot apt-get install g++-4.7 distcc
There should be some symlinks in /usr/lib/distcc as follows:
# chroot arm-linux-gnueabi-g++-4.7 -> ../../bin/distcc arm-linux-gnueabi-gcc-4.7 -> ../../bin/distcc
The cross compiler on the host machine will need to match the g++/gcc version listed in your symlinks. To make distcc the default compiler add the following lines to your ~/.bashrc file:
# chroot export CC=/usr/lib/distcc/arm-linux-gnueabi-gcc-4.7 export CXX=/usr/lib/distcc/arm-linux-gnueabi-g++-4.7 export DISTCC_HOST=192.168.1.100 # default remote host to use
On the machine you want to distribute the compile jobs too (host) install distcc and the cross compiler.
# host sudo apt-get install distcc g++-4.7-arm-linux-gnueabi
Add two new symlinks in /usr/lib/distcc
# host cd /usr/lib/distcc sudo ln -s ../../bin/distcc arm-linux-gnueabi-g++-4.7 sudo ln -s ../../bin/distcc arm-linux-gnueabi-gcc-4.7
Run the distcc daemon on the host
# host distccd --daemon --allow '192.168.1.0/24'
You can add this command to ~/.profile to run on login.
RTKLIB Setup
The required files are included in the third-party folder of the hovergroup svn. Start by building the rtklib applications:
# chroot ~/hoverland/hover-kayak/third-party/rtklib/app/makeall.sh
Then set the launch scripts corresponding to your vehicle to automatically start
# chroot cd /etc/init.d sudo ln -s /home/mit/hoverland/hover-kayak/third_party/josh_rtklib/start_silvana.sh start_kayak.sh sudo ln -s /home/mit/hoverland/hover-kayak/third_party/josh_rtklib/start_rtkrcv.sh start_rtkrcv.sh sudo update-rc.d start_kayak.sh defaults sudo update-rc.d start_rtkrcv.sh defaults
For some reason this doesn't seem to work when copy pasted, so you may need to type it in.
Other Modifications
Set permissions on screen at startup
# chroot nano /etc/rc.local chmod 777 /var/run/screen
Allow [machine] auto ssh login to [remote]
This is required for the automated log fetching scripts to work correctly. For example, to allow terra to ssh into kestrel without a password prompt:
# terra ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.1.105
Deploy to SD card
Copy the required files from the hovergroup svn:
cp ~/hovergroup/gumstix-dev/duovero/u-boot.img ~/duovero/ cp ~/hovergroup/gumstix-dev/duovero/MLO ~/duovero/ cp ~/hovergroup/gumstix-dev/duovero/mksdcard.sh ~/duovero/
Insert your sd card, determine its device identifier (/dev/sdb for example), and then run the script. There are some absolute paths in the script so you may want to look through it before running it.
cd ~/duovero sudo ./mksdcard /dev/sdb
References
http://gobysoft.org/wiki/CompileGumstixKernel
http://gobysoft.org/wiki/InstallOnGumstixOvero
http://www.gumstix.org/software-development/how-to/248-compile-kernel-boot-loader.html