Scratchbox 2 With Maemo

Please go to the official Maemo SDK+ project, they provide support for their stuff. Instructions here on this page are not supported, nobody will care if you have trouble with them.

Rough Guide to Combining Maemo and SB2

Get yourself a toolchain

Download CodeSourcery toolchain. Select "ARM GNU/Linux" for Target Platform, and "IA32 GNU/Linux" for Host Platform. Save the file to your $HOME directory.

Get a Qemu

First you need to get a decently functioning qemu for your system, it must have -drop-ld-preload supported. You will also need gnu make 3.81 or newer to build scratchbox2.

Tool Time

Second important thing is to install a debian/etch system somewhere on your host using debootstrap. It will be used as the build tools. We'll assume you've put it into /etch_root. You need to install into it all those tools that you need for building your software (typically "apt-get build-deps gedit" is a good set to start from).

If you don't feel like installing a second linux distro just to build some stuff for the internet tablets, it's perfectly possible to use your host system. Simply omit the "-t /etch_root" option from the sb2-init command. Hopefully you do understand that it'll make creating .debs a little hard unless you're running a debian or its derivative on your host.

SB2 Specifics

$ wget http://people.freedesktop.org/~lle/sbox2-releases/sbox2-1.99.0.22.tar.bz2
$ tar jxf sbox2-1.99.0.22.tar.bz2
$ cd sbox2-1.99.0.22
$ ./autogen.sh
$ ./configure --prefix=$HOME/scratchbox2
$ make
$ make install

If you're on amd64 version of your distribution, you need to build sb2 slightly differently in order to get both 32bit and 64bit versions of the libsb2.so. Make sure you have both versions of glibc and related development files on your host, then replace the last three lines of the above with:

$ make install-multilib prefix=$HOME/scratchbox2

Now continue setting up the toolchain and your target buildroot:

$ cd $HOME
$ tar jxf arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
$ cd arm-2007q3/bin
$ ln -s arm-none-linux-gnueabi-gcc arm-none-linux-gnueabi-cc
$ for f in *; do ln -s $f $(echo $f | sed 's/arm-none-linux-gnueabi-/arm-linux-/'); done
$ mkdir $HOME/buildroot
$ cd $HOME/buildroot
$ wget http://repository.maemo.org/stable/3.1/armel/maemo-sdk-rootstrap_3.1_armel.tgz
$ tar zxf maemo-sdk-rootstrap_3.1_armel.tgz
$ $HOME/scratchbox2/bin/sb2-init -m maemo -t /etch_root maemo $HOME/arm-2007q3/bin/arm-linux-gcc

Add $HOME/scratchbox2/bin to your PATH.

Functionality Verification

After completing the above steps you should verify with a simple hello-world style program that everything is working. Put this into hello.c:

#include <stdio.h>
int main(int argc, char **argv)
{
    printf("Hello, World!\n");
    return 0;
}

Compile it with:

$ sb2 gcc -o hello hello.c

Run it with:

$ sb2 ./hello

For a more thorough test do:

$ sb2 apt-get update
$ sb2 apt-get source maemopad
$ cd maemopad-1.5
$ sb2 dpkg-buildpackage -rfakeroot -d