Meego Wiki
Views

SDK/Docs/1.1/MeeGo SDK with Xephyr

From MeeGo wiki
< SDK | Docs | 1.1(Difference between revisions)
Jump to: navigation, search
(Install extra software (if building your own chroot))
 
(23 intermediate revisions not shown)
Line 72: Line 72:
This is now a ''MeeGo chroot terminal''.  It behaves just like a terminal running in the MeeGo OS: paths, programs, libraries, and environment are all the same as those on a MeeGo OS netbook or handset.
This is now a ''MeeGo chroot terminal''.  It behaves just like a terminal running in the MeeGo OS: paths, programs, libraries, and environment are all the same as those on a MeeGo OS netbook or handset.
-
'''Caution:'''  If you later decide to delete the directory that you created, use <code>mic-rm-chroot-dir</code> to delete it. Otherwise the contents of the image may be destroyed.
+
'''Caution:'''  If you later decide to delete the directory that you created, use <code>mic-rm-chroot-dir</code> to delete it. Otherwise the contents of the host file system may be destroyed.
  $ sudo mic-rm-chroot-dir <image destination directory>
  $ sudo mic-rm-chroot-dir <image destination directory>
Line 83: Line 83:
First, add the SDK tools repo to the chroot:
First, add the SDK tools repo to the chroot:
-
  $ zypper addrepo http://download.meego.com/live/devel:/tools:/sdk:/target/MeeGo_1.1/ meego-sdk
+
  $ zypper addrepo http://repo.meego.com/MeeGo/sdk/target/repos/meego/1.1/ meego-sdk
Note that if you're using a different MeeGo image (for example, from Trunk), change the repo URL, replacing MeeGo_1.1 with the correct version for your image.
Note that if you're using a different MeeGo image (for example, from Trunk), change the repo URL, replacing MeeGo_1.1 with the correct version for your image.
Line 95: Line 95:
==== Handset extra software ====
==== Handset extra software ====
-
  $ zypper install meego-simulator-launcher-handset mesa-dri-i915-driver mesa-dri-i965-driver mesa-dri-swrast-driver
+
  $ zypper install meego-simulator-launcher-handset
== Start the MeeGo UI with Xephyr ==
== Start the MeeGo UI with Xephyr ==
-
<ol>
+
Launch Xephyr from inside the MeeGo chroot terminal with:
-
<li>Check for Intel graphics chipset using [[SDK/Docs/1.1/MeeGo_SDK_Graphics_Acceleration#Graphics_Chipset|this procedure]].<br/>
+
-
 
+
-
If your system does not have Intel graphics, you ''cannot'' start Xephyr with the MeeGo image. However, you can still use the chroot to run MeeGo applications run on your desktop, or compile MeeGo software. Go to [[#Application Development|Application Development]], below, for more details.</li>
+
-
 
+
-
<li>Launch Xephyr from inside the MeeGo chroot terminal with:<br/>
+
<pre>
<pre>
Line 115: Line 110:
           <td>[[File:qemu-netbook.jpg|thumb|MeeGo Netbook UI in Xephyr]]</td>
           <td>[[File:qemu-netbook.jpg|thumb|MeeGo Netbook UI in Xephyr]]</td>
</tr></table>
</tr></table>
-
</li>
 
-
</ol>
 
When you're done, stop Xephyr by closing the Xephyr window (click X in the upper corner).
When you're done, stop Xephyr by closing the Xephyr window (click X in the upper corner).
Line 134: Line 127:
</pre>
</pre>
-
=== Debugging the Simulator ===
+
=== Running an image without GL acceleration ===
 +
 
 +
GL acceleration for MeeGo images under Xephyr only works on Intel graphics chipset. Images may run without it, but performance will be poor.
 +
 
 +
To identify your graphics chipset, run the following:
 +
$ lspci | grep VGA
 +
<table><tr><td colspan='2'>Example output:</td></tr>
 +
<tr><td valign='top' nowrap>Intel mobile:</td><td>00:02.0 VGA compatible controller: '''Intel Corporation''' Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)</td></tr>
 +
<tr><td valign='top'>nVidia:</td><td>08:00.0 VGA compatible controller: nVidia Corporation GT216 [GeForce GT 220] (rev a2)</td></tr>
 +
<tr><td valign='top'>ATI:</td><td>01:00.0 VGA compatible controller: ATI Technologies Inc M22 [Mobility Radeon X300]
 +
</td></tr>
 +
</table>
 +
 
 +
If you get an '''Intel Corporation''' chipset, GL acceleration should work.
 +
 
 +
There is also a [http://bugs.meego.com/show_bug.cgi?id=8666 known issue] with the netbook UX running under Fedora Core 13, where GL acceleration causes the UX to truncate.
 +
 
 +
However, even if you can't start a MeeGo image in Xephyr with GL acceleration, you should be able to use the UX without acceleration. This can be done by editing the Xephyr start command in <code>/usr/bin/startmeego-debug</code> in the chroot. Change the line which starts <code>Xephyr $DISP</code> to the following:
 +
 
 +
Xephyr $DISP -host-cursor -screen 864x480 -notfp -nodri2 -ac &
 +
 
 +
Replace the <code>-screen</code> resolution with whatever is appropriate for the image you're running (use the existing Xephyr command as a basis). This disables GL acceleration in Xephyr, which will result in a slow, but just about usable, UX.
 +
 
 +
Another approach is to use the host's default Xephyr package, rather than the MeeGo SDK package, to run an image: [http://wiki.forum.nokia.com/index.php/Qt_MeeGo_handset_SDK_how_to_install_and_use_on_Linux_Ubuntu_10.04_LTS this article] explains how to do this on Ubuntu 10.04.
 +
 
 +
Regardless of whether you can run the UX, you can always use the chroot to run MeeGo applications run on your desktop, or compile MeeGo software. Go to [[#Application Development|Application Development]], below, for more details.
 +
 
 +
=== Debugging Xephyr ===
If you are having issues running Xephyr, use the debug script to see what's happening:
If you are having issues running Xephyr, use the debug script to see what's happening:
Line 142: Line 162:
This shows the console output from the script, which may give you some clues if it's not working correctly.
This shows the console output from the script, which may give you some clues if it's not working correctly.
-
== Application Development ==
+
== Installing other software into the chroot ==
 +
 
 +
You can install additional software into the MeeGo chroot environment.  From the MeeGo chroot terminal:
 +
 
 +
$ zypper install <package>
 +
 
 +
You can also upgrade the whole MeeGo image using:
 +
 
 +
$ zypper dup
 +
 
 +
== Application development ==
The MeeGo chroot terminal can be used to build, run, and debug your application.  You can do this with or without Xephyr.   
The MeeGo chroot terminal can be used to build, run, and debug your application.  You can do this with or without Xephyr.   
Line 153: Line 183:
  $ <start your application>
  $ <start your application>
-
Building your application in the MeeGo chroot terminal is the same as doing so on a MeeGo system.  You can use gcc, emacs, or any other Linux development tools you are comfortable with. (See [[#Qt Creator IDE|Qt Creator IDE]], below.)
+
Building your application in the MeeGo chroot terminal is the same as doing so on a MeeGo system.  You can use gcc, emacs, or any other Linux development tools you are comfortable with. (See [[#Developing with Qt Creator from the chroot|Developing with Qt Creator from the chroot]], below.)
=== Source Code Management ===
=== Source Code Management ===
Line 168: Line 198:
'''Caution:''' Be sure to unmount this directory when finished and before <code>rm -rf /path/to/chroot/dir</code> at some later date or your source directory will be destroyed.
'''Caution:''' Be sure to unmount this directory when finished and before <code>rm -rf /path/to/chroot/dir</code> at some later date or your source directory will be destroyed.
-
=== Qt Creator IDE ===
+
=== Developing with Qt Creator from the chroot ===
Qt Creator is part of MeeGo.  You can launch Qt Creator from the MeeGo chroot.  The following will open Qt Creator IDE on your workstation (not in Xephyr):
Qt Creator is part of MeeGo.  You can launch Qt Creator from the MeeGo chroot.  The following will open Qt Creator IDE on your workstation (not in Xephyr):
Line 174: Line 204:
  $ qtcreator
  $ qtcreator
-
From Qt Creator you can now load your project, build, run, and debug it as you would normally.
+
[[File:Simulator_QtCreator_splash.png]]
-
== Installing other software ==
+
To setup the project:
-
You can install additional software into the MeeGo chroot environment. From the MeeGo chroot terminal:
+
* Create a new project (''File > New File or Project''). Under ''Projects'', select ''Qt Gui Application'' and click ''OK''.
 +
* Enter '''helloworld''' for the name; choose a directory to save it to (such as ''/root'' if you're working as the root user). Click on ''Next''.
 +
* Accept the defaults in the ''Class Information'' dialog box and click ''Next''.
 +
* In the ''Project Management'' dialog box, click ''Finish''.
-
$ zypper install <package>
+
Next write some code:
-
You can also upgrade the whole MeeGo image using:
+
* Open the ''Forms'' folder and double-click '''mainwindow.ui''' to open it in the graphical forms editor.
 +
* Drag a label from the list of widgets on the left-hand side of the forms editor and drop it into the editable area.
 +
* Change the text to something else ("Hello world" works well).
 +
* Put any other junk you like the look of in there.
-
$ zypper dup
+
Then configure the project:
 +
 
 +
* Click on the ''Projects'' icon on the left of the Qt Creator window.
 +
* Configure the Qt version:
 +
** Under ''Build Settings > General'', click on the ''More'' button. This displays the Qt version which will be used when building and running the project.
 +
** Click on the ''Manage'' button next to ''Qt Version''. This displays the ''Qt Versions'' panel:<br/>[[File:simulator_QtCreator_qt_versions.png]]
 +
** Select the '''Qt in PATH''' entry.
 +
** Click on ''Rebuild'' to set up the ''Debugging Helper'' for this version of Qt.
 +
** Click ''OK'' to save your changes.
 +
* Make sure that the ''Qt Version'' is now set to '''Default Qt Version (Qt in PATH)'''.
 +
* Next, configure the run environment to use the Simulator to display the application when it's running:
 +
** Click on the ''Run Settings'' tab.
 +
** Click on the ''More'' button under ''Run Environment''.
 +
** Double-click in the text entry next to the ''Display'' variable; change ''':0.0''' to ''':2'''. This tells Qt Creator to run the application on display number :2, the one which Xephyr is in control of.
 +
 
 +
=== Running a Qt Creator project inside Xephyr ===
 +
 
 +
Now you're all set to run the application.
 +
 
 +
First don't forget to generate the makefile (apply qmake).
 +
 
 +
From inside Qt Creator, click on the big green arrow (bottom-left corner) to run the application. This will build it first (using the Qt Version you set up) then run it on display ''':2''' (inside the Xephyr simulated MeeGo desktop).
 +
 
 +
In the Xephyr window, you might need to click on the MyZone icon (the house icon) to reveal the application running behind it:
 +
 
 +
[[File:Simulator_running_meego_app.png]]
-
== Known issues ==
+
== Known issues with Xephyr ==
* Panels which rely on DBus (like the battery, networking) don't report devices properly.
* Panels which rely on DBus (like the battery, networking) don't report devices properly.
* Applications that rely on DBus might work inconsistently because the host workstation's system bus is used.
* Applications that rely on DBus might work inconsistently because the host workstation's system bus is used.

Latest revision as of 02:24, 30 January 2011


The MeeGo SDK with Xephyr provides a development environment on Linux workstations for Netbook and Handheld applications.

This environment consists of a MeeGo image, converted for use as a chroot, combined with Xephyr, an X server for running the image's UX.

Contents

Install a chroot

You have two alternatives here. Either:

  • Download the MeeGo SDK Image for your target as described on the Getting Started page.

OR

  • Make a chroot yourself by unpacking a stock image, as described in Building a MeeGo chroot on Linux. This is only recommended if you are comfortable with using Linux. If you build your own chroot, you will need to install some extra software into it, as described later.

Configure X on the host

This is to allow Xephyr to access the display:

$ xhost +SI:localuser:<user name>

Example for user named "bob":

$ xhost +SI:localuser:bob

(You need to do this once before running Xephyr or Qt Creator after each reboot)

"Change root" into the MeeGo image

You need MeeGo Image Creator (MIC) for this: install it using the instructions at http://wiki.meego.com/Image_Creation#Installation if you haven't already.

Run this command to chroot into the unpacked image:

$ sudo mic-chroot /path/to/chroot/dir

The output from running mic-chroot should look like this:

+====================================================================================+
| WARNING: this script is very dangerous, it may damage your system data,            |
| so please use it carefully and read this warning seriously.                        |
|                                                                                    |
| mic-chroot will create some temporary directories under /var/tmp, their names      |
| look like 'mic-tmp-*', mic-chroot also creates a directory to save image           |
| file system for chroot. For such directories, please use mic-rm-chroot-dir to      |
| remove, otherwise, you may remove your whole system by 'rm -rf <yourdir>' if you   |
| terminate mic-chroot because of some exceptions or unknown errors, the root        |
| cause is mic-chroot will bind mount / to chroot directory, exceptional             |
| terminations didn't unmount it, so you may damage your system, we have warned you. |
| Please use it very very carefully, and don't use 'rm -rf' for such directories,    |
| instead, use 'mic-rm-chroot-dir'                                                   |
+====================================================================================+


Launching shell. Exit to continue.
----------------------------------
bind_mount: /proc -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//proc
bind_mount: /proc/sys/fs/binfmt_misc -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//proc/sys/fs/binfmt_misc
bind_mount: /sys -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//sys
bind_mount: /dev -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//dev
bind_mount: /dev/pts -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//dev/pts
bind_mount: /dev/shm -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//dev/shm
bind_mount: /var/lib/dbus -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//var/lib/dbus
bind_mount: /var/run/dbus -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//var/run/dbus
bind_mount: / -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//parentroot
bind_mount: /lib/modules/2.6.33.8-149.fc13.i686 -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//lib/modules/2.6.33.8-149.fc13.i686
bind_mount: /lib/modules/2.6.34.6-54.fc13.i686 -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//lib/modules/2.6.34.6-54.fc13.i686
bind_mount: /lib/modules/2.6.35.3+ -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//lib/modules/2.6.35.3+
bind_mount: /lib/modules/2.6.34.7-56.fc13.i686 -> /home/ell/meego-netbook-ia32-1.1.80.1.20101012.1-chroot//lib/modules/2.6.34.7-56.fc13.i686

This is now a MeeGo chroot terminal. It behaves just like a terminal running in the MeeGo OS: paths, programs, libraries, and environment are all the same as those on a MeeGo OS netbook or handset.

Caution: If you later decide to delete the directory that you created, use mic-rm-chroot-dir to delete it. Otherwise the contents of the host file system may be destroyed.

$ sudo mic-rm-chroot-dir <image destination directory>

Install extra software (if building your own chroot)

You only need to follow these steps if you are creating your own chroot from a stock image.

You must do these steps once inside the chroot.

First, add the SDK tools repo to the chroot:

$ zypper addrepo http://repo.meego.com/MeeGo/sdk/target/repos/meego/1.1/ meego-sdk

Note that if you're using a different MeeGo image (for example, from Trunk), change the repo URL, replacing MeeGo_1.1 with the correct version for your image.

Then install the software using the instructions for your type of image, below.

Netbook extra software

$ zypper install meego-simulator-launcher-netbook

Handset extra software

$ zypper install meego-simulator-launcher-handset

Start the MeeGo UI with Xephyr

Launch Xephyr from inside the MeeGo chroot terminal with:

$ startmeego &

This starts the Xephyr server and runs a script to start the MeeGo UI.

MeeGo Handset UI in Xephyr
MeeGo Netbook UI in Xephyr

When you're done, stop Xephyr by closing the Xephyr window (click X in the upper corner).

Finally, exit the MeeGo chroot terminal with:

$ exit

This closes down any processes started inside the chroot and unmounts directories used by the chroot environment. The output should look something like this:

umount /home/ell/meego-sdk-0524/proc
umount /home/ell/meego-sdk-0524/sys
umount /home/ell/meego-sdk-0524/dev/pts
umount /home/ell/meego-sdk-0524/dev
umount /home/ell/meego-sdk-0524/tmp
umount /home/ell/meego-sdk-0524/var/lib/dbus
umount /home/ell/meego-sdk-0524/var/run/dbus

Running an image without GL acceleration

GL acceleration for MeeGo images under Xephyr only works on Intel graphics chipset. Images may run without it, but performance will be poor.

To identify your graphics chipset, run the following:

$ lspci | grep VGA
Example output:
Intel mobile:00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)
nVidia:08:00.0 VGA compatible controller: nVidia Corporation GT216 [GeForce GT 220] (rev a2)
ATI:01:00.0 VGA compatible controller: ATI Technologies Inc M22 [Mobility Radeon X300]

If you get an Intel Corporation chipset, GL acceleration should work.

There is also a known issue with the netbook UX running under Fedora Core 13, where GL acceleration causes the UX to truncate.

However, even if you can't start a MeeGo image in Xephyr with GL acceleration, you should be able to use the UX without acceleration. This can be done by editing the Xephyr start command in /usr/bin/startmeego-debug in the chroot. Change the line which starts Xephyr $DISP to the following:

Xephyr $DISP -host-cursor -screen 864x480 -notfp -nodri2 -ac &

Replace the -screen resolution with whatever is appropriate for the image you're running (use the existing Xephyr command as a basis). This disables GL acceleration in Xephyr, which will result in a slow, but just about usable, UX.

Another approach is to use the host's default Xephyr package, rather than the MeeGo SDK package, to run an image: this article explains how to do this on Ubuntu 10.04.

Regardless of whether you can run the UX, you can always use the chroot to run MeeGo applications run on your desktop, or compile MeeGo software. Go to Application Development, below, for more details.

Debugging Xephyr

If you are having issues running Xephyr, use the debug script to see what's happening:

startmeego-debug

This shows the console output from the script, which may give you some clues if it's not working correctly.

Installing other software into the chroot

You can install additional software into the MeeGo chroot environment. From the MeeGo chroot terminal:

$ zypper install <package>

You can also upgrade the whole MeeGo image using:

$ zypper dup

Application development

The MeeGo chroot terminal can be used to build, run, and debug your application. You can do this with or without Xephyr.

Running without Xephyr: If you run your application from the command-line, it will run normally on your workstation. Although it is not running inside the MeeGo OS UI, it is still using the MeeGo libraries. You can put temporary code in your application to manually set its window size to that of a netbook (1024x800) or handheld (800x480 or 480x800) device.

Running with Xephyr: If you have Xephyr running already, before you start your application from the command-line you need to set the $DISPLAY variable to :2 tell your application to display in the Xephyr window. Otherwise it will use the default DISPLAY value of :0 and show up on your workstation.

$ export DISPLAY=:2
$ <start your application>

Building your application in the MeeGo chroot terminal is the same as doing so on a MeeGo system. You can use gcc, emacs, or any other Linux development tools you are comfortable with. (See Developing with Qt Creator from the chroot, below.)

Source Code Management

Source code is often managed by a version control system and checked in/out on your host workstation. To have your source directory available within the MeeGo chroot, you can mount --bind your source directory to a subdirectory in the MeeGo chroot. From a terminal on your host workstation, outside the MeeGo chroot:

$ sudo mount --bind <full path to source directory on host workstation> <full path to MeeGo chroot directory>/<subdirectory in MeeGo>

For example, using the directories in the example above where the chroot folder is located at /opt/meego-handset, do the following:

$ sudo mkdir /opt/meego-handset/root/src      <-- Create a folder inside MeeGo to mount the source to
$ sudo mount --bind /home/bob/src/ /opt/meego-handset/root/src/

Caution: Be sure to unmount this directory when finished and before rm -rf /path/to/chroot/dir at some later date or your source directory will be destroyed.

Developing with Qt Creator from the chroot

Qt Creator is part of MeeGo. You can launch Qt Creator from the MeeGo chroot. The following will open Qt Creator IDE on your workstation (not in Xephyr):

$ export DISPLAY=:0
$ qtcreator

Simulator QtCreator splash.png

To setup the project:

  • Create a new project (File > New File or Project). Under Projects, select Qt Gui Application and click OK.
  • Enter helloworld for the name; choose a directory to save it to (such as /root if you're working as the root user). Click on Next.
  • Accept the defaults in the Class Information dialog box and click Next.
  • In the Project Management dialog box, click Finish.

Next write some code:

  • Open the Forms folder and double-click mainwindow.ui to open it in the graphical forms editor.
  • Drag a label from the list of widgets on the left-hand side of the forms editor and drop it into the editable area.
  • Change the text to something else ("Hello world" works well).
  • Put any other junk you like the look of in there.

Then configure the project:

  • Click on the Projects icon on the left of the Qt Creator window.
  • Configure the Qt version:
    • Under Build Settings > General, click on the More button. This displays the Qt version which will be used when building and running the project.
    • Click on the Manage button next to Qt Version. This displays the Qt Versions panel:
      Simulator QtCreator qt versions.png
    • Select the Qt in PATH entry.
    • Click on Rebuild to set up the Debugging Helper for this version of Qt.
    • Click OK to save your changes.
  • Make sure that the Qt Version is now set to Default Qt Version (Qt in PATH).
  • Next, configure the run environment to use the Simulator to display the application when it's running:
    • Click on the Run Settings tab.
    • Click on the More button under Run Environment.
    • Double-click in the text entry next to the Display variable; change :0.0 to :2. This tells Qt Creator to run the application on display number :2, the one which Xephyr is in control of.

Running a Qt Creator project inside Xephyr

Now you're all set to run the application.

First don't forget to generate the makefile (apply qmake).

From inside Qt Creator, click on the big green arrow (bottom-left corner) to run the application. This will build it first (using the Qt Version you set up) then run it on display :2 (inside the Xephyr simulated MeeGo desktop).

In the Xephyr window, you might need to click on the MyZone icon (the house icon) to reveal the application running behind it:

Simulator running meego app.png

Known issues with Xephyr

  • Panels which rely on DBus (like the battery, networking) don't report devices properly.
  • Applications that rely on DBus might work inconsistently because the host workstation's system bus is used.
Personal tools