MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

Using Harmattan Platform SDK


Scratchbox targets

The installed Scratchbox environment includes the following targets for MeeGo 1.2 Harmattan development.

  • HARMATTAN_X86: Mainly used for the development of applications.
  • HARMATTAN_ARMEL: Mainly used for cross-compilation to generate ARMEL binaries that can run on the target device.

The targets are configured to use the following:

  • Debian Squeeze devkit, which provides tools from Debian Squeeze baseline.
  • Perl devkit, which provides perl libraries.
  • Code Sourcery CS2009q3 eglibc toolchains.

Development rootstraps containing the needed headers and libraries are pre-installed on both targets.

Logging into Scratchbox

Since Scratchbox is a chroot environment, you must log in just as you would with a real host. Normal users must be added as Scratchbox users before they can log into Scratchbox. This is already handled by the SDK installer. At your host prompt, enter the following command:

$ scratchbox 

The Scratchbox welcome message is displayed:

Welcome to Scratchbox, the cross-compilation toolkit!

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

[sbox-HARMATTAN_X86: ~] >

The Scratchbox prompt [sbox-HARMATTAN_X86: ~] > shows that you are in the Scratchbox environment and using a target called "HARMATTAN_X86".

Using Harmattan UI inside Scratchbox

To run any applications inside Scratchbox, you need Xephyr X11 server software on your host. Xephyr is an X11 server that provides a device screen that shows the application windows and visual elements on your host. It is available on most Linux distributions. This software is pre-installed on the provided vmware image.

1. Outside Scratchbox, start Xephyr. Enter the following command:

Xephyr :2 -host-cursor -screen 480x854x16 -dpi 96 -ac +extension Composite &

2. Inside Scratchbox, start MeeGo Touch Framework. Enter the following command:

[sbox-HARMATTAN_X86: ~] > meego-sb-session start

The home screen runs inside the Xephyr window, as displayed in the following figure:

Harmattan homescreen in the Xephyr window

To stop the UI framework, enter the following command:

[sbox-HARMATTAN_X86: ~] > meego-sb-session stop

Running custom applications inside Scratchbox

To run your own application inside Scratchbox, enter the following command:

[sbox-HARMATTAN_X86: ~] > meego-run <your application name>

Using Scratchbox

Switching between targets

To switch from one target to another, enter the following command:

sb-conf se <target name>

Resetting target rootstrap

To clear the rootstrap content from your current Scratchbox target, enter the following command:

sb-conf re -f

Installing a new rootstrap


Target rootstrap reset

To install a new rootstrap, enter the following command:

sb-conf in <rootstrap name>

Killing all trailing processes

To kill all trailing processes inside your target, enter the following command:

sb-conf killall

Showing your target configuration

To display your current target configuration, enter the following command:

sb-conf sh

Viewing all available commands and options

To view the complete list of commands and options available, enter the following command:

[sbox-HARMATTAN_X86: ~] > sb-conf -h   

Usage: sb-conf <ACTION> [<OPTIONS>]

     ACTION  OPTIONS                  ACTION  OPTIONS
     ------  -------                  ------  -------

      setup  [<TARGET>]                   st  [<TARGET>]
             [--compiler=<COMPILER>]          [-c <COMPILER>]
             [--devkits=<LIST>]               [-d <LIST]
             [--cputransp=<METHOD>]           [-t <METHOD]
             [--force]                        [-f]

    install  [<TARGET>]                   in  [<TARGET>]
             [--clibrary]                     [-c]
             [--cruntime]                     [-C]
             [--etc]                          [-e]
             [--devkits]                      [-d]
             [--fakeroot]                     [-F]
             [--gdb]                          [-G]
             [--debug-links]                  [-L]
             [--strace]                       [-S]

  rootstrap  [<TARGET>]                   rs  [<TARGET>]
             <FILE>|<URL>                     <FILE>|<URL>

     select  [<TARGET>]                   se  [<TARGET>]

      reset  [<TARGET>]                   re  [<TARGET>]
             [--force]                        [-f]

    killall  [--signal=<SIGNAL>]          ka  [-s <SIGNAL>]

     remove  [<TARGET>]                   rm  [<TARGET>]
             [--force]                        [-f]

       show  [<TARGET>]                   sh  [<TARGET>]
             [--compiler]                     [-c]
             [--compiler-arch]                [-A]
             [--compiler-subarch]             [-S]
             [--compiler-clib]                [-C]
             [--devkits]                      [-d]
             [--cputransp]                    [-t]

       list  [--compilers]                ls  [-c]
             [--devkits]                      [-d]
             [--cputransps]                   [-t]
             [--targets]                      [-T]
             [--sessions]                     [-S]

    current                               cu

    version                               ve

See 'sb-menu' for interactive versions of these actions.
[sbox-HARMATTAN_X86: ~] > 

Starting the dialog-based interface for sb-conf

The sb-menu command provides a dialog-based interface to configure and modify your Scratchbox targets. To start the interface, enter the following command:


Creating additional Harmattan targets manually

To create additional targets for Harmattan:

1. Create additional x86 and ARMEL targets for Harmattan from any Scratchbox target (in this example, HARMATTAN_X86 target is used). Enter the following command:

[sbox-HARMATTAN_X86: ~] > sb-conf st test_armel -c cs2009q3-eglibc2.10-armv7-hard -d qemu:perl:debian-squeeze:hashutils-squeeze-sdk -t qemu-arm-sb
[sbox-HARMATTAN_X86: ~] > sb-conf st test_x86 -c cs2009q3-eglibc2.10-i486 -d perl:debian-squeeze:hashutils-squeeze-sdk -t none

2. Install the available development rootstraps to the newly created targets.

  • For test_armel, enter the following commands:
[sbox-HARMATTAN_X86: ~] > sb-conf se test_armel
[sbox-test_armel: ~] > sb-conf rs <rootstrap for ARMEL target>.tgz
[sbox-test_armel: ~] > sb-conf in -edFL
  • For test_x86, enter the following commands:
[sbox-test_armel: ~] > sb-conf se test_x86
[sbox-test_x86: ~] > sb-conf rs <rootstrap for X86 target>.tgz
[sbox-test_x86: ~] > sb-conf in -edFL