Meego Wiki
Views

SDK/Docs/1.0/MeeGo SDK with Xephyr

From MeeGo wiki
< SDK | Docs | 1.0(Difference between revisions)
Jump to: navigation, search
(Related Articles)
 
(47 intermediate revisions not shown)
Line 1: Line 1:
The MeeGo SDK with Xephyr provides a development environment on Linux workstations for Netbook and Handheld applications.  
The MeeGo SDK with Xephyr provides a development environment on Linux workstations for Netbook and Handheld applications.  
 +
 +
== Set up the MeeGo SDK with Xephyr ==
<ol>
<ol>
-
<li>Check for Intel graphics chipset</li>
+
<li>Download the MeeGo SDK Image for your target as described on the [[SDK/Docs/1.1/Getting started with the MeeGo SDK for Linux|Getting Started for Linux]] page.</li>
-
To identify your graphics chipsetrun the following:
+
<li> Unpack the image on your workstation. </li>
-
$ lspci | grep VGA
+
  $ tar xvjf <compressed image file>  
-
<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 your system does not have Intel graphics, see the [http://wiki.meego.com/MeeGo_SDK_Development_Options other SDK options].
+
-
<li>Download the MeeGo SDK Image for your target as described on the [http://wiki.meego.com/Getting_started_with_the_MeeGo_SDK_for_Linux_new Getting Started] page.</li>
+
<li>Install the meego-sdk-chroot script.</li>
-
<li>Install the meego-sdk-chroot script</li>
+
The ''meego-sdk-chroot'' script sets up mountpoints for the chroot environment, then starts the chroot proper. The script also attempts to unmount everything when it exits and clear up any processes started in the chroot. Get it with:
-
The ''meego-sdk-chroot'' script sets up mountpoints for the chroot environment, then starts the chroot proper; it also attempts to unmount everything when it exits and clear up any processes started in the chroot. Get it with:
+
-
  wget http://download3.meego.com/meego-sdk-chroot
+
  $ wget http://download3.meego.com/meego-sdk-chroot
Make the chroot script executable:
Make the chroot script executable:
-
  chmod +x meego-sdk-chroot
+
  $ chmod +x ./meego-sdk-chroot
-
Move it to ''/usr/bin'':
+
<li>Configure X on the host to allow Xephyr to access the display</li>
 +
$ xhost +SI:localuser:<user name>
 +
Example for user named "bob":
 +
$ xhost +SI:localuser:bob
-
sudo mv meego-sdk-chroot /usr/bin
+
(You need to do this once before running Xephyr or Qt Creator after each reboot)
-
== Configure the host ready for the Simulator ==
+
<li>Mount and "Change root" into the MeeGo image.</li>
-
Next, configure X on the host machine to enable the Simulator (running from the chroot) to access the display of the normal user:
+
Create a directory for the MeeGo image contents:
 +
$ mkdir <image destination directory>
-
  xhost +SI:localuser:usernametogiveaccesstogoeshere
+
Mount the image into the directory:
 +
  $ sudo mount -o loop,offset=512 <image file> <image destination directory>
-
(You need to do this once before running the Simulator or Qt Creator after each reboot. Please replace "usernametogiveaccesstogoeshere" with the name of the
+
Change the root of the terminal to the MeeGo OS root:
-
user who you're going to run Xephyr as here.)
+
$ sudo ./meego-sdk-chroot <image destination directory>
-
== Enter the MeeGo chroot environment ==
+
Example:
-
 
+
$ sudo mkdir /opt/meego-handset
-
The ''meego-sdk-chroot'' script sets up a MeeGo chroot environment and drops you into a shell inside it:
+
  $ sudo mount -o loop,offset=512 ./meego-handset-ia32-1.0.80.9.20100706.1-sdk-pre0721.raw /opt/meego-handset
-
 
+
$ sudo ./meego-sdk-chroot /opt/meego-handset
-
  sudo meego-sdk-chroot ~/meego-sdk-0524
+
-
 
+
-
(replace ''~/meego-sdk-0524'' with the path to the chroot directory)
+
-
 
+
-
Note that this uses the ''chroot'' command, which may not be on root's PATH (on Fedora the chroot command is in ''/usr/sbin''). You can fix this by adding an alias to the top of the ''meego-sdk-chroot'' script:
+
-
 
+
-
alias chroot='/usr/sbin/chroot'
+
-
 
+
-
The output from running the script should look like this:
+
 +
The output from running meego-sdk-chroot should look like this:
<pre>
<pre>
mount --bind /proc /home/ell/meego-sdk-0524/proc
mount --bind /proc /home/ell/meego-sdk-0524/proc
Line 59: Line 50:
mount --bind /var/run/dbus /home/ell/meego-sdk-0524/var/run/dbus
mount --bind /var/run/dbus /home/ell/meego-sdk-0524/var/run/dbus
cp /etc/resolv.conf /home/ell/meego-sdk-0524/etc/resolv.conf
cp /etc/resolv.conf /home/ell/meego-sdk-0524/etc/resolv.conf
-
root@meego-netbook-sdk:/#
+
root@meego-handset-sdk:/#
</pre>
</pre>
-
=== Installing other software ===
+
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.
-
It's possible to install software from the standard locations (at least it is in netbook images) into the chroot.
+
'''Caution:'''  If you later decide to delete the directory that you created, you should unmount the image first.  Otherwise the contents of the image will be destroyed.
 +
$ sudo umount <image destination directory>
-
[[#Enter the MeeGo chroot environment | Enter the chroot]], then run:
+
Note: ''meego-sdk-chroot'' uses the ''chroot'' command.  Be sure it is in your path or create an alias:
 +
$ alias chroot='/usr/sbin/chroot'
 +
</ol>
-
zypper install <package>
+
== Start the MeeGo UI with Xephyr ==
 +
<ol>
 +
<li>Check for Intel graphics chipset.</li>
 +
$ lspci | grep VGA
 +
Desired output:  00:02.0 VGA compatible controller: '''Intel Corporation''' ...
-
It should also be possible to upgrade the whole MeeGo image using:
+
If your system does not have Intel graphics, you cannot start Xephyr with the MeeGo image.  However, you can still use the chroot to launch your applications which will run on the desktop.  Go to "Application Development" below.
 +
<li>Set the DISPLAY environment variable.</li>
 +
Xephyr does not see DISPLAY env variable from host system because Xephyr is running from the MeeGo chroot terminal. In the MeeGo chroot terminal, set the DISPLAY variable before running the ''startmeego'' script below.
-
  zypper dist-upgrade
+
  # export DISPLAY=:0
-
=== Setting host display before running Simulator ===
+
<li>Install the MeeGo simulator launcher (not always needed).</li>
 +
The handset SDK has the MeeGo simulator launcher pre-installed, but for some reason the handset sdk doesn't seem to have it installed. So, in the handset SDK, first you want to do the following from inside the MeeGo chroot terminal:
 +
# zypper install meego-simulator-launcher-handset
-
Xephyr does not see DISPLAY env variable from host system since it is running as chroot.
+
<li>Launch Xephyr.</li>
-
As chroot, set DISPLAY variable before running "startmeego" that calls Xephyr.
+
From inside the MeeGo chroot terminal:
 +
# startmeego &
-
export DISPLAY=:0
+
This starts the Xephyr server and runs a script to start the MeeGo UI.
-
== Run the Simulator ==
+
<table><tr><td>[[File:qemu-handset.jpg|thumb|MeeGo Handset UI in Xephyr]]</td>
 +
          <td>[[File:qemu-netbook.jpg|thumb|MeeGo Netbook UI in Xephyr]]</td>
 +
</tr></table>
-
From inside the chroot, '''as root''' do:
+
<li>Exit the Simulator.</li>
-
  startmeego &
+
You can stop Xephyr by closing the Xephyr window (click X in the upper corner). You can 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:
 +
<pre>
 +
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
 +
</pre>
 +
</ol>
 +
=== Debugging the Simulator ===
 +
If you are having issues running Xephyr, use the debug script to see what's happening:
-
This starts the Xephyr server then runs a script to boot the MeeGo desktop into it.
+
startmeego-debug
-
Note: Currently, the simulator runs only on host systems with an Intel integrated graphics controller. It does not run with ATI or NVIDIA graphics controllers.
+
This shows the console output from the script, which may give you some clues if it's not working correctly.
-
If you want to run applications from the chroot and have them display in the Simulator window, you can do:
+
== Application Development ==
 +
The MeeGo chroot terminal can be used to build, run, and debug your application.  You can do this with or without Xephyr. 
-
DISPLAY=:2 glxgears
+
'''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.
-
(replacing ''glxgears'' with the command you want to run).
+
'''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 Qt Creator use below).
-
=== Debugging the Simulator ===
+
=== 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 /opt/meego-handset" at some later date or your source directory will be destroyed.
-
If you are having issues with the Simulator, use the debug script to see what's happening:
+
=== Qt Creator IDE ===
 +
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
 +
From Qt Creator you can now load your project, build, run, and debug it as you would normally.
-
  startmeego-debug
+
== Installing other software ==
 +
You can install additional software into the MeeGo chroot environment. From the MeeGo chroot terminal:
-
This shows the console output from the script, which may give you some clues if it's not working correctly.
+
# zypper install <package>
-
=== Netbook UX in the Simulator ===
+
You can also upgrade the whole MeeGo image using:
-
Here's what it looks like:
+
# zypper dist-upgrade
-
[[File:Simulator_running_netbook_ux.png]]
+
== Known issues ==
-
 
+
-
<table><tr><td>[[File:qemu-handset.jpg|thumb|MeeGo Handset UI in QEMU]]</td>
+
-
          <td>[[File:qemu-netbook.jpg|thumb|MeeGo Netbook UI in QEMU]]</td>
+
-
</tr></table>
+
-
 
+
-
Known issues:
+
 +
* Currently Xephyr with GL acceleration does not work with Fedora 13.
* 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.
-
== Stop the Simulator ==
+
== Another language version of this page ==
-
To stop the Simulator, just exit the chroot shell with:
+
* [[SDK/Docs/1.0/配置 MeeGo Xephyr 环境|Simplified Chinese - 简体中文]]
-
exit
+
== Related Articles ==
-
This closes down any processes started inside the Simulator and unmounts directories used by the chroot environment. The output should look something like this:
+
* A nice [http://wiki.forum.nokia.com/index.php/Qt_MeeGo_handset_SDK_how_to_install_and_use_on_Linux_Ubuntu_10.04_LTS article] explaining some extra details to get the Meego SDK working with non-Intel Graphic cards, using Xephyr without GL acceleration.
-
 
+
-
<pre>
+
-
exit
+
-
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
+
-
</pre>
+
-
 
+
-
== Another language version of this page ==
+
-
* [[在 Linux 上使用 MeeGo SDK|Simplified Chinese - 简体中文]]
+
[[Category:SDK]]
 +
[[Category:Tutorial]]
 +
[[Category:Linux]]
 +
[[Category:Meego-1.0]]

Latest revision as of 22:12, 24 June 2011

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

Contents

Set up the MeeGo SDK with Xephyr

  1. Download the MeeGo SDK Image for your target as described on the Getting Started for Linux page.
  2. Unpack the image on your workstation.
  3. $ tar xvjf <compressed image file> 
    
  4. Install the meego-sdk-chroot script.
  5. The meego-sdk-chroot script sets up mountpoints for the chroot environment, then starts the chroot proper. The script also attempts to unmount everything when it exits and clear up any processes started in the chroot. Get it with:

    $ wget http://download3.meego.com/meego-sdk-chroot
    

    Make the chroot script executable:

    $ chmod +x ./meego-sdk-chroot
    
  6. Configure X on the host to allow Xephyr to access the display
  7. $ 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)

  8. Mount and "Change root" into the MeeGo image.
  9. Create a directory for the MeeGo image contents:

    $ mkdir <image destination directory>
    

    Mount the image into the directory:

    $ sudo mount -o loop,offset=512 <image file> <image destination directory>
    

    Change the root of the terminal to the MeeGo OS root:

    $ sudo ./meego-sdk-chroot <image destination directory>
    

    Example:

    $ sudo mkdir /opt/meego-handset
    $ sudo mount -o loop,offset=512 ./meego-handset-ia32-1.0.80.9.20100706.1-sdk-pre0721.raw /opt/meego-handset
    $ sudo ./meego-sdk-chroot /opt/meego-handset
    

    The output from running meego-sdk-chroot should look like this:

    mount --bind /proc /home/ell/meego-sdk-0524/proc
    mount --bind /sys /home/ell/meego-sdk-0524/sys
    mount --bind /dev /home/ell/meego-sdk-0524/dev
    mount --bind /dev/pts /home/ell/meego-sdk-0524/dev/pts
    mount --bind /tmp /home/ell/meego-sdk-0524/tmp
    mount --bind /var/lib/dbus /home/ell/meego-sdk-0524/var/lib/dbus
    mount --bind /var/run/dbus /home/ell/meego-sdk-0524/var/run/dbus
    cp /etc/resolv.conf /home/ell/meego-sdk-0524/etc/resolv.conf
    root@meego-handset-sdk:/#
    

    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, you should unmount the image first. Otherwise the contents of the image will be destroyed.

    $ sudo umount <image destination directory>
    

    Note: meego-sdk-chroot uses the chroot command. Be sure it is in your path or create an alias:

    $ alias chroot='/usr/sbin/chroot'
    

Start the MeeGo UI with Xephyr

  1. Check for Intel graphics chipset.
  2. $ lspci | grep VGA
    

    Desired output: 00:02.0 VGA compatible controller: Intel Corporation ...

    If your system does not have Intel graphics, you cannot start Xephyr with the MeeGo image. However, you can still use the chroot to launch your applications which will run on the desktop. Go to "Application Development" below.

  3. Set the DISPLAY environment variable.
  4. Xephyr does not see DISPLAY env variable from host system because Xephyr is running from the MeeGo chroot terminal. In the MeeGo chroot terminal, set the DISPLAY variable before running the startmeego script below.

    # export DISPLAY=:0
    
  5. Install the MeeGo simulator launcher (not always needed).
  6. The handset SDK has the MeeGo simulator launcher pre-installed, but for some reason the handset sdk doesn't seem to have it installed. So, in the handset SDK, first you want to do the following from inside the MeeGo chroot terminal:

    # zypper install meego-simulator-launcher-handset
    
  7. Launch Xephyr.
  8. From inside the MeeGo chroot terminal:

    # 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
  9. Exit the Simulator.
  10. You can stop Xephyr by closing the Xephyr window (click X in the upper corner). You can 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
    

Debugging the Simulator

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.

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 Qt Creator use 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 /opt/meego-handset" at some later date or your source directory will be destroyed.

Qt Creator IDE

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

From Qt Creator you can now load your project, build, run, and debug it as you would normally.

Installing other software

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 dist-upgrade

Known issues

  • Currently Xephyr with GL acceleration does not work with Fedora 13.
  • 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.

Another language version of this page

Related Articles

  • A nice article explaining some extra details to get the Meego SDK working with non-Intel Graphic cards, using Xephyr without GL acceleration.
Personal tools