Chapter8 Recipes

Table of Contents

Syntax of recipes
Recipe naming: Names, versions and releases
Sources: Downloading, patching and additional files
Directories: What goes where
WORKDIR: The working directory
S: The unpacked source code directory
D: The destination directory
Staging directories
FILESPATH/FILESDIR: Finding local files
Basic examples
Hello world
An autotools package
Dependencies: What's needed to build and/or run the package?
Methods: Inbuilt methods to make your life easier
Packaging: Defining packages and their contents
Default packages and files
Checking the packages
Excluding files
Debian naming
Empty packages
Tasks: Playing with tasks
Classes: The separation of common functionality
Staging: Making includes and libraries available for building
Autoconf: All about autotools
Installation scripts: Running scripts during package install and/or removal
Configuration files
Package relationships
Fakeroot: Dealing with the need for "root"
Native: Packages for the build host
Development: Strategies for developing recipes
Advanced versioning: How to deal with rc and pre versions
Require/include: Reusing recipe contents
Python: Advanced functionality with python
Preferences: How to disable packages
Initscripts: How to handle daemons
Alternatives: How to handle the same command in multiple packages
Example of alternative commands
Using update-alternatives
Volatiles: How to handle the /var directory
Declaring volatiles
Logging and log files


A bitbake recipe is a set of instructions that describe what needs to be done to retrieve the source code for some application, apply any necessary patches, provide any additional files (such as init scripts), compile it, install it and generated binary packages. The end result is a binary package that you can install on your target device, and maybe some intermediate files, such as libraries and headers, which can be used when building other application.

In many ways the process is similar to creating .deb or .rpm packages for your standard desktop distributions with one major difference - in OpenEmbedded everything is being cross-compiled. This often makes the task far more difficult (depending on how well suited the application is to cross compiling), then it is for other packaging systems and sometime impossible.

This chapter assumes that you are familiar with working with bitbake, including the work flow, required directory structures, bitbake configuration and the use of monotone. If you are not familiar with these then first take a look at the chapter on bitbake usage.