View source for BitBake

From Openmoko

Jump to: navigation, search

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Administrators.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page:

Template used on this page:

Return to BitBake.

Personal tools

BitBake is the build tool used by OpenEmbedded. BitBake recipes are simple, declarative files. Here is an example for the openmoko-calculator2 application:

 DESCRIPTION = "A Calculator for Openmoko"
 SECTION = "openmoko/tools"
 DEPENDS = "libmokoui2"
 PV = "0.1.0+svnr${SRCREV}"
 PR = "r0"

 inherit openmoko2

The user manual is available at the BitBake berlios page.

Set Bitbake building environment

Basically, using bitbake to build your image is very easy.

  • Get bitbake
  • Get OpenEmbedded tree
  • Set local configuare file
  • Set building environment variables.

All you need is these four things. Lets assume you are using a account named build, and you are working under directory moko.

Get BitBake

Note: The instructions below are fairly out of date. It is not actually necessary to use bitbake-om. Any version of BitBake as recent or more recent than 1.8.12 (>=bitbake-1.8.12) is all that is necessary. OpenMoko development is largely moving upstream to the main OpenEmbedded repository. To get started, please follow the instructions available on the OpenEmbedded Wiki under OEandYourDistro. -- User:Cfriedt 20090109

$cd ~/moko  # Enter the directory
$git clone git:// bitbake-om  # get the bitbake of openmoko.

Bitbake come for OpenEmbedded, however Openmoko has its own bitbake, named bitbake-om. After cloning the bitbake-om, you have the kitchen comprehensive. You also need recipes to tell you how to cook.

Get OpenEmbedded Tree

Note: The instructions below are fairly out of date. To get started with OpenEmbedded, please follow the instructions under OpenEmbedded. -- User:Cfriedt 20090109

$git clone git:// openmoko

It will clone an OE tree from Openmoko git server. This is the recipes what tell bitbake how to cook. The cloning process spend little time, get a cup of coffee is a good idea when you are waiting.

Set Local configuare file

$install -d /home/build/moko/local/conf #create the direcotry
$vim local/conf/local.conf # use your favorite editor

Paste these line into the file

BBFILES := "/home/build/moko/openmoko/packages/*/*.bb"
DISTRO = "openmoko"
DL_DIR := "/home/build/moko/sources"
IMAGE_FSTYPES = "jffs2 tar.gz"
INHERIT += "om-utils"
MACHINE = "om-gta02"
QA_LOG = "1"
TMPDIR := "/home/build/moko/build/"

Let me explain the meanings of some variables.

  • BBFILES: It tells bitbake where those recipes are.
  • DL_DIR: Bitbake fetch source code and put them here.
  • MACHINE: I build packages for gta02. If you are going to build for gta01, replace it with "om-gta01"
  • PARALLEL_MAKE: Please read the manual of "make" and search the -j option.
  • TMPDIR: All of your building result will place here.

Set building environment variables

$vim build_env  # use your favorite editor

Paste these lines into the file

export BBPATH="/home/build/moko/local:/home/build/moko/openmoko"
export PATH=/home/build/moko/bitbake-om/bin:$PATH

Update environment

bitbake-om won't change often. But the OE tree (/home/build/moko/openmoko) almost change everyday. Update them is important so you can get the latest fix.

$cd /home/build/moko/bitbake-om
$git pull
$cd /home/build/moko/openmoko
$git pull

Starting use bitbake

The first time you use bitbake will spend many hours. It have to fetch every source code what you need. To build the meta toolchain, and many basic libraries like glibc.

$source /home/build/moko/build_env  #read in the environment variables.
$bitbake helloworld # build the simplest case.
Playing video game for 5 hours, Watching movie for 3 hours and Sleeping for 8 hours.

If you wanna try something like fso image, just ask bitbake to cook another food.

$bitbake fso-image

All the recipe are placed in /home/build/moko/openmoko/packages. For example, fso-image recipe is placed in /home/build/moko/openmoko/packages/images/

After the building process complete, the opk files are placed in /home/build/moko/build/deploy/glibc/opk, and the image is in /home/build/moko/build/deploy/images.