Understanding BitBake

The ecosystem around BitBake, how one build target expands into a dependency tree, and the task lifecycle behind every recipe.

Yocto is not a single program

Another important concept is that Yocto is an ecosystem rather than one executable.

Several components work together.

The most important concepts are:

The four top-level parts of the Yocto project and what metadata holds Yocto Project BitBake OpenEmbedded Metadata BSPs Recipes Classes Configuration Layers
Almost everything you edit lives in metadata, which is why a change to a recipe can be reviewed like code.

Let’s look at these individually.

BitBake

BitBake is the task execution engine used by Yocto.

It reads recipes and configuration files and determines what needs to be built.

For example:

What the core-image-minimal recipe pulls into the image core-image-minimal root filesystem packages libc kernel bootloader machine configuration dependencies
A recipe is a dependency list: everything the image contains is declared here, nothing is copied in by hand.

This tells BitBake to build the core-image-minimal image.

BitBake then determines the dependencies required to create that image.

BitBake builds the required components in the correct order.

Understanding the build process

One of the most useful things to understand is what happens internally.

A simplified recipe lifecycle looks like:

The seven tasks BitBake runs for each recipe do_fetch do_unpack do_patch do_configure do_compile do_install do_package
Every task is cached and skippable, which is why a second build only re-runs what actually changed.

Finally, packages can be combined into a root filesystem.

For example:

How source code becomes a final bootable image Source Fetch Unpack Patch Configure Compile Install Package Root filesystem Final image
One recipe walks this path, and its output ends up inside the root filesystem of the final image.

Understanding this sequence is extremely useful when debugging Yocto.