Meego Wiki
Views

SDK/Docs/1.0/配置 MeeGo Xephyr 环境

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(Setup the MeeGo SDK with Xephyr)
(Start the MeeGo UI with Xephyr)
Line 65: Line 65:
</ol>
</ol>
-
== Start the MeeGo UI with Xephyr ==
+
== 在Xephyr环境中启动MeeGo UI ==
<ol>
<ol>
-
<li>Set the DISPLAY environment variable</li>
+
<li>设置DISPLAY环境变量</li>
-
Xephyr does not see DISPLAY env variable from host system since Xephyr is running from the MeeGo chroot terminal. In the MeeGo chroot terminal, set the DISPLAY variable before running the ''startmeego'' script below.
+
因为Xephyr是在chroot终端中运行的,因此无法获得主机DISPLAY环境变量的值. 在MeeGo chroot终端中运行''startmeego''脚本前,使用以下命令设置DISPLAY的值.
  # export DISPLAY=:0
  # export DISPLAY=:0
-
<li>Launch Xephyr</li>
+
<li>启动 Xephyr</li>
-
From inside the MeeGo chroot terminal:
+
从MeeGo chroot终端命令下执行:
  # startmeego &
  # startmeego &
-
This starts the Xephyr server and runs a script to start the MeeGo UI.
+
这会启动Xephyr服务器并且调用其它脚本启动MeeGo UI.
-
<table><tr><td>[[File:qemu-handset.jpg|thumb|MeeGo Handset UI in Xephyr]]</td>
+
<table><tr><td>[[File:qemu-handset.jpg|thumb|运行在Xephyr中的手机MeeGo界面]]</td>
-
           <td>[[File:qemu-netbook.jpg|thumb|MeeGo Netbook UI in Xephyr]]</td>
+
           <td>[[File:qemu-netbook.jpg|thumb|运行在Xephyr中的上网本MeeGo界面]]</td>
</tr></table>
</tr></table>
-
<li>Exit the Simulator</li>
+
<li>退出模拟器/li>
-
You can stop Xephyr by closing the Xephyr window (click X in the upper corner). You can exit the MeeGo chroot terminal with:
+
你可以通过直接关闭Xephyr窗口(点击左上角的X按钮)停止Xephyr服务.并在MeeGo Chroot终端中输入exit退出MeeGo:
  # exit
  # 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:
+
这将关闭在chroot中启动的所有进程,并且卸载因chroot环境中需要而挂载的目录. 此时输出应该是如下这个样子的:
<pre>
<pre>
umount /home/ell/meego-sdk-0524/proc
umount /home/ell/meego-sdk-0524/proc
Line 97: Line 97:
</pre>
</pre>
</ol>
</ol>
 +
== Debugging the Simulator ==
== Debugging the Simulator ==
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:

Revision as of 09:36, 30 August 2010

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

Contents

配置MeeGo SDK的Xephyr运行环境

  1. 查验主机是否包含Intel图形芯片组
  2. $ lspci | grep VGA
    

    预期输出: 00:02.0 VGA compatible controller: Intel Corporation ...

    如果你的系统不含Intel图形芯片组, 请参考 MeeGo可用的SDK开发选项.

  3. 按照Getting Started 文中的描述下载你目标平台对应的MeeGo SDK.
  4. 解压下载的映像文件到工作目录
  5. $ tar xvjf <compressed image file> 
    
  6. 安装meego-sdk-chroot脚本
  7. meego-sdk-chroot脚本负责设置chroot环境的挂载点,并正确地启动chroot. 该脚本在退出时会卸载在启动时挂载的所有内容并清除启动时加载的所有进程. 如下命令可以下载此脚本:

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

    为meego-sdk-chroot脚本增加可执行权限:

    $ chmod +x ./meego-sdk-chroot
    
  8. 配置主机上的X允许Xephyr可以访问其显示区(allow Xephyr to access the display)
  9. $ xhost +SI:localuser:<user name>
    

    允许用户"bob"访问X显示区的例子:

    $ xhost +SI:localuser:bob
    

    (如果你的主机重启了,那么在运行Xephyr或Qt Creator前,需要再一次运行xhost命令)

  10. 挂载并切换根目录(chroot)到MeeGo映像
  11. 建立一个目录用于挂载MeeGo映像:

    $ mkdir <image destination directory>
    

    将Meego映像挂载到新建的目录上:

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

    切换系统的终端根目录(chroot)到MeeGo系统的根目录上:

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

    例子:

    $ 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
    

    在执行meego-sdk-chroot后,你看到的终端输出会是如下的一些内容:

    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:/#
    

    此时你已进入MeeGo 终端. 它仿如运行在真正的MeeGo操作系统里,路径,程序,库,环境这些都和你在MeeGo上网本或手机中看到的一模一样.

    提示: meego-sdk-chroot会用到chroot命令.请确保你的PATH路径中包含了chroot命令:

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

在Xephyr环境中启动MeeGo UI

  1. 设置DISPLAY环境变量
  2. 因为Xephyr是在chroot终端中运行的,因此无法获得主机DISPLAY环境变量的值. 在MeeGo chroot终端中运行startmeego脚本前,使用以下命令设置DISPLAY的值.

    # export DISPLAY=:0
    
  3. 启动 Xephyr
  4. 从MeeGo chroot终端命令下执行:

    # startmeego &
    

    这会启动Xephyr服务器并且调用其它脚本启动MeeGo UI.

    运行在Xephyr中的手机MeeGo界面
    运行在Xephyr中的上网本MeeGo界面
  5. 退出模拟器/li> 你可以通过直接关闭Xephyr窗口(点击左上角的X按钮)停止Xephyr服务.并在MeeGo Chroot终端中输入exit退出MeeGo: # exit 这将关闭在chroot中启动的所有进程,并且卸载因chroot环境中需要而挂载的目录. 此时输出应该是如下这个样子的:
    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

Your MeeGo application can be built and run from the MeeGo chroot terminal. By default, your application UI will display in a new window on your desktop. To configure your application to show up inside the MeeGo UI in Xephyr, start your application as follows in the MeeGo chroot terminal:

# DISPLAY=:2 <your application>

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

  • Panels which rely on DBus (like the battery, networking) don't report devices properly.

英文原文



Personal tools