Back to Index

Maemo for mobile developers

Preparing your development environment

Table of contents

  1. Overview of the maemo development environment
  2. Creating, editing, and manipulating files inside Scratchbox
  3. Updating and installing development packages

Overview of the maemo development environment

As usual, there are some tools and SDKs which help the development tasks for maemo. This section introduces these facilities and describes how to install and use them.

Scratchbox toolkit

As described in other sections, Scratchbox is a cross-compilation toolkit designed to make the development of embedded Linux applications easier. It provides a set of tools to integrate and cross-compile an entire Linux distribution. Scratchbox itself does not provide a graphical user interface for development but a simple command line for writing, debugging, and executing maemo applications.

Xephyr X server

Xephyr provides a graphical user interface where the device screen can be emulated. Using this tool, there is no need to copy the application to the device to see how it will appear. This tool is needed to launch the application framework and execute GUI applications.

Creating, editing, and manipulating files inside Scratchbox

In order to easily create or edit a file, use the following command from the text editor available in the SDK:

  1. [sbox-SDK_X86: ~] > nano filename

    The Nano text editor opens and you can enter text just as in, for example, Notepad.

  2. To save the file you just created, press CTRL+O , then give the filename you want, and press Enter.
  3. To exit the editor, press CTRL+X.
See Nano text editor for more information.

Setting up the maemo SDK on Microsoft Windows

If you are working on a machine with the Microsoft Windows Operating System, you have to emulate a Linux environment to be able to work with the maemo SDK. Setting up the SDK environment is described below.

The hardware and software requirements are as follows:

Setting up VMWare Appliance

To emulate a Linux environment you need to setup the VMWare player, which is a virtual machine emulator where you will install and run the Maemo SDK environment.

To setup an up-to-date vmware image:

  1. Download and install the latest version of the Windows OS-related VMware player.

  2. Once you have installed the Virtual Machine program, go to Maemo SDK VMware Appliance and download the maemo-sdk-vmware (part 1) and the maemo-sdk-vmware (part 2) packages and store them in the same folder.

  3. To decompress and install the SDK package:

  4. Install the decompressed SDK package:
    • Go to Start > Programs > VMWare> VMWare Player.
    • Click Open, navigate to the directory where the VMWare SDK package is, and choose the *.vmx file.
    • Click OK to launch the Linux environment containing the maemo Software Development Toolkit environment.
    • Log in (username/password): maemo/maemo
  5. Once the Virtual Machine starts up, you should see the following desktop environment on your screen:
  6. Double click the README.html file on the desktop and read it for instructions on using the SDK environment.
  7. Double click the Maemo Scratchbox icon to start application development setup. The following windows will open:
    • Terminal with the SDK running inside the Scratchbox environment:SDKTerminal
    • The Xephyr X server:SDKXephyr
  8. Now you can proceed to the section Updating and installing development packages.

Setting up the maemo SDK on a Linux machine

Hardware and software requirements:

  1. Install and setup the maemo 4.0 development environment on your computer according to the steps described in Section "2.1 Installing Scratchbox using the new installer script" and Chapter "3. Installing Maemo 4.0 Beta SDK" in the INSTALL.txt file.

  2. To run the maemo graphical environment you need an X server where to start it. The recommended server is Xephyr, but there are also other options. The X server is meant to be installed/run outside Scratchbox.

    Use the following parameters to start Xephyr outside Scratchbox:

    $ Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac
  3. After you have successfully installed Scratchbox, the SDK targets, and Xephyr on your machine, log in to your environment with the following command:
    $ /scratchbox/login

    or simply

    $ scratchbox

    Now the prompted command line command is:

    [sbox-SDK_X86: ~] >

    This means that you are logged in to Scratchbox.

  4. Once you have logged in and if you started Xephyr or another graphical window using display 2, as instructed earlier, set the DISPLAY variable inside Scratchbox to direct graphical applications to display 2.

    [sbox-SDK_X86: ~] > export DISPLAY=:2 
  5. You can also set the variable every time you log in to Scratchbox with this command (only once):
    [sbox-SDK_X86: ~] > echo "export DISPLAY=:2" >> ~/.bashrc

Updating and installing development packages

Now that you have installed the maemo environment, ensure that your system is up to date and it gets the updated packages from the correct place.

To get the most recent C++ development packages, ensure that your system is using the correct packages repository. Log in to Scratchbox and do as follows:

  1. Type the following command on the Scratchbox command line prompt and press Enter:
    [sbox-SDK_X86: ~] > fakeroot nano /etc/apt/sources.list 
  2. Inside the Nano editor, enter the following lines and save the file:
    For Linux and Windows repositories:
    deb diablo free non-free
    deb-src diablo free
    deb diablo free
    deb-src diablo free
  3. If you are connected to the Internet with a proxy, you need to export the variable HTTP_PROXY as follows:
    [sbox-SDK_X86: ~] > export http_proxy="http://address:port"
  4. You can also set this variable every time you enter Scratchbox with this command (only once):
    [sbox-SDK_X86: ~] > echo "export http_proxy="http://address:port" >> ~/.bashrc
  5. Type the following command to update the package list:
    [sbox-SDK_X86: ~] > fakeroot apt-get update
  6. Type the following commands to upgrade the distribution packages and install the application framework:
    [sbox-SDK_X86: ~] > fakeroot apt-get -y upgrade
    [sbox-SDK_X86: ~] > fakeroot apt-get -y install hildon-application-framework hildon-application-framework-dev
  7. Press Enter on all remaining prompts and wait until the packages are upgraded.
  8. To be able to compile and execute C++ applications on maemo, type the following command to install the C++ bindings:
    [sbox-SDK_X86: ~] > fakeroot apt-get install -y libhildonmm-dev libhildon-fmmm-dev
  9. Now you can start the maemo GUI in the Xephyr window with the command:
    [sbox-SDK_X86: ~] > start
    and the following user interface will appear on Xephyr:
  10. If you want to exit the GUI, run:
    [sbox-SDK_X86: ~] > stop

Now you are ready to start developing your C++ GUI application.

Creating, building, and running a "Hello World" application