Using QEMU on Windows* for MeeGo* Application Testing

Introduction

Testing and validating an application targeting MeeGo* can be done in various different ways. If the basic UI and functionality testing that the Qt Simulator provides is not sufficient and a real target device with the appropriate form factor is not available, using a virtual machine running the full MeeGo* software stack on your development host may be the way to go.

QEMU is a component of the MeeGo* SDK. It can run handset, netbook or tablet images under an emulator, so you can test your applications on a MeeGo* operating system, even if you don't have a MeeGo* device.

The MeeGo* SDK offers access to a set of MeeGo* OS images that can be booted inside a QEMU based virtual machine.

This article focuses on how to do the setup and configuration of QEMU on a Microsoft Windows* host, so that a MeeGo* OS image can be launched inside of QEMU and the application to be tested can be downloaded and run on this image.

The default method that this article highlights is to have the application automatically downloaded and launched from within the Qt Creator development environment.

1. Prerequisites

Hardware: Intel® Architecture or compatible hardware supporting at least Intel® Streaming SIMD Extensions 3 (Intel® SSE3) based instructions. Support for Virtualization Technology (VT) is required to use the QEMU virtual machine. The MeeGo* SDK version of QEMU relies on kqemu to provide CPU virtualization support, but on some machines with this support, images will still not run.

Known to work: Intel® Core™ 2 Quad CPU, Q8200; Intel® Core™ i5 and i7

Software: Windows* XP or Windows* 7.

Filesystem: MeeGo* SDK should be installed on a hardlink-capable filesystem such as NTFS. FAT* filesystems are not hardlink-capable and not supported.

QEMU runtimes and targets: The following pre-defined targets and runtimes are currently available:

  • Targets:
    • meego-core-ia32-1.1.2
    • meego-handset-ia32-1.1.2
    • meego-netbook-ia32-1.1.2
    • meego-core-ia32-1.2.0
    • meego-handset-ia32-1.2.0
    • meego-netbook-ia32-1.2.0
    • meego-tablet-ia32-1.2.0.90.0.20110517.1
    • meego-core-armv7l-1.1.2
  • Runtimes:
    • meego-handset-ia32-qemu-1.1.20110110.1026-runtime
    • meego-handset-ia32-qemu-1.1.20110118.1010-runtime
    • meego-handset-ia32-qemu-1.1.20101031.2201-sda-runtime
    • meego-handset-ia32-w32-qemu-1.1.20101031.2201-sda-runtime
    • meego-handset-ia32-qemu-1.1.99.5.20110503.6-runtime
    • meego-netbook-ia32-qemu-1.1.20110110.1049-runtime
    • meego-netbook-ia32-qemu-1.1.20110118.1020-runtime
    • meego-netbook-ia32-qemu-1.1.20101031.2037-sda-runtime
    • meego-netbook-ia32-w32-qemu-1.1.20101031.2037-sda-runtime
    • meego-netbook-ia32-qemu-1.2.0-runtime
    • meego-netbook-ia32-qemu-1.1.99.5.20110503.6-runtime
    • meego-tablet-ia32-qemu-1.2.0.90.0.20110517.1-runtime

Others may be listed by MADDE, but are not guaranteed to work.

You can run mad command to list the supporting targets & runtimes

$ mad list

Commands: Terminal commands in the instructions below are prefaced with "$". Do not include $ when entering the commands in your terminal.

2. Download and setup the MeeGo* SDK

The QEMU* virtual machine is part of the MeeGo* SDK for Windows*. Thus the first step is to download the MeeGo* SDK installer:

http://sdk.meego.com/installer/Windows/meego-sdk-installer-online-20110519.exe

Between 3-10GB of free disk space is required, depending on which options you select during installation. 3GB is sufficient for the recommended configuration. Double-click on the downloaded .exe file and follow the prompts to install the SDK.

If you are using Windows* XP, please download a small file vcredist_x86.exe (Microsoft* Visual C++ 2008 SP1 Redistributable Package (x86)) from

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2

and install it to your system. This is not needed for Windows* 7.

3. Download and create local QEMU runtime configuration using MADDE

Launch MADDE Terminal with Start > All Programs > MeeGo* SDK > MADDE Terminal.

  1. Run "export http_proxy="proxy server":"port"" if you are in an intranet.
  2. Run "mad-admin create -f meego-tablet-ia32-1.2.0.90.0.20110517.1" to create target "meego-tablet-ia32-1.2.0.90.0.20110517.1". Some huge files will be downloaded automatically.
  3. Run "mad-admin create -e -f meego-tablet-ia32-qemu-1.2.0.90.0.20110517.1-runtime" to create a runtime "meego-tablet-ia32-qemu-1.2.0.90.0.20110517.1-runtime". Some huge files will be downloaded automatically.

4. Launch Qt Creator and configure MeeGo* Project

  • Launch Qt Creator with Start > All Programs > MeeGo* SDK > QtCreator.
  • Configure Qt Creator to support MeeGo* sysroot. Inside Qt Creator, follow these steps:
  1. From the Tools menu, choose Options.
  2. Click into the Qt4 section, and make sure the Qt Versions tab is open.
  3. Click the + button, and then fill the Version name and the qmake location of the MeeGo* target:
    • Version name: meego-handset
    • qmake location: <MEEGO_SDK>\MADDE\targets\<target name>\bin\qmake.exe
      Replace <MEEGO_SDK> with the directory where you installed MeeGo* SDK; the default is C:\MeeGoSDK_1.2; replace <target_name> with the name of the target (for example, meego-netbook-ia32-w32-1.2.0).
    • Once added, select the new entry and click on the Rebuild button (bottom right) to build the debugging helper for this Qt version. This enables you to use debugging from Qt Creator.

The result should look like this:

5. Create a Mobile Qt project (for handset) or Qt Gui project (for netbook or tablet)

Go to the menu: File -> New File or Project -> Qt Application Project -> MeeGo* Touch Framework Application.

In "Project setup" dialog, choose "meego-ne".

Disable shadow build: "Shadow build” should be disabled before build an app. To do that, select “Projects” button in the left side of Qt Creator, and uncheck “Shadow build” in “Build Settings”.

6. Run an application within the QEMU Emulator

6a. Qt Creator Project Configuration for a QEMU Emulator Device Running MeeGo*

Get to the menu: Tools -> Options -> Projects -> MeeGo* Device Configurations. Click "Add" button to add a runtime for emulator. Set "Device type" to "MeeGo emulator"; set "Authentication type" to "Password"; set "Username" to "root"; set "Password" to "meego".

6b. Set Run Configuration

Click "Projects" again on the left side. Select "Run" in the MeeGo* Build/Run box at the top. Make sure that the "Device configuration" is set to "MeeGo Emulator". This will ensure that QEMU is started when you run your application. You can now launch the QEMU MeeGo* emulator. Click the "Start MeeGo emulator" icon near the bottom left corner of Qt Creator (circled in red in the screenshot below).

Note: You can also start the Qemu from the MADDE terminal. For that you need to go to Start->Programs->MeeGoSDK->MADDE Terminal. In the terminal type:

mad list

to see the runtime and target names, and then type:

mad remote -r <runtime> poweron

6c. Build, run and deploy the application

After QEMU starts, click the "Run" icon to run your application. Qt Creator will package and deploy your application to QEMU and start it on the target. You can see the window of your application in QEMU.

If you launched your application inside a netbook QEMU runtime image with QEMU running on Windows* XP a similar scenario would look as can be seen below:

7. Debug the application

You can also debug the application by clicking the "Debug" icon. Setting breakpoints and stepping are the same as local applications.

8. Open an SSH Terminal for QEMU Runtime

Anytime MeeGo* is running in QEMU, you can use SSH to connect to the image from another terminal on the host system.

  1. Launch QEMU with MeeGo* image
  2. From a terminal on the host, connect to the running image
  3. $ ssh meego@127.0.0.1 -p 6666

Two user accounts are available in the MeeGo* images: User: meego, Password: meego User: root, Password: meego

9. SFTP File Transfer into QEMU Runtime

Anytime MeeGo* is running in QEMU, you can use an SFTP connection to transfer files to the image from another terminal on the host system.

  1. Launch QEMU with MeeGo* image
  2. From a terminal on the host, connect to the running image
  3. sftp –P 6666 meego@127.0.0.1

Two user accounts are available in the MeeGo* images:
User: meego, Password: meego
User: root, Password: meego

10. Known QEMU image issues and workarounds
  1. SSH into QEMU runtime as root user.
  2. edit /usr/sbin/meego-dm to add "sleep 5"
  3. sleep 5 # new added line shopt -s execfail
  1. SSH into QEMU runtime as root user.
  2. Invoke the following command:
  3. rm -rf /etc/ssh/*key*

11. Note for advanced users only: How to create QEMU image

The QEMU images for SDK on Linux* could be built from the kick start file by using mic-image-creator tool (command to run the mic-image-creator could be found in each ks file). On the general topic of image creation there are two nice articles at http://wiki.meego.com/Image_Creation_For_Beginners and http://wiki.meego.com/Image_Creation. Ideally the images are host platform independent. However, due to the slower boot time and some other issues with kqemu, minor changes were done on the images obtained from ks file so that they could boot up successfully on Windows. Suppose you have a raw image, say abc.raw, built from a standard kickstart file in hand, below are the changes needed:

11a. mount into the image

sudo mount -o loop,offset=512 abc.raw /mnt

11b. edit /mnt/usr/sbin/meego-dm to add "sleep 5" to solve bug #10412: mouse udev not ready before starting X server while running handset image on QEMU windows

sleep 5 # new added line
sh opt -s execfail

11c. edit /mnt/boot/extlinux/extlinux.conf to add kernel option "intel_idle.max-cstate=0" to solve bug #10149: Home screen can't show up after starting emulator from Qt Creator on Windows7 32bit

append ro root=/dev/sda1 vga=current intel_idle.max-cstate=0 quiet

11d. unmount the image

sudo umount /mnt

*Other names and brands may be claimed as the property of others. Copyright © 2011, Intel Corporation. All Rights Reserved.

4
Average: 4 (2 votes)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Posted On : May 6, 2011 - 08:21
Offline
Last seen: 19 weeks 5 days ago
 Brown Belt
Joined: Nov 11 2009
Points: 1309

Hi Vsh.Vshnu,

it looks as though in my answer yesterday I have been mislead by the "nothing to be done" messages from make - sorry. The problem seems to however be more in the communication between Qt Creator and the QEMU.

Assuming everything is configured right in step 6, then the most common problem are the ssh permissions in the MeeGo image running inside the QEMU.

Could you try the following:

ssh meego@127.0.0.1 -p 6666

User: root, Password: meego

rm -rf /etc/ssh/*key*

A permanent way to resolve this would also be to edit the global SSH configuration file (/etc/ssh/ssh_config) or the user specific SSH configuration file (~/.ssh/config) on your target device. This will help avoid access denial due to key checking.

Add the following lines to the beginning of the SSH configuration file.
Host 172.0.0.1
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null

Please also make sure your QEMU environment under Wiindows is fully up and running and that port 6666 and 22 are not blocked by any firewall settings.

If the port is the problem you can in theory also modify the QEMu image information file to have a different port used for deployment: If, for example, your image is “meego-tablet-ia32-qemu--sda-runtime” you could change to the
/usr/lib/madde/linux-i686/runtimes/meego-handset-ia32-qemu--sda-runtime/ directory and edit the information file and replace the 6666=>22 port host forward to something else:

qemu_args='-name MeeGo -m 1024 -boot c -hda meego-handset-ia32-qemu-1.1.20101031.2201-sda.raw -enable-kvm -vga std -enable-gl -device virtio-gl-pci -skin /opt/meego/qemu-gl/share/qemugl/meego/skin/handset/skin.xml -usbdevice tablet -soundhw ac97 -net nic -net user,hostfwd=tcp:127.0.0.1:6666-:22,hostfwd=tcp:127.0.0.1:13219-:13219,hostfwd=tcp:127.0.0.1:14168-:14168'

I would only do this if I absolutely had to though.

Thanks, Rob

Posted On : May 6, 2011 - 00:09
Offline
Last seen: 46 weeks 4 hours ago
Joined: Apr 29 2011
Points: 287

Hi robert-mueller-albrecht,
I have not done any mistakes in the stpes3,4.I am using the machine configuration
Intel(R) Core(TM)2 CPU
4300@1.80GHz,1GB of Ram
and Microsoft Windows XP SP3 as the operating system.

When i try to build the application , its working fine,Please find the follwoing as compile window output

Running build steps for project HelloMeego...
Starting: "C:\meegosdk_1.2\madde\bin\make.exe" clean -w
make: Entering directory `/c/MeeGoSDK_1.2/QtCreator/bin/HelloMeego'
rm -f moc_mainwindow.cpp
rm -f ui_mainwindow.h
rm -f main.o mainwindow.o moc_mainwindow.o
rm -f *~ core *.core
make: Leaving directory `/c/MeeGoSDK_1.2/QtCreator/bin/HelloMeego'
The process "C:\meegosdk_1.2\madde\bin\make.exe" exited normally.
Configuration unchanged, skipping qmake step.
Starting: "C:\meegosdk_1.2\madde\bin\make.exe" -w
make: Entering directory `/c/MeeGoSDK_1.2/QtCreator/bin/HelloMeego'
c:/MeeGoSDK_1.2/MADDE/targets/meego-netbook-ia32-1.1/bin/uic.exe mainwindow.ui -o ui_mainwindow.h
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/share/qt4/mkspecs/default -I. -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4/QtCore -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4/QtGui -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4 -I. -I. -o main.o main.cpp
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/share/qt4/mkspecs/default -I. -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4/QtCore -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4/QtGui -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4 -I. -I. -o mainwindow.o mainwindow.cpp
C:/MeeGoSDK_1.2/MADDE/targets/meego-netbook-ia32-1.1/bin/moc.exe -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/share/qt4/mkspecs/default -I. -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4/QtCore -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4/QtGui -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4 -I. -I. mainwindow.h -o moc_mainwindow.cpp
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/share/qt4/mkspecs/default -I. -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4/QtCore -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4/QtGui -I../../../MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/include/qt4 -I. -I. -o moc_mainwindow.o moc_mainwindow.cpp
g++ -o HelloMeego main.o mainwindow.o moc_mainwindow.o -LC:/MeeGoSDK_1.2/MADDE/sysroots/meego-core-ia32-madde-sysroot-1.1-fs/usr/lib -lQtGui -lQtCore -lpthread
make: Leaving directory `/c/MeeGoSDK_1.2/QtCreator/bin/HelloMeego'
The process "C:\meegosdk_1.2\madde\bin\make.exe" exited normally.

After when i try to run the following "Installing package created" is coming with the following on the compile window

Running build steps for project HelloMeego...
Configuration unchanged, skipping qmake step.
Starting: "C:\meegosdk_1.2\madde\bin\make.exe" -w
make: Entering directory `/c/MeeGoSDK_1.2/QtCreator/bin/HelloMeego'
make: Nothing to be done for `first'.
make: Leaving directory `/c/MeeGoSDK_1.2/QtCreator/bin/HelloMeego'
The process "C:\meegosdk_1.2\madde\bin\make.exe" exited normally.
Creating package file ...
Package Creation: Running command 'rrpmbuild -bb hellomeego.spec'.
Executing: %build
+ make
make: Nothing to be done for `first'.
Executing: %install
+ make install INSTALL_ROOT=rrpmbuild/instroot
install -m 755 -p "HelloMeego" "rrpmbuild/instroot/usr/local/bin/HelloMeego"
Adding directory usr/local
Adding directory usr/local/bin
Adding file usr/local/bin/HelloMeego
Pushing data "C
Package created.
Connecting to device...
No directories to unmount
Started uploading file 'C:\MeeGoSDK_1.2\QtCreator\bin\HelloMeego\rrpmbuild\hellomeego-0.0.1-1.i586.rpm'.
Successfully uploaded file 'C:\MeeGoSDK_1.2\QtCreator\bin\HelloMeego\rrpmbuild\hellomeego-0.0.1-1.i586.rpm'.
Installing package to device...
bash: /usr/lib/mad-developer/devrootsh: cannot execute binary file
No directories to unmount
Deployment finished.
Error while building project HelloMeego (target: MeeGo)
When executing build step 'Deploy to MeeGo device'

Please help me

Posted On : May 5, 2011 - 14:40
Robert Mueller-Albrecht (not verified)

Dear Vsh.Vshnu,

the printout you provided indicates that qmake called from within QT Creator does not find an appropriate Makefile to build with. This means that either in step 3) the QEMU runtime download and install inside MADDE did not succeed (You may want to go back and look at the console log inside the MADDE console terminal) or that in step 4) you do no point to the correct qmake for your target platform configuration.

Since you say that the QEMU target environment is up and running, it should be the second of these two possible issues. The problem therefore is not so much with QEMU, but rathter with the build cpnfiguration in QT Creator.

Perhaps you could provide me with the exact data you put into the configuration dialog for your application build and I can check whether I see something suspicious.

Thanks, Rob

Posted On : May 5, 2011 - 08:36
Offline
Last seen: 46 weeks 4 hours ago
Joined: Apr 29 2011
Points: 287

Hi robert-mueller,
I have configure everything accordingly for Netbook target and runtime on Windows xp.
But when i try to run the sample "HelloMeego" project after starting MeeGO Emulator, iam getting the follwoing error
"Installing package failed"

Following are the steps i have copied from the Compile Output window

Running build steps for project HelloMeeGo...
Configuration unchanged, skipping qmake step.
Starting: "C:\meegosdk_1.2\madde\bin\make.exe" -w
make: Entering directory `/c/MeeGoSDK_1.2/QtCreator/bin/HelloMeeGo'
make: Nothing to be done for `first'.
make: Leaving directory `/c/MeeGoSDK_1.2/QtCreator/bin/HelloMeeGo'
The process "C:\meegosdk_1.2\madde\bin\make.exe" exited normally.
Creating package file ...
Package Creation: Running command 'rrpmbuild -bb hellomeego.spec'.
Executing: %build
+ make
make: Nothing to be done for `first'.
Executing: %install
+ make install INSTALL_ROOT=rrpmbuild/instroot
install -m 755 -p "HelloMeeGo" "rrpmbuild/instroot/usr/local/bin/HelloMeeGo"
Adding directory usr/local
Adding directory usr/local/bin
Adding file usr/local/bin/HelloMeeGo
Pushing data "C
Package created.
Connecting to device...
No directories to unmount
Started uploading file 'C:\MeeGoSDK_1.2\QtCreator\bin\HelloMeeGo\rrpmbuild\hellomeego-0.0.1-1.i586.rpm'.
Successfully uploaded file 'C:\MeeGoSDK_1.2\QtCreator\bin\HelloMeeGo\rrpmbuild\hellomeego-0.0.1-1.i586.rpm'.
Installing package to device...
bash: /usr/lib/mad-developer/devrootsh: No such file or directory
No directories to unmount
Deployment finished.
Error while building project HelloMeeGo (target: MeeGo)
When executing build step 'Deploy to MeeGo device'

Please help me..

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.