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.

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.

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