Welcome to the Yocto Project Documentation
Yocto Project Quick Build
Welcome!
This short document steps you through the process for a typical image build using the Yocto Project. The document also introduces how to configure a build for specific hardware. You will use Yocto Project to build a reference embedded OS called Poky.
Note
The examples in this paper assume you are using a native Linux system running a supported version of Ubuntu Linux distribution. If the machine you want to use Yocto Project on to build an image (Build Host) is not a native Linux system, you can still perform these steps by using CROss PlatformS (CROPS) and setting up a Poky container. See the Setting Up to Use CROss PlatformS (CROPS) section in the Yocto Project Development Tasks Manual for more information.
You may use version 2 of Windows Subsystem For Linux (WSL 2) to set up a build host using Windows 10 or later, Windows Server 2019 or later. See the Setting Up to Use Windows Subsystem For Linux (WSL 2) section in the Yocto Project Development Tasks Manual for more information.
If you want more conceptual or background information on the Yocto Project, see the Yocto Project Overview and Concepts Manual.
Compatible Linux Distribution
Make sure your Build Host meets the following requirements:
At least 140 Gbytes of free disk space, though much more will help to run multiple builds and increase performance by reusing build artifacts.
At least 32 Gbytes of RAM, though a modern build host with as much RAM and as many CPU cores as possible is strongly recommended to maximize build performance.
Runs a supported Linux distribution (i.e. recent releases of Fedora, openSUSE, CentOS, Debian, or Ubuntu). For a list of Linux distributions that support the Yocto Project, see the Supported Linux Distributions section in the Yocto Project Reference Manual. For detailed information on preparing your build host, see the Preparing the Build Host section in the Yocto Project Development Tasks Manual.
Ensure that the following utilities have these minimum version numbers:
Git 1.8.3.1 or greater
tar 1.28 or greater
Python 3.9.0 or greater.
gcc 10.1 or greater.
GNU make 4.0 or greater
If your build host does not satisfy all of the above version requirements, you can take steps to prepare the system so that you can still use the Yocto Project. See the Required Git, tar, Python, make and gcc Versions section in the Yocto Project Reference Manual for information.
Build Host Packages
Here are the packages needed to build an image on a headless system with a supported Ubuntu or Debian Linux distribution:
sudo apt-get install build-essential chrpath cpio debianutils diffstat file gawk gcc git iputils-ping libacl1 locales python3 python3-git python3-jinja2 python3-pexpect python3-pip python3-subunit socat texinfo unzip wget xz-utils zstd
You also need to ensure you have the en_US.UTF-8 locale enabled:
$ locale --all-locales | grep en_US.utf8
If this is not the case, you can reconfigure the locales package to add it
(requires an interactive shell):
$ sudo dpkg-reconfigure locales
Note
If you are not in an interactive shell,
dpkg-reconfigurewill not work as expected. To add the locale you will need to edit/etc/locale.genfile to add/uncomment theen_US.UTF-8locale. A naive way to do this as root is:$ echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen $ locale-gen
If your build system has the
oss4-devpackage installed, you might experience QEMU build failures due to the package installing its own custom/usr/include/linux/soundcard.hon the Debian system. If you run into this situation, try either of these solutions:$ sudo apt build-dep qemu $ sudo apt remove oss4-dev
Note
For host package requirements on all supported Linux distributions, see the Required Packages for the Build Host section in the Yocto Project Reference Manual.
Use Git to Clone bitbake-setup
Once you complete the setup instructions for your machine, you need to
get a copy of the bitbake-setup tool to setup the Poky reference
distribution on your build host. Use the following commands to clone
the bitbake repository.
$ git clone https://git.openembedded.org/bitbake
Setup a build environment with the following command:
$ ./bitbake/bin/bitbake-setup init
By default, this will setup a top directory in the current directory.
If you prefer to setup your builds in a different top directory, for example
$HOME/bitbake-builds, you can set it with the bitbake-setup settings command:
$ ./bitbake/bin/bitbake-setup settings set --global default top-dir-prefix $HOME
Note
Use bitbake-setup settings list to get an overview of the settings.
bitbake-setup init is an interactive program by default and will ask you to make some decisions. Depending on your answers, the output may differ from the examples below.
Choose a configuration (for example,
poky-master):Available configurations: 1. poky-master Poky - The Yocto Project testing distribution configurations and hardware test platforms 2. oe-nodistro-whinlatter OpenEmbedded - 'nodistro' basic configuration, release 5.3 'whinlatter' 3. poky-whinlatter Poky - The Yocto Project testing distribution configurations and hardware test platforms, release 5.3 'whinlatter' 4. oe-nodistro-master OpenEmbedded - 'nodistro' basic configuration ... Please select one of the above configurations by its number: 1
Depending on the choice above, new options can be prompted to further specify which configuration to use. For example:
Available bitbake configurations: 1. poky Poky - The Yocto Project testing distribution 2. poky-with-sstate Poky - The Yocto Project testing distribution with internet sstate acceleration. Use with caution as it requires a completely robust local network with sufficient bandwidth. Please select one of the above bitbake configurations by its number: 1
Choose a target MACHINE (for example,
qemux86-64):Target machines: 1. machine/qemux86-64 2. machine/qemuarm64 3. machine/qemuriscv64 4. machine/genericarm64 5. machine/genericx86-64 Please select one of the above options by its number: 1
Choose a DISTRO (for example,
poky):Distribution configuration variants: 1. distro/poky 2. distro/poky-altcfg 3. distro/poky-tiny Please select one of the above options by its number: 1
Choose a setup directory name:
Enter setup directory name: [poky-master-poky-distro_poky-machine_qemux86-64]
Press Enter to leave it to the default value shown in the brackets, or type a custom directory name.
Note
If you prefer to run non-interactively, you can run a command like the following:
$ bitbake-setup init --non-interactive poky-master poky-with-sstate distro/poky machine/qemux86-64
The init command creates a new Setup in the
top directory. The default name is derived from the selected
configuration above.
For the selected options in the above example, this would be:
poky-master-poky-distro_poky-machine_qemux86-64
This will be our example configuration in the following sections.
This directory contains:
The BitBake Build directory, named
build. Later, when the build completes, this directory contains all the files created during the build.This directory also contains a
README, describing the current configuration and showing some instructions.The layers needed to build the Poky reference distribution, in the
layersdirectory.A
configdirectory, representing the current configuration used for this setup.
Note
It is also possible to setup the Poky reference distro manually. For that refer to the Setting Up the Poky Reference Distro Manually section of the Yocto Project Development Tasks Manual.
Building Your Image
Use the following steps to build your image. The build process creates an entire Linux distribution, including the toolchain, from source.
Note
If you are working behind a firewall and your build host is not set up for proxies, you could encounter problems with the build process when fetching source code (e.g. fetcher failures or Git failures).
If you do not know your proxy settings, consult your local network infrastructure resources and get that information. A good starting point could also be to check your web browser settings. Finally, you can find more information on the “Working Behind a Network Proxy” page of the Yocto Project Wiki.
Initialize the Build Environment: Source the
init-build-envenvironment setup script within the BitBake build directory to setup the BitBake build environment on your host:$ source poky-master-poky-distro_poky-machine_qemux86-64/build/init-build-env Poky reference distro build
Examine Your Current Configuration: When you set up the build environment, an configuration file named toolcfg.conf becomes available in a
conf/sub-directory of the BitBake build directory. This file is automatically modified by thebitbake-config-buildcommand-line tool. With this tool, list the currently enabled configuration fragments:$ bitbake-config-build list-fragments
For this configuration, the default is to use two Built-in Fragments:
These fragment values correspond to the choices made when running bitbake-setup init.
Note
These set up the environment similar to what was previously in the local configuration file local.conf, which is now largely empty. To setup the build how it was done previously, see the Setting Up the Poky Reference Distro Manually section of the Yocto Project Development Tasks Manual.
The current configuration does not allow the
rootuser to login. As this can be useful for development, you can enable the core/yocto/root-login-with-empty-password fragment:$ bitbake-config-build enable-fragment root-login-with-empty-password
Note
You can significantly speed up your build and guard against fetcher failures by using Shared State Cache mirrors and enabling Hash Equivalence. This way, you can use pre-built artifacts rather than building them. This is relevant only when your network and the server that you use can download these artifacts faster than you would be able to build them.
To use such mirrors, enable the core/yocto/sstate-mirror-cdn fragment:
$ bitbake-config-build enable-fragment core/yocto/sstate-mirror-cdn
The hash equivalence server needs the websockets python module version 9.1 or later. Debian GNU/Linux 12 (Bookworm) and later, Fedora, CentOS Stream 9 and later, and Ubuntu 22.04 (LTS) and later, all have a recent enough package. Other supported distributions need to get the module some other place than their package feed, e.g. via
pip. You can otherwise install a Buildtools tarball by following the instructions in the Required Git, tar, Python, make and gcc Versions section of the Yocto Project Reference Manual.Start the Build: Continue with the following command to build an OS image for the target, which is
core-image-satoin this example:$ bitbake core-image-sato
For information on using the
bitbakecommand, see the BitBake section in the Yocto Project Overview and Concepts Manual, or see The BitBake Command in the BitBake User Manual.Simulate Your Image Using QEMU: Once this particular image is built, you can start QEMU, which is a Quick EMUlator that ships with the Yocto Project:
$ runqemu qemux86-64
If you want to learn more about running QEMU, see the Using the Quick EMUlator (QEMU) chapter in the Yocto Project Development Tasks Manual.
Exit QEMU: Exit QEMU by either clicking on the shutdown icon or by typing
Ctrl-Cin the QEMU transcript window from which you evoked QEMU.
Customizing Your Build for Specific Hardware
So far, all you have done is quickly built an image suitable for emulation only. This section shows you how to customize your build for specific hardware by adding a hardware layer into the Yocto Project development environment.
In general, layers are repositories that contain related sets of instructions and configurations that tell the Yocto Project what to do. Isolating related metadata into functionally specific layers facilitates modular development and makes it easier to reuse the layer metadata.
Note
By convention, layer names start with the string “meta-“.
Follow these steps to add a BSP layer:
Find a Layer: Many BSP layers are available. The layer index can be used to find such layers. This example adds the meta-raspberrypi BSP layer.
First, clone the layer next the other layers:
git clone -b whinlatter https://git.yoctoproject.org/meta-raspberrypi ../layers/meta-raspberrypi
Add Your Layer to the Layer Configuration File: Before you can use it, you must add the layer and its dependencies to your
bblayers.conffile, which is found in the Build Directory (conf/) directory.For this, the
bitbake-layers add-layercan be used:$ bitbake-layers add-layer ../layers/meta-raspberrypi
You can find more information on adding layers in the Adding a Layer Using the bitbake-layers Script section.
Change the Configuration to Build for a Specific Machine: The MACHINE variable is defined by the machine/ fragment. For this example, the meta-raspberrypi layer provides the raspberrypi5 machine, so let’s make it the MACHINE used for the build with
bitbake-config-build:$ bitbake-config-build enable-fragment machine/raspberrypi5
Note
See the “Examine Your Current Configuration” step earlier for more information on configuring the build.
The
raspberrypi5build depends on non-free firmware (https://github.com/RPi-Distro/firmware-nonfree) that includes the Synaptics license. See the ipcompliance.md document for more information. Add thesynaptics-killswitchvalue to the LICENSE_FLAGS_ACCEPTED variable, in theconf/local.conffile of your build directory:LICENSE_FLAGS_ACCEPTED = "synaptics-killswitch"
Start The Build: The configuration is now set to build for the Raspberry Pi 5. Start the build again:
$ bitbake core-image-sato
Completing these steps has added the meta-raspberrypi layer to your Yocto
Project development environment and configured it to build for the
raspberrypi5 machine.
Note
The previous steps are for demonstration purposes only. If you were
to attempt to build an image for the raspberrypi5 machine, you
should read the README.md file in meta-raspberrypi.
Creating Your Own General Layer
Maybe you have an application or specific set of behaviors you need to
isolate. You can create your own general layer using the
bitbake-layers create-layer command. The tool automates layer
creation by setting up a subdirectory with a layer.conf
configuration file, a recipes-example subdirectory that contains an
example.bb recipe, a licensing file, and a README.
The following commands run the tool to create a layer named
meta-mylayer:
$ bitbake-layers create-layer ../layers/meta-mylayer
NOTE: Starting bitbake server...
Add your new layer with 'bitbake-layers add-layer ../layers/meta-mylayer'
Note
By convention, layers are placed side-by-side.
For more information on layers and how to create them, see the Creating Your Own Layer section in the Yocto Project Development Tasks Manual.
Where To Go Next
Now that you have experienced using the Yocto Project, you might be asking yourself “What now?”. The Yocto Project has many sources of information including the website, wiki pages, and user manuals:
Website: The Yocto Project Website provides background information, the latest builds, breaking news, full development documentation, and access to a rich Yocto Project Development Community into which you can tap.
Video Seminar: The Introduction to the Yocto Project and BitBake, Part 1 and Introduction to the Yocto Project and BitBake, Part 2 videos offer a video seminar introducing you to the most important aspects of developing a custom embedded Linux distribution with the Yocto Project.
Yocto Project Overview and Concepts Manual: The Yocto Project Overview and Concepts Manual is a great place to start to learn about the Yocto Project. This manual introduces you to the Yocto Project and its development environment. The manual also provides conceptual information for various aspects of the Yocto Project.
Yocto Project Wiki: The Yocto Project Wiki provides additional information on where to go next when ramping up with the Yocto Project, release information, project planning, and QA information.
Yocto Project Mailing Lists: Related mailing lists provide a forum for discussion, patch submission and announcements. There are several mailing lists grouped by topic. See the Mailing lists section in the Yocto Project Reference Manual for a complete list of Yocto Project mailing lists.
Comprehensive List of Links and Other Documentation: The Links and Related Documentation section in the Yocto Project Reference Manual provides a comprehensive list of all related links and other user documentation.
Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales as published by Creative Commons.
To report any inaccuracies or problems with this (or any other Yocto Project)
manual, or to send additions or changes, please send email/patches to the Yocto
Project documentation mailing list at docs@lists.yoctoproject.org or
log into the Libera Chat #yocto channel.
What I wish I’d known about Yocto Project
Note
Before reading further, make sure you’ve taken a look at the Software Overview page which presents the definitions for many of the terms referenced here. Also, know that some of the information here won’t make sense now, but as you start developing, it is the information you’ll want to keep close at hand. These are best known methods for working with Yocto Project and they are updated regularly.
Using the Yocto Project is fairly easy, until something goes wrong. Without an understanding of how the build process works, you’ll find yourself trying to troubleshoot “a black box”. Here are a few items that new users wished they had known before embarking on their first build with Yocto Project. Feel free to contact us with other suggestions.
Use Git, not the tarball download: If you use git the software will be automatically updated with bug updates because of how git works. If you download the tarball instead, you will need to be responsible for your own updates.
Get to know the layer index: All layers can be found in the layer index. Layers which have applied for Yocto Project Compatible status (structure continuity assurance and testing) can be found in the Yocto Project Compatible Layers page. Generally check the Compatible layer index first, and if you don’t find the necessary layer check the general layer index. The layer index is an original artifact from the Open Embedded Project. As such, that index doesn’t have the curating and testing that the Yocto Project provides on Yocto Project Compatible layer list, but the latter has fewer entries. Know that when you start searching in the layer index that not all layers have the same level of maturity, validation, or usability. Nor do searches prioritize displayed results. There is no easy way to help you through the process of choosing the best layer to suit your needs. Consequently, it is often trial and error, checking the mailing lists, or working with other developers through collaboration rooms that can help you make good choices.
Use existing BSP layers from silicon vendors when possible: Intel, TI, NXP and others have information on what BSP layers to use with their silicon. These layers have names such as “meta-intel” or “meta-ti”. Try not to build layers from scratch. If you do have custom silicon, use one of these layers as a guide or template and familiarize yourself with the Yocto Project Board Support Package Developer’s Guide.
Do not put everything into one layer: Use different layers to logically separate information in your build. As an example, you could have a BSP layer, a GUI layer, a distro configuration, middleware, or an application (e.g. “meta-filesystems”, “meta-python”, “meta-intel”, and so forth). Putting your entire build into one layer limits and complicates future customization and reuse. Isolating information into layers, on the other hand, helps keep simplify future customizations and reuse.
Never modify the core layers (BitBake, OpenEmbedded-Core (OE-Core) and possibly meta-yocto). Never. Ever. When you update to the next release, you’ll lose all of your work. ALL OF IT.**
Don’t be fooled by documentation searching results: Yocto Project documentation is always being updated. Unfortunately, when you use Google to search for Yocto Project concepts or terms, Google consistently searches and retrieves older versions of Yocto Project manuals. For example, searching for a particular topic using Google could result in a “hit” on a Yocto Project manual that is several releases old. To be sure that you are using the most current Yocto Project documentation, use the drop-down menu at the top of any of its page.
Many developers look through the All-in-one ‘Mega’ Manual for a concept or term by doing a search through the whole page. This manual is a concatenation of the core set of Yocto Project manual. Thus, a simple string search using Ctrl-F in this manual produces all the “hits” for a desired term or concept. Once you find the area in which you are interested, you can display the actual manual, if desired. It is also possible to use the search bar in the menu or in the left navigation pane.
Understand the basic concepts of how the build system works: the workflow: Understanding the Yocto Project workflow is important as it can help you both pinpoint where trouble is occurring and how the build is breaking. The workflow breaks down into the following steps:
Fetch – get the source code
Extract – unpack the sources
Patch – apply patches for bug fixes and new capability
Configure – set up your environment specifications
Build – compile and link
Install – copy files to target directories
Package – bundle files for installation
During “fetch”, there may be an inability to find code. During “extract”, there is likely an invalid zip or something similar. In other words, the function of a particular part of the workflow gives you an idea of what might be going wrong.
Know that you can generate a dependency graph and learn how to do it: A dependency graph shows dependencies between recipes, tasks, and targets. You can use the “-g” option with BitBake to generate this graph. When you start a build and the build breaks, you could see packages you have no clue about or have any idea why the build system has included them. The dependency graph can clarify that confusion. You can learn more about dependency graphs and how to generate them in the Generating Dependency Graphs section in the BitBake User Manual.
Here’s how you decode “magic” folder names in tmp/work: The build system fetches, unpacks, preprocesses, and builds. If something goes wrong, the build system reports to you directly the path to a folder where the temporary (build/tmp) files and packages reside resulting from the build. For a detailed example of this process, see the example. Unfortunately this example is on an earlier release of Yocto Project.
When you perform a build, you can use the “-u” BitBake command-line option to specify a user interface viewer into the dependency graph (e.g. knotty, ncurses, or taskexp) that helps you understand the build dependencies better.
You can build more than just images: You can build and run a specific task for a specific package (including devshell) or even a single recipe. When developers first start using the Yocto Project, the instructions found in the Yocto Project Quick Build show how to create an image and then run or flash that image. However, you can actually build just a single recipe. Thus, if some dependency or recipe isn’t working, you can just say “bitbake foo” where “foo” is the name for a specific recipe. As you become more advanced using the Yocto Project, and if builds are failing, it can be useful to make sure the fetch itself works as desired. Here are some valuable links: Using a Development Shell for information on how to build and run a specific task using devshell. Also, the SDK manual shows how to build out a specific recipe.
An ambiguous definition: Package vs Recipe: A recipe contains instructions the build system uses to create packages. Recipes and Packages are the difference between the front end and the result of the build process.
As mentioned, the build system takes the recipe and creates packages from the recipe’s instructions. The resulting packages are related to the one thing the recipe is building but are different parts (packages) of the build (i.e. the main package, the doc package, the debug symbols package, the separate utilities package, and so forth). The build system splits out the packages so that you don’t need to install the packages you don’t want or need, which is advantageous because you are building for small devices when developing for embedded and IoT.
You will want to learn about and know what’s packaged in the root filesystem.
Create your own image recipe: There are a number of ways to create your own image recipe. We suggest you create your own image recipe as opposed to appending an existing recipe. It is trivial and easy to write an image recipe. Again, do not try appending to an existing image recipe. Create your own and do it right from the start.
Finally, here is a list of the basic skills you will need as a systems developer. You must be able to:
deal with corporate proxies
add a package to an image
understand the difference between a recipe and package
build a package by itself and why that’s useful
find out what packages are created by a recipe
find out what files are in a package
find out what files are in an image
add an ssh server to an image (enable transferring of files to target)
know the anatomy of a recipe
know how to create and use layers
find recipes (with the OpenEmbedded Layer index)
understand difference between machine and distro settings
find and use the right BSP (machine) for your hardware
find examples of distro features and know where to set them
understanding the task pipeline and executing individual tasks
understand devtool and how it simplifies your workflow
improve build speeds with shared downloads and shared state cache
generate and understand a dependency graph
generate and understand BitBake environment
build an Extensible SDK for applications development
Depending on what you primary interests are with the Yocto Project, you could consider any of the following reading:
Look Through the Yocto Project Development Tasks Manual: This manual contains procedural information grouped to help you get set up, work with layers, customize images, write new recipes, work with libraries, and use QEMU. The information is task-based and spans the breadth of the Yocto Project. See the Yocto Project Development Tasks Manual.
Look Through the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual: This manual describes how to use both the standard SDK and the extensible SDK, which are used primarily for application development. The Using the Extensible SDK also provides example workflows that use devtool. See the section Using devtool in Your SDK Workflow for more information.
Learn About Kernel Development: If you want to see how to work with the kernel and understand Yocto Linux kernels, see the Yocto Project Linux Kernel Development Manual. This manual provides information on how to patch the kernel, modify kernel recipes, and configure the kernel.
Learn About Board Support Packages (BSPs): If you want to learn about BSPs, see the Yocto Project Board Support Package Developer’s Guide. This manual also provides an example BSP creation workflow. See the Board Support Packages (BSP) — Developer’s Guide section.
Learn About Toaster: Toaster is a web interface to the Yocto Project’s OpenEmbedded build system. If you are interested in using this type of interface to create images, see the Toaster User Manual.
Discover the VSCode extension: The Yocto Project BitBake extension for the Visual Studio Code IDE provides language features and commands for working with the Yocto Project. If you are interested in using this extension, visit its marketplace page.
Have Available the Yocto Project Reference Manual: Unlike the rest of the Yocto Project manual set, this manual is comprised of material suited for reference rather than procedures. You can get build details, a closer look at how the pieces of the Yocto Project development environment work together, information on various technical details, guidance on migrating to a newer Yocto Project release, reference material on the directory structure, classes, and tasks. The Yocto Project Reference Manual also contains a fairly comprehensive glossary of variables used within the Yocto Project.
Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales as published by Creative Commons.
To report any inaccuracies or problems with this (or any other Yocto Project)
manual, or to send additions or changes, please send email/patches to the Yocto
Project documentation mailing list at docs@lists.yoctoproject.org or
log into the Libera Chat #yocto channel.
Transitioning to a custom environment for systems development
Note
So you’ve finished the Yocto Project Quick Build and glanced over the document What I wish I’d known about Yocto Project, the latter contains important information learned from other users. You’re well prepared. But now, as you are starting your own project, it isn’t exactly straightforward what to do. And, the documentation is daunting. We’ve put together a few hints to get you started.
Make a list of the processor, target board, technologies, and capabilities that will be part of your project. You will be finding layers with recipes and other metadata that support these things, and adding them to your configuration. (See #3)
Set up your board support. Even if you’re using custom hardware, it might be easier to start with an existing target board that uses the same processor or at least the same architecture as your custom hardware. Knowing the board already has a functioning Board Support Package (BSP) within the project makes it easier for you to get comfortable with project concepts.
Find and acquire the best BSP for your target. Use the Yocto Project Compatible Layers or even the OpenEmbedded Layer Index to find and acquire the best BSP for your target board. The Yocto Project layer index BSPs are regularly validated. The best place to get your first BSP is from your silicon manufacturer or board vendor – they can point you to their most qualified efforts. In general, for Intel silicon use meta-intel, for Texas Instruments use meta-ti, and so forth. Choose a BSP that has been tested with the same Yocto Project release that you’ve downloaded. Be aware that some BSPs may not be immediately supported on the very latest release, but they will be eventually.
You might want to start with the build specification that Poky provides (which is reference embedded distribution) and then add your newly chosen layers to that. Here is the information about adding layers.
Based on the layers you’ve chosen, make needed changes in your configuration. For instance, you’ve chosen a machine type and added in the corresponding BSP layer. You’ll then need to change the value of the MACHINE variable in your configuration (using the machine/ fragment) to point to that same machine type. There could be other layer-specific settings you need to change as well. Each layer has a
READMEdocument that you can look at for this type of usage information.Add a new layer for any custom recipes and metadata you create. Use the
bitbake-layers create-layercommand. Thebitbake-layerstool also provides a number of other useful layer-related commands. See Creating Your Own Layer section.Create your own layer for the BSP you’re going to use. It is not common that you would need to create an entire BSP from scratch unless you have a really special device. Even if you are using an existing BSP, create your own layer for the BSP. For example, given a 64-bit x86-based machine, copy the conf/intel-corei7-64 definition and give the machine a relevant name (think board name, not product name). Make sure the layer configuration is dependent on the meta-intel layer (or at least, meta-intel remains in your bblayers.conf). Now you can put your custom BSP settings into your layer and you can re-use it for different applications.
Write your own recipe to build additional software support that isn’t already available in the form of a recipe. Creating your own recipe is especially important for custom application software that you want to run on your device. Writing new recipes is a process of refinement. Start by getting each step of the build process working beginning with fetching all the way through packaging. Next, run the software on your target and refine further as needed. See Writing a New Recipe in the Yocto Project Development Tasks Manual for more information.
Now you’re ready to create an image recipe. There are a number of ways to do this. However, it is strongly recommended that you have your own image recipe — don’t try appending to existing image recipes. Recipes for images are trivial to create and you usually want to fully customize their contents.
Build your image and refine it. Add what’s missing and fix anything that’s broken using your knowledge of the workflow to identify where issues might be occurring.
Consider creating your own distribution. When you get to a certain level of customization, consider creating your own distribution rather than using the default reference distribution.
Distribution settings define the packaging back-end (e.g. rpm or other) as well as the package feed and possibly the update solution. You would create your own distribution in a new layer inheriting from Poky but overriding what needs to change for your distribution. If you find yourself adding a lot of configuration to your local.conf file aside from paths and other typical local settings, it’s time to consider creating your own distribution.
You can add product specifications that can customize the distribution if needed in other layers. You can also add other functionality specific to the product. But to update the distribution, not individual products, you update the distribution feature through that layer.
Congratulations! You’re well on your way. Welcome to the Yocto Project community.
Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales as published by Creative Commons.
To report any inaccuracies or problems with this (or any other Yocto Project)
manual, or to send additions or changes, please send email/patches to the Yocto
Project documentation mailing list at docs@lists.yoctoproject.org or
log into the Libera Chat #yocto channel.
Yocto Project Overview and Concepts Manual
1 The Yocto Project Overview and Concepts Manual
1.1 Welcome
Welcome to the Yocto Project Overview and Concepts Manual! This manual introduces the Yocto Project by providing concepts, software overviews, best-known-methods (BKMs), and any other high-level introductory information suitable for a new Yocto Project user.
Here is what you can get from this manual:
Introducing the Yocto Project: This chapter provides an introduction to the Yocto Project. You will learn about features and challenges of the Yocto Project, the layer model, components and tools, development methods, the Poky reference distribution, the OpenEmbedded build system workflow, and some basic Yocto terms.
The Yocto Project Development Environment: This chapter helps you get started understanding the Yocto Project development environment. You will learn about open source, development hosts, Yocto Project source repositories, workflows using Git and the Yocto Project, a Git primer, and information about licensing.
Yocto Project Concepts : This chapter presents various concepts regarding the Yocto Project. You can find conceptual information about components, development, cross-toolchains, and so forth.
This manual does not give you the following:
Step-by-step Instructions for Development Tasks: Instructional procedures reside in other manuals within the Yocto Project documentation set. For example, the Yocto Project Development Tasks Manual provides examples on how to perform various development tasks. As another example, the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual contains detailed instructions on how to install an SDK, which is used to develop applications for target hardware.
Reference Material: This type of material resides in an appropriate reference manual. For example, system variables are documented in the Yocto Project Reference Manual. As another example, the Yocto Project Board Support Package Developer’s Guide contains reference information on BSPs.
Detailed Public Information Not Specific to the Yocto Project: For example, exhaustive information on how to use the Source Control Manager Git is better covered with Internet searches and official Git Documentation than through the Yocto Project documentation.
1.2 Other Information
Because this manual presents information for many different topics, supplemental information is recommended for full comprehension. For additional introductory information on the Yocto Project, see the Yocto Project Website. If you want to build an image with no knowledge of Yocto Project as a way of quickly testing it out, see the Yocto Project Quick Build document. For a comprehensive list of links and other documentation, see the “Links and Related Documentation” section in the Yocto Project Reference Manual.
2 Introducing the Yocto Project
2.1 What is the Yocto Project?
The Yocto Project is an open source collaboration project that helps developers create custom Linux-based systems that are designed for embedded products regardless of the product’s hardware architecture. Yocto Project provides a flexible toolset and a development environment that allows embedded device developers across the world to collaborate through shared technologies, software stacks, configurations, and best practices used to create these tailored Linux images.
Thousands of developers worldwide have discovered that Yocto Project provides advantages in both systems and applications development, archival and management benefits, and customizations used for speed, footprint, and memory utilization. The project is a standard when it comes to delivering embedded software stacks. The project allows software customizations and build interchange for multiple hardware platforms as well as software stacks that can be maintained and scaled.
For further introductory information on the Yocto Project, you might be interested in this article by Drew Moseley and in this short introductory video.
The remainder of this section overviews advantages and challenges tied to the Yocto Project.
2.1.1 Features
Here are features and advantages of the Yocto Project:
Widely Adopted Across the Industry: Many semiconductor, operating system, software, and service vendors adopt and support the Yocto Project in their products and services. For a look at the Yocto Project community and the companies involved with the Yocto Project, see the “COMMUNITY” and “ECOSYSTEM” tabs on the Yocto Project home page.
Architecture Agnostic: Yocto Project supports Intel, ARM, MIPS, AMD, PPC, RISC-V and other architectures. Most ODMs, OSVs, and chip vendors create and supply BSPs that support their hardware. If you have custom silicon, you can create a BSP that supports that architecture. See Yocto Project Supported Architectures And Features for details on the level of support for some of these architectures.
Aside from broad architecture support, the Yocto Project fully supports a wide range of devices emulated by the Quick EMUlator (QEMU).
Images and Code Transfer Easily: Yocto Project output can easily move between architectures without moving to new development environments. Additionally, if you have used the Yocto Project to create an image or application and you find yourself not able to support it, commercial Linux vendors such as Wind River, Mentor Graphics, Timesys, and ENEA could take it and provide ongoing support. These vendors have offerings that are built using the Yocto Project.
Flexibility: Corporations use the Yocto Project many different ways. One example is to create an internal Linux distribution as a code base the corporation can use across multiple product groups. Through customization and layering, a project group can leverage the base Linux distribution to create a distribution that works for their product needs.
Ideal for Constrained Embedded and IoT devices: Unlike a full Linux distribution, you can use the Yocto Project to create exactly what you need for embedded devices. You only add the feature support or packages that you absolutely need for the device. For devices that have display hardware, you can use available system components such as X11, Wayland, GTK+, Qt, Clutter, and SDL (among others) to create a rich user experience. For devices that do not have a display or where you want to use alternative UI frameworks, you can choose to not build these components.
Comprehensive Toolchain Capabilities: Toolchains for supported architectures satisfy most use cases. However, if your hardware supports features that are not part of a standard toolchain, you can easily customize that toolchain through specification of platform-specific tuning parameters. And, should you need to use a third-party toolchain, mechanisms built into the Yocto Project allow for that.
Mechanism Rules Over Policy: Focusing on mechanism rather than policy ensures that you are free to set policies based on the needs of your design instead of adopting decisions enforced by some system software provider.
Uses a Layer Model: The Yocto Project layer infrastructure groups related functionality into separate bundles. You can incrementally add these grouped functionalities to your project as needed. Using layers to isolate and group functionality reduces project complexity and redundancy, allows you to easily extend the system, make customizations, and keep functionality organized.
Supports Partial Builds: You can build and rebuild individual packages as needed. Yocto Project accomplishes this through its Shared State Cache (sstate) scheme. Being able to build and debug components individually eases project development.
Releases According to a Strict Schedule: Major releases occur on a six-month cycle predictably in October and April. The most recent two releases support point releases to address common vulnerabilities and exposures. This predictability is crucial for projects based on the Yocto Project and allows development teams to plan activities.
Rich Ecosystem of Individuals and Organizations: For open source projects, the value of community is very important. Support forums, expertise, and active developers who continue to push the Yocto Project forward are readily available.
Binary Reproducibility: The Yocto Project allows you to be very specific about dependencies and achieves very high percentages of binary reproducibility (e.g. 99.8% for
core-image-minimal). When distributions are not specific about which packages are pulled in and in what order to support dependencies, other build systems can arbitrarily include packages.License Manifest: The Yocto Project provides a license manifest for review by people who need to track the use of open source licenses (e.g. legal teams).
2.1.2 Challenges
Here are challenges you might encounter when developing using the Yocto Project:
Steep Learning Curve: The Yocto Project has a steep learning curve and has many different ways to accomplish similar tasks. It can be difficult to choose between such ways.
Understanding What Changes You Need to Make For Your Design Requires Some Research: Beyond the simple tutorial stage, understanding what changes need to be made for your particular design can require a significant amount of research and investigation. For information that helps you transition from trying out the Yocto Project to using it for your project, see the “What I wish I’d known about Yocto Project” and “Transitioning to a custom environment for systems development” documents on the Yocto Project website.
Project Workflow Could Be Confusing: The Yocto Project workflow could be confusing if you are used to traditional desktop and server software development. In a desktop development environment, there are mechanisms to easily pull and install new packages, which are typically pre-compiled binaries from servers accessible over the Internet. Using the Yocto Project, you must modify your configuration and rebuild to add additional packages.
Working in a Cross-Build Environment Can Feel Unfamiliar: When developing code to run on a target, compilation, execution, and testing done on the actual target can be faster than running a BitBake build on a development host and then deploying binaries to the target for test. While the Yocto Project does support development tools on the target, the additional step of integrating your changes back into the Yocto Project build environment would be required. Yocto Project supports an intermediate approach that involves making changes on the development system within the BitBake environment and then deploying only the updated packages to the target.
The Yocto Project OpenEmbedded Build System produces packages in standard formats (i.e. RPM, DEB and/or IPK). If you included runtime package management in your image, you can deploy these packages into the running system on the target by using the corresponding utilities on the target such as
rpm/dnf,dpkg/aptoropkg.Initial Build Times Can be Significant: Long initial build times are unfortunately unavoidable due to the large number of packages initially built from scratch for a fully functioning Linux system. Once that initial build is completed, however, the shared-state (sstate) cache mechanism Yocto Project uses keeps the system from rebuilding packages that have not been “touched” since the last build. The sstate mechanism significantly reduces times for successive builds.
2.2 The Yocto Project Layer Model
The Yocto Project’s “Layer Model” is a development model for embedded and IoT Linux creation that distinguishes the Yocto Project from other simple build systems. The Layer Model simultaneously supports collaboration and customization. Layers are repositories that contain related sets of instructions that tell the OpenEmbedded Build System what to do. You can collaborate, share, and reuse layers.
Layers can contain changes to previous instructions or settings at any time. This powerful override capability is what allows you to customize previously supplied collaborative or community layers to suit your product requirements.
You use different layers to logically separate information in your build. As an example, you could have BSP, GUI, distro configuration, middleware, or application layers. Putting your entire build into one layer limits and complicates future customization and reuse. Isolating information into layers, on the other hand, helps simplify future customizations and reuse. You might find it tempting to keep everything in one layer when working on a single project. However, the more modular your Metadata, the easier it is to cope with future changes.
Note
Use Board Support Package (BSP) layers from silicon vendors when possible.
Familiarize yourself with the Yocto Project Compatible Layers or the OpenEmbedded Layer Index. The latter contains more layers but they are less universally validated.
Layers support the inclusion of technologies, hardware components, and software components. The Yocto Project Compatible designation provides a minimum level of standardization that contributes to a strong ecosystem. “YP Compatible” is applied to appropriate products and software components such as BSPs, other OE-compatible layers, and related open-source projects, allowing the producer to use Yocto Project badges and branding assets.
To illustrate how layers are used to keep things modular, consider
machine customizations. These types of customizations typically reside
in a special layer, rather than a general layer, called a BSP Layer.
Furthermore, the machine customizations should be isolated from recipes
and Metadata that support a new GUI environment, for example. This
situation gives you a couple of layers: one for the machine
configurations, and one for the GUI environment. It is important to
understand, however, that the BSP layer can still make machine-specific
additions to recipes within the GUI environment layer without polluting
the GUI layer itself with those machine-specific changes. You can
accomplish this through a recipe that is a BitBake append
(.bbappend) file, which is described later in this section.
Note
For general information on BSP layer structure, see the Yocto Project Board Support Package Developer’s Guide.
The Source Directory
contains both general layers and BSP layers right out of the box. You
can easily identify layers that ship with a Yocto Project release in the
Source Directory by their names. Layers typically have names that begin
with the string meta-.
Note
It is not a requirement that a layer name begin with the prefix
meta-, but it is a commonly accepted standard in the Yocto Project
community.
For example, if you were to examine the tree view
of the openembedded-core repository, you will see several layers: meta,
meta-skeleton, and meta-selftest. Each of these repositories represents a distinct
layer.
For procedures on how to create layers, see the “Understanding and Creating Layers” section in the Yocto Project Development Tasks Manual.
2.3 Components and Tools
The Yocto Project employs a collection of components and tools used by the project itself, by project developers, and by those using the Yocto Project. These components and tools are open source projects and metadata that are separate from the reference distribution (Poky) and the OpenEmbedded Build System. Most of the components and tools are downloaded separately.
This section provides brief overviews of the components and tools associated with the Yocto Project.
2.3.1 Development Tools
Here are tools that help you develop images and applications using the Yocto Project:
CROPS: CROPS is an open source, cross-platform development framework that leverages Docker Containers. CROPS provides an easily managed, extensible environment that allows you to build binaries for a variety of architectures on Windows, Linux and Mac OS X hosts.
devtool: This command-line tool is available as part of the extensible SDK (eSDK) and is its cornerstone. You can use
devtoolto help build, test, and package software within the eSDK. You can use the tool to optionally integrate what you build into an image built by the OpenEmbedded build system.The
devtoolcommand employs a number of sub-commands that allow you to add, modify, and upgrade recipes. As with the OpenEmbedded build system, “recipes” represent software packages withindevtool. When you usedevtool add, a recipe is automatically created. When you usedevtool modify, the specified existing recipe is used in order to determine where to get the source code and how to patch it. In both cases, an environment is set up so that when you build the recipe a source tree that is under your control is used in order to allow you to make changes to the source as desired. By default, both new recipes and the source go into a “workspace” directory under the eSDK. Thedevtool upgradecommand updates an existing recipe so that you can build it for an updated set of source files.You can read about the
devtoolworkflow in the Yocto Project Application Development and Extensible Software Development Kit (eSDK) Manual in the “Using devtool in Your SDK Workflow” section.Extensible Software Development Kit (eSDK): The eSDK provides a cross-development toolchain and libraries tailored to the contents of a specific image. The eSDK makes it easy to add new applications and libraries to an image, modify the source for an existing component, test changes on the target hardware, and integrate into the rest of the OpenEmbedded build system. The eSDK gives you a toolchain experience supplemented with the powerful set of
devtoolcommands tailored for the Yocto Project environment.For information on the eSDK, see the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) Manual.
Toaster: Toaster is a web interface to the Yocto Project OpenEmbedded build system. Toaster allows you to configure, run, and view information about builds. For information on Toaster, see the Toaster User Manual.
VSCode IDE Extension: The Yocto Project BitBake extension for Visual Studio Code provides a rich set of features for working with BitBake recipes. The extension provides syntax highlighting, hover tips, and completion for BitBake files as well as embedded Python and Bash languages. Additional views and commands allow you to efficiently browse, build and edit recipes. It also provides SDK integration for cross-compiling and debugging through
devtool.Learn more about the VSCode Extension on the extension’s frontpage.
2.3.2 Production Tools
Here are tools that help with production related activities using the Yocto Project:
Auto Upgrade Helper: This utility when used in conjunction with the OpenEmbedded Build System (BitBake and OE-Core) automatically generates upgrades for recipes that are based on new versions of the recipes published upstream. See Using the Auto Upgrade Helper (AUH) for how to set it up.
Recipe Reporting System: The Recipe Reporting System tracks recipe versions available for Yocto Project. The main purpose of the system is to help you manage the recipes you maintain and to offer a dynamic overview of the project. The Recipe Reporting System is built on top of the OpenEmbedded Layer Index, which is a website that indexes OpenEmbedded-Core layers.
Patchwork: Patchwork is a fork of a project originally started by OzLabs. The project is a web-based tracking system designed to streamline the process of bringing contributions into a project. The Yocto Project uses Patchwork as an organizational tool to handle patches, which number in the thousands for every release.
AutoBuilder: AutoBuilder is a project that automates build tests and quality assurance (QA). By using the public AutoBuilder, anyone can determine the status of the current development branch of the core repositories (OpenEmbedded-Core (OE-Core) and BitBake).
Note
AutoBuilder is based on buildbot.
A goal of the Yocto Project is to lead the open source industry with a project that automates testing and QA procedures. In doing so, the project encourages a development community that publishes QA and test plans, publicly demonstrates QA and test plans, and encourages development of tools that automate and test and QA procedures for the benefit of the development community.
You can learn more about the AutoBuilder used by the Yocto Project Autobuilder here.
Pseudo: Pseudo is the Yocto Project implementation of fakeroot, which is used to run commands in an environment that seemingly has root privileges.
During a build, it can be necessary to perform operations that require system administrator privileges. For example, file ownership or permissions might need to be defined. Pseudo is a tool that you can either use directly or through the environment variable
LD_PRELOAD. Either method allows these operations to succeed even without system administrator privileges.Thanks to Pseudo, the Yocto Project never needs root privileges to build images for your target system.
You can read more about Pseudo in the “Fakeroot and Pseudo” section.
2.3.3 Open-Embedded Build System Components
Here are components associated with the OpenEmbedded Build System:
BitBake: BitBake is a core component of the Yocto Project and is used by the OpenEmbedded build system to build images. While BitBake is key to the build system, BitBake is maintained separately from the Yocto Project.
BitBake is a generic task execution engine that allows shell and Python tasks to be run efficiently and in parallel while working within complex inter-task dependency constraints. In short, BitBake is a build engine that works through recipes written in a specific format in order to perform sets of tasks.
You can learn more about BitBake in the BitBake User Manual.
OpenEmbedded-Core: OpenEmbedded-Core (OE-Core) is a common layer of metadata (i.e. recipes, classes, and associated files) used by OpenEmbedded-derived systems, which includes the Yocto Project. The Yocto Project and the OpenEmbedded Project both maintain the OpenEmbedded-Core. You can find the OE-Core metadata in the OpenEmbedded Source Repositories.
Historically, the Yocto Project integrated the OE-Core metadata throughout the Yocto Project source repository reference system (Poky). After Yocto Project Version 1.0, the Yocto Project and OpenEmbedded agreed to work together and share a common core set of metadata (OE-Core), which contained much of the functionality previously found in Poky. This collaboration achieved a long-standing OpenEmbedded objective for having a more tightly controlled and quality-assured core. The results also fit well with the Yocto Project objective of achieving a smaller number of fully featured tools as compared to many different ones.
Nowadays, the Poky repository is no longer updated as bitbake-setup became the preferred way of setting up the repositories in order to build the Poky distro.
2.3.4 Packages for Finished Targets
Here are components associated with packages for finished targets:
Matchbox: Matchbox is an Open Source, base environment for the X Window System running on non-desktop, embedded platforms such as handhelds, set-top boxes, kiosks, and anything else for which screen space, input mechanisms, or system resources are limited.
Matchbox consists of a number of interchangeable and optional applications that you can tailor to a specific, non-desktop platform to enhance usability in constrained environments.
You can find the Matchbox source in the Yocto Project Source Repositories.
Opkg: Open PacKaGe management (opkg) is a lightweight package management system based on the itsy package (ipkg) management system. Opkg is written in C and resembles Advanced Package Tool (APT) and Debian Package (dpkg) in operation.
Opkg is intended for use on embedded Linux devices and is used in this capacity in the OpenEmbedded and OpenWrt projects, as well as the Yocto Project.
Note
As best it can, opkg maintains backwards compatibility with ipkg and conforms to a subset of Debian’s policy manual regarding control files.
You can find the opkg source in the Yocto Project Source Repositories.
2.3.5 Archived Components
The Build Appliance is a virtual machine image that enables you to build and boot a custom embedded Linux image with the Yocto Project using a non-Linux development system.
Historically, the Build Appliance was the second of three methods by which you could use the Yocto Project on a system that was not native to Linux.
Hob: Hob, which is now deprecated and is no longer available since the 2.1 release of the Yocto Project provided a rudimentary, GUI-based interface to the Yocto Project. Toaster has fully replaced Hob.
Build Appliance: Post Hob, the Build Appliance became available. It was never recommended that you use the Build Appliance as a day-to-day production development environment with the Yocto Project. Build Appliance was useful as a way to try out development in the Yocto Project environment.
CROPS: The final and best solution available now for developing using the Yocto Project on a system not native to Linux is with CROPS.
2.4 Development Methods
The Yocto Project development environment usually involves a Build Host and target hardware. You use the Build Host to build images and develop applications, while you use the target hardware to execute deployed software.
This section provides an introduction to the choices or development methods you have when setting up your Build Host. Depending on your particular workflow preference and the type of operating system your Build Host runs, you have several choices.
Note
For additional detail about the Yocto Project development environment, see the “The Yocto Project Development Environment” chapter.
Native Linux Host: By far the best option for a Build Host. A system running Linux as its native operating system allows you to develop software by directly using the BitBake tool. You can accomplish all aspects of development from a regular shell in a supported Linux distribution.
For information on how to set up a Build Host on a system running Linux as its native operating system, see the “Setting Up a Native Linux Host” section in the Yocto Project Development Tasks Manual.
CROss PlatformS (CROPS): Typically, you use CROPS, which leverages Docker Containers, to set up a Build Host that is not running Linux (e.g. Microsoft Windows or macOS).
Note
You can, however, use CROPS on a Linux-based system.
CROPS is an open source, cross-platform development framework that provides an easily managed, extensible environment for building binaries targeted for a variety of architectures on Windows, macOS, or Linux hosts. Once the Build Host is set up using CROPS, you can prepare a shell environment to mimic that of a shell being used on a system natively running Linux.
For information on how to set up a Build Host with CROPS, see the “Setting Up to Use CROss PlatformS (CROPS)” section in the Yocto Project Development Tasks Manual.
Windows Subsystem For Linux (WSL 2): You may use Windows Subsystem For Linux version 2 to set up a Build Host using Windows 10 or later, or Windows Server 2019 or later.
The Windows Subsystem For Linux allows Windows to run a real Linux kernel inside of a lightweight virtual machine (VM).
For information on how to set up a Build Host with WSL 2, see the “Setting Up to Use Windows Subsystem For Linux (WSL 2)” section in the Yocto Project Development Tasks Manual.
Toaster: Regardless of what your Build Host is running, you can use Toaster to develop software using the Yocto Project. Toaster is a web interface to the Yocto Project’s OpenEmbedded Build System. The interface allows you to configure and run your builds. Information about builds is collected and stored in a database. You can use Toaster to configure and start builds on multiple remote build servers.
For information about and how to use Toaster, see the Toaster User Manual.
Using the VSCode Extension: You can use the Yocto Project BitBake extension for Visual Studio Code to start your BitBake builds through a graphical user interface.
Learn more about the VSCode Extension on the extension’s marketplace page
2.5 Reference Embedded Distribution (Poky)
“Poky”, which is pronounced Pock-ee, is the name of the Yocto Project’s reference distribution or Reference OS Kit. This reference distribution is represented by a DISTRO configuration file found in meta-poky.
Warning
While Poky is a “complete” distribution specification and is tested and put through QA, you cannot use it as a product “out of the box” in its current form.
Poky has a regular, well established, six-month release cycle detailed in the Yocto Project Releases and the Stable Release Process of the Yocto Project Reference Manual.
2.6 The OpenEmbedded Build System Workflow
The OpenEmbedded Build System uses a “workflow” to accomplish image and SDK generation. The following figure overviews that workflow:
Here is a brief summary of the “workflow”:
Developers specify architecture, policies, patches and configuration details.
The build system fetches and downloads the source code from the specified location. The build system supports standard methods such as tarballs or source code repositories systems such as Git.
Once source code is downloaded, the build system extracts the sources into a local work area where patches are applied and common steps for configuring and compiling the software are run.
The build system then installs the software into a temporary staging area where the binary package format you select (DEB, RPM, or IPK) is used to roll up the software.
Different QA and sanity checks run throughout entire build process.
After the binaries are created, the build system generates a binary package feed that is used to create the final root file image.
The build system generates the file system image and a customized SDK (Software Development Kit) for application development in parallel.
For a very detailed look at this workflow, see the “OpenEmbedded Build System Concepts” section.
2.7 Some Basic Terms
It helps to understand some basic fundamental terms when learning the Yocto Project. Although there is a list of terms in the “Yocto Project Terms” section of the Yocto Project Reference Manual, this section provides the definitions of some terms helpful for getting started:
Configuration Files: Files that hold global definitions of variables, user-defined variables, and hardware configuration information. These files tell the OpenEmbedded Build System what to build and what to put into the image to support a particular platform.
Extensible Software Development Kit (eSDK): A custom SDK for application developers. This eSDK allows developers to incorporate their library and programming changes back into the image to make their code available to other application developers. For information on the eSDK, see the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.
Layer: A collection of related recipes. Layers allow you to consolidate related metadata to customize your build. Layers also isolate information used when building for multiple architectures. Layers are hierarchical in their ability to override previous specifications. You can include any number of available layers from the Yocto Project and customize the build by adding your own layers after them. You can search the Layer Index for layers used within Yocto Project.
For more detailed information on layers, see the “Understanding and Creating Layers” section in the Yocto Project Development Tasks Manual. For a discussion specifically on BSP Layers, see the “BSP Layers” section in the Yocto Project Board Support Packages (BSP) Developer’s Guide.
Metadata: A key element of the Yocto Project is the Metadata that is used to construct a Linux distribution and is contained in the files that the OpenEmbedded build system parses when building an image. In general, Metadata includes recipes, configuration files, and other information that refers to the build instructions themselves, as well as the data used to control what things get built and the effects of the build. Metadata also includes commands and data used to indicate what versions of software are used, from where they are obtained, and changes or additions to the software itself (patches or auxiliary files) that are used to fix bugs or customize the software for use in a particular situation. OpenEmbedded-Core is an important set of validated metadata.
OpenEmbedded Build System: The terms “BitBake” and “build system” are sometimes used for the OpenEmbedded Build System.
BitBake is a task scheduler and execution engine that parses instructions (i.e. recipes) and configuration data. After a parsing phase, BitBake creates a dependency tree to order the compilation, schedules the compilation of the included code, and finally executes the building of the specified custom Linux image (distribution). BitBake is similar to the
maketool.During a build process, the build system tracks dependencies and performs a native or cross-compilation of each package. As a first step in a cross-build setup, the framework attempts to create a cross-compiler toolchain (i.e. Extensible SDK) suited for the target platform.
OpenEmbedded-Core (OE-Core): OE-Core is metadata comprised of foundation recipes, classes, and associated files that are meant to be common among many different OpenEmbedded-derived systems, including the Yocto Project. OE-Core is a curated subset of an original repository developed by the OpenEmbedded community that has been pared down into a smaller, core set of continuously validated recipes. The result is a tightly controlled and quality-assured core set of recipes.
You can see the Metadata in the
metadirectory of the Yocto Project Source Repositories.Packages: In the context of the Yocto Project, this term refers to a recipe’s packaged output produced by BitBake (i.e. a “baked recipe”). A package is generally the compiled binaries produced from the recipe’s sources. You “bake” something by running it through BitBake.
It is worth noting that the term “package” can, in general, have subtle meanings. For example, the packages referred to in the “Required Packages for the Build Host” section in the Yocto Project Reference Manual are compiled binaries that, when installed, add functionality to your host Linux distribution.
Another point worth noting is that historically within the Yocto Project, recipes were referred to as packages — thus, the existence of several BitBake variables that are seemingly mis-named, (e.g. PR, PV, and PE).
Poky: Poky is a reference embedded distribution and a reference test configuration. Poky provides the following:
A base-level functional distro (DISTRO) used to illustrate how to customize a distribution.
A means by which to test the Yocto Project components (i.e. Poky is used to validate the Yocto Project).
Poky is not a product level distro. Rather, it is a good starting point for customization.
Recipe: The most common form of metadata. A recipe contains a list of settings and tasks (i.e. instructions) for building packages that are then used to build the binary image. A recipe describes where you get source code and which patches to apply. Recipes describe dependencies for libraries or for other recipes as well as configuration and compilation options. Related recipes are consolidated into a layer.
3 The Yocto Project Development Environment
This chapter takes a look at the Yocto Project development environment. The chapter provides Yocto Project Development environment concepts that help you understand how work is accomplished in an open source environment, which is very different as compared to work accomplished in a closed, proprietary environment.
Specifically, this chapter addresses open source philosophy, source repositories, workflows, Git, and licensing.
3.1 Open Source Philosophy
Open source philosophy is characterized by software development directed by peer production and collaboration through an active community of developers. Contrast this to the more standard centralized development models used by commercial software companies where a finite set of developers produces a product for sale using a defined set of procedures that ultimately result in an end product whose architecture and source material are closed to the public.
Open source projects conceptually have differing concurrent agendas, approaches, and production. These facets of the development process can come from anyone in the public (community) who has a stake in the software project. The open source environment contains new copyright, licensing, domain, and consumer issues that differ from the more traditional development environment. In an open source environment, the end product, source material, and documentation are all available to the public at no cost.
A benchmark example of an open source project is the Linux kernel, which was initially conceived and created by Finnish computer science student Linus Torvalds in 1991. Conversely, a good example of a non-open source project is the Windows family of operating systems developed by Microsoft Corporation.
Wikipedia has a good historical description of the Open Source Philosophy. You can also find helpful information on how to participate in the Linux Community here.
3.2 The Development Host
A development host or Build Host is key to using the Yocto Project. Because the goal of the Yocto Project is to develop images or applications that run on embedded hardware, development of those images and applications generally takes place on a system not intended to run the software — the development host.
You need to set up a development host in order to use it with the Yocto Project. Most find that it is best to have a native Linux machine function as the development host. However, it is possible to use a system that does not run Linux as its operating system as your development host. When you have a Mac or Windows-based system, you can set it up as the development host by using CROPS, which leverages Docker Containers. Once you take the steps to set up a CROPS machine, you effectively have access to a shell environment that is similar to what you see when using a Linux-based development host. For the steps needed to set up a system using CROPS, see the “Setting Up to Use CROss PlatformS (CROPS)” section in the Yocto Project Development Tasks Manual.
If your development host is going to be a system that runs a Linux distribution, you must still take steps to prepare the system for use with the Yocto Project. You need to be sure that the Linux distribution on the system is one that supports the Yocto Project. You also need to be sure that the correct set of host packages are installed that allow development using the Yocto Project. For the steps needed to set up a development host that runs Linux, see the “Setting Up a Native Linux Host” section in the Yocto Project Development Tasks Manual.
Once your development host is set up to use the Yocto Project, there are several ways of working in the Yocto Project environment:
Command Lines, BitBake, and Shells: Traditional development in the Yocto Project involves using the OpenEmbedded Build System, which uses BitBake, in a command-line environment from a shell on your development host. You can accomplish this from a host that is a native Linux machine or from a host that has been set up with CROPS. Either way, you create, modify, and build images and applications all within a shell-based environment using components and tools available through your Linux distribution and the Yocto Project.
For a general flow of the build procedures, see the “Building a Simple Image” section in the Yocto Project Development Tasks Manual.
Board Support Package (BSP) Development: Development of BSPs involves using the Yocto Project to create and test layers that allow easy development of images and applications targeted for specific hardware. To development BSPs, you need to take some additional steps beyond what was described in setting up a development host.
The Yocto Project Board Support Package Developer’s Guide provides BSP-related development information. For specifics on development host preparation, see the “Preparing Your Build Host to Work With BSP Layers” section in the Yocto Project Board Support Package (BSP) Developer’s Guide.
Kernel Development: If you are going to be developing kernels using the Yocto Project you likely will be using
devtool. A workflow usingdevtoolmakes kernel development quicker by reducing iteration cycle times.The Yocto Project Linux Kernel Development Manual provides kernel-related development information. For specifics on development host preparation, see the “Preparing the Build Host to Work on the Kernel” section in the Yocto Project Linux Kernel Development Manual.
Using Toaster: The other Yocto Project development method that involves an interface that effectively puts the Yocto Project into the background is Toaster. Toaster provides an interface to the OpenEmbedded build system. The interface enables you to configure and run your builds. Information about builds is collected and stored in a database. You can use Toaster to configure and start builds on multiple remote build servers.
For steps that show you how to set up your development host to use Toaster and on how to use Toaster in general, see the Toaster User Manual.
Using the VSCode Extension: You can use the Yocto Project BitBake extension for Visual Studio Code to start your BitBake builds through a graphical user interface.
Learn more about the VSCode Extension on the extension’s marketplace page.
3.3 Yocto Project Source Repositories
The Yocto Project team maintains complete source repositories for all Yocto Project files at https://git.yoctoproject.org/. This web-based source code browser is organized into categories by function such as IDE Plugins, Matchbox, Poky, Yocto Linux Kernel, and so forth. From the interface, you can click on any particular item in the “Name” column and see the URL at the bottom of the page that you need to clone a Git repository for that particular item. Having a local Git clone of these repositories allows you to make changes, contribute to the history, and ultimately enhance the Yocto Project’s tools, Board Support Packages, and so forth.
For any supported release of Yocto Project, you can also go to the Yocto Project Website and select the “Releases” item from the “Development” menu and get a released tarball of the repositories, any supported BSP tarball, or Yocto Project tools. Unpacking these tarballs gives you a snapshot of the released files.
Note
The recommended method for setting up the Yocto Project is to use Git to create a local copy of the upstream repositories.
Be sure to always work in matching branches for both the selected BSP repository, the OpenEmbedded-Core (OE-Core) and BitBake repositories. For example, if you have checked out the “whinlatter” branch of OpenEmbedded-Core (OE-Core) and you are going to use
meta-intel, be sure to checkout the “whinlatter” branch ofmeta-intel.
In summary, here is where you can get the project files needed for development:
Source Repositories: This area contains BitBake, OpenEmbedded-Core (OE-Core), Yocto documentation and other metadata layers. You can create local copies of Git repositories for each of these areas.
Releases page: The Yocto Project website includes a “Releases” page accessible through the “Development” menu that allows you to download any Yocto Project release, tool, and Board Support Package (BSP) in tarball form. The hyperlinks point to the tarballs under https://downloads.yoctoproject.org/releases/yocto/.
3.4 Git Workflows and the Yocto Project
Developing using the Yocto Project likely requires the use of Git. Git is a free, open source distributed version control system used as part of many collaborative design environments. This section provides workflow concepts using the Yocto Project and Git. In particular, the information covers basic practices that describe roles and actions in a collaborative development environment.
Note
If you are familiar with this type of development environment, you might not want to read this section.
The Yocto Project files are maintained using Git in “branches” whose Git histories track every change and whose structures provide branches for all diverging functionality. Although there is no need to use Git, many open source projects do so.
For the Yocto Project, a key individual called the “maintainer” is responsible for the integrity of the development branch of a given Git repository. The development branch is the “upstream” repository from which final or most recent builds of a project occur. The maintainer is responsible for accepting changes from other developers and for organizing the underlying branch structure to reflect release strategies and so forth.
Note
For information on finding out who is responsible for (maintains) a particular area of code in the Yocto Project, see the “Identify the component” section of the Yocto Project and OpenEmbedded Contributor Guide.
The Yocto Project Git repositories may also have upstream
contribution Git repositories suffixed with -contrib. You can see all the
branches of these repositories using the web interface of the
Source Repositories.
These branches hold changes (commits) to the project that have
been submitted or committed by the Yocto Project development team and by
community members who contribute to the project. The maintainer
determines if the changes are qualified to be moved from the “contrib”
branches into the “master” branch of the Git repository.
Developers (including contributing community members) create and maintain cloned repositories of upstream branches. The cloned repositories are local to their development platforms and are used to develop changes. When a developer is satisfied with a particular feature or change, they “push” the change to the appropriate “contrib” repository.
Developers are responsible for keeping their local repository up-to-date with whatever upstream branch they are working against. They are also responsible for straightening out any conflicts that might arise within files that are being worked on simultaneously by more than one person. All this work is done locally on the development host before anything is pushed to a “contrib” area and examined at the maintainer’s level.
There is a somewhat formal method by which developers commit changes and push them into the “contrib” area and subsequently request that the maintainer include them into an upstream branch. This process is called “submitting a patch” or “submitting a change.” For information on submitting patches and changes, see the “Contributing Changes to a Component” section in the Yocto Project and OpenEmbedded Contributor Guide.
In summary, there is a single point of entry for changes into the development branch of the Git repository, which is controlled by the project’s maintainer. A set of developers independently develop, test, and submit changes to “contrib” areas for the maintainer to examine. The maintainer then chooses which changes are going to become a permanent part of the project.
While each development environment is unique, there are some best practices or methods that help development run smoothly. The following list describes some of these practices. For more information about Git workflows, see the workflow topics in the Git Community Book.
Make Small Changes: It is best to keep the changes you commit small as compared to bundling many disparate changes into a single commit. This practice not only keeps things manageable but also allows the maintainer to more easily include or refuse changes.
Make Complete Changes: It is also good practice to leave the repository in a state that allows you to still successfully build your project. In other words, do not commit half of a feature, then add the other half as a separate, later commit. Each commit should take you from one buildable project state to another buildable state.
Use Branches Liberally: It is very easy to create, use, and delete local branches in your working Git repository on the development host. You can name these branches anything you like. It is helpful to give them names associated with the particular feature or change on which you are working. Once you are done with a feature or change and have merged it into your local development branch, simply discard the temporary branch.
Merge Changes: The
git mergecommand allows you to take the changes from one branch and fold them into another branch. This process is especially helpful when more than a single developer might be working on different parts of the same feature. Merging changes also automatically identifies any collisions or “conflicts” that might happen as a result of the same lines of code being altered by two different developers.Manage Branches: Because branches are easy to use, you should use a system where branches indicate varying levels of code readiness. For example, you can have a “work” branch to develop in, a “test” branch where the code or change is tested, a “stage” branch where changes are ready to be committed, and so forth. As your project develops, you can merge code across the branches to reflect ever-increasing stable states of the development.
Use Push and Pull: The push-pull workflow is based on the concept of developers “pushing” local commits to a remote repository, which is usually a contribution repository. This workflow is also based on developers “pulling” known states of the project down into their local development repositories. The workflow easily allows you to pull changes submitted by other developers from the upstream repository into your work area ensuring that you have the most recent software on which to develop. The Yocto Project has two scripts named
create-pull-requestandsend-pull-requestthat ship with the release to facilitate this workflow. You can find these scripts in thescriptsfolder of OpenEmbedded-Core (OE-Core). For information on how to use these scripts, see the “Using Scripts to Push a Change Upstream and Request a Pull” section in the Yocto Project and OpenEmbedded Contributor Guide.Patch Workflow: This workflow allows you to notify the maintainer through an email that you have a change (or patch) you would like considered for the development branch of the Git repository. To send this type of change, you format the patch and then send the email using the Git commands
git format-patchandgit send-email. For information on how to use these scripts, see the “Contributing Changes to a Component” section in the Yocto Project and OpenEmbedded Contributor Guide.
3.5 Git
The Yocto Project makes extensive use of Git, which is a free, open source distributed version control system. Git supports distributed development, non-linear development, and can handle large projects. It is best that you have some fundamental understanding of how Git tracks projects and how to work with Git if you are going to use the Yocto Project for development. This section provides a quick overview of how Git works and provides you with a summary of some essential Git commands.
Note
For more information on Git, see https://git-scm.com/documentation.
If you need to download Git, it is recommended that you add Git to your system through your distribution’s “software store” (e.g. for Ubuntu, use the Ubuntu Software feature). For the Git download page, see https://git-scm.com/download.
3.5.2 Basic Commands
Git has an extensive set of commands that lets you manage changes and perform collaboration over the life of a project. Conveniently though, you can manage with a small set of basic operations and workflows once you understand the basic philosophy behind Git. You do not have to be an expert in Git to be functional. A good place to look for instruction on a minimal set of Git commands is here.
The following list of Git commands briefly describes some basic Git operations as a way to get started. As with any set of commands, this list (in most cases) simply shows the base command and omits the many arguments it supports. See the Git documentation for complete descriptions and strategies on how to use these commands:
git init: Initializes an empty Git repository. You cannot use Git commands unless you have a
.gitrepository.git clone: Creates a local clone of a Git repository that is on equal footing with a fellow developer’s Git repository or an upstream repository.
git add: Locally stages updated file contents to the index that Git uses to track changes. You must stage all files that have changed before you can commit them.
git commit: Creates a local “commit” that documents the changes you made. Only changes that have been staged can be committed. Commits are used for historical purposes, for determining if a maintainer of a project will allow the change, and for ultimately pushing the change from your local Git repository into the project’s upstream repository.
git status: Reports any modified files that possibly need to be staged and gives you a status of where you stand regarding local commits as compared to the upstream repository.
git checkout branch-name: Changes your local working branch and in this form assumes the local branch already exists. This command is analogous to “cd”.
git checkout -b working-branch upstream-branch: Creates and checks out a working branch on your local machine. The local branch tracks the upstream branch. You can use your local branch to isolate your work. It is a good idea to use local branches when adding specific features or changes. Using isolated branches facilitates easy removal of changes if they do not work out.
git branch: Displays the existing local branches associated with your local repository. The branch that you have currently checked out is noted with an asterisk character.
git branch -D branch-name: Deletes an existing local branch. You need to be in a local branch other than the one you are deleting in order to delete branch-name.
git pull --rebase: Retrieves information from an upstream Git repository and places it in your local Git repository. You use this command to make sure you are synchronized with the repository from which you are basing changes (e.g. the “whinlatter” branch). The
--rebaseoption ensures that any local commits you have in your branch are preserved at the top of your local branch.git push repo-name local-branch:upstream-branch: Sends all your committed local changes to the upstream Git repository that your local repository is tracking (e.g. a contribution repository). The maintainer of the project draws from these repositories to merge changes (commits) into the appropriate branch of project’s upstream repository.
git merge: Combines or adds changes from one local branch of your repository with another branch. When you create a local Git repository, the default branch may be named “main”. A typical workflow is to create a temporary branch that is based off “main” that you would use for isolated work. You would make your changes in that isolated branch, stage and commit them locally, switch to the “main” branch, and then use the
git mergecommand to apply the changes from your isolated branch into the currently checked out branch (e.g. “main”). After the merge is complete and if you are done with working in that isolated branch, you can safely delete the isolated branch.git cherry-pick commits: Choose and apply specific commits from one branch into another branch. There are times when you might not be able to merge all the changes in one branch with another but need to pick out certain ones.
gitk: Provides a GUI view of the branches and changes in your local Git repository. This command is a good way to graphically see where things have diverged in your local repository.
Note
You need to install the gitk package on your development system to use this command.
git log: Reports a history of your commits to the repository. This report lists all commits regardless of whether you have pushed them upstream or not.
git diff: Displays line-by-line differences between a local working file and the same file as understood by Git. This command is useful to see what you have changed in any given file.
3.6 Licensing
Because open source projects are open to the public, they have different licensing structures in place. License evolution for both Open Source and Free Software has an interesting history. If you are interested in this history, you can find basic information here:
In general, the Yocto Project is broadly licensed under the Massachusetts Institute of Technology (MIT) License. MIT licensing permits the reuse of software within proprietary software as long as the license is distributed with that software. Patches to the Yocto Project follow the upstream licensing scheme. You can find information on the MIT license here.
When you build an image using the Yocto Project, the build process uses
a known list of licenses to ensure compliance. You can find this list in
OpenEmbedded-Core (OE-Core) at meta/files/common-licenses. Once the
build completes, the list of all licenses found and used during that build
are kept in the Build Directory at tmp/deploy/licenses.
If a module requires a license that is not in the base list, the build process generates a warning during the build. These tools make it easier for a developer to be certain of the licenses with which their shipped products must comply. However, even with these tools it is still up to the developer to resolve potential licensing issues.
The base list of licenses used by the build process is a combination of the Software Package Data Exchange (SPDX) list and the Open Source Initiative (OSI) projects. SPDX Group is a working group of the Linux Foundation that maintains a specification for a standard format for communicating the components, licenses, and copyrights associated with a software package. OSI is a corporation dedicated to the Open Source Definition and the effort for reviewing and approving licenses that conform to the Open Source Definition (OSD).
You can find a list of the combined SPDX and OSI licenses that the Yocto Project uses in the meta/files/common-licenses directory in OpenEmbedded-Core (OE-Core).
For information that can help you maintain compliance with various open source licensing during the lifecycle of a product created using the Yocto Project, see the “Maintaining Open Source License Compliance During Your Product’s Lifecycle” section in the Yocto Project Development Tasks Manual.
4 Yocto Project Concepts
This chapter provides explanations for Yocto Project concepts that go beyond the surface of “how-to” information and reference (or look-up) material. Concepts such as components, the OpenEmbedded Build System workflow, cross-development toolchains, shared state cache, and so forth are explained.
4.1 Yocto Project Components
The BitBake task executor together with various types of configuration files form the OpenEmbedded-Core (OE-Core). This section overviews these components by describing their use and how they interact.
BitBake handles the parsing and execution of the data files. The data itself is of various types:
Recipes: Provides details about particular pieces of software.
Class Data: Abstracts common build information (e.g. how to build a Linux kernel).
Configuration Data: Defines machine-specific settings, policy decisions, and so forth. Configuration data acts as the glue to bind everything together.
BitBake knows how to combine multiple data sources together and refers to each data source as a layer. For information on layers, see the “Understanding and Creating Layers” section of the Yocto Project Development Tasks Manual.
Here are some brief details on these core components. For additional information on how these components interact during a build, see the “OpenEmbedded Build System Concepts” section.
4.1.1 BitBake
BitBake is the tool at the heart of the OpenEmbedded Build System and is responsible for parsing the Metadata, generating a list of tasks from it, and then executing those tasks.
This section briefly introduces BitBake. If you want more information on BitBake, see the BitBake User Manual.
To see a list of the options BitBake supports, use either of the following commands:
$ bitbake -h
$ bitbake --help
The most common usage for BitBake is bitbake recipename, where
recipename is the name of the recipe you want to build (referred
to as the “target”). The target often equates to the first part of a
recipe’s filename (e.g. “foo” for a recipe named foo_1.3.0-r0.bb).
So, to process the matchbox-desktop_1.2.3.bb recipe file, you might
type the following:
$ bitbake matchbox-desktop
Several different versions of matchbox-desktop might exist. BitBake chooses
the one selected by the distribution configuration. You can get more details
about how BitBake chooses between different target versions and providers in the
“Preferences” section
of the BitBake User Manual.
BitBake also tries to execute any dependent tasks first. So for example,
before building matchbox-desktop, BitBake would build a cross
compiler and glibc if they had not already been built.
A useful BitBake option to consider is the -k or --continue
option. This option instructs BitBake to try and continue processing the
job as long as possible even after encountering an error. When an error
occurs, the target that failed and those that depend on it cannot be
remade. However, when you use this option other dependencies can still
be processed.
4.1.2 Recipes
Files that have the .bb suffix are “recipes” files. In general, a
recipe contains information about a single piece of software. This
information includes the location from which to download the unaltered
source, any source patches to be applied to that source (if needed),
which special configuration options to apply, how to compile the source
files, and how to package the compiled output.
The term “package” is sometimes used to refer to recipes. However, since
the word “package” is used for the packaged output from the OpenEmbedded
build system (i.e. .ipk, .deb or .rpm files), this document avoids
using the term “package” when referring to recipes.
4.1.3 Classes
Class files (.bbclass) contain information that is useful to share
between recipes files. An example is the autotools* class,
which contains common settings for any application that is built with
the GNU Autotools.
The “Classes” chapter in the Yocto Project
Reference Manual provides details about classes and how to use them.
4.1.4 Configurations
The configuration files (.conf) define various configuration
variables that govern the OpenEmbedded build process. These files fall
into several areas that define machine configuration options,
distribution configuration options, compiler tuning options, general
common configuration options, and user configuration options in
conf/local.conf, which is found in the Build Directory.
4.2 Layers
Layers are repositories that contain related metadata (i.e. sets of instructions) that tell the OpenEmbedded build system how to build a target. The Yocto Project Layer Model facilitates collaboration, sharing, customization, and reuse within the Yocto Project development environment. Layers logically separate information for your project. For example, you can use a layer to hold all the configurations for a particular piece of hardware. Isolating hardware-specific configurations allows you to share other metadata by using a different layer where that metadata might be common across several pieces of hardware.
There are many layers working in the Yocto Project development environment. The Yocto Project Compatible Layer Index and OpenEmbedded Layer Index both contain layers from which you can use or leverage.
By convention, layers in the Yocto Project follow a specific form.
Conforming to a known structure allows BitBake to make assumptions
during builds on where to find types of metadata. You can find
procedures and learn about tools (i.e. bitbake-layers) for creating
layers suitable for the Yocto Project in the
“Understanding and Creating Layers”
section of the Yocto Project Development Tasks Manual.
4.3 OpenEmbedded Build System Concepts
This section takes a more detailed look inside the build process used by the OpenEmbedded Build System, which is the build system specific to the Yocto Project. At the heart of the build system is BitBake, the task executor.
The following diagram represents the high-level workflow of a build. The remainder of this section expands on the fundamental input, output, process, and metadata logical blocks that make up the workflow.
In general, the build’s workflow consists of several functional areas:
User Configuration: metadata you can use to control the build process.
Metadata Layers: Various layers that provide software, machine, and distro metadata.
Source Files: Upstream releases, local projects, and SCMs.
Build System: Processes under the control of BitBake. This block expands on how BitBake fetches source, applies patches, completes compilation, analyzes output for package generation, creates and tests packages, generates images, and generates cross-development tools.
Package Feeds: Directories containing output packages (RPM, DEB or IPK), which are subsequently used in the construction of an image or Software Development Kit (SDK), produced by the build system. These feeds can also be copied and shared using a web server or other means to facilitate extending or updating existing images on devices at runtime if runtime package management is enabled.
Images: Images produced by the workflow.
Application Development SDK: Cross-development tools that are produced along with an image or separately with BitBake.
4.3.1 User Configuration
User configuration helps define the build. Through user configuration, you can tell BitBake the target architecture for which you are building the image, where to store downloaded source, and other build properties.
The following figure shows an expanded representation of the “User Configuration” box of the general workflow figure:
BitBake needs some basic configuration files in order to complete a
build. These files are *.conf files. The minimally necessary ones
reside as example files in the build/conf directory of the
Build Directory.
When you initialize the build environment, you can specify which directory will be the Source Directory.
Setting up the build environment creates a Build Directory
if one does not already exist. BitBake uses the Build Directory
for all its work during builds. The Build Directory has a conf directory
that contains default versions of your local.conf and bblayers.conf
configuration files. These default configuration files are created only if they do not already exist in the Build
Directory at the time you source the build environment setup script.
Configuration files provide many basic variables
that define a build environment. To show a list of possible variables to
configure from configuration files, see the
local.conf.sample in the
meta-poky layer:
Here is a non-exhaustive list:
Target Machine Selection: Controlled by the MACHINE variable.
Download Directory: Controlled by the DL_DIR variable.
Shared State Directory: Controlled by the SSTATE_DIR variable.
Persistent Data Directory: Controlled by the PERSISTENT_DIR variable.
Build Output: Controlled by the TMPDIR variable.
Distribution Policy: Controlled by the DISTRO variable.
Packaging Format: Controlled by the PACKAGE_CLASSES variable.
SDK Target Architecture: Controlled by the SDKMACHINE variable.
Extra Image Packages: Controlled by the EXTRA_IMAGE_FEATURES variable.
Note
Configurations set in the conf/local.conf file can also be set
in the conf/site.conf and conf/auto.conf configuration files.
The bblayers.conf file tells BitBake what layers you want considered
during the build. By default, the layers listed in this file include
layers minimally needed by the build system. However, you must manually
add any custom layers you have created. You can find more information on
working with the bblayers.conf file in the
“Enabling Your Layer”
section in the Yocto Project Development Tasks Manual.
The files site.conf and auto.conf are not created by the
environment initialization script. If you want the site.conf file,
you need to create it yourself. The auto.conf file is typically
created by an autobuilder:
site.conf: You can use the
conf/site.confconfiguration file to configure multiple build directories. For example, suppose you had several build environments and they shared some common features. You can set these default build properties here. A good example is perhaps the packaging format to use through the PACKAGE_CLASSES variable.auto.conf: The file is usually created and written to by an autobuilder. The settings put into the file are typically the same as you would find in the
conf/local.confor theconf/site.conffiles.
You can edit all configuration files to further define any particular build environment. This process is represented by the “User Configuration Edits” box in the figure.
When you launch your build with the bitbake target command, BitBake
sorts out the configurations to ultimately define your build
environment. It is important to understand that the
OpenEmbedded Build System reads the
configuration files in a specific order: site.conf, auto.conf,
and local.conf. And, the build system applies the normal assignment
statement rules as described in the
“Syntax and Operators” chapter
of the BitBake User Manual. Because the files are parsed in a specific
order, variable assignments for the same variable could be affected. For
example, if the auto.conf file and the local.conf set variable1
to different values, because the build system parses local.conf
after auto.conf, variable1 is assigned the value from the
local.conf file.
4.3.2 Metadata, Machine Configuration, and Policy Configuration
The previous section described the user configurations that define BitBake’s global behavior. This section takes a closer look at the layers the build system uses to further control the build. These layers provide Metadata for the software, machine, and policies.
In general, there are three types of layer input. You can see them below the “User Configuration” box in the general workflow figure:
Metadata (.bb + Patches): Software layers containing user-supplied recipe files, patches, and append files. A good example of a software layer might be the meta-qt5 layer from the OpenEmbedded Layer Index. This layer is for version 5.0 of the popular Qt cross-platform application development framework for desktop, embedded and mobile.
Machine BSP Configuration: Board Support Package (BSP) layers (i.e. “BSP Layer” in the following figure) providing machine-specific configurations. This type of information is specific to a particular target architecture. A good example of a BSP layer from the Reference Embedded Distribution (Poky) is the meta-yocto-bsp layer.
Policy Configuration: Distribution Layers (i.e. “Distro Layer” in the following figure) providing top-level or general policies for the images or SDKs being built for a particular distribution. For example, in the Poky Reference Distribution the distro layer is the meta-poky layer. Within the distro layer is a
conf/distrodirectory that contains distro configuration files (e.g. poky.conf that contain many policy configurations for the Poky distribution.
The following figure shows an expanded representation of these three layers from the general workflow figure:
In general, all layers have a similar structure. They all contain a
licensing file (e.g. COPYING.MIT) if the layer is to be distributed,
a README file as good practice and especially if the layer is to be
distributed, a configuration directory, and recipe directories. You can
learn about the general structure for layers used with the Yocto Project
in the
“Creating Your Own Layer”
section in the
Yocto Project Development Tasks Manual. For a general discussion on
layers and the many layers from which you can draw, see the
“Layers” and
“The Yocto Project Layer Model” sections both
earlier in this manual.
If you explored the previous links, you discovered some areas where many layers that work with the Yocto Project exist. The Source Repositories also shows layers categorized under “Yocto Metadata Layers.”
Note
There are layers in the Yocto Project Source Repositories that cannot be found in the OpenEmbedded Layer Index. Such layers are either deprecated or experimental in nature.
BitBake uses the conf/bblayers.conf file, which is part of the user
configuration, to find what layers it should be using as part of the
build.
4.3.2.1 Distro Layer
A distribution layer provides policy configurations for your
distribution. Best practices dictate that you isolate these types of
configurations into their own layer. Settings you provide in
conf/distro/distro.conf override similar settings that BitBake finds
in your conf/local.conf file in the Build Directory.
The following list provides some explanation and references for what you typically find in a distribution layer:
classes, classes-global, classes-recipe: Class files (
.bbclass) hold common functionality that can be shared among recipes in the distribution. When your recipes inherit a class, they take on the settings and functions for that class. You can read more about class files in the “Classes” chapter of the Yocto Reference Manual.conf: This area holds configuration files for the layer (
conf/layer.conf), the distribution (conf/distro/distro.conf), and any distribution-wide include files.recipes-*: Recipes and append files that affect common functionality across the distribution. This area could include recipes and append files to add distribution-specific configuration, initialization scripts, custom image recipes, and so forth. Examples of
recipes-*directories arerecipes-coreandrecipes-extra. Hierarchy and contents within arecipes-*directory can vary. Generally, these directories contain recipe files (*.bb), recipe append files (*.bbappend), directories that are distro-specific for configuration files, and so forth.
4.3.2.2 BSP Layer
A BSP layer provides machine configurations that target specific hardware. Everything in this layer is specific to the machine for which you are building the image or the SDK. A common structure or form is defined for BSP layers. You can learn more about this structure in the Yocto Project Board Support Package Developer’s Guide.
Note
In order for a BSP layer to be considered compliant with the Yocto Project, it must meet some structural requirements.
A BSP layer’s configuration directory contains configuration files for
the machine (conf/machine/machine.conf) and, of course, the layer
(conf/layer.conf).
The remainder of the layer is dedicated to specific recipes by function:
recipes-bsp, recipes-core, recipes-graphics,
recipes-kernel, and so forth. There can be metadata for multiple
formfactors, graphics support systems, and so forth.
Note
While the figure shows several
recipes-*
directories, not all these directories appear in all BSP layers.
4.3.2.3 Software Layer
A software layer provides the Metadata for additional software packages used during the build. This layer does not include Metadata that is specific to the distribution or the machine, which are found in their respective layers.
This layer contains any recipes, append files, and patches that your project needs.
4.3.3 Sources
In order for the OpenEmbedded build system to create an image or any target, it must be able to access source files. The general workflow figure represents source files using the “Upstream Project Releases”, “Local Projects”, and “SCMs (optional)” boxes. The figure represents mirrors, which also play a role in locating source files, with the “Source Materials” box.
The method by which source files are ultimately organized is a function of the project. For example, for released software, projects tend to use tarballs or other archived files that can capture the state of a release guaranteeing that it is statically represented. On the other hand, for a project that is more dynamic or experimental in nature, a project might keep source files in a repository controlled by a Source Control Manager (SCM) such as Git. Pulling source from a repository allows you to control the point in the repository (the revision) from which you want to build software. A combination of the two is also possible.
BitBake uses the SRC_URI variable to point to source files regardless of their location. Each recipe must have a SRC_URI variable that points to the source.
Another area that plays a significant role in where source files come from is pointed to by the DL_DIR variable. This area is a cache that can hold previously downloaded source. You can also instruct the OpenEmbedded build system to create tarballs from Git repositories, which is not the default behavior, and store them in the DL_DIR by using the BB_GENERATE_MIRROR_TARBALLS variable.
Judicious use of a DL_DIR directory can save the build system a trip across the Internet when looking for files. A good method for using a download directory is to have DL_DIR point to an area outside of your Build Directory. Doing so allows you to safely delete the Build Directory if needed without fear of removing any downloaded source file.
The remainder of this section provides a deeper look into the source files and the mirrors. Here is a more detailed look at the source file area of the general workflow figure:
4.3.3.1 Upstream Project Releases
Upstream project releases exist anywhere in the form of an archived file (e.g. tarball or zip file). These files correspond to individual recipes. For example, the figure uses specific releases each for BusyBox, Qt, and Dbus. An archive file can be for any released product that can be built using a recipe.
4.3.3.2 Local Projects
Local projects are custom bits of software the user provides. These bits reside somewhere local to a project — perhaps a directory into which the user checks in items (e.g. a local directory containing a development source tree used by the group).
The canonical method through which to include a local project is to use the
externalsrc class to include that local project. You use
either local.conf or a recipe’s append file to override or set the
recipe to point to the local directory from which to fetch the source.
4.3.3.3 Source Control Managers (Optional)
Another place from which the build system can get source files is with Fetchers employing various Source Control Managers (SCMs) such as Git or Subversion. In such cases, a repository is cloned or checked out. The do_fetch task inside BitBake uses the SRC_URI variable and the argument’s prefix to determine the correct fetcher module.
Note
For information on how to have the OpenEmbedded build system generate tarballs for Git repositories and place them in the DL_DIR directory, see the BB_GENERATE_MIRROR_TARBALLS variable in the Yocto Project Reference Manual.
When fetching a repository, BitBake uses the SRCREV variable to determine the specific revision from which to build.
4.3.3.4 Source Mirror(s)
There are two kinds of mirrors: pre-mirrors and regular mirrors. The PREMIRRORS and MIRRORS variables point to these, respectively. BitBake checks pre-mirrors before looking upstream for any source files. Pre-mirrors are appropriate when you have a shared directory that is not a directory defined by the DL_DIR variable. A Pre-mirror typically points to a shared directory that is local to your organization.
Regular mirrors can be any site across the Internet that is used as an alternative location for source code should the primary site not be functioning for some reason or another.
4.3.4 Package Feeds
When the OpenEmbedded build system generates an image or an SDK, it gets the packages from a package feed area located in the Build Directory. The general workflow figure shows this package feeds area in the upper-right corner.
This section looks a little closer into the package feeds area used by the build system. Here is a more detailed look at the area:
Package feeds are an intermediary step in the build process. The OpenEmbedded build system provides classes to generate different package types, and you specify which classes to enable through the PACKAGE_CLASSES variable. Before placing the packages into package feeds, the build process validates them with generated output quality assurance checks through the insane class.
The package feed area resides in the Build Directory. The directory the build system uses to temporarily store packages is determined by a combination of variables and the particular package manager in use. See the “Package Feeds” box in the illustration and note the information to the right of that area. In particular, the following defines where package files are kept:
DEPLOY_DIR: Defined as
tmp/deployin the Build Directory.DEPLOY_DIR_*: Depending on the package manager used, the package type sub-folder. Given RPM, IPK, or DEB packaging and tarball creation, the DEPLOY_DIR_RPM, DEPLOY_DIR_IPK, or DEPLOY_DIR_DEB variables are used, respectively.PACKAGE_ARCH: Defines architecture-specific sub-folders. For example, packages could be available for the i586 or qemux86 architectures.
BitBake uses the
do_package_write_*
tasks to generate packages and place them into the package holding area
(e.g. do_package_write_ipk for IPK packages). See the
“do_package_write_deb”,
“do_package_write_ipk”,
and
“do_package_write_rpm”
sections in the Yocto Project Reference Manual for additional
information. As an example, consider a scenario where an IPK packaging
manager is being used and there is package architecture support for both
i586 and qemux86. Packages for the i586 architecture are placed in
build/tmp/deploy/ipk/i586, while packages for the qemux86
architecture are placed in build/tmp/deploy/ipk/qemux86.
4.3.5 BitBake Tool
The OpenEmbedded build system uses BitBake to produce images and Software Development Kits (SDKs). You can see from the general workflow figure, the BitBake area consists of several functional areas. This section takes a closer look at each of those areas.
Note
Documentation for the BitBake tool is available separately. See the BitBake User Manual for reference material on BitBake.
4.3.5.1 Source Fetching
The first stages of building a recipe are to fetch and unpack the source code:
The do_fetch and do_unpack tasks fetch the source files and unpack them into the Build Directory.
Note
For every local file (e.g. file://) that is part of a recipe’s
SRC_URI statement, the OpenEmbedded build system takes a
checksum of the file for the recipe and inserts the checksum into
the signature for the do_fetch task. If any local
file has been modified, the do_fetch task and all
tasks that depend on it are re-executed.
By default, everything is accomplished in the Build Directory, which has a defined structure. For additional general information on the Build Directory, see the “build/” section in the Yocto Project Reference Manual.
Each recipe has an area in the Build Directory where the unpacked
source code resides. The UNPACKDIR variable points to this area for a
recipe’s unpacked source code, and has the default sources name. The
preceding figure and the following list describe the Build Directory’s
hierarchy:
TMPDIR: The base directory where the OpenEmbedded build system performs all its work during the build. The default base directory is the
tmpdirectory.PACKAGE_ARCH: The architecture of the built package or packages. Depending on the eventual destination of the package or packages (i.e. machine architecture, Build Host, SDK, or specific machine), PACKAGE_ARCH varies. See the variable’s description for details.
TARGET_OS: The operating system of the target device. A typical value would be “linux” (e.g. “qemux86-poky-linux”).
PN: The name of the recipe used to build the package. This variable can have multiple meanings. However, when used in the context of input files, PN represents the name of the recipe.
WORKDIR: The location where the OpenEmbedded build system builds a recipe (i.e. does the work to create the package).
PV: The version of the recipe used to build the package.
UNPACKDIR: Contains the unpacked source files for a given recipe.
S: Contains the final location of the source code.
The default value for BP is
${BPN}-${PV}where:
Note
In the previous figure, notice that there are two sample hierarchies: one based on package architecture (i.e. PACKAGE_ARCH) and one based on a machine (i.e. MACHINE). The underlying structures are identical. The differentiator being what the OpenEmbedded build system is using as a build target (e.g. general architecture, a build host, an SDK, or a specific machine).
4.3.5.2 Patching
Once source code is fetched and unpacked, BitBake locates patch files and applies them to the source files:
The do_patch task uses a recipe’s SRC_URI statements and the FILESPATH variable to locate applicable patch files.
Default processing for patch files assumes the files have either
*.patch or *.diff file types. You can use SRC_URI parameters
to change the way the build system recognizes patch files. See the
do_patch task for more
information.
BitBake finds and applies multiple patches for a single recipe in the order in which it locates the patches. The FILESPATH variable defines the default set of directories that the build system uses to search for patch files. Once found, patches are applied to the recipe’s source files, which are located in the S directory.
For more information on how the source directories are created, see the “Source Fetching” section. For more information on how to create patches and how the build system processes patches, see the “Patching Code” section in the Yocto Project Development Tasks Manual. You can also see the “Use devtool modify to Modify the Source of an Existing Component” section in the Yocto Project Application Development and the Extensible Software Development Kit (SDK) manual and the “Using Traditional Kernel Development to Patch the Kernel” section in the Yocto Project Linux Kernel Development Manual.
4.3.5.3 Configuration, Compilation, and Staging
After source code is patched, BitBake executes tasks that configure and compile the source code. Once compilation occurs, the files are copied to a holding area (staged) in preparation for packaging:
This step in the build process consists of the following tasks:
do_prepare_recipe_sysroot: This task sets up the two sysroots in
${WORKDIR}(i.e.recipe-sysrootandrecipe-sysroot-native) so that during the packaging phase the sysroots can contain the contents of the do_populate_sysroot tasks of the recipes on which the recipe containing the tasks depends. A sysroot exists for both the target and for the native binaries, which run on the host system.do_configure: This task configures the source by enabling and disabling any build-time and configuration options for the software being built. Configurations can come from the recipe itself as well as from an inherited class. Additionally, the software itself might configure itself depending on the target for which it is being built.
The configurations handled by the do_configure task are specific to configurations for the source code being built by the recipe.
If you are using the autotools* class, you can add additional configuration options by using the EXTRA_OECONF or PACKAGECONFIG_CONFARGS variables. For information on how this variable works within that class, see the autotools* class here.
do_compile: Once a configuration task has been satisfied, BitBake compiles the source using the do_compile task. Compilation occurs in the directory pointed to by the B variable. Realize that the B directory is, by default, the same as the S directory.
do_install: After compilation completes, BitBake executes the do_install task. This task copies files from the B directory and places them in a holding area pointed to by the D variable. Packaging occurs later using files from this holding directory.
4.3.5.4 Package Splitting
After source code is configured, compiled, and staged, the build system analyzes the results and splits the output into packages:
The do_package and do_packagedata tasks combine to analyze the files found in the D directory and split them into subsets based on available packages and files. Analysis involves the following as well as other items: splitting out debugging symbols, looking at shared library dependencies between packages, and looking at package relationships.
The do_packagedata task creates package metadata based on the analysis such that the build system can generate the final packages. The do_populate_sysroot task stages (copies) a subset of the files installed by the do_install task into the appropriate sysroot. Working, staged, and intermediate results of the analysis and package splitting process use several areas:
PKGD: The destination directory (i.e.
package) for packages before they are split into individual packages.PKGDESTWORK: A temporary work area (i.e.
pkgdata) used by the do_package task to save package metadata.PKGDEST: The parent directory (i.e.
packages-split) for packages after they have been split.PKGDATA_DIR: A shared, global-state directory that holds packaging metadata generated during the packaging process. The packaging process copies metadata from PKGDESTWORK to the PKGDATA_DIR area where it becomes globally available.
STAGING_DIR_HOST: The path for the sysroot for the system on which a component is built to run (i.e.
recipe-sysroot).STAGING_DIR_NATIVE: The path for the sysroot used when building components for the build host (i.e.
recipe-sysroot-native).STAGING_DIR_TARGET: The path for the sysroot used when a component that is built to execute on a system and it generates code for yet another machine (e.g. cross-canadian recipes).
Packages for a recipe are listed in the PACKAGES variable. The bitbake.conf configuration file defines the following default list of packages:
PACKAGES = "${PN}-src ${PN}-dbg ${PN}-staticdev ${PN}-dev ${PN}-doc ${PN}-locale ${PACKAGE_BEFORE_PN} ${PN}"
Each of these packages contains a default list of files defined with the
FILES variable. For example, the package ${PN}-dev represents files
useful to the development of applications depending on ${PN}. The default
list of files for ${PN}-dev, also defined in bitbake.conf, is defined as follows:
FILES:${PN}-dev = "${includedir} ${FILES_SOLIBSDEV} ${libdir}/*.la \
${libdir}/*.o ${libdir}/pkgconfig ${datadir}/pkgconfig \
${datadir}/aclocal ${base_libdir}/*.o \
${libdir}/${BPN}/*.la ${base_libdir}/*.la \
${libdir}/cmake ${datadir}/cmake"
The paths in this list must be absolute paths from the point of view of the root filesystem on the target, and must not make a reference to the variable D or any WORKDIR related variable. A correct example would be:
${sysconfdir}/foo.conf
Note
The list of files for a package is defined using the override syntax by
separating FILES and the package name by a semi-colon (:).
A given file can only ever be in one package. By iterating from the leftmost to rightmost package in PACKAGES, each file matching one of the patterns defined in the corresponding FILES definition is included in the package.
Note
To find out which package installs a file, the oe-pkgdata-util
command-line utility can be used:
$ oe-pkgdata-util find-path '/etc/fstab'
base-files: /etc/fstab
For more information on the oe-pkgdata-util utility, see the section
Viewing Package Information with oe-pkgdata-util of the Yocto Project Development Tasks Manual.
To add a custom package variant of the ${PN} recipe named
${PN}-extra (name is arbitrary), one can add it to the
PACKAGE_BEFORE_PN variable:
PACKAGE_BEFORE_PN += "${PN}-extra"
Alternatively, a custom package can be added by adding it to the
PACKAGES variable using the prepend operator (=+):
PACKAGES =+ "${PN}-extra"
Depending on the type of packages being created (RPM, DEB, or IPK), the
do_package_write_*
task creates the actual packages and places them in the Package Feed
area, which is ${TMPDIR}/deploy. You can see the
“Package Feeds” section for more detail on
that part of the build process.
Note
Support for creating feeds directly from the deploy/*
directories does not exist. Creating such feeds usually requires some
kind of feed maintenance mechanism that would upload the new packages
into an official package feed (e.g. the Ångström distribution). This
functionality is highly distribution-specific and thus is not
provided out of the box.
4.3.5.5 Image Generation
Once packages are split and stored in the Package Feeds area, the build system uses BitBake to generate the root filesystem image:
The image generation process consists of several stages and depends on several tasks and variables. The do_rootfs task creates the root filesystem (file and directory structure) for an image. This task uses several key variables to help create the list of packages to actually install:
IMAGE_INSTALL: Lists out the base set of packages from which to install from the Package Feeds area.
PACKAGE_EXCLUDE: Specifies packages that should not be installed into the image.
IMAGE_FEATURES: Specifies features to include in the image. Most of these features map to additional packages for installation.
PACKAGE_CLASSES: Specifies the package backend (e.g. RPM, DEB, or IPK) to use and consequently helps determine where to locate packages within the Package Feeds area.
IMAGE_LINGUAS: Determines the language(s) for which additional language support packages are installed.
PACKAGE_INSTALL: The final list of packages passed to the package manager for installation into the image.
With IMAGE_ROOTFS pointing to the location of the filesystem under construction and the PACKAGE_INSTALL variable providing the final list of packages to install, the root file system is created.
Package installation is under control of the package manager (e.g. dnf/rpm, opkg, or apt/dpkg) regardless of whether or not package management is enabled for the target. At the end of the process, if package management is not enabled for the target, the package manager’s data files are deleted from the root filesystem. As part of the final stage of package installation, post installation scripts that are part of the packages are run. Any scripts that fail to run on the build host are run on the target when the target system is first booted. If you are using a read-only root filesystem, all the post installation scripts must succeed on the build host during the package installation phase since the root filesystem on the target is read-only.
The final stages of the do_rootfs task handle post processing. Post processing includes creation of a manifest file and optimizations.
The manifest file (.manifest) resides in the same directory as the root
filesystem image. This file lists out, line-by-line, the installed packages.
The manifest file is useful for the testimage class,
for example, to determine whether or not to run specific tests. See the
IMAGE_MANIFEST variable for additional information.
Optimizing processes that are run across the image include mklibs
and any other post-processing commands as defined by the
ROOTFS_POSTPROCESS_COMMAND
variable. The mklibs process optimizes the size of the libraries.
After the root filesystem is built, processing begins on the image through the do_image task. The build system runs any pre-processing commands as defined by the IMAGE_PREPROCESS_COMMAND variable. This variable specifies a list of functions to call before the build system creates the final image output files.
The build system dynamically creates do_image_* tasks as needed, based on the image types specified in the IMAGE_FSTYPES variable. The process turns everything into an image file or a set of image files and can compress the root filesystem image to reduce the overall size of the image. The formats used for the root filesystem depend on the IMAGE_FSTYPES variable. Compression depends on whether the formats support compression.
As an example, a dynamically created task when creating a particular image type would take the following form:
do_image_type
So, if the type
as specified by the IMAGE_FSTYPES were ext4, the dynamically
generated task would be as follows:
do_image_ext4
The final task involved in image creation is the do_image_complete task. This task completes the image by applying any image post processing as defined through the IMAGE_POSTPROCESS_COMMAND variable. The variable specifies a list of functions to call once the build system has created the final image output files.
Note
The entire image generation process is run under Pseudo. Running under Pseudo ensures that the files in the root filesystem have correct ownership.
4.3.5.6 SDK Generation
The OpenEmbedded build system uses BitBake to generate the Software Development Kit (SDK) installer scripts for both the standard SDK and the extensible SDK (eSDK):
Note
For more information on the cross-development toolchain generation, see the “Cross-Development Toolchain Generation” section. For information on advantages gained when building a cross-development toolchain using the do_populate_sdk task, see the “Building an SDK Installer” section in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.
Like image generation, the SDK script process consists of several stages and depends on many variables. The do_populate_sdk and do_populate_sdk_ext tasks use these key variables to help create the list of packages to actually install. For information on the variables listed in the figure, see the “Application Development SDK” section.
The do_populate_sdk task helps create the standard SDK and handles two parts: a target part and a host part. The target part is the part built for the target hardware and includes libraries and headers. The host part is the part of the SDK that runs on the SDKMACHINE.
The do_populate_sdk_ext task helps create the extensible SDK and handles host and target parts differently than its counter part does for the standard SDK. For the extensible SDK, the task encapsulates the build system, which includes everything needed (host and target) for the SDK.
Regardless of the type of SDK being constructed, the tasks perform some
cleanup after which a cross-development environment setup script and any
needed configuration files are created. The final output is the
Cross-development toolchain installation script (.sh file), which
includes the environment setup script.
4.3.5.7 Stamp Files and the Rerunning of Tasks
For each task that completes successfully, BitBake writes a stamp file into the STAMPS_DIR directory. The beginning of the stamp file’s filename is determined by the STAMP variable, and the end of the name consists of the task’s name and current input checksum.
Note
This naming scheme assumes that BB_SIGNATURE_HANDLER is “OEBasicHash”, which is almost always the case in current OpenEmbedded.
To determine if a task needs to be rerun, BitBake checks if a stamp file with a matching input checksum exists for the task. In this case, the task’s output is assumed to exist and still be valid. Otherwise, the task is rerun.
Note
The stamp mechanism is more general than the shared state (sstate) cache mechanism described in the “Setscene Tasks and Shared State” section. BitBake avoids rerunning any task that has a valid stamp file, not just tasks that can be accelerated through the sstate cache.
However, you should realize that stamp files only serve as a marker that some work has been done and that these files do not record task output. The actual task output would usually be somewhere in TMPDIR (e.g. in some recipe’s WORKDIR.) What the sstate cache mechanism adds is a way to cache task output that can then be shared between build machines.
Since STAMPS_DIR is usually a subdirectory of TMPDIR, removing TMPDIR will also remove STAMPS_DIR, which means tasks will properly be rerun to repopulate TMPDIR.
If you want some task to always be considered “out of date”, you can mark it with the nostamp varflag. If some other task depends on such a task, then that task will also always be considered out of date, which might not be what you want.
For details on how to view information about a task’s signature, see the “Viewing Task Variable Dependencies” section in the Yocto Project Development Tasks Manual.
4.3.6 Images
The images produced by the build system are compressed forms of the root filesystem and are ready to boot on a target device. You can see from the general workflow figure that BitBake output, in part, consists of images. This section takes a closer look at this output:
Note
For a list of example images that the Yocto Project provides, see the “Images” chapter in the Yocto Project Reference Manual.
The build process writes images out to the Build Directory inside
the tmp/deploy/images/machine/ folder as shown in the figure. This
folder contains any files expected to be loaded on the target device.
The DEPLOY_DIR variable points to the deploy directory, while the
DEPLOY_DIR_IMAGE variable points to the appropriate directory
containing images for the current configuration.
kernel-image: A kernel binary file. The KERNEL_IMAGETYPE variable determines the naming scheme for the kernel image file. Depending on this variable, the file could begin with a variety of naming strings. The
deploy/images/machine directory can contain multiple image files for the machine.root-filesystem-image: Root filesystems for the target device (e.g.
*.ext3or*.bz2files). The IMAGE_FSTYPES variable determines the root filesystem image type. Thedeploy/images/machine directory can contain multiple root filesystems for the machine.kernel-modules: Tarballs that contain all the modules built for the kernel. Kernel module tarballs exist for legacy purposes and can be suppressed by setting the MODULE_TARBALL_DEPLOY variable to “0”. The
deploy/images/machine directory can contain multiple kernel module tarballs for the machine.bootloaders: If applicable to the target machine, bootloaders supporting the image. The
deploy/images/machine directory can contain multiple bootloaders for the machine.symlinks: The
deploy/images/machine folder contains a symbolic link that points to the most recently built file for each machine. These links might be useful for external scripts that need to obtain the latest version of each file.
4.3.7 Application Development SDK
In the general workflow figure, the
output labeled “Application Development SDK” represents an SDK. The SDK
generation process differs depending on whether you build an extensible
SDK (e.g. bitbake -c populate_sdk_ext imagename) or a standard SDK
(e.g. bitbake -c populate_sdk imagename). This section takes a
closer look at this output:
The specific form of this output is a set of files that includes a
self-extracting SDK installer (*.sh), host and target manifest
files, and files used for SDK testing. When the SDK installer file is
run, it installs the SDK. The SDK consists of a cross-development
toolchain, a set of libraries and headers, and an SDK environment setup
script. Running this installer essentially sets up your
cross-development environment. You can think of the cross-toolchain as
the “host” part because it runs on the SDK machine. You can think of the
libraries and headers as the “target” part because they are built for
the target hardware. The environment setup script is added so that you
can initialize the environment before using the tools.
Note
The Yocto Project supports several methods by which you can set up this cross-development environment. These methods include downloading pre-built SDK installers or building and installing your own SDK installer.
For background information on cross-development toolchains in the Yocto Project development environment, see the “Cross-Development Toolchain Generation” section.
For information on setting up a cross-development environment, see the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.
All the output files for an SDK are written to the deploy/sdk folder
inside the Build Directory as shown in the previous figure. Depending
on the type of SDK, there are several variables to configure these files.
The variables associated with an extensible SDK are:
DEPLOY_DIR: Points to the
deploydirectory.SDK_EXT_TYPE: Controls whether or not shared state artifacts are copied into the extensible SDK. By default, all required shared state artifacts are copied into the SDK.
SDK_INCLUDE_PKGDATA: Specifies whether or not packagedata is included in the extensible SDK for all recipes in the “world” target.
SDK_INCLUDE_TOOLCHAIN: Specifies whether or not the toolchain is included when building the extensible SDK.
ESDK_LOCALCONF_ALLOW: A list of variables allowed through from the build system configuration into the extensible SDK configuration.
ESDK_LOCALCONF_REMOVE: A list of variables not allowed through from the build system configuration into the extensible SDK configuration.
ESDK_CLASS_INHERIT_DISABLE: A list of classes to remove from the INHERIT value globally within the extensible SDK configuration.
This next list, shows the variables associated with a standard SDK:
DEPLOY_DIR: Points to the
deploydirectory.SDKMACHINE: Specifies the architecture of the machine on which the cross-development tools are run to create packages for the target hardware.
SDKIMAGE_FEATURES: Lists the features to include in the “target” part of the SDK.
TOOLCHAIN_HOST_TASK: Lists packages that make up the host part of the SDK (i.e. the part that runs on the SDKMACHINE). When you use
bitbake -c populate_sdk imagenameto create the SDK, a set of default packages apply. This variable allows you to add more packages.TOOLCHAIN_TARGET_TASK: Lists packages that make up the target part of the SDK (i.e. the part built for the target hardware).
SDKPATHINSTALL: Defines the default SDK installation path offered by the installation script.
SDK_HOST_MANIFEST: Lists all the installed packages that make up the host part of the SDK. This variable also plays a minor role for extensible SDK development as well. However, it is mainly used for the standard SDK.
SDK_TARGET_MANIFEST: Lists all the installed packages that make up the target part of the SDK. This variable also plays a minor role for extensible SDK development as well. However, it is mainly used for the standard SDK.
4.4 Cross-Development Toolchain Generation
The Yocto Project does most of the work for you when it comes to creating The Cross-Development Toolchain. This section provides some technical background on how cross-development toolchains are created and used. For more information on toolchains, you can also see the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.
In the Yocto Project development environment, cross-development toolchains are used to build images and applications that run on the target hardware. With just a few commands, the OpenEmbedded build system creates these necessary toolchains for you.
The following figure shows a high-level build environment regarding toolchain construction and use.
Most of the work occurs on the Build Host. This is the machine used to
build images and generally work within the Yocto Project
environment. When you run
BitBake to create an image, the
OpenEmbedded build system uses the host gcc compiler to bootstrap a
cross-compiler named gcc-cross (or clang-cross if Clang is used). This
compiler is what BitBake uses to compile source files when creating the target
image. You can think of it simply as an automatically generated
cross-compiler that is used internally within BitBake only.
The chain of events that occurs when the standard toolchain is bootstrapped:
gcc -> virtual/cross-binutils -> linux-libc-headers -> virtual/cross-cc -> libgcc-initial -> virtual/libc -> libgcc -> virtual/compilerlibs
gcc: The compiler, GNU Compiler Collection (GCC), provided by the Build Host, or by a buildtools tarball.virtual/cross-binutils: The binary utilities needed in order to run thevirtual/cross-ccphase of the bootstrap operation and build the headers for the C library.linux-libc-headers: Headers needed for the cross-compiler and C library build.virtual/cross-cc: The final stage of the bootstrap process for the cross-compiler. This stage results in the actual cross-compiler that BitBake uses when it builds an image for a targeted device.This tool is a “native” tool (i.e. it is designed to run on the build host).
libgcc-initial: An initial version of the GCC support library needed to bootstrapvirtual/libc.virtual/libc: An provider of the C Standard Library (for example, the GNU C Library).libgcc: The final version of the GCC support library which can only be built once there is a C library to link against.virtual/compilerlibs: Runtime libraries resulting from the toolchain bootstrapping process. This tool produces a binary that consists of the runtime libraries need for the targeted device.
You can use the OpenEmbedded build system to build an installer for the
relocatable SDK used to develop applications. When you run the
installer, it installs the toolchain, which contains the development
tools (e.g., gcc-cross-canadian, clang-cross-canadian,
binutils-cross-canadian, and other nativesdk-* tools), which are tools
native to the SDK (i.e. native to SDK_ARCH), you need to cross-compile
and test your software. The figure shows the commands you use to easily build
out this toolchain. This cross-development toolchain is built to execute on the
SDKMACHINE, which might or might not be the same machine as the Build
Host.
Note
If your target architecture is supported by the Yocto Project, you can take advantage of pre-built images that ship with the Yocto Project and already contain cross-development toolchain installers.
Here is the bootstrap process for the relocatable toolchain:
gcc -> virtual/cross-binutils -> linux-libc-headers -> virtual/cross-cc -> libgcc-initial -> virtual/libc -> gcc-cross-canadian/clang-cross-canadian
The chain is the same as the standard toolchain, except for the last item:
gcc-cross-canadian (or clang-cross-canadian) is the final relocatable
cross-compiler. When run on the SDKMACHINE, this tool produces
executable code that runs on the target device. Only one cross-canadian compiler
is produced per architecture since they can be targeted at different processor
optimizations using configurations passed to the compiler through the compile
commands. This circumvents the need for multiple compilers and thus reduces the
size of the toolchains.
Note
The extensible SDK does not use gcc-cross-canadian or clang-cross-canadian
since this SDK ships a copy of the OpenEmbedded build system and the
sysroot within it contains gcc-cross.
Note
To learn how to use Clang for the SDK, see PREFERRED_TOOLCHAIN_SDK.
Note
For information on advantages gained when building a cross-development toolchain installer, see the “Building an SDK Installer” appendix in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.
4.6 Automatically Added Runtime Dependencies
The OpenEmbedded build system automatically adds common types of runtime
dependencies between packages, which means that you do not need to
explicitly declare the packages using
RDEPENDS. There are three automatic
mechanisms (shlibdeps, pcdeps, and depchains) that
handle shared libraries, package configuration (pkg-config) modules, and
-dev and -dbg packages, respectively. For other types of runtime
dependencies, you must manually declare the dependencies.
shlibdeps: During the do_package task of each recipe, all shared libraries installed by the recipe are located. For each shared library, the package that contains the shared library is registered as providing the shared library. More specifically, the package is registered as providing the soname of the library. The resulting shared-library-to-package mapping is saved globally in PKGDATA_DIR by the do_packagedata task.Simultaneously, all executables and shared libraries installed by the recipe are inspected to see what shared libraries they link against. For each shared library dependency that is found, PKGDATA_DIR is queried to see if some package (likely from a different recipe) contains the shared library. If such a package is found, a runtime dependency is added from the package that depends on the shared library to the package that contains the library.
The automatically added runtime dependency also includes a version restriction. This version restriction specifies that at least the current version of the package that provides the shared library must be used, as if “package (>= version)” had been added to RDEPENDS. This forces an upgrade of the package containing the shared library when installing the package that depends on the library, if needed.
If you want to avoid a package being registered as providing a particular shared library (e.g. because the library is for internal use only), then add the library to PRIVATE_LIBS inside the package’s recipe.
pcdeps: During the do_package task of each recipe, all pkg-config modules (*.pcfiles) installed by the recipe are located. For each module, the package that contains the module is registered as providing the module. The resulting module-to-package mapping is saved globally in PKGDATA_DIR by the do_packagedata task.Simultaneously, all pkg-config modules installed by the recipe are inspected to see what other pkg-config modules they depend on. A module is seen as depending on another module if it contains a “Requires:” line that specifies the other module. For each module dependency, PKGDATA_DIR is queried to see if some package contains the module. If such a package is found, a runtime dependency is added from the package that depends on the module to the package that contains the module.
Note
The pcdeps mechanism most often infers dependencies between -dev packages.
depchains: If a packagefoodepends on a packagebar, thenfoo-devandfoo-dbgare also made to depend onbar-devandbar-dbg, respectively. Taking the-devpackages as an example, thebar-devpackage might provide headers and shared library symlinks needed byfoo-dev, which shows the need for a dependency between the packages.The dependencies added by
depchainsare in the form of RRECOMMENDS.Note
By default,
foo-devalso has an RDEPENDS-style dependency onfoo, because the default value ofRDEPENDS:${PN}-dev(set inbitbake.conf) includes “${PN}”.To ensure that the dependency chain is never broken,
-devand-dbgpackages are always generated by default, even if the packages turn out to be empty. See the ALLOW_EMPTY variable for more information.
The do_package task depends on the do_packagedata
task of each recipe in DEPENDS through use of a
[deptask]
declaration, which guarantees that the required shared-library /
module-to-package mapping information will be available when needed as long as
DEPENDS has been correctly set.
4.7 Fakeroot and Pseudo
Some tasks are easier to implement when allowed to perform certain operations that are normally reserved for the root user (e.g. do_install, do_package_write*, do_rootfs, and do_image_*). For example, the do_install task benefits from being able to set the UID and GID of installed files to arbitrary values.
One approach to allowing tasks to perform root-only operations would be to require BitBake to run as root. However, this method is cumbersome and has security issues. The approach that is actually used is to run tasks that benefit from root privileges in a “fake” root environment. Within this environment, the task and its child processes believe that they are running as the root user, and see an internally consistent view of the filesystem. As long as generating the final output (e.g. a package or an image) does not require root privileges, the fact that some earlier steps ran in a fake root environment does not cause problems.
The capability to run tasks in a fake root environment is known as “fakeroot”, which is derived from the BitBake keyword/variable flag that requests a fake root environment for a task.
In the OpenEmbedded Build System, the program that implements
fakeroot is known as Pseudo. Pseudo
overrides system calls by using the environment variable LD_PRELOAD,
which results in the illusion of running as root. To keep track of
“fake” file ownership and permissions resulting from operations that
require root permissions, Pseudo uses an SQLite 3 database. This
database is stored in
${WORKDIR}/pseudo/files.db
for individual recipes. Storing the database in a file as opposed to in
memory gives persistence between tasks and builds, which is not
accomplished using fakeroot.
Note
If you add your own task that manipulates the same files or
directories as a fakeroot task, then that task also needs to run
under fakeroot. Otherwise, the task cannot run root-only operations,
and cannot see the fake file ownership and permissions set by the
other task. You need to also add a dependency on
virtual/fakeroot-native:do_populate_sysroot, giving the following:
fakeroot do_mytask () {
...
}
do_mytask[depends] += "virtual/fakeroot-native:do_populate_sysroot"
For more information, see the FAKEROOT* variables in the BitBake User Manual. You can also reference the “Why Not Fakeroot?” article for background information on Fakeroot and Pseudo.
4.8 BitBake Tasks Map
To understand how BitBake operates in the build directory and environment we can consider the following recipes and diagram, to have full picture about the tasks that BitBake runs to generate the final package file for the recipe.
We will have two recipes as an example:
libhello: A recipe that provides a shared librarysayhello: A recipe that useslibhellolibrary to do its job
Note
sayhello depends on libhello at compile time as it needs the shared
library to do the dynamic linking process. It also depends on it at runtime
as the shared library loader needs to find the library.
For more details about dependencies check Dependencies.
libhello sources are as follows:
LICENSE: This is the license associated with this libraryMakefile: The file used bymaketo build the libraryhellolib.c: The implementation of the libraryhellolib.h: The C header of the library
sayhello sources are as follows:
LICENSE: This is the license associated with this projectMakefile: The file used bymaketo build the projectsayhello.c: The source file of the project
Before presenting the contents of each file, here are the steps
that we need to follow to accomplish what we want in the first place,
which is integrating sayhello in our root file system:
Create a Git repository for each project with the corresponding files
Create a recipe for each project
Make sure that
sayhellorecipe DEPENDS onlibhelloMake sure that
sayhellorecipe RDEPENDS onlibhelloAdd
sayhelloto IMAGE_INSTALL to integrate it into the root file system
The contents of libhello/Makefile are:
LIB=libhello.so
all: $(LIB)
$(LIB): hellolib.o
$(CC) $< -Wl,-soname,$(LIB).1 -fPIC $(LDFLAGS) -shared -o $(LIB).1.0
%.o: %.c
$(CC) -c $<
clean:
rm -rf *.o *.so*
Note
When creating shared libraries, it is strongly recommended to follow the Linux conventions and guidelines (see this article for some background).
Note
When creating Makefile files, it is strongly recommended to use CC, LDFLAGS
and CFLAGS as BitBake will set them as environment variables according
to your build configuration.
The contents of libhello/hellolib.h are:
#ifndef HELLOLIB_H
#define HELLOLIB_H
void Hello();
#endif
The contents of libhello/hellolib.c are:
#include <stdio.h>
void Hello(){
puts("Hello from a Yocto demo \n");
}
The contents of sayhello/Makefile are:
EXEC=sayhello
LDFLAGS += -lhello
all: $(EXEC)
$(EXEC): sayhello.c
$(CC) $< $(LDFLAGS) $(CFLAGS) -o $(EXEC)
clean:
rm -rf $(EXEC) *.o
The contents of sayhello/sayhello.c are:
#include <hellolib.h>
int main(){
Hello();
return 0;
}
The contents of libhello_0.1.bb are:
SUMMARY = "Hello demo library"
DESCRIPTION = "Hello shared library used in Yocto demo"
# NOTE: Set the License according to the LICENSE file of your project
# and then add LIC_FILES_CHKSUM accordingly
LICENSE = "CLOSED"
# Assuming the branch is main
# Change <username> accordingly
SRC_URI = "git://github.com/<username>/libhello;branch=main;protocol=https"
do_install(){
install -d ${D}${includedir}
install -d ${D}${libdir}
install hellolib.h ${D}${includedir}
oe_soinstall ${PN}.so.${PV} ${D}${libdir}
}
The contents of sayhello_0.1.bb are:
SUMMARY = "SayHello demo"
DESCRIPTION = "SayHello project used in Yocto demo"
# NOTE: Set the License according to the LICENSE file of your project
# and then add LIC_FILES_CHKSUM accordingly
LICENSE = "CLOSED"
# Assuming the branch is main
# Change <username> accordingly
SRC_URI = "git://github.com/<username>/sayhello;branch=main;protocol=https"
DEPENDS += "libhello"
RDEPENDS:${PN} += "libhello"
do_install(){
install -d ${D}${bindir}
install -m 0700 sayhello ${D}${bindir}
}
After placing the recipes in a custom layer we can run bitbake sayhello
to build the recipe.
The following diagram shows the sequences of tasks that BitBake executes to accomplish that.
Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales as published by Creative Commons.
To report any inaccuracies or problems with this (or any other Yocto Project)
manual, or to send additions or changes, please send email/patches to the Yocto
Project documentation mailing list at docs@lists.yoctoproject.org or
log into the Libera Chat #yocto channel.
Yocto Project and OpenEmbedded Contributor Guide
The Yocto Project and OpenEmbedded are open-source, community-based projects so contributions are very welcome, it is how the code evolves and everyone can effect change. Contributions take different forms, if you have a fix for an issue you’ve run into, a patch is the most appropriate way to contribute it. If you run into an issue but don’t have a solution, opening a defect in Bugzilla or asking questions on the mailing lists might be more appropriate. This guide intends to point you in the right direction to this.
1 Identify the component
The Yocto Project and OpenEmbedded ecosystem is built of layers so the first step is to identify the component where the issue likely lies. For example, if you have a hardware issue, it is likely related to the BSP you are using and the best place to seek advice would be from the BSP provider or layer. If the issue is a build/configuration one and a distro is in use, they would likely be the first place to ask questions. If the issue is a generic one and/or in the core classes or metadata, the core layer or BitBake might be the appropriate component.
Each metadata layer being used should contain a README file and that should
explain where to report issues, where to send changes and how to contact the
maintainers.
If the issue is in the core metadata layer (OpenEmbedded-Core) or in BitBake, issues can be reported in the Yocto Project Bugzilla. The yocto mailing list is a general “catch-all” location where questions can be sent if you can’t work out where something should go.
2 Reporting a Defect Against the Yocto Project and OpenEmbedded
You can use the Yocto Project instance of Bugzilla to submit a defect (bug) against BitBake, OpenEmbedded-Core, against any other Yocto Project component or for tool issues. For additional information on this implementation of Bugzilla see the “Yocto Project Bugzilla” section in the Yocto Project Reference Manual. For more detail on any of the following steps, see the Yocto Project Bugzilla wiki page.
Use the following general steps to submit a bug:
Open the Yocto Project implementation of Bugzilla.
Click “File a Bug” to enter a new bug.
Choose the appropriate “Classification”, “Product”, and “Component” for which the bug was found. Bugs for the Yocto Project fall into one of several classifications, which in turn break down into several products and components. For example, for a bug against the
meta-intellayer, you would choose “Build System, Metadata & Runtime”, “BSPs”, and “bsps-meta-intel”, respectively.Choose the “Version” of the Yocto Project for which you found the bug (e.g. 5.3.3).
Determine and select the “Severity” of the bug. The severity indicates how the bug impacted your work.
Choose the “Hardware” that the bug impacts.
Choose the “Architecture” that the bug impacts.
Choose a “Documentation change” item for the bug. Fixing a bug might or might not affect the Yocto Project documentation. If you are unsure of the impact to the documentation, select “Don’t Know”.
Provide a brief “Summary” of the bug. Try to limit your summary to just a line or two and be sure to capture the essence of the bug.
Provide a detailed “Description” of the bug. You should provide as much detail as you can about the context, behavior, output, and so forth that surrounds the bug. You can even attach supporting files for output from logs by using the “Add an attachment” button.
Click the “Submit Bug” button submit the bug. A new Bugzilla number is assigned to the bug and the defect is logged in the bug tracking system.
Once you file a bug, the bug is processed by the Yocto Project Bug Triage Team and further details concerning the bug are assigned (e.g. priority and owner). You are the “Submitter” of the bug and any further categorization, progress, or comments on the bug result in Bugzilla sending you an automated email concerning the particular change or progress to the bug.
There are no guarantees about if or when a bug might be worked on since an open-source project has no dedicated engineering resources. However, the project does have a good track record of resolving common issues over the medium and long term. We do encourage people to file bugs so issues are at least known about. It helps other users when they find somebody having the same issue as they do, and an issue that is unknown is much less likely to ever be fixed!
3 Recipe Style Guide
3.1 Recipe Naming Conventions
In general, most recipes should follow the naming convention
recipes-category/recipename/recipename_version.bb. Recipes for related
projects may share the same recipe directory. recipename and category
may contain hyphens, but hyphens are not allowed in version.
If the recipe is tracking a Git revision that does not correspond to a released
version of the software, version may be git (e.g. recipename_git.bb)
and the recipe would set PV.
3.2 Version Policy
Our versions follow the form <epoch>:<version>-<revision>
or in BitBake variable terms ${PE}:${PV}-${PR}. We
generally follow the Debian
version policy which defines these terms.
In most cases the version PV will be set automatically from the recipe file name. It is recommended to use released versions of software as these are revisions that upstream are expecting people to use.
Recipe versions should always compare and sort correctly so that upgrades work
as expected. With conventional versions such as 1.4 upgrading to 1.5
this happens naturally, but some versions don’t sort. For example,
1.5 Release Candidate 2 could be written as 1.5rc2 but this sorts after
1.5, so upgrades from feeds won’t happen correctly.
Instead the tilde (~) operator can be used, which sorts before the empty
string so 1.5~rc2 comes before 1.5. There is a historical syntax which
may be found where PV is set as a combination of the prior version
+ the pre-release version, for example PV=1.4+1.5rc2. This is a valid
syntax but the tilde form is preferred.
For version comparisons, the opkg-compare-versions program from
opkg-utils can be useful when attempting to determine how two version
numbers compare to each other. Our definitive version comparison algorithm is
the one within bitbake which aims to match those of the package managers and
Debian policy closely.
When a recipe references a git revision that does not correspond to a released
version of software (e.g. is not a tagged version), the PV variable
should include the sign +, so bitbake automatically includes package
version information during the packaging phase:
PV = "<version>+git"
In this case, <version> should be the most recently released version of the
software from the current source revision (git describe can be useful for
determining this). Whilst not recommended for published layers, this format is
also useful when using AUTOREV to set the recipe to increment source
control revisions automatically, which can be useful during local development.
3.3 Version Number Changes
The PR variable is used to indicate different revisions of a recipe that reference the same upstream source version. It can be used to force a new version of a recipe to be installed onto a device from a package feed. These once had to be set manually but in most cases these can now be set and incremented automatically by a PR Server connected with a package feed.
When PV increases, any existing PR value can and should be removed.
If PV changes in such a way that it does not increase with respect to the previous value, you need to increase PE to ensure package managers will upgrade it correctly. If unset you should set PE to “1” since the default of empty is easily confused with “0” depending on the package manager. PE can only have an integer value.
3.4 Recipe formatting
3.4.1 Variable Formatting
Variable assignment should a space around each side of the operator, e.g.
FOO = "bar", notFOO="bar".Double quotes should be used on the right-hand side of the assignment, e.g.
FOO = "bar"notFOO = 'bar'Spaces should be used for indenting variables, with 4 spaces per tab
Long variables should be split over multiple lines when possible by using the continuation character (
\)When splitting a long variable over multiple lines, all continuation lines should be indented (with spaces) to align with the start of the quote on the first line:
FOO = "this line is \ long \ "
Instead of:
FOO = "this line is \ long \ "
3.4.2 Python Function formatting
Spaces must be used for indenting Python code, with 4 spaces per tab
3.4.3 Shell Function formatting
The formatting of shell functions should be consistent within layers. Some use tabs, some use spaces.
3.5 Recipe metadata
3.5.1 Required Variables
The following variables should be included in all recipes:
SUMMARY: a one line description of the upstream project
DESCRIPTION: an extended description of the upstream project, possibly with multiple lines. If no reasonable description can be written, this may be omitted as it defaults to SUMMARY.
HOMEPAGE: the URL to the upstream projects homepage.
BUGTRACKER: the URL upstream projects bug tracking website, if applicable.
3.5.2 Recipe Ordering
When a variable is defined in recipes and classes, variables should follow the general order when possible:
inherit ...Build class specific variables such as
EXTRA_QMAKEVARS_POSTand EXTRA_OECONFTasks such as do_configure
There are some cases where ordering is important and these cases would override this default order. Examples include:
PACKAGE_ARCH needing to be set before
inherit packagegroup
Tasks should be ordered based on the order they generally execute. For commonly used tasks this would be:
Custom tasks should be sorted similarly.
Package specific variables are typically grouped together, e.g.:
RDEPENDS:${PN} = “foo”
RDEPENDS:${PN}-libs = “bar”
RRECOMMENDS:${PN} = “one”
RRECOMMENDS:${PN}-libs = “two”
3.5.3 Recipe License Fields
Recipes need to define both the LICENSE and LIC_FILES_CHKSUM variables:
LICENSE: This variable specifies the license for the software. If you do not know the license under which the software you are building is distributed, you should go to the source code and look for that information. Typical files containing this information include
COPYING, LICENSE, andREADMEfiles. You could also find the information near the top of a source file. For example, given a piece of software licensed under the GNU General Public License version 2, you would set LICENSE as follows:LICENSE = "GPL-2.0-only"
The licenses you specify within LICENSE can have any name as long as you do not use spaces, since spaces are used as separators between license names. For standard licenses, use the names of the files in
meta/files/common-licenses/or the SPDXLICENSEMAP flag names defined inmeta/conf/licenses.conf.Note
Setting a LICENSE in a recipe applies to the software to be built by this recipe, not to the recipe file itself. The license of recipes, configuration files and scripts should also be clearly specified, for example via comments or via a license found in the layer that holds these files. These license files are usually found at the root of the layer. Exceptions should be clearly stated in the layer README or LICENSE file.
For example, the OpenEmbedded-Core (OE-Core) layer provides both the GPL-2.0-only and MIT license files, and a “LICENSE” file to explain how these two licenses are attributed to files found in the layer.
LIC_FILES_CHKSUM: The OpenEmbedded build system uses this variable to make sure the license text has not changed. If it has, the build produces an error and it affords you the chance to figure it out and correct the problem.
You need to specify all applicable licensing files for the software. At the end of the configuration step, the build process will compare the checksums of the files to be sure the text has not changed. Any differences result in an error with the message containing the current checksum. For more explanation and examples of how to set the LIC_FILES_CHKSUM variable, see the “Tracking License Changes” section.
To determine the correct checksum string, you can list the appropriate files in the LIC_FILES_CHKSUM variable with incorrect md5 strings, attempt to build the software, and then note the resulting error messages that will report the correct md5 strings. See the “Fetching Code” section for additional information.
Here is an example that assumes the software has a
COPYINGfile:LIC_FILES_CHKSUM = "file://COPYING;md5=xxx"
When you try to build the software, the build system will produce an error and give you the correct string that you can substitute into the recipe file for a subsequent build.
3.5.3.1 License Updates
When you change the LICENSE or LIC_FILES_CHKSUM in the recipe
you need to briefly explain the reason for the change via a License-Update:
tag. Often it’s quite trivial, such as:
License-Update: copyright years refreshed
Less often, the actual licensing terms themselves will have changed. If so, do try to link to upstream making/justifying that decision.
3.5.4 Tips and Guidelines for Writing Recipes
Use BBCLASSEXTEND instead of creating separate recipes such as
-nativeand-nativesdkones, whenever possible. This avoids having to maintain multiple recipe files at the same time.Recipes should have tasks which are idempotent, i.e. that executing a given task multiple times shouldn’t change the end result. The build environment is built upon this assumption and breaking it can cause obscure build failures.
For idempotence when modifying files in tasks, it is usually best to:
copy a file
XtoX.orig(only if it doesn’t exist already)then, copy
X.origback toX,and, finally, modify
X.
This ensures if rerun the task always has the same end result and the original file can be preserved to reuse. It also guards against an interrupted build corrupting the file.
3.6 Patch Upstream Status
In order to keep track of patches applied by recipes and ultimately reduce the number of patches that need maintaining, the OpenEmbedded build system requires information about the upstream status of each patch.
In its description, each patch should provide detailed information about the bug that it addresses, such as the URL in a bug tracking system and links to relevant mailing list archives.
Then, you should also add an Upstream-Status: tag containing one of the
following status strings:
PendingNo determination has been made yet, or patch has not yet been submitted to upstream.
Keep in mind that every patch submitted upstream reduces the maintainance burden in OpenEmbedded and Yocto Project in the long run, so this patch status should only be used in exceptional cases if there are genuine obstacles to submitting a patch upstream; the reason for that should be included in the patch.
Submitted [where]Submitted to upstream, waiting for approval. Optionally include where it was submitted, such as the author, mailing list, etc.
Backport [version]Accepted upstream and included in the next release, or backported from newer upstream version, because we are at a fixed version. Include upstream version info (e.g. commit ID or next expected version).
DeniedNot accepted by upstream, include reason in patch.
Inactive-Upstream [lastcommit: when (and/or) lastrelease: when]The upstream is no longer available. This typically means a defunct project where no activity has happened for a long time — measured in years. To make that judgement, it is recommended to look at not only when the last release happened, but also when the last commit happened, and whether newly made bug reports and merge requests since that time receive no reaction. It is also recommended to add to the patch description any relevant links where the inactivity can be clearly seen.
Inappropriate [reason]The patch is not appropriate for upstream, include a brief reason on the same line enclosed with
[]. In the past, there were several different reasons not to submit patches upstream, but we have to consider that every non-upstreamed patch means a maintainance burden for recipe maintainers. Currently, the only reasons to mark patches as inappropriate for upstream submission are:oe specific: the issue is specific to how OpenEmbedded performs builds or sets things up at runtime, and can be resolved only with a patch that is not however relevant or appropriate for general upstream submission.upstream ticket <link>: the issue is not specific to Open-Embedded and should be fixed upstream, but the patch in its current form is not suitable for merging upstream, and the author lacks sufficient expertise to develop a proper patch. Instead the issue is handled via a bug report (include link).
Of course, if another person later takes care of submitting this patch upstream,
the status should be changed to Submitted [where], and an additional
Signed-off-by: line should be added to the patch by the person claiming
responsibility for upstreaming.
3.6.1 Examples
Here’s an example of a patch that has been submitted upstream:
rpm: Adjusted the foo setting in bar
[RPM Ticket #65] -- http://rpm5.org/cvs/tktview?tn=65,5
The foo setting in bar was decreased from X to X-50% in order to
ensure we don't exhaust all system memory with foobar threads.
Upstream-Status: Submitted [rpm5-devel@rpm5.org]
Signed-off-by: Joe Developer <joe.developer@example.com>
A future update can change the value to Backport or Denied as
appropriate.
Another example of a patch that is specific to OpenEmbedded:
Do not treat warnings as errors
There are additional warnings found with musl which are
treated as errors and fails the build, we have more combinations
than upstream supports to handle.
Upstream-Status: Inappropriate [oe specific]
Here’s a patch that has been backported from an upstream commit:
include missing sys/file.h for LOCK_EX
Upstream-Status: Backport [https://github.com/systemd/systemd/commit/ac8db36cbc26694ee94beecc8dca208ec4b5fd45]
3.7 CVE patches
In order to have a better control of vulnerabilities, patches that fix CVEs must
contain a CVE: tag. This tag list all CVEs fixed by the patch. If more than
one CVE is fixed, separate them using spaces.
3.7.1 CVE Examples
This should be the header of patch that fixes CVE-2015-8370 in GRUB2:
grub2: Fix CVE-2015-8370
[No upstream tracking] -- https://bugzilla.redhat.com/show_bug.cgi?id=1286966
Back to 28; Grub2 Authentication
Two functions suffer from integer underflow fault; the grub_username_get() and grub_password_get()located in
grub-core/normal/auth.c and lib/crypto.c respectively. This can be exploited to obtain a Grub rescue shell.
Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/grub.git/commit/?id=451d80e52d851432e109771bb8febafca7a5f1f2]
CVE: CVE-2015-8370
Signed-off-by: Joe Developer <[email protected]>
3.8 Patch format
By default, patches created with git format-patch have a Git version signature at the end.
To avoid having a Git signature at the end of generated or updated patches,
you can use Git configuration settings:
git config --global format.signature ""
Note
Patches generated or updated by devtool are created with no signature.
4 Contributing Changes to a Component
Contributions to the Yocto Project and OpenEmbedded are very welcome. Because the system is extremely configurable and flexible, we recognize that developers will want to extend, configure or optimize it for their specific uses.
4.1 Contributing through mailing lists — Why not using web-based workflows?
Both Yocto Project and OpenEmbedded have many key components that are maintained by patches being submitted on mailing lists. We appreciate this approach does look a little old fashioned when other workflows are available through web technology such as GitHub, GitLab and others. Since we are often asked this question, we’ve decided to document the reasons for using mailing lists.
One significant factor is that we value peer review. When a change is proposed to many of the core pieces of the project, it helps to have many eyes of review go over them. Whilst there is ultimately one maintainer who needs to make the final call on accepting or rejecting a patch, the review is made by many eyes and the exact people reviewing it are likely unknown to the maintainer. It is often the surprise reviewer that catches the most interesting issues!
This is in contrast to the “GitHub” style workflow where either just a maintainer makes that review, or review is specifically requested from nominated people. We believe there is significant value added to the codebase by this peer review and that moving away from mailing lists would be to the detriment of our code.
We also need to acknowledge that many of our developers are used to this mailing list workflow and have worked with it for years, with tools and processes built around it. Changing away from this would result in a loss of key people from the project, which would again be to its detriment.
The projects are acutely aware that potential new contributors find the
mailing list approach off-putting and would prefer a web-based GUI.
Since we don’t believe that can work for us, the project is aiming to ensure
patchwork is available to help track
patch status and also looking at how tooling can provide more feedback to users
about patch status. We are looking at improving tools such as patchtest to
test user contributions before they hit the mailing lists and also at better
documenting how to use such workflows since we recognise that whilst this was
common knowledge a decade ago, it might not be as familiar now.
4.2 Preparing Changes for Submission
4.2.1 Set up Git
The first thing to do is to install Git packages. Here is an example on Debian and Ubuntu:
sudo apt install git-core git-email
Then, you need to set a name and e-mail address that Git will use to identify your commits:
git config --global user.name "Ada Lovelace"
git config --global user.email "[email protected]"
By default, Git adds a signature line at the end of patches containing the Git version. We suggest to remove it as it doesn’t add useful information.
Remove it with the following command:
git config --global format.signature ""
4.2.2 Clone the Git repository for the component to modify
After identifying the component to modify as described in the “Identify the component” section, clone the corresponding Git repository. Here is an example for OpenEmbedded-Core:
git clone https://git.openembedded.org/openembedded-core
cd openembedded-core
4.2.3 Create a new branch
Then, create a new branch in your local Git repository
for your changes, starting from the reference branch in the upstream
repository (often called master):
$ git checkout <ref-branch>
$ git checkout -b my-changes
If you have completely unrelated sets of changes to submit, you should even create one branch for each set.
4.2.4 Implement and commit changes
In each branch, you should group your changes into small, controlled and isolated ones. Keeping changes small and isolated aids review, makes merging/rebasing easier and keeps the change history clean should anyone need to refer to it in future.
To this purpose, you should create one Git commit per change, corresponding to each of the patches you will eventually submit. See further guidance in the Linux kernel documentation if needed.
For example, when you intend to add multiple new recipes, each recipe should be added in a separate commit. For upgrades to existing recipes, the previous version should usually be deleted as part of the same commit to add the upgraded version.
Stage Your Changes: Stage your changes by using the
git addcommand on each file you modified. If you want to stage all the files you modified, you can even use thegit add -Acommand.Commit Your Changes: This is when you can create separate commits. For each commit to create, use the
git commit -scommand with the files or directories you want to include in the commit:$ git commit -s file1 file2 dir1 dir2 ...
To include all staged files:
$ git commit -sa
The
-soption ofgit commitadds a “Signed-off-by:” line to your commit message. There is the same requirement for contributing to the Linux kernel. Adding such a line signifies that you, the submitter, have agreed to the Developer’s Certificate of Origin 1.1 as follows:Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.Provide a single-line summary of the change and, if more explanation is needed, provide more detail in the description of the commit. This summary is typically viewable in the “shortlist” of changes. Thus, providing something short and descriptive that gives the reader a summary of the change is useful when viewing a list of many commits. You should prefix this short description with the recipe name (if changing a recipe), or else with the short form path to the file being changed.
Note
To find a suitable prefix for the commit summary, a good idea is to look for prefixes used in previous commits touching the same files or directories:
git log --oneline <paths>
For the commit description, provide detailed information that describes what you changed, why you made the change, and the approach you used. It might also be helpful if you mention how you tested the change. Provide as much detail as you can in the commit description.
Note
If the single line summary is enough to describe a simple change, the commit description can be left empty.
If the change addresses a specific bug or issue that is associated with a bug-tracking ID, include a reference to that ID in the body of the commit message. For example, the Yocto Project uses a specific convention for bug references — any commit that addresses a specific bug should use the following form for the body of the commit message. Be sure to use the actual bug-tracking ID from Bugzilla for bug-id:
single-line summary of change Fixes [YOCTO #bug-id] detailed description of change
If other people participated in this patch, add some tags to the commit description to credit other contributors to the change:
Reported-by: name and email of a person reporting a bug that your commit is trying to fix. This is a good practice to encourage people to go on reporting bugs and let them know that their reports are taken into account.Suggested-by: name and email of a person to credit for the idea of making the change.Tested-by,Reviewed-by: name and email for people having tested your changes or reviewed their code. These fields are usually added by the maintainer accepting a patch, or by yourself if you submitted your patches to early reviewers, or are submitting an unmodified patch again as part of a new iteration of your patch series.Cc: name and email of people you want to send a copy of your changes to. This field will be used bygit send-email.
See more guidance about using such tags in the Linux kernel documentation.
Note
One can amend an existing git commit message to add missing tags for contributors with the
git commit --amendcommand.
4.2.5 Test your changes
For each contributions you make, you should test your changes as well. For this the Yocto Project offers several types of tests. Those tests cover different areas and it depends on your changes which are feasible. For example run:
For changes that affect the build environment:
bitbake-selftest: for changes within BitBake
oe-selftest: to test combinations of BitBake runs
oe-build-perf-test: to test the performance of common build scenariosFor changes in a recipe:
ptest: run package specific tests, if they exist
testimage: build an image, boot it and run testcases on itIf applicable, ensure also the
nativeandnativesdkvariants buildsFor changes relating to the SDK:
testsdk: to build, install and run tests against a SDK
testsdk_ext: to build, install and run tests against an extended SDK
Note that this list just gives suggestions and is not exhaustive. More details can be found here: Yocto Project Tests — Types of Testing Overview.
4.3 Creating Patches
Here is the general procedure on how to create patches to be sent through email:
Describe the Changes in your Branch: If you have more than one commit in your branch, it’s recommended to provide a cover letter describing the series of patches you are about to send.
For this purpose, a good solution is to store the cover letter contents in the branch itself:
git branch --edit-description
This will open a text editor to fill in the description for your changes. This description can be updated when necessary and will be used by Git to create the cover letter together with the patches.
It is recommended to start this description with a title line which will serve a the subject line for the cover letter.
Generate Patches for your Branch: The
git format-patchcommand will generate patch files for each of the commits in your branch. You need to pass the reference branch your branch starts from.If you branch didn’t need a description in the previous step:
$ git format-patch <ref-branch>
If you filled a description for your branch, you will want to generate a cover letter too:
$ git format-patch --cover-letter --cover-from-description=auto <ref-branch>
After the command is run, the current directory contains numbered
.patchfiles for the commits in your branch. If you have a cover letter, it will be in the0000-cover-letter.patch.Note
The
--cover-from-description=autooption makesgit format-patchuse the first paragraph of the branch description as the cover letter title. Another possibility, which is easier to remember, is to pass only the--cover-letteroption, but you will have to edit the subject line manually every time you generate the patches.See the git format-patch manual page for details.
Review each of the Patch Files: This final review of the patches before sending them often allows to view your changes from a different perspective and discover defects such as typos, spacing issues or lines or even files that you didn’t intend to modify. This review should include the cover letter patch too.
If necessary, rework your commits as described in “Taking Patch Review into Account”.
4.4 Validating Patches with Patchtest
patchtest is available in openembedded-core as a tool for making
sure that your patches are well-formatted and contain important info for
maintenance purposes, such as Signed-off-by and Upstream-Status
tags. Note that no functional testing of the changes will be performed by patchtest.
Currently, it only supports testing patches for openembedded-core branches.
To setup, perform the following:
pip install -r meta/lib/patchtest/requirements.txt
source oe-init-build-env
bitbake-layers add-layer ../meta-selftest
Once these steps are complete and you have generated your patch files,
you can run patchtest like so:
patchtest --patch <patch_name>
Alternatively, if you want patchtest to iterate over and test
multiple patches stored in a directory, you can use:
patchtest --directory <directory_name>
By default, patchtest uses its own modules’ file paths to determine what
repository and test suite to check patches against. If you wish to test
patches against a repository other than openembedded-core and/or use
a different set of tests, you can use the --repodir and --testdir
flags:
patchtest --patch <patch_name> --repodir <path/to/repo> --testdir <path/to/testdir>
Finally, note that patchtest is designed to test patches in a standalone
way, so if your patches are meant to apply on top of changes made by
previous patches in a series, it is possible that patchtest will report
false failures regarding the “merge on head” test.
Using patchtest in this manner provides a final check for the overall
quality of your changes before they are submitted for review by the
maintainers.
4.5 Sending the Patches via Email
4.5.1 Using Git to Send Patches
To submit patches through email, it is very important that you send them
without any whitespace or HTML formatting that either you or your mailer
introduces. The maintainer that receives your patches needs to be able
to save and apply them directly from your emails, using the git am
command.
Using the git send-email command is the only error-proof way of sending
your patches using email since there is no risk of compromising whitespace
in the body of the message, which can occur when you use your own mail
client. It will also properly include your patches as inline attachments,
which is not easy to do with standard e-mail clients without breaking lines.
If you used your regular e-mail client and shared your patches as regular
attachments, reviewers wouldn’t be able to quote specific sections of your
changes and make comments about them.
4.5.2 Setting up Git to Send Email
The git send-email command can send email by using a local or remote
Mail Transport Agent (MTA) such as msmtp, sendmail, or
through a direct SMTP configuration in your Git ~/.gitconfig file.
Here are the settings for letting git send-email send e-mail through your
regular STMP server, using a Google Mail account as an example:
git config --global sendemail.smtpserver smtp.gmail.com
git config --global sendemail.smtpserverport 587
git config --global sendemail.smtpencryption tls
git config --global sendemail.smtpuser ada.lovelace@gmail.com
git config --global sendemail.smtppass = XXXXXXXX
These settings will appear in the .gitconfig file in your home directory.
If you neither can use a local MTA nor SMTP, make sure you use an email client that does not touch the message (turning spaces in tabs, wrapping lines, etc.). A good mail client to do so is Pine (or Alpine) or Mutt. For more information about suitable clients, see Email clients info for Linux in the Linux kernel sources.
If you use such clients, just include the patch in the body of your email.
4.5.3 Finding a Suitable Mailing List
You should send patches to the appropriate mailing list so that they can be reviewed by the right contributors and merged by the appropriate maintainer. The specific mailing list you need to use depends on the location of the code you are changing.
If people have concerns with any of the patches, they will usually voice their concern over the mailing list. If patches do not receive any negative reviews, the maintainer of the affected layer typically takes them, tests them, and then based on successful testing, merges them.
In general, each component (e.g. layer) should have a README file
that indicates where to send the changes and which process to follow.
If you intend to submit a new recipe that neither fits in OpenEmbedded-Core (OE-Core), nor into meta-openembedded, you should look for a suitable layer in https://layers.openembedded.org. If similar recipes can be expected, you may consider Creating Your Own Layer.
If in doubt, please ask on the yocto general mailing list or on the openembedded-devel mailing list.
4.5.4 Subscribing to the Mailing List
After identifying the right mailing list to use, you will have to subscribe to it if you haven’t done it yet.
If you attempt to send patches to a list you haven’t subscribed to, your email will be returned as undelivered.
However, if you don’t want to be receive all the messages sent to a mailing list, you can set your subscription to “no email”. You will still be a subscriber able to send messages, but you won’t receive any e-mail. If people reply to your message, their e-mail clients will default to including your email address in the conversation anyway.
Anyway, you’ll also be able to access the new messages on mailing list archives, either through a web browser, or for the lists archived on https://lore.kernel.org, through an individual newsgroup feed or a git repository.
4.5.5 Sending Patches via Email
At this stage, you are ready to send your patches via email. Here’s the
typical usage of git send-email:
git send-email --to <mailing-list-address> *.patch
Then, review each subject line and list of recipients carefully, and then allow the command to send each message.
You will see that git send-email will automatically copy the people listed
in any commit tags such as Signed-off-by or Reported-by.
In case you are sending patches for meta-openembedded or any layer other than openembedded-core, please add the appropriate prefix so that it is clear which layer the patch is intended to be applied to:
git format-patch --subject-prefix="meta-oe][PATCH" ...
Note
It is actually possible to send patches without generating them
first. However, make sure you have reviewed your changes carefully
because git send-email will just show you the title lines of
each patch.
Here’s a command you can use if you just have one patch in your branch:
git send-email --to <mailing-list-address> -1
If you have multiple patches and a cover letter, you can send patches for all the commits between the reference branch and the tip of your branch:
git send-email --cover-letter --cover-from-description=auto --to <mailing-list-address> -M <ref-branch>
See the git send-email manual page for details.
4.5.6 Troubleshooting Email Issues
4.5.6.1 Fixing your From identity
We have a frequent issue with contributors whose patches are received through
a From field which doesn’t match the Signed-off-by information. Here is
a typical example for people sending from a domain name with https://en.wikipedia.org/wiki/DMARC:
From: "Linus Torvalds via lists.openembedded.org <[email protected]>"
This From field is used by git am to recreate commits with the right
author name. The following will ensure that your e-mails have an additional
From field at the beginning of the Email body, and therefore that
maintainers accepting your patches don’t have to fix commit author information
manually:
git config --global sendemail.from "[email protected]"
The sendemail.from should match your user.email setting,
which appears in the Signed-off-by line of your commits.
4.5.7 Streamlining git send-email usage
If you want to save time and not be forced to remember the right options to use
with git send-email, you can use Git configuration settings.
To set the right mailing list address for a given repository:
git config --local sendemail.to openembedded-devel@lists.openembedded.org
If the mailing list requires a subject prefix for the layer (this only works when the repository only contains one layer):
git config --local format.subjectprefix "meta-something][PATCH"
4.6 Using Scripts to Push a Change Upstream and Request a Pull
For larger patch series it is preferable to send a pull request which not
only includes the patch but also a pointer to a branch that can be pulled
from. This involves making a local branch for your changes, pushing this
branch to an accessible repository and then using the create-pull-request
and send-pull-request scripts from openembedded-core to create and send a
patch series with a link to the branch for review.
Follow this procedure to push a change to an upstream “contrib” Git repository once the steps in “Preparing Changes for Submission” have been followed:
Note
You can find general Git information on how to push a change upstream in the Git Community Book.
Request Push Access to an “Upstream” Contrib Repository: Send an email to
helpdesk@yoctoproject.org:Attach your SSH public key which usually named
id_rsa.pub.. If you don’t have one generate it by runningssh-keygen -t rsa -b 4096 -C "your_email@example.com".List the repositories you’re planning to contribute to.
Include your preferred branch prefix for
-contribrepositories.
Push Your Commits to the “Contrib” Upstream: Push your changes to that repository:
$ git push upstream_remote_repo local_branch_name
For example, suppose you have permissions to push into the upstream
meta-intel-contribrepository and you are working in a local branch named your_name/README. The following command pushes your local commits to themeta-intel-contribupstream repository and puts the commit in a branch named your_name/README:$ git push meta-intel-contrib your_name/README
Determine Who to Notify: Determine the maintainer or the mailing list that you need to notify for the change.
Before submitting any change, you need to be sure who the maintainer is or what mailing list that you need to notify. Use either these methods to find out:
Maintenance File: Examine the
maintainers.incfile, which is located in OpenEmbedded-Core (OE-Core) atmeta/conf/distro/include, to see who is responsible for code.Search by File: Using Git, you can enter the following command to bring up a short list of all commits against a specific file:
git shortlog -- filename
Just provide the name of the file for which you are interested. The information returned is not ordered by history but does include a list of everyone who has committed grouped by name. From the list, you can see who is responsible for the bulk of the changes against the file.
Find the Mailing List to Use: See the “Finding a Suitable Mailing List” section above.
Make a Pull Request: Notify the maintainer or the mailing list that you have pushed a change by making a pull request.
The Yocto Project provides two scripts that conveniently let you generate and send pull requests to the Yocto Project. These scripts are
create-pull-requestandsend-pull-request. You can find these scripts in thescriptsdirectory within OpenEmbedded-Core (OE-Core).Using these scripts correctly formats the requests without introducing any whitespace or HTML formatting. The maintainer that receives your patches either directly or through the mailing list needs to be able to save and apply them directly from your emails. Using these scripts is the preferred method for sending patches.
First, create the pull request. For example, the following command runs the script, specifies the upstream repository in the contrib directory into which you pushed the change, and provides a subject line in the created patch files:
$ ./scripts/create-pull-request -u meta-intel-contrib -s "Updated Manual Section Reference in README"
Running this script forms
*.patchfiles in a folder namedpull-PID in the current directory. One of the patch files is a cover letter.Before running the
send-pull-requestscript, you must edit the cover letter patch to insert information about your change. After editing the cover letter, send the pull request. For example, the following command runs the script and specifies the patch directory and email address. In this example, the email address is a mailing list:$ ./scripts/send-pull-request -p ~/meta-intel/pull-10565 -t [email protected]
You need to follow the prompts as the script is interactive.
Note
For help on using these scripts, simply provide the
-hargument as follows:$ ./scripts/create-pull-request -h $ ./scripts/send-pull-request -h
4.7 Submitting Changes to Stable Release Branches
The process for proposing changes to a Yocto Project stable branch differs from the steps described above. Changes to a stable branch must address identified bugs or CVEs and should be made carefully in order to avoid the risk of introducing new bugs or breaking backwards compatibility. Typically bug fixes must already be accepted into the master branch before they can be backported to a stable branch unless the bug in question does not affect the master branch or the fix on the master branch is unsuitable for backporting.
The list of stable branches along with the status and maintainer for each branch can be obtained from the Releases page.
Note
Changes will not typically be accepted for branches which are marked as End-Of-Life (EOL).
With this in mind, the steps to submit a change for a stable branch are as follows:
Identify the bug or CVE to be fixed: This information should be collected so that it can be included in your submission.
See Checking for Vulnerabilities for details about CVE tracking.
Check if the fix is already present in the master branch: This will result in the most straightforward path into the stable branch for the fix.
If the fix is present in the master branch — submit a backport request by email: You should send an email to the relevant stable branch maintainer and the mailing list with details of the bug or CVE to be fixed, the commit hash on the master branch that fixes the issue and the stable branches which you would like this fix to be backported to.
If the fix is not present in the master branch — submit the fix to the master branch first: This will ensure that the fix passes through the project’s usual patch review and test processes before being accepted. It will also ensure that bugs are not left unresolved in the master branch itself. Once the fix is accepted in the master branch a backport request can be submitted as above.
If the fix is unsuitable for the master branch — submit a patch directly for the stable branch: This method should be considered as a last resort. It is typically necessary when the master branch is using a newer version of the software which includes an upstream fix for the issue or when the issue has been fixed on the master branch in a way that introduces backwards incompatible changes. In this case follow the steps in “Preparing Changes for Submission” and in the following sections but modify the subject header of your patch email to include the name of the stable branch which you are targetting. This can be done using the
--subject-prefixargument togit format-patch, for example to submit a patch to the “walnascar” branch use:git format-patch --subject-prefix='walnascar][PATCH' ...
4.8 Taking Patch Review into Account
You may get feedback on your submitted patches from other community members or from the automated patchtest service. If issues are identified in your patches then it is usually necessary to address these before the patches are accepted into the project. In this case you should revise your commits according to the feedback and submit an updated version to the relevant mailing list.
In any case, never fix reported issues by fixing them in new commits on the tip of your branch. Always come up with a new series of commits without the reported issues.
Note
It is a good idea to send a copy to the reviewers who provided feedback
to the previous version of the patch. You can make sure this happens
by adding a CC tag to the commit description:
CC: William Shakespeare <bill@yoctoproject.org>
A single patch can be amended using git commit --amend, and multiple
patches can be easily reworked and reordered through an interactive Git rebase:
git rebase -i <ref-branch>
See this tutorial for practical guidance about using Git interactive rebasing.
You should also modify the [PATCH] tag in the email subject line when
sending the revised patch to mark the new iteration as [PATCH v2],
[PATCH v3], etc as appropriate. This can be done by passing the -v
argument to git format-patch with a version number:
git format-patch -v2 <ref-branch>
After generating updated patches (v2, v3, and so on) via git
format-patch, ideally developers will add a patch version changelog
to each patch that describes what has changed between each revision of
the patch. Add patch version changelogs after the --- marker in the
patch, indicating that this information is part of this patch, but is not
suitable for inclusion in the commit message (i.e. the git history) itself.
Providing a patch version changelog makes it easier for maintainers and
reviewers to succinctly understand what changed in all versions of the
patch, without having to consult alternate sources of information, such as
searching through messages on a mailing list. For example:
<patch title>
<commit message>
<Signed-off-by/other trailers>
---
changes in v4:
- provide a clearer commit message
- fix spelling mistakes
changes in v3:
- replace func() to use other_func() instead
changes in v2:
- this patch was added in v2
---
<diffstat output>
<unified diff>
Lastly please ensure that you also test your revised changes. In particular
please don’t just edit the patch file written out by git format-patch and
resend it.
4.9 Tracking the Status of Patches
The Yocto Project uses a Patchwork instance
to track the status of patches submitted to the various mailing lists and to
support automated patch testing. Each submitted patch is checked for common
mistakes and deviations from the expected patch format and submitters are
notified by patchtest if such mistakes are found. This process helps to
reduce the burden of patch review on maintainers.
Note
This system is imperfect and changes can sometimes get lost in the flow. Asking about the status of a patch or change is reasonable if the change has been idle for a while with no feedback.
If your patches have not had any feedback in a few days, they may have already
been merged. You can run git pull branch to check this. Note that many if
not most layer maintainers do not send out acknowledgement emails when they
accept patches. Alternatively, if there is no response or merge after a few days
the patch may have been missed or the appropriate reviewers may not currently be
around. It is then perfectly fine to reply to it yourself with a reminder asking
for feedback.
Note
Patch reviews for feature and recipe upgrade patches are likely be delayed during a feature freeze because these types of patches aren’t merged during at that time — you may have to wait until after the freeze is lifted.
Maintainers also commonly use -next branches to test submissions prior to
merging patches. Thus, you can get an idea of the status of a patch based on
whether the patch has been merged into one of these branches. The commonly
used testing branches for OpenEmbedded-Core are as follows:
openembedded-core “master-next” branch: This branch is part of the openembedded-core repository and contains proposed changes to the core metadata.
bitbake “master-next” branch: This branch is part of the bitbake repository and contains changes to BitBake.
meta-yocto “master-next” branch: This branch is part of the meta-yocto repository and contains proposed changes to meta-yocto.
Similarly, stable branches maintained by the project may have corresponding
-next branches which collect proposed changes. For example,
whinlatter-next and walnascar-next
branches in both the “openembedded-core” and “meta-yocto” repositories.
Other layers may have similar testing branches but there is no formal requirement or standard for these so please check the documentation for the layers you are contributing to.
4.10 Acceptance of AI Generated Code
The Yocto Project and OpenEmbedded follow the guidance of the Linux Foundation in regards to the use of generative AI tools. See: https://www.linuxfoundation.org/legal/generative-ai.
All of the existing guidelines in this document are expected to be followed, including in the Recipe Style Guide, and contributing the changes with additional requirements to the items in section Implement and commit changes.
All AI Generated Code must be labeled as such in the commit message,
prior to your Signed-off-by line. It is also strongly recommended,
that any patches or code within the commit also have a comment or other
indication that this code was AI generated.
For example, here is a properly formatted commit message:
component: Add the ability to ...
AI-Generated: Uses GitHub Copilot
Signed-off-by: Your Name <your.name@domain>
The Signed-off-by line must be written by you, and not the AI helper.
As a reminder, when contributing a change, your Signed-off-by line is
required and the stipulations in the Developer’s Statement of Origin
1.1 still apply.
Additionally, you must stipulate AI contributions conform to the Linux Foundation policy, specifically:
Contributors should ensure that the terms and conditions of the generative AI tool do not place any contractual restrictions on how the tool’s output can be used that are inconsistent with the project’s open source software license, the project’s intellectual property policies, or the Open Source Definition.
If any pre-existing copyrighted materials (including pre-existing open source code) authored or owned by third parties are included in the AI tool’s output, prior to contributing such output to the project, the Contributor should confirm that they have permission from the third party owners – such as the form of an open source license or public domain declaration that complies with the project’s licensing policies – to use and modify such pre-existing materials and contribute them to the project. Additionally, the contributor should provide notice and attribution of such third party rights, along with information about the applicable license terms, with their contribution.
Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales as published by Creative Commons.
To report any inaccuracies or problems with this (or any other Yocto Project)
manual, or to send additions or changes, please send email/patches to the Yocto
Project documentation mailing list at docs@lists.yoctoproject.org or
log into the Libera Chat #yocto channel.
Yocto Project Reference Manual
1 System Requirements
Welcome to the Yocto Project Reference Manual. This manual provides reference information for the current release of the Yocto Project, and is most effectively used after you have an understanding of the basics of the Yocto Project. The manual is neither meant to be read as a starting point to the Yocto Project, nor read from start to finish. Rather, use this manual to find variable definitions, class descriptions, and so forth as needed during the course of using the Yocto Project.
For introductory information on the Yocto Project, see the Yocto Project Website and the “The Yocto Project Development Environment” chapter in the Yocto Project Overview and Concepts Manual.
If you want to use the Yocto Project to quickly build an image without having to understand concepts, work through the Yocto Project Quick Build document. You can find “how-to” information in the Yocto Project Development Tasks Manual. You can find Yocto Project overview and conceptual information in the Yocto Project Overview and Concepts Manual.
Note
For more information about the Yocto Project Documentation set, see the Links and Related Documentation section.
1.1 Minimum Free Disk Space
To build an image such as core-image-sato for the qemux86-64 machine,
you need a system with at least 140 Gbytes of free disk space.
However, much more disk space will be necessary to build more complex images,
to run multiple builds and to cache build artifacts, improving build efficiency.
If you have a shortage of disk space, see the “Conserving Disk Space” section of the Development Tasks Manual.
1.2 Minimum System RAM
You will manage to build an image such as core-image-sato for the
qemux86-64 machine with as little as 32 Gbytes of RAM on an old
system with 4 CPU cores, but your builds will be much faster on a system with
as much RAM and as many CPU cores as possible.
1.3 Supported Linux Distributions
Currently, the 5.3.3 release (“Whinlatter”) of the Yocto Project is supported on the following distributions:
AlmaLinux 8
AlmaLinux 9
CentOS Stream 9
Debian GNU/Linux 11 (Bullseye)
Debian GNU/Linux 12 (Bookworm)
Debian GNU/Linux 13 (Trixie)
Fedora 39
Fedora 40
Fedora 41
Fedora 42
OpenSUSE Leap 15.5
OpenSUSE Leap 15.6
Rocky Linux 8
Rocky Linux 9
Ubuntu 22.04 (LTS)
Ubuntu 24.04 (LTS)
Ubuntu 25.04
Ubuntu 25.10
The following distribution versions are still tested, even though the organizations publishing them no longer make updates publicly available:
Fedora 39
Fedora 40
OpenSUSE Leap 15.5
Note that the Yocto Project doesn’t have access to private updates that some of these versions may have. Therefore, our testing has limited value if you have access to such updates. Also, buildtools may have to be used on older releases in order to get current enough tools, such as Python.
Finally, here are the distribution versions which were previously tested on former revisions of “Whinlatter”, but no longer are:
This list is currently empty
Note
While the Yocto Project Team attempts to ensure all Yocto Project releases are one hundred percent compatible with each officially supported Linux distribution, you may still encounter problems that happen only with a specific distribution.
Yocto Project releases are tested against the stable Linux distributions in the above list. The Yocto Project should work on other distributions but validation is not performed against them.
In particular, the Yocto Project does not support and currently has no plans to support rolling-releases or development distributions due to their constantly changing nature. We welcome patches and bug reports, but keep in mind that our priority is on the supported platforms listed above.
If your Linux distribution is not in the above list, we recommend to get the buildtools or buildtools-extended tarballs containing the host tools required by your Yocto Project release, typically by running
scripts/install-buildtoolsas explained in the “Required Git, tar, Python, make and gcc Versions” section.You may use Windows Subsystem For Linux v2 to set up a build host using Windows 10 or later, or Windows Server 2019 or later, but validation is not performed against build hosts using WSL 2.
See the Setting Up to Use Windows Subsystem For Linux (WSL 2) section in the Yocto Project Development Tasks Manual for more information.
If you encounter problems, please go to Yocto Project Bugzilla and submit a bug. We are interested in hearing about your experience. For information on how to submit a bug, see the Yocto Project Bugzilla wiki page and the “Reporting a Defect Against the Yocto Project and OpenEmbedded” section in the Yocto Project and OpenEmbedded Contributor Guide.
1.4 Required Packages for the Build Host
The list of packages you need on the host development system can be large when covering all build scenarios using the Yocto Project. This section describes required packages according to Linux distribution and function.
1.4.1 Ubuntu and Debian
Here are the packages needed to build an image on a headless system with a supported Ubuntu or Debian Linux distribution:
sudo apt-get install build-essential chrpath cpio debianutils diffstat file gawk gcc git iputils-ping libacl1 locales python3 python3-git python3-jinja2 python3-pexpect python3-pip python3-subunit socat texinfo unzip wget xz-utils zstd
You also need to ensure you have the en_US.UTF-8 locale enabled:
$ locale --all-locales | grep en_US.utf8
If this is not the case, you can reconfigure the locales package to add it
(requires an interactive shell):
$ sudo dpkg-reconfigure locales
Note
If you are not in an interactive shell,
dpkg-reconfigurewill not work as expected. To add the locale you will need to edit/etc/locale.genfile to add/uncomment theen_US.UTF-8locale. A naive way to do this as root is:$ echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen $ locale-gen
If your build system has the
oss4-devpackage installed, you might experience QEMU build failures due to the package installing its own custom/usr/include/linux/soundcard.hon the Debian system. If you run into this situation, try either of these solutions:$ sudo apt build-dep qemu $ sudo apt remove oss4-dev
Here are the packages needed to build Project documentation manuals:
sudo apt install git librsvg2-bin locales make python3-saneyaml python3-sphinx-rtd-theme python3-sphinx-copybutton sphinx
In addition to the previous packages, here are the packages needed to build the documentation in PDF format:
sudo apt install fonts-freefont-otf latexmk tex-gyre texlive-fonts-extra texlive-fonts-recommended texlive-lang-all texlive-latex-extra texlive-latex-recommended texlive-xetex
1.4.2 Fedora Packages
Here are the packages needed to build an image on a headless system with a supported Fedora Linux distribution:
sudo dnf install bzip2 ccache chrpath cpio cpp diffstat diffutils file findutils gawk gcc gcc-c++ git glibc-devel glibc-langpack-en gzip hostname libacl make patch perl perl-Data-Dumper perl-File-Compare perl-File-Copy perl-FindBin perl-Text-ParseWords perl-Thread-Queue perl-bignum perl-locale python python3 python3-GitPython python3-jinja2 python3-pexpect python3-pip rpcgen socat tar texinfo unzip wget which xz zstd $([ $(rpm -E %fedora) -ge 42 ] && echo "util-linux-script")
Here are the packages needed to build Project documentation manuals:
sudo dnf install git glibc-locale-source librsvg2-tools make python3-pip which
sudo pip3 install sphinx sphinx_rtd_theme pyyaml sphinx-copybutton
In addition to the previous packages, here are the packages needed to build the documentation in PDF format:
sudo dnf install 'texlive-collection-lang*' latexmk texlive-collection-fontsextra texlive-collection-fontsrecommended texlive-collection-latex texlive-collection-latexextra texlive-collection-latexrecommended texlive-collection-xetex texlive-fncychap texlive-gnu-freefont texlive-tex-gyre texlive-xetex
1.4.3 openSUSE Packages
Here are the packages needed to build an image on a headless system with a supported openSUSE distribution:
sudo zypper install bzip2 chrpath diffstat gcc gcc-c++ git gzip hostname libacl1 make makeinfo patch python python-curses python-xml python3 python3-Jinja2 python3-curses python3-pexpect python3-pip rpcgen socat tar wget which xz zstd
sudo pip3 install GitPython
Here are the packages needed to build Project documentation manuals:
sudo zypper install git glibc-i18ndata make python3-pip rsvg-convert which
sudo pip3 install sphinx sphinx_rtd_theme pyyaml sphinx-copybutton
In addition to the previous packages, here are the packages needed to build the documentation in PDF format:
sudo zypper install 'texlive-collection-lang*' texlive-collection-fontsextra texlive-collection-fontsrecommended texlive-collection-latex texlive-collection-latexextra texlive-collection-latexrecommended texlive-collection-xetex texlive-fncychap texlive-gnu-freefont texlive-latexmk texlive-tex-gyre texlive-xetex
1.4.4 AlmaLinux Packages
Here are the packages needed to build an image on a headless system with a supported AlmaLinux distribution:
sudo dnf install -y epel-release
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --set-enabled crb || sudo dnf config-manager --set-enabled powertools
sudo dnf makecache
sudo dnf install -y bzip2 ccache chrpath cpio cpp diffstat diffutils gawk gcc gcc-c++ git glibc-devel glibc-langpack-en gzip libacl make patch perl perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3 python3-GitPython python3-jinja2 python3-pexpect python3-pip rpcgen socat tar texinfo unzip wget which xz zstd
Note
Extra Packages for Enterprise Linux (i.e.
epel-release) is a collection of packages from Fedora built on RHEL/CentOS for easy installation of packages not included in enterprise Linux by default. You need to install these packages separately.The
PowerTools/CRBrepo provides additional packages such asrpcgenandtexinfo.The
makecachecommand consumes additional Metadata fromepel-release.
Here are the packages needed to build Project documentation manuals:
sudo dnf install -y git glibc-locale-source librsvg2-tools make python3-pip which
sudo pip3 install sphinx sphinx_rtd_theme pyyaml sphinx-copybutton
In addition to the previous packages, the following TeX Live packages are needed to build the documentation in PDF format and can be installed with the TeX Live package manager:
sudo dnf install -y wget perl
textooldir=${TEXTOOLDIR:-"./docs-build-tex-tools"}
mkdir -p "$textooldir"/tl
wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -O "$textooldir"/install-tl-unx.tar.gz
tar xzf "$textooldir"/install-tl-unx.tar.gz -C "$textooldir"
"$textooldir"/install-tl-*/install-tl --scheme=small --texdir="${textooldir}"/tl --no-interaction
PATH="$PATH:${textooldir}/tl/bin/x86_64-linux" tlmgr install titlesec varwidth tabulary needspace upquote framed capt-of wrapfig fncychap gnu-freefont ctex latexmk nimbus15
rm -r "$textooldir"/install-tl*
Warning
The Tex Live installation above is only valid for x86_64 hosts.
Before building the documentation PDF, setup the PATH to use the installed
packages (with ${textooldir} pointing to the TeX Live installation from the
previous step):
$ export PATH="${PATH}:${textooldir}/tl/bin/x86_64-linux"
1.4.5 CentOS Stream Packages
Here are the packages needed to build an image on a headless system with a supported CentOS Stream distribution:
sudo dnf install -y epel-release
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --set-enabled crb || sudo dnf config-manager --set-enabled powertools
sudo dnf makecache
sudo dnf install -y bzip2 ccache chrpath cpio cpp diffstat diffutils gawk gcc gcc-c++ git glibc-devel glibc-langpack-en gzip libacl make patch perl perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3 python3-GitPython python3-jinja2 python3-pexpect python3-pip rpcgen socat tar texinfo unzip wget which xz zstd
Here are the packages needed to build Project documentation manuals:
sudo dnf install -y git glibc-locale-source librsvg2-tools make python3-pip which
sudo pip3 install sphinx sphinx_rtd_theme pyyaml sphinx-copybutton
In addition to the previous packages, the following TeX Live packages are needed to build the documentation in PDF format and can be installed with the TeX Live package manager:
sudo dnf install -y wget perl
textooldir=${TEXTOOLDIR:-"./docs-build-tex-tools"}
mkdir -p "$textooldir"/tl
wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -O "$textooldir"/install-tl-unx.tar.gz
tar xzf "$textooldir"/install-tl-unx.tar.gz -C "$textooldir"
"$textooldir"/install-tl-*/install-tl --scheme=small --texdir="${textooldir}"/tl --no-interaction
PATH="$PATH:${textooldir}/tl/bin/x86_64-linux" tlmgr install titlesec varwidth tabulary needspace upquote framed capt-of wrapfig fncychap gnu-freefont ctex latexmk nimbus15
rm -r "$textooldir"/install-tl*
Warning
The Tex Live installation above is only valid for x86_64 hosts.
Before building the documentation PDF, setup the PATH to use the installed
packages (with ${textooldir} pointing to the TeX Live installation from the
previous step):
$ export PATH="${PATH}:${textooldir}/tl/bin/x86_64-linux"
1.4.6 RockyLinux Packages
Here are the packages needed to build an image on a headless system with a supported RockyLinux distribution:
sudo dnf install -y epel-release
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --set-enabled crb || sudo dnf config-manager --set-enabled powertools
sudo dnf makecache
sudo dnf install -y bzip2 ccache chrpath cpio cpp diffstat diffutils gawk gcc gcc-c++ git glibc-devel glibc-langpack-en gzip libacl make patch perl perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3 python3-GitPython python3-jinja2 python3-pexpect python3-pip rpcgen socat tar texinfo unzip wget which xz zstd
Note
Extra Packages for Enterprise Linux (i.e.
epel-release) is a collection of packages from Fedora built on RHEL/CentOS for easy installation of packages not included in enterprise Linux by default. You need to install these packages separately.The
PowerTools/CRBrepo provides additional packages such asrpcgenandtexinfo.The
makecachecommand consumes additional Metadata fromepel-release.
Here are the packages needed to build Project documentation manuals:
sudo dnf install -y git glibc-locale-source librsvg2-tools make python3-pip which
sudo pip3 install sphinx sphinx_rtd_theme pyyaml sphinx-copybutton
In addition to the previous packages, the following TeX Live packages are needed to build the documentation in PDF format and can be installed with the TeX Live package manager:
sudo dnf install -y wget perl
textooldir=${TEXTOOLDIR:-"./docs-build-tex-tools"}
mkdir -p "$textooldir"/tl
wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -O "$textooldir"/install-tl-unx.tar.gz
tar xzf "$textooldir"/install-tl-unx.tar.gz -C "$textooldir"
"$textooldir"/install-tl-*/install-tl --scheme=small --texdir="${textooldir}"/tl --no-interaction
PATH="$PATH:${textooldir}/tl/bin/x86_64-linux" tlmgr install titlesec varwidth tabulary needspace upquote framed capt-of wrapfig fncychap gnu-freefont ctex latexmk nimbus15
rm -r "$textooldir"/install-tl*
Warning
The Tex Live installation above is only valid for x86_64 hosts.
Before building the documentation PDF, setup the PATH to use the installed
packages (with ${textooldir} pointing to the TeX Live installation from the
previous step):
$ export PATH="${PATH}:${textooldir}/tl/bin/x86_64-linux"
1.5 Required Git, tar, Python, make and gcc Versions
In order to use the build system, your host development system must meet the following version requirements for Git, tar, and Python:
Git 1.8.3.1 or greater
tar 1.28 or greater
Python 3.9.0 or greater
GNU make 4.0 or greater
If your host development system does not meet all these requirements, you can resolve this by installing a buildtools tarball that contains these tools. You can either download a pre-built tarball or use BitBake to build one.
In addition, your host development system must meet the following version requirement for gcc:
gcc 10.1 or greater
If your host development system does not meet this requirement, you can
resolve this by installing a buildtools-extended tarball that
contains additional tools, the equivalent of the Debian/Ubuntu build-essential
package.
For systems with a broken make version (e.g. make 4.2.1 without patches) but where the rest of the host tools are usable, you can use the buildtools-make tarball instead.
In the sections that follow, three different methods will be described for installing the buildtools, buildtools-extended or buildtools-make toolset.
1.5.1 Installing a Pre-Built buildtools Tarball with install-buildtools script
The install-buildtools script is the easiest of the three methods by
which you can get these tools. It downloads a pre-built buildtools
installer and automatically installs the tools for you:
Execute the
install-buildtoolsscript. Here is an example:$ cd /path/to/bitbake-builds $ ./layers/openembedded-core/scripts/install-buildtools \ --without-extended-buildtools \ --base-url https://downloads.yoctoproject.org/releases/yocto \ --release yocto-5.3.3 \ --installer-version 5.3.3
During execution, the buildtools tarball will be downloaded, the checksum of the download will be verified, the installer will be run for you, and some basic checks will be run to make sure the installation is functional.
To avoid the need of
sudoprivileges, theinstall-buildtoolsscript will by default tell the installer to install in:/path/to/bitbake-builds/buildtools
If your host development system needs the additional tools provided in the buildtools-extended tarball, you can instead execute the
install-buildtoolsscript with the default parameters:$ cd /path/to/bitbake-builds $ ./layers/openembedded-core/scripts/install-buildtools
Alternatively if your host development system has a broken
makeversion such that you only need a known good version ofmake, you can use the--make-onlyoption:$ cd /path/to/bitbake-builds $ ./layers/openembedded-core/scripts/install-buildtools --make-only
Source the tools environment setup script by using a command like the following:
$ source /path/to/bitbake-builds/buildtools/environment-setup-x86_64-pokysdk-linux
After you have sourced the setup script, the tools are added to
PATHand any other environment variables required to run the tools are initialized. The results are working versions versions of Git, tar, Python andchrpath. And in the case of the buildtools-extended tarball, additional working versions of tools includinggcc,makeand the other tools included inpackagegroup-core-buildessential.
1.5.2 Downloading a Pre-Built buildtools Tarball
If you would prefer not to use the install-buildtools script, you can instead
download and run a pre-built buildtools installer yourself with the following
steps:
Go to https://downloads.yoctoproject.org/releases/yocto/yocto-5.3.3/buildtools/, locate and download the
.shfile corresponding to your host architecture and to buildtools, buildtools-extended or buildtools-make.Execute the installation script. Here is an example for the traditional installer:
$ sh ~/Downloads/x86_64-buildtools-nativesdk-standalone-5.3.3.sh
Here is an example for the extended installer:
$ sh ~/Downloads/x86_64-buildtools-extended-nativesdk-standalone-5.3.3.sh
An example for the make-only installer:
$ sh ~/Downloads/x86_64-buildtools-make-nativesdk-standalone-5.3.3.sh
During execution, a prompt appears that allows you to choose the installation directory. For example, you could choose the following:
/home/your-username/buildtoolsAs instructed by the installer script, you will have to source the tools environment setup script:
$ source /home/your_username/buildtools/environment-setup-x86_64-pokysdk-linux
After you have sourced the setup script, the tools are added to
PATHand any other environment variables required to run the tools are initialized. The results are working versions versions of Git, tar, Python andchrpath. And in the case of the buildtools-extended tarball, additional working versions of tools includinggcc,makeand the other tools included inpackagegroup-core-buildessential.
1.5.3 Building Your Own buildtools Tarball
Building and running your own buildtools installer applies only when you
have a build host that can already run BitBake. In this case, you use
that machine to build the .sh file and then take steps to transfer
and run it on a machine that does not meet the minimal Git, tar, and
Python (or gcc) requirements.
Here are the steps to take to build and run your own buildtools installer:
On the machine that is able to run BitBake, be sure you have set up your build environment with the setup script (oe-init-build-env).
Run the BitBake command to build the tarball:
$ bitbake buildtools-tarball
or to build the extended tarball:
$ bitbake buildtools-extended-tarball
or to build the make-only tarball:
$ bitbake buildtools-make-tarball
Note
The SDKMACHINE variable in your
local.conffile determines whether you build tools for a 32-bit or 64-bit system.Once the build completes, you can find the
.shfile that installs the tools in thetmp/deploy/sdksubdirectory of the Build Directory. The installer file has the string “buildtools” or “buildtools-extended” in the name.Transfer the
.shfile from the build host to the machine that does not meet the Git, tar, or Python (or gcc) requirements.On this machine, run the
.shfile to install the tools. Here is an example for the traditional installer:$ sh ~/Downloads/x86_64-buildtools-nativesdk-standalone-5.3.3.sh
For the extended installer:
$ sh ~/Downloads/x86_64-buildtools-extended-nativesdk-standalone-5.3.3.sh
And for the make-only installer:
$ sh ~/Downloads/x86_64-buildtools-make-nativesdk-standalone-5.3.3.sh
During execution, a prompt appears that allows you to choose the installation directory. For example, you could choose the following:
/home/your_username/buildtoolsSource the tools environment setup script by using a command like the following:
$ source /home/your_username/buildtools/environment-setup-x86_64-poky-linux
After you have sourced the setup script, the tools are added to
PATHand any other environment variables required to run the tools are initialized. The results are working versions versions of Git, tar, Python andchrpath. And in the case of the buildtools-extended tarball, additional working versions of tools includinggcc,makeand the other tools included inpackagegroup-core-buildessential.
2 Yocto Project Supported Architectures And Features
The Yocto Project is putting continuous efforts into testing the changes made to the OpenEmbedded-Core (OE-Core) metadata and core tools. The details on how this test environment functions is described in the Yocto Project Test Environment Manual.
These tests are also run for stable and LTS versions of the Yocto Project. See the Yocto Project Releases and the Stable Release Process section of the Yocto Project Reference Manual for more information on these types of releases.
The infrastructure behind the test environment is the
Yocto Project Autobuilder. The Autobuilder contains a set of Builders that are associated to an
architecture or a feature to test. For example, the qemuarm64 builder
corresponds to testing the ARM 64-bit architecture.
Below is a comprehensive list of target architectures and features that are supported, as well as their level of support. For each architecture or feature, their corresponding builders are also listed.
2.1 Primary Supported
The term “primary” means that dedicated builds for these architectures or features are being run on a daily basis on the Yocto Project Autobuilder and also tested with incoming changes before they merge. These changes are usually on the “-next” Git branches of the OpenEmbedded-Core (OE-Core) repositories.
Below is a list of primary tested features, their maintainer(s) and builder(s):
Feature |
Description |
Maintainer(s) |
Builder(s) |
|---|---|---|---|
ARM architecture testing |
Collective effort |
genericarm64, genericarm64-alt, musl-qemuarm64, qemuarm, qemuarm-alt, qemuarm-oecore, qemuarm-tc, qemuarm64, qemuarm64-alt, qemuarm64-armhost, qemuarm64-ltp, qemuarm64-ptest, qemuarm64-tc, qemuarmv5 |
|
Beaglebone image and SDK build testing |
Collective effort |
beaglebone, beaglebone-alt |
|
reproducibility testing |
Collective effort |
reproducible |
|
Buildtools generation |
Collective effort |
buildtools |
|
meta-agl-core layer testing |
TBD |
meta-agl-core |
|
meta-arm layer testing |
meta-arm mailing list <meta-arm@lists.yoctoproject.org> |
meta-arm |
|
meta-aws layer testing |
TBD |
meta-aws |
|
meta-intel layer testing |
meta-intel mailing list <meta-intel@lists.yoctoproject.org> |
meta-intel |
|
meta-exein layer testing |
TBD |
meta-exein |
|
meta-webosose layer testing |
TBD |
meta-webosose |
|
Multilib feature testing |
Collective effort |
multilib |
|
OpenEmbedded-Core layers selftests |
Collective effort |
oe-selftest-fedora, oe-selftest-debian, oe-selftest-armhost |
|
Package managers |
Package managers (RPM, DEB and IPK formats) testing in the
OpenEmbedded Build System (different from the
|
Collective effort |
pkgman-non-rpm (other builders use RPM by default) |
Patchtest tool selftests |
Collective effort |
patchtest-selftest |
|
RISC-V architecture testing (64-bit) |
Collective effort |
qemuriscv64, qemuriscv64-ptest, qemuriscv64-tc |
|
Systemd init manager testing |
Collective effort |
no-x11, qa-extras2 |
|
Toaster web interface testing |
Collective effort |
toaster |
|
WIC image creation testing |
Collective effort |
wic |
|
X86 architecture testing |
Collective effort |
genericx86, genericx86-64, genericx86-64-alt, genericx86-alt, musl-qemux86, musl-qemux86-64, qemux86, qemux86-64, qemux86-64-alt, qemux86-64-ltp, qemux86-64-ptest, qemux86-64-tc, qemux86-64-x32, qemux86-alt, qemux86-tc, qemux86-world, qemux86-world-alt |
2.2 Secondary Supported
The term “secondary” means that in some cases there is code/feature/support which is desired by people using the project and is in the project’s interests to support, however there isn’t wide enough interest and support to justify testing all incoming changes on it. There are however project member organisations and maintainers willing to run tests and review fixes.
This category may be applicable as support/usage in an area develops and grows, or as support/usage fades but we continue to have tests. It can also apply where resourcing isn’t available for full primary support but there is member/maintainer support for running tests.
We therefore have the following criteria and policies for such items:
It can be clearly isolated and defined by specific configuration.
There is a clear documented group of maintainers agreeing to maintain it.
Those maintainers are active and responsive.
It is being actively and publicly tested (potentially using the Autobuilder by agreement, or otherwise).
Testing would not be part of standard incoming change testing and regressions would not block incoming patches.
The SWAT team would not handle any test builds on the Autobuilder.
Test results can be submitted as part of the release process if desired.
The Yocto Project Technical Steering Committee (TSC) makes decisions on features in this status and Autobuilder testing. Such support would be dropped if the maintainers/testing were inactive.
If you are interested in providing resources for improving testing please contact the Technical Steering Committee (TSC).
Below is a list of secondary tested features, their maintainer(s) and builder(s):
Feature |
Description |
Maintainer(s) |
Builder(s) |
|---|---|---|---|
PowerPC architecture testing (32-bit) |
Peter Marko, Adrian Freihofer |
qemuppc, qemuppc-tc |
|
meta-openembedded layer testing |
Collective effort / openembedded-devel mailing list <openebedded-devel@lists.openembedded.org> |
meta-oe |
|
mingw based SDKs testing |
TBD |
meta-mingw |
|
meta-virtualization layer testing |
meta-virtualization mailing list <meta-virtualization@lists.yoctoproject.org> |
meta-virt |
|
RISC-V architecture testing (32-bit) |
TBD |
qemuriscv32, qemuriscv32, qemuriscv32-tc |
2.3 Untested
“Untested” means that whilst the configurations are present in the project, we don’t currently run the tests on any regular basis and new changes are not tested against them. We may take patches in these areas if they make sense but it is on a best effort only basis.
Feature |
Description |
Maintainer(s) |
Builder(s) |
|---|---|---|---|
MIPS architecture testing |
No maintainers |
qemumips, qemumips64, qemumips-alt, qemumips-tc, qemumips64-tc |
|
PowerPC (32-bit) Systemd |
PowerPC architecture testing (32-bit) with systemd |
No maintainers |
qemuppc-alt |
PowerPC architecture testing (64-bit) |
No maintainers |
qemuppc64, qemuppc64-tc |
3 Yocto Project Terms
Here is a list of terms and definitions users new to the Yocto Project development environment might find helpful. While some of these terms are universal, the list includes them just in case:
- Append Files
Files that append build information to a recipe file. Append files are known as BitBake append files and
.bbappendfiles. The OpenEmbedded build system expects every append file to have a corresponding recipe (.bb) file. Furthermore, the append file and corresponding recipe file must use the same root filename. The filenames can differ only in the file type suffix used (e.g.formfactor_0.0.bbandformfactor_0.0.bbappend).Information in append files extends or overrides the information in the similarly-named recipe file. For an example of an append file in use, see the “Appending Other Layers Metadata With Your Layer” section in the Yocto Project Development Tasks Manual.
When you name an append file, you can use the “
%” wildcard character to allow for matching recipe names. For example, suppose you have an append file named as follows:busybox_1.21.%.bbappend
That append file would match any
busybox_1.21.x.bbversion of the recipe. So, the append file would match any of the following recipe names:busybox_1.21.1.bb busybox_1.21.2.bb busybox_1.21.3.bb busybox_1.21.10.bb busybox_1.21.25.bb
Note
The use of the “%” character is limited in that it only works directly in front of the .bbappend portion of the append file’s name. You cannot use the wildcard character in any other location of the name.
- BitBake
The task executor and scheduler used by the OpenEmbedded build system to build images. For more information on BitBake, see the BitBake User Manual.
- Board Support Package (BSP)
A group of drivers, definitions, and other components that provide support for a specific hardware configuration. For more information on BSPs, see the Yocto Project Board Support Package Developer’s Guide.
- Build Directory
This term refers to the area used by the OpenEmbedded build system for builds. The area is created when you
sourcethe setup environment script that is found in the Source Directory (i.e. oe-init-build-env, orinit-build-envwhen using bitbake-setup). The TOPDIR variable points to the Build Directory.When setting up the build manually (see Setting Up the Poky Reference Distro Manually), you have a lot of flexibility when creating the Build Directory. Here are some examples that show how to create the directory. The examples assume your Source Directory is named
bitbake-builds:Create the Build Directory inside your Source Directory and let the name of the Build Directory default to
build:$ cd bitbake-builds $ source layers/openembedded-core/oe-init-build-env
Or provide a path to the Build Directory when sourcing
oe-init-build-env. Any intermediate folders in the pathname must exist. This next example creates a Build Directory namedYP-5.3.3within the existing directorymybuilds:$ source bitbake-builds/layers/openembedded-core/oe-init-build-env mybuilds/YP-5.3.3
This path can also be an absolute path and be outside of the current working directory:
$ source bitbake-builds/layers/openembedded-core/oe-init-build-env /opt/mybuilds/YP-5.3.3
Note
By default, the Build Directory contains TMPDIR, which is a temporary directory the build system uses for its work. TMPDIR cannot be under NFS. Thus, by default, the Build Directory cannot be under NFS. However, if you need the Build Directory to be under NFS, you can set this up by setting TMPDIR in your build/conf/site.conf file to use a local drive. Doing so effectively separates TMPDIR from TOPDIR, which is the Build Directory.
- Build Host
The system used to build images in a Yocto Project Development environment. The build system is sometimes referred to as the development host.
- buildtools
Build tools in binary form, providing required versions of development tools (such as Git, GCC, Python and make), to run the OpenEmbedded build system on a development host without such minimum versions.
See the “Required Git, tar, Python, make and gcc Versions” paragraph in the Reference Manual for details about downloading or building an archive of such tools.
- buildtools-extended
A set of buildtools binaries extended with additional development tools, such as a required version of the GCC compiler to run the OpenEmbedded build system.
See the “Required Git, tar, Python, make and gcc Versions” paragraph in the Reference Manual for details about downloading or building an archive of such tools.
- buildtools-make
A variant of buildtools, just providing the required version of
maketo run the OpenEmbedded build system.- Built-in Fragment
A built-in fragment is a specific kind of Configuration Fragment that affects the value of a single variable globally. Built-in Fragments do not require a separate configuration file, but like a standard Configuration Fragment, Built-in Fragments can be enabled or disabled using the bitbake-config-build command-line utility.
When declared, a built-in fragment follows the following naming convention:
<fragment>:<variable name>
Where:
<fragment>is the name of the built-in fragment.<variable name>is the name of the variable to be modified by this fragment.
For example:
machine:MACHINE
Will setup the
machineBuilt-in Fragment for modifying the value of the MACHINE variable.Setting the MACHINE variable through this fragment must follow this syntax:
machine/qemux86-64
This sets the value of MACHINE to
qemux86-64.In OpenEmbedded-Core (OE-Core), the list of available Built-in Fragments can be obtained from the OE_FRAGMENTS_BUILTIN variable.
For more details on fragments, see:
The Using Configuration Fragments section of the Yocto Project Reference Manual for a list of fragments the OpenEmbedded Build System supports, and a quick reference guide on how to manage fragments.
The Creating New Configuration Fragments In Your Build section of the Yocto Project Development Tasks Manual for details on how to create new fragments in your build.
- Classes
Files that provide for logic encapsulation and inheritance so that commonly used patterns can be defined once and then easily used in multiple recipes. For reference information on the Yocto Project classes, see the “Classes” chapter. Class files end with the
.bbclassfilename extension.- Configuration File
Files that hold global definitions of variables, user-defined variables, and hardware configuration information. These files tell the OpenEmbedded build system what to build and what to put into the image to support a particular platform.
Configuration files end with a
.conffilename extension. Theconf/local.confconfiguration file in the Build Directory contains user-defined variables that affect every build. Themeta-poky/conf/distro/poky.confconfiguration file defines Yocto “distro” configuration variables used only when building with this policy. Machine configuration files, which are located throughout the Source Directory, define variables for specific hardware and are only used when building for that target (e.g. themachine/beaglebone.confconfiguration file defines variables for the Texas Instruments ARM Cortex-A8 development board). Configuration Fragments such as core/yocto/sstate-mirror-cdn define snippets of configuration that can be enabled from the command-line.- Configuration Fragment
A Configuration Fragment (also called Standard Configuration Fragment) is a configuration file that contains configuration statements such as variable assignments, affecting the build at a global-level when the fragment is enabled. By default, configuration fragments are located in the
conf/fragments/directory of a Layer.Note
Another form of fragment not to be confounded with Standard Configuration Fragments are Built-in Fragments which are used to assign a single variable value globally.
A fragment configuration file must contain a summary (BB_CONF_FRAGMENT_SUMMARY) and a description (BB_CONF_FRAGMENT_DESCRIPTION) explaining the purpose of the fragment.
In OpenEmbedded-Core (OE-Core), the location of fragments and what variables are required in a fragment is specified in bitbake.conf thanks to the addfragments directive and the OE_FRAGMENTS, OE_FRAGMENTS_METADATA_VARS and OE_FRAGMENTS_BUILTIN variables.
Fragments can be listed, enabled and disabled with the bitbake-config-build command-line utility.
For more details on fragments, see:
The Using Configuration Fragments section of the Yocto Project Reference Manual for a list of fragments the OpenEmbedded Build System supports, and a quick reference guide on how to manage fragments.
The Creating New Configuration Fragments In Your Build section of the Yocto Project Development Tasks Manual for details on how to create new fragments in your build.
- Container Layer
A flexible definition that typically refers to a single Git checkout which contains multiple (and typically related) sub-layers which can be included independently in your project’s
bblayers.conffile.In some cases, such as with OpenEmbedded’s meta-openembedded layer, the top level
meta-openembedded/directory is not itself an actual layer, so you would never explicitly include it in abblayers.conffile; rather, you would include any number of its layer subdirectories, such as meta-oe, meta-python and so on.On the other hand, some container layers (such as meta-security) have a top-level directory that is itself an actual layer, as well as a variety of sub-layers, both of which could be included in your
bblayers.conffile.In either case, the phrase “container layer” is simply used to describe a directory structure which contains multiple valid OpenEmbedded layers.
- Cross-Development Toolchain
In general, a cross-development toolchain is a collection of software development tools and utilities that run on one architecture and allow you to develop software for a different, or targeted, architecture. These toolchains contain cross-compilers, linkers, and debuggers that are specific to the target architecture.
The Yocto Project supports two different cross-development toolchains:
A toolchain only used by and within BitBake when building an image for a target architecture.
A relocatable toolchain used outside of BitBake by developers when developing applications that will run on a targeted device.
Creation of these toolchains is simple and automated. For information on toolchain concepts as they apply to the Yocto Project, see the “Cross-Development Toolchain Generation” section in the Yocto Project Overview and Concepts Manual. You can also find more information on using the relocatable toolchain in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.
- Extensible Software Development Kit (eSDK)
A custom SDK for application developers. This eSDK allows developers to incorporate their library and programming changes back into the image to make their code available to other application developers.
For information on the eSDK, see the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.
- Image
An image is an artifact of the BitBake build process given a collection of recipes and related Metadata. Images are the binary output that run on specific hardware or QEMU and are used for specific use-cases. For a list of the supported image types that the Yocto Project provides, see the “Images” chapter.
- Initramfs
An Initial RAM Filesystem (Initramfs) is an optionally compressed cpio archive which is extracted by the Linux kernel into RAM in a special tmpfs instance, used as the initial root filesystem.
This is a replacement for the legacy init RAM disk (“initrd”) technique, booting on an emulated block device in RAM, but being less efficient because of the overhead of going through a filesystem and having to duplicate accessed file contents in the file cache in RAM, as for any block device.
Note
As far as bootloaders are concerned, Initramfs and “initrd” images are still copied to RAM in the same way. That’s why most most bootloaders refer to Initramfs images as “initrd” or “init RAM disk”.
This kind of mechanism is typically used for two reasons:
For booting the same kernel binary on multiple systems requiring different device drivers. The Initramfs image is then customized for each type of system, to include the specific kernel modules necessary to access the final root filesystem. This technique is used on all GNU / Linux distributions for desktops and servers.
For booting faster. As the root filesystem is extracted into RAM, accessing the first user-space applications is very fast, compared to having to initialize a block device, to access multiple blocks from it, and to go through a filesystem having its own overhead. For example, this allows to display a splashscreen very early, and to later take care of mounting the final root filesystem and loading less time-critical kernel drivers.
This cpio archive can either be loaded to RAM by the bootloader, or be included in the kernel binary.
For information on creating and using an Initramfs, see the “Building an Initial RAM Filesystem (Initramfs) Image” section in the Yocto Project Development Tasks Manual.
- Layer
A collection of related recipes. Layers allow you to consolidate related metadata to customize your build. Layers also isolate information used when building for multiple architectures. Layers are hierarchical in their ability to override previous specifications. You can include any number of available layers from the Yocto Project and customize the build by adding your layers after them. You can search the Layer Index for layers used within Yocto Project.
For introductory information on layers, see the “The Yocto Project Layer Model” section in the Yocto Project Overview and Concepts Manual. For more detailed information on layers, see the “Understanding and Creating Layers” section in the Yocto Project Development Tasks Manual. For a discussion specifically on BSP Layers, see the “BSP Layers” section in the Yocto Project Board Support Packages (BSP) Developer’s Guide.
- LTS
This term means “Long Term Support”, and in the context of the Yocto Project, it corresponds to selected stable releases for which bug and security fixes are provided for at least four years. See the Long Term Support Releases section for details.
- Metadata
A key element of the Yocto Project is the Metadata that is used to construct a Linux distribution and is contained in the files that the OpenEmbedded Build System parses when building an image. In general, Metadata includes recipes, configuration files, and other information that refers to the build instructions themselves, as well as the data used to control what things get built and the effects of the build. Metadata also includes commands and data used to indicate what versions of software are used, from where they are obtained, and changes or additions to the software itself (patches or auxiliary files) that are used to fix bugs or customize the software for use in a particular situation. OpenEmbedded-Core is an important set of validated metadata.
In the context of the kernel (“kernel Metadata”), the term refers to the kernel config fragments and features contained in the yocto-kernel-cache Git repository.
- Mixin
A Mixin layer is a layer which can be created by the community to add a specific feature or support a new version of some package for an LTS release. See the Long Term Support Releases section for details.
- OpenEmbedded Build System
The build system used by the Yocto Project, using Bitbake as the task executor. Throughout the Yocto Project documentation, the OpenEmbedded build system is sometimes referred to simply as “the build system”. If other build systems, such as a host or target build system are referenced, the documentation clearly states the difference.
Note
For some historical information about Poky, see the Poky term.
- OpenEmbedded-Core (OE-Core)
OE-Core is metadata comprised of foundational recipes, classes, and associated files that are meant to be common among many different OpenEmbedded-derived systems, including the Yocto Project. OE-Core is a curated subset of an original repository developed by the OpenEmbedded community that has been pared down into a smaller, core set of continuously validated recipes. The result is a tightly controlled and an quality-assured core set of recipes.
You can browse the source of OpenEmbedded-Core (OE-Core) at openembedded-core.
- Package
In the context of the Yocto Project, this term refers to a recipe’s packaged output produced by BitBake (i.e. a “baked recipe”). A package is generally the compiled binaries produced from the recipe’s sources. You “bake” something by running it through BitBake.
It is worth noting that the term “package” can, in general, have subtle meanings. For example, the packages referred to in the “Required Packages for the Build Host” section are compiled binaries that, when installed, add functionality to your Linux distribution.
Another point worth noting is that historically within the Yocto Project, recipes were referred to as packages — thus, the existence of several BitBake variables that are seemingly mis-named, (e.g. PR, PV, and PE).
- Package Groups
Arbitrary groups of software Recipes. You use package groups to hold recipes that, when built, usually accomplish a single task. For example, a package group could contain the recipes for a company’s proprietary or value-add software. Or, the package group could contain the recipes that enable graphics. A package group is really just another recipe. Because package group files are recipes, they end with the
.bbfilename extension.- Poky
Poky, which is pronounced Pock-ee, is a reference embedded distribution and a reference test configuration. Poky provides the following:
A base-level functional distro used to illustrate how to customize a distribution.
A means by which to test the Yocto Project components (i.e. Poky is used to validate the Yocto Project).
Poky is not a product level distro. Rather, it is a good starting point for customization.
Note
Poky also used to be a repository containing the combination of BitBake, OpenEmbedded-Core (OE-Core), the meta-yocto repository and the Yocto Project documentation – which were combined with the combo-layer tool.
This repository is still hosted at https://git.yoctoproject.org/poky and is still updated for maintained releases that are older than Whinlatter (5.3). Newer releases now use
bitbake-setupto clone and setup the initial OpenEmbedded Build System environment. For more information on how to usebitbake-setup, see the Yocto Project Quick Build document. An alternative can be to setup the above repositories manually, by following the Setting Up the Poky Reference Distro Manually section of the Yocto Project Development Tasks Manual.Note
Poky began as an open-source project initially developed by OpenedHand. OpenedHand developed Poky from the existing OpenEmbedded build system to create a commercially supportable build system for embedded Linux. After Intel Corporation acquired OpenedHand, the poky project became the basis for the Yocto Project’s build system.
- Recipe
A set of instructions for building packages. A recipe describes where you get source code, which patches to apply, how to configure the source, how to compile it and so on. Recipes also describe dependencies for libraries or for other recipes. Recipes represent the logical unit of execution, the software to build, the images to build, and use the
.bbfile extension.- Reference Kit
A working example of a system, which includes a BSP as well as a build host and other components, that can work on specific hardware.
- SBOM
This term means Software Bill of Materials. When you distribute software, it offers a description of all the components you used, their corresponding licenses, their dependencies, the changes that were applied and the known vulnerabilities that were fixed.
This can be used by the recipients of the software to assess their exposure to license compliance and security vulnerability issues.
See the Software Supply Chain article on Wikipedia for more details.
The OpenEmbedded Build System can generate such documentation for your project, in SPDX format, based on all the metadata it used to build the software images. See the “Creating a Software Bill of Materials” section of the Development Tasks manual.
- Source Directory
This term refers to the directory structure created as a result of setting up your environment to build images with the Yocto Project, which can be done in two ways:
Using the
bitbake-setupcommand-line utility (see Setting Up The Environment With bitbake-setup).Or manually setting up the Layers (see Setting Up the Poky Reference Distro Manually).
In either case, the result will be a set of Layers and a Build Directory: this is the Source Directory for your build. The documentation usually denotes this directory with the name “bitbake-builds”.
A typical layout for the Source Directory would be:
bitbake-builds/ ├── build/ └── layers/
Where the
layers/directory corresponds to the directory containing layers for your project, and thebuild/directory corresponds to the Build Directory.We present a Source Directory structure and its components in details in the Source Directory Structure section of the Yocto Project Reference Manual.
Note
The OpenEmbedded build system does not support file or directory names that contain spaces. Be sure that the Source Directory you use does not contain these types of names.
The Source Directory contains BitBake, OpenEmbedded-Core (OE-Core), and other files that all support the Yocto Project.
Consequently, you must have the Source Directory in place on your development system in order to do any development using the Yocto Project.
- SPDX
This term means Software Package Data Exchange, and is used as an open standard for providing a Software Bill of Materials (SBOM). This standard is developed through a Linux Foundation project and is used by the OpenEmbedded Build System to provide an SBOM associated to each software image.
For details, see Wikipedia’s SPDX page and the “Creating a Software Bill of Materials” section of the Development Tasks manual.
- Sysroot
When cross-compiling, the target file system may be differently laid out and contain different things compared to the host system. The concept of a sysroot is directory which looks like the target filesystem and can be used to cross-compile against.
In the context of cross-compiling toolchains, a sysroot typically contains C library and kernel headers, plus the compiled binaries for the C library. A multilib toolchain can contain multiple variants of the C library binaries, each compiled for a target instruction set (such as
armv5,armv7andarmv8), and possibly optimized for a specific CPU core.In the more specific context of the OpenEmbedded build System and of the Yocto Project, each recipe has two sysroots:
A target sysroot contains all the target libraries and headers needed to build the recipe.
A native sysroot contains all the host files and executables needed to build the recipe.
See the SYSROOT_* variables controlling how sysroots are created and stored.
- Task
A per-recipe unit of execution for BitBake (e.g. do_compile, do_fetch, do_patch, and so forth). One of the major benefits of the build system is that, since each recipe will typically spawn the execution of numerous tasks, it is entirely possible that many tasks can execute in parallel, either tasks from separate recipes or independent tasks within the same recipe, potentially up to the parallelism of your build system.
- Toaster
A web interface to the Yocto Project’s OpenEmbedded Build System. The interface enables you to configure and run your builds. Information about builds is collected and stored in a database. For information on Toaster, see the Toaster User Manual.
- Upstream
A reference to source code or repositories that are not local to the development system but located in a remote area that is controlled by the maintainer of the source code. For example, in order for a developer to work on a particular piece of code, they need to first get a copy of it from an “upstream” source.
4 Yocto Project Releases and the Stable Release Process
The Yocto Project release process is predictable and consists of both major and minor (point) releases. This brief chapter provides information on how releases are named, their life cycle, and their stability.
4.1 Major and Minor Release Cadence
The Yocto Project delivers major releases (e.g. 5.3.3) using a six month cadence roughly timed each April and October of the year. Here are examples of some major YP releases with their codenames also shown. See the “Major Release Codenames” section for information on codenames used with major releases.
4.1 (“Langdale”)
4.0 (“Kirkstone”)
3.4 (“Honister”)
While the cadence is never perfect, this timescale facilitates regular releases that have strong QA cycles while not overwhelming users with too many new releases. The cadence is predictable and avoids many major holidays in various geographies.
The Yocto project delivers minor (point) releases on an unscheduled basis and are usually driven by the accumulation of enough significant fixes or enhancements to the associated major release. Some example past point releases are:
4.1.3
4.0.8
3.4.4
The point release indicates a point in the major release branch where a full QA cycle and release process validates the content of the new branch.
Note
Realize that there can be patches merged onto the stable release branches as and when they become available.
4.2 Development Cycle
As explained in the previous Major and Minor Release Cadence section, a new release comes out every six months.
During this six-months period of time, the Yocto Project releases four “Milestone” releases which represent distinct points of time. The milestone releases are tested through the Testing and Quality Assurance process and helps spotting issues before the actual release is out.
The time span between milestone releases can vary, but they are in general evenly spaced out during this six-months period of time.
These milestone releases are tagged with a capital “M” after the future release tag name. For example, the milestone tags “5.3M1”, “5.3M2”, and “5.3M3” are released before the actual “5.3” release.
Note
The fourth milestone (M4) is not actually released and announced, but represents a point of time for the Quality Assurance team to start the Testing and Quality Assurance process before tagging and delivering the final release.
After the third milestone release (M3), the Yocto Project enters Feature Freeze. This means that the maintainers of OpenEmbedded-Core (OE-Core), BitBake and other core repositories stop accepting significant changes on the “master” branch. Changes that may be accepted are minor upgrades to core components and security/bug fixes.
During feature freeze, a new branch is created and maintained separately to test new features and enhancements received from contributors, but these changes will only make it to the master branch after the release is out.
4.3 Major Release Codenames
Each major release receives a codename that identifies the release in the Yocto Project Source Repositories. The concept is that branches of Metadata with the same codename are likely to be compatible and thus work together.
Note
Codenames are associated with major releases because a Yocto Project release number (e.g. 5.3.3) could conflict with a given layer or company versioning scheme. Codenames are unique, interesting, and easily identifiable.
Releases are given a nominal release version as well but the codename is used in repositories for this reason. You can find information on Yocto Project releases and codenames in the Releases page.
Our Release Information detail how to migrate from one release of the Yocto Project to the next.
4.4 Stable Release Process
Once released, the release enters the stable release process at which time a person is assigned as the maintainer for that stable release. This maintainer monitors activity for the release by investigating and handling nominated patches and backport activity. Only fixes and enhancements that have first been applied on the “master” branch (i.e. the current, in-development branch) are considered for backporting to a stable release.
Note
The current Yocto Project policy regarding backporting is to consider bug fixes and security fixes only. Policy dictates that features are not backported to a stable release. This policy means generic recipe version upgrades are unlikely to be accepted for backporting. The exception to this policy occurs when there is a strong reason such as the fix happens to also be the preferred upstream approach.
4.5 Long Term Support Releases
While stable releases are supported for a duration of seven months, some specific ones are now supported for a longer period by the Yocto Project, and are called Long Term Support (LTS) releases.
When significant issues are found, LTS releases allow to publish fixes not only for the current stable release, but also to the LTS releases that are still supported. Older stable releases which have reached their End of Life (EOL) won’t receive such updates.
This started with version 3.1 (“Dunfell”), released in April 2020, which the project initially committed to supporting for two years, but this duration was later extended to four years.
A new LTS release is made every two years and is supported for four years. This offers more stability to project users and leaves more time to upgrade to the following LTS release.
The currently supported LTS releases are:
Version 5.0 (“Scarthgap”), released in April 2024 and supported until April 2028.
Version 4.0 (“Kirkstone”), released in May 2022 and supported until May 2026.
See https://wiki.yoctoproject.org/wiki/Stable_Release_and_LTS for details about the management of stable and LTS releases.
This documentation was built for the Whinlatter release.
Note
In some circumstances, a layer can be created by the community in order to add a specific feature or support a new version of some package for an LTS release. This is called a Mixin layer. These are thin and specific purpose layers which can be stacked with an LTS release to “mix” a specific feature into that build. These are created on an as-needed basis and maintained by the people who need them.
Policies on testing these layers depend on how widespread their usage is and determined on a case-by-case basis. You can find some Mixin layers in the meta-lts-mixins repository. While the Yocto Project provides hosting for those repositories, it does not provides testing on them. Other Mixin layers may be released elsewhere by the wider community.
4.6 Testing and Quality Assurance
Part of the Yocto Project development and release process is quality assurance through the execution of test strategies. Test strategies provide the Yocto Project team a way to ensure a release is validated. Additionally, because the test strategies are visible to you as a developer, you can validate your projects. This section overviews the available test infrastructure used in the Yocto Project. For information on how to run available tests on your projects, see the “Performing Automated Runtime Testing” section in the Yocto Project Test Environment Manual.
The QA/testing infrastructure is woven into the project to the point where core developers take some of it for granted. The infrastructure consists of the following pieces:
bitbake-selftest: A standalone command that runs unit tests on key pieces of BitBake and its fetchers.sanity: This automatically included class checks the build environment for missing tools (e.g.
gcc) or common misconfigurations such as MACHINE set incorrectly.insane: This class checks the generated output from builds for sanity. For example, if building for an ARM target, did the build produce ARM binaries. If, for example, the build produced PPC binaries then there is a problem.
testimage: This class performs runtime testing of images after they are built. The tests are usually used with QEMU to boot the images and check the combined runtime result boot operation and functions. However, the test can also use the IP address of a machine to test.
ptest: Runs tests against packages produced during the build for a given piece of software. The test allows the packages to be run within a target image.
oe-selftest: Tests combinations of BitBake invocations. These tests operate outside the OpenEmbedded build system itself. Theoe-selftestcan run all tests by default or can run selected tests or test suites.
Originally, much of this testing was done manually. However, significant effort has been made to automate the tests so that more people can use them and the Yocto Project development team can run them faster and more efficiently.
The Yocto Project’s main Autobuilder publicly tests each Yocto Project release’s code in the openembedded-core, meta-yocto and bitbake repositories. The testing occurs for both the current state of the “master” branch and also for submitted patches. Testing for submitted patches usually occurs in the “master-next” branch in the openembedded-core, meta-yocto and bitbake repository.
Note
You can find all these branches in the Yocto Project Source Repositories.
Testing within these public branches ensures in a publicly visible way that all of the main supposed architectures and recipes in OE-Core successfully build and behave properly.
Various features such as multilib, sub architectures (e.g. x32,
poky-tiny, musl, no-x11 and and so forth),
bitbake-selftest, and oe-selftest are tested as part of the QA
process of a release. Complete testing and validation for a release
takes the Autobuilder workers several hours.
Note
The Autobuilder workers are non-homogeneous, which means regular testing across a variety of Linux distributions occurs. The Autobuilder is limited to only testing QEMU-based setups and not real hardware.
Finally, in addition to the Autobuilder’s tests, the Yocto Project QA team also performs testing on a variety of platforms, which includes actual hardware, to ensure expected results.
5 Source Directory Structure
The Source Directory consists of numerous files, directories and subdirectories; understanding their locations and contents is key to using the Yocto Project effectively. This chapter describes the Source Directory and gives information about those files and directories.
Note
The OpenEmbedded build system does not support file or directory names that contain spaces. Be sure that the Source Directory you use does not contain these types of names.
For the following sections, we assume the core components of the Source Directory are organized as follows:
├── build/
│ └── ...
└── layers/
├── bitbake/
├── meta-yocto/
├── openembedded-core/
└── yocto-docs/
5.1 Top-Level Core Components
This section describes the top-level components of the Source Directory.
5.1.1 bitbake/
This directory includes a copy of BitBake for ease of use. The copy usually matches the current stable BitBake release from the BitBake project. BitBake, a Metadata interpreter, reads the Yocto Project Metadata and runs the tasks defined by that data. Failures are usually caused by errors in your Metadata and not from BitBake itself.
When you run the bitbake command, the main BitBake executable (which
resides in the bitbake/bin/ directory) starts. Sourcing the
environment setup script (i.e. oe-init-build-env) places
the scripts/ and bitbake/bin/ directories (in that order) into
the shell’s PATH environment variable.
For more information on BitBake, see the BitBake User Manual.
5.1.2 build/
This directory contains user configuration files and the output
generated by the OpenEmbedded build system in its standard configuration
where the source tree is combined with the output. The Build Directory
is created initially when you source the OpenEmbedded build environment
setup script (i.e. oe-init-build-env).
It is also possible to place output and configuration files in a
directory separate from the Source Directory by
providing a directory name when you source the setup script. For
information on separating output from your local Source Directory files
(commonly described as an “out of tree” build), see the
“oe-init-build-env” section.
See the “The Build Directory — build/” section for details about the contents of the Build Directory.
5.1.3 layers/yocto-docs/
The Yocto documentation repository is hosted at https://git.yoctoproject.org/yocto-docs.
This directory holds the source for the Yocto Project documentation as
well as templates and tools that allow you to generate PDF and HTML
versions of the manuals. Each manual is contained in its own sub-folder;
for example, the files for this reference manual reside in the
ref-manual/ directory.
This directory is not mandatory for building with BitBake.
5.1.4 layers/openembedded-core/
The OpenEmbedded-Core (OE-Core) repository is hosted at https://git.openembedded.org/openembedded-core.
5.1.4.1 meta/
This directory contains the minimal, underlying OpenEmbedded-Core
(OE-Core) metadata. The directory holds recipes, common classes, and machine
configuration for strictly emulated targets (qemux86, qemuarm,
and so forth.)
5.1.4.2 meta-selftest/
This directory adds additional recipes and append files used by the
OpenEmbedded selftests to verify the behavior of the build system. You
do not have to add this layer to your bblayers.conf file unless you
want to run the selftests.
5.1.4.3 meta-skeleton/
This directory contains template recipes for BSP and kernel development.
5.1.4.4 scripts/
This directory contains various integration scripts that implement extra
functionality in the Yocto Project environment (e.g. QEMU scripts). The
oe-init-build-env script prepends this directory to the
shell’s PATH environment variable.
The scripts directory has useful scripts that assist in contributing
back to the Yocto Project, such as create-pull-request and
send-pull-request.
5.1.4.5 oe-init-build-env
This script sets up the OpenEmbedded build environment. Running this
script with the source command in a shell makes changes to PATH
and sets other core BitBake variables based on the current working
directory. You need to run an environment setup script before running
BitBake commands. The script uses other scripts within the scripts
directory to do the bulk of the work.
When you run this script, your Yocto Project environment is set up, a Build Directory is created, your working directory becomes the Build Directory, and you are presented with some simple suggestions as to what to do next, including a list of some possible targets to build. Here is an example:
$ source oe-init-build-env
### Shell environment set up for builds. ###
You can now run 'bitbake <target>'
Common targets are:
core-image-minimal
core-image-sato
meta-toolchain
meta-ide-support
You can also run generated QEMU images with a command like 'runqemu qemux86-64'
Note
When using bitbake-setup,
this script is indirectly sourced when sourcing the init-build-env
located in the Setup’s build directory. However, compared to
oe-init-build-env, the bitbake-setup init-build-env does not take any
argument, as it is already located in a Build Directory.
See Setting Up The Environment With bitbake-setup for more information.
The default output of the oe-init-build-env script is from the
conf-summary.txt and conf-notes.txt files, which are found in the
meta/conf/templates/default directory of OpenEmbedded-Core
(OE-Core). If you design a custom distribution, you can include your own
versions of these configuration files where you can provide a brief summary and
detailed usage notes, such as a list of the targets defined by your
distribution. See the
“Creating a Custom Template Configuration Directory” section in the Yocto Project Development
Tasks Manual for more information.
By default, running this script without a Build Directory argument
creates the build/ directory in your current working directory. If
you provide a Build Directory argument when you source the script,
you direct the OpenEmbedded build system to create a Build Directory of
your choice. For example, the following command creates a
Build Directory named mybuilds/ that is outside of the
Source Directory:
$ source oe-init-build-env ~/mybuilds
The OpenEmbedded build system uses the template configuration files, which
are found by default in the meta/conf/templates/default directory in
OpenEmbedded-Core (OE-Core). See the
“Creating a Custom Template Configuration Directory”
section in the Yocto Project Development Tasks Manual for more
information.
Note
The OpenEmbedded build system does not support file or directory
names that contain spaces. If you attempt to run the oe-init-build-env
script from a Source Directory that contains spaces in either the
filenames or directory names, the script returns an error indicating
no such file or directory. Be sure to use a Source Directory free of
names containing spaces.
5.1.5 layers/meta-yocto/
The meta-yocto repository is hosted at https://git.yoctoproject.org/meta-yocto.
5.1.5.1 meta-poky/
Dependent on the OpenEmbedded-Core (OE-Core) metadata, this directory adds just enough metadata to define the Poky reference distribution.
Namely, it contains the distro configuration file for Poky:
conf/distro/poky.conf.
5.1.5.2 meta-yocto-bsp/
This directory contains the Yocto Project reference hardware Board Support Packages (BSPs). For more information on BSPs, see the Yocto Project Board Support Package Developer’s Guide.
5.2 The Build Directory — build/
The OpenEmbedded build system creates the Build Directory when you run
the build environment setup script oe-init-build-env. If you do not
give the Build Directory a specific name when you run the setup script,
the name defaults to build/.
For subsequent parsing and processing, the name of the Build directory is available via the TOPDIR variable.
5.2.1 build/buildhistory/
The OpenEmbedded build system creates this directory when you enable build history via the buildhistory class file. The directory organizes build information into image, packages, and SDK subdirectories. For information on the build history feature, see the “Maintaining Build Output Quality” section in the Yocto Project Development Tasks Manual.
5.2.2 build/cache/
This directory contains several internal files used by the OpenEmbedded build system. The path to this directory is defined by the PERSISTENT_DIR variable.
It also contains sanity_info, a text file keeping track of important
build information such as the values of TMPDIR, SSTATE_DIR,
as well as the name and version of the host distribution.
This directory should not be shared between builds.
Note
The default location of the Hash Equivalence
database is this directory (when BB_HASHSERVE is set to auto). If
you need to share the Hash Equivalence
database, don’t share this file and instead refer to the
Setting up a Hash Equivalence Server document of the Yocto Project Development
Tasks Manual to setup a Hash Equivalence server.
5.2.3 build/conf/local.conf
This configuration file contains the local user configurations for the build environment.
You could for example experiment with setting (or adding to) DISTRO_FEATURES or IMAGE_FEATURES, or adjust build configurations for specific recipes by setting the PACKAGECONFIG variables for them. If you would like to publish and share changes made to this file, it is recommended to put them into a distro configuration file, or to create layer configuration fragments from changes made here.
The OpenEmbedded Build System can create the local.conf file from a
local.conf.sample file when you source the top-level build environment
setup script oe-init-build-env.
The source local.conf.sample file used depends on the
TEMPLATECONF script variable, which defaults to layers/meta-yocto/meta-poky/conf/templates/default
when you are building from the Yocto Project development environment,
and to layers/openembedded-core/meta/conf/templates/default when you are building from the OpenEmbedded-Core
environment. Because the script variable points to the source of the
local.conf.sample file, this implies that you can configure your
build environment from any layer by setting the variable in the
top-level build environment setup script as follows:
TEMPLATECONF=your_layer/conf/templates/your_template_name
Once the build process gets the sample
file, it uses sed to substitute final
${OEROOT} values for all
##OEROOT## values.
Note
You can see how the TEMPLATECONF variable is used by looking at the
layers/openembedded-core/scripts/oe-setup-builddir script in OpenEmbedded-Core (OE-Core).
You can find the Poky version of the local.conf.sample file in
the layers/meta-yocto/meta-poky/conf/templates/default directory.
5.2.4 build/conf/bblayers.conf
This configuration file defines
layers,
which are directory trees, traversed (or walked) by BitBake. The
bblayers.conf file uses the BBLAYERS
variable to list the layers BitBake tries to find.
The OpenEmbedded build system can create it from a bblayers.conf.sample file
when you source the top-level build environment setup script (i.e.
oe-init-build-env).
As with the build/conf/local.conf file, the source bblayers.conf.sample
file used depends on the TEMPLATECONF script variable, which
defaults to meta-poky/conf/templates/default when you are building using the
Poky reference distro, and to meta/conf/templates/default when you are
building from the OpenEmbedded-Core environment (default). Because the script
variable points to the source of the bblayers.conf.sample file, this
implies that you can base your build from any layer by setting the
variable in the top-level build environment setup script as follows:
TEMPLATECONF=your_layer/conf/templates/your_template_name
Once the build process gets the sample file, it uses sed to substitute final
${OEROOT} values for all ##OEROOT## occurrences.
Note
You can see how the TEMPLATECONF variable is defined by the scripts/oe-setup-builddir
script in OpenEmbedded-Core (OE-Core). You can find the Poky
version of the bblayers.conf.sample file in the layers/meta-yocto/meta-poky/conf/templates/default
directory.
5.3 build/conf/site.conf
This configuration file contains the site specific configurations for your build environment.
You could for example edit this file to limit the number of threads used by BitBake (BB_NUMBER_THREADS) or set the location from which you want to access downloaded files (DL_DIR).
This file can be shared for multiple build directories. For example,
bitbake-setup
makes the build/conf/site.conf file a symbolic link to a common
site.conf file:
├── poky-master-poky-distro_poky-machine_qemux86-64/
│ └── build/
│ └── conf/
│ └── site.conf -> ../../../site.conf
├── poky-master-poky-with-sstate-distro_poky-machine_qemux86-64/
│ └── build/
│ └── conf/
│ └── site.conf -> ../../../site.conf
└── site.conf
This way, site-specific settings can be shared for multiple build configurations.
Note
For more information on how to use bitbake-setup, see the
Yocto Project Quick Build document.
5.3.1 build/conf/bblock.conf
This configuration file is generated by bblock and
contains the signatures locked by bblock. By default, it does not exist
and will be created upon the first invocation of bblock.
5.3.2 build/conf/toolcfg.conf
This file contains configuration variables that are automatically modified by tools such as bitbake-config-build. This file should not be modified manually.
5.3.3 build/conf/auto.conf
This file is intended for use by continuous integration environments, such as the Yocto Project’s Autobuilder. It should not be created or modified when running local builds.
5.3.4 build/downloads/
This directory contains downloaded upstream source tarballs. You can reuse the directory for multiple builds or move the directory to another location. You can control the location of this directory through the DL_DIR variable.
5.3.5 build/sstate-cache/
This directory contains the shared state cache. You can reuse the directory for multiple builds or move the directory to another location. You can control the location of this directory through the SSTATE_DIR variable.
5.3.6 build/tmp/
The OpenEmbedded build system creates and uses this directory for all the build system’s output. The TMPDIR variable points to this directory.
BitBake creates this directory if it does not exist. As a last resort,
to clean up a build and start it from scratch (other than the
downloads), you can remove everything in the tmp directory or get
rid of the directory completely. If you do, you should also completely
remove the build/sstate-cache directory.
5.3.6.1 build/tmp/buildstats/
This directory stores the build statistics as generated by the buildstats class.
5.3.6.2 build/tmp/cache/
When BitBake parses the metadata (recipes and configuration files), it
caches the results in build/tmp/cache/ to speed up future builds.
The results are stored on a per-machine basis.
During subsequent builds, BitBake checks each recipe (together with, for example, any files included or appended to it) to see if they have been modified. Changes can be detected, for example, through file modification time (mtime) changes and hashing of file contents. If no changes to the file are detected, then the parsed result stored in the cache is reused. If the file has changed, it is reparsed.
5.3.6.3 build/tmp/deploy/
This directory contains any “end result” output from the OpenEmbedded
build process. The DEPLOY_DIR variable points
to this directory. For more detail on the contents of the deploy
directory, see the
“Images” and
“Application Development SDK” sections in the Yocto
Project Overview and Concepts Manual.
5.3.6.3.1 build/tmp/deploy/deb/
This directory receives any .deb packages produced by the build
process. The packages are sorted into feeds for different architecture
types.
5.3.6.3.2 build/tmp/deploy/rpm/
This directory receives any .rpm packages produced by the build
process. The packages are sorted into feeds for different architecture
types.
5.3.6.3.3 build/tmp/deploy/ipk/
This directory receives .ipk packages produced by the build process.
5.3.6.3.4 build/tmp/deploy/licenses/
This directory receives package licensing information. For example, the
directory contains sub-directories for bash, busybox, and
glibc (among others) that in turn contain appropriate COPYING
license files with other licensing information. For information on
licensing, see the
“Maintaining Open Source License Compliance During Your Product’s Lifecycle”
section in the Yocto Project Development Tasks Manual.
5.3.6.3.5 build/tmp/deploy/images/
This directory is populated with the basic output objects of the build (think of them as the “generated artifacts” of the build process), including things like the boot loader image, kernel, root filesystem and more. If you want to flash the resulting image from a build onto a device, look here for the necessary components.
Be careful when deleting files in this directory. You can safely delete
old images from this directory (e.g. core-image-*). However, the
kernel (*zImage*, *uImage*, etc.), bootloader and other
supplementary files might be deployed here prior to building an image.
Because these files are not directly produced from the image, if you
delete them they will not be automatically re-created when you build the
image again.
If you do accidentally delete files here, you will need to force them to be re-created. In order to do that, you will need to know the target that produced them. For example, these commands rebuild and re-create the kernel files:
$ bitbake -c clean virtual/kernel
$ bitbake virtual/kernel
5.3.6.3.6 build/tmp/deploy/sdk/
The OpenEmbedded build system creates this directory to hold toolchain installer scripts which, when executed, install the sysroot that matches your target hardware. You can find out more about these installers in the “Building an SDK Installer” section in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.
5.3.6.4 build/tmp/hosttools/
The OpenEmbedded build system uses this directory to create symbolic links to some of the host components that are allowed to be called within tasks. These are basic components listed in the Required Packages for the Build Host section. These components are also listed in the HOSTTOOLS variable and are limited to this list to prevent host contamination.
5.3.6.5 build/tmp/pkgdata/
The OpenEmbedded build system uses this directory to store package metadata generated during the do_packagedata task. The files stored in this directory contain information about each output package produced by the OpenEmbedded build system, and are used in different ways by the build system such as “Viewing Package Information with oe-pkgdata-util”.
5.3.6.6 build/tmp/sstate-control/
The OpenEmbedded build system uses this directory for the shared state manifest files. The shared state code uses these files to record the files installed by each sstate task so that the files can be removed when cleaning the recipe or when a newer version is about to be installed. The build system also uses the manifests to detect and produce a warning when files from one task are overwriting those from another.
5.3.6.7 build/tmp/sysroots-components/
This directory is the location of the sysroot contents that the task
do_prepare_recipe_sysroot
links or copies into the recipe-specific sysroot for each recipe listed
in DEPENDS. Population of this directory is
handled through shared state, while the path is specified by the
COMPONENTS_DIR variable. Apart from a few
unusual circumstances, handling of the sysroots-components directory
should be automatic, and recipes should not directly reference
build/tmp/sysroots-components.
5.3.6.8 build/tmp/sysroots/
Previous versions of the OpenEmbedded build system used to create a
global shared sysroot per machine along with a native sysroot. Since
the 2.3 version of the Yocto Project, there are sysroots in
recipe-specific WORKDIR directories. Thus, the
build/tmp/sysroots/ directory is unused.
Note
The build/tmp/sysroots/ directory can still be populated using the
bitbake build-sysroots command and can be used for compatibility in some
cases. However, in general it is not recommended to populate this directory.
Individual recipe-specific sysroots should be used.
5.3.6.9 build/tmp/stamps/
This directory holds information that BitBake uses for accounting purposes to track what tasks have run and when they have run. The directory is sub-divided by architecture, package name, and version. Here is an example:
stamps/all-poky-linux/distcc-config/1.0-r0.do_build-2fdd....2do
Although the files in the directory are empty of data, BitBake uses the filenames and timestamps for tracking purposes.
For information on how BitBake uses stamp files to determine if a task should be rerun, see the “Stamp Files and the Rerunning of Tasks” section in the Yocto Project Overview and Concepts Manual.
5.3.6.10 build/tmp/log/
This directory contains general logs that are not otherwise placed using
the package’s WORKDIR. Examples of logs are the output from the
do_check_pkg or do_distro_check tasks. Running a build does not
necessarily mean this directory is created.
5.3.6.11 build/tmp/work/
This directory contains architecture-specific work sub-directories for packages built by BitBake. All tasks execute from the appropriate work directory. For example, the source for a particular package is unpacked, patched, configured and compiled all within its own work directory. Within the work directory, organization is based on the package group and version for which the source is being compiled as defined by the WORKDIR.
It is worth considering the structure of a typical work directory. As an
example, consider linux-yocto-kernel-3.0 on the machine qemux86
built within the Yocto Project. For this package, a work directory of
tmp/work/qemux86-poky-linux/linux-yocto/3.0+git1+<.....>, referred
to as the WORKDIR, is created. Within this directory, the source is
unpacked to sources/linux-qemux86-standard-build and then patched by Quilt.
(See the “Using Quilt in Your Workflow” section in
the Yocto Project Development Tasks Manual for more information.) Within
the linux-qemux86-standard-build directory, standard Quilt
directories linux-3.0/patches and linux-3.0/.pc are created, and
standard Quilt commands can be used.
There are other directories generated within WORKDIR. The most
important directory is WORKDIR/temp/, which has log files for each
task (log.do_*.pid) and contains the scripts BitBake runs for each
task (run.do_*.pid). The WORKDIR/image/ directory is where “make
install” places its output that is then split into sub-packages within
WORKDIR/packages-split/.
5.3.6.11.1 build/tmp/work/tunearch/recipename/version/
The recipe work directory — ${WORKDIR}.
As described earlier in the
“build/tmp/sysroots/” section,
beginning with the 2.3 release of the Yocto Project, the OpenEmbedded
build system builds each recipe in its own work directory (i.e.
WORKDIR). The path to the work directory is
constructed using the architecture of the given build (e.g.
TUNE_PKGARCH, MACHINE_ARCH, or “allarch”), the recipe
name, and the version of the recipe (i.e.
PE:PV-PR).
Here are key subdirectories within each recipe work directory:
${WORKDIR}/temp: Contains the log files of each task executed for this recipe, the “run” files for each executed task, which contain the code run, and alog.task_orderfile, which lists the order in which tasks were executed.${WORKDIR}/image: Contains the output of the do_install task, which corresponds to the${D}variable in that task.${WORKDIR}/pseudo: Contains the pseudo database and log for any tasks executed under pseudo for the recipe.${WORKDIR}/sysroot-destdir: Contains the output of the do_populate_sysroot task.${WORKDIR}/package: Contains the output of the do_package task before the output is split into individual packages.${WORKDIR}/packages-split: Contains the output of the do_package task after the output has been split into individual packages. There are subdirectories for each individual package created by the recipe.${WORKDIR}/recipe-sysroot: A directory populated with the target dependencies of the recipe. This directory looks like the target filesystem and contains libraries that the recipe might need to link against (e.g. the C library).${WORKDIR}/recipe-sysroot-native: A directory populated with the native dependencies of the recipe. This directory contains the tools the recipe needs to build (e.g. the compiler, Autoconf, libtool, and so forth).${WORKDIR}/build: This subdirectory applies only to recipes that support builds where the source is separate from the build artifacts. The OpenEmbedded build system uses this directory as a separate build directory (i.e.${B}).
5.4 The OpenEmbedded-Core (OE-Core) Metadata — meta/
As mentioned previously, the OpenEmbedded-Core (OE-Core) metadata is the core of the Yocto Project. This metadata has several important subdivisions:
5.4.1 meta/classes*/
These directories contain the *.bbclass files. Class files are used to
abstract common code so it can be reused by multiple packages. Every
package inherits the base file. Examples of other important
classes are autotools*, which in theory allows any
Autotool-enabled package to work with the Yocto Project with minimal
effort. Another example is kernel that contains common code
and functions for working with the Linux kernel. Functions like image
generation or packaging also have their specific class files such as
image, rootfs* and
package*.bbclass.
For reference information on classes, see the “Classes” chapter.
5.4.2 meta/conf/
This directory contains the core set of configuration files that start
from bitbake.conf and from which all other configuration files are
included. See the include statements at the end of the bitbake.conf
file and you will note that even local.conf is loaded from there.
While bitbake.conf sets up the defaults, you can often override
these by using the (local.conf) file, machine file or the
distribution configuration file.
5.4.2.1 meta/conf/machine/
This directory contains all the machine configuration files. If you set
MACHINE = "qemux86", the OpenEmbedded build system looks for a
qemux86.conf file in this directory. The include directory
contains various data common to multiple machines. If you want to add
support for a new machine to the Yocto Project, look in this directory.
5.4.2.2 meta/conf/distro/
The contents of this directory controls any distribution-specific
configurations. For the Yocto Project, the defaultsetup.conf is the
main file here. This directory includes the versions and the SRCDATE
definitions for applications that are configured here. An example of an
alternative configuration might be poky-bleeding.conf. Although this
file mainly inherits its configuration from Poky.
5.4.2.3 meta/conf/machine-sdk/
The OpenEmbedded build system searches this directory for configuration files that correspond to the value of SDKMACHINE. By default, 32-bit and 64-bit x86 files ship with the Yocto Project that support some SDK hosts. However, it is possible to extend that support to other SDK hosts by adding additional configuration files in this subdirectory within another layer.
5.4.3 meta/files/
This directory contains common license files and several text files used by the build system. The text files contain minimal device information and lists of files and directories with known permissions.
5.4.4 meta/lib/
This directory contains OpenEmbedded Python library code used during the
build process. It is enabled via the addpylib directive in
meta/conf/local.conf. For more information, see
Extending Python Library Code.
5.4.5 meta/recipes-bsp/
This directory contains anything linking to specific hardware or hardware configuration information such as “u-boot” and “grub”.
5.4.6 meta/recipes-connectivity/
This directory contains libraries and applications related to communication with other devices.
5.4.7 meta/recipes-core/
This directory contains what is needed to build a basic working Linux image including commonly used dependencies.
5.4.8 meta/recipes-devtools/
This directory contains tools that are primarily used by the build system. The tools, however, can also be used on targets.
5.4.9 meta/recipes-extended/
This directory contains non-essential applications that add features compared to the alternatives in core. You might need this directory for full tool functionality.
5.4.10 meta/recipes-gnome/
This directory contains all things related to the GTK+ application framework.
5.4.11 meta/recipes-graphics/
This directory contains X and other graphically related system libraries.
5.4.12 meta/recipes-kernel/
This directory contains the kernel and generic applications and libraries that have strong kernel dependencies.
5.4.13 meta/recipes-multimedia/
This directory contains codecs and support utilities for audio, images and video.
5.4.14 meta/recipes-rt/
This directory contains package and image recipes for using and testing
the PREEMPT_RT kernel.
5.4.15 meta/recipes-sato/
This directory contains the Sato demo/reference UI/UX and its associated applications and configuration data.
5.4.16 meta/recipes-support/
This directory contains recipes used by other recipes, but that are not directly included in images (i.e. dependencies of other recipes).
5.4.17 meta/site/
This directory contains a list of cached results for various architectures. Because certain “autoconf” test results cannot be determined when cross-compiling due to the tests not able to run on a live system, the information in this directory is passed to “autoconf” for the various architectures.
5.4.18 meta/recipes.txt
This file is a description of the contents of recipes-*.
6 Classes
Class files are used to abstract common functionality and share it
amongst multiple recipe (.bb) files. To use a class file, you simply
make sure the recipe inherits the class. In most cases, when a recipe
inherits a class it is enough to enable its features. There are cases,
however, where in the recipe you might need to set variables or override
some default behavior. A class can also be inherited globally (in every recipe)
with the INHERIT variable.
Any Metadata usually found in a recipe can also be
placed in a class file. Class files are identified by the extension
.bbclass and are usually placed in one of the following subdirectories
of a layer:
classes-recipe/- classes intended to be inherited by recipes individually
classes-global/- classes intended to be inherited globally
classes/- classes whose usage context is not clearly defined
Class files can also be pointed to by
BUILDDIR (e.g. build/) in the same way as
.conf files in the conf directory. Class files are searched for
in BBPATH using the same method by which .conf
files are searched.
This chapter discusses only the most useful and important classes. Other
classes do exist within the meta/classes* directories of
OpenEmbedded-Core (OE-Core). You can refer to the .bbclass files
directly for more information.
6.1 allarch
The allarch class is inherited by recipes that do not produce architecture-specific output. The class disables functionality that is normally needed for recipes that produce executable binaries (such as building the cross-compiler and a C library as pre-requisites, and splitting out of debug symbols during packaging).
Note
Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that produce packages that depend on tunings through use of the RDEPENDS and TUNE_PKGARCH variables, should never be configured for all architectures using allarch. This is the case even if the recipes do not produce architecture-specific output.
Configuring such recipes for all architectures causes the do_package_write_* tasks to have different signatures for the machines with different tunings. Additionally, unnecessary rebuilds occur every time an image for a different MACHINE is built even when the recipe never changes.
By default, all recipes inherit the base and package classes, which enable functionality needed for recipes that produce executable output. If your recipe, for example, only produces packages that contain configuration files, media files, or scripts (e.g. Python and Perl), then it should inherit the allarch class.
6.2 archiver
The archiver class supports releasing source code and other materials with the binaries.
For more details on the source archiver, see the “Maintaining Open Source License Compliance During Your Product’s Lifecycle” section in the Yocto Project Development Tasks Manual. You can also see the ARCHIVER_MODE variable for information about the variable flags (varflags) that help control archive creation.
6.3 autotools*
The autotools* classes support packages built with the GNU Autotools.
The autoconf, automake, and libtool packages bring
standardization. This class defines a set of tasks (e.g. configure,
compile and so forth) that work for all Autotooled packages. It
should usually be enough to define a few standard variables and then
simply inherit autotools. These classes can also work with software
that emulates Autotools. For more information, see the
“Building an Autotooled Package” section
in the Yocto Project Development Tasks Manual.
By default, the autotools* classes use out-of-tree builds (i.e.
autotools.bbclass building with B != S).
If the software being built by a recipe does not support using out-of-tree builds, you should have the recipe inherit the autotools-brokensep class. The autotools-brokensep class behaves the same as the autotools* class but builds with B == S. This method is useful when out-of-tree build support is either not present or is broken.
Note
It is recommended that out-of-tree support be fixed and used if at all possible.
It’s useful to have some idea of how the tasks defined by the autotools* classes work and what they do behind the scenes.
do_configure — regenerates the configure script (using
autoreconf) and then launches it with a standard set of arguments used during cross-compilation. You can pass additional parameters toconfigurethrough the EXTRA_OECONF or PACKAGECONFIG_CONFARGS variables.do_compile — runs
makewith arguments that specify the compiler and linker. You can pass additional arguments through the EXTRA_OEMAKE variable.do_install — runs
make installand passes in${D}asDESTDIR.
6.4 barebox
The barebox class manages building the barebox bootloader.
If a file named defconfig is included in the SRC_URI, it will be
copied to .config in the build directory and used as the barebox
configuration.
Instead of providing a defconfig file, you can set BAREBOX_CONFIG
to a defconfig provided by the barebox source tree.
If neither defconfig nor BAREBOX_CONFIG is specified, the class
will raise an error.
The barebox class supports config fragments and internally includes the cml1 class to provide Kconfig support for barebox, enabling tasks such as do_menuconfig and do_diffconfig.
The generated barebox binaries are deployed to
DEPLOY_DIR_IMAGE as well as installed to BAREBOX_INSTALL_PATH
(/boot by default) making them part of the recipe’s base package.
This setup supports both using the barebox binaries as independent artifacts
and installing them into a rootfs.
BAREBOX_BINARY can be used to select a distinct binary to deploy and
install.
If barebox is set as the EFI_PROVIDER, the class will leverage
conf/image-uefi.conf
to define the default installation paths and naming conventions.
The compiled-in barebox environment can be extended by adding environment files
to the BAREBOX_ENV_DIR.
The BAREBOX_FIRMWARE_DIR variable allows you to specify the firmware blob
search directory, enabling loading of additional firmware like TF-A or OP-TEE.
6.5 base
The base class is special in that every .bb file implicitly
inherits the class. This class contains definitions for standard basic
tasks such as fetching, unpacking, configuring (empty by default),
compiling (runs any Makefile present), installing (empty by default)
and packaging (empty by default). These tasks are often overridden or
extended by other classes such as the autotools* class or the
package class.
The class also contains some commonly used functions such as
oe_runmake, which runs make with the arguments specified in
EXTRA_OEMAKE variable as well as the
arguments passed directly to oe_runmake.
6.6 bash-completion
Sets up packaging and dependencies appropriate for recipes that build software that includes bash-completion data.
6.7 bin_package
The bin_package class is a helper class for recipes, that disables the do_configure and do_compile tasks and copies the content of the S directory into the D directory. This is useful for installing binary packages (e.g. RPM packages) by passing the package in the SRC_URI variable and inheriting this class.
For RPMs and other packages that do not contain a subdirectory, you should set
the SRC_URI option subdir to BP so that the contents are
extracted to the directory expected by the default value of S. For
example:
SRC_URI = "https://example.com/downloads/somepackage.rpm;subdir=${BP}"
This class can also be used for tarballs. For example:
SRC_URI = "file://somepackage.tar.xz;subdir=${BP}"
The bin_package class will copy the extracted content of the tarball from S to D.
This class assumes that the content of the package as installed in S
mirrors the expected layout once installed on the target, which is generally the
case for binary packages. For example, an RPM package for a library would
usually contain the usr/lib directory, and should be extracted to
${S}/usr/lib/<library>.so.<version> to be installed in D correctly.
Note
The extraction of the package passed in SRC_URI is not handled by the bin_package class, but rather by the appropriate fetcher depending on the file extension.
6.8 binconfig
The binconfig class helps to correct paths in shell scripts.
Before pkg-config had become widespread, libraries shipped shell
scripts to give information about the libraries and include paths needed
to build software (usually named LIBNAME-config). This class assists
any recipe using such scripts.
During staging, the OpenEmbedded build system installs such scripts into
the sysroots/ directory. Inheriting this class results in all paths
in these scripts being changed to point into the sysroots/ directory
so that all builds that use the script use the correct directories for
the cross compiling layout. See the
BINCONFIG_GLOB variable for more
information.
6.9 binconfig-disabled
An alternative version of the binconfig
class, which disables binary configuration scripts by making them return
an error in favor of using pkg-config to query the information. The
scripts to be disabled should be specified using the BINCONFIG
variable within the recipe inheriting the class.
6.10 buildhistory
The buildhistory class records a history of build output metadata, which can be used to detect possible regressions as well as used for analysis of the build output. For more information on using Build History, see the “Maintaining Build Output Quality” section in the Yocto Project Development Tasks Manual.