Host-based development with Xoo and Xephyr

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Build an OpenMoko Image (Getting rootfs))
(Part II (building from source))
 
(50 intermediate revisions by 15 users not shown)
Line 1: Line 1:
Please see [[Getting OpenMoko working on host with Xephyr]] which might contain more up-to-date information.
+
This page introduces you to the most efficient way to create new software for the Openmoko platform. Note that there is a VMware image where this environment has been prebuilt for you.
 +
''Does anyone know where to find this VMWare image??''
  
== What is Host-based development ==
+
==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.
+
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, ... Compiling for your host also means that your edit-run-debug turnaround cycles are much faster, because you can skip the uploading-to-neo step.
  
== What is Xoo ==
+
==Xoo and Xephyr==
 
[http://projects.o-hand.com/xoo/ Xoo] is a GTK2 based graphical wrapper around a ‘Windowed’ X Server.  The X server is typically '''Xnest''', the nested X server, or [http://projects.o-hand.com/xephyr 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.  
 
[http://projects.o-hand.com/xoo/ Xoo] is a GTK2 based graphical wrapper around a ‘Windowed’ X Server.  The X server is typically '''Xnest''', the nested X server, or [http://projects.o-hand.com/xephyr 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''
+
Note that Xoo is not required to simulate Openmoko hardware - it just improves the presentation.
  
 
==Prerequisites==
 
==Prerequisites==
Line 16: Line 17:
 
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:
 
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
+
* gtk-doc-tools
* xoo
+
* libstartup-notification0-dev
* matchbox-window-manager
+
* libapm-dev
* matchbox-keyboard
+
* libgpgme11-dev
 
* libgtk2.0-dev
 
* libgtk2.0-dev
 +
* libebook1.2-dev
 
* libecal1.2-dev
 
* libecal1.2-dev
 +
* libnotify-dev
 +
* libpulse-dev
 +
* libcurl4-openssl-dev (or libcurl4-gnutls-dev)
 +
* matchbox-window-manager
 +
* matchbox-keyboard
 +
* pulseaudio
 +
* xephyr ( package is called xserver-xephyr on ubuntu and debian )
 +
* xoo
 +
 +
 +
Ubuntu-Specific Packages
 +
* gnome-common (does this belong above?)
 +
* ubuntu-mobile-dev (this depends on many other development packages; some are necessary, others optional)
 +
 +
 +
Other Useful Packages
 +
* libasound2-dev (needed to compile openmoko-dialer2 ([[User:Tomjoad]]))
 +
  
 
Gentoo users run just
 
Gentoo users run just
 
  # emerge <package>
 
  # emerge <package>
 +
 +
''note'': To get the Xephyr package installed Gentoo users have to rebuild the x11-base/xorg-server package with the "kdrive" use flag enabled ([http://gentoo-wiki.com/Scratchbox#Xephyr_support link])
 +
 +
 
Debian/Ubuntu
 
Debian/Ubuntu
 
  $ sudo apt-get install <package>
 
  $ sudo apt-get install <package>
Line 44: Line 68:
 
* libipkg
 
* libipkg
  
Here are the instructions to do this:
+
To compile and install matchbox-panel-2:
  
{{todo|...}}
+
mkdir -f /local/pkg/ohand
 +
cd /local/pkg/ohand
 +
svn co http://svn.o-hand.com/repos/matchbox/trunk matchbox
 +
cd matchbox/matchbox-panel-2
 +
./autogen.sh
 +
make
 +
sudo make install
  
==Building the OpenMoko applications==
+
To compile and install libjana:
  
{{todo|...}}
+
mkdir -f /local/pkg/ohand
 +
cd /local/pkg/ohand
 +
svn co http://svn.o-hand.com/repos/jana/trunk jana
 +
cd jana
 +
./autogen.sh
 +
make
 +
sudo make install
  
== Setup the Image Filesystem ==
+
To compile and install libipkg:
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 [http://www.ms.mff.cuni.cz/~kupem6am/openmoko-devel-image-x86-20070227064250.rootfs.tar.gz].
+
mkdir -f /local/pkg/handhelds.org
 +
cd /local/pkg/handhelds.org
 +
wget http://downloads.openmoko.org/developer/sources/ipkg-0.99.163.tar.gz
 +
tar xzf ipkg-0.99.163.tar.gz
 +
cd ipkg-0.99.163
 +
./configure
 +
make
 +
sudo make install
  
=== Making X cooperate ===
+
==Building the Openmoko core==
* 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)
+
First we download the Openmoko subversion repository:
  
* Enable conection from localhost
+
  mkdir -f /local/pkg/openmoko
# xhost localhost
+
  cd /local/pkg/openmoko
 +
  svn co http://svn.openmoko.org/trunk/src src
  
===  Preparing rootfs ===
+
Then you compile the software contained there, e.g. you will definitely want to compile at least:
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
+
In directory src/target/:
# sudo mount --bind /dev/ /home/moko/mokobox/dev
+
* [http://svnweb.openmoko.org/trunk/src/target/gsm/ gsmd]
 +
* [http://svnweb.openmoko.org/trunk/src/target/opkg/ opkg]
  
Start/Move into the protected mokobox environment
+
In directory src/target/OM-2007.2/artwork:
# sudo chroot /home/moko/mokobox /bin/sh
+
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/artwork/icons/ icons]
  
==  Starting the nested X server ==
+
In directory src/target/OM-2007.2/libraries/:
=== Launch Xoo ===
+
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/libraries/libmokoui2/ libmokoui2]
In another terminal (not related to mokobox), start Xoo. Download [http://www.datenfreihafen.org/~stefan/OpenMoko/neo1973-xoo-device.tar.bz2] and run for a nice neo 1973 theme.
+
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/libraries/libmokopanelui2/ libmokopanelui2]
# xoo --device neo1973.xml
+
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/libraries/libmokojournal2/ libmokojournal2]
 +
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/libraries/libmokogsmd2/ libmokogsmd2]
  
=== Using Xnest without xoo ===
+
In directory src/target/OM-2007.2/daemons/:
 +
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/daemons/neod/ neod]
  
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,
+
In directory src/target/OM-2007.2/panel-plugins/:
 +
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-gsm/ openmoko-panel-gsm]
 +
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-usb/ openmoko-panel-usb]
 +
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-battery/ openmoko-panel-battery]
 +
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-gps/ openmoko-panel-gps]
 +
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-bt/ openmoko-panel-bt]
  
# Xnest :1 -dpi 283 -geometry 480x640+86+295
+
In directory src/target/OM-2007.2/applications:
(if you get "Xnest: client 1 rejected from IP 127.0.0.1", try running Xnest with the -ac flag)
+
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/applications/openmoko-today2/ openmoko-today2]
 +
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ openmoko-dialer2]
 +
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/applications/openmoko-calculator2/ openmoko-calculator2]
 +
* [http://svnweb.openmoko.org/trunk/src/target/OM-2007.2/applications/openmoko-appmanager2/ openmoko-appmanager2]
  
=== Start X Client ===
+
Each of these packages can be compiled with the well-known-triple of:
Now, back in chroo'ted environment, start X client: <br /><br />
+
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.
+
  
 +
./configure (or ./autogen.sh, if it's the first time)
 +
make
 +
make install
  
=== Set your theme to OpenMoko ===
+
==Data files==
  
If you find that graphics within Xnest & xoo are broken, try the following:
+
Some of the data files are not yet installed. We will create links so that Openmoko finds the data files and uses them directly from the svn directories that you have checked out. To create the links:
* 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
+
   mkdir /usr/local/share/matchbox
 +
  cd /usr/local/share/matchbox
 +
  sudo ln -s /local/pkg/openmoko/src/target/OM-2007.2/misc/openmoko-today2-folders vfolders
  
* Register pango modules
+
  cd /usr/share/themes
 +
  sudo ln -s /local/pkg/openmoko/src/target/OM-2007.2/artwork/themes/openmoko-standard-2
  
  pango-querymodules > /etc/pango/pango.modules
+
==Starting the nested Openmoko==
  
* Set the GTK2_RC_FILES variable before running OpenMoko applications:
+
We have prepared a script for you that starts Xoo and all the necessary X clients in one run. The script is online at
 +
* [http://svnweb.openmoko.org/trunk/src/host/xoo/om-launch om-launch]
  
  export GTK2_RC_FILES=$OPENMOKODIR/artwork/themes/openmoko-standard/gtk-2.0/gtkrc
+
==Creating a new application==
  
Or edit $HOME/.gtkrc-2.0 to something like this:
+
{{todo|...}}
  
  include "/home/moko/openmoko/trunk/src/target/OM-2007/artwork/themes/openmoko-standard/gtk-2.0/gtkrc"
+
==Using a Neo1973 as external GSM modem==
  
However, this will make all Gtk2 apps run with the OpenMoko theme.
+
{{todo|...}}
  
 +
==Using an external GPS device==
  
[[Category:Developer software]]
+
{{todo|...}}
[[Category:Guides]]
+
  
{{Languages|Getting_OpenMoko_working_on_host_with_Xoo}}
+
{{Languages|Host-based development with Xoo and Xephyr}}
 +
[[Category:Emulation]]

Latest revision as of 09:45, 17 February 2009

This page introduces you to the most efficient way to create new software for the Openmoko platform. Note that there is a VMware image where this environment has been prebuilt for you. Does anyone know where to find this VMWare image??

Contents

[edit] 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, ... Compiling for your host also means that your edit-run-debug turnaround cycles are much faster, because you can skip the uploading-to-neo step.

[edit] Xoo and Xephyr

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.

Note that Xoo is not required to simulate Openmoko hardware - it just improves the presentation.

[edit] Prerequisites

[edit] 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:

  • gtk-doc-tools
  • libstartup-notification0-dev
  • libapm-dev
  • libgpgme11-dev
  • libgtk2.0-dev
  • libebook1.2-dev
  • libecal1.2-dev
  • libnotify-dev
  • libpulse-dev
  • libcurl4-openssl-dev (or libcurl4-gnutls-dev)
  • matchbox-window-manager
  • matchbox-keyboard
  • pulseaudio
  • xephyr ( package is called xserver-xephyr on ubuntu and debian )
  • xoo


Ubuntu-Specific Packages

  • gnome-common (does this belong above?)
  • ubuntu-mobile-dev (this depends on many other development packages; some are necessary, others optional)


Other Useful Packages

  • libasound2-dev (needed to compile openmoko-dialer2 (User:Tomjoad))


Gentoo users run just

# emerge <package>

note: To get the Xephyr package installed Gentoo users have to rebuild the x11-base/xorg-server package with the "kdrive" use flag enabled (link)


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.

[edit] 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

To compile and install matchbox-panel-2:

mkdir -f /local/pkg/ohand
cd /local/pkg/ohand
svn co http://svn.o-hand.com/repos/matchbox/trunk matchbox
cd matchbox/matchbox-panel-2
./autogen.sh
make
sudo make install

To compile and install libjana:

mkdir -f /local/pkg/ohand
cd /local/pkg/ohand
svn co http://svn.o-hand.com/repos/jana/trunk jana
cd jana
./autogen.sh
make
sudo make install

To compile and install libipkg:

mkdir -f /local/pkg/handhelds.org
cd /local/pkg/handhelds.org
wget http://downloads.openmoko.org/developer/sources/ipkg-0.99.163.tar.gz
tar xzf ipkg-0.99.163.tar.gz
cd ipkg-0.99.163
./configure
make
sudo make install

[edit] Building the Openmoko core

First we download the Openmoko subversion repository:

 mkdir -f /local/pkg/openmoko
 cd /local/pkg/openmoko
 svn co http://svn.openmoko.org/trunk/src src

Then you compile the software contained there, e.g. you will definitely want to compile at least:

In directory src/target/:

In directory src/target/OM-2007.2/artwork:

In directory src/target/OM-2007.2/libraries/:

In directory src/target/OM-2007.2/daemons/:

In directory src/target/OM-2007.2/panel-plugins/:

In directory src/target/OM-2007.2/applications:

Each of these packages can be compiled with the well-known-triple of:

./configure (or ./autogen.sh, if it's the first time)
make
make install

[edit] Data files

Some of the data files are not yet installed. We will create links so that Openmoko finds the data files and uses them directly from the svn directories that you have checked out. To create the links:

 mkdir /usr/local/share/matchbox
 cd /usr/local/share/matchbox
 sudo ln -s /local/pkg/openmoko/src/target/OM-2007.2/misc/openmoko-today2-folders vfolders
 cd /usr/share/themes
 sudo ln -s /local/pkg/openmoko/src/target/OM-2007.2/artwork/themes/openmoko-standard-2

[edit] Starting the nested Openmoko

We have prepared a script for you that starts Xoo and all the necessary X clients in one run. The script is online at

[edit] Creating a new application

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

[edit] Using a Neo1973 as external GSM modem

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

[edit] Using an external GPS device

TODO: ... (See: To-Do List)
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)

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.