Getting Openmoko working on host with Xephyr/it

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(Build an OpenMoko Image)
m (-Guides)
 
(32 intermediate revisions by 7 users not shown)
Line 1: Line 1:
Lo scopo di questa pagina è quello di mostrare come eseguire un'immagine OpenMoko su una macchina x86 in un ambiente chroot.
+
Lo scopo di questa pagina è quello di mostrare come eseguire un'immagine Openmoko su una macchina x86 in un ambiente chroot.
  
 
==  Cosa è Xephyr ==
 
==  Cosa è Xephyr ==
 +
[http://projects.o-hand.com/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 [http://projects.o-hand.com/Home 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.
  
==  Costruire una immagine OpenMoko ==
+
==  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).
  
==  Setup the image filesystem ==
+
Per creare una openmoko-devel-image per l'architettura adatta (x86 nel nostro caso) vedere [[MokoMakefile/it|Creare Openmoko usando MokoMakefile]]. Assicurarsi di avere il makefile moko in /home/moko/Makefile .
  
===  In chroot'ed environment ===
+
Prima di questo, modificare il file build/conf/local.conf in questo modo:
  
==  Starting the nested X server ==
+
MACHINE = "x86"
 +
DISTRO = "openmoko"
 +
  BUILD_ARCH = "i686"
 +
INHERIT += " devshell"
 +
SRCDATE_eds-dbus = "now"
  
=== Supplying fonts ===
+
Una volta creata l'immagine, possiamo passare alla sua configurazione.
  
=== Launching Xephyr ===
+
([[User:Flerchjj]]) Ho dovuto aggiungere anche la seguente riga al file "build/conf/local.conf" per poter completare "make openmoko-devel-image".
 +
TARGET_FPU = ""
  
=== Start X Client ===
+
== Configurare il filesystem dell'immagine ==
  
==  A sample script ==
+
Vedere anche lo script d'esempio alla fine di questo articolo. Sarà molto utile.
  
==  Improving Display Realism - Extending Xephyr with Xoo ==
+
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
 +
 
 +
=== Nell'ambiente chroot ===
 +
 
 +
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.
 +
 
 +
[[Image:Xephyr.png]]
 +
 
 +
== Uno script di esempio ==
 +
Lo script seguente imposta automaticamente l'ambiente Openmoko 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 ==
 +
 
 +
 
 +
[http://projects.o-hand.com/xoo/ Xoo] estende [http://projects.o-hand.com/xephyr Xephyr] fornendo un emulatore dei dispositivi. Si rivolge agli sviluppatori che vogliono simulare un particolare dispositivo (una dimensione del display '''accurata''', tasti hardware, temi del display, etc) su una macchina desktop.
 +
 
 +
Vedere [[Getting Openmoko working on host with Xoo/it|Far funzionare Openmoko su un host tramite Xoo]] per ulteriori informazioni.
 +
 
 +
 
 +
<span id="bottom"></span>
 +
{{Languages|Getting_Openmoko_working_on_host_with_Xephyr}}
 +
 
 +
[[Category:Emulation/it]]

Latest revision as of 22:57, 12 September 2008

Lo scopo di questa pagina è quello di mostrare come eseguire un'immagine Openmoko su una macchina x86 in un ambiente chroot.

Contents

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

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

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

[edit] Nell'ambiente chroot

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

[edit] Avviare il server X annidato

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

[edit] Eseguire Xephyr

In un altro terminale (non legato a mokobox), avviare Xephyr

Xephyr :1 -ac -2button -host-cursor -screen 480x640

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

Xephyr.png

[edit] Uno script di esempio

Lo script seguente imposta automaticamente l'ambiente Openmoko 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

[edit] Migliorare il realismo del Display - Estendere Xephyr con Xoo

Xoo estende Xephyr fornendo un emulatore dei dispositivi. Si rivolge agli sviluppatori che vogliono simulare un particolare dispositivo (una dimensione del display accurata, tasti hardware, temi del display, etc) su una macchina desktop.

Vedere Far funzionare Openmoko su un host tramite Xoo per ulteriori informazioni.


Personal tools

Lo scopo di questa pagina è quello di mostrare come eseguire un'immagine OpenMoko su una macchina x86 in un ambiente chroot.

Cosa è Xephyr

Costruire una immagine OpenMoko

Setup the image filesystem

In chroot'ed environment

Starting the nested X server

Supplying fonts

Launching Xephyr

Start X Client

A sample script

Improving Display Realism - Extending Xephyr with Xoo