Table of Contents

  1. Introduction
  2. Installing Scratchbox
    1. Installing on Ubuntu
    2. Disabling VDSO Support
  3. Configuring Scratchbox for Zipit 2 Development
  4. Running Your Software
  5. Notes

Introduction

Scratchbox is a sandbox for building software. It is a cross-compilation toolkit designed to make embedded Linux application development easier. It also provides a full set of tools to integrate and cross-compile an entire Linux distribution. Development will the Zipit is currently being moved to provide full support with OpenEmbedded, but in the meantime, here's a guide to get Scratchbox up and running for writing software on the Zipit 2.

IMPORTANT NOTE: Newer kernel releases such as 2.6.31 and later have problems running scratchbox. While there are workarounds being developed you are advised to steer clear of bleeding edge Linux releases for scratchbox Zipit development. Known working distributions include Ubuntu 9.04 (Jaunty) and Debian 5.03. If you update these older releases, ensure that you are not installing a newer kernel.

Installing Scratchbox

The full installation guide for installing Scratchbox is available on their website in case your Linux distro isn't listed on this site.

Installing on Ubuntu

First, add the following lines your "/etc/apt/sources.list" repository list:

# Scratchbox
deb http://scratchbox.org/debian/ stable main

Then, run the following commands to get Scratchbox installed:

sudo apt-get update
sudo apt-get install scratchbox-core scratchbox-devkit-cputransp scratchbox-devkit-debian scratchbox-libs scratchbox-toolchain-arm-gcc4.1-uclibc20061004 scratchbox-toolchain-arm-linux-ct401-2.3 scratchbox-toolchain-cs2005q3.2-glibc2.5-arm scratchbox-toolchain-host-gcc

Then, run the following command to add yourself to the "scratchbox" user group:

sudo /scratchbox/sbin/sbox_adduser "your username"

Once that is done, you'll want to log out and back in to be recognized as part of the "scratchbox" group to run Scratchbox. If you have to disable VDSO (read below) then you can disregard the logging off and settle for a reboot instead.

Disabling VDSO Support

If you are installing Scratchbox on a Debian distribution (such as Ubuntu) then you may need to disable VDSO at boot time. Typically you will be told that this is necessary when you add yourself to the scratchbox group. You may see a message that reads "Host kernel has vdso support (which is uncompatible with SB)". If you are running a modern flavor of Debian or Ubuntu then you are utilizing Grub2 as a boot loader. Older distributions such as Ubuntu 9.04 or Debian 5.03 utilize Grub v1.x.

To disable VDSO with Grub2

  1. Edit "/etc/default/grub" and change GRUB_CMDLINE_LINUX="" to read GRUB_CMDLINE_LINUX="vdso=0".
  2. Run sudo /usr/sbin/update-grub in terminal.
  3. Reboot.

To disable VDSO with Grub 1.x

  1. Edit "/boot/grub/menu.lst" and find your default kernel. Typically this line looks something like this ...

kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/hda1 ro quiet

  1. Change this line to include vdso=0 at the end. It should look like this ...

kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/hda1 ro quiet vdso=0

  1. Save and close the file.
  2. Reboot.

Configuring Scratchbox for Zipit 2 Development

Enter "scratchbox" into a terminal to start the sandbox environment. Do the following steps to get Scratchbox setup for the Zipit 2.

  1. Next, enter "sb-menu" to bring up the Scratchbox configuration menu.
  2. Then you'll want to select "Setup".
  3. Select "<NEW>" for a new target, then enter "Z2" as your target name.
  4. Choose "arm-gcc4.1-uclibc20061004" as your compiler.
  5. Then, browse down to select the "cputransp" development kit. Then select "DONE".
  6. Next, select "qemu-arm-cvs" for your CPU-transparency method.
  7. Then, choose "NO" for extracting a rootstrap to the target.
  8. Select "YES" to install files on the target. Choose any extra packages to install, and then select "OK".
  9. Finally, choose "YES" to select the target you just created.

From now on, each time you run Scratchbox, the "Z2" development environment will be selected. You now have C (gcc) and C++ (g++) compilers to write software for the Zipit 2.

Running Your Software

After writing and compiling your software, you'll want to copy your executables to a Mini-SD card. You can either follow the Z2 Mini-SD guide on running it, or check out the Z2 Shell documentation. Everything you compile is saved in the "/scratchbox/users/username/home/username" folder of you Linux installation.

Notes

There are no extra libraries on the Zipit 2 at this time. Anything you compile will have to be statically linked before it will run on the Zipit 2. If you need extra libraries, make sure to compile them first in Scratchbox. If you you are given a typical OSS set of software, the easiest way to statically link it is to run the following command while configuring it.

CFLAGS="-static" ./configure

But, also make sure that this is the best way to configure static linking for your particular library. You can find out more about your library by running the following command:

./configure --help

Hosted by linux.zipitwireless.com