Getting Started
OpenEmbedded Directory Structure
Before you begin downloading OpenEmbedded, you need to setup your
working environment.
The first step is to decide where on your system you wish to
work. This document will use the $OEBASE variable to
denote the base directory of the OpenEmbedded environment. For
example, $OEBASE could
be /home/joe/work/oe.
The base directory of your OpenEmbedded environment
($OEBASE) is the location where sources will be checked
out (or unpacked). You must choose a location with no symlinks
above it.
To create the directory structure:
$ mkdir -p $OEBASE/build/conf
$ cd $OEBASE
The $OEBASE/build directory will contain your
local configurations and extensions to the OpenEmbedded system which allow
you to build your applications and images.
The $OEBASE will also contain both bitbake/ and
openembedded/ directories. These will be discussed in
and
.
Getting BitBake
Before using OE, you must first obtain the build tool it needs:
bitbake.
It is recommended to run bitbake without installing it, as a sibling
directory of openembedded/
and build/ directories. Indeed, as bitbake is written
in python it does not need compilation for being used. You'll just have to
set the PATH variable so that the BitBake tools are accessible (see
).
Downloading a BitBake release
Releases are available from the berlios project website. The current
release series is BitBake 1.8
and the current release is 1.8.12. To download execute
the following commands:
$ cd $OEBASE
$ wgethttp://download.berlios.de/bitbake/bitbake-1.8.12.tar.gz
$ tar -xvzf bitbake-1.8.12.tar.gz
$ mv bitbake-1.8.12 bitbake
BitBake is now downloaded and
the $OEBASE directory will contain
a bitbake/ subdirectory.
Getting OpenEmbedded
Note: Once upon a time OpenEmbedded used
Monotone for version control. If you have an OE Monotone repository on
your computer, you should replace it with the Git repository.
The OpenEmbedded metadata has a high rate of development, so it's a
good idea to stay up to date. You'll need Git to get the metadata and
stay up to date. Git is available in most distributions and has binaries
at Git homepage.
Checking Out OpenEmbedded With Git
Once you have installed Git, checkout the OpenEmbedded repository:
$ cd $OEBASE
$ git clone git://git.openembedded.org/openembedded
The $OEBASE/openembedded/ directory should now
exist.
Updating OpenEmbedded
The org.openembedded.dev branch of OpenEmbedded
is updated very frequently (as much as several times an hour). The
distro branches are not updated as much but still fairly often. It
seems good practice to update your OpenEmbedded tree at least
daily. To do this, run:
$ cd $OEBASE
$ git pull
Changing Branches
Working with multiple branches is very easy to do with Git. The
OpenEmbedded repository holds many branches. To list all branches, use this command:
$ git branch -a
Branch names that begin with origin/ denote
branches that exist on the remote server. The name with a * in front
of it is the branch currently checked out. If you want to work with a
remote branch, you must first create a local copy of it. The following
command will create a local copy of a remote branch:
$ git branch <local_name> <remote_name>
To change branches, use this command:
$ git checkout <branch_name>
There are more complicated branch operations that can be done with git,
but those are beyond the scope of this document.
Configuring OpenEmbedded
At this point, your $OEBASE/ directory should
contain at least the following subdirectories:
build/
bitbake/
openembedded/
Environment Setup
There are a few environment variables that you will need to set
before you can build software for OpenEmbedded using BitBake. You will
need to set these variables every time you open a terminal for
development. You can automate this in
~/.profile, /etc/profile, or
perhaps use a script to set the necessary variables for using BitBake.
Since the path to your OpenEmbedded installation will be used in
many places, setting it in your environment will allow you to use
the $OEBASE variable in all pathes and make it
easier to change in the future should the need arise. To
set $OEBASE if you use a Bourne like shell
If you use a CSH like shell (e.g. on a FreeBSD system), you
will set environment variables like this:
$ setenv VAR_NAME "VAR_VALUE"
, do this:
$ export OEBASE=/path/to/your/oe/installation
If you followed the recommendation to use BitBake from svn, you
will need to add the path to the BitBake executable to
your PATH environment variable like this:
$ export PATH=$OEBASE/bitbake/bin:$PATH
In order for bitbake to find the configuration files for
OpenEmbedded, you will need to set the BBPATH
variable.
$ export BBPATH=$OEBASE/build:$OEBASE/openembedded
Finally, if you wish to allow BitBake to inherit
the $OEBASE variable from the environment, you will
need to set the BB_ENV_EXTRAWHITE variable:
$ export BB_ENV_EXTRAWHITE="OEBASE"
Note the absence of the "$" character which implies that you are
setting BB_ENV_EXTRAWHITE to the variable name, not
the variable value.
Local Configuration
It is now time to create your local configuration. While you could
copy the default local.conf.sample like this:
$ cd $OEBASE
$ cp openembedded/conf/local.conf.sample build/conf/local.conf
$ vi build/conf/local.conf
It is actually recommended to start smaller and
keep local.conf.sample in the background. Add
entries from there step-by-step as you understand and need
them. Please, do not just edit
build/conf/local.conf.sample but
actually READ it (read it and then edit it).
For building an org.openembedded.dev branch, in
your local.conf file, you should have at least
the following three
entries: BBFILES, DISTRO
and MACHINE. For example, consider the following
minimal local.conf file for the Ångström
distribution and the Openmoko gta01 machine:
BBFILES = "${OEBASE}/openembedded/recipes/*/*.bb"
DISTRO = "angstrom-2008.1"
MACHINE = "om-gta01"
Building Software
The primary interface to the build system is
the bitbake command (see
the BitBake
users manual). BitBake will download and patch files from the
internet, so it helps if you are on a well connected machine.
Note that you should issue all BitBake commands from inside of the
build/ directory, or you should
override TMPDIR in
your $OEBASE/build/conf/local.conf to point
elsewhere (by default it goes to tmp/ relative to
the directory you run bitbake commands in).
BitBake might complain that there is a problem with the setting in
/proc/sys/vm/mmap_min_addr, which needs to be set
to zero. You can set it by doing the following as root:
# echo 0 > /proc/sys/vm/mmap_min_addr
Note that you can not use a text editor to do this since files
in /proc are not real files. Also note that this
above change will be lost when you reboot your system. To have the
change made automatically when the system boots, some systems provide
a /etc/sysctl.conf file. Add the following line
to that file:
vm.mmap_min_addr=0
If your system does not provide
the /etc/sysctl.conf mechanism, you can try adding
the above echo command line to
your /etc/rc.local.
Once BitBake and OpenEmbedded are set up and configured, you can build
software and images like this:
$ bitbake <recipe_name>
A recipe name corresponds to a BitBake .bb file. A
BitBake file is a logical unit of tasks to be executed. Normally this is
a package to be built. Inter-recipe dependencies are obeyed. The recipes
are located by BitBake via the BBFILES variable (set
in your $OEBASE/build/conf/local/conf), which is a
space separated list of .bb files, and does handle
wildcards.
To build a single package, bypassing the long parse step (and
therefore its dependencies -- use with care):
$ bitbake -b $OEBASE/openembedded/recipes/blah/blah.bb
There are a few groups of special recipes located in subdirectories
of the $OEBASE/openembedded/recipes/
directory. These groups are:
tasks/
A collection of meta-packages that depend on real
packages to make managing package sets easier.
meta/
A collection of useful meta tasks and recipes that
don't fit in a general category.
images/
A collection of image targets that depend on
packages that will be installed into an image which can be put
on the target system.
Useful Target Recipes
Although BitBake can build individual packages, it is often more
useful to build a set of packages and combine them into an image. The
following recipe names are commonly used to that effect.
Images
helloworld-image
Builds an image, that if used as a root filesystem, will
start a static executable that prints hello world then
loops infinitely. Can be used to test the Linux boot
procedure into user space (init).
bootstrap-image
Build image contains task-base packages.
console-image
Build an image without the X11, gtk+, or qt windowing
libraries.
x11-image
Builds an image with X11.
beagleboard-demo-image
Builds the Ångström distribution like Koen
proposed.
opie-image
Build image based on the
Open Palmtop
Integrated Environment (OPIE). OPIE is a completely
Open Source based graphical user environment and suite of
applications for small form-factor devices, such as PDAs,
running Linux.
opie-kdepim-image
Build image based on the OPIE and full featured
KDE-based PIM (pi-sync, ko/pi, ka/pi, etc).
pivotboot-image
Build image that is necessary to flash a Sharp SL C3000,
Zaurus. It pivots after booting from the NAND and finalizes
the install to the HD during the first boot.
twin-image
A image with task-base plus a couple of editors, nano and
vim (why two?), and a mail reader, mutt.
uml-image
A root image for user-mode-linux. Includes task-base,
and parts of opie.
gpe-image
Build a GPE
Palmtop Environment based kernel and rootfs. The GPE
provides a user interface environment for palmtop/handheld
computers running the GNU/Linux or any other UNIX-like
operating system.
Tasks
task-base
Build a kernel and core packages for a basic
installation. You won't be able to do much more than ssh to
the machine if this is all that is installed.
task-dvb
Meta-package for DVB application (DVB = Digital Video
Broadcasting).
task-python-everything
All of python.
task-native-sdk
Mata-package for native (on-device) SDK.
Meta
meta-opie
Build all OPIE related packages and some more for OPIE
based usage.
meta-gpe
Basic packages to go with gpe-image.
Other
helloworld
Builds a static executable that prints hello
world then loops infinitely.
world
Build everything. This takes a long time, a lot
of network bandwidth, and a lot of disc space. Can also
break your toolchain.
package-index
Target to update the "feed" files to reflect the current
set of .ipk's that exist in the deploy directory. Commonly
used after building some packages individually to update the
feed and allow them to be installed via a package manager or
the ipkg command line tools.
virtual/kernel
Builds the appropriate kernel for your device.