BitBake is the build engine that powers the Yocto Project. It is a generic task execution engine that reads metadata — recipes, configuration files, and class definitions — and uses that information to schedule and execute the tasks needed to build a complete embedded Linux system.
BitBake's Four Core Concepts
BitBake manages the build through four key abstractions:
BitBake Four Concepts:
+------------------------------------------+
| 1. Images |
| End products: Linux images, packages |
| (e.g. core-image-minimal) |
+------------------------------------------+
| 2. Layers |
| Collections of recipes and configs |
| Organised by functionality |
+------------------------------------------+
| 3. Recipes (.bb files) |
| Build instructions for one component |
| Source location, dependencies, steps |
+------------------------------------------+
| 4. Tasks and Dependencies |
| do_fetch, do_compile, do_install... |
| Scheduled based on dependency graph |
+------------------------------------------+
The BitBake Command
BitBake is invoked from the command line after sourcing the Yocto build environment.
bitbake --help
The help output is organised into six categories:
General and Image
bitbake -u UI # Specify user interface (knotty, teamcity, etc.)
bitbake --version # Show BitBake version
bitbake -h # Show help message
Execution Control
bitbake -n # Dry run (parse and plan but do not execute)
bitbake -k # Continue as much as possible after an error
bitbake -p # Parse only (do not build)
bitbake -P # Profile the command and save reports
The -k flag is useful during debugging — it allows BitBake to continue building other packages even when one fails, giving you a complete picture of all errors in a single run.
Logging
bitbake -D # Increase debug level (use multiple times for more output)
bitbake -v # Verbose output
bitbake -q # Quiet output (less console noise)
Server Control
bitbake -B BIND # Bind the BitBake server to a specific address/port
bitbake -m # Terminate any running BitBake server
BitBake uses a client-server architecture. The server persists between builds to avoid re-parsing all metadata on every invocation.
Configuration
bitbake -r PREFILE # Read configuration before processing
bitbake -R POSTFILE # Read configuration after processing
Building with BitBake
Build an Image
bitbake core-image-minimal
This builds the complete minimal image — toolchain, bootloader, kernel, root filesystem, and final image files.
Build a Specific Recipe
bitbake busybox
bitbake linux-yocto
bitbake u-boot
BitBake Tasks
Every recipe is broken into tasks. The standard task pipeline is:
do_fetch
|
v
do_unpack
|
v
do_patch
|
v
do_configure
|
v
do_compile
|
v
do_install
|
v
do_package
|
v
do_build (default target)
Execute a Specific Task
Run only a specific task for a recipe (drop the do_ prefix):
bitbake -c fetch busybox
bitbake -c compile linux-yocto
bitbake -c install myapp
Fetch All Dependencies
bitbake -c fetchall core-image-minimal
This fetches source code for all recipes needed to build the image — useful for preparing an offline build.
List All Tasks for a Recipe
bitbake -c listtasks core-image-minimal
Clean a Recipe
bitbake -c cleanall busybox
This removes all downloaded sources, build artifacts, and packages for the specified recipe — forcing a full rebuild from scratch.
BitBake Parsing
Before executing any build, BitBake parses all metadata — recipes, configuration files, and classes. This can take some time on the first run but is cached subsequently.
To only parse without building:
bitbake -p
Parsing errors appear here and must be fixed before any build can proceed.
BitBake Output and Logs
Build logs are stored in the recipe's work directory:
tmp/work/<machine-arch>/
└── <recipe-name>/<version>/
├── temp/
│ ├── log.do_fetch
│ ├── log.do_compile
│ └── log.do_install
└── build/
(extracted and compiled source)
When a build task fails, check the corresponding log.do_<task> file for the detailed error output.
Final Thoughts
BitBake is the engine that makes the Yocto Project work. Understanding its command-line interface, the task pipeline, and how to target specific recipes and tasks makes debugging and development far more efficient.
BitBake Reference:
Build image: bitbake core-image-minimal
Build recipe: bitbake busybox
Run one task: bitbake -c fetch busybox
Fetch all: bitbake -c fetchall core-image-minimal
List tasks: bitbake -c listtasks core-image-minimal
Clean recipe: bitbake -c cleanall busybox
Dry run: bitbake -n core-image-minimal
Debug output: bitbake -DD core-image-minimal
Mastering BitBake is the key to mastering Yocto.