Host-based development with Xoo and Xephyr

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Install Xoo on your host)
(Build an OpenMoko Image (Getting rootfs))
Line 48: Line 48:
 
{{todo|...}}
 
{{todo|...}}
  
== Build an OpenMoko Image (Getting rootfs) ==
+
==Building the OpenMoko applications==
First, you'll need to build an openmoko-devel-image and get rootfs. One good way to get started developing is getting rootfs working on host machine, since most of us don't have real hardware.
+
  
You should use [[MokoMakefile|Building OpenMoko using the MokoMakefile]] to build an openmoko-devel-image for your host architecture.
+
{{todo|...}}
 
+
Prior to running make openmoko-devel-image to get rootfs (before step 5) run :
+
# sed -i 's/fic-gta01/x86/' build/conf/local.conf
+
then just run make openmoko-devel-image. After a while (half a day) the build should complete.
+
 
+
You might need to add
+
TARGET_FPU = ""
+
to your build/conf/local.conf to avoid:
+
NOTE: <type 'exceptions.Exception'>:variable TARGET_FPU references itself! while evaluating:${TARGET_FPU}
+
errors.
+
=== Build issues ===
+
 
+
[http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=264 Please see this bug tracker issues] if you have problems getting libelf compiled (do_stage fails).
+
  
 
== Setup the Image Filesystem ==
 
== Setup the Image Filesystem ==

Revision as of 17:17, 11 December 2007

Please see Getting OpenMoko working on host with Xephyr which might contain more up-to-date information.

Contents

What is Host-based development

This term means you develop most of your application in your standard desktop environment until it's almost finished. Then you can use a Toolchain to cross-compile your application for the Neo1973. Host-based development is incredibly more efficient since you can use your (typically) fast computer, large monitor, etc.

What is Xoo

Xoo is a GTK2 based graphical wrapper around a ‘Windowed’ X Server. The X server is typically Xnest, the nested X server, or Xephyr. It is intended for embedded developers that want to simulate a target device (with an accurate display size, working hardware buttons, etc) on a desktop machine.

Xoo is not required to simulate OpenMoko hardware - it just improves the presentation

Prerequisites

Part I (precompiled software)

You need to install some software that is usually not present on a desktop system, but used on the Neo1973. Some of this software has already been precompiled by your friendly distribution packager, so you don't need to compile it yourself. Most likely you can install the following packages from your distribution repository:

  • xephyr
  • xoo
  • matchbox-window-manager
  • matchbox-keyboard
  • libgtk2.0-dev
  • libecal1.2-dev

Gentoo users run just

# emerge <package>

Debian/Ubuntu

$ sudo apt-get install <package>

For Fedora, you can use

# yum install <package>

For Mandriva, you may try

# urpmi <package>

for any other find a way how to do it in your distro.

Part II (building from source)

You also need some software that is typically not found in your distribution repository, either because it's too new, too specific, or unheard of.

Most likely you will need to compile the following packages for your distribution:

  • matchbox-panel-2
  • libjana
  • libipkg

Here are the instructions to do this:

TODO: ... (See: To-Do List)

Building the OpenMoko applications

TODO: ... (See: To-Do List)

Setup the Image Filesystem

The filesystem of the image can be found at build/tmp/rootfs . It is that image that we want to run in a chrooted environment.

This image should also be packed/compressed as the file openmoko-devel-image-x86-$(DATE).rootfs.tar.gz in build/tmp/image/ - mine is here [1].

Making X cooperate

  • Make sure your iptables do not prevent you from connecting to port 6000(x11) on localhost
  • Make sure your X is listening on port 6000(X11) on localhost (netstat is friend)
  • Enable conection from localhost
# xhost localhost

Preparing rootfs

Unpack the rootfs file and copy the contents into a directory called /home/moko/mokobox. This will be our chrooted environment.

make sure /dev of the host machine are visible from within mokobox

# sudo mount --bind /dev/ /home/moko/mokobox/dev

Start/Move into the protected mokobox environment

# sudo chroot /home/moko/mokobox /bin/sh

Starting the nested X server

Launch Xoo

In another terminal (not related to mokobox), start Xoo. Download [2] and run for a nice neo 1973 theme.

# xoo --device neo1973.xml

Using Xnest without xoo

If you don't want to use xoo (perhaps you don't have the required resolutions to display the large image) you can use Xnest on its own,

# Xnest :1 -dpi 283 -geometry 480x640+86+295

(if you get "Xnest: client 1 rejected from IP 127.0.0.1", try running Xnest with the -ac flag)

Start X Client

Now, back in chroo'ted environment, start X client:

Export display to connect to started xoo

# export DISPLAY=localhost:1.0

Start window manager.

# x-window-manager

By this time you should have Xnest & Xoo running OpenMoko in a window.


Set your theme to OpenMoko

If you find that graphics within Xnest & xoo are broken, try the following:

  • Add a user and group 'messagebus', on some systems by adduser, on others by editing /etc/passwd and /etc/group)
  • Start dbus:
 /etc/init.d/dbus-1 start
  • Register pango modules
 pango-querymodules > /etc/pango/pango.modules
  • Set the GTK2_RC_FILES variable before running OpenMoko applications:
 export GTK2_RC_FILES=$OPENMOKODIR/artwork/themes/openmoko-standard/gtk-2.0/gtkrc

Or edit $HOME/.gtkrc-2.0 to something like this:

 include "/home/moko/openmoko/trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc"

However, this will make all Gtk2 apps run with the OpenMoko theme.

Personal tools

Please see Getting OpenMoko working on host with Xephyr which might contain more up-to-date information.

What is Host-based development

This term means you develop most of your application in your standard desktop environment until it's almost finished. Then you can use a Toolchain to cross-compile your application for the Neo1973. Host-based development is incredibly more efficient since you can use your (typically) fast computer, large monitor, etc.

What is Xoo

Xoo is a GTK2 based graphical wrapper around a ‘Windowed’ X Server. The X server is typically Xnest, the nested X server, or Xephyr. It is intended for embedded developers that want to simulate a target device (with an accurate display size, working hardware buttons, etc) on a desktop machine.

Xoo is not required to simulate OpenMoko hardware - it just improves the presentation

Prerequisites

Part I (precompiled software)

You need to install some software that is usually not present on a desktop system, but used on the Neo1973. Some of this software has already been precompiled by your friendly distribution packager, so you don't need to compile it yourself. Most likely you can install the following packages from your distribution repository:

  • xephyr
  • xoo
  • matchbox-window-manager
  • matchbox-keyboard
  • libgtk2.0-dev
  • libecal1.2-dev

Gentoo users run just

# emerge <package>

Debian/Ubuntu

$ sudo apt-get install <package>

For Fedora, you can use

# yum install <package>

For Mandriva, you may try

# urpmi <package>

for any other find a way how to do it in your distro.

Part II (building from source)

You also need some software that is typically not found in your distribution repository, either because it's too new, too specific, or unheard of.

Most likely you will need to compile the following packages for your distribution:

  • matchbox-panel-2
  • libjana
  • libipkg

Here are the instructions to do this:

TODO: ... (See: To-Do List)

Build an OpenMoko Image (Getting rootfs)

First, you'll need to build an openmoko-devel-image and get rootfs. One good way to get started developing is getting rootfs working on host machine, since most of us don't have real hardware.

You should use Building OpenMoko using the MokoMakefile to build an openmoko-devel-image for your host architecture.

Prior to running make openmoko-devel-image to get rootfs (before step 5) run :

# sed -i 's/fic-gta01/x86/' build/conf/local.conf

then just run make openmoko-devel-image. After a while (half a day) the build should complete.

You might need to add

TARGET_FPU = ""

to your build/conf/local.conf to avoid:

NOTE: <type 'exceptions.Exception'>:variable TARGET_FPU references itself! while evaluating:${TARGET_FPU}

errors.

Build issues

Please see this bug tracker issues if you have problems getting libelf compiled (do_stage fails).

Setup the Image Filesystem

The filesystem of the image can be found at build/tmp/rootfs . It is that image that we want to run in a chrooted environment.

This image should also be packed/compressed as the file openmoko-devel-image-x86-$(DATE).rootfs.tar.gz in build/tmp/image/ - mine is here [1].

Making X cooperate

  • Make sure your iptables do not prevent you from connecting to port 6000(x11) on localhost
  • Make sure your X is listening on port 6000(X11) on localhost (netstat is friend)
  • Enable conection from localhost
# xhost localhost

Preparing rootfs

Unpack the rootfs file and copy the contents into a directory called /home/moko/mokobox. This will be our chrooted environment.

make sure /dev of the host machine are visible from within mokobox

# sudo mount --bind /dev/ /home/moko/mokobox/dev

Start/Move into the protected mokobox environment

# sudo chroot /home/moko/mokobox /bin/sh

Starting the nested X server

Launch Xoo

In another terminal (not related to mokobox), start Xoo. Download [2] and run for a nice neo 1973 theme.

# xoo --device neo1973.xml

Using Xnest without xoo

If you don't want to use xoo (perhaps you don't have the required resolutions to display the large image) you can use Xnest on its own,

# Xnest :1 -dpi 283 -geometry 480x640+86+295

(if you get "Xnest: client 1 rejected from IP 127.0.0.1", try running Xnest with the -ac flag)

Start X Client

Now, back in chroo'ted environment, start X client:

Export display to connect to started xoo

# export DISPLAY=localhost:1.0

Start window manager.

# x-window-manager

By this time you should have Xnest & Xoo running OpenMoko in a window.


Set your theme to OpenMoko

If you find that graphics within Xnest & xoo are broken, try the following:

  • Add a user and group 'messagebus', on some systems by adduser, on others by editing /etc/passwd and /etc/group)
  • Start dbus:
 /etc/init.d/dbus-1 start
  • Register pango modules
 pango-querymodules > /etc/pango/pango.modules
  • Set the GTK2_RC_FILES variable before running OpenMoko applications:
 export GTK2_RC_FILES=$OPENMOKODIR/artwork/themes/openmoko-standard/gtk-2.0/gtkrc

Or edit $HOME/.gtkrc-2.0 to something like this:

 include "/home/moko/openmoko/trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc"

However, this will make all Gtk2 apps run with the OpenMoko theme.