[How to] Set Up Maemo 5/N900 Dev Environment on Windows [x32]

I’ve been learning to write applications for a number of mobile platforms, one of them being Nokia’s N900 smartphone. To that end I was trying to setup the Maemo 5 SDK, but it’s taken me more than a week to do so. Let’s see why, and what I did to finally get a Maemo 5 emulator up so that I could test code I wrote for the device, without having to install it on the device itself.

I’ve called the N900 a “smartphone” because that’s what Nokia is calling it but it’s really a UMPC with a phone built-in. The N900 runs the ARM port of Maemo 5 (a.k.a. Fremantle). Maemo 5 is a Debian based operating system, so you’ll be using apt-get to install software onto the device. The N900 even ships with an “X Terminal” app pre-installed. That is probably one of the things that tells you that the phone was built by geeks.


The Maemo 5 SDK is really an emulated environment that allows you to write and compile code for testing. It uses scratchbox as the cross-compilation toolkit. You login to scratchbox, which has emulated environments (targets) for both x86 and ARM setup using a rootstrap (think of it as an operating system installer) for each platform. You write code and test it on the emulated x86 target. You can then compile in the ARM target, and deploy it on the phone for final testing.

The reason for this is that compilation and execution is faster in the x86 target as it uses native compilation tools. Compilation for ARM would be slower.

The documentation points to multiple ways of installing the Maemo SDK.

  1. If you are not using Linux, you are pointed to a VMWare image that has been created for you with all the tools already setup.
  2. If you are using Debian-based installation of Linux, you can setup the SDK in three different ways:
    1. The GUI installer
    2. The automated command-line installer
    3. Manual Installation

Which sounds great until you find out that only one of the above actually works – The manual installation.

I wanted to set this up at work, where I only have Windows PCs. So I jumped for the VMWare image. The link takes you to a page on the nokia.com domain, where you need to accept the EULA before you can see the list of available downloads. Sadly though, for the past few weeks, the vmware image has been missing from this list.

I did find the image on this page at one point, and went ahead and downloaded it. However, there was a problem with the image and it was deleted the next day. For the curious, the problem I saw was that when you ran the emulator, all the apps on the emulated device started up fine, but you could only see their title-bars. The body of the window was blank.

So I had to create my own virtual machine. Below are the instructions on how to do that using VMWare Server on a Windows PC. I prefer to use the old VMWare Server 1.0 release, but the instructions should work the same on new versions and other virtualization software too.

  1. Download the ISO file for the 32-bit x86 version of Ubuntu Server 9.10 Karmic Koala. I would recommend using this specific version since that’s what Maemo’s developers seem to use as their development environment. I’m choosing the server edition to keep the VM light. The desktop edition will also work but will be slower.
  2. Create a VM in VMWare Server, with at least 5GB of hard disk space (I used 10GB). If you don’t allocate all diskspace at the time of creation, the VM will slow down everytime it needs to grow the disk file. This might be acceptable if you are low on disk. I suggest 512MB of RAM though less will probably work for most development needs. I use bridged networking so that the VM has its own identity on the network. The VM will need access to the internet, so make sure you set this up.
  3. Setup the ISO file as the CDROM drive for the newly created VM.
  4. Start the VM, and it will boot from the ISO file
  5. Install Ubuntu onto the VM as a full server install. I don’t recommend using the JeOS/Virtual Server option, as I had some problems with dependencies that probably came from using a kernel optimized for virtual environments.
  6. Towards the end of the installation, choose to use the installation as an “SSH Server”. This will make sure that you can login to the virtual machine using SSH instead of using the VMWare Server Console.
  7. Install an X-Server of your choice. I prefer Cygwin/X. I’ve been using it for years, and I’ve never had a problem with it.
    1. The instructions to install Cygwin/X can be found at this page.
    2. I’ve found it necessary to ensure selection of the following additional packages to get Cygwin/X working optimally: font-adobe-dpi75, font-encodings, fontconfig, xwinwm.
    3. You’ll also need the xhost package.
    4. I like using Cygwin to connect to the virtual machine instead of using additional tools like putty. If you want to do the same, also install the openssh package.
  8. Once all the installation is done, boot into your newly setup VM, and log in using the user you created at installation.

I tried to install Maemo SDK using the automated command-line scripts (which is pretty much the same as the GUI tool). However, this didn’t work for me. So at my third attempt, I created a fresh new VM, and used the manual installation instructions. I’ll be repeating those instructions here with my comments on what worked and what did not.

The first thing we need to do is to install scratchbox. Ubuntu’s universe repositories have version 2 of scratchbox available that can be easily installed, but this doesn’t work well with Maemo 5. There is a Maemo Garage project called Maemo SDK+ that is currently trying to make the SDK compatible with Scratchbox 2. As of now, I don’t recommend using it.

We will install directly from the scratchbox project repository. For this we have to add the scratchbox repository to our apt sources file.

Use the following command to edit the file, or use any editor you’re comfortable with. (Remember, that sudo will ask you for the password of the user currently logged in. Ubuntu doesn’t have the root user by default, and this is a good thing. All root access is by preceding commands with sudo.)

$ sudo vi /etc/apt/sources.list

Add this line to the bottom of the file.

deb http://scratchbox.org/debian/ maemo5-sdk main

If you are behind a firewall, you need to first tell the tools what your proxy is. Use this command:

export http_proxy=http://[username]:[password]@[proxy-host]:[proxy-port]

If your proxy doesn’t authenticate, just use

export http_proxy=http://[proxy-host]:[proxy-port]

Now you’ll need to refresh the apt cache with the newly added repository.

$ sudo apt-get update

Scratchbox doesn’t work when VDSO is enabled. It is enabled in Ubuntu 9.10, so we need to turn it off.

To disable VDSO support in Ubuntu, use this command to edit the sysctl file.

$ sudo vi /etc/sysctl.conf

Add this line to the bottom of the file.

vm.vdso_enabled = 0

To load these changes, run the following command:

sudo sysctl -p

You can now install scratchbox. Run the following command (all on one line). The apt-get tool will download all files and dependencies (there will be around 400MB of them), and install the software.

$ 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

I sometimes got 503 errors while downloading some of the dependencies, but re-running the command allowed it to proceed smoothly.

Now we need to setup the currently logged in user as a scratchbox user. Run the following command.

$ sudo /scratchbox/sbin/sbox_adduser $USER yes

$USER should expand to the name of the user currently logged in. If you have created another user on the VM, and want to set up that user instead, replace $USER with the username of the user you want setup.

Some Nokia applications (which will be running inside the emulator) look for the home directory of the logged in user to be named “user”, like it is on the device. To get around this problem, run the following command

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

where <username> is the username of the currently logged in user. This creates a symbolic link called “/home/user” in scratchbox, which points to the home directory of the user you setup. This means that if you want multiple users setup in scratchbox, they’ll have to replace the symbolic link every time they log in.

At this point, the documentation suggests running the newgrp command to ensure your current session is in the sbox group. Call me superstitious, but I recommend simply logging out of your session and logging back in.

Once you are logged back into the VM, you must login to scratchbox to setup the Maemo SDK. Use the following command

$ /scratchbox/login

This takes you into the scratchbox environment. However this is a brand new environment, and we will need to setup Maemo here. First, we will need to create the two targets (for X86 and ARM). Use these commands.

[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

At each command you will get a message saying that no target is currently selected. This is expected, so ignore it.

Again, if you are behind a firewall, you’ll need to setup your proxy. Use the same command used above.

Now, download the rootstrap files.

[sbox->:~]> wget http://repository.maemo.org/stable/5.0/armel/maemo-sdk-rootstrap_5.0_armel.tgz http://repository.maemo.org/stable/5.0/i386/maemo-sdk-rootstrap_5.0_i386.tgz

Remember, these are the installers of the two targets (emulated operating systems) you just created. Now you need to switch to the X86 target and install the rootstrap.

[sbox->:~]> sb-conf se FREMANTLE_X86
[sbox-FREMANTLE_X86:~]> sb-conf rs maemo-sdk-rootstrap_5.0_i386.tgz
[sbox-FREMANTLE_X86:~]> sb-conf in -edFL
[sbox-FREMANTLE_X86:~]> apt-get update
[sbox-FREMANTLE_X86:~]> fakeroot apt-get install maemo-sdk-debug

This will again download and install a large number of packages. If you get 503 errors downloading some files, just rerun the last command. The “fakeroot” prefix is required because apt-get checks whether you have root permissions before it will run.

You now want to install the Nokia restricted binaries. To setup the repository for this, go to this page. Accept the EULA. You will then see the line in the repository that looks something like this

deb http://repository.maemo.org/ fremantle/xxxxxxxxxxxxxxxx nokia-binaries

Add this line to the bottom of the apt sources file. You can use this command:

$ vi /etc/apt/sources.list

Now you need to refresh the repository catalog and install the required binaries.

[sbox-FREMANTLE_X86:~]> apt-get update
[sbox-FREMANTLE_X86:~]> fakeroot apt-get install nokia-binaries nokia-apps

This will again download a little more than 100MB of files and install them.

You need to repeat these steps for the ARM environment setup.

[sbox-FREMANTLE_X86:~]> sb-conf se FREMANTLE_ARMEL
[sbox-FREMANTLE_ARMEL:~]> sb-conf rs maemo-sdk-rootstrap_5.0_armel.tgz
[sbox-FREMANTLE_ARMEL:~]> sb-conf in -edFL
[sbox-FREMANTLE_ARMEL:~]> apt-get update
[sbox-FREMANTLE_ARMEL:~]> fakeroot apt-get install maemo-sdk-debug

Edit the apt sources file using this command

$ vi /etc/apt/sources.list

and add the line provided by Nokia, to the end of the file.

Then install the Nokia binaries.

[sbox-FREMANTLE_ARMEL:~]> apt-get update
[sbox-FREMANTLE_ARMEL:~]> fakeroot apt-get install nokia-binaries nokia-apps

Scratchbox should now be properly setup with the Maemo 5 SDK.

You need to now understand how to run the emulator so you can see how your application would look on the device. The Maemo UI is a desktop environment just like any in other Linux installation. This means you need an X Server running for the desktop to load in.

The Maemo documentation talks about installing Xephyr. However, it assumes you are running Linux. Xephyr isn’t available on Windows, but you can use Cygwin/X instead.

One important point is that N900’s screen has 16-bit color depth. So your X Server also needs to be running at 16-bit color depth. However, since Cygwin/X only supports controlling color depth for full-screen X Servers, you will need to reduce the color depth of your Windows desktop. If you don’t, the emulator screen will not look accurate, and some widgets will not display properly. To set the color depth on Windows XP, right-click on your desktop, and click on Properties. Select the Settings tab. Change the Color Quality dropdown to 16-bit, and click Ok.

First, start two instances of Cygwin Bash Shell. You’ll find the shortcut to this in your Start Menu under “Cygwin”. Alternatively, you can use the shortcut “XWin Server” under “Cygwin-X”. This will open an xterm, which is a lot more convenient to use than the Cygwin Bash Shell. You can start another xterm by clicking on the shortcut for the same in the sample where you found the shortcut for “XWin Server”. Remember we need two terminals running.

We now need to start a separate X Server, that has the dimensions of the Nokia N900 device. Use this command in the first Cygwin Bash Shell/xterm to start this server.

$ XWin :2 -screen 0 800x480 -clipboard

The “:2” above specifies the “screen number” that the X server uses. If you’ve started “XWin Server”, you’ll see an icon in your system tray that says “Cygwin/X Server:0.0” when you hover over it. Since screen number “0” is already used, I’ve arbitrarily used “2” instead. You can use any number you like.

This will open an 800×480 sized blank window on your screen. The background may be gray, checked, or black. The command will not exit, so keep your shell open.

In the other Cygwin Bash Shell, run the following commands.

$ export DISPLAY=:2
$ xterm

Remember to use the same sceen number as the value of the DISPLAY variable as you used to start the X Server.

This will start an xterm in the newly opened X Server window. In this xterm, run the following command

$ xhost +
$ exit

where is the IP address of the VM. This step authorizes processes from the VM to write to this X Server. The exit command closes the xterm since we don’t need it anymore.

Now login to the VM, and to scratchbox. If not already set, set the target to the X86 version, using the command:

[sbox->:~]> sb-conf se FREMANTLE_X86

Now we want to start the Maemo UI. Set the DISPLAY variable and start the UI.

[sbox-FREMANTLE_X86:~] export DISPLAY=
[sbox-FREMANTLE_X86:~] af-sb-init.sh start

where is the IP address of your Windows machine, and :2 is the screen number where your X Server is running.

You may get a number of warnings about HAL, a VolumeMonitor and a cellular operator. You can safely ignore these.

You should now be able to see the N900’s home screen.

That’s it! Now read the documentation and start programming!

Other SDK options:

1) Install on Debian/ Debian compatible linux distribution

2) Grab a copy of the the Virtual Image of the SDK installed in Ubuntu


2 thoughts on “[How to] Set Up Maemo 5/N900 Dev Environment on Windows [x32]

  1. Thank you SO MUCH for this tutorial. I’ve been looking for it so bad.
    However, I can’t believe it is so complicated. Nobody thought about Windows-based developers at Nokia? How comes developing for Android is so easy (perfect integration in Eclipse)? Maybe I’m just missing something..

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s