MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Installing Harmattan Platform SDK manually


MeeGo 1.2 Harmattan Platform SDK can be installed manually without using installer scripts. It uses Scratchbox as the cross-compilation and development environment. Scratchbox is a configuration and chroot cross-compilation environment for building Linux software. The basic idea of Scratchbox is to offer developers an environment that works and looks like the target environment before the target environment is available. It also provides a large set of tools for integrating and cross-compiling in the form of development kits (so-called devkits). For more information, see Scratchbox documentation.

To start using Scratchbox:

To install Scratchbox manually:

  1. Download Scratchbox Hathor from the Scratchbox site.
  2. Modify the sources.list file (on Debian-based systems).
  3. Install the Scratchbox packages.
  4. Add your user name to the Scratchbox user group.
  5. Log into Scratchbox.

Modifying package resource list

If your host machine is not a Debian-based Linux distribution, skip this step.

Before starting the installation, add the following line to your host system's /etc/apt/sources.list file:

deb http://scratchbox.org/debian/ harmattan main

Installing the Scratchbox packages

Installing the packages on Debian-based systems

Enter the following commands:

$ sudo apt-get update
$ sudo apt-get install scratchbox-core scratchbox-libs scratchbox-devkit-qemu scratchbox-devkit-debian-squeeze \ scratchbox-devkit-perl scratchbox-toolchain-host-gcc scratchbox-toolchain-cs2009q3-eglibc2.10-armv7-hard \ scratchbox-toolchain-cs2009q3-eglibc2.10-i486 scratchbox-devkit-hashutils-squeeze-sdk

Installing the packages on other systems

  1. Download the necessary tarballs from the Scratchbox site.
  2. To extract the tarballs into / directory, enter the following command:
    $ sudo tar zxf <package> -C /
    Note: If / directory does not contain enough space for Scratchbox, you can install Scratchbox into another partition by creating a symbolic link from /scratchbox to the desired location with the following command: ln -s /opt/sb /scratchbox.
  3. After extracting the files, configure Scratchbox with root permission. Enter the following command:
    $ sudo /scratchbox/run_me_first.sh
  4. Complete the installation by answering the questions. In most cases, you can select the default settings.

Scratchbox is now set up and sbox user group created.

Adding your user name to the Scratchbox user group

To use Scratchbox, add your user name to the Scratchbox default user group 'sbox'.

To add your user name, enter the following command:

$ sudo /scratchbox/sbin/sbox_adduser <user name> yes

You are prompted for your password:

[sudo] password for <user name>:

Adding the group membership for the current session

  1. To add the group membership to your current terminal session, enter the following command:
    $ newgrp sbox
    Note: This command changes your existing group ID for the current login session to sbox. If you do not want this change, simply log out and back in again to return to your default group membership.
  2. Because Scratchbox is a chroot environment, you must log in as you would with a real workstation. To log in, enter the following command in the command prompt:
$ /scratchbox/login
The following message is displayed:
You dont have active target in scratchbox chroot.
Please create one by running "sb-menu" before continuing

Welcome to Scratchbox, the cross-compilation toolkit!

Use 'sb-menu' to change your compilation target.
See /scratchbox/doc/ for documentation. 

sb-conf: No current target
[sbox-: ~] >

The Scratchbox prompt [sbox-: ~] > shows that you are in the Scratchbox environment. Since it is possible to have multiple targets in Scratchbox, you can compile programs for different architectures and settings. The HOST target is used for compiling programs that are used in Scratchbox (inside the Scratchbox tool).

Next, create and configure the Scratchbox targets.

Creating and configuring targets

To compile packages for Harmattan, you need to create two new targets, HARMATTAN_X86 and HARMATTAN_ARMEL, with their required tool chains.

  1. To create HARMATTAN_ARMEL target, enter the following command in the command prompt:
    [sbox-: ~] > sb-conf st HARMATTAN_ARMEL -c cs2009q3-eglibc2.10-armv7-hard -d qemu:perl:debian-squeeze:hashutils-squeeze-sdk -t qemu-arm-sb
  2. To create HARMATTAN_X86 target, enter the following command:
    [sbox-: ~] > sb-conf st HARMATTAN_X86 -c cs2009q3-eglibc2.10-i486 -d perl:debian-squeeze:hashutils-squeeze-sdk -t none
  3. To select the HARMATTAN_X86 target you have just created, enter the following command:
    [sbox-: ~] > sb-conf se HARMATTAN_X86

Next, install the TRFs you need.

Installing target root file systems (TRFs)

A target root file system (TRF) is a compressed .tar file containing libraries, header files, executables, and other programs needed for building software for a specific target device.

1. Download the TRF for the currently selected target. The following TRFs are available for the current Harmattan Platform SDK:
  • For HARMATTAN_X86: i386-public-sdk-beta2-rootstrap.tgz
  • For HARMATTAN_ARMEL: arm-public-sdk-beta2-rootstrap.tgz
Note: Save the TRFs to a path that is visible from inside Scratchbox, such as /tmp.
2. Install the TRF together with devkits, etc, fakeroot, and debug links into the currently selected target:
  • For HARMATTAN_X86, enter the following commands:
[sbox-HARMATTAN_X86: ~] >sb-conf rs /<path for the TRF>/i386-public-sdk-beta2-rootstrap.tgz
[sbox-HARMATTAN_X86: ~] >sb-conf in -edFL
  • For HARMATTAN_ARMEL, enter the following commands:
[sbox-HARMATTAN_ARMEL: ~] >sb-conf rs /<path for the TRF>/arm-public-sdk-beta2-rootstrap.tgz
[sbox-HARMATTAN_ARMEL: ~] >sb-conf in -edFL

Completing the setup

To complete the setup after installing the TRFs, update the apt repository. Enter the following command in the command prompt:

[sbox-HARMATTAN_X86: ~] > apt-get update

Note: Update the apt repository also on the ARMEL target if you intend to use it.

Starting Scratchbox

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

$ sudo /scratchbox/sbin/sbox_ctl start

Uninstalling Scratchbox

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

On Debian-based systems, enter the the following commands with root permissions:

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

On non-Debian-based systems, you need to stop Scratchbox before removing it. Enter the following commands:

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