QtMoko/CrossBuildingOnDebian

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m (Setting up the git workspace)
(+cat)
 
(7 intermediate revisions by one user not shown)
Line 2: Line 2:
 
It is possible to cross-build QtMoko on a Debian box using only (em)debian tools.
 
It is possible to cross-build QtMoko on a Debian box using only (em)debian tools.
  
'''This is a work in progress. The resulting package isn't fully functionnal yet:'''
+
On my Zotac ZBox (amd64) the whole build takes just less than five hours.
* no sound
+
* no bluetooth.
+
 
===Tools needed===
 
===Tools needed===
 +
The builds are done the Debian way, using pbuilder on a Debian Wheezy box.
 
Most of the magic is handled by the ''pdebuild-cross'' package:
 
Most of the magic is handled by the ''pdebuild-cross'' package:
 
  $ sudo apt-get install pdebuild-cross
 
  $ sudo apt-get install pdebuild-cross
 
+
The toolchain comes from the [http://emdebian.org Emdebian project] and is set up via the ''multistrap'' package (pulled in by pdebuild-cross).
===Configuration===
+
===Building QtMoko v36===
The toolchain comes from the [http://emdebian.org Emdebian project]. Two configuration files from the ''multistrap'' package (pulled in by pdebuild-cross) are needed. It is best to copy them because they're not part of /etc:
+
====Configuration====
$ sudo mkdir /etc/multistrap
+
Configuration file for multistrap (/etc/multistrap/armel-sid.conf):
$ sudo cp /usr/share/multistrap/{armel,crosschroot}.conf /etc/multistrap
+
Then modify the ''armel.conf'' file to use the Squeeze toolchain (with g++-4.4; the Lenny toolchain with g++-4.2 doesn't work for QtMoko) and to load our copy of ''crosschroot.conf'':
+
 
  [General]
 
  [General]
  include=/etc/multistrap/crosschroot.conf
+
  arch=
 +
directory=
 +
# same as --tidy-up option if set to true
 +
cleanup=true
 +
# same as --no-auth option if set to true
 +
# keyring packages listed in each debootstrap will
 +
# still be installed.
 +
noauth=false
 +
# whether to add the /suite to be explicit about where apt
 +
# needs to look for packages. Default is false.
 +
explicitsuite=true
 +
# extract all downloaded archives (default is true)
 +
unpack=true
 +
 
  omitrequired=false
 
  omitrequired=false
 
  configscript=
 
  configscript=
 
  setupscript=/usr/share/multistrap/setcrossarch.sh
 
  setupscript=/usr/share/multistrap/setcrossarch.sh
  debootstrap=Debian Base Toolchains
+
  debootstrap=Debian Toolchains
 
  aptsources=Debian Toolchains
 
  aptsources=Debian Toolchains
 
  tarballname=pdebuild-cross.tgz
 
  tarballname=pdebuild-cross.tgz
Line 29: Line 39:
 
  keyring=emdebian-archive-keyring
 
  keyring=emdebian-archive-keyring
 
  suite=squeeze
 
  suite=squeeze
You may also want to change the Debian mirror URIs in ''crosschroot.conf'' to use one near your location. I use a french one:
 
# Example multistrap configuration file for a sid build chroot
 
# Need to use cascading to select the toolchain for a cross arch.
 
 
   
 
   
 +
[Debian]
 +
packages=dpkg-dev binutils-multiarch build-essential dpkg-cross makedev
 +
# Choose your preferred mirror
 +
source=http://ftp.fr.debian.org/debian
 +
keyring=debian-archive-keyring
 +
suite=unstable
 +
omitdebsrc=false
 +
Configuration file for pdebuild-cross (/etc/pdebuild-cross/pdebuild-cross.rc):
 +
# this is your configuration file for pdebuild-cross.
 +
# /etc/pdebuild-cross/pdebuild-cross.rc is the one meant for editing.
 +
#
 +
# read pbuilderrc (5) and pdebuild-cross (1) for notes on specific options.
 +
 +
# remember to change CROSSARCH, DEBBUILDOPTS and MULTISTRAPFILE to
 +
# change your target cross-building architecture from armel.
 +
 +
CROSSARCH=armel
 +
DEBBUILDOPTS="-aarmel"
 +
MULTISTRAPFILE=/etc/multistrap/armel-sid.conf
 +
#BASETGZ=/var/lib/pdebuild-cross/pdebuild-cross.tgz
 +
BASETGZ=/home/pdebuild-cross.tgz
 +
BUILDPLACE=/var/lib/pdebuild-cross/build/
 +
BUILDRESULT=..
 +
APTCACHE=/var/lib/pdebuild-cross/aptcache/
 +
APTCACHEHARDLINK=no
 +
PBUILDERSATISFYDEPENDSCMD=/usr/sbin/embuilddeps
 +
PBUILDERSATISFYDEPENDSOPT="-m -a armel"
 +
USEDEVPTS=yes
 +
AUTO_DEBSIGN=no
 +
 +
# Only use when testing Xorg apps, not when building
 +
# also remember to copy ~/.Xauthority into /home/$SUDO_USER/
 +
# (mkdir /home/$SUDO_USER if necessary).
 +
#BINDMOUNTS="/tmp"
 +
====Creating the pbuilder chroot====
 +
As simple as:
 +
$ sudo pdebuild-cross-create
 +
$ sudo pdebuild-cross-update
 +
====Setting up the git workspace====
 +
First clone the QtMoko repo:
 +
$ git clone --recursive git://github.com/radekp/qtmoko.git
 +
Check out the v36 tag:
 +
$ cd qtmoko
 +
$ git checkout v36
 +
Patch the debian files
 +
$ wget -O - -c http://wiki.openmoko.org/images/0/0a/QtMoko-v36-pdebuild-cross-patch.txt | patch -p1
 +
====Building the QtMoko package====
 +
Create the orig tarball (once after each git merge):
 +
$ tar czf ../qtmoko_36.orig.tar.gz -C .. --exclude .git --exclude .pc --exclude qtmoko/debian --transform 's:\./qtmoko:qtmoko-36:' ./qtmoko
 +
Build:
 +
$ pdebuild-cross -aarmel
 +
===Building QtMoko v35===
 +
QtMoko v35 is the trickiest case since it requires a Debian Squeeze pbuilder chroot which misses the xapt tool. Hopefully an official backport will be available soon. For now I use a backport sitting in my own repository.
 +
 +
====Configuration====
 +
Configuration file for multistrap (/etc/multistrap/armel-squeeze.conf):
 
  [General]
 
  [General]
 
  arch=
 
  arch=
Line 47: Line 110:
 
  # extract all downloaded archives (default is true)
 
  # extract all downloaded archives (default is true)
 
  unpack=true
 
  unpack=true
# the order of sections is not important.
 
# the debootstrap option determines which repository
 
# is used to calculate the list of Priority: required packages.
 
debootstrap=Debian Base
 
aptsources=Debian Base
 
 
   
 
   
  # Lenny toolchains need -base from Lenny.
+
  omitrequired=false
  [Base]
+
configscript=
  packages=gcc-4.2-base
+
setupscript=/usr/share/multistrap/setcrossarch.sh
  source=http://ftp.fr.debian.org/debian
+
debootstrap=Debian Toolchains
  keyring=debian-archive-keyring
+
aptsources=Debian Toolchains
  suite=lenny
+
tarballname=pdebuild-cross.tgz
omitdebsrc=false
+
 +
  [Toolchains]
 +
  packages=g++-4.4-arm-linux-gnueabi linux-libc-dev-armel-cross
 +
reinstall=binutils-multiarch
 +
  source=http://www.emdebian.org/debian
 +
  keyring=emdebian-archive-keyring
 +
  suite=squeeze
 
   
 
   
 
  [Debian]
 
  [Debian]
  packages=dpkg-dev binutils-multiarch build-essential dpkg-cross aptitude
+
  packages=dpkg-dev binutils-multiarch build-essential makedev wget
 +
# Choose your preferred mirror
 
  source=http://ftp.fr.debian.org/debian
 
  source=http://ftp.fr.debian.org/debian
 
  keyring=debian-archive-keyring
 
  keyring=debian-archive-keyring
  suite=unstable
+
  suite=squeeze
 
  omitdebsrc=false
 
  omitdebsrc=false
Finally update the MULTISTRAPFILE variable in your pdebuild-cross' configuration file (/etc/pdebuild-cross/pdebuild-cross.rc) to point to your multistrap armel config:
+
Hook file for multistrap so that it installs the xapt backport for squeeze from my repository (/etc/multistrap/armel-squeeze-hooks/E10-xapt):
 +
#!/bin/sh
 +
set -e
 +
if [ ! -f /usr/bin/xapt ]; then
 +
  wget http://pini.free.fr/debian/pool/main/e/emdebian-crush/xapt_2.2.17~stable_all.deb
 +
  dpkg -i xapt_2.2.17~stable_all.deb || apt-get -f -y install
 +
  rm xapt_2.2.17~stable_all.deb
 +
fi
 +
This file must be executable (chmod a+x).
 +
 
 +
Configuration file for pdebuild-cross (/etc/pdebuild-cross/pdebuild-cross.rc):
 
  # this is your configuration file for pdebuild-cross.
 
  # this is your configuration file for pdebuild-cross.
 
  # /etc/pdebuild-cross/pdebuild-cross.rc is the one meant for editing.
 
  # /etc/pdebuild-cross/pdebuild-cross.rc is the one meant for editing.
Line 78: Line 153:
 
  CROSSARCH=armel
 
  CROSSARCH=armel
 
  DEBBUILDOPTS="-aarmel"
 
  DEBBUILDOPTS="-aarmel"
  MULTISTRAPFILE=/home/pini/debian/multistrap/armel.conf
+
  MULTISTRAPFILE=/etc/multistrap/armel-squeeze.conf
  BASETGZ=/var/lib/pdebuild-cross/pdebuild-cross.tgz
+
  #BASETGZ=/var/lib/pdebuild-cross/pdebuild-cross.tgz
 +
BASETGZ=/home/pdebuild-cross.tgz
 
  BUILDPLACE=/var/lib/pdebuild-cross/build/
 
  BUILDPLACE=/var/lib/pdebuild-cross/build/
 
  BUILDRESULT=..
 
  BUILDRESULT=..
 
  APTCACHE=/var/lib/pdebuild-cross/aptcache/
 
  APTCACHE=/var/lib/pdebuild-cross/aptcache/
  #HOOKDIR=/usr/share/pdebuild-cross/hookdir/
+
  HOOKDIR=/etc/multistrap/armel-squeeze-hooks
 
  APTCACHEHARDLINK=no
 
  APTCACHEHARDLINK=no
 
  PBUILDERSATISFYDEPENDSCMD=/usr/sbin/embuilddeps
 
  PBUILDERSATISFYDEPENDSCMD=/usr/sbin/embuilddeps
Line 95: Line 171:
 
  #BINDMOUNTS="/tmp"
 
  #BINDMOUNTS="/tmp"
 
You may want to change the BUILDPLACE path as well in case you're short of space in /var.
 
You may want to change the BUILDPLACE path as well in case you're short of space in /var.
===Creating the pbuilder chroot===
+
====Creating the pbuilder chroot====
 
As simple as:
 
As simple as:
 
  $ sudo pdebuild-cross-create
 
  $ sudo pdebuild-cross-create
===Setting up the git workspace===
+
$ sudo pdebuild-cross-update
 +
The second step will trigger the xapt installation through the E10-xapt hook script defined above.
 +
 
 +
====Setting up the git workspace====
 
First clone the QtMoko repo:
 
First clone the QtMoko repo:
  $ git clone -r git://github.com/radekp/qtmoko.git
+
  $ git clone --recursive git://github.com/radekp/qtmoko.git
Create your own branch:
+
Check out the v35 tag:
 
  $ cd qtmoko
 
  $ cd qtmoko
  $ git branch <my branch>
+
  $ git checkout v35
Merge in the ''translations'' branch:
+
$ git merge origin/translations
+
 
Patch the debian files
 
Patch the debian files
  $ wget -c http://wiki.openmoko.org/images/c/c7/QtMoko-pdebuild-cross-patch.txt
+
  $ wget -O - -c http://wiki.openmoko.org/images/f/f6/QtMoko-v35-pdebuild-cross-patch.txt | patch -p1
$ patch -p1 < QtMoko-pdebuild-cross-patch.txt
+
====Building the QtMoko package====
 
+
===Building the QtMoko package===
+
 
Create the orig tarball (once after each git merge):
 
Create the orig tarball (once after each git merge):
  $ tar czf ../qtmoko_36.orig.tar.gz -C .. --exclude .git --exclude .pc --exclude qtmoko/debian --transform 's:\./qtmoko:qtmoko-36:' ./qtmoko
+
  $ tar czf ../qtmoko_35.orig.tar.gz -C .. --exclude .git --exclude .pc --exclude qtmoko/debian --transform 's:\./qtmoko:qtmoko-35:' ./qtmoko
 
Build:
 
Build:
  $ pdebuild-cross
+
  $ pdebuild-cross -aarmel
On my Zotac ZBox (amd64) the whole build takes five hours.
+
 
 +
[[Category:Qt Moko]]

Latest revision as of 10:28, 10 February 2012

Contents

[edit] Cross-building QtMoko on Debian

It is possible to cross-build QtMoko on a Debian box using only (em)debian tools.

On my Zotac ZBox (amd64) the whole build takes just less than five hours.

[edit] Tools needed

The builds are done the Debian way, using pbuilder on a Debian Wheezy box. Most of the magic is handled by the pdebuild-cross package:

$ sudo apt-get install pdebuild-cross

The toolchain comes from the Emdebian project and is set up via the multistrap package (pulled in by pdebuild-cross).

[edit] Building QtMoko v36

[edit] Configuration

Configuration file for multistrap (/etc/multistrap/armel-sid.conf):

[General]
arch=
directory=
# same as --tidy-up option if set to true
cleanup=true
# same as --no-auth option if set to true
# keyring packages listed in each debootstrap will
# still be installed.
noauth=false
# whether to add the /suite to be explicit about where apt
# needs to look for packages. Default is false.
explicitsuite=true
# extract all downloaded archives (default is true)
unpack=true

omitrequired=false
configscript=
setupscript=/usr/share/multistrap/setcrossarch.sh
debootstrap=Debian Toolchains
aptsources=Debian Toolchains
tarballname=pdebuild-cross.tgz

[Toolchains]
packages=g++-4.4-arm-linux-gnueabi linux-libc-dev-armel-cross
reinstall=binutils-multiarch
source=http://www.emdebian.org/debian
keyring=emdebian-archive-keyring
suite=squeeze

[Debian]
packages=dpkg-dev binutils-multiarch build-essential dpkg-cross makedev
# Choose your preferred mirror
source=http://ftp.fr.debian.org/debian
keyring=debian-archive-keyring
suite=unstable
omitdebsrc=false

Configuration file for pdebuild-cross (/etc/pdebuild-cross/pdebuild-cross.rc):

# this is your configuration file for pdebuild-cross.
# /etc/pdebuild-cross/pdebuild-cross.rc is the one meant for editing.
#
# read pbuilderrc (5) and pdebuild-cross (1) for notes on specific options.

# remember to change CROSSARCH, DEBBUILDOPTS and MULTISTRAPFILE to
# change your target cross-building architecture from armel.

CROSSARCH=armel
DEBBUILDOPTS="-aarmel"
MULTISTRAPFILE=/etc/multistrap/armel-sid.conf
#BASETGZ=/var/lib/pdebuild-cross/pdebuild-cross.tgz
BASETGZ=/home/pdebuild-cross.tgz
BUILDPLACE=/var/lib/pdebuild-cross/build/
BUILDRESULT=..
APTCACHE=/var/lib/pdebuild-cross/aptcache/
APTCACHEHARDLINK=no
PBUILDERSATISFYDEPENDSCMD=/usr/sbin/embuilddeps
PBUILDERSATISFYDEPENDSOPT="-m -a armel"
USEDEVPTS=yes
AUTO_DEBSIGN=no

# Only use when testing Xorg apps, not when building
# also remember to copy ~/.Xauthority into /home/$SUDO_USER/
# (mkdir /home/$SUDO_USER if necessary).
#BINDMOUNTS="/tmp"

[edit] Creating the pbuilder chroot

As simple as:

$ sudo pdebuild-cross-create
$ sudo pdebuild-cross-update

[edit] Setting up the git workspace

First clone the QtMoko repo:

$ git clone --recursive git://github.com/radekp/qtmoko.git

Check out the v36 tag:

$ cd qtmoko
$ git checkout v36

Patch the debian files

$ wget -O - -c http://wiki.openmoko.org/images/0/0a/QtMoko-v36-pdebuild-cross-patch.txt | patch -p1

[edit] Building the QtMoko package

Create the orig tarball (once after each git merge):

$ tar czf ../qtmoko_36.orig.tar.gz -C .. --exclude .git --exclude .pc --exclude qtmoko/debian --transform 's:\./qtmoko:qtmoko-36:' ./qtmoko

Build:

$ pdebuild-cross -aarmel

[edit] Building QtMoko v35

QtMoko v35 is the trickiest case since it requires a Debian Squeeze pbuilder chroot which misses the xapt tool. Hopefully an official backport will be available soon. For now I use a backport sitting in my own repository.

[edit] Configuration

Configuration file for multistrap (/etc/multistrap/armel-squeeze.conf):

[General]
arch=
directory=
# same as --tidy-up option if set to true
cleanup=true
# same as --no-auth option if set to true
# keyring packages listed in each debootstrap will
# still be installed.
noauth=false
# whether to add the /suite to be explicit about where apt
# needs to look for packages. Default is false.
explicitsuite=true
# extract all downloaded archives (default is true)
unpack=true

omitrequired=false
configscript=
setupscript=/usr/share/multistrap/setcrossarch.sh
debootstrap=Debian Toolchains
aptsources=Debian Toolchains
tarballname=pdebuild-cross.tgz

[Toolchains]
packages=g++-4.4-arm-linux-gnueabi linux-libc-dev-armel-cross
reinstall=binutils-multiarch
source=http://www.emdebian.org/debian
keyring=emdebian-archive-keyring
suite=squeeze

[Debian]
packages=dpkg-dev binutils-multiarch build-essential makedev wget
# Choose your preferred mirror
source=http://ftp.fr.debian.org/debian
keyring=debian-archive-keyring
suite=squeeze
omitdebsrc=false

Hook file for multistrap so that it installs the xapt backport for squeeze from my repository (/etc/multistrap/armel-squeeze-hooks/E10-xapt):

#!/bin/sh
set -e
if [ ! -f /usr/bin/xapt ]; then
  wget http://pini.free.fr/debian/pool/main/e/emdebian-crush/xapt_2.2.17~stable_all.deb
  dpkg -i xapt_2.2.17~stable_all.deb || apt-get -f -y install
  rm xapt_2.2.17~stable_all.deb
fi

This file must be executable (chmod a+x).

Configuration file for pdebuild-cross (/etc/pdebuild-cross/pdebuild-cross.rc):

# this is your configuration file for pdebuild-cross.
# /etc/pdebuild-cross/pdebuild-cross.rc is the one meant for editing.
#
# read pbuilderrc (5) and pdebuild-cross (1) for notes on specific options.

# remember to change CROSSARCH, DEBBUILDOPTS and MULTISTRAPFILE to
# change your target cross-building architecture from armel.

CROSSARCH=armel
DEBBUILDOPTS="-aarmel"
MULTISTRAPFILE=/etc/multistrap/armel-squeeze.conf
#BASETGZ=/var/lib/pdebuild-cross/pdebuild-cross.tgz
BASETGZ=/home/pdebuild-cross.tgz
BUILDPLACE=/var/lib/pdebuild-cross/build/
BUILDRESULT=..
APTCACHE=/var/lib/pdebuild-cross/aptcache/
HOOKDIR=/etc/multistrap/armel-squeeze-hooks
APTCACHEHARDLINK=no
PBUILDERSATISFYDEPENDSCMD=/usr/sbin/embuilddeps
PBUILDERSATISFYDEPENDSOPT="-m -a armel"
USEDEVPTS=yes
AUTO_DEBSIGN=no

# Only use when testing Xorg apps, not when building
# also remember to copy ~/.Xauthority into /home/$SUDO_USER/
# (mkdir /home/$SUDO_USER if necessary).
#BINDMOUNTS="/tmp"

You may want to change the BUILDPLACE path as well in case you're short of space in /var.

[edit] Creating the pbuilder chroot

As simple as:

$ sudo pdebuild-cross-create
$ sudo pdebuild-cross-update

The second step will trigger the xapt installation through the E10-xapt hook script defined above.

[edit] Setting up the git workspace

First clone the QtMoko repo:

$ git clone --recursive git://github.com/radekp/qtmoko.git

Check out the v35 tag:

$ cd qtmoko
$ git checkout v35

Patch the debian files

$ wget -O - -c http://wiki.openmoko.org/images/f/f6/QtMoko-v35-pdebuild-cross-patch.txt | patch -p1

[edit] Building the QtMoko package

Create the orig tarball (once after each git merge):

$ tar czf ../qtmoko_35.orig.tar.gz -C .. --exclude .git --exclude .pc --exclude qtmoko/debian --transform 's:\./qtmoko:qtmoko-35:' ./qtmoko

Build:

$ pdebuild-cross -aarmel
Personal tools

Cross-building QtMoko on Debian

It is possible to cross-build QtMoko on a Debian box using only (em)debian tools.

This is a work in progress. The resulting package isn't fully functionnal yet:

  • no sound
  • no bluetooth.

Tools needed

Most of the magic is handled by the pdebuild-cross package:

$ sudo apt-get install pdebuild-cross

Configuration

The toolchain comes from the Emdebian project. Two configuration files from the multistrap package (pulled in by pdebuild-cross) are needed. It is best to copy them because they're not part of /etc:

$ sudo mkdir /etc/multistrap
$ sudo cp /usr/share/multistrap/{armel,crosschroot}.conf /etc/multistrap

Then modify the armel.conf file to use the Squeeze toolchain (with g++-4.4; the Lenny toolchain with g++-4.2 doesn't work for QtMoko) and to load our copy of crosschroot.conf:

[General]
include=/etc/multistrap/crosschroot.conf
omitrequired=false
configscript=
setupscript=/usr/share/multistrap/setcrossarch.sh
debootstrap=Debian Base Toolchains
aptsources=Debian Toolchains
tarballname=pdebuild-cross.tgz

[Toolchains]
packages=g++-4.4-arm-linux-gnueabi linux-libc-dev-armel-cross
reinstall=binutils-multiarch
source=http://www.emdebian.org/debian
keyring=emdebian-archive-keyring
suite=squeeze

You may also want to change the Debian mirror URIs in crosschroot.conf to use one near your location. I use a french one:

# Example multistrap configuration file for a sid build chroot
# Need to use cascading to select the toolchain for a cross arch.

[General]
arch=
directory=
# same as --tidy-up option if set to true
cleanup=true
# same as --no-auth option if set to true
# keyring packages listed in each debootstrap will
# still be installed.
noauth=false
# whether to add the /suite to be explicit about where apt
# needs to look for packages. Default is false.
explicitsuite=true
# extract all downloaded archives (default is true)
unpack=true
# the order of sections is not important.
# the debootstrap option determines which repository
# is used to calculate the list of Priority: required packages.
debootstrap=Debian Base
aptsources=Debian Base

# Lenny toolchains need -base from Lenny.
[Base]
packages=gcc-4.2-base
source=http://ftp.fr.debian.org/debian
keyring=debian-archive-keyring
suite=lenny
omitdebsrc=false

[Debian]
packages=dpkg-dev binutils-multiarch build-essential dpkg-cross aptitude
source=http://ftp.fr.debian.org/debian
keyring=debian-archive-keyring
suite=unstable
omitdebsrc=false

Finally update the MULTISTRAPFILE variable in your pdebuild-cross' configuration file (/etc/pdebuild-cross/pdebuild-cross.rc) to point to your multistrap armel config:

# this is your configuration file for pdebuild-cross.
# /etc/pdebuild-cross/pdebuild-cross.rc is the one meant for editing.
#
# read pbuilderrc (5) and pdebuild-cross (1) for notes on specific options.

# remember to change CROSSARCH, DEBBUILDOPTS and MULTISTRAPFILE to
# change your target cross-building architecture from armel.

CROSSARCH=armel
DEBBUILDOPTS="-aarmel"
MULTISTRAPFILE=/home/pini/debian/multistrap/armel.conf
BASETGZ=/var/lib/pdebuild-cross/pdebuild-cross.tgz
BUILDPLACE=/var/lib/pdebuild-cross/build/
BUILDRESULT=..
APTCACHE=/var/lib/pdebuild-cross/aptcache/
#HOOKDIR=/usr/share/pdebuild-cross/hookdir/
APTCACHEHARDLINK=no
PBUILDERSATISFYDEPENDSCMD=/usr/sbin/embuilddeps
PBUILDERSATISFYDEPENDSOPT="-m -a armel"
USEDEVPTS=yes
AUTO_DEBSIGN=no

# Only use when testing Xorg apps, not when building
# also remember to copy ~/.Xauthority into /home/$SUDO_USER/
# (mkdir /home/$SUDO_USER if necessary).
#BINDMOUNTS="/tmp"

You may want to change the BUILDPLACE path as well in case you're short of space in /var.

Creating the pbuilder chroot

As simple as:

$ sudo pdebuild-cross-create

Setting up the git workspace

First clone the QtMoko repo:

$ git clone -r git://github.com/radekp/qtmoko.git

Create your own branch:

$ cd qtmoko
$ git branch <my branch>

Merge in the translations branch:

$ git merge origin/translations

Patch the debian files

$ wget -c http://wiki.openmoko.org/images/c/c7/QtMoko-pdebuild-cross-patch.txt
$ patch -p1 < QtMoko-pdebuild-cross-patch.txt

Building the QtMoko package

Create the orig tarball (once after each git merge):

$ tar czf ../qtmoko_36.orig.tar.gz -C .. --exclude .git --exclude .pc --exclude qtmoko/debian --transform 's:\./qtmoko:qtmoko-36:' ./qtmoko

Build:

$ pdebuild-cross

On my Zotac ZBox (amd64) the whole build takes five hours.