(For more resources related to this topic, see here.)
Understanding the BitBake tool
The BitBake task scheduler started as a fork from Portage, which is the package management system used in the Gentoo distribution. However, nowadays the two projects have diverged a lot due to the different usage focusses. The Yocto Project and the OpenEmbedded Project are the most known and intensive users of BitBake, which remains a separated and independent project with its own development cycle and mailing list (firstname.lastname@example.org).
BitBake is a task scheduler that parses Python and the Shell Script mixed code. The code parsed generates and runs tasks that may have a complex dependency chain, which is scheduled to allow a parallel execution and maximize the use of computational resources. BitBake can be understood as a tool similar to GNU Make in some aspects.
The metadata used by BitBake can be classified into three major areas:
- Configuration (the .conf files)
- Classes (the .bbclass files)
- Recipes (the .bb and and .bbappend files)
The configuration files define the global content, which is used to provide information and configure how the recipes will work. One common example of the configuration file is the machine file that has a list of settings, which describes the board hardware.
The classes are used by the whole system and can be inherited by recipes, according to their needs or by default, as in this case with classes used to define the system behavior and provide the base methods. For example, kernel.bbclass helps the process of build, install, and package of the Linux kernel, independent of version and vendor.
The recipes and classes are written in a mix of Python and Shell Scripting code.
The classes and recipes describe the tasks to be run and provide the needed information to allow BitBake to generate the needed task chain. The inheritance mechanism that permits a recipe to inherit one or more classes is useful to reduce code duplication, and eases the maintenance. A Linux kernel recipe example is linux-yocto_3.14.bb, which inherits a set of classes, including kernel.bbclass.
BitBake's most commonly used aspects across all types of metadata (.conf, .bb, and .bbclass).
In this article, we studied about BitBake and the classification of metadata.
Resources for Article:
- Installation and Introduction of K2 Content Construction Kit [article]
- Linux Shell Script: Tips and Tricks [article]
- Customizing a Linux kernel [article]