How to set up Maemo 5 (4) SDK and start writing applications under 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 is now working on tablets from Nokia and on the new Nokia N900. But since the project is open-source, then I think other manufacturers do not interfere with making their device under this platform (who knows, maybe HTC or Motorolla will appear on the basis of Maemo).
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 a stable (relatively and debatable, later I will show why) and the current one - Fremantle (at the time of this writing, but 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 do, and then I will only talk about Fremantle, suspecting that you can use Diablo if you want.
Well, suppose we chose the Fremantle SDK (I will dedicate the following articles to MADDE). This SDK has one drawback - it is mono-platform. It only works under Linux x86 (preferably debian based, but not required). 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 is Windows (most popular) / Linux x64 / MacOs? Do not despair. You and there is a choice. 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 is already an ESBox and SDK. If you do not know how to install the system in a virtual machine, you can see in this article below.
Well, the last option - if you want to develop applications on your native platform - no problem! ESBox (I forgot to submit - this is Eclipse + plugins for development for Maemo5 / 4) can work with a virtual machine. That is, it turns out that you write the code in the ESBox, it collects it in a virtual machine and runs there, and the result is displayed again in your native system. The virtual system works "in the shade." The idea is beautiful, is not it?
In fact, everything is not so smooth in Windows, under Mac OS and Linux, everything works as it should (I hope in the near future for Windows all the bugs I have noted will be fixed). I encountered several unpleasant moments, plus some of the documentation that can be found in different places was not created by Nokia, but by the open source community and sometimes there are inaccuracies and inconsistencies between versions.
Here in this article we will discuss how to install the Maemo SDK under Windows (there will be remarks if the process differs from Linux, Mac OS variants) and moreover, I will do it with you 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 setting up is complicated and many letters.In fact, not so, I just tried to describe as detailed as possible.In fact, just watch the video, and if something is not clear, read the description of this video.
UPD: At the time of this writing, the image of the virtual system was “PreFinal2”, a few days ago the Final version was released.But the instruction remains completely relevant, as for this type of installation, nothing has changed.Only the contents of the virtual system image have changed, with the maemo environment configured.
The order of management is as follows: first a video, then explanations to it and links. So you don’t have to memorize them all, I’ll bring them after the video (I advise you to watch in HD, I bring the link before the video, how to add HD video right here - I did not find it).
So, the first step: installing and initial configuration of the virtual machine:
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 parameters by default (carefully: during installation, VirtualBox will fall off for a while the network interfaces).
Then we unpack the downloaded virtual image of Ubuntu in a place convenient for you (zip format is supported by all OSs straight out of the box).
We start VirtualBox and create a new virtual machine, connect the newly downloaded image as a disk.
We start the virtual machine: login and password: maemo.
Run the ~ / install_guest_additions_server.sh tool with the command:
Next, we answer all questions positively and accept all license agreements. After the installation process is complete, reboot the virtual machine with the command:
sudo reboot
Step two: install and configure the ESbox + SDK to work with the virtual machine.
Go to the settings of the virtual machine and in the section "Network" 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 ESbox's workspace (in the diagram, this is “C: \ maemo \ shared”) to the appropriate folders on the virtual machine, so that the SDK can get to them for compilation and launch from the virtual system. The ball is organized via smb protocol.
But for comfortable work, you can also make a reverse ball from the virtual machine to the host machine to connect the header files from the SDK and thus you could see them from the ESBox and enable auto-completion. It is not necessary, but convenient.
If there is a network connection through NAT on a virtual machine, you will have to do 22 port redirection, so it is easier to make a “Bridge” network, so the virtual machine will appear on the network as a separate instance. This will enable the development of a network from another computer (for example, to hang my virtual image on my computer for my wife, and to code it myself on a beech, why should idle power :-) or work remotely with a 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 the data transfer between the host and the virtual machine can easily go through the Internet (through the provider) - even with a little traffic in this case there can be terrible brakes. Therefore, I do not reject the use of NAT Networking, instructions on how to configure port forwarding can be found here .
Next you need to download the 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 this writing, of course you need to download the latest.
The first archive is plug-ins and features, and the second platform-dependent files (executable and related). Unpacking both files into the same folder (if you unpack it in C: \ for example, the program will be in C: \ ESBox), the zip archive is supported by all platforms without third-party products.
Run the unpacked ESBox and proceed to its initial configuration. First we will be asked where our workspace is located. I recommend to specify C: \ maemo \ shared. (The wrong directory was selected in the video, but the correct path was written in the subtitles, I later changed the way to the workspace behind the scenes). We put a tick, informing that this is the default workspace, and no longer need to ask about its placement at launch.
Next, connect the help (optional). First, the on-line help repository connects, the parameters when filling:
We select the necessary packages (in my case everything), accept the license agreement and install.
After that, close the 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 need to install Xephyr:
sudo apt-get install xserver-xephyr
Under Windows, you have the choice between XServers. The Maemo SDK developers offer Cygwin / X, I suggest XMing. Both work the same (equally wrong, see the next chapter).
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 falls 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 follow 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 of the Virtual Box (remove the extra characters "xVM" if you set everything up 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: login / password - maemo / maemo. type the command:
ifconfig
The command will bring 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 press the “Apply” button. Next, click on the link above "Click here for maemo installers". First install Scratchbox. Select the target platform (Fremantle or Diablo). We agree to the proposed autoconfs patch, and restart the virtual machine.
Again, click on this link and set goals for Scratchbox (Fremantle or Diablo respectively). Here it is necessary to accept the license agreement. After the targets are installed, you will be prompted to install the Nokia commercial (closed) binaries. 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 needs to be copied and entered into the corresponding installer field. After that, the necessary packages are already installed.
We don’t touch the network resource settings yet, we’ll start with this in the next chapter.
Step three: finish setting up and attempt to build and debug the first application.
Note: the following video assumes that you made network access to the C: / maemo / shared folder and gave the local user permission to change 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 schema above). Check the path and click the button "Validate Machine". ESbox will try to mount C: \ Maemo \ shared in the appropriate directories on the virtual machine and ask for the username and password to connect (he will remember them and will not ask more). Here Mac OS and Linux everything should go without errors. On Windows, it will display a message that everything was mounted well, but not available. Ignore this message. Well, then an exception will pop up. Bug number 1. We do not pay attention to this, just check that there are two T and S disks in Windows (or others, if you change the settings).
Next, create a new project Maemo C ++ -> Hello World. ESbox will ask to check the installed dependencies. If you run the first time, then it will put several packages (I already have).
Start the maemo environment by clicking on the button with the maemo logo. You will be prompted to remove the unsupported parameters for running the X-server (I tried nothing to influence, but it’s better to agree). If you installed XMing on my recommendation, you will not start anything, then do not worry. It won't work anyway, just watch the video. And instructions on how to configure the ESbox to work with XMing read in the next chapter.
In the video there are a lot of icons lost in the left corner (I already have widgets installed), you will only have a twitter icon. Clicking on it below will scroll bar (this browser will start). This is bug number 2, how to get around it, I will describe in the next chapter. This bug appears only under Windows, on Linux and Mac OS, everything should be displayed beautifully (if not, then look at the end of this step).
As you can see, the window manager does not work as needed. The weather app is shown without a title.
Turn off the Maemo environment and close the hands of the X-server (another bug, ESBox can not close the X-server).
Now we are trying to build the application, using the selected FREMANTLE_X86 (Debug) as the target. And ops, nothing happens. We have an error in the console (can not find the script) and the exception of the plug-in (another bug). Do not worry. You just need to choose another assembly target and everything will work, after that the target that was not going to will be assembled. I think this is due to the fact that some initial values ​​are not initialized, and when switching targets, they are filled. After a long autoconf test, 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 expected, but after running on the screen is black and black. It should be so. This application has only one control in the window title, but since we have no headers (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 be displayed correctly. If you also see it, then check that the -extension Composite option does not exist when you start the X-server. This option was in Diablo, and it is not needed in Fremantle.
Step four, final: configure XMing, bypassing the bugs and debugging our application.
It seems that instead of Cygwin 1.7, it is better to use version 1.5.25-15 . But the old versions of Cygwin cannot be installed by the official installer (the oldest version of the Xorg-server in the official repository is xorg-server-1.6.5-1 ), but I could not find and download it quickly. And not the fact that this will solve the problem (it was described in drop bugs, and not the lack of support for the composite extension). If anyone tries, please write about success.
The second option is XMing. Here we do not support Generic Events (XGE) and it generally falls with the Composition extension turned on. Without errors, just silently falls. There is no desire to debug it, especially since its development has already gone very far forward, and judging by the announcements, in version 7.5.0.14 this has already been fixed (the latest version 7.5.0.16). Maybe the problem with the Composite Extension is also corrected. But the versions are being put into public access very late (version 6.9.0.31 is now lying), and in order 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 last XMing - sign off, very interesting. Yes, by the way, you can add the -clipboard option to XMing to enable the clipboard. Well, now how to make everything work.
The scheme is as follows. The Maemo environment runs in a virtual machine, but it should use the screen not the one that the ESBox passes to it, but the local one. Xephyr will be run locally (this X-server, which is embedded in another XServer (nested)). The screen for XServer is already XMing / Cygwin. It turns out between maemo environment and screw XServer now we insert Xephyr on the virtual machine.
Make it quite simple. Now release the pause from the video, go further to tune.
Go to the virtual machine and install Xephyr:
sudo apt-get install xserver-xephyr
Then we create a script to launch it:
touch ./start1.sh chmod a + x ./start1.sh vim ./start1.sh
Naturally, instead of vim, you can use another editor: nano, mcedit.
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. We start XServer from under ESbox and we start a script again. There should be a conclusion like in my console. To shut down Xephyr, press Ctr + C (to switch between consoles in a virtual machine, use Alt + <left / right arrow>).
Now we need to fix go to scratchbox and fix the maemo startup script there, so that it is displayed 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 we run Xming on Windows, run our script for Xephyr on 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 we also need to change the parameters a little bit. In the environment variables you need to add the following line:
DISPLAY = 127.0.0.1: 2
In order 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 become familiar with the system.
Conclusion
Congratulations if you have reached the conclusion. Of course, we didn't get the perfect environment, but it works. The main disadvantages are that the compiler uses the power of the virtual machine, but the full power of the entire computer does not display as beautifully and quickly as it should be difficult to set up (the total time for the video is 25 minutes, but it does not take into account the time for downloading packages) Eclipse ( ESBox) by itself is not without flaws (speed, memory, errors)
But there is an alternative - this is MADDE. This SDK is still under development, but you can already use it. It is cross-platform. Requires a minimum of installation and there is support for this SDK in Qt-creator'e (but still experimentally). At the moment, applications can be written on MADDE, but only with a real device. About how to install and use MADDE I will discuss in subsequent articles.
In the next article I will explain how to write a Qt application and build a package so that others can install it.
I am also waiting for your advice and suggestions on how to solve the problem with XMing and Cygwin / X.
Enjoy your acquaintance with Maemo. UPD: as always, traditionally, the English version of the flocks can be found on my personal blog erudenko.com . True, they appear with some delay (translation difficulties :-)).