3. Development Environment

3.1 Introduction

The following code examples are used in this chapter:

The development environment for maemo running on the desktop is called maemo SDK[72]. It will only install and run on a Linux operating system. Supported Linux distributions for maemo SDK are currently Debian and Ubuntu, but installing maemo SDK is also possible for other distributions. On other operating systems such as Windows, a VMWare image[74] can be used to provide a working Linux environment.

3.2 Maemo Software Development Kit

The maemo SDK creates a sandboxed maemo development environment on a GNU/Linux desktop system largely built on a tool called Scratchbox[90]. In most ways, this environment behaves like the operating system on the device, but with added development tools. This means that the development process is very similar to a normal desktop GNU/Linux, and the kinks of embedded development, such as cross-compiling, are handled transparently by Scratchbox.






Scratchbox is licensed under the GPL and it is open for outside contributions. For an in-depth coverage on Scratchbox capabilities please see [90].


Hardware architectures

Maemo SDK supports two architectures and has an environment for them both. x86 is used for native performance and better tool support through native execution without the need for emulation. ARMEL is used for working with the actual device's architecture. Both have their advantages and roles in maemo development. It is important to understand that maemo SDK actually provides these two environments as preconfigured targets inside a working Scratchbox installation. This is explained in detail later.

Generally the x86 environment is used in active development, because it provides practically the same performance as normal GNU/Linux applications. Also, although the underlying architecture is different from the actual device, programs usually behave exactly as they would, when compiled and run on ARMEL. As stated before, many tools are available only for the x86 environment.

Working means that application also functions properly and not just run, the next step is to compile it for the ARMEL architecture. The process for compilation and packaging is exactly the same as in x86, albeit a bit slower, because some of the required software is emulated. The developer needs not to concern themselves with cross-compilation. This is the main reason maemo SDK use Scratchbox in the first place.

The applications compiled in ARMEL environment can be run straight on the device. Additionally, it is possible to run some of the applications inside the ARMEL environment in maemo SDK. This is possible, because of the automatic emulation maemo SDK provides. The emulation is not complete, and things like multithreading will cause problems, so actual testing must be performed on the device.

Using emulation for the whole development process may not sound ideal because of the effect on performance. That is why even when in ARMEL environment, native performance is achieved with Scratchbox by internally using the host computer's tools without emulation, when possible. For example, compilation on ARMEL environment is actually performed by an x86-ARMEL cross-compiler, but Scratchbox hides the details so that the developer can execute GCC like on any GNU/Linux system.

Scratchbox In-Depth










More Scratchbox information can be found at Scratchbox's web site[90].

Development on Maemo SDK

The maemo SDK provides all of its development tools inside Scratchbox. Also the Hildon Desktop is started with a single command af-sb-init start inside Scratchbox. However, the Hildon Desktop needs a secondary X server of proper size and bitdepth to be displayed on.

As an exception to the rule, the X server such as Xephyr[105] must be started on the host Linux environment, instead of being started inside Scratchbox. The use of Xephyr is described in section 3.4.

Development Tools on Scratchbox

As the Scratchbox environment is practically a full GNU/Linux system, it includes the standard GNU/Linux development tools. Debugging is performed with tools like GDB[24], valgrind[99], ltrace and strace[93]. Performance profiling can be performed with tools like htop[50], oprofile[82] and time, and compiling with the GCC toolchain. Some of these tools offer graphical user interfaces, which can also be used. Naturally, this is not a comprehensive list of the tools, and if the tools shipped with the SDK do not suit to needs or personal preferences, most utilities can be easily run practically unchanged in Scratchbox.

Chapter Application Development of Maemo Diablo Reference Manual gives good introductions to development using Scratchbox, and the debugging tools are described in depth in chapter Debugging14.

Testing and Debugging on Device

Even though Scratchbox is quite accurate in emulating a full target environment on the device, it isn't 100% identical. Especially applications that make use of the device's special hardware can behave differently on the device than on Scratchbox. They even may not work at all. Fortunately, testing the software on device is quite straightforward using either SSH or a tool called sbrsh to run target binaries on the device transparently from Scratchbox.

The CPU Transparency section 3.6 has instructions for getting started with sbrsh. SSH server and client for maemo can be downloaded from maemo web site[65].

Other Programming Languages

Currently C is the only official programming language for maemo. But thanks to the community, unofficial support exist for several other languages. To name a few, the SDK itself compiles C++, and by adding hildonmm bindings[45], Hildon applications can be created the C++ way. Python scripting language also has a good support in form of pymaemo[86], and Ruby bindings are in the works[71], not to forget Mono[78]. For Java support, JaliMo[52] is an interesting project to track.

3.3 Installing SDK

3.3.1 Prerequisites

Before continuing, the installation instructions of the maemo SDK should be reviewed.


user@system:~$ lsmod | grep binfmt
binfmt_misc 12936 0





To install Xephyr to Debian based Linux:

3.3.2 Automatic Install of Scratchbox

Up-to-date installation instructions can be found from [72] with instructions for each maemo SDK release.

The preferred way to install the Scratchbox is to use the automated installation script. Manual installation of the Scratchbox is described here for educational purposes, and for situations where the automatic installation script fails.

Quick installation of Scratchbox on a Debian system with the automated install-script:

user@system:~$ sudo sh ./maemo-scratchbox-install_X.X.sh -u user

The -u user option is used, so that Scratchbox will add the user account "user" automatically into the group that is allowed to use Scratchbox.

3.3.3 Manual Install of Scratchbox

Scratchbox can also be installed manually. The Debian packages (for the real Linux system) are located at [91]. Apophis is the release of Scratchbox that is suited to be used with maemo 4.x SDK. Please refer to the Scratchbox documentation for further instructions [92].

3.3.4 Automatic Install of Maemo SDK

Up-to-date installation instructions can be found from [72], with instructions for each maemo SDK Release.

The preferred way to install the the maemo SDK is to use the automated installation script. In some cases, using a manual process is more suitable; this is covered later. Installing the SDK in an offline environment is officially unsupported, but possible as well.

Quick installation with automated install-script:

user@system:~$ sh maemo-sdk-install_X.X.sh

Running this script will display the end user license agreement. Pressing Enter key to accept the license presents you with package selection dialog.

Image auto-maemo-package-selection

You are presented with four options for installing SDK:

  1. Minimal Rootstrap only. Choose this only if you are going to install all packages you need from repository.
  2. Runtime Environment. Use this to install and run software inside Scratchbox. Cannot be used for building software.
  3. Runtime Environment + All Dev Packages. Choose this to get a full development environment.
  4. Runtime Environment + All Dev and Dbg Packages. You will get a full development environment plus debug symbols for many system components.

By default, option 3 is selected.

N.B.: The SDK installer will always download and install the minimal rootstrap, but will install additional packages using apt-get based on your choice.

In the next dialog, you can choose to install closed Nokia binaries or not.

Image auto-maemo-install-nokia-binaries

Selecting 'yes' will run the Nokia binaries installer script which will display the EUSA(End User Software Agreement). If you accept the agreement, the installer script will extract the Nokia binaries into a folder under the user's home directory inside scratchbox. It will also configure the /etc/apt/sources.list file in the scratchbox targets to make this 'local repository' visible to the Debian apt tools.

In the next dialog, a summary of your selections so far and the default settings are listed.

Image auto-maemo-summary

Selecting 'Continue' will initiate the SDK installation process. If the selection summary is not OK, you can cancel the process and re-start the SDK installation script.

After it's successful execution, you will have 2 scratchbox targets ready for use:

The Nokia binaries are not installed by default but just made available. If you wish to install all of them , then execute the following command inside the scratchbox targets:

[sbox-DIABLO_<target>: ~] > fakeroot apt-get install maemo-explicit

N.B. The installer script by default will prompt the user to install the Nokia binaries, which are not open source. To disable this feature, please use -f command line parameter for the script. For more options, use the command line help option.

user@system:~$ sh maemo-sdk-install_X.X.sh --help

3.3.5 Manual Install of Maemo SDK

In order to install the maemo SDK manually, the first step is to download the necessary rootstrap files. There will be two: one for the X86 target, and the other one for the ARM target.

The rootstrap files are available in the same location as the automatic install scripts (for maemo 4.1 SDK they can be found at [61]).

It is necessary to download the minimal rootstraps for i386 and arm, so the filenames will be as follows:

For other versions of the SDK, the exact path names above will need to be adjusted (please consult the SDK installation instructions).

Do not extract the downloaded files. They have to be moved under a location where Scratchbox setup tools can find them (/scratchbox/packages/):

user@system:~$ sudo mv /tmp/download-location/maemo-sdk-rootstrap*  \

You are now ready to setup your first sbox target. Scratchbox comes with a simple menu-driven tool (sb-menu), which can be used for this. The other option would be using a command line driver tool (sb-conf), but using the menu driver tool is easier.

The first step is to log in on the Scratchbox environment:

user@system:~$ /scratchbox/login

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-: ~] >

By default, Scratchbox will activate the same target that was used previously, but since this is the first time Scratchbox is used, there is no target to activate. One can be built with sb-menu:

  1. Type sb-menu inside Scratchbox to launch the tool.

    [sbox-: ~] > sb-menu

  2. Select "Setup" in order to create a new target.

    Normally the tool would display all configured targets in a list, but since there are none, the dialog is empty. Select "NEW" in order to create a new target.

  3. Using the same names as the automatic install script uses allows you to use the Nokia binaries installer later. Type DIABLO_X86 as the target name.
  4. Since the first target will be for X86 environment, select the i386 compiler version (cs2005q3.2-glibc2.5-i386).
  5. Next, you will need to select all the devkit packages that you want to enable for the new target. You will need debian-etch, maemo3-tools and perl. Do not select cputransp for the X86 target. Select each of them in a row and then press "DONE".
  6. Since the cputransp devkit was not selected in the previous step, selecting the CPU transparency becomes "none".
  7. This concludes the target-specific tool choices, but there are still things to do. The next step is to select a rootstrap package to extract into the target (select "Yes").
  8. And since the rootstraps were already downloaded and copied to the proper location, select "File".
  9. Using TAB arrows, navigate to the proper rootstrap file (the one that ends with i386), and select it by pressing space and then press ENTER to go forward.
  10. Unpacking the rootstrap will not take long, and soon after that, a dialog will come up with a question about files installation. Select "Yes" (even if it is not entirely obvious what the question means), and then select the C-library, /etc, Devkits and fakeroot. Other tools can be installed later from the maemo SDK repository (or local mirror of the repository).
  11. After extracting the selected files from the rootstrap, the target is now ready. You should next opt to select the target (so that it becomes active and will be default target from now on).

    Selecting the target will restart the Scratchbox session and if everything went well, you are now left with a very minimal maemo SDK environment:

    Shell restarting...
    [sbox-DIABLO_X86: ~] > arch
    [sbox-DIABLO_X86: ~] > dpkg -l | grep maemo-repository
    ii  maemo-repository       4.1-1               Configuration for maemo repository.

  12. In order to complete the SDK installation, you will have to fetch the package list and then install the maemo-sdk-dev meta-package. The package depends on a lot of other packages, and all of them will be downloaded into the target. The number of packages is quite significant, so reserve some time for this step. This step will require a working Internet connection (or DNS redirection into a local copy of the repository).

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

    [sbox-DIABLO_X86: ~] > fakeroot apt-get install maemo-sdk-dev

    Using fakeroot is important in the above command so that the package install scripts think that they are running as the root user. Otherwise the installation phase will fail with errors. Modern Debian-style repositories are signed with GPG keys in order to prevent tampering with the repository contents. The maemo repositories, however, do not use this convention, and this makes apt-get slightly conserned. This can be ignored by accepting installation of unverified packages.

  13. The closed Nokia binaries can be obtained by running the script maemo-sdk-nokia-binaries_X.X.sh. If you choose to accept the EUSA, then proceed to the following step.
  14. You can install all the nokia binaries in your targets by installing the meta package 'maemo-explicit'.

After apt-get finishes installing all the packages, the SDK installation is ready.

When you are finished with sbox, you need to logout. This is done by terminating the command shell with the exit command, or by using logout.

3.3.6 Manual Install of ARMEL Target

If the X86 target was installed manually (above), it is advisable to create the ARMEL target to enable building software for the Internet Tablets. This step can also be postponed until the need to perform cross-building for Internet Tablets arises.

If the automatic install process was used, the ARMEL target is already available (as DIABLO_ARMEL), and the following steps are not necessary.

Creating the ARMEL target requires creating a new target in Scratchbox, using the same steps that were taken for the X86 target.

Here is how the ARMEL target install process differs from the X86 (described above):

The apt-get command remains exactly the same, as do all of the other steps.

You may wish to verify the target by using the steps below (see section 3.4.1), at least build the hello world program and verify the architecture of the resulting executable with file command.

3.4 Testing SDK Installation

3.4.1 Testing Scratchbox


 * helloworld.c
 * directory as this file.
 * test our toolchains.

#include <stdio.h> /* printf */

/* main implementation */
int main(int argc, char** argv) {

  printf("Hello world\n");

     Exit code 0 means success to whoever executed this program. It
     is routinely used inside scripts to test whether running some
     program succeeded or not. Other exit codes mean failure. Each
     program is free to use different non-zero codes to signify
     different kinds of failures. These are normally listed in the
  return 0;


[sbox-DIABLO_X86: ~] > pwd


[sbox-DIABLO_X86: ~] > nano helloworld.c


[sbox-DIABLO_X86: ~] > gcc -Wall -g helloworld.c -o helloworld
[sbox-DIABLO_X86: ~] > ls -F hello* 
helloworld* helloworld.c



[sbox-DIABLO_X86: ~] > ./helloworld
Hello world

Running the binary should not produce any surprises.

[sbox-DIABLO_X86: ~] > file helloworld


[sbox-DIABLO_X86: ~] > ldd helloworld
   linux-gate.so.1 =>  (0xffffe000)
   libc.so.6 => /lib/libc.so.6 (0xb7e9f000)
   /lib/ld-linux.so.2 (0xb7fd2000)
[sbox-DIABLO_X86: ~] > ls -l /lib/libc.so.6
lrwxrwxrwx  1 user user 11 Nov 12 15:52 /lib/libc.so.6 -> libc-2.5.so
[sbox-DIABLO_X86: ~] > ls -l /lib/libc-2.5.so
-rwxr-xr-x  1 user user 1213256 Sep  7 13:28 /lib/libc-2.5.so








And as a final note, also emacs can be used.

Here is how to do it:

3.4.2 Writing GUI Hello World

 * gtk_helloworld-1.c
 * directory as this file.

#include <stdlib.h> /* EXIT_* */
#include <gtk/gtk.h>

int main(int argc, char** argv) {

  GtkWindow* window;
  GtkLabel* label;

  /* Initialize the GTK+ library. */
  gtk_init(&argc, &argv);

     title text. */
  window = g_object_new(GTK_TYPE_WINDOW,
    "border-width", 12,
    "title", "Hello GTK+",

  /* Create the label widget. */
  label = g_object_new(GTK_TYPE_LABEL,
    "label", "Hello World!",

  /* Pack the label into the window layout. */


  /* Start the main event loop. */
  g_print("main: calling gtk_main\n");


  return EXIT_SUCCESS;

Build your program:

[sbox-DIABLO_X86: ~] > gcc -Wall -g gtk_helloworld-1.c -o gtk_helloworld-1
gtk_helloworld-1.c: In function `main':



[sbox-DIABLO_X86: ~] > pkg-config --list-all | sort
.. listing cut to include only relevant libraries ..
gconf-2.0      gconf - GNOME Config System.
gdk-2.0        GDK - GIMP Drawing Kit (x11 target)
gdk-pixbuf-2.0 GdkPixbuf - Image loading and scaling
glib-2.0       GLib - C Utility Library
hildon-1       hildon - Hildon widgets library
pango          Pango - Internationalized text handling
x11            X11 - X Library


[sbox-DIABLO_X86: ~] > pkg-config --modversion gtk+-2.0

[sbox-DIABLO_X86: ~] > pkg-config --cflags gtk+-2.0


[sbox-DIABLO_X86: ~] > pkg-config --libs gtk+-2.0
-ldl -lglib-2.0



 undefined reference to `gtk_init'
collect2: ld returned 1 exit status





 `pkg-config --libs gtk+-2.0`
[sbox-DIABLO_X86: ~] >



[sbox-DIABLO_X86: ~] > ls -l gtk_helloworld-1
[sbox-DIABLO_X86: ~] > file gtk_helloworld-1
[sbox-DIABLO_X86: ~] > ldd gtk_helloworld-1
  linux-gate.so.1 =>  (0xffffe000)
  libm.so.6 => /lib/libm.so.6 (0xb7b71000)
  libcairo.so.2 => /usr/lib/libcairo.so.2 (0xb7ab5000)
  libdl.so.2 => /lib/libdl.so.2 (0xb7a71000)
  libc.so.6 => /lib/libc.so.6 (0xb78b2000)
  libX11.so.6 => /usr/lib/libX11.so.6 (0xb77bd000)
  libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb77b8000)
  libXtst.so.6 => /usr/lib/libXtst.so.6 (0xb77b3000)
  libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb7788000)
  libXext.so.6 => /usr/lib/libXext.so.6 (0xb777a000)
  libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb7771000)
  libXi.so.6 => /usr/lib/libXi.so.6 (0xb7769000)
  libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0xb7762000)
  libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0xb7759000)
  /lib/ld-linux.so.2 (0xb7fc3000)
  libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb76c6000)
  libz.so.1 => /usr/lib/libz.so.1 (0xb76b7000)
  libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb7692000)
  libXau.so.6 => /usr/lib/libXau.so.6 (0xb768f000)
  libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb7689000)
  libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb7669000)





3.4.3 Running GUI Hello World


[sbox-DIABLO_X86: ~] > ./gtk_helloworld-1
[sbox-DIABLO_X86: ~] > echo $DISPLAY



3.4.4 Starting Virtual X Server (Xephyr)


Start up the server with:

 -extension Composite








3.4.5 Directing Client to Virtual Server



[sbox-DIABLO_X86: ~] > export DISPLAY=:2
main: calling gtk_main




3.4.6 Starting Application Framework


To start the Application Framework (referred to as AF from now on), it is possible to use a handy script that comes with the SDK:

[sbox-DIABLO_X86: ~] > af-sb-init.sh start
Sample files present.
Starting DBUS system bus
Starting D-BUS session bus daemon
Starting Maemo Launcher: maemo-launcher
maemo-launcher: error rising the oom shield for pid=4847 status=5632.
Starting Sapwood image server
Starting Matchbox window manager
sapwood-server[4858]: GLIB INFO default - server started
Starting clipboard-manager
Starting Keyboard
maemo-launcher: invoking '/usr/bin/hildon-input-method.launch'
Starting Hildon Desktop
maemo-launcher: invoking '/usr/bin/hildon-desktop.launch'
.. listing cut for brevity ..
[sbox-DIABLO_X86: ~] >


Image af_startup

3.4.7 Running Hello World in Application Framework

While AF is running, the Hello World can be started again (./gtk_helloworld-1 in sbox):

Image xephyr_af_and_gtk_helloworld


Next step shows how to use an SDK utility script called run-standalone.sh. Its job is to set up correct environmental variables for themes and communication for the command that is given to it as its command line parameter.

Use run-standalone.sh ./gtk_helloworld-1 to start your X client again:

Image xephyr_af_and_gtk_helloworld_runstandalone


3.5 Setting up USB Networking

3.5.1 Introduction

This section describes how USB networking can be set up between the host Linux machine and Internet Tablet.

USB networking connects the device and Linux laptop with IP protocol over the USB cable. This provides fast and effortless access to the device and enables e.g. file copying, remote login over SSH, using of NFS and remote debugging.

3.5.2 Setting up Environment and Device

In order to use USB networking on the device, some extra packages must be installed, such as openssh.

Linux host side instructions are for Debian and its derivatives, and might not work on other distributions.

A root shell access on the device is needed for setting up the USB networking on the device side. For this, xterm has to be started. There is a script for root access that should be run on terminal.

$ sudo gainroot

When using USB networking, device must be booted from flash, meaning that MMC dualboot is an unavailable option. The reason for this is that the device can only act as either a mass storage or network device at any given time.

Check whether the device has been preconfigured for USB networking with IP If not, please add the following lines to your /etc/network/interfaces:

auto usb0
iface usb0 inet static

The IP address of the host machine in the USB network has to be for the usb0 interface.

The following steps should prepare the device and host machine for USB networking:

  1. Make sure the USB cable is disconnected.
  2. Gain root shell access on the device, and perform the following:

    # insmod /mnt/initfs/lib/modules/2.6.21-omap1/g_ether.ko
    # ifup usb0

    N.B. You may need to run insmod twice.
  3. Make sure the kernel of the host machine has usbnet enabled.
  4. Add the following entry to the /etc/network/interfaces file of the host machine:

          mapping hotplug
                  script grep
                  map usb0
          auto usb0
          iface usb0 inet static
          up iptables -t nat -A POSTROUTING -o eth0 -s -j MASQUERADE
          down iptables -t nat -D POSTROUTING -o eth0 -s -j MASQUERADE

  5. Now both the device and the host machine should be ready for initiating a USB connection

3.5.3 Testing Connection

After making the preparations, the USB network should automatically be set up when connecting the device to the host machine with a USB cable.

For basic testing, pinging can be performed from the host machine.

$ ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=245 time=79.8 ms

Use Application Manager to install openssh from Diablo extras. Now, an ssh root shell over the USB network from host to tablet can be initiated.

$ ssh root@

The password of the root is rootme.

3.6 CPU Transparency

This document provides instructions for setting up sbrsh CPU transparency for the Scratchbox ARMEL target. N.B. The use of sbrsh is insecure. It should only be run on trusted networks.

Prerequisites for setting up CPU transparency are as follows:

  1. Scratchbox installed by maemo Scratchbox installer
  2. Scratchbox ARMEL target installed by maemo SDK installer with sbrsh set as the CPU transparency method.
  3. NFS support compiled and transferred onto the device. For instructions on how to do this, see 11.
  4. Networking set-up using static IP addresses on the device, and on the host Linux PC computer, as described in section 3.5.

3.6.1 Setting up Host Linux PC Environment

To set up the host environment, the following commands have to be run with root access.

  1. Install NFS kernel server in the Linux PC. In Debian, this is provided by the package nfs-kernel-server. Fetch the required software by running the command:

    $ apt-get install nfs-kernel-server
  2. Edit the /etc/exports file in the Linux PC. This file lists the NFS file systems that will be exported to the device. Add the following line (replace sbox_username, sbox_user_uid and sbox_user_gid with correct values, i.e. use your own user names and IDs):


    Make sure that the user IDs used in the /etc/exports file in Linux PC match the user IDs that are effective inside the Scratchbox.

  3. Restart NFS kernel server to apply new exports:

    * Stopping NFS kernel daemon...                         [ ok ]
    * Starting NFS kernel daemon:                           [ ok ]
    root@host:~ #

Now the Linux PC host system should be set up.

3.6.2 Setting up Scratchbox ARMEL Target

Now the ARMEL target needs to be set up inside Scratchbox. To do this, first start Scratchbox and change to the ARMEL target, if necessary.

Edit the ~/.sbrsh in the home directory of the Scratchbox user, adding the following lines, replacing <username> and <target_name> with real names using the Scratchbox:

nfs<username>/targets/<target_name>  / rw,nolock,noac
bind    /dev          /dev
bind    /dev/pts      /dev/pts
bind    /proc         /proc
bind    /tmp          /tmp

If you are using the sb-menu command in Scratchbox, configuring the sbrshd settings with the tool, make sure that you do not use the term localhost, but instead the full IP address of your Linux PC.

N.B. If the network connection between the Tablet and Linux PC breaks, and the Scratchbox is trying to push the required configurations to the device, it will not give any warning of failure. Check always from the device that the configurations are in order. In a later section, there are instructions to set up device configuration manually. It can also be used for checking purposes.

With these changes, the _ARMEL target should be set up accordingly.

3.6.3 Setting up Device for CPU Transparency

  1. Copy sbrshd and its init-script onto the device using a memory card or scp. These can be found under /scratchbox/device_tools/sbrsh-7.4/cs2005q3.2-glibc2.5-arm, in the current stable release of Scratchbox. N.B. The initscript searches binary from /usr/sbin by default, and quietly exits if not found there.
  2. Edit /etc/sbrshd.conf and add entry for the desktop PC: *

    N.B. There are additional configurable options for sbrshd, and these are covered in the Scratchbox documentation.

  3. Make sure NFS modules are loaded into the device's kernel.
  4. Start sbrshd

    # /etc/init.d/sbrshd start

The sbrshd daemon should now be up and running, ready to accept host PC connections for CPU transparency.

3.6.4 Testing CPU Transparency

Now the CPU transparency should be set up. To test it, log into Scratchbox and change to the ARMEL target.

After this, extract the hello-world.tar.gz package and go the hello-world directory. Run ./autogen.sh and make, followed by ./hello. This should print the text hello world on the console.

[sbox-ARMEL: ~] > cd hello-world
[sbox-ARMEL: ~/hello-world] > ./autogen.sh
+ aclocal
[... output from aclocal ...]
+ autoconf
+ autoheader
+ automake --add-missing --foreign
[... output from automake ...]
+ ./configure
make  all-am
gcc  -g -O2   -o hello  main.o
Hello World!
[sbox-ARMEL: ~/hello-world] >

The program is run transparently on the device. It can be verified by the log written to /tmp/cputransp_username.log



[sbox-ARMEL: ~/hello-world] >


3.7 Using Linux Flasher Tool

This section describes how to use the Linux flasher tool, and how to flash a rootfs to the Internet Tablet device.

The flasher is a command line tool that can be used to flash items to the Nokia Internet Tablet. The utility can be downloaded from this location. N.B. Attention should be paid to selecting the correct flasher for the product in question, as different Internet Tablet products may require a specific flasher tool.

The flasher tool should be saved to the directory that is to be used as the working directory. After saving the tool, the file should be changed with chmod to be executable.

        $ chmod +x flasher

To run the flasher, root-user rights are needed. As a root user, type:

        $ ./flasher

This command will display the following information on how to use the flasher:

                Usage: flasher [OPTIONS]
                --fiasco, -F                  Location of a FIASCO image
                --kernel, -k                  Location of kernel image
                --initfs, -n                  Location of initfs image
                --rootfs, -r                  Location of root JFFS2 image
                --xloader, -x                 Location of X-Loader image
                --secondary, -s               Location of NOLO secondary bootloader image
                --2nd, -2                     Location of NOLO cold flasher ("2nd") image
                --unpack, -u [arg]            Unpack a FIASCO image
                --flash, -f                   Load and flash all supplied images
                --load, -l                    Only load all supplied images
                --boot, -b [arg]              Boot the kernel with optional cmdline
                --reboot, -R                  Reboot the board (e.g. after flashing NOLO)
                --read-board-id, -i           Print out the board type
                --serial-port, -S             Serial port used for cold flashing
                --initialize-port, -I         Only initialize the serial port
                --cold-flash, -c              "Cold flash" the device
                --enable-rd-mode              Enable R&D mode on the device
                --disable-rd-mode             Disable R&D mode on the device
                --set-rd-flags [arg]          Set R&D mode flags on the device
                --clear-rd-flags [arg]        Clear R&D mode flags on the device
                --query-rd-mode               Query the device R&D mode status and flags
                --set-root-device             Set the default root device
                --query-root-device           Query the default root device
                --enable-usb-host-mode        Set the device into USB host mode
                --disable-usb-host-mode       Set the device into USB peripheral mode
                --flash-only                  Flash only certain components

This shows all the necessary parameters and information that are enabled for use in the flasher.

To try out the flasher, first retrieve a flash image for your specific product. For example, software for N800 is available in tablets-dev.nokia.com.

Save the image to the same directory where the flasher tool is located, and complete the following steps:

After these steps, the device is ready to receive the root file system. Enter the following command (N.B. You must be the root user or use the sudo command):

        $ ./flasher -F RX-XX_20XXSE_X.20XX.XX-X_PR_COMBINED_MR0_ARM.bin -f -R

After this command, turn on the device, and the flashing will start.

If everything goes well, a progress bar should appear at the bottom of the device screen.

The command above will flash the new image to the device. When the flashing is complete, the device will reboot.

sponsored by Nokia Corporation