|
|
(21 intermediate revisions by 11 users not shown) |
Line 1: |
Line 1: |
− | 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.
| + | #redirect[[Getting Openmoko working on host with Xephyr]] |
− | | + | |
− | == What is Xephyr ==
| + | |
− | [http://projects.o-hand.com/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 [http://projects.o-hand.com/Home OpenedHand] projects page. | + | |
− | | + | |
− | == Build an 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 [[MokoMakefile|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"
| + | |
− | SRCDATE_eds-dbus = "now"
| + | |
− | | + | |
− | 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 = ""
| + | |
− | | + | |
− | == 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 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 the mokobox
| + | |
− | | + | |
− | 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.
| + | |
− | | + | |
− | === Launching Xephyr ===
| + | |
− | | + | |
− | In another terminal (not related to mokobox), start Xephyr
| + | |
− | | + | |
− | Xephyr :1 -ac -2button -host-cursor -screen 480x640
| + | |
− | | + | |
− | Now, back in chroo'ted environment, start X client:
| + | |
− | | + | |
− | eval $(dbus-launch)
| + | |
− | /etc/X11/Xsession
| + | |
− | | + | |
− | You should see OpenMoko booting in the Xephyr window.
| + | |
− | | + | |
− | [[Image:Xephyr.png]]
| + | |
− | | + | |
− | == A sample script ==
| + | |
− | | + | |
− | The following script sets up the most of root fs environment automatically
| + | |
− | | + | |
− | <pre>
| + | |
− | #!/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
| + | |
− | | + | |
− | </pre>
| + | |