Getting Openmoko working on host with Xephyr
From Openmoko
Languages: |
English • العربية • Български • Česky • Dansk • Deutsch • Esperanto • Eesti • Español • فارسی • Suomi • Français • עברית • Magyar • Italiano • 한국어 • Nederlands • Norsk (bokmål) • Polski • Português • Română • Русский • Svenska • Slovenčina • Українська • 中文(中国大陆) • 中文(台灣) • Euskara • Català |
The goal of this page is to show you how to run an Openmoko development image on your host x86 development machine in a chrooted environment.
Contents |
What is Xephyr
Xephyr is a modern X Server in a window which can be used to simulate small displays in a desktop development enviroment. It is maintained on the OpenedHand projects page. Xephyr is now part of xorg-server. Please note that even though it will render Openmoko pixel for pixel, it will likely display almost 4 times larger than the actual device since portable devices tend to have smaller pixels than computer monitors.
Xephyr on your system
gentoo
To have it on your system, add kdrive flag in /etc/make.conf or on your x11-base/xorg-server use flags.
Build an Openmoko Image
First, you'll need to build an openmoko-devel-image. You'll need to edit your local.conf file during build process (before step 5).
You should use Building Openmoko using the MokoMakefile to build an openmoko-devel-image for your host architecture (x86 in our case). Make sure you put the moko makefile in /home/moko/Makefile .
Prior to that, edit your build/conf/local.conf to make it look like this:
MACHINE = "x86" DISTRO = "openmoko" BUILD_ARCH = "i686" INHERIT += " devshell"
Once you have built the image, you can start working toward running the image.
(User:Flerchjj) I also had to add the following line to "build/conf/local.conf" to get "make openmoko-devel-image" to complete.
TARGET_FPU = ""
(User:Enjahova) I had to remove all references to uboot from the makefile to get it to get "make openmoko-devel-image" to complete.
(User:iad.mike2) me too -> look at [1]
Setup the image filesystem
Please see the included help script at the bottom of this article. It should make your life much easier.
The filesystem of the image can be found at /home/moko/build/tmp/rootfs . It is that image that we want to run in a chrooted environment.
We will copy that rootfs directory somewhere so that subsquent builds (using the MokoMakefile for instance) don't overwrite it.
Make sure you have root privileges:
su -
Copy the rootf into a directory called MokoBox. From now on, we will call the chrooted environment a MokoBox.
cp -r /home/moko/build/tmp/rootfs /home/moko/mokobox
make sure /dev and /proc of the host machine are visible from within mokobox
mount --bind /dev /home/moko/mokobox/dev mount -t proc none /home/moko/mokobox/proc
Start/Move into the protected mokobox environment
chroot /home/moko/mokobox /bin/sh
In chroot'ed environment
set environment variables
DISPLAY=:1 LANG=C HOME=/home/root export DISPLAY LANG HOME
Create pango.modules file
pango-querymodules > /etc/pango/pango.modules
Create gdk-pixbuf.loaders file
gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders
Remove touch screen calibrator. Since touch screen hardware is not present, the touch screen calibration prevents X start-up on PC.
rm /etc/X11/Xsession.d/30xTs_Calibrate
Starting the nested X server
Supplying fonts
You might need to install fonts supplied by Openmoko to your host system. The easiest way to do is in Gnome is to go Preferences -> Font - > Details -> Go to font folder and then drag and drop TTF font files from build/tmp/rootfs/usr/share/fonts/ in Nautilus. Using Xubuntu (no Gnome) I found copying the ttf folder into /usr/X11R6/lib/X11/fonts worked.
Launching Xephyr
In another terminal (not related to mokobox), start Xephyr
Xephyr :1 -ac -2button -host-cursor -screen 480x640
Add -dpi 140 or anything that fits you to get bigger fonts and better readability.
Start X Client
Now, back in chroo'ted environment, start X client:
eval $(dbus-launch) /etc/X11/Xsession
You should see Openmoko booting in the Xephyr window.
A sample script
Please do not use this script. It is simply wrong and will do harm to your host file system! The chroot has to be done earlier, otherwise the script modifies/deletes stuff in your host /etc directory.
The following script sets up the most of root fs environment automatically
#!/bin/bash # # Set-up x86 Openmoko root jail. This script must be run as root. # # Root jail is an environment, where the file system root has been # changed to the Openmoko root file system folder. Please don't # use the build/rootfs, but make a copy of it, since build/rootfs # gets overwritten each time you build openmoko-devel-image # # You need to set-up another X server (nested preferably) to # act as a Openmoko screen. Otherwise chrooted applications are executed # as is on the host hardware and the kernel. # # See: # # http://wiki.openmoko.org/wiki/Getting_Openmoko_working_on_host_with_Xephyr # # # 2007 Mikko Ohtamaa - Red Innovation Ltd. # <mikko@redinnovation.com> # # Do anything you wish with this script # # # # Setup required environment variables # Xephyr must listen to this DISPLAY DISPLAY=:1 # If we don't have locale, applications refuse to launch LANG=C # We are running as root in our chrooted environment HOME=/home/root export DISPLAY LANG HOME # Update pango modules pango-querymodules > /etc/pango/pango.modules # Update icon images gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders # Mount /dev and /proc file systems mount --bind /dev ./dev mount -t proc none ./proc # Remove touch screen calibration start up app # It doesn't launch on x86 and prevents X booting if [ -e /etc/X11/Xsession.d/30xTs_Calibrate ] ; then rm /etc/X11/Xsession.d/30xTs_Calibrate fi # Use host name server information so that # web browsing works cp /etc/resolv.conf etc/resolv.conf # Enter into chroot jail chroot . /bin/sh
Improving Display Realism - Extending Xephyr with Xoo
Xoo further extends Xephyr as to provide a poor mans device emulator. It is intended for embedded developers that want to simulate a target device (with an accurate display size, working hardware buttons, themed display, etc) on a desktop machine.
See Getting Openmoko working on host with Xoo for more information.