Getting Openmoko working on host with Xephyr/it
From Openmoko
(→Avviare il Client X) |
(→Uno script di esempio) |
||
| Line 88: | Line 88: | ||
== Uno script di esempio == | == Uno script di esempio == | ||
| + | Lo script seguente imposta automaticamente l'ambiente in chroot. | ||
| + | |||
| + | <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> | ||
== Migliorare il realismo del Display - Estendere Xephyr con Xoo == | == Migliorare il realismo del Display - Estendere Xephyr con Xoo == | ||
Revision as of 16:52, 11 July 2007
Lo scopo di questa pagina è quello di mostrare come eseguire un'immagine OpenMoko su una macchina x86 in un ambiente chroot.
Contents |
Cosa è Xephyr
Xephyr è un moderno Server X eseguito in una finestra che può essere utilizzato per simulare un piccolo display in un ambiente di sviluppo su desktop. Xephyr è mantenuto sulla pagina del progetto OpenedHand. Da notare che nonostante OpenMoko verrà renderizzato pixel per pixel, probabilmente verrà visualizzato 4 volte più grande di quanto non sia nella realtà. Questo perché i dispositivi portatili tendono ad avere pixel più piccoli rispetto ai monitor dei computer.
Creare un'immagine OpenMoko
Prima di tutto, bisogna creare una openmoko-devel-image. Il file local.conf andrà modificato durante il processo (prima del passo 5).
Per creare una openmoko-devel-image per l'architettura adatta (x86 nel nostro caso) vedere Creare OpenMoko usando MokoMakefile. Assicurarsi di avere il makefile moko in /home/moko/Makefile .
Prima di questo, modificare il file build/conf/local.conf in questo modo:
MACHINE = "x86" DISTRO = "openmoko" BUILD_ARCH = "i686" INHERIT += " devshell" SRCDATE_eds-dbus = "now"
Una volta creata l'immagine, possiamo passare alla sua configurazione.
(User:Flerchjj) Ho dovuto aggiungere anche la seguente riga al file "build/conf/local.conf" per poter completare "make openmoko-devel-image".
TARGET_FPU = ""
Configurare il filesystem dell'immagine
Vedere anche lo script d'esempio alla fine di questo articolo. Sarà molto utile.
Il filesystem dell'immagine che vogliamo eseguire nell'ambiente chroot, si trova in /home/moko/build/tmp/rootfs .
Bisogna copiare la directory rootfs da qualche parte per poterla poi ricostruire (usando MokoMakefile per esempio) senza sovrascriverla.
Assicurarsi di avere i privilegi di root:
su -
Copia rootfs in una directory chiamata mokobox. Di seguito chiameremo l'ambiente chroot "mokobox".
cp -r /home/moko/build/tmp/rootfs /home/moko/mokobox
Assicurarsi che /dev e /proc della macchina host siano visibili dall'interno di mokobox.
mount --bind /dev /home/moko/mokobox/dev mount -t proc none /home/moko/mokobox/proc
Avviare l'ambiente protetto mokobox.
chroot /home/moko/mokobox /bin/sh
In chroot'ed environment
Impostare le variabili d'ambiente
DISPLAY=:1 LANG=C HOME=/home/root export DISPLAY LANG HOME
Creare il file pango.modules
pango-querymodules > /etc/pango/pango.modules
Creare il file gdk-pixbuf.loaders
gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders
Rimuovere il calibratore del touch screen. Siccome l'hardware del touch screen è assente, il suo calibratore impedirebbe l'avvio di X sul PC.
rm /etc/X11/Xsession.d/30xTs_Calibrate
Avviare il server X annidato
Fornire i fonts
Potrebbe essere necessario installare i caratteri forniti da OpenMoko al sistema host. Il modo più semplice per eseguire questa operazione su Gnome, è andare in Preferences -> Font - > Details -> Vai alla directory dei caratteri e copiare-incollare i file TTF da build/tmp/rootfs/usr/share/fonts/ in Nautilus.
Eseguire Xephyr
In un altro terminale (non legato a mokobox), avviare Xephyr
Xephyr :1 -ac -2button -host-cursor -screen 480x640
Avviare il Client X
Tornare nell'ambiente chroot ed avviare il client X:
eval $(dbus-launch) /etc/X11/Xsession
A questo punto si dovrebbe vedere la fase di boot di OpenMoko nella finestra Xephyr.
Uno script di esempio
Lo script seguente imposta automaticamente l'ambiente in chroot.
#!/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

