Documentation/Maemo 5 Final SDK Installation

WARNING: Never rm -r /scratchbox or subfolders, you got bindmounts of proc/ dev/ etc to your REAL SYSTEM. You will kill your system when indiscriminately deleting stuff in /scratchbox!



The following document describes the installation of the Maemo 5 Final SDK. Maemo SDK uses Scratchbox as the cross compilation environment into which Maemo specific development files are installed.

Before we begin with the installation, have a look at the minimum system requirements. We officially support x86-32 Debian based distributions, mainly Debian and Ubuntu though it is possible to install the SDK on other flavours of Linux too.

Once you are sure that your development machine fulfills these requirements, you can proceed with the following guidelines:

Maemo 5 SDK comes with two command-line installation scripts and GUI installer (beta) to ease the SDK installation.

  • Scratchbox installer script which downloads and installs the required version of Scratchbox onto your host machine.
  • Maemo SDK installer which sets up two targets (armel and x86) inside Scratchbox, downloads the minimal rootstraps for both targets, and installs the open source development files based on the user selection during the installation process.
  • GUI installer which combines both Scratchbox and SDK installation.

Maemo 5 SDK also provides the essential Nokia proprietary binary packages needed for Maemo development and additional Nokia applications in an authenticated repository. In order to have access to this repository, you will need to accept the End User License Agreement (EULA).

For the complete functionality and usability of the Maemo SDK, it is required to install Nokia proprietary binary packages in addition to the open source packages.

What is not included in the Maemo SDK?

Xephyr X11 server software is needed on your host machine before you can run any applications in the Maemo SDK. It is an X11 server that provides a device screen for the developer so that you can see all the Maemo application windows and visuals on your host machine. This software is not included in the SDK mainly because it is available on most linux distributions.

If you choose to install Maemo SDK using the GUI installer on Debian based systems, it will provide an option to install Xephyr for you.

If not, you can manually install Xephyr as follows:

On Debian based linux systems, Xephyr can be installed outside Scratchbox environment using apt with root permission:

$ sudo apt-get install xserver-xephyr

On a Gentoo system you need to install xorg-server with the kdrive useflag. This builds the Xephyr binary.

Installing Maemo 5 SDK using GUI Installer

recent requests on IRC suggest this wizard GUI installer is completely broken and thus SHOULD NOT be used. Follow text based installation scheme instead, as this GUI thing will fail out after downloading 1GB and you have to start all over again

Maemo 5 SDK installation is now made easy with GUI installer. This installer will install Scratchbox and Maemo 5 SDK on Debian based systems. This installer will allow installation of nokia closed packages and applications provided that EULA at this webpage is accepted.

Features of the GUI installer

  • Install/Upgrade Scratchbox
  • Installation of Maemo 5 SDK
  • Installation of nokia-binaries
  • Installation of nokia-apps
  • Installation of Xephyr, if missing
  • Can create a launcher for Xephyr on Desktop
  • Can create a shortcut to Scratchbox home folder on Desktop
  • Can create Maemo 5 info page on Desktop that contains useful links for developers
  • Uninstallation of Scratchbox and targets (Debian-based distros only)

GUI installer offers standard and custom installation modes in a wizard. Standard installation will use default settings, while custom offers more choices. Please note that standard mode will overwrite any of the standard targets (FREMANTLE_X86, FREMANTLE_ARMEL) if present, but contents of Scratchbox home will be preserved. Please use the custom mode if you don't want to overwrite your targets.

The GUI installer Qt application requires Python bindings for Qt. GUI installer can install the required packages if not already installed.

The installer will use the http_proxy environment variable if available. If your connection does not seem to work, you will be asked to manually enter proxy settings.

GUI installer has been tested on Ubuntu Karmic and Debian Lenny, both 32bit and 64bit versions. The GUI installer needs to download Maemo SDK so it requires a working Internet connection. On 64bit kernel, you need to disable VDSO for 32bit applications manually.

On systems with Grub2, this can be done in the file /etc/default/grub.

Starting installation with GUI installer

There are some missing options in this Python script, and if you run from non-Debian based Linux systems you will errors, because it will not automatically define the installation path of Scratchbox, to correct this error you must patch this script.

Also you must uncheck the Xephyr checkbox and install it manually.

  < SB_PATH = "/scratchbox"
  > SB_PATH = "/opt/scratchbox"
  >       opt = opt + "-s /opt/scratchbox"
  >       cmd = cmd +" -s /opt/scratchbox"
chmod a+x
$ Installer requires root privileges
   sudo ./
   su -c ./

Limitations of the GUI installer

  • As the installer will do package installation, you should quit all package managers before running it.
  • Please note that detecting Scratchbox is not perfect and it will detect only if it is installed in the /scratchbox path.
  • Please note that python-qt features used in this installer might not be available in older Ubuntu and Debian distros.
  • Due to differences in versions of Python Qt bindings, certain parts of installation can work differently on different systems.
  • Installer only shows required settings on 64-bit machines but does not add them automatically.
  • Installer will always use DISPLAY :2, if you want to use a different value, you need to change it manually.
  • GUI installer does not work on SUSE Linux. You can use command line installers instead.

Installing Maemo 5 SDK using Text-based Installer

Installing Maemo 5 SDK on 32-/64-bit Debian/Ubuntu-based distributions

Since the Scratchbox site has packages for both architectures, and the Debian packages work fine on Ubuntu, it is easiest to just install from the Hathor release.

1. Set up a new APT source using the instructions at

2. Follow the installation instructions at or follow on for simplified instructions.

3. Update your APT cache:

$ sudo apt-get update

then install Scratchbox:

$ sudo apt-get install scratchbox-core scratchbox-devkit-apt-https scratchbox-devkit-autotools-legacy scratchbox-devkit-debian-squeeze scratchbox-devkit-doctools scratchbox-devkit-git scratchbox-devkit-perl scratchbox-devkit-python-legacy scratchbox-devkit-qemu scratchbox-devkit-svn scratchbox-libs scratchbox-toolchain-cs2007q3-glibc2.5-arm7 scratchbox-toolchain-cs2007q3-glibc2.5-i486 scratchbox-toolchain-host-gcc

The installation will ask you some questions about users and groups to set up.

4. Download the SDK setup script:

$ wget

5. Since Scratchbox Hathor is based on Debian Squeeze, and the SDK script assumes etch is to be used, we need to make a small change to it:

$ sed -i -e 's/etch/squeeze/g'

6. Set the permissions to execute the script:

$ chmod +x

7. Users of Ubuntu 10.04 LTS will need to do the following to fix the installation, note that this may reduce system security! [1]

$ echo "vm.mmap_min_addr = 0" | sudo tee -a /etc/sysctl.conf
$ sudo sysctl -p

8. If you have not already added a user to scratchbox, do so now:

$ sudo /scratchbox/sbin/sbox_adduser <username>

At this step, you should have a working Scratchbox environment ready.

9. Proceed further to run the Maemo SDK installer script. This script is run as <user> outside the Scratchbox environment.

$ ./

10. If you are installing running this script in Ubuntu 10.10 Maverick Meerkat, you might find the following error: Error opening terminal: xterm In that case follow the instructions at

11. If you have installed Scratchbox in a path alternative to /scratchbox, you will need to specify the path with ‘-s PATH’ option. More information on available command line options can be found with --help option. Follow the instructions on the go.

11. Once the script has successfully completed its execution, you can login into Scratchbox.

$ /scratchbox/login

If you are not able to login, take a look at the limitations of Scratchbox.

12. Proceed further to accept the EULA in order to obtain the Nokia proprietary binary packages. These Nokia binaries are essential for the complete functionality of the Maemo SDK:

12.1. Accept the EULA on this webpage
12.2. Copy the sources.list entry given to you after the license acceptance to your Scratchbox x86 and armel target’s /etc/apt/sources.list file.

EDIT: You can now just use the following sources.list entry:

deb fremantle/4bc37c7c77ebe90177c050b805a8dc79 nokia-binaries

Execute the commands below on the FREMANTLE_ARMEL and FREMANTLE_X86 targets.

[sbox-FREMANTLE_X86: ~] > sb-conf select FREMANTLE_ARMEL
[sbox-FREMANTLE_ARMEL: ~] > nano /etc/apt/sources.list  # add deb line 
[sbox-FREMANTLE_ARMEL: ~] > apt-get update
[sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install nokia-binaries nokia-apps
[sbox-FREMANTLE_ARMEL: ~] > sb-conf select FREMANTLE_X86
[sbox-FREMANTLE_X86: ~] > nano /etc/apt/sources.list  # add deb line 
[sbox-FREMANTLE_X86: ~] > apt-get update
[sbox-FREMANTLE_X86: ~] > fakeroot apt-get install nokia-binaries nokia-apps

The above step installs all needed Nokia proprietary binary packages along with the open source binaries that have dependencies to Nokia proprietary binary packages. With this, your Maemo 5 SDK environment is set up completely and ready for development.

13. If you got any DNS errors with apt-get install resolving '', you have need to update the resolver config inside scratchbox with sudo /scratchbox/sbin/sbox_sync

Installing Maemo 5 SDK on openSUSE

There are instructions at

At the moment, the instructions are only available at the old version of the openSUSE-wiki:

Installing Maemo 5 SDK on non-Linux operating systems

If you do not have a Linux environment (Windows or Mac OS X), you can install a Maemo SDK virtual machine image from VMPlayer is required.

Starting/Shutting down the SDK UI

Before starting the UI framework, ensure that you have installed the following:

  • Xephyr X11 server on the host machine outside the Scratchbox environment
  • The SDK as described above
  • The Nokia proprietary binary packages

1. Now, run Xephyr outside the scratchbox environment:

$ Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac &

Ubuntu 10.04 users using the package in the repositories will have to run the same command without the -host-cursor and -kb, however the terminal window will have to stay open. For recent Ubuntu releases the recommended Xephyr command line (using Finnish keyboard layout) is:

$ Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -keybd ephyr,,,xkbmodel=evdev,xkblayout=fi

Ubuntu 10.10:

$ Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac

Ubuntu 10.10 & poulsbo (GMA 500, Nokia Booklet 3G):

$ Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac -nodri

To run Maemo5 SDK from desktop edit /usr/local/bin/

2. Login to Scratchbox X86 target

$ /scratchbox/login

Welcome to Scratchbox, the cross-compilation toolkit!

Use 'sb-menu' to change your compilation target.

See /scratchbox/doc/ for documentation.

[sbox-FREMANTLE_X86: ~]>

3. Set the DISPLAY variable to match the display setting given for the Xephyr server.

[sbox-FREMANTLE_X86: ~] >export DISPLAY=:2

4. Start the UI framework .

[sbox-FREMANTLE_X86: ~] > start

5. You will now see the UI framework up and running on the Xephyr window.

6. You can shut down the UI framework as follows:

 [sbox-FREMANTLE_X86: ~] > stop

Starting Scratchbox on non-Debian based systems

If Scratchbox was installed from Debian packages, the /etc/init.d/scratchbox-core init script is installed and Scratchbox should start automatically when the system is rebooted. However, if you have installed Scratchbox from tarballs, then rebooting your machine will clear away all the mounts and binfmt_misc registrations that Scratchbox requires to work. To get your Scratchbox working again after reboot, you have to run the following command as root:

$ sudo /scratchbox/sbin/sbox_ctl start

Alternatively you can add sbox_ctl as an init script to the /etc/init.d directory and create the appropriate links at your system's runlevel directories. This procedure works on some systems:

$ ln -s /scratchbox/sbin/sbox_ctl /etc/init.d/scratchbox-core
$ /usr/sbin/update-rc.d scratchbox-core defaults

Refer to your system's documentation for the correct instructions.

Upgrading from Maemo 5 Beta2 SDK

A smooth upgrade from beta2 to Final SDK is unfortunately not possible. Hence it is advised to freshly install the Final SDK. Before you do so, read through the instructions below.

Some of the Nokia applications shipped with the final SDK use a hard coded path for user home directory which presents a problem since the default username on the device differs from the username on the developer’s machine. To make these applications work, it is required to create a home directory that matches the hard coded value. This needs to be done outside scratchbox using root privileges. The -u option in the Scratchbox installer has been updated to create the necessary symlinks. Running the installer with -u option when the Scratchbox has been already installed will just add the user and create symlinks. Running it for already existing user will check for the symlink and create it if needed.

Run the command below to create the symlink for existing Scratchbox user:

$ sudo ./ -u <EXISTING_USER>

Alternatively, you can create the symlinks manually as follows, if Scratchbox is installed in the default location:

$ sudo ln -s /scratchbox/users/<username>/home/<username> /scratchbox/users/<username>/home/user

The Final SDK installer additionally creates a directory /opt under /target/<target_name>/.

Reason: In order to facilitate installing applications under /opt on the device, a symlink /opt has been created pointing to /home/opt. The SDK inherits this feature. Under Scratchbox, /opt points to /target/links/opt which in turn points to /targets/<target_name>/opt. Installing the rootstraps makes this point to /home/opt, which is not what we want, since we need /opt to be target specific. In order to resolve this situation, we have to manually check whether /targets/<target_name>/opt is a symlink and if it is, remove it and create a directory with the same name.

Upgrading from Maemo 4.x/Diablo SDK

Due to the fact that there are API breaks in Fremantle, we cannot upgrade Diablo SDK to Fremantle. We can however have Fremantle Scratchbox targets co-exist with Diablo targets.

For this, we need to first upgrade the Scratchbox installation on our host machine.

  • Download the Maemo5 scratchbox installer.
  • Set executable permissions and run it as follows:
$ chmod a+x ./
$ sudo  ./ -U -u <EXISTING_USER> -s /scratchbox

Once the Scratchbox installation is done, run the Maemo 5 Final SDK installer.

Manual Installation

On x86 and x86_64 Debian-based systems

  • You can add the following line into your host machine's /etc/apt/sources.list file.
deb hathor main
  • Install the needed Scratchbox packages with root permission
$ sudo apt-get update
$ sudo apt-get install scratchbox-core scratchbox-libs scratchbox-devkit-qemu scratchbox-devkit-debian scratchbox-devkit-doctools scratchbox-devkit-perl scratchbox-toolchain-host-gcc scratchbox-toolchain-cs2007q3-glibc2.5-arm7 scratchbox-toolchain-cs2007q3-glibc2.5-i486  scratchbox-devkit-svn scratchbox-devkit-git scratchbox-devkit-apt-https

The Scratchbox packages will be unpacked to /scratchbox directory and the installation procedure will ask you some questions about the group and user accounts. Default group to Scratchbox is 'sbox'.

  • Users who will be using Scratchbox should be added using the following command with root permission:
$ sudo /scratchbox/sbin/sbox_adduser USER yes

It will automatically include the user to the Scratchbox group, create user directories under /scratchbox/users and mount several directories (/dev, /proc, /tmp) under the user directory.

  • Some of the Nokia applications shipped with the final SDK use a hard coded path for user home directory which presents a problem since the default username on the device differs from the username on the developer’s machine. To make these applications work, it is required to create a home directory that matches the hard coded value. This needs to be done outside scratchbox using root privileges.
$ sudo ln -s /scratchbox/users/<username>/home/<username> /scratchbox/users/<username>/home/user
  • For the group membership to be effective in the current terminal session, run the following command:
$ newgrp sbox

Note: This command will change the existing group ID during the current login session to 'sbox'. If you do not want to change, simply logout and log back in for the group membership to be effective.

  • Log-in to Scratchbox.
$ /scratchbox/login
  • Configure the scratchbox x86 and armel targets as follows:
[sbox->:~]>sb-conf st FREMANTLE_X86 -c cs2007q3-glibc2.5-i486 -d perl:debian-etch:doctools:svn:git -t none
[sbox->:~]>sb-conf st FREMANTLE_ARMEL -c cs2007q3-glibc2.5-arm7 -d qemu:perl:debian-etch:doctools:svn:git -t qemu-arm-sb
  • Download the minimal rootstraps.
[sbox->:~]> wget
  • Switch to x86 target, install the devkits, etc and fakeroot into the target, install the minimal rootstrap and finally the Maemo development files.
[sbox->:~]> sb-conf se FREMANTLE_X86
[sbox-FREMANTLE_X86: ~] > sb-conf rs maemo-sdk-rootstrap_5.0_20.2010.36-2_i386.tgz
  • Some users seem to have problems downloading all files with apt http pipelining enabled. If you want to make sure or you get download errors like "104 connection reset by peer" at the fakeroot steps below, then disable http pipelining with the next command:
[sbox-FREMANTLE_X86: ~] > echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00maemo
  • either way, continue here:
[sbox-FREMANTLE_X86: ~] > sb-conf in -edFL
[sbox-FREMANTLE_X86: ~] > apt-get update
[sbox-FREMANTLE_X86: ~] > fakeroot apt-get install maemo-sdk-debug

The meta-package maemo-sdk-debug installs all needed open source runtime, development and debug pakcages into the target. Use maemo-sdk-runtime if you want only runtime packages to be installed or use maemo-sdk-dev if you want only the runtime and development packages to be installed.

  • Accept the EULA from here to obtain the URL to access the Nokia binaries repository. (OBSOLETE)
  • Instead add repository:

deb fremantle/<token_number_here> nokia-binaries

  • For token check the post:

  • Add the URL thus obtained to the Scratchbox target's /etc/apt/sources.list and do the following:
[sbox-FREMANTLE_X86: ~] >apt-get update
[sbox-FREMANTLE_X86: ~] >fakeroot apt-get install nokia-binaries nokia-apps
  • In order to facilitate installing applications under /opt on the device, a symlink <code>/opt has been created pointing to /home/opt. The SDK inherits this feature. Under Scratchbox, /opt points to /target/links/opt which in turn points to /targets/<target_name>/opt. Installing the rootstraps makes this point to /home/opt, which is not what we want, since we need /opt,/code> to be target specific. In order to resolve this situation,
[sbox-FREMANTLE_X86: ~] >rm -rf /targets/FREMANTLE_X86/opt
[sbox-FREMANTLE_X86: ~] >mkdir /targets/FREMANTLE_X86/opt
  • Execute similar steps on the armel target too to set it up:
[sbox-FREMANTLE_X86: ~]> sb-conf se FREMANTLE_ARMEL
[sbox-FREMANTLE_ARMEL: ~] > sb-conf rs maemo-sdk-rootstrap_5.0_20.2010.36-2_armel.tgz
  • again,the next command disables http pipelining, if you like:
[sbox-FREMANTLE_X86: ~] > echo 'Acquire::http::Pipeline-Depth "0";' >> /etc/apt/apt.conf.d/00maemo
  • pipelining disabled or not, here we go again...
[sbox-FREMANTLE_ARMEL: ~] > sb-conf in -edFL
[sbox-FREMANTLE_ARMEL: ~] > apt-get update
[sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install maemo-sdk-debug
  • Add the same URL obtained above to access the Nokia binaries repository under <code>/etc/apt/sources.list file of the Scratchbox armel target.
[sbox-FREMANTLE_ARMEL: ~] >apt-get update
[sbox-FREMANTLE_ARMEL: ~] >fakeroot apt-get install nokia-binaries nokia-apps
  • Create the /opt directory.
[sbox-FREMANTLE_ARMEL: ~] >rm -rf /targets/FREMANTLE_ARMEL/opt
[sbox-FREMANTLE_ARMEL: ~] >mkdir /targets/FREMANTLE_ARMEL/opt

With this, you must now have both the targets setup and ready to use.

Start the UI framework.


Make sure that you have no process running inside Scratchbox. Uninstalling Scratchbox will remove everything that is installed and saved inside Scratchbox. Please take a backup of your files from Scratchbox user home directory if needed.

On Debian based systems, do the following with root permissions:

$ sudo apt-get remove scratchbox-* --purge
$ sudo rm -rf /scratchbox

On non-Debian based systems, you need to stop scratchbox as follows before removing it.

$ sudo /scratchbox/sbin/sbox_ctl stop
$ sudo rm -rf /scratchbox

not stopping scratchbox will keep the bindmounts and you'll nuke /proc /dev etc of your *real* system with the second line above!

Limitations of Scratchbox

The following limitations have been noted in the usage of Scratchbox:

VDSO support

Scratchbox versions prior to 1.0.18 (Hathor) do not work when VDSO32 support is enabled in the host's kernel, although there are some workarounds for older versions, which are presented here.

If your host has VDSO32 turned on you will get an error like this when trying to login to Scratchbox.

No directory, logging in with HOME=/
Inconsistency detected by rtld.c: 1192: dl_main: Assertion `(void *) 
ph->p_vaddr == _rtld_local._dl_sysinfo_dso' failed!

x86-64 kernel

x86-64 Linux kernels starting from version 2.6.25 enable VDSO32 by default. To temporarily disable VDSO32 execute

sysctl abi.vsyscall32=0

On Linux kernel 2.6.24 <= you can disable VDSO32 by executing

sysctl vm.vdso_enabled=0


sysctl kernel.vdso=0

The current setting of VDSO32 can be verified by using sysctl. Only values 0 and 2 are compatible with Scratchbox. In our examples we use 0 (disable). 2 enables compat mode.

You can set all of these permanently by adding the following lines to /etc/sysctl.conf

vm.vdso_enabled = 0
abi.vsyscall32 = 0
kernel.vdso = 0

Save the file and run the command:

$ sudo sysctl -p

Please note the correct line depends on your Linux kernel version. When you execute sysctl -p you may get a warning about unknown keys. You can safely ignore those warnings as long as one of the 3 settings works.

WARNING : You should try setting these values by echoing them to the given locations before adding them to sysctl.conf to see if they cause any problems. For example, in some Ubuntu Gutsy installations, it has been observed that changing the VDSO settings will hang the system and thus making permanent changes in sysctl.conf may, in these cases, make your system unbootable.

Known Issues in the SDK

  • A list of issues and their solutions can be found in the Developer FAQ article
  • Unnecessary warnings and debugging messages are printed out when the hildon application framework is started.
  • Armel target does not bring up the UI framework
  • It has been noted that Xephyr dies with the application framework at times. The crash in question might even be Xephyr related since the application framework behaves differently with different versions/builds of Xephyr. The case seems to be worst on Xephyr that comes with Ubuntu Jaunty, there Xephyr will die when running any application that contains an input field and clicking on that field with a mouse to invoke the input method. On Fedora Core 10 the Xephyr does not mind the mouse clicks but dies when shutting down the application framework. On the other hand Xephyr on Ubuntu Intrepid or even the Intrepid version recompiled for Jaunty does not experience crashing in these situations.
    A patch is already available for the Xephyr on Ubuntu Jaunty and can be found at Binaries packages for xserver-xephyr package and its dependencies (libgpg-error0 and libcrypt11) can be download from Ubuntu Jaunty repositories.
  • The performance of clutter can be improved by enabling hardware acceleration if not enabled already. In some cases, it would require installing restricted/proprietary drivers (Eg: on host machines with ATI or NVidia graphics card). Refer to Maemo 5 Clutter performance for more details.
  • Running Xephyr with -kb option disables entry of “@” symbol. However, removing -kb option disables cursor keys.
  • Running Xephyr with -host-cursor is causing Xephyr to crash in Ubuntu Lucid and Debian Squeeze when the Hildon Application Framework is closed.
  • Xephyr in Ubuntu Lucid does not support the -kb option anymore.
  • In order to run ARMEL binaries in scratchbox the mmap_min_address needs to be set to 4096 or lower. Normally the SDK installer warns about that, but in Ubuntu Lucid the /proc entry is visible only to root, so the SDK installer can not see it. This also prevents qemu from checking the value, in which case it is assumed to be 0. Because of this, until the bug is fixed (kernel 2.6.34 is unaffected, and at least that version will be in Maverick), the value should be set to 0 on Lucid.
$ sudo su
$ echo "vm.mmap_min_addr = 0" >> /etc/sysctl.conf
$ sysctl -p
$ exit #to go back to user

Next steps

Once you have Scratchbox installed and the Maemo 5 UI running in Xephyr, you have everything you need to start building, packaging and developing software for the N900.

To get started with a sample application, try following this tutorial on packaging.