Building OpenMoko 2007.1 from scratch

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m
(+{{Delete|What this link point to has been deleted by 18. apr 2010, 17:19 Marko Knöbl.}})
 
(47 intermediate revisions by 17 users not shown)
Line 1: Line 1:
{|align=right
+
{{Delete|What this link point to has been deleted by 18. apr 2010, 17:19 Marko Knöbl.}}
|__TOC__
+
What this link point to has been deleted by 18. apr 2010, 17:19 Marko Knöbl.
|}
+
#REDIRECT [[Building_Openmoko_2007.1_from_scratch]]
 
+
{{warning|This is still a preliminary version, which will take some more days until it has all the updates.}}
+
 
+
This is a guide describing how to set up a running OpenMoko
+
system from scratch.
+
 
+
If you just want to run OpenMoko applications on your PC, just perform the
+
"Obtaining OpenMoko SVN tree" step below and then go to
+
[[How to run OpenMoko Apps on PC]]. If you want to autoinstall all required tools and resources, consider using [[MokoMakefile]] -- script developed by Rod Whitby.
+
 
+
Do not treat this as a linear script! There are various configuration items you
+
need to set (or skip, as it may be), operations that depend on how your
+
host(s) is/are set up, and also on the hardware revision of the target platform
+
(i.e., the phone).
+
 
+
Instead, look at each step, read the instructions, copy and paste what
+
makes sense for you, and adapt what you disagree with. Links to original and
+
background material in the Wiki are included wherever useful.
+
 
+
 
+
== Preparation ==
+
 
+
===  Roles  ===
+
 
+
The build process may spread over multiple machines. They have the following
+
roles:
+
 
+
;'''BUILD''': build host, with quick access to the files and CPU power. Must have Internet access.
+
;'''LAB''': lab machine connected to the debug board (serial and JTAG) and to USB on the Neo (since this will probably be just a single machine, the roles are not further divided)
+
;'''CARD''': machine with a USB-attached SD/MMC card reader
+
 
+
All machines are assumed to share the same filesystem layout. At the beginning of
+
each of the sections below, the respective role is indicated. "('''all''')" is for
+
settings that apply to all machines, or that - for simplicity - can be
+
applied to all of them.
+
 
+
 
+
=== Directory layout ===
+
'''(Roles: all)'''
+
 
+
<pre>
+
$OMDIR (/home/moko) base directory for the whole tree
+
  openmoko/ files from OpenMoko subversion (SVN) repository
+
  openembedded/ files from OpenEmbedded (OE) Monotone repository
+
  sources/ cached downloads of OE
+
  build/ OE build directory
+
</pre>
+
 
+
 
+
===  Environment variables ===
+
'''(Roles: all)'''
+
 
+
For simplicity, we just set these environment variables on all hosts
+
involved. If you're not comfortable with this, feel free to weed out the ones
+
you don't need.
+
 
+
Our base directory (configure this for local arrangements):
+
 
+
export OMDIR=/home/moko
+
 
+
The search path for BitBake files. Note that the order is of vital
+
importance.
+
 
+
export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded
+
 
+
 
+
===  Permissions  ===
+
'''(Role: BUILD)'''
+
 
+
In order to perform the build process, you have to obtain the following
+
permissions:
+
 
+
* write access to the OpenMoko SVN repository (in principle, it should be possible to simplify this to read access. For further study.)
+
 
+
 
+
===  Build host prerequisites  ===
+
'''(Role: BUILD)'''
+
 
+
There must be at least 7 GB of free space on $OMDIR.
+
 
+
In addition to the traditional development tools (gcc, patch, etc.), the
+
following packages must be installed on the build host:
+
 
+
;subversion: version control system used by OpenMoko and others
+
;quilt: patch management system used by the Linux kernel and others
+
;monotone: version control system used by OpenEmbedded. This should be a recent version, e.g., 0.32, although also 0.31 should work.
+
;diffstat: the OE build process wants this
+
;texi2html: this too
+
;git: version control system used by the Linux kernel and others. Do not confuse this with the "GNU Interactive Tools"
+
 
+
Furthermore, the following package can be installed optionally:
+
;psyco: Python just-in-time compiler. Speeds up OpenEmbedded builds (with BitBake) considerably. Strongly recommended.
+
 
+
Gentoo users can obtain all this with (note that, at the time of writing, Monotone 0.32 isn't available without setting the ~x86 keyword):
+
 
+
<pre>
+
echo 'dev-util/monotone ~'`readlink /etc/make.profile | awk -F / '{print $6}'`\
+
  >>/etc/portage/package.keywords
+
emerge -u subversion quilt monotone diffstat texi2html dev-util/git psyco
+
</pre>
+
 
+
[http://www.openembedded.org/wiki/OEandYourDistro  Instructions for installing prerequisites in other distributions]
+
 
+
If the local user name does not match the user name with which you access SVN, you can put your username in the url you use to checkout, eg. svn ssh://joe@stuff.org/svn/stuff.
+
 
+
===  Lab host prerequisites  ===
+
'''(Role: LAB)'''
+
 
+
The following package must be installed on the lab host:
+
;xc: a simple communications program for the serial port
+
 
+
Gentoo users can obtain this with:
+
emerge -u xc
+
 
+
Note that similar communications programs, such as "cu" or "minicom", may be used as well.
+
 
+
===  Assumptions  ===
+
'''(Roles: LAB, CARD)'''
+
 
+
We make the following assumptions about hardware setup and devices:
+
 
+
* the serial console of the Neo phone is connected to /dev/ttyS0 on '''LAB''' (see [[Debug_Board]])
+
* the JTAG [[wiggler]] is connected to /dev/parport0 on '''LAB'''. See [[Debug Board]] and  [[Connecting_GTA01Bv2_with_Debug_Board]]
+
* cards inserted in the SD/MMC card reader appear as /dev/uba on '''CARD''' and can be mounted on /mnt/tmp (we'll specify the mount point explicitly, so the directory has to be there, but we don't need to specify the mount point in /etc/fstab). If in doubt,
+
mkdir -p /mnt/tmp
+
 
+
== Obtaining Sources and build system ==
+
 
+
===  OpenEmbedded build: initial downloads  ===
+
 
+
First, we obtain a snapshot of the OpenEmbedded-based tree used by OpenMoko, plus the OE build tool called BitBake.
+
 
+
 
+
==== Obtaining OpenMoko SVN tree ====
+
'''(Role: BUILD)'''
+
 
+
Obtain the latest revision of the OpenMoko tree. Unfortunately, at some places, "current" versions of upstream packages may get included, thus the build may still fail. If it does, you may wish to inform the authorities.
+
 
+
The checkout should take about 45 minutes over an Internet connection with a round-trip time to svn.openmoko.org of 350 ms.
+
 
+
<pre>
+
cd $OMDIR
+
svn co http://svn.openmoko.org/ openmoko
+
</pre>
+
 
+
==== Installing BitBake ====
+
'''(Role: BUILD)'''
+
 
+
Install version 1.6 of BitBake, the build tool of OE. (This is quick.)
+
 
+
<pre>
+
svn co http://svn.berlios.de/svnroot/repos/bitbake/branches/bitbake-1.6/ bitbake
+
cd bitbake
+
./setup.py install
+
cd ..
+
</pre>
+
 
+
 
+
==== Obtaining OpenEmbedded snapshot ====
+
'''(Role: BUILD)'''
+
 
+
Obtain a snapshot of the Monotone repository of OpenEmbedded, then update it
+
to the latest version, and finally check out our "known to be good" revision.
+
We extract things into $OMDIR/openembedded. OE.mtn.bz2 is about 100 MB.
+
 
+
<pre>
+
wget http://www.openembedded.org/snapshots/OE.mtn.bz2
+
bunzip2 OE.mtn.bz2
+
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev
+
mtn --db=OE.mtn checkout --branch=org.openembedded.dev \
+
  -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded
+
</pre>
+
 
+
{{note|For advanced users: if you ever want to update to the latest version of the repository, you would do a "pull" (see above), followed by:
+
cd $OMDIR/openembedded
+

Latest revision as of 10:51, 10 February 2012

Proposed for deletion: This page is proposed for deletion. Please see Wiki Issues#Pages proposed for deletion to discuss this proposal.

What this link point to has been deleted by 18. apr 2010, 17:19 Marko Knöbl.

  1. REDIRECT Building_Openmoko_2007.1_from_scratch
Personal tools

Contents

WARNING: This is still a preliminary version, which will take some more days until it has all the updates.


This is a guide describing how to set up a running OpenMoko system from scratch.

If you just want to run OpenMoko applications on your PC, just perform the "Obtaining OpenMoko SVN tree" step below and then go to How to run OpenMoko Apps on PC. If you want to autoinstall all required tools and resources, consider using MokoMakefile -- script developed by Rod Whitby.

Do not treat this as a linear script! There are various configuration items you need to set (or skip, as it may be), operations that depend on how your host(s) is/are set up, and also on the hardware revision of the target platform (i.e., the phone).

Instead, look at each step, read the instructions, copy and paste what makes sense for you, and adapt what you disagree with. Links to original and background material in the Wiki are included wherever useful.


Preparation

Roles

The build process may spread over multiple machines. They have the following roles:

BUILD
build host, with quick access to the files and CPU power. Must have Internet access.
LAB
lab machine connected to the debug board (serial and JTAG) and to USB on the Neo (since this will probably be just a single machine, the roles are not further divided)
CARD
machine with a USB-attached SD/MMC card reader

All machines are assumed to share the same filesystem layout. At the beginning of each of the sections below, the respective role is indicated. "(all)" is for settings that apply to all machines, or that - for simplicity - can be applied to all of them.


Directory layout

(Roles: all)

$OMDIR (/home/moko)	base directory for the whole tree
  openmoko/		files from OpenMoko subversion (SVN) repository
  openembedded/		files from OpenEmbedded (OE) Monotone repository
  sources/		cached downloads of OE
  build/		OE build directory


Environment variables

(Roles: all)

For simplicity, we just set these environment variables on all hosts involved. If you're not comfortable with this, feel free to weed out the ones you don't need.

Our base directory (configure this for local arrangements):

export OMDIR=/home/moko

The search path for BitBake files. Note that the order is of vital importance.

export BBPATH=$OMDIR/build:$OMDIR/openmoko/trunk/oe:$OMDIR/openembedded


Permissions

(Role: BUILD)

In order to perform the build process, you have to obtain the following permissions:

  • write access to the OpenMoko SVN repository (in principle, it should be possible to simplify this to read access. For further study.)


Build host prerequisites

(Role: BUILD)

There must be at least 7 GB of free space on $OMDIR.

In addition to the traditional development tools (gcc, patch, etc.), the following packages must be installed on the build host:

subversion
version control system used by OpenMoko and others
quilt
patch management system used by the Linux kernel and others
monotone
version control system used by OpenEmbedded. This should be a recent version, e.g., 0.32, although also 0.31 should work.
diffstat
the OE build process wants this
texi2html
this too
git
version control system used by the Linux kernel and others. Do not confuse this with the "GNU Interactive Tools"

Furthermore, the following package can be installed optionally:

psyco
Python just-in-time compiler. Speeds up OpenEmbedded builds (with BitBake) considerably. Strongly recommended.

Gentoo users can obtain all this with (note that, at the time of writing, Monotone 0.32 isn't available without setting the ~x86 keyword):

echo 'dev-util/monotone ~'`readlink /etc/make.profile | awk -F / '{print $6}'`\
  >>/etc/portage/package.keywords
emerge -u subversion quilt monotone diffstat texi2html dev-util/git psyco

Instructions for installing prerequisites in other distributions

If the local user name does not match the user name with which you access SVN, you can put your username in the url you use to checkout, eg. svn ssh://joe@stuff.org/svn/stuff.

Lab host prerequisites

(Role: LAB)

The following package must be installed on the lab host:

xc
a simple communications program for the serial port

Gentoo users can obtain this with:

emerge -u xc

Note that similar communications programs, such as "cu" or "minicom", may be used as well.

Assumptions

(Roles: LAB, CARD)

We make the following assumptions about hardware setup and devices:

  • the serial console of the Neo phone is connected to /dev/ttyS0 on LAB (see Debug_Board)
  • the JTAG wiggler is connected to /dev/parport0 on LAB. See Debug Board and Connecting_GTA01Bv2_with_Debug_Board
  • cards inserted in the SD/MMC card reader appear as /dev/uba on CARD and can be mounted on /mnt/tmp (we'll specify the mount point explicitly, so the directory has to be there, but we don't need to specify the mount point in /etc/fstab). If in doubt,
mkdir -p /mnt/tmp

Obtaining Sources and build system

OpenEmbedded build: initial downloads

First, we obtain a snapshot of the OpenEmbedded-based tree used by OpenMoko, plus the OE build tool called BitBake.


Obtaining OpenMoko SVN tree

(Role: BUILD)

Obtain the latest revision of the OpenMoko tree. Unfortunately, at some places, "current" versions of upstream packages may get included, thus the build may still fail. If it does, you may wish to inform the authorities.

The checkout should take about 45 minutes over an Internet connection with a round-trip time to svn.openmoko.org of 350 ms.

cd $OMDIR
svn co http://svn.openmoko.org/ openmoko

Installing BitBake

(Role: BUILD)

Install version 1.6 of BitBake, the build tool of OE. (This is quick.)

svn co http://svn.berlios.de/svnroot/repos/bitbake/branches/bitbake-1.6/ bitbake
cd bitbake
./setup.py install
cd ..


Obtaining OpenEmbedded snapshot

(Role: BUILD)

Obtain a snapshot of the Monotone repository of OpenEmbedded, then update it to the latest version, and finally check out our "known to be good" revision. We extract things into $OMDIR/openembedded. OE.mtn.bz2 is about 100 MB.

wget http://www.openembedded.org/snapshots/OE.mtn.bz2
bunzip2 OE.mtn.bz2
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev
mtn --db=OE.mtn checkout --branch=org.openembedded.dev \
  -r e2dbb52fe39df7ef786b6068f6178f29508dfded openembedded

{{note|For advanced users: if you ever want to update to the latest version of the repository, you would do a "pull" (see above), followed by:

cd $OMDIR/openembedded