
How to set up the Maemo 5 (4) SDK and start writing applications for Windows / Linux / MacOS in less than half an hour!

It makes no sense, I think, to explain what Maemo is and where it works. Everyone understands that this is Linux, which now works on tablets from Nokia and on the new Nokia N900. But since the project is open-source, I think that there is nothing stopping other manufacturers from making their device under this platform (who knows, maybe HTC or Motorolla based on Maemo may appear).
This article will discuss how to set up a development environment for Maemo.
To begin with, there are now two types of SDKs - the current stable for Maemo5 / 4 (Fremantle / Diablo) and the new SDK, which is now in beta - MADDE.
Well, let's start with the stable (relatively and controversially, later I will show why) and the current one - Fremantle (at the time of writing, it was “pre-final 2”, now in “final”). It is based on Diablo and therefore the installation process and tools are the same. And if you need Diablo, this instruction will work, and then I will talk only about Fremantle, suspecting that you can use Diablo if you wish.
Well, suppose we chose the Fremantle SDK (MADDE I will devote the following articles). This SDK has one drawback - it is mono-platform. It works only under Linux x86 (preferably debian based, but not necessary). For happy users of this system, there is a simple way to install the SDK, you need to download the script from this page and act according to this instruction.
What to do if the working system we have is Windows (the most popular) / Linux x64 / MacOs? Do not despair. You have a choice here too. The easiest way is to download a virtual image from here with a customized environment and work in it. Everything is extremely simple - download, run from under VMWare, QEMU, VirtualBox. There are already ESBox and SDK. If you do not know how to install the system in a virtual machine, you can peek in this article further.

Well, the last option - if you want to develop applications on your own platform - no problem! ESBox (forgot to introduce - these are Eclipse + plugins for development for Maemo5 / 4) can work with a virtual machine. That is, it turns out that you write the code in ESBox, it collects it in a virtual machine and launches there, and the result is displayed again in your native system. The virtual system works "in the shade." The idea is beautiful, isn't it?
In fact, everything is not so smooth on Windows, on Mac OS and Linux everything works as it should(I hope in the near future for Windows all the bugs I noted will be fixed). I came across several unpleasant moments, plus the part of the documentation that can be found in different places was created not by Nokia, but by the open source community and sometimes there are inaccuracies and version mismatches
Here in this article we will talk about how to install the Maemo SDK under Windows (there will be comments if the process will be different from Linux, Mac OS options) and moreover, with you I will do it in less than half an hour. All videos and notations to them under the cut.
By the way, all this can be installed not only for development, but also in order to get acquainted with Maemo without having a real device.
It seems to some that the process of utsanovka is complicated and many letters. Actually not so, I just tried to describe as detailed as possible. In fact, it’s enough to watch the video, and if something is not clear - read the description for this video.
UPD: At the time of writing, the image of the virtual system was “PreFinal2”, a few days ago the Final version was released. But the instruction remains fully relevant, since nothing has changed for this type of installation. Only the contents of the virtual system image have changed, with the maemo environment configured.
The order of leadership is as follows: first a video, then explanations to it and links. So do not remember them all, I will bring them after the video (I advise you to watch in HD, I give the link before the video, I did not find how to add HD video right here).
So the first step: installation and initial configuration of the virtual machine:
Link to the HD YouTube version.
The sequence of actions is as follows:
download Maemo Virtual Image from the site (when clicking on the link, you must accept the license agreement). Download the file "Maemo_Ubuntu_Intrepid_Server_SDK_Virtual_Image.zip". This is an image with some additions, in particular:
Ubuntu Server 8.10 Intrepid Ibex
Maemo Host PC Connectivity release without GUI applications
Installation wizards for virtualization performance tools
Installer for Official VMWare Tools
Installer for Open VMWare Tools
Installer for VirtuaBox GuestAdditions
Plus, there are some patches installed.
Next, go to the VirtualBox website and in the Download section download the installer for your platform. Well and accordingly, we install it with all the default parameters (carefully: during the installation of VirtualBox, network interfaces will fall off for a while).
Then we unpack the downloaded virtual image of Ubuntu to a place convenient for you (the zip format is supported by all OS directly “out of the box”).
We start VirtualBox and create a new virtual machine, as a disk we connect the just downloaded image.
We start the virtual machine: login and password: maemo.
run the ~ / install_guest_additions_server.sh tool with the command:
sudo /home/maemo/ToolsInstallers/install_guest_additions_server.sh
Next, we answer all questions positively and accept all license agreements.
After the installation process is complete, restart the virtual machine with the command:
sudo reboot
Step two: install and configure ESbox + SDK to work with the virtual machine.
Link to the HD version on YouTube.
We go into the settings of the virtual machine and in the “Network” section we change the type of network connection from “NAT” to “Network Bridge”.
In general, you need to organize a cross-ball between the host system and the virtual system. The scheme of the balls is as follows:

We mount the ESbox workspace (in the diagram it is “C: \ maemo \ shared”) on the corresponding folders on the virtual machine so that the SDK can reach them for compilation and launch from the virtual system. The ball is organized through the smb protocol.
But for comfortable work, you can still make the return ball from the virtual machine to the host machine in order to connect the header files from the SDK and thus you could see them from the ESBox and enable autocompletion. This is not necessary, but convenient.
If there is a network connection through NAT on the virtual machine, then you will have to do port 22 redirection, so it’s easier to make a “Bridge” network, so the virtual machine will appear on the network as a separate instance. This will make it possible to conduct development over the network from another computer (for example, to hang this virtual image on the computer for the wife, and to code on the beech itself, why should the power be idle :-) or work remotely with the virtual machine (there are many options)).
BUT it is worth considering one moment. The network may not allow this, or if the router is not very smart, then data transfer between the host and the virtual machine can safely go through the Internet (through the provider) - even with little traffic, in this case there can be terrible brakes. Therefore, I do not discard the use of NAT Networking,instructions for setting up port forwarding can be found here .
Next, you need to download ESbox from this site. .
You need to download two files:
esbox_2.0.0-R20091216-common.zip
esbox_2.0.0-R20091216-win32.win32.x86.zip - for Windows (or appropriate for your platform).
R20091216 - the number of the available version at the time of writing, of course you need to download the latter.
The first archive is plugins and features, and the second is platform-dependent files (executable and related).
Unpack both files in the same folder (for example, unpack it in C: \, then the program will be in C: \ ESBox), the zip archive is supported by all platforms without third-party products.
We launch the unpacked ESBox and proceed to its initial configuration.
First we will be asked where our workspace is located. I recommend specifying C: \ maemo \ shared. (The wrong directory was selected in the video, but the correct path is written in the subtitles, I later changed the path to the workspace behind the scenes).
We tick off, informing that this is the default workspace, and you no longer need to ask at startup about its placement.
Next, we connect the help (optional).
First, an on-line help repository is connected, parameters when filling out:
Name: Maemo Docs Libraray
Host: library.maemodocs.nokia.com
Path: / fremantle
Also, if you wish, you can install off-line help.
To do this, add a new repository:
Location: maemoide.nokia.com/downloads/fremantle
We select the necessary packages (in my case, everything), accept the license agreement and install.
After that we close ESBox.
The next step for Windows users only is to install the X-server. Under Mac OS, the server goes “out of the box” and works fine (checked). For Linux, you must install Xephyr:
sudo apt-get install xserver-xephyr
On Windows, you have a choice between XServer's. Maemo SDK developers offer Cygwin / X, I offer XMing. Both work the same (equally wrong, see the next chapter).
To install Cygwin / X, you need to go to cygwin.org and download the file from this link.
After that, run the installer and add three packages: X11 / xorg-server, X11 / xinit, X11 / xdpyinfo.
Attention for users of Windows 7. Cygwin / X version 1.7 crashes due to a bug . It is associated with the composition extension (more on this in the fourth step).
To install XMing, download the installer from sourceforge.net . Run the installer and proceed according to the instructions (I left all the default settings).
As for me, XMing is easier and faster to install.
Next, you need to configure the virtual machine, go to the settings of ESbox-> Build Machines and select VirtualBox from the list of virtual machines.
In the first tab, you need to change the path to the executable file Virtual Box (remove the extra characters "xVM", if you set everything by default, like me) and select our virtual machine from the list.
In the second tab, we configure network interfaces.
To do this, start the virtual machine and go to it: username / password - maemo / maemo.
we type the command:
ifconfig
The command will display us the address of the virtual machine, and in the drop-down list of interfaces for the host machine, select the appropriate IP address.
And be sure to click the “Apply” button.
Next, click on the link above “Click here for maemo installers”.
First install Scratchbox.
Choose the target platform (Fremantle or Diablo). We agree to the proposed autoconfs'a patch, and reboot the virtual machine.
Click this link again and set goals for Scratchbox (Fremantle or Diablo respectively).
Here it is necessary to accept the license agreement.
After setting goals, you will be prompted to install commercial (closed) binary files from Nokia.
This is a necessary step for Fremantle.
There is a tricky license agreement, you need to click on the link above, read the license agreement in the browser, enter the verification code and get the path to the deb repository. This path must be copied and entered in the appropriate installer field.
After that, the necessary packages are already installed.
We don’t touch the network resource settings yet, we will start with this in the next chapter.
Step Three: Finish the setup and try to build and debug the first application.
Attention: the following video assumes that you have made network access to the C: / maemo / shared folder and gave the local user permission to modify the files.
The network resource must be organized using the Samba protocol. How to do it on Windows / Linux / Mac Os you can easily find in google .
Link to the HD version on YouTube.
Go to the settings of the virtual machine in the “Shared Folders” tab (see the diagram above). We check the paths and click the "Validate Machine" button.
ESbox will try to mount C: \ Maemo \ shared in the appropriate directories on the virtual machine and ask for the username and password for the connection (it will remember them and will not ask again).
Here Mac OS and Linux everything should go without errors.
On Windows, he will display a message that everything was mounted well, but not available. Ignore this message. Well and then the exception will jump out. Bug number 1. We do not pay attention to this, just check that two disks T and S appeared in Windows (or others if you changed the settings).
Next, create a new project Maemo C ++ -> Hello World.
ESbox will ask you to check the installed dependencies. If you run the first time, it will install several packages (I already have it).
We start the maemo environment by clicking on the button with the maemo logo. It will be suggested to remove the unsupported parameters for starting the X-server (I tried they do not affect anything, but it's better to agree).
If you installed XMing on my recommendation, nothing will start, then it's okay. All the same, it will not work as it should, just watch the video. For instructions on setting up ESbox to work with XMing, see the next chapter.
On the video there a bunch of icons went astray in the left corner (I already have widgets installed), you will only have a twitter icon. Clicking on it from the bottom will have a scroll bar (this browser will start).
This is bug number 2, and I will describe how to get around it in the next chapter. This bug appears only under Windows, on Linux and Mac OS everything should be displayed nicely for you (if not, then look at the end of this step).
As you can see, the window manager is not working as it should. The weather app is shown without a title.
We turn off the Maemo environment and close the X-server with our hands (another bug, ESBox cannot close the X-server).
Now we are trying to build the application, we use the selected FREMANTLE_X86 (Debug) as the target. And ops, nothing happens. We have an error in the console (cannot find the script) and a plugin exception (another bug).
Do not worry. You just need to choose a different assembly target and it will work, after that a goal that was not collected will be collected. I think this is due to the fact that some initial values are not initialized, but when switching goals, they are filled.
After a long working out of autoconf, we are ready to launch our application.
We start the Maemo environment and run our application in debug mode.
The application will stop at the breakpoint, which means gdb works as it should, but after execution it is black and black on the screen. It should be so. This application has only one control in the window title, but since we have no titles (the window manager did not start, but more on that later), it is not visible.
For Mac OS and Linux users, everything should already work and display correctly. If you also see it, then check that the -extension Composite option does not appear when starting the X-server. This option was in Diablo, but in Fremantle it is not needed.
Fourth step, final: setting up XMing, bypassing bugs and debugging our application.
Link to the HD version on YouTube.
First, instructions for those who listened to me and put XMing.
We go into the settings of ESbox-> X Server and change the values:
Command template to launch server: "C: \\ Program Files \\ XMing \\ XMing.exe"
Additional PAth entries for server: "" C: \\ Program Files \\ XMing "
Now for all types of X's you need to add the following parameters:
+ extension Composite + extension "Generic Events"
Run, XMing should start.
Pause the video and listen a little to my reasoning.
Now we will understand why everything is not displayed correctly.
There is a problem with Cygwin / X that matchbox (the window manager on maemo) cannot recognize that the composite extension is installed on the X-server. And it does not start. The result is lost icons and no headers and everything else. This bug is known, but a little different. The bottom line is that you need to check Cygwin 1.7 support with the Fremantle SDK .
It seems that instead of Cygwin 1.7 it is better to use version 1.5.25-15 . But older versions of Cygwin cannot be installed by the official installer (the oldest version of Xorg-server in the official repository is xorg-server-1.6.5-1), but I could not find and download fast. Yes, and not the fact that this will solve the problem (the fall was described in bugs, and not the lack of support for composite extension). If anyone tries, please unsubscribe about success.
The second option is XMing. Here we do not support Generic Events (XGE) and it generally crashes with the Composition extension turned on. Without errors, it just falls silently. There is no desire to debug it, especially since its development has already gone very far ahead, and judging by the announcements, this has already been fixed in version 7.5.0.14 (latest version 7.5.0.16). Maybe the problem with the Composite Extension was also fixed. But versions with a great delay are laid out in public access (version 6.9.0.31 now lies), and to get access to the latest versions, you need to get a donor code (for this you need to make a donation to the project). If I used the X server under Windows, I would definitely do it. But my main platform is Mac Os. Again, if anyone has the opportunity to check on the latest XMing - unsubscribe, very interesting.
Yes, by the way, in XMing you can add the -clipboard option to enable the clipboard.
Well, now how do you make it work.
The scheme is as follows. The Maemo environment runs in a virtual machine, but the screen should not use the one that the ESBox will give it, but the local one. Xephyr will be launched locally (this X-server, which is embedded in another XServer (nested, nested)). The screen for XServer will be XMing / Cygwin. It turns out between the maemo environment and the XServer Windows now we insert Xephyr in the virtual machine.
This is easy enough to do.
Now release the pause from the video, let's go further to configure.
We go to the virtual machine and install Xephyr:
sudo apt-get install xserver-xephyr
Then create a script to run it:
touch ./start1.sh
chmod a + x ./start1.sh
vim ./start1.sh
Naturally, instead of vim, you can use another editor: nano, mcedit.
The contents of the script will look like this:
#! / bin / bash
export DISPLAY = 192.168.1.152: 2
Xephyr: 2 -host-cursor -screen 800x600x16 -dpi 96 -ac -kb
Instead of 192.168.1.152 - specify the IP address of your host machine.
And run the script, it should swear that it can not connect to the screen.
Run XServer from under ESbox and run the script again.
The output should appear as in my console.
To terminate Xephyr, press Ctr + C (to switch between consoles in a virtual machine, use the combination Alt + <left / right arrow).
Now we need to fix it, go to scratchbox and fix the maemo startup script there so that it appears in the local Xephyr server, and not in our Xming.
/ scratchbox / login
vim /usr/bin/af-sb-init.sh
at the beginning we add such a line
export DISPLAY = 127.0.0.1: 2
Well, now run Xming on Windows, run our script for Xephyr in a virtual machine, and run the Maemo environment from ESbox.
Here we have an almost working Maemo (some applications still did not start, for example, a browser and an audio player).
Now let's run our helloworld in debug mode, here you also need to slightly change the settings. In environment variables you need to add the following line:
DISPLAY = 127.0.0.1: 2
So that our application is also displayed in Xephyr and not on XMing.
As you can see, everything works as it should.
By the way, you can instruct any software in the application manager, as I did, and thus get acquainted with the system.
Conclusion
Congratulations if you have reached the conclusion.
Of course, we did not get the perfect environment, but it works.
Of the main drawbacks:
when compiling, the power of the virtual machine is used, and not the full power of the entire computer, the
display is not so beautiful and fast, as it should be
quite difficult to configure (the total time for the video is 25 minutes, but it does not take into account the time it takes to download the packages) the
Eclipse environment ( ESBox) in itself is not without flaws (speed, memory, errors)
But there is an alternative - this is MADDE. This SDK is still under development, but it can already be used.
It is cross platform. It requires a minimum of installation and there is support for this SDK in Qt-creator'e (but so far experimentally). Today, you can write applications on MADDE, but only with a real device. I will tell you how to install and use MADDE in subsequent articles.
In the next article, I will tell you how to write Qt applications and build a package so that others can install it.
I am also waiting for your advice and thoughts on resolving the problem with XMing and Cygwin / X.
Enjoy your acquaintance with Maemo.
UPD: as always, traditionally, the English version of the pack can be found on my personal blog erudenko.com . True, they appear with some delay (translation difficulties :-)).