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 recent 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 Windows Subsystem For Linux v2 to set up a build host using Windows 10.
Note
The Yocto Project is not compatible with WSLv1, it is compatible but not officially supported nor validated with WSLv2, if you still decide to use WSL please upgrade to WSLv2.
See the Setting Up to Use Windows Subsystem For Linux (WSLv2) 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:
50 Gbytes of free disk space
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.
Git 1.8.3.1 or greater
tar 1.28 or greater
Python 3.6.0 or greater.
gcc 5.0 or greater.
If your build host does not meet any of these three listed 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 and gcc Versions section in the Yocto Project Reference Manual for information.
Build Host Packages
You must install essential host packages on your build host. The following command installs the host packages based on an Ubuntu distribution:
$ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit mesa-common-dev zstd liblz4-tool
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 Poky
Once you complete the setup instructions for your machine, you need to get a copy of the Poky repository on your build host. Use the following commands to clone the Poky repository.
$ git clone git://git.yoctoproject.org/poky
Cloning into 'poky'...
remote: Counting
objects: 432160, done. remote: Compressing objects: 100%
(102056/102056), done. remote: Total 432160 (delta 323116), reused
432037 (delta 323000) Receiving objects: 100% (432160/432160), 153.81 MiB | 8.54 MiB/s, done.
Resolving deltas: 100% (323116/323116), done.
Checking connectivity... done.
Go to Releases wiki page, and choose a release
codename (such as kirkstone
), corresponding to either the
latest stable release or a Long Term Support release.
Then move to the poky
directory and take a look at existing branches:
$ cd poky
$ git branch -a
.
.
.
remotes/origin/HEAD -> origin/master
remotes/origin/dunfell
remotes/origin/dunfell-next
.
.
.
remotes/origin/gatesgarth
remotes/origin/gatesgarth-next
.
.
.
remotes/origin/master
remotes/origin/master-next
.
.
.
For this example, check out the kirkstone
branch based on the
Kirkstone
release:
$ git checkout -t origin/kirkstone -b my-kirkstone
Branch 'my-kirkstone' set up to track remote branch 'kirkstone' from 'origin'.
Switched to a new branch 'my-kirkstone'
The previous Git checkout command creates a local branch named
my-kirkstone
. The files available to you in that branch
exactly match the repository’s files in the kirkstone
release branch.
Note that you can regularly type the following command in the same directory to keep your local files in sync with the release branch:
$ git pull
For more options and information about accessing Yocto Project related repositories, see the Locating Yocto Project Source Files section in 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: From within the
poky
directory, run the oe-init-build-env environment setup script to define Yocto Project’s build environment on your build host.$ cd poky $ source oe-init-build-env You had no conf/local.conf file. This configuration file has therefore been created for you with some default values. You may wish to edit it to, for example, select a different MACHINE (target hardware). See conf/local.conf for more information as common configuration options are commented. You had no conf/bblayers.conf file. This configuration file has therefore been created for you with some default values. To add additional metadata layers into your configuration please add entries to conf/bblayers.conf. The Yocto Project has extensive documentation about OE including a reference manual which can be found at: https://docs.yoctoproject.org For more information about OpenEmbedded see their website: https://www.openembedded.org/ ### Shell environment set up for builds. ### You can now run 'bitbake <target>' Common targets are: core-image-minimal core-image-full-cmdline core-image-sato core-image-weston meta-toolchain meta-ide-support You can also run generated QEMU images with a command like 'runqemu qemux86-64' Other commonly useful commands are: - 'devtool' and 'recipetool' handle common recipe tasks - 'bitbake-layers' handles common layer tasks - 'oe-pkgdata-util' handles common target package tasks
Among other things, the script creates the Build Directory, which is
build
in this case and is located in the Source Directory. After the script runs, your current working directory is set to the Build Directory. Later, when the build completes, the Build Directory contains all the files created during the build.Examine Your Local Configuration File: When you set up the build environment, a local configuration file named
local.conf
becomes available in aconf
subdirectory of the Build Directory. For this example, the defaults are set to build for aqemux86
target, which is suitable for emulation. The package manager used is set to the RPM package manager.Tip
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, uncomment the below lines in your
conf/local.conf
file in the Build Directory:BB_SIGNATURE_HANDLER = "OEEquivHash" BB_HASHSERVE = "auto" BB_HASHSERVE_UPSTREAM = "typhoon.yocto.io:8687" SSTATE_MIRRORS ?= "file://.* https://sstate.yoctoproject.org/4.0.1/PATH;downloadfilename=PATH"
The above settings assumed the use of Yocto Project 4.0.1. If you are using the development version instead, set SSTATE_MIRRORS as follows:
SSTATE_MIRRORS ?= "file://.* https://sstate.yoctoproject.org/dev/PATH;downloadfilename=PATH"
Start the Build: Continue with the following command to build an OS image for the target, which is
core-image-sato
in this example:$ bitbake core-image-sato
For information on using the
bitbake
command, 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-C
in 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 hardware layer:
Find a Layer: Many hardware layers are available. The Yocto Project Source Repositories has many hardware layers. This example adds the meta-altera hardware layer.
Clone the Layer: Use Git to make a local copy of the layer on your machine. You can put the copy in the top level of the copy of the Poky repository created earlier:
$ cd poky $ git clone https://github.com/kraj/meta-altera.git Cloning into 'meta-altera'... remote: Counting objects: 25170, done. remote: Compressing objects: 100% (350/350), done. remote: Total 25170 (delta 645), reused 719 (delta 538), pack-reused 24219 Receiving objects: 100% (25170/25170), 41.02 MiB | 1.64 MiB/s, done. Resolving deltas: 100% (13385/13385), done. Checking connectivity... done.
The hardware layer is now available next to other layers inside the Poky reference repository on your build host as
meta-altera
and contains all the metadata needed to support hardware from Altera, which is owned by Intel.Note
It is recommended for layers to have a branch per Yocto Project release. Please make sure to checkout the layer branch supporting the Yocto Project release you’re using.
Change the Configuration to Build for a Specific Machine: The MACHINE variable in the
local.conf
file specifies the machine for the build. For this example, set the MACHINE variable tocyclone5
. These configurations are used: https://github.com/kraj/meta-altera/blob/master/conf/machine/cyclone5.conf.Note
See the “Examine Your Local Configuration File” step earlier for more information on configuring the build.
Add Your Layer to the Layer Configuration File: Before you can use a layer during a build, you must add it to your
bblayers.conf
file, which is found in the Build Directoryconf
directory.Use the
bitbake-layers add-layer
command to add the layer to the configuration file:$ cd poky/build $ bitbake-layers add-layer ../meta-altera NOTE: Starting bitbake server... Parsing recipes: 100% |##################################################################| Time: 0:00:32 Parsing of 918 .bb files complete (0 cached, 918 parsed). 1401 targets, 123 skipped, 0 masked, 0 errors.
You can find more information on adding layers in the Adding a Layer Using the bitbake-layers Script section.
Completing these steps has added the meta-altera
layer to your Yocto
Project development environment and configured it to build for the
cyclone5
machine.
Note
The previous steps are for demonstration purposes only. If you were
to attempt to build an image for the cyclone5
machine, you should
read the Altera README
.
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
in the poky
directory:
$ cd poky
$ bitbake-layers create-layer meta-mylayer
NOTE: Starting bitbake server...
Add your new layer with 'bitbake-layers add-layer meta-mylayer'
For more information on layers and how to create them, see the Creating a General Layer Using the bitbake-layers Script 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 index. 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 POKY layer. 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.
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 curated layer index 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 file (build/local.conf) to point to that same machine type. There could be other layer-specific settings you need to change as well. Each layer has a
README
document 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-layer
tool for Yocto Project 2.4+ releases. If you are using a Yocto Project release earlier than 2.4, use theyocto-layer create
tool. Thebitbake-layers
tool also provides a number of other useful layer-related commands. See Creating a General Layer Using the bitbake-layers Script 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 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.
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, IPK, and TAR). You can deploy these packages into the running system on the target by using utilities on the target such as
rpm
oripk
.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 curated layer index 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 poky
repository, you will see several layers: meta
,
meta-skeleton
, meta-selftest
, meta-poky
, and
meta-yocto-bsp
. 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
devtool
to 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
devtool
command 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 upgrade
command updates an existing recipe so that you can build it for an updated set of source files.You can read about the
devtool
workflow 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
devtool
commands 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.
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 Poky.
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 Yocto Project 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.
Sharing a core set of metadata results in Poky as an integration layer on top of OE-Core. You can see that in this figure. The Yocto Project combines various components such as BitBake, OE-Core, script “glue”, and documentation for its build system.
2.3.4 Reference Distribution (Poky)
Poky is the Yocto Project reference distribution. It contains the OpenEmbedded Build System (BitBake and OE-Core) as well as a set of metadata to get you started building your own distribution. See the figure in “What is the Yocto Project?” section for an illustration that shows Poky and its relationship with other parts of the Yocto Project.
To use the Yocto Project tools and components, you can download
(clone
) Poky and use it to bootstrap your own distribution.
Note
Poky does not contain binary files. It is a working example of how to build your own custom Linux distribution from source.
You can read more about Poky in the “Reference Embedded Distribution (Poky)” section.
2.3.5 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.6 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 (WSLv2): You may use Windows Subsystem For Linux v2 to set up a Build Host using Windows 10.
Note
The Yocto Project is not compatible with WSLv1, it is compatible but not officially supported nor validated with WSLv2, if you still decide to use WSL please upgrade to WSLv2.
The Windows Subsystem For Linux allows Windows 10 to run a real Linux kernel inside of a lightweight virtual machine (VM).
For information on how to set up a Build Host with WSLv2, see the “Setting Up to Use Windows Subsystem For Linux (WSLv2)” 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.
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. Poky contains the OpenEmbedded Build System (BitBake and OpenEmbedded-Core (OE-Core)) as well as a set of Metadata to get you started building your own distro. In other words, Poky is a base specification of the functionality needed for a typical embedded system as well as the components from the Yocto Project that allow you to build a distribution into a usable binary image.
Poky is a combined repository of BitBake, OpenEmbedded-Core (which is
found in meta
), meta-poky
, meta-yocto-bsp
, and documentation
provided all together and known to work well together. You can view
these items that make up the Poky repository in the
Source Repositories.
Note
If you are interested in all the contents of the poky Git repository, see the “Top-Level Core Components” section in the Yocto Project Reference Manual.
The following figure illustrates what generally comprises Poky:

BitBake is a task executor and scheduler that is the heart of the OpenEmbedded build system.
meta-poky
, which is Poky-specific metadata.meta-yocto-bsp
, which are Yocto Project-specific Board Support Packages (BSPs).OpenEmbedded-Core (OE-Core) metadata, which includes shared configurations, global variable definitions, shared classes, packaging, and recipes. Classes define the encapsulation and inheritance of build logic. Recipes are the logical units of software and images to be built.
Documentation, which contains the Yocto Project source files used to make the set of user manuals.
Note
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.
To use the Yocto Project tools, you can use Git to clone (download) the Poky repository then use your local copy of the reference distribution to bootstrap your own distribution.
Note
Poky does not contain binary files. It is a working example of how to build your own custom Linux distribution from source.
Poky has a regular, well established, six-month release cycle under its own version. Major releases occur at the same time major releases (point releases) occur for the Yocto Project, which are typically in the Spring and Fall. For more information on the Yocto Project release schedule and cadence, see the “Yocto Project Releases and the Stable Release Process” chapter in the Yocto Project Reference Manual.
Much has been said about Poky being a “default configuration”. A default configuration provides a starting image footprint. You can use Poky out of the box to create an image ranging from a shell-accessible minimal image all the way up to a Linux Standard Base-compliant image that uses a GNOME Mobile and Embedded (GMAE) based reference user interface called Sato.
One of the most powerful properties of Poky is that every aspect of a build is controlled by the metadata. You can use metadata to augment these base image types by adding metadata layers <overview-manual/yp-intro:the yocto project layer model> that extend functionality. These layers can provide, for example, an additional software stack for an image type, add a board support package (BSP) for additional hardware, or even create a new image type.
Metadata is loosely grouped into configuration files or package recipes.
A recipe is a collection of non-executable metadata used by BitBake to
set variables or define additional build-time tasks. A recipe contains
fields such as the recipe description, the recipe version, the license
of the package and the upstream source repository. A recipe might also
indicate that the build process uses autotools, make, distutils or any
other build process, in which case the basic functionality can be
defined by the classes it inherits from the OE-Core layer’s class
definitions in ./meta/classes
. Within a recipe you can also define
additional tasks as well as task prerequisites. Recipe syntax through
BitBake also supports both :prepend
and :append
operators as a
method of extending task functionality. These operators inject code into
the beginning or end of a task. For information on these BitBake
operators, see the
“Appending and Prepending (Override Style Syntax)”
section in the BitBake User’s 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:

Following 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 Extensible SDK (eSDK) 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
make
tool.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
meta
directory 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 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).
A vehicle through which you can download the Yocto Project.
Poky is not a product level distro. Rather, it is a good starting point for customization.
Note
Poky is an integration layer on top of OE-Core.
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 here. 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 usingdevtool
makes 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.
3.3 Yocto Project Source Repositories
The Yocto Project team maintains complete source repositories for all Yocto Project files at https://git.yoctoproject.org/cgit/cgit.cgi/. 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 repository of the Source Directory, which is usually named “poky”, 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 “DOWNLOADS”
item from the “SOFTWARE” menu and get a released tarball of the poky
repository, 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 Source Directory and the files for supported BSPs (e.g.,
meta-intel
) 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 and the Source Directory (i.e.
poky
) repository. For example, if you have checked out the “kirkstone” branch ofpoky
and you are going to usemeta-intel
, be sure to checkout the “kirkstone” branch ofmeta-intel
.
In summary, here is where you can get the project files needed for development:
Source Repositories: This area contains IDE Plugins, Matchbox, Poky, Poky Support, Tools, Yocto Linux Kernel, and Yocto Metadata Layers. You can create local copies of Git repositories for each of these areas.
For steps on how to view and access these upstream Git repositories, see the “Accessing Source Repositories” Section in the Yocto Project Development Tasks Manual.
Index of /releases: This is an index of releases such as Poky, Pseudo, installers for cross-development toolchains, miscellaneous support and all released versions of Yocto Project in the form of images or tarballs. Downloading and extracting these files does not produce a local copy of the Git repository but rather a snapshot of a particular release or image.
For steps on how to view and access these files, see the “Accessing Index of Releases” section in the Yocto Project Development Tasks Manual.
“DOWNLOADS” page for the Yocto Project Website :
The Yocto Project website includes a “DOWNLOADS” page accessible through the “SOFTWARE” menu that allows you to download any Yocto Project release, tool, and Board Support Package (BSP) in tarball form. The tarballs are similar to those found in the Index of /releases: area.
For steps on how to use the “DOWNLOADS” page, see the “Using the Downloads Page” section in the Yocto Project Development Tasks Manual.
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 “Submitting a Change to the Yocto Project” section of the Yocto Project Development Tasks Manual.
The Yocto Project poky
Git repository also has an upstream
contribution Git repository named poky-contrib
. You can see all the
branches in this repository using the web interface of the
Source Repositories organized within the “Poky Support”
area. 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 “Submitting a Change to the Yocto Project” section in the Yocto Project Development Tasks Manual.
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 merge
command 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-request
andsend-pull-request
that ship with the release to facilitate this workflow. You can find these scripts in thescripts
folder of the Source Directory. 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 Development Tasks Manual.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-patch
andgit send-email
. For information on how to use these scripts, see the “Submitting a Change to the Yocto Project” section in the Yocto Project Development Tasks Manual.
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.
For information beyond the introductory nature in this section, see the “Locating Yocto Project Source Files” section in the Yocto Project Development Tasks Manual.
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
.git
repository.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 “kirkstone” branch). The
--rebase
option 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 merge
command 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. MIT is also compatible with the GNU General Public License (GPL). Patches to the Yocto Project follow the upstream licensing scheme. You can find information on the MIT license here. You can find information on the GNU GPL 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
the Source Directory 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 your
Source Directory.
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.
Following 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
or .deb
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 Autotools uses.
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 Curated 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
Source Directory. For simplicity,
this section refers to the Source Directory as the “Poky Directory.”
When you clone the Poky Git repository
or you download and unpack a Yocto Project release, you can set up the
Source Directory to be named anything you want. For this discussion, the
cloned repository uses the default name poky
.
Note
The Poky repository is primarily an aggregation of existing repositories. It is not a canonical upstream source.
The meta-poky
layer inside Poky contains a conf
directory that
has example configuration files. These example files are used as a basis
for creating actual configuration files when you source
oe-init-build-env, which is the
build environment script.
Sourcing the build environment script 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 versions do not already exist in the Build Directory at the time you
source the build environment setup script.
Because the Poky repository is fundamentally an aggregation of existing repositories, some users might be familiar with running the oe-init-build-env script in the context of separate OpenEmbedded-Core (OE-Core) and BitBake repositories rather than a single Poky repository. This discussion assumes the script is executed from within a cloned or unpacked version of Poky.
Depending on where the script is sourced, different sub-scripts are
called to set up the Build Directory (Yocto or OpenEmbedded).
Specifically, the script scripts/oe-setup-builddir
inside the poky
directory sets up the Build Directory and seeds the directory (if
necessary) with configuration files appropriate for the Yocto Project
development environment.
Note
The
scripts/oe-setup-builddir
script uses the
$TEMPLATECONF
variable to determine which sample configuration files to locate.
The local.conf
file provides many basic variables that define a
build environment. Here is a list of a few. To see the default
configurations in a local.conf
file created by the build environment
script, see the
local.conf.sample
in the meta-poky
layer:
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.
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 that yourself. The auto.conf
file is typically
created by an autobuilder:
site.conf: You can use the
conf/site.conf
configuration 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.One useful scenario for using the
conf/site.conf
file is to extend your BBPATH variable to include the path to aconf/site.conf
. Then, when BitBake looks for Metadata using BBPATH, it finds theconf/site.conf
file and applies your common configurations found in the file. To override configurations in a particular build directory, alter the similar configurations within that build directory’sconf/local.conf
file.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.conf
or theconf/site.conf
files.
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 <overview-manual/concepts:openembedded build system concepts>:
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 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/distro
directory 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
The 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 the distribution layer:
classes: 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-core
andrecipes-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
The 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.
The 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
The 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 the local.conf
or a recipe’s append file to override or set the recipe to point to the
local directory on your disk to pull in the whole source tree.
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/deploy
in 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, DEPLOY_DIR_DEB, or DEPLOY_DIR_TAR, 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”,
“do_package_write_rpm”,
and
“do_package_write_tar”
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 S variable points to this area for a recipe’s unpacked source code. The name of that directory for any given recipe is defined from several different variables. 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
tmp
directory.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).
S: Contains the unpacked source files for a given recipe.
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-sysroot
andrecipe-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 thedo_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).
The FILES variable defines the files that go into each package in PACKAGES. If you want details on how this is accomplished, you can look at package.bbclass.
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.
*.ext3
or*.bz2
files). 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. Here are the variables
associated with an extensible SDK:
DEPLOY_DIR: Points to the
deploy
directory.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
deploy
directory.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 imagename
to 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).
SDKPATH: 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 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
. The gcc-cross
compiler is what
BitBake uses to compile source files when creating the target image. You
can think of gcc-cross
simply as an automatically generated
cross-compiler that is used internally within BitBake only.
Note
The extensible SDK does not use gcc-cross-canadian
since this SDK ships a copy of the OpenEmbedded build system and the
sysroot within it contains gcc-cross
.
The chain of events that occurs when the standard toolchain is bootstrapped:
binutils-cross -> linux-libc-headers -> gcc-cross -> libgcc-initial -> glibc -> libgcc -> gcc-runtime
gcc
: The compiler, GNU Compiler Collection (GCC).binutils-cross
: The binary utilities needed in order to run thegcc-cross
phase 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.libgcc-initial
: An initial version of the gcc support library needed to bootstrapglibc
.libgcc
: The final version of the gcc support library which can only be built once there is a C library to link against.glibc
: The GNU C Library.gcc-cross
: 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).
gcc-runtime
: 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
, 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 -> binutils-crosssdk -> gcc-crosssdk-initial -> linux-libc-headers -> glibc-initial -> nativesdk-glibc -> gcc-crosssdk -> gcc-cross-canadian
gcc
: The build host’s GNU Compiler Collection (GCC).binutils-crosssdk
: The bare minimum binary utilities needed in order to run thegcc-crosssdk-initial
phase of the bootstrap operation.gcc-crosssdk-initial
: An early stage of the bootstrap process for creating the cross-compiler. This stage builds enough of thegcc-crosssdk
and supporting pieces so that the final stage of the bootstrap process can produce the finished cross-compiler. This tool is a “native” binary that runs on the build host.linux-libc-headers
: Headers needed for the cross-compiler.glibc-initial
: An initial version of the Embedded GLIBC needed to bootstrapnativesdk-glibc
.nativesdk-glibc
: The Embedded GLIBC needed to bootstrap thegcc-crosssdk
.gcc-crosssdk
: The final stage of the bootstrap process for the relocatable cross-compiler. Thegcc-crosssdk
is a transitory compiler and never leaves the build host. Its purpose is to help in the bootstrap process to create the eventualgcc-cross-canadian
compiler, which is relocatable. This tool is also a “native” package (i.e. it is designed to run on the build host).gcc-cross-canadian
: 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
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 thedo_package
task of each recipe, all pkg-config modules (*.pc
files) 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 thedo_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 packagefoo
depends on a packagebar
, thenfoo-dev
andfoo-dbg
are also made to depend onbar-dev
andbar-dbg
, respectively. Taking the-dev
packages as an example, thebar-dev
package might provide headers and shared library symlinks needed byfoo-dev
, which shows the need for a dependency between the packages.The dependencies added by
depchains
are in the form of RRECOMMENDS.Note
By default,
foo-dev
also has an RDEPENDS-style dependency onfoo
, because the default value ofRDEPENDS:${PN}-dev
(set in bitbake.conf) includes “${PN}”.To ensure that the dependency chain is never broken,
-dev
and-dbg
packages 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.
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 Supported Linux Distributions
Currently, the Yocto Project is supported on the following distributions:
Ubuntu 18.04 (LTS)
Ubuntu 20.04 (LTS)
Fedora 34
Fedora 35
CentOS 7.x
CentOS 8.x
AlmaLinux 8.5
Debian GNU/Linux 9.x (Stretch)
Debian GNU/Linux 10.x (Buster)
Debian GNU/Linux 11.x (Bullseye)
OpenSUSE Leap 15.3
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 below.
You may use Windows Subsystem For Linux v2 to set up a build host using Windows 10, but validation is not performed against build hosts using WSLv2.
The Yocto Project is not compatible with WSLv1, it is compatible but not officially supported nor validated with WSLv2, if you still decide to use WSL please upgrade to WSLv2.
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 “Submitting a Defect Against the Yocto Project” section in the Yocto Project Development Tasks Manual.
1.2 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.2.1 Ubuntu and Debian
Here are the required packages by function given a supported Ubuntu or Debian Linux distribution:
Note
If your build system has the
oss4-dev
package installed, you might experience QEMU build failures due to the package installing its own custom/usr/include/linux/soundcard.h
on the Debian system. If you run into this situation, try either of these solutions:$ sudo apt build-dep qemu $ sudo apt remove oss4-dev
For Debian-8,
python3-git
andpylint3
are no longer available viaapt
.$ sudo pip3 install GitPython pylint==1.9.5
Essentials: Packages needed to build an image on a headless system:
$ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm python3-subunit mesa-common-dev zstd liblz4-tool
Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:
$ sudo apt install make python3-pip $ sudo pip3 install sphinx sphinx_rtd_theme pyyaml
Note
It is currently not possible to build out documentation from Debian 8 (Jessie) because of outdated
pip3
andpython3
.python3-sphinx
is too outdated.
1.2.2 Fedora Packages
Here are the required packages by function given a supported Fedora Linux distribution:
Essentials: Packages needed to build an image for a headless system:
$ sudo dnf install gawk make wget tar bzip2 gzip python3 unzip perl patch diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue perl-bignum socat python3-pexpect findutils which file cpio python python3-pip xz python3-GitPython python3-jinja2 SDL-devel xterm rpcgen mesa-libGL-devel perl-FindBin perl-File-Compare perl-File-Copy perl-locale zstd lz4
Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:
$ sudo dnf install make python3-pip which $ sudo pip3 install sphinx sphinx_rtd_theme pyyaml
1.2.3 openSUSE Packages
Here are the required packages by function given a supported openSUSE Linux distribution:
Essentials: Packages needed to build an image for a headless system:
$ sudo zypper install python gcc gcc-c++ git chrpath make wget python-xml diffstat makeinfo python-curses patch socat python3 python3-curses tar python3-pip python3-pexpect xz which python3-Jinja2 Mesa-libEGL1 libSDL-devel xterm rpcgen Mesa-dri-devel zstd lz4 $ sudo pip3 install GitPython
Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:
$ sudo zypper install make python3-pip which $ sudo pip3 install sphinx sphinx_rtd_theme pyyaml
1.2.4 CentOS-7 Packages
Here are the required packages by function given a supported CentOS-7 Linux distribution:
Essentials: Packages needed to build an image for a headless system:
$ sudo yum install -y epel-release $ sudo yum makecache $ sudo yum install gawk make wget tar bzip2 gzip python3 unzip perl patch diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath socat perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3-pip xz which SDL-devel xterm mesa-libGL-devel zstd lz4 $ sudo pip3 install GitPython jinja2
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
makecache
command consumes additional Metadata fromepel-release
.
Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:
$ sudo yum install make python3-pip which $ sudo pip3 install sphinx sphinx_rtd_theme pyyaml
1.2.5 CentOS-8 Packages
Here are the required packages by function given a supported CentOS-8 Linux distribution:
Essentials: Packages needed to build an image for a headless system:
$ sudo dnf install -y epel-release $ sudo dnf config-manager --set-enabled PowerTools $ sudo dnf makecache $ sudo dnf install gawk make wget tar bzip2 gzip python3 unzip perl patch diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath ccache socat perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3-pip python3-GitPython python3-jinja2 python3-pexpect xz which SDL-devel xterm rpcgen mesa-libGL-devel zstd lz4
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
repo provides additional packages such asrpcgen
andtexinfo
.The
makecache
command consumes additional Metadata fromepel-release
.
Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:
$ sudo dnf install make python3-pip which $ sudo pip3 install sphinx sphinx_rtd_theme pyyaml
1.3 Required Git, tar, Python 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.6.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 get the tarball one of two ways: download
a pre-built tarball or use BitBake to build the tarball.
In addition, your host development system must meet the following version requirement for gcc:
gcc 5.0 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.
In the sections that follow, three different methods will be described for
installing the buildtools
or buildtools-extended
toolset.
1.3.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-buildtools
script. Here is an example:$ cd poky $ scripts/install-buildtools \ --without-extended-buildtools \ --base-url https://downloads.yoctoproject.org/releases/yocto \ --release yocto-4.0.1 \ --installer-version 4.0.1
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
sudo
privileges, theinstall-buildtools
script will by default tell the installer to install in:/path/to/poky/buildtools
If your host development system needs the additional tools provided in the
buildtools-extended
tarball, you can instead execute theinstall-buildtools
script with the default parameters:$ cd poky $ scripts/install-buildtools
Source the tools environment setup script by using a command like the following:
$ source /path/to/poky/buildtools/environment-setup-x86_64-pokysdk-linux
Of course, you need to supply your installation directory and be sure to use the right file (i.e. i586 or x86_64).
After you have sourced the setup script, the tools are added to
PATH
and 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 thebuildtools-extended
tarball, additional working versions of tools includinggcc
,make
and the other tools included inpackagegroup-core-buildessential
.
1.3.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:
Locate and download the
*.sh
at https://downloads.yoctoproject.org/releases/yocto/yocto-4.0.1/buildtools/Execute the installation script. Here is an example for the traditional installer:
$ sh ~/Downloads/x86_64-buildtools-nativesdk-standalone-4.0.1.sh
Here is an example for the extended installer:
$ sh ~/Downloads/x86_64-buildtools-extended-nativesdk-standalone-4.0.1.sh
During execution, a prompt appears that allows you to choose the installation directory. For example, you could choose the following:
/home/your-username/buildtools
Source the tools environment setup script by using a command like the following:
$ source /home/your_username/buildtools/environment-setup-i586-poky-linux
Of course, you need to supply your installation directory and be sure to use the right file (i.e. i585 or x86-64).
After you have sourced the setup script, the tools are added to
PATH
and 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 thebuildtools-extended
tarball, additional working versions of tools includinggcc
,make
and the other tools included inpackagegroup-core-buildessential
.
1.3.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 run the BitBake command to build the extended tarball:
$ bitbake buildtools-extended-tarball
Note
The SDKMACHINE variable in your
local.conf
file determines whether you build tools for a 32-bit or 64-bit system.Once the build completes, you can find the
.sh
file that installs the tools in thetmp/deploy/sdk
subdirectory of the Build Directory. The installer file has the string “buildtools” (or “buildtools-extended”) in the name.Transfer the
.sh
file from the build host to the machine that does not meet the Git, tar, or Python (or gcc) requirements.On the machine that does not meet the requirements, run the
.sh
file to install the tools. Here is an example for the traditional installer:$ sh ~/Downloads/x86_64-buildtools-nativesdk-standalone-4.0.1.sh
Here is an example for the extended installer:
$ sh ~/Downloads/x86_64-buildtools-extended-nativesdk-standalone-4.0.1.sh
During execution, a prompt appears that allows you to choose the installation directory. For example, you could choose the following:
/home/your_username/buildtools
Source the tools environment setup script by using a command like the following:
$ source /home/your_username/buildtools/environment-setup-x86_64-poky-linux
Of course, you need to supply your installation directory and be sure to use the right file (i.e. i586 or x86_64).
After you have sourced the setup script, the tools are added to
PATH
and 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 thebuildtools-extended
tarball, additional working versions of tools includinggcc
,make
and the other tools included inpackagegroup-core-buildessential
.
2 Yocto Project Terms
Following 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
.bbappend
files. 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.bb
andformfactor_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.bb
version 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
source
the setup environment script that is found in the Source Directory (i.e. oe-init-build-env). The TOPDIR variable points to the Build Directory.You have a lot of flexibility when creating the Build Directory. Following are some examples that show how to create the directory. The examples assume your Source Directory is named
poky
:Create the Build Directory inside your Source Directory and let the name of the Build Directory default to
build
:$ cd poky $ source oe-init-build-env
Create the Build Directory inside your home directory and specifically name it
test-builds
:$ source poky/oe-init-build-env test-builds
Provide a directory path and specifically name the Build Directory. Any intermediate folders in the pathname must exist. This next example creates a Build Directory named
YP-4.0.1
within the existing directorymybuilds
:$ source poky/oe-init-build-env mybuilds/YP-4.0.1
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
local.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.
- 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
.bbclass
filename 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
.conf
filename extension. Theconf/local.conf
configuration file in the Build Directory contains user-defined variables that affect every build. Themeta-poky/conf/distro/poky.conf
configuration 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.conf
configuration file defines variables for the Texas Instruments ARM Cortex-A8 development board).- 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.conf
file.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.conf
file; rather, you would include any number of its layer subdirectories, such as meta-openembedded/meta-oe, meta-openembedded/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.conf
file.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.
- 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.
- 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.
- 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 see the Metadata in the
meta
directory of the Yocto Project Source Repositories.- OpenEmbedded Build System
The build system specific to the Yocto Project. The OpenEmbedded build system is based on another project known as “Poky”, which uses BitBake as the task executor. Throughout the Yocto Project documentation set, 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.
- 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
.bb
filename 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).
A vehicle through which you can download the Yocto Project.
Poky is not a product level distro. Rather, it is a good starting point for customization.
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
.bb
file 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.
- Source Directory
This term refers to the directory structure created as a result of creating a local copy of the
poky
Git repositorygit://git.yoctoproject.org/poky
or expanding a releasedpoky
tarball.Note
Creating a local copy of the poky Git repository is the recommended method for setting up your Source Directory.
Sometimes you might hear the term “poky directory” used to refer to this directory structure.
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, Documentation, Metadata 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.
When you create a local copy of the Git repository, you can name the repository anything you like. Throughout much of the documentation, “poky” is used as the name of the top-level folder of the local copy of the poky Git repository. So, for example, cloning the
poky
Git repository results in a local Git repository whose top-level folder is also named “poky”.While it is not recommended that you use tarball extraction to set up the Source Directory, if you do, the top-level directory name of the Source Directory is derived from the Yocto Project release tarball. For example, downloading and unpacking poky tarballs from https://downloads.yoctoproject.org/releases/yocto/yocto-4.0.1/ results in a Source Directory whose root folder is named poky.
It is important to understand the differences between the Source Directory created by unpacking a released tarball as compared to cloning
git://git.yoctoproject.org/poky
. When you unpack a tarball, you have an exact copy of the files based on the time of release - a fixed release point. Any changes you make to your local files in the Source Directory are on top of the release and will remain local only. On the other hand, when you clone thepoky
Git repository, you have an active development repository with access to the upstream repository’s branches and tags. In this case, any local changes you make to the local Source Directory can be later applied to active development branches of the upstreampoky
Git repository.For more information on concepts related to Git repositories, branches, and tags, see the “Repositories, Tags, and Branches” section in the Yocto Project Overview and Concepts Manual.
- 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.
3 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.
3.1 Major and Minor Release Cadence
The Yocto Project delivers major releases (e.g. 4.0.1) using a six month cadence roughly timed each April and October of the year. Following 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.
2.2 (Morty)
2.1 (Krogoth)
2.0 (Jethro)
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. Following are some example past point releases:
2.1.1
2.1.2
2.2.1
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.
3.2 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. 4.0.1) 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 at https://wiki.yoctoproject.org/wiki/Releases.
Our Release Information detail how to migrate from one release of the Yocto Project to the next.
3.3 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.
Stable release branches have strong maintenance for about a year after their initial release. Should significant issues be found for any release regardless of its age, fixes could be backported to older releases. For issues that are not backported given an older release, Community LTS trees and branches allow community members to share patches for older releases. However, these types of patches do not go through the same release process as do point releases. You can find more information about stable branch maintenance at https://wiki.yoctoproject.org/wiki/Stable_branch_maintenance.
3.4 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 Development Tasks 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.bbclass: This automatically included class checks the build environment for missing tools (e.g.
gcc
) or common misconfigurations such as MACHINE set incorrectly.insane.bbclass: 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*.bbclass: 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 combination BitBake invocations. These tests operate outside the OpenEmbedded build system itself. Theoe-selftest
can run all tests by default or can run selected tests or test suites.Note
Running
oe-selftest
requires host packages beyond the “Essential” grouping. See the Required Packages for the Build Host section for more information.
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 (https://autobuilder.yoctoproject.org)
publicly tests each Yocto Project release’s code in the
OpenEmbedded-Core (OE-Core), Poky, 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
“ross/mut” branch in the poky-contrib
repository (i.e. the
master-under-test branch) or in the “master-next” branch in the poky
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.
4 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.
For information on how to establish a local Source Directory on your development system, see the “Locating Yocto Project Source Files” section in the Yocto Project Development Tasks 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.
4.1 Top-Level Core Components
This section describes the top-level components of the Source Directory.
4.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.
4.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.
4.1.3 documentation/
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.
4.1.4 meta/
This directory contains the minimal, underlying OpenEmbedded-Core
metadata. The directory holds recipes, common classes, and machine
configuration for strictly emulated targets (qemux86
, qemuarm
,
and so forth.)
4.1.5 meta-poky/
Designed above the meta/
content, this directory adds just enough
metadata to define the Poky reference distribution.
4.1.6 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.
4.1.7 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.
4.1.8 meta-skeleton/
This directory contains template recipes for BSP and kernel development.
4.1.9 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
.
4.1.10 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'
The default output of the oe-init-build-env
script is from the
conf-notes.txt
file, which is found in the meta-poky
directory
within the Source Directory. If you design a
custom distribution, you can include your own version of this
configuration file to mention 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-poky/conf/
directory in the Source
Directory. 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.
4.1.11 LICENSE, README, and README.hardware
These files are standard top-level files.
4.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.
4.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.
4.2.2 build/conf/local.conf
This configuration file contains all the local user configurations for
your build environment. The local.conf
file contains documentation
on the various configuration options. Any variable set here overrides
any variable set elsewhere within the environment unless that variable
is hard-coded within a file (e.g. by using ‘=’ instead of ‘?=’). Some
variables are hard-coded for various reasons but such variables are
relatively rare.
At a minimum, you would normally edit this file to select the target MACHINE, which package types you wish to use (PACKAGE_CLASSES), and the location from which you want to access downloaded files (DL_DIR).
If local.conf
is not present when you start the build, the
OpenEmbedded build system creates it from local.conf.sample
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 meta-poky/conf/
when you are building from the Yocto Project development environment,
and to meta/conf/
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
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
scripts/oe-setup-builddir
script in the Source Directory.
You can find the Yocto Project version of the local.conf.sample
file in
the meta-poky/conf
directory.
4.2.3 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.
If bblayers.conf
is not present when you start the build, the
OpenEmbedded build system creates it from bblayers.conf.sample
when
you source
the top-level build environment setup script (i.e.
oe-init-build-env).
As with the local.conf
file, the source bblayers.conf.sample
file used depends on the $TEMPLATECONF
script variable, which
defaults to meta-poky/conf/
when you are building from the Yocto
Project development environment, and to meta/conf/
when you are
building from the OpenEmbedded-Core environment. 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
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 scripts/oe-setup-builddir
script in the Source Directory. You can find the Yocto Project
version of the bblayers.conf.sample
file in the meta-poky/conf/
directory.
4.2.4 build/cache/sanity_info
This file indicates the state of the sanity checks and is created during the build.
4.2.5 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.
4.2.6 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.
4.2.7 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.
4.2.8 build/tmp/buildstats/
This directory stores the build statistics.
4.2.9 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.
4.2.10 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.
4.2.11 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.
4.2.12 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.
4.2.13 build/tmp/deploy/ipk/
This directory receives .ipk
packages produced by the build process.
4.2.14 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.
4.2.15 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
4.2.16 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.
4.2.17 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.
4.2.18 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
.
4.2.19 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.
4.2.20 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. Following 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.
4.2.21 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.
4.2.22 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 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/
.
4.2.23 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_order
file, 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 thedo_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}
).
4.3 The Metadata - meta/
As mentioned previously, Metadata is the core of the Yocto Project. Metadata has several important subdivisions:
4.3.1 meta/classes/
This directory contains the *.bbclass
files. Class files are used to
abstract common code so it can be reused by multiple packages. Every
package inherits the base.bbclass file. Examples of other important
classes are autotools*.bbclass, which in theory allows any
Autotool-enabled package to work with the Yocto Project with minimal
effort. Another example is kernel.bbclass 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.bbclass, rootfs*.bbclass and
package*.bbclass.
For reference information on classes, see the “Classes” chapter.
4.3.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.
4.3.3 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.
4.3.4 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.
4.3.5 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.
4.3.6 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.
4.3.7 meta/lib/
This directory contains OpenEmbedded Python library code used during the build process.
4.3.8 meta/recipes-bsp/
This directory contains anything linking to specific hardware or hardware configuration information such as “u-boot” and “grub”.
4.3.9 meta/recipes-connectivity/
This directory contains libraries and applications related to communication with other devices.
4.3.10 meta/recipes-core/
This directory contains what is needed to build a basic working Linux image including commonly used dependencies.
4.3.11 meta/recipes-devtools/
This directory contains tools that are primarily used by the build system. The tools, however, can also be used on targets.
4.3.12 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.
4.3.13 meta/recipes-gnome/
This directory contains all things related to the GTK+ application framework.
4.3.14 meta/recipes-graphics/
This directory contains X and other graphically related system libraries.
4.3.15 meta/recipes-kernel/
This directory contains the kernel and generic applications and libraries that have strong kernel dependencies.
4.3.16 meta/recipes-multimedia/
This directory contains codecs and support utilities for audio, images and video.
4.3.17 meta/recipes-rt/
This directory contains package and image recipes for using and testing
the PREEMPT_RT
kernel.
4.3.18 meta/recipes-sato/
This directory contains the Sato demo/reference UI/UX and its associated applications and configuration data.
4.3.19 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).
4.3.20 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.
4.3.21 meta/recipes.txt
This file is a description of the contents of recipes-*
.
5 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.
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 a classes/
directory beneath
the meta*/
directory found in the Source Directory.
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
directory in the Source
Directory. You can reference the .bbclass
files directly for more
information.
5.1 allarch.bbclass
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.
5.2 archiver.bbclass
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.
5.3 autotools*.bbclass
The autotools*
classes support Autotooled packages.
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
“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 toconfigure
through the EXTRA_OECONF or PACKAGECONFIG_CONFARGS variables.do_compile - Runs
make
with arguments that specify the compiler and linker. You can pass additional arguments through the EXTRA_OEMAKE variable.do_install - Runs
make install
and passes in${
D}
asDESTDIR
.
5.4 base.bbclass
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 classes 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
.
5.5 bash-completion.bbclass
Sets up packaging and dependencies appropriate for recipes that build software that includes bash-completion data.
5.6 bin_package.bbclass
The bin_package
class is a helper class for recipes that extract the
contents of a binary package (e.g. an RPM) and install those contents
rather than building the binary from source. The binary package is
extracted and new packages in the configured output package format are
created. Extraction and installation of proprietary binaries is a good
example use for this class.
Note
For RPMs and other packages that do not contain a subdirectory, you
should specify an appropriate fetcher parameter to point to the
subdirectory. For example, if BitBake is using the Git fetcher (git://
),
the “subpath” parameter limits the checkout to a specific subpath
of the tree. Here is an example where ${BP}
is used so that the files
are extracted into the subdirectory expected by the default value of
S:
SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=main;subpath=${BP}"
See the “Fetchers” section in the BitBake User Manual for more information on supported BitBake Fetchers.
5.7 binconfig.bbclass
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.
5.8 binconfig-disabled.bbclass
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.
5.9 buildhistory.bbclass
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.
5.10 buildstats.bbclass
The buildstats
class records performance statistics about each task
executed during the build (e.g. elapsed time, CPU usage, and I/O usage).
When you use this class, the output goes into the
BUILDSTATS_BASE directory, which defaults
to ${TMPDIR}/buildstats/
. You can analyze the elapsed time using
scripts/pybootchartgui/pybootchartgui.py
, which produces a cascading
chart of the entire build process and can be useful for highlighting
bottlenecks.
Collecting build statistics is enabled by default through the
USER_CLASSES variable from your
local.conf
file. Consequently, you do not have to do anything to
enable the class. However, if you want to disable the class, simply
remove “buildstats” from the USER_CLASSES list.
5.11 buildstats-summary.bbclass
When inherited globally, prints statistics at the end of the build on sstate re-use. In order to function, this class requires the buildstats class be enabled.
5.12 ccache.bbclass
The ccache
class enables the C/C++ Compiler Cache for the build.
This class is used to give a minor performance boost during the build.
See https://ccache.samba.org/ for information on the C/C++ Compiler
Cache, and the ccache.bbclass
file for details about how to enable this mechanism in your configuration
file, how to disable it for specific recipes, and how to share ccache
files between builds.
However, using the class can lead to unexpected side-effects. Thus, using this class is not recommended.
5.13 chrpath.bbclass
The chrpath
class is a wrapper around the “chrpath” utility, which
is used during the build process for nativesdk
, cross
, and
cross-canadian
recipes to change RPATH
records within binaries
in order to make them relocatable.
5.14 cmake.bbclass
The cmake
class allows for recipes that need to build software using
the CMake build system. You can use
the EXTRA_OECMAKE variable to specify
additional configuration options to be passed using the cmake
command line.
On the occasion that you would be installing custom CMake toolchain
files supplied by the application being built, you should install them
to the preferred CMake Module directory: ${D}${datadir}/cmake/
Modules during
do_install.
5.15 cml1.bbclass
The cml1
class provides basic support for the Linux kernel style
build configuration system.
5.16 compress_doc.bbclass
Enables compression for man pages and info pages. This class is intended to be inherited globally. The default compression mechanism is gz (gzip) but you can select an alternative mechanism by setting the DOC_COMPRESS variable.
5.17 copyleft_compliance.bbclass
The copyleft_compliance
class preserves source code for the purposes
of license compliance. This class is an alternative to the archiver
class and is still used by some users even though it has been deprecated
in favor of the archiver class.
5.18 copyleft_filter.bbclass
A class used by the archiver and
copyleft_compliance classes
for filtering licenses. The copyleft_filter
class is an internal
class and is not intended to be used directly.
5.19 core-image.bbclass
The core-image
class provides common definitions for the
core-image-*
image recipes, such as support for additional
IMAGE_FEATURES.
5.20 cpan*.bbclass
The cpan*
classes support Perl modules.
Recipes for Perl modules are simple. These recipes usually only need to point to the source’s archive and then inherit the proper class file. Building is split into two methods depending on which method the module authors used.
Modules that use old
Makefile.PL
-based build system requirecpan.bbclass
in their recipes.Modules that use
Build.PL
-based build system require usingcpan_build.bbclass
in their recipes.
Both build methods inherit the cpan-base
class for basic Perl
support.
5.21 cross.bbclass
The cross
class provides support for the recipes that build the
cross-compilation tools.
5.22 cross-canadian.bbclass
The cross-canadian
class provides support for the recipes that build
the Canadian Cross-compilation tools for SDKs. See the
“Cross-Development Toolchain Generation”
section in the Yocto Project Overview and Concepts Manual for more
discussion on these cross-compilation tools.
5.23 crosssdk.bbclass
The crosssdk
class provides support for the recipes that build the
cross-compilation tools used for building SDKs. See the
“Cross-Development Toolchain Generation”
section in the Yocto Project Overview and Concepts Manual for more
discussion on these cross-compilation tools.
5.24 cve-check.bbclass
The cve-check
class looks for known CVEs (Common Vulnerabilities
and Exposures) while building an image. This class is meant to be
inherited globally from a configuration file:
INHERIT += "cve-check"
You can also look for vulnerabilities in specific packages by passing
-c cve_check
to BitBake. You will find details in the
“Checking for Vulnerabilities”
section in the Development Tasks Manual.
5.25 debian.bbclass
The debian
class renames output packages so that they follow the
Debian naming policy (i.e. glibc
becomes libc6
and
glibc-devel
becomes libc6-dev
.) Renaming includes the library
name and version as part of the package name.
If a recipe creates packages for multiple libraries (shared object files
of .so
type), use the LEAD_SONAME
variable in the recipe to specify the library on which to apply the
naming scheme.
5.26 deploy.bbclass
The deploy
class handles deploying files to the
DEPLOY_DIR_IMAGE directory. The main
function of this class is to allow the deploy step to be accelerated by
shared state. Recipes that inherit this class should define their own
do_deploy function to copy the files to be
deployed to DEPLOYDIR, and use addtask
to
add the task at the appropriate place, which is usually after
do_compile or
do_install. The class then takes care of
staging the files from DEPLOYDIR to DEPLOY_DIR_IMAGE.
5.27 devshell.bbclass
The devshell
class adds the do_devshell
task. Distribution
policy dictates whether to include this class. See the “Using a Development Shell”
section in the Yocto Project Development Tasks Manual for more
information about using devshell
.
5.28 devupstream.bbclass
The devupstream
class uses
BBCLASSEXTEND to add a variant of the
recipe that fetches from an alternative URI (e.g. Git) instead of a
tarball. Following is an example:
BBCLASSEXTEND = "devupstream:target"
SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
SRCREV:class-devupstream = "abcd1234"
Adding the above statements to your recipe creates a variant that has
DEFAULT_PREFERENCE set to “-1”.
Consequently, you need to select the variant of the recipe to use it.
Any development-specific adjustments can be done by using the
class-devupstream
override. Here is an example:
DEPENDS:append:class-devupstream = " gperf-native"
do_configure:prepend:class-devupstream() {
touch ${S}/README
}
The class
currently only supports creating a development variant of the target
recipe, not native
or nativesdk
variants.
The BBCLASSEXTEND syntax (i.e. devupstream:target
) provides
support for native
and nativesdk
variants. Consequently, this
functionality can be added in a future release.
Support for other version control systems such as Subversion is limited
due to BitBake’s automatic fetch dependencies (e.g.
subversion-native
).
5.29 externalsrc.bbclass
The externalsrc
class supports building software from source code
that is external to the OpenEmbedded build system. Building software
from an external source tree means that the build system’s normal fetch,
unpack, and patch process is not used.
By default, the OpenEmbedded build system uses the S
and B variables to locate unpacked recipe source code
and to build it, respectively. When your recipe inherits the
externalsrc
class, you use the
EXTERNALSRC and
EXTERNALSRC_BUILD variables to
ultimately define S and B.
By default, this class expects the source code to support recipe builds that use the B variable to point to the directory in which the OpenEmbedded build system places the generated objects built from the recipes. By default, the B directory is set to the following, which is separate from the source directory (S):
${WORKDIR}/${BPN}-{PV}/
See these variables for more information: WORKDIR, BPN, and PV,
For more information on the externalsrc
class, see the comments in
meta/classes/externalsrc.bbclass
in the Source Directory.
For information on how to use the
externalsrc
class, see the
“Building Software from an External Source”
section in the Yocto Project Development Tasks Manual.
5.30 extrausers.bbclass
The extrausers
class allows additional user and group configuration
to be applied at the image level. Inheriting this class either globally
or from an image recipe allows additional user and group operations to
be performed using the
EXTRA_USERS_PARAMS variable.
Note
The user and group operations added using the extrausers class are not tied to a specific recipe outside of the recipe for the image. Thus, the operations can be performed across the image as a whole. Use the useradd class to add user and group configuration to a specific recipe.
Here is an example that uses this class in an image recipe:
inherit extrausers
EXTRA_USERS_PARAMS = "\
useradd -p '' tester; \
groupadd developers; \
userdel nobody; \
groupdel -g video; \
groupmod -g 1020 developers; \
usermod -s /bin/sh tester; \
"
Here is an example that adds two users named “tester-jim” and “tester-sue” and assigns passwords. First on host, create the (escaped) password hash:
printf "%q" $(mkpasswd -m sha256crypt tester01)
The resulting hash is set to a variable and used in useradd
command parameters:
inherit extrausers
PASSWD = "\$X\$ABC123\$A-Long-Hash"
EXTRA_USERS_PARAMS = "\
useradd -p '${PASSWD}' tester-jim; \
useradd -p '${PASSWD}' tester-sue; \
"
Finally, here is an example that sets the root password:
inherit extrausers
EXTRA_USERS_PARAMS = "\
usermod -p '${PASSWD}' root; \
"
Note
From a security perspective, hardcoding a default password is not generally a good idea or even legal in some jurisdictions. It is recommended that you do not do this if you are building a production image.
5.31 features_check.bbclass
The features_check
class allows individual recipes to check
for required and conflicting
DISTRO_FEATURES, MACHINE_FEATURES or COMBINED_FEATURES.
This class provides support for the following variables:
REQUIRED_MACHINE_FEATURES
CONFLICT_MACHINE_FEATURES
ANY_OF_MACHINE_FEATURES
REQUIRED_COMBINED_FEATURES
CONFLICT_COMBINED_FEATURES
ANY_OF_COMBINED_FEATURES
If any conditions specified in the recipe using the above variables are not met, the recipe will be skipped, and if the build system attempts to build the recipe then an error will be triggered.
5.32 fontcache.bbclass
The fontcache
class generates the proper post-install and
post-remove (postinst and postrm) scriptlets for font packages. These
scriptlets call fc-cache
(part of Fontconfig
) to add the fonts
to the font information cache. Since the cache files are
architecture-specific, fc-cache
runs using QEMU if the postinst
scriptlets need to be run on the build host during image creation.
If the fonts being installed are in packages other than the main package, set FONT_PACKAGES to specify the packages containing the fonts.
5.33 fs-uuid.bbclass
The fs-uuid
class extracts UUID from
${
ROOTFS}
, which must have been built
by the time that this function gets called. The fs-uuid
class only
works on ext
file systems and depends on tune2fs
.
5.34 gconf.bbclass
The gconf
class provides common functionality for recipes that need
to install GConf schemas. The schemas will be put into a separate
package (${
PN}-gconf
) that is created
automatically when this class is inherited. This package uses the
appropriate post-install and post-remove (postinst/postrm) scriptlets to
register and unregister the schemas in the target image.
5.35 gettext.bbclass
The gettext
class provides support for building software that uses
the GNU gettext
internationalization and localization system. All
recipes building software that use gettext
should inherit this
class.
5.36 gnomebase.bbclass
The gnomebase
class is the base class for recipes that build
software from the GNOME stack. This class sets
SRC_URI to download the source from the GNOME
mirrors as well as extending FILES with the typical
GNOME installation paths.
5.37 gobject-introspection.bbclass
Provides support for recipes building software that supports GObject introspection. This functionality is only enabled if the “gobject-introspection-data” feature is in DISTRO_FEATURES as well as “qemu-usermode” being in MACHINE_FEATURES.
Note
This functionality is backfilled by default and, if not applicable, should be disabled through DISTRO_FEATURES_BACKFILL_CONSIDERED or MACHINE_FEATURES_BACKFILL_CONSIDERED, respectively.
5.38 grub-efi.bbclass
The grub-efi
class provides grub-efi
-specific functions for
building bootable images.
This class supports several variables:
INITRD: Indicates list of filesystem images to concatenate and use as an initial RAM disk (initrd) (optional).
ROOTFS: Indicates a filesystem image to include as the root filesystem (optional).
GRUB_GFXSERIAL: Set this to “1” to have graphics and serial in the boot menu.
LABELS: A list of targets for the automatic configuration.
APPEND: An override list of append strings for each
LABEL
.GRUB_OPTS: Additional options to add to the configuration (optional). Options are delimited using semi-colon characters (
;
).GRUB_TIMEOUT: Timeout before executing the default
LABEL
(optional).
5.39 gsettings.bbclass
The gsettings
class provides common functionality for recipes that
need to install GSettings (glib) schemas. The schemas are assumed to be
part of the main package. Appropriate post-install and post-remove
(postinst/postrm) scriptlets are added to register and unregister the
schemas in the target image.
5.40 gtk-doc.bbclass
The gtk-doc
class is a helper class to pull in the appropriate
gtk-doc
dependencies and disable gtk-doc
.
5.41 gtk-icon-cache.bbclass
The gtk-icon-cache
class generates the proper post-install and
post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
install icons. These scriptlets call gtk-update-icon-cache
to add
the fonts to GTK+’s icon cache. Since the cache files are
architecture-specific, gtk-update-icon-cache
is run using QEMU if
the postinst scriptlets need to be run on the build host during image
creation.
5.42 gtk-immodules-cache.bbclass
The gtk-immodules-cache
class generates the proper post-install and
post-remove (postinst/postrm) scriptlets for packages that install GTK+
input method modules for virtual keyboards. These scriptlets call
gtk-update-icon-cache
to add the input method modules to the cache.
Since the cache files are architecture-specific,
gtk-update-icon-cache
is run using QEMU if the postinst scriptlets
need to be run on the build host during image creation.
If the input method modules being installed are in packages other than the main package, set GTKIMMODULES_PACKAGES to specify the packages containing the modules.
5.43 gzipnative.bbclass
The gzipnative
class enables the use of different native versions of
gzip
and pigz
rather than the versions of these tools from the
build host.
5.44 icecc.bbclass
The icecc
class supports
Icecream, which facilitates
taking compile jobs and distributing them among remote machines.
The class stages directories with symlinks from gcc
and g++
to
icecc
, for both native and cross compilers. Depending on each
configure or compile, the OpenEmbedded build system adds the directories
at the head of the PATH
list and then sets the ICECC_CXX
and
ICEC_CC
variables, which are the paths to the g++
and gcc
compilers, respectively.
For the cross compiler, the class creates a tar.gz
file that
contains the Yocto Project toolchain and sets ICECC_VERSION
, which
is the version of the cross-compiler used in the cross-development
toolchain, accordingly.
The class handles all three different compile stages (i.e native
,cross-kernel and target) and creates the necessary environment
tar.gz
file to be used by the remote machines. The class also
supports SDK generation.
If ICECC_PATH is not set in your
local.conf
file, then the class tries to locate the icecc
binary
using which
. If ICECC_ENV_EXEC is set
in your local.conf
file, the variable should point to the
icecc-create-env
script provided by the user. If you do not point to
a user-provided script, the build system uses the default script
provided by the recipe icecc-create-env-native.bb
.
Note
This script is a modified version and not the one that comes with icecc.
If you do not want the Icecream distributed compile support to apply to
specific recipes or classes, you can ask them to be ignored by Icecream
by listing the recipes and classes using the
ICECC_RECIPE_DISABLE and
ICECC_CLASS_DISABLE variables,
respectively, in your local.conf
file. Doing so causes the
OpenEmbedded build system to handle these compilations locally.
Additionally, you can list recipes using the
ICECC_RECIPE_ENABLE variable in
your local.conf
file to force icecc
to be enabled for recipes
using an empty PARALLEL_MAKE variable.
Inheriting the icecc
class changes all sstate signatures.
Consequently, if a development team has a dedicated build system that
populates SSTATE_MIRRORS and they want to
reuse sstate from SSTATE_MIRRORS, then all developers and the build
system need to either inherit the icecc
class or nobody should.
At the distribution level, you can inherit the icecc
class to be
sure that all builders start with the same sstate signatures. After
inheriting the class, you can then disable the feature by setting the
ICECC_DISABLED variable to “1” as follows:
INHERIT_DISTRO:append = " icecc"
ICECC_DISABLED ??= "1"
This practice
makes sure everyone is using the same signatures but also requires
individuals that do want to use Icecream to enable the feature
individually as follows in your local.conf
file:
ICECC_DISABLED = ""
5.45 image.bbclass
The image
class helps support creating images in different formats.
First, the root filesystem is created from packages using one of the
rootfs*.bbclass
files (depending on the package format used) and
then one or more image files are created.
The IMAGE_FSTYPES variable controls the types of images to generate.
The IMAGE_INSTALL variable controls the list of packages to install into the image.
For information on customizing images, see the “Customizing Images” section in the Yocto Project Development Tasks Manual. For information on how images are created, see the “Images” section in the Yocto Project Overview and Concepts Manual.
5.46 image-buildinfo.bbclass
The image-buildinfo
class writes information to the target
filesystem on /etc/build
.
5.47 image_types.bbclass
The image_types
class defines all of the standard image output types
that you can enable through the
IMAGE_FSTYPES variable. You can use this
class as a reference on how to add support for custom image output
types.
By default, the image class automatically
enables the image_types
class. The image
class uses the
IMGCLASSES
variable as follows:
IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
IMGCLASSES += "image_types_wic"
IMGCLASSES += "rootfs-postcommands"
IMGCLASSES += "image-postinst-intercepts"
inherit ${IMGCLASSES}
The image_types
class also handles conversion and compression of images.
Note
To build a VMware VMDK image, you need to add “wic.vmdk” to IMAGE_FSTYPES. This would also be similar for Virtual Box Virtual Disk Image (“vdi”) and QEMU Copy On Write Version 2 (“qcow2”) images.
5.48 image-live.bbclass
This class controls building “live” (i.e. HDDIMG and ISO) images. Live images contain syslinux for legacy booting, as well as the bootloader specified by EFI_PROVIDER if MACHINE_FEATURES contains “efi”.
Normally, you do not use this class directly. Instead, you add “live” to IMAGE_FSTYPES.
5.49 insane.bbclass
The insane
class adds a step to the package generation process so
that output quality assurance checks are generated by the OpenEmbedded
build system. A range of checks are performed that check the build’s
output for common problems that show up during runtime. Distribution
policy usually dictates whether to include this class.
You can configure the sanity checks so that specific test failures either raise a warning or an error message. Typically, failures for new tests generate a warning. Subsequent failures for the same test would then generate an error message once the metadata is in a known and good condition. See the “QA Error and Warning Messages” Chapter for a list of all the warning and error messages you might encounter using a default configuration.
Use the WARN_QA and
ERROR_QA variables to control the behavior of
these checks at the global level (i.e. in your custom distro
configuration). However, to skip one or more checks in recipes, you
should use INSANE_SKIP. For example, to skip
the check for symbolic link .so
files in the main package of a
recipe, add the following to the recipe. You need to realize that the
package name override, in this example ${PN}
, must be used:
INSANE_SKIP:${PN} += "dev-so"
Please keep in mind that the QA checks are meant to detect real or potential problems in the packaged output. So exercise caution when disabling these checks.
Here are the tests you can list with the WARN_QA and ERROR_QA variables:
already-stripped:
Checks that produced binaries have not already been stripped prior to the build system extracting debug symbols. It is common for upstream software projects to default to stripping debug symbols for output binaries. In order for debugging to work on the target using-dbg
packages, this stripping must be disabled.arch:
Checks the Executable and Linkable Format (ELF) type, bit size, and endianness of any binaries to ensure they match the target architecture. This test fails if any binaries do not match the type since there would be an incompatibility. The test could indicate that the wrong compiler or compiler options have been used. Sometimes software, like bootloaders, might need to bypass this check.buildpaths:
Checks for paths to locations on the build host inside the output files. Currently, this test triggers too many false positives and thus is not normally enabled.build-deps:
Determines if a build-time dependency that is specified through DEPENDS, explicit RDEPENDS, or task-level dependencies exists to match any runtime dependency. This determination is particularly useful to discover where runtime dependencies are detected and added during packaging. If no explicit dependency has been specified within the metadata, at the packaging stage it is too late to ensure that the dependency is built, and thus you can end up with an error when the package is installed into the image during the do_rootfs task because the auto-detected dependency was not satisfied. An example of this would be where the update-rc.d class automatically adds a dependency on theinitscripts-functions
package to packages that install an initscript that refers to/etc/init.d/functions
. The recipe should really have an explicit RDEPENDS for the package in question oninitscripts-functions
so that the OpenEmbedded build system is able to ensure that theinitscripts
recipe is actually built and thus theinitscripts-functions
package is made available.compile-host-path:
Checks the do_compile log for indications that paths to locations on the build host were used. Using such paths might result in host contamination of the build output.debug-deps:
Checks that all packages except-dbg
packages do not depend on-dbg
packages, which would cause a packaging bug.debug-files:
Checks for.debug
directories in anything but the-dbg
package. The debug files should all be in the-dbg
package. Thus, anything packaged elsewhere is incorrect packaging.dep-cmp:
Checks for invalid version comparison statements in runtime dependency relationships between packages (i.e. in RDEPENDS, RRECOMMENDS, RSUGGESTS, RPROVIDES, RREPLACES, and RCONFLICTS variable values). Any invalid comparisons might trigger failures or undesirable behavior when passed to the package manager.desktop:
Runs thedesktop-file-validate
program against any.desktop
files to validate their contents against the specification for.desktop
files.dev-deps:
Checks that all packages except-dev
or-staticdev
packages do not depend on-dev
packages, which would be a packaging bug.dev-so:
Checks that the.so
symbolic links are in the-dev
package and not in any of the other packages. In general, these symlinks are only useful for development purposes. Thus, the-dev
package is the correct location for them. In very rare cases, such as dynamically loaded modules, these symlinks are needed instead in the main package.empty-dirs:
Checks that packages are not installing files to directories that are normally expected to be empty (such as/tmp
) The list of directories that are checked is specified by the QA_EMPTY_DIRS variable.file-rdeps:
Checks that file-level dependencies identified by the OpenEmbedded build system at packaging time are satisfied. For example, a shell script might start with the line#!/bin/bash
. This line would translate to a file dependency on/bin/bash
. Of the three package managers that the OpenEmbedded build system supports, only RPM directly handles file-level dependencies, resolving them automatically to packages providing the files. However, the lack of that functionality in the other two package managers does not mean the dependencies do not still need resolving. This QA check attempts to ensure that explicitly declared RDEPENDS exist to handle any file-level dependency detected in packaged files.files-invalid:
Checks for FILES variable values that contain “//”, which is invalid.host-user-contaminated:
Checks that no package produced by the recipe contains any files outside of/home
with a user or group ID that matches the user running BitBake. A match usually indicates that the files are being installed with an incorrect UID/GID, since target IDs are independent from host IDs. For additional information, see the section describing the do_install task.incompatible-license:
Report when packages are excluded from being created due to being marked with a license that is in INCOMPATIBLE_LICENSE.install-host-path:
Checks the do_install log for indications that paths to locations on the build host were used. Using such paths might result in host contamination of the build output.installed-vs-shipped:
Reports when files have been installed withindo_install
but have not been included in any package by way of the FILES variable. Files that do not appear in any package cannot be present in an image later on in the build process. Ideally, all installed files should be packaged or not installed at all. These files can be deleted at the end ofdo_install
if the files are not needed in any package.invalid-chars:
Checks that the recipe metadata variables DESCRIPTION, SUMMARY, LICENSE, and SECTION do not contain non-UTF-8 characters. Some package managers do not support such characters.invalid-packageconfig:
Checks that no undefined features are being added to PACKAGECONFIG. For example, any name “foo” for which the following form does not exist:PACKAGECONFIG[foo] = "..."
la:
Checks.la
files for any TMPDIR paths. Any.la
file containing these paths is incorrect sincelibtool
adds the correct sysroot prefix when using the files automatically itself.ldflags:
Ensures that the binaries were linked with the LDFLAGS options provided by the build system. If this test fails, check that the LDFLAGS variable is being passed to the linker command.libdir:
Checks for libraries being installed into incorrect (possibly hardcoded) installation paths. For example, this test will catch recipes that install/lib/bar.so
when${base_libdir}
is “lib32”. Another example is when recipes install/usr/lib64/foo.so
when${libdir}
is “/usr/lib”.libexec:
Checks if a package contains files in/usr/libexec
. This check is not performed if thelibexecdir
variable has been set explicitly to/usr/libexec
.packages-list:
Checks for the same package being listed multiple times through the PACKAGES variable value. Installing the package in this manner can cause errors during packaging.perm-config:
Reports lines infs-perms.txt
that have an invalid format.perm-line:
Reports lines infs-perms.txt
that have an invalid format.perm-link:
Reports lines infs-perms.txt
that specify ‘link’ where the specified target already exists.perms:
Currently, this check is unused but reserved.pkgconfig:
Checks.pc
files for any TMPDIR/WORKDIR paths. Any.pc
file containing these paths is incorrect sincepkg-config
itself adds the correct sysroot prefix when the files are accessed.pkgname:
Checks that all packages in PACKAGES have names that do not contain invalid characters (i.e. characters other than 0-9, a-z, ., +, and -).pkgv-undefined:
Checks to see if the PKGV variable is undefined during do_package.pkgvarcheck:
Checks through the variables RDEPENDS, RRECOMMENDS, RSUGGESTS, RCONFLICTS, RPROVIDES, RREPLACES, FILES, ALLOW_EMPTY,pkg_preinst
,pkg_postinst
,pkg_prerm
andpkg_postrm
, and reports if there are variable sets that are not package-specific. Using these variables without a package suffix is bad practice, and might unnecessarily complicate dependencies of other packages within the same recipe or have other unintended consequences.pn-overrides:
Checks that a recipe does not have a name (PN) value that appears in OVERRIDES. If a recipe is named such that its PN value matches something already in OVERRIDES (e.g. PN happens to be the same as MACHINE or DISTRO), it can have unexpected consequences. For example, assignments such asFILES:${PN} = "xyz"
effectively turn intoFILES = "xyz"
.rpaths:
Checks for rpaths in the binaries that contain build system paths such as TMPDIR. If this test fails, bad-rpath
options are being passed to the linker commands and your binaries have potential security issues.split-strip:
Reports that splitting or stripping debug symbols from binaries has failed.staticdev:
Checks for static library files (*.a
) in non-staticdev
packages.symlink-to-sysroot:
Checks for symlinks in packages that point into TMPDIR on the host. Such symlinks will work on the host, but are clearly invalid when running on the target.textrel:
Checks for ELF binaries that contain relocations in their.text
sections, which can result in a performance impact at runtime. See the explanation for theELF binary
message in “QA Error and Warning Messages” for more information regarding runtime performance issues.unlisted-pkg-lics:
Checks that all declared licenses applying for a package are also declared on the recipe level (i.e. any license inLICENSE:*
should appear in LICENSE).useless-rpaths:
Checks for dynamic library load paths (rpaths) in the binaries that by default on a standard system are searched by the linker (e.g./lib
and/usr/lib
). While these paths will not cause any breakage, they do waste space and are unnecessary.var-undefined:
Reports when variables fundamental to packaging (i.e. WORKDIR, DEPLOY_DIR, D, PN, and PKGD) are undefined during do_package.version-going-backwards:
If Build History is enabled, reports when a package being written out has a lower version than the previously written package under the same name. If you are placing output packages into a feed and upgrading packages on a target system using that feed, the version of a package going backwards can result in the target system not correctly upgrading to the “new” version of the package.Note
This is only relevant when you are using runtime package management on your target system.
xorg-driver-abi:
Checks that all packages containing Xorg drivers have ABI dependencies. Thexserver-xorg
recipe provides driver ABI names. All drivers should depend on the ABI versions that they have been built against. Driver recipes that includexorg-driver-input.inc
orxorg-driver-video.inc
will automatically get these versions. Consequently, you should only need to explicitly add dependencies to binary driver recipes.
5.50 insserv.bbclass
The insserv
class uses the insserv
utility to update the order
of symbolic links in /etc/rc?.d/
within an image based on
dependencies specified by LSB headers in the init.d
scripts
themselves.
5.51 kernel.bbclass
The kernel
class handles building Linux kernels. The class contains
code to build all kernel trees. All needed headers are staged into the
STAGING_KERNEL_DIR directory to allow out-of-tree module builds
using the module class.
This means that each built kernel module is packaged separately and
inter-module dependencies are created by parsing the modinfo
output.
If all modules are required, then installing the kernel-modules
package installs all packages with modules and various other kernel
packages such as kernel-vmlinux
.
The kernel
class contains logic that allows you to embed an initial
RAM filesystem (initramfs) image when you build the kernel image. For
information on how to build an initramfs, see the
“Building an Initial RAM Filesystem (initramfs) Image” section in
the Yocto Project Development Tasks Manual.
Various other classes are used by the kernel
and module
classes
internally including the kernel-arch,
module-base, and
linux-kernel-base classes.
5.52 kernel-arch.bbclass
The kernel-arch
class sets the ARCH
environment variable for
Linux kernel compilation (including modules).
5.53 kernel-devicetree.bbclass
The kernel-devicetree
class, which is inherited by the
kernel class, supports device tree
generation.
5.54 kernel-fitimage.bbclass
The kernel-fitimage
class provides support to pack a kernel image,
device trees, a U-boot script, a Initramfs bundle and a RAM disk
into a single FIT image. In theory, a FIT image can support any number
of kernels, U-boot scripts, Initramfs bundles, RAM disks and device-trees.
However, kernel-fitimage
currently only supports
limited usescases: just one kernel image, an optional U-boot script,
an optional Initramfs bundle, an optional RAM disk, and any number of
device tree.
To create a FIT image, it is required that KERNEL_CLASSES is set to include “kernel-fitimage” and KERNEL_IMAGETYPE is set to “fitImage”.
The options for the device tree compiler passed to mkimage -D
when creating the FIT image are specified using the
UBOOT_MKIMAGE_DTCOPTS variable.
Only a single kernel can be added to the FIT image created by
kernel-fitimage
and the kernel image in FIT is mandatory. The
address where the kernel image is to be loaded by U-Boot is
specified by UBOOT_LOADADDRESS and the entrypoint by
UBOOT_ENTRYPOINT.
Multiple device trees can be added to the FIT image created by
kernel-fitimage
and the device tree is optional.
The address where the device tree is to be loaded by U-Boot is
specified by UBOOT_DTBO_LOADADDRESS for device tree overlays
and by UBOOT_DTB_LOADADDRESS for device tree binaries.
Only a single RAM disk can be added to the FIT image created by
kernel-fitimage
and the RAM disk in FIT is optional.
The address where the RAM disk image is to be loaded by U-Boot
is specified by UBOOT_RD_LOADADDRESS and the entrypoint by
UBOOT_RD_ENTRYPOINT. The ramdisk is added to FIT image when
INITRAMFS_IMAGE is specified and that INITRAMFS_IMAGE_BUNDLE
is set to 0.
Only a single Initramfs bundle can be added to the FIT image created by
kernel-fitimage
and the Initramfs bundle in FIT is optional.
In case of Initramfs, the kernel is configured to be bundled with the root filesystem
in the same binary (example: zImage-initramfs-MACHINE.bin).
When the kernel is copied to RAM and executed, it unpacks the Initramfs root filesystem.
The Initramfs bundle can be enabled when INITRAMFS_IMAGE
is specified and that INITRAMFS_IMAGE_BUNDLE is set to 1.
The address where the Initramfs bundle is to be loaded by U-boot is specified
by UBOOT_LOADADDRESS and the entrypoint by UBOOT_ENTRYPOINT.
Only a single U-boot boot script can be added to the FIT image created by
kernel-fitimage
and the boot script is optional.
The boot script is specified in the ITS file as a text file containing
U-boot commands. When using a boot script the user should configure the
U-boot do_install
task to copy the script to sysroot.
So the script can be included in the FIT image by the kernel-fitimage
class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
load the boot script from the FIT image and executes it.
The FIT image generated by kernel-fitimage
class is signed when the
variables UBOOT_SIGN_ENABLE, UBOOT_MKIMAGE_DTCOPTS,
UBOOT_SIGN_KEYDIR and UBOOT_SIGN_KEYNAME are set
appropriately. The default values used for FIT_HASH_ALG and
FIT_SIGN_ALG in kernel-fitimage
are “sha256” and
“rsa2048” respectively. The keys for signing fitImage can be generated using
the kernel-fitimage
class when both FIT_GENERATE_KEYS and
UBOOT_SIGN_ENABLE are set to “1”.
5.55 kernel-grub.bbclass
The kernel-grub
class updates the boot area and the boot menu with
the kernel as the priority boot mechanism while installing a RPM to
update the kernel on a deployed target.
5.56 kernel-module-split.bbclass
The kernel-module-split
class provides common functionality for
splitting Linux kernel modules into separate packages.
5.57 kernel-uboot.bbclass
The kernel-uboot
class provides support for building from
vmlinux-style kernel sources.
5.58 kernel-uimage.bbclass
The kernel-uimage
class provides support to pack uImage.
5.59 kernel-yocto.bbclass
The kernel-yocto
class provides common functionality for building
from linux-yocto style kernel source repositories.
5.60 kernelsrc.bbclass
The kernelsrc
class sets the Linux kernel source and version.
5.61 lib_package.bbclass
The lib_package
class supports recipes that build libraries and
produce executable binaries, where those binaries should not be
installed by default along with the library. Instead, the binaries are
added to a separate ${
PN}-bin
package to
make their installation optional.
5.62 libc*.bbclass
The libc*
classes support recipes that build packages with libc
:
The
libc-common
class provides common support for building withlibc
.The
libc-package
class supports packaging upglibc
andeglibc
.
5.63 license.bbclass
The license
class provides license manifest creation and license
exclusion. This class is enabled by default using the default value for
the INHERIT_DISTRO variable.
5.64 linux-kernel-base.bbclass
The linux-kernel-base
class provides common functionality for
recipes that build out of the Linux kernel source tree. These builds
goes beyond the kernel itself. For example, the Perf recipe also
inherits this class.
5.65 linuxloader.bbclass
Provides the function linuxloader()
, which gives the value of the
dynamic loader/linker provided on the platform. This value is used by a
number of other classes.
5.66 logging.bbclass
The logging
class provides the standard shell functions used to log
messages for various BitBake severity levels (i.e. bbplain
,
bbnote
, bbwarn
, bberror
, bbfatal
, and bbdebug
).
This class is enabled by default since it is inherited by the base
class.
5.67 metadata_scm.bbclass
The metadata_scm
class provides functionality for querying the
branch and revision of a Source Code Manager (SCM) repository.
The base class uses this class to print the
revisions of each layer before starting every build. The
metadata_scm
class is enabled by default because it is inherited by
the base
class.
5.68 migrate_localcount.bbclass
The migrate_localcount
class verifies a recipe’s localcount data and
increments it appropriately.
5.69 mime.bbclass
The mime
class generates the proper post-install and post-remove
(postinst/postrm) scriptlets for packages that install MIME type files.
These scriptlets call update-mime-database
to add the MIME types to
the shared database.
5.70 mirrors.bbclass
The mirrors
class sets up some standard
MIRRORS entries for source code mirrors. These
mirrors provide a fall-back path in case the upstream source specified
in SRC_URI within recipes is unavailable.
This class is enabled by default since it is inherited by the base class.
5.71 module.bbclass
The module
class provides support for building out-of-tree Linux
kernel modules. The class inherits the
module-base and
kernel-module-split classes,
and implements the do_compile and
do_install tasks. The class provides
everything needed to build and package a kernel module.
For general information on out-of-tree Linux kernel modules, see the “Incorporating Out-of-Tree Modules” section in the Yocto Project Linux Kernel Development Manual.
5.72 module-base.bbclass
The module-base
class provides the base functionality for building
Linux kernel modules. Typically, a recipe that builds software that
includes one or more kernel modules and has its own means of building
the module inherits this class as opposed to inheriting the
module class.
5.73 multilib*.bbclass
The multilib*
classes provide support for building libraries with
different target optimizations or target architectures and installing
them side-by-side in the same image.
For more information on using the Multilib feature, see the “Combining Multiple Versions of Library Files into One Image” section in the Yocto Project Development Tasks Manual.
5.74 native.bbclass
The native
class provides common functionality for recipes that
build tools to run on the Build Host (i.e. tools that use the compiler
or other tools from the build host).
You can create a recipe that builds tools that run natively on the host a couple different ways:
Create a
myrecipe-native.bb
recipe that inherits thenative
class. If you use this method, you must order the inherit statement in the recipe after all other inherit statements so that thenative
class is inherited last.Note
When creating a recipe this way, the recipe name must follow this naming convention:
myrecipe-native.bb
Not using this naming convention can lead to subtle problems caused by existing code that depends on that naming convention.
Create or modify a target recipe that contains the following:
BBCLASSEXTEND = "native"
Inside the recipe, use
:class-native
and:class-target
overrides to specify any functionality specific to the respective native or target case.
Although applied differently, the native
class is used with both
methods. The advantage of the second method is that you do not need to
have two separate recipes (assuming you need both) for native and
target. All common parts of the recipe are automatically shared.
5.75 nativesdk.bbclass
The nativesdk
class provides common functionality for recipes that
wish to build tools to run as part of an SDK (i.e. tools that run on
SDKMACHINE).
You can create a recipe that builds tools that run on the SDK machine a couple different ways:
Create a
nativesdk-myrecipe.bb
recipe that inherits thenativesdk
class. If you use this method, you must order the inherit statement in the recipe after all other inherit statements so that thenativesdk
class is inherited last.Create a
nativesdk
variant of any recipe by adding the following:BBCLASSEXTEND = "nativesdk"
Inside the recipe, use
:class-nativesdk
and:class-target
overrides to specify any functionality specific to the respective SDK machine or target case.
Note
When creating a recipe, you must follow this naming convention:
nativesdk-myrecipe.bb
Not doing so can lead to subtle problems because there is code that depends on the naming convention.
Although applied differently, the nativesdk
class is used with both
methods. The advantage of the second method is that you do not need to
have two separate recipes (assuming you need both) for the SDK machine
and the target. All common parts of the recipe are automatically shared.
5.76 nopackages.bbclass
Disables packaging tasks for those recipes and classes where packaging is not needed.
5.77 npm.bbclass
Provides support for building Node.js software fetched using the node package manager (NPM).
Note
Currently, recipes inheriting this class must use the npm://
fetcher to have dependencies fetched and packaged automatically.
For information on how to create NPM packages, see the “Creating Node Package Manager (NPM) Packages” section in the Yocto Project Development Tasks Manual.
5.78 oelint.bbclass
The oelint
class is an obsolete lint checking tool available in
meta/classes
in the Source Directory.
There are some classes that could be generally useful in OE-Core but
are never actually used within OE-Core itself. The oelint
class is
one such example. However, being aware of this class can reduce the
proliferation of different versions of similar classes across multiple
layers.
5.79 overlayfs.bbclass
It’s often desired in Embedded System design to have a read-only root filesystem.
But a lot of different applications might want to have read-write access to
some parts of a filesystem. It can be especially useful when your update mechanism
overwrites the whole root filesystem, but you may want your application data to be preserved
between updates. The overlayfs class provides a way
to achieve that by means of overlayfs
and at the same time keeping the base
root filesystem read-only.
To use this class, set a mount point for a partition overlayfs
is going to use as upper
layer in your machine configuration. The underlying file system can be anything that
is supported by overlayfs
. This has to be done in your machine configuration:
OVERLAYFS_MOUNT_POINT[data] = "/data"
Note
QA checks fail to catch file existence if you redefine this variable in your recipe!
Only the existence of the systemd mount unit file is checked, not its contents.
To get more details on
overlayfs
, its internals and supported operations, please refer to the official documentation of the Linux kernel.
The class assumes you have a data.mount
systemd unit defined elsewhere in your BSP
(e.g. in systemd-machine-units
recipe) and it’s installed into the image.
Then you can specify writable directories on a recipe basis (e.g. in my-application.bb):
OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
To support several mount points you can use a different variable flag. Assuming we
want to have a writable location on the file system, but do not need that the data
survives a reboot, then we could have a mnt-overlay.mount
unit for a tmpfs
file system.
In your machine configuration:
OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
and then in your recipe:
OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
On a practical note, your application recipe might require multiple
overlays to be mounted before running to avoid writing to the underlying
file system (which can be forbidden in case of read-only file system)
To achieve that overlayfs provides a systemd
helper service for mounting overlays. This helper service is named
${PN}-overlays.service
and can be depended on in your application recipe
(named application
in the following example) systemd
unit by adding
to the unit the following:
[Unit]
After=application-overlays.service
Requires=application-overlays.service
Note
The class does not support the /etc
directory itself, because systemd
depends on it.
In order to get /etc
in overlayfs, see overlayfs-etc.
5.80 overlayfs-etc.bbclass
In order to have the /etc
directory in overlayfs a special handling at early
boot stage is required. The idea is to supply a custom init script that mounts
/etc
before launching the actual init program, because the latter already
requires /etc
to be mounted.
Example usage in image recipe:
IMAGE_FEATURES += "overlayfs-etc"
Note
This class must not be inherited directly. Use IMAGE_FEATURES or EXTRA_IMAGE_FEATURES
Your machine configuration should define at least the device, mount point, and file system type
you are going to use for overlayfs
:
OVERLAYFS_ETC_MOUNT_POINT = "/data"
OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
OVERLAYFS_ETC_FSTYPE ?= "ext4"
To control more mount options you should consider setting mount options
(defaults
is used by default):
OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
The class provides two options for /sbin/init
generation:
The default option is to rename the original
/sbin/init
to/sbin/init.orig
and place the generated init under original name, i.e./sbin/init
. It has an advantage that you won’t need to change any kernel parameters in order to make it work, but it poses a restriction that package-management can’t be used, because updating the init manager would remove the generated script.If you wish to keep original init as is, you can set:
OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
Then the generated init will be named
/sbin/preinit
and you would need to extend your kernel parameters manually in your bootloader configuration.
5.81 own-mirrors.bbclass
The own-mirrors
class makes it easier to set up your own
PREMIRRORS from which to first fetch source
before attempting to fetch it from the upstream specified in
SRC_URI within each recipe.
To use this class, inherit it globally and specify SOURCE_MIRROR_URL. Here is an example:
INHERIT += "own-mirrors"
SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
You can specify only a single URL in SOURCE_MIRROR_URL.
5.82 package.bbclass
The package
class supports generating packages from a build’s
output. The core generic functionality is in package.bbclass
. The
code specific to particular package types resides in these
package-specific classes:
package_deb,
package_rpm,
package_ipk, and
package_tar.
Note
The package_tar class is broken and not supported. It is recommended that you do not use this class.
You can control the list of resulting package formats by using the
PACKAGE_CLASSES variable defined in your conf/local.conf
configuration file, which is located in the Build Directory.
When defining the variable, you can
specify one or more package types. Since images are generated from
packages, a packaging class is needed to enable image generation. The
first class listed in this variable is used for image generation.
If you take the optional step to set up a repository (package feed) on the development host that can be used by DNF, you can install packages from the feed while you are running the image on the target (i.e. runtime installation of packages). For more information, see the “Using Runtime Package Management” section in the Yocto Project Development Tasks Manual.
The package-specific class you choose can affect build-time performance and has space ramifications. In general, building a package with IPK takes about thirty percent less time as compared to using RPM to build the same or similar package. This comparison takes into account a complete build of the package with all dependencies previously built. The reason for this discrepancy is because the RPM package manager creates and processes more Metadata than the IPK package manager. Consequently, you might consider setting PACKAGE_CLASSES to “package_ipk” if you are building smaller systems.
Before making your package manager decision, however, you should consider some further things about using RPM:
RPM starts to provide more abilities than IPK due to the fact that it processes more Metadata. For example, this information includes individual file types, file checksum generation and evaluation on install, sparse file support, conflict detection and resolution for Multilib systems, ACID style upgrade, and repackaging abilities for rollbacks.
For smaller systems, the extra space used for the Berkeley Database and the amount of metadata when using RPM can affect your ability to perform on-device upgrades.
You can find additional information on the effects of the package class at these two Yocto Project mailing list links:
5.83 package_deb.bbclass
The package_deb
class provides support for creating packages that
use the Debian (i.e. .deb
) file format. The class ensures the
packages are written out in a .deb
file format to the
${
DEPLOY_DIR_DEB}
directory.
This class inherits the package class and
is enabled through the PACKAGE_CLASSES
variable in the local.conf
file.
5.84 package_ipk.bbclass
The package_ipk
class provides support for creating packages that
use the IPK (i.e. .ipk
) file format. The class ensures the packages
are written out in a .ipk
file format to the
${
DEPLOY_DIR_IPK}
directory.
This class inherits the package class and
is enabled through the PACKAGE_CLASSES
variable in the local.conf
file.
5.85 package_rpm.bbclass
The package_rpm
class provides support for creating packages that
use the RPM (i.e. .rpm
) file format. The class ensures the packages
are written out in a .rpm
file format to the
${
DEPLOY_DIR_RPM}
directory.
This class inherits the package class and
is enabled through the PACKAGE_CLASSES
variable in the local.conf
file.
5.86 package_tar.bbclass
The package_tar
class provides support for creating tarballs. The
class ensures the packages are written out in a tarball format to the
${
DEPLOY_DIR_TAR}
directory.
This class inherits the package class and
is enabled through the PACKAGE_CLASSES
variable in the local.conf
file.
Note
You cannot specify the package_tar
class first using the
PACKAGE_CLASSES variable. You must use .deb
, .ipk
, or .rpm
file formats for your image or SDK.
5.87 packagedata.bbclass
The packagedata
class provides common functionality for reading
pkgdata
files found in PKGDATA_DIR. These
files contain information about each output package produced by the
OpenEmbedded build system.
This class is enabled by default because it is inherited by the package class.
5.88 packagegroup.bbclass
The packagegroup
class sets default values appropriate for package
group recipes (e.g. PACKAGES, PACKAGE_ARCH, ALLOW_EMPTY, and
so forth). It is highly recommended that all package group recipes
inherit this class.
For information on how to use this class, see the “Customizing Images Using Custom Package Groups” section in the Yocto Project Development Tasks Manual.
Previously, this class was called the task
class.
5.89 patch.bbclass
The patch
class provides all functionality for applying patches
during the do_patch task.
This class is enabled by default because it is inherited by the base class.
5.90 perlnative.bbclass
When inherited by a recipe, the perlnative
class supports using the
native version of Perl built by the build system rather than using the
version provided by the build host.
5.91 python_flit_core.bbclass
The python_flit_core
class enables building Python modules which declare
the PEP-517 compliant
flit_core.buildapi
build-backend
in the [build-system]
section of pyproject.toml
(See PEP-518).
Python modules built with flit_core.buildapi
are pure Python (no
C
or Rust
extensions).
Internally this uses the python_pep517 class.
5.92 python_pep517.bbclass
The python_pep517
class builds and installs a Python wheel
binary
archive (see PEP-517).
Recipes wouldn’t inherit this directly, instead typically another class will inherit this, add the relevant native dependencies, and set PEP517_BUILD_API to the Python class which implements the PEP-517 build API.
Examples of classes which do this are python_flit_core, python_setuptools_build_meta, and python_poetry_core.
5.93 python_poetry_core.bbclass
The python_poetry_core
class enables building Python modules which use the
Poetry Core build system.
Internally this uses the python_pep517 class.
5.94 pixbufcache.bbclass
The pixbufcache
class generates the proper post-install and
post-remove (postinst/postrm) scriptlets for packages that install
pixbuf loaders, which are used with gdk-pixbuf
. These scriptlets
call update_pixbuf_cache
to add the pixbuf loaders to the cache.
Since the cache files are architecture-specific, update_pixbuf_cache
is run using QEMU if the postinst scriptlets need to be run on the build
host during image creation.
If the pixbuf loaders being installed are in packages other than the recipe’s main package, set PIXBUF_PACKAGES to specify the packages containing the loaders.
5.95 pkgconfig.bbclass
The pkgconfig
class provides a standard way to get header and
library information by using pkg-config
. This class aims to smooth
integration of pkg-config
into libraries that use it.
During staging, BitBake installs pkg-config
data into the
sysroots/
directory. By making use of sysroot functionality within
pkg-config
, the pkgconfig
class no longer has to manipulate the
files.
5.96 populate_sdk.bbclass
The populate_sdk
class provides support for SDK-only recipes. 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.
5.97 populate_sdk_*.bbclass
The populate_sdk_*
classes support SDK creation and consist of the
following classes:
populate_sdk_base
: The base class supporting SDK creation under all package managers (i.e. DEB, RPM, and opkg).populate_sdk_deb
: Supports creation of the SDK given the Debian package manager.populate_sdk_rpm
: Supports creation of the SDK given the RPM package manager.populate_sdk_ipk
: Supports creation of the SDK given the opkg (IPK format) package manager.populate_sdk_ext
: Supports extensible SDK creation under all package managers.
The populate_sdk_base
class inherits the appropriate
populate_sdk_*
(i.e. deb
, rpm
, and ipk
) based on
IMAGE_PKGTYPE.
The base class ensures all source and destination directories are
established and then populates the SDK. After populating the SDK, the
populate_sdk_base
class constructs two sysroots:
${
SDK_ARCH}-nativesdk
, which
contains the cross-compiler and associated tooling, and the target,
which contains a target root filesystem that is configured for the SDK
usage. These two images reside in SDK_OUTPUT,
which consists of the following:
${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
Finally, the base populate SDK class creates the toolchain environment setup script, the tarball of the SDK, and the installer.
The respective populate_sdk_deb
, populate_sdk_rpm
, and
populate_sdk_ipk
classes each support the specific type of SDK.
These classes are inherited by and used with the populate_sdk_base
class.
For more information on the cross-development toolchain generation, see the “Cross-Development Toolchain Generation” section in the Yocto Project Overview and Concepts Manual. 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.
5.98 prexport.bbclass
The prexport
class provides functionality for exporting
PR values.
Note
This class is not intended to be used directly. Rather, it is enabled
when using “bitbake-prserv-tool export
”.
5.99 primport.bbclass
The primport
class provides functionality for importing
PR values.
Note
This class is not intended to be used directly. Rather, it is enabled
when using “bitbake-prserv-tool import
”.
5.100 prserv.bbclass
The prserv
class provides functionality for using a PR
service in order to
automatically manage the incrementing of the PR
variable for each recipe.
This class is enabled by default because it is inherited by the package class. However, the OpenEmbedded build system will not enable the functionality of this class unless PRSERV_HOST has been set.
5.101 ptest.bbclass
The ptest
class provides functionality for packaging and installing
runtime tests for recipes that build software that provides these tests.
This class is intended to be inherited by individual recipes. However, the class’ functionality is largely disabled unless “ptest” appears in DISTRO_FEATURES. See the “Testing Packages With ptest” section in the Yocto Project Development Tasks Manual for more information on ptest.
5.102 ptest-gnome.bbclass
Enables package tests (ptests) specifically for GNOME packages, which
have tests intended to be executed with gnome-desktop-testing
.
For information on setting up and running ptests, see the “Testing Packages With ptest” section in the Yocto Project Development Tasks Manual.
5.103 python3-dir.bbclass
The python3-dir
class provides the base version, location, and site
package location for Python 3.
5.104 python3native.bbclass
The python3native
class supports using the native version of Python
3 built by the build system rather than support of the version provided
by the build host.
5.105 python3targetconfig.bbclass
The python3targetconfig
class supports using the native version of Python
3 built by the build system rather than support of the version provided
by the build host, except that the configuration for the target machine
is accessible (such as correct installation directories). This also adds a
dependency on target python3
, so should only be used where appropriate
in order to avoid unnecessarily lengthening builds.
5.106 qemu.bbclass
The qemu
class provides functionality for recipes that either need
QEMU or test for the existence of QEMU. Typically, this class is used to
run programs for a target system on the build host using QEMU’s
application emulation mode.
5.107 recipe_sanity.bbclass
The recipe_sanity
class checks for the presence of any host system
recipe prerequisites that might affect the build (e.g. variables that
are set or software that is present).
5.108 relocatable.bbclass
The relocatable
class enables relocation of binaries when they are
installed into the sysroot.
This class makes use of the chrpath class and is used by both the cross and native classes.
5.109 remove-libtool.bbclass
The remove-libtool
class adds a post function to the
do_install task to remove all .la
files
installed by libtool
. Removing these files results in them being
absent from both the sysroot and target packages.
If a recipe needs the .la
files to be installed, then the recipe can
override the removal by setting REMOVE_LIBTOOL_LA
to “0” as follows:
REMOVE_LIBTOOL_LA = "0"
Note
The remove-libtool
class is not enabled by default.
5.110 report-error.bbclass
The report-error
class supports enabling the error reporting
tool”,
which allows you to submit build error information to a central database.
The class collects debug information for recipe, recipe version, task,
machine, distro, build system, target system, host distro, branch,
commit, and log. From the information, report files using a JSON format
are created and stored in
${
LOG_DIR}/error-report
.
5.111 rm_work.bbclass
The rm_work
class supports deletion of temporary workspace, which
can ease your hard drive demands during builds.
The OpenEmbedded build system can use a substantial amount of disk space
during the build process. A portion of this space is the work files
under the ${TMPDIR}/work
directory for each recipe. Once the build
system generates the packages for a recipe, the work files for that
recipe are no longer needed. However, by default, the build system
preserves these files for inspection and possible debugging purposes. If
you would rather have these files deleted to save disk space as the
build progresses, you can enable rm_work
by adding the following to
your local.conf
file, which is found in the Build Directory.
INHERIT += "rm_work"
If you are
modifying and building source code out of the work directory for a
recipe, enabling rm_work
will potentially result in your changes to
the source being lost. To exclude some recipes from having their work
directories deleted by rm_work
, you can add the names of the recipe
or recipes you are working on to the RM_WORK_EXCLUDE variable, which
can also be set in your local.conf
file. Here is an example:
RM_WORK_EXCLUDE += "busybox glibc"
5.112 rootfs*.bbclass
The rootfs*
classes support creating the root filesystem for an
image and consist of the following classes:
The
rootfs-postcommands
class, which defines filesystem post-processing functions for image recipes.The
rootfs_deb
class, which supports creation of root filesystems for images built using.deb
packages.The
rootfs_rpm
class, which supports creation of root filesystems for images built using.rpm
packages.The
rootfs_ipk
class, which supports creation of root filesystems for images built using.ipk
packages.The
rootfsdebugfiles
class, which installs additional files found on the build host directly into the root filesystem.
The root filesystem is created from packages using one of the
rootfs*.bbclass
files as determined by the
PACKAGE_CLASSES variable.
For information on how root filesystem images are created, see the “Image Generation” section in the Yocto Project Overview and Concepts Manual.
5.113 sanity.bbclass
The sanity
class checks to see if prerequisite software is present
on the host system so that users can be notified of potential problems
that might affect their build. The class also performs basic user
configuration checks from the local.conf
configuration file to
prevent common mistakes that cause build failures. Distribution policy
usually determines whether to include this class.
5.114 scons.bbclass
The scons
class supports recipes that need to build software that
uses the SCons build system. You can use the
EXTRA_OESCONS variable to specify
additional configuration options you want to pass SCons command line.
5.115 sdl.bbclass
The sdl
class supports recipes that need to build software that uses
the Simple DirectMedia Layer (SDL) library.
5.116 python_setuptools_build_meta.bbclass
The python_setuptools_build_meta
class enables building Python modules which
declare the
PEP-517 compliant
setuptools.build_meta
build-backend
in the [build-system]
section of pyproject.toml
(See PEP-518).
Python modules built with setuptools.build_meta
can be pure Python or
include C
or Rust
extensions).
Internally this uses the python_pep517 class.
5.117 setuptools3.bbclass
The setuptools3
class supports Python version 3.x extensions that
use build systems based on setuptools
(e.g. only have a setup.py
and
have not migrated to the official pyproject.toml
format). If your recipe
uses these build systems, the recipe needs to inherit the setuptools3
class.
Note
The
setuptools3
classdo_compile()
task now callssetup.py bdist_wheel
to build thewheel
binary archive format (See PEP-427).A consequence of this is that legacy software still using deprecated
distutils
from the Python standard library cannot be packaged aswheels
. A common solution is the replacefrom distutils.core import setup
withfrom setuptools import setup
.Note
The
setuptools3
classdo_install()
task now installs thewheel
binary archive. In current versions ofsetuptools
the legacysetup.py install
method is deprecated. If thesetup.py
cannot be used with wheels, for example it creates files outside of the Python module or standard entry points, then setuptools3_legacy should be used.
5.118 setuptools3_legacy.bbclass
The setuptools3_legacy
class supports Python version 3.x extensions that use
build systems based on setuptools
(e.g. only have a setup.py
and have
not migrated to the official pyproject.toml
format). Unlike
setuptools3.bbclass
, this uses the traditional setup.py
build
and
install
commands and not wheels. This use of setuptools
like this is
deprecated
but still relatively common.
5.119 setuptools3-base.bbclass
The setuptools3-base
class provides a reusable base for other classes
that support building Python version 3.x extensions. If you need
functionality that is not provided by the setuptools3 class, you may
want to inherit setuptools3-base
. Some recipes do not need the tasks
in the setuptools3 class and inherit this class instead.
5.120 sign_rpm.bbclass
The sign_rpm
class supports generating signed RPM packages.
5.121 sip.bbclass
The sip
class supports recipes that build or package SIP-based
Python bindings.
5.122 siteconfig.bbclass
The siteconfig
class provides functionality for handling site
configuration. The class is used by the
autotools class to accelerate the
do_configure task.
5.123 siteinfo.bbclass
The siteinfo
class provides information about the targets that might
be needed by other classes or recipes.
As an example, consider Autotools, which can require tests that must
execute on the target hardware. Since this is not possible in general
when cross compiling, site information is used to provide cached test
results so these tests can be skipped over but still make the correct
values available. The meta/site directory
contains test results
sorted into different categories such as architecture, endianness, and
the libc
used. Site information provides a list of files containing
data relevant to the current build in the CONFIG_SITE variable that
Autotools automatically picks up.
The class also provides variables like SITEINFO_ENDIANNESS and SITEINFO_BITS that can be used elsewhere in the metadata.
5.124 sstate.bbclass
The sstate
class provides support for Shared State (sstate). By
default, the class is enabled through the
INHERIT_DISTRO variable’s default value.
For more information on sstate, see the “Shared State Cache” section in the Yocto Project Overview and Concepts Manual.
5.125 staging.bbclass
The staging
class installs files into individual recipe work
directories for sysroots. The class contains the following key tasks:
The do_populate_sysroot task, which is responsible for handing the files that end up in the recipe sysroots.
The do_prepare_recipe_sysroot task (a “partner” task to the
populate_sysroot
task), which installs the files into the individual recipe work directories (i.e. WORKDIR).
The code in the staging
class is complex and basically works in two
stages:
Stage One: The first stage addresses recipes that have files they want to share with other recipes that have dependencies on the originating recipe. Normally these dependencies are installed through the do_install task into
${
D}
. Thedo_populate_sysroot
task copies a subset of these files into${SYSROOT_DESTDIR}
. This subset of files is controlled by the SYSROOT_DIRS, SYSROOT_DIRS_NATIVE, and SYSROOT_DIRS_IGNORE variables.Note
Additionally, a recipe can customize the files further by declaring a processing function in the SYSROOT_PREPROCESS_FUNCS variable.
A shared state (sstate) object is built from these files and the files are placed into a subdirectory of build/tmp/sysroots-components/. The files are scanned for hardcoded paths to the original installation location. If the location is found in text files, the hardcoded locations are replaced by tokens and a list of the files needing such replacements is created. These adjustments are referred to as “FIXMEs”. The list of files that are scanned for paths is controlled by the SSTATE_SCAN_FILES variable.
Stage Two: The second stage addresses recipes that want to use something from another recipe and declare a dependency on that recipe through the DEPENDS variable. The recipe will have a do_prepare_recipe_sysroot task and when this task executes, it creates the
recipe-sysroot
andrecipe-sysroot-native
in the recipe work directory (i.e. WORKDIR). The OpenEmbedded build system creates hard links to copies of the relevant files fromsysroots-components
into the recipe work directory.Note
If hard links are not possible, the build system uses actual copies.
The build system then addresses any “FIXMEs” to paths as defined from the list created in the first stage.
Finally, any files in
${bindir}
within the sysroot that have the prefix “postinst-
” are executed.Note
Although such sysroot post installation scripts are not recommended for general use, the files do allow some issues such as user creation and module indexes to be addressed.
Because recipes can have other dependencies outside of DEPENDS (e.g.
do_unpack[depends] += "tar-native:do_populate_sysroot"
), the sysroot creation functionextend_recipe_sysroot
is also added as a pre-function for those tasks whose dependencies are not through DEPENDS but operate similarly.When installing dependencies into the sysroot, the code traverses the dependency graph and processes dependencies in exactly the same way as the dependencies would or would not be when installed from sstate. This processing means, for example, a native tool would have its native dependencies added but a target library would not have its dependencies traversed or installed. The same sstate dependency code is used so that builds should be identical regardless of whether sstate was used or not. For a closer look, see the
setscene_depvalid()
function in the sstate class.The build system is careful to maintain manifests of the files it installs so that any given dependency can be installed as needed. The sstate hash of the installed item is also stored so that if it changes, the build system can reinstall it.
5.126 syslinux.bbclass
The syslinux
class provides syslinux-specific functions for building
bootable images.
The class supports the following variables:
INITRD: Indicates list of filesystem images to concatenate and use as an initial RAM disk (initrd). This variable is optional.
ROOTFS: Indicates a filesystem image to include as the root filesystem. This variable is optional.
AUTO_SYSLINUXMENU: Enables creating an automatic menu when set to “1”.
LABELS: Lists targets for automatic configuration.
APPEND: Lists append string overrides for each label.
SYSLINUX_OPTS: Lists additional options to add to the syslinux file. Semicolon characters separate multiple options.
SYSLINUX_SPLASH: Lists a background for the VGA boot menu when you are using the boot menu.
SYSLINUX_DEFAULT_CONSOLE: Set to “console=ttyX” to change kernel boot default console.
SYSLINUX_SERIAL: Sets an alternate serial port. Or, turns off serial when the variable is set with an empty string.
SYSLINUX_SERIAL_TTY: Sets an alternate “console=tty…” kernel boot argument.
5.127 systemd.bbclass
The systemd
class provides support for recipes that install systemd
unit files.
The functionality for this class is disabled unless you have “systemd” in DISTRO_FEATURES.
Under this class, the recipe or Makefile (i.e. whatever the recipe is
calling during the do_install task)
installs unit files into
${
D}${systemd_unitdir}/system
. If the unit
files being installed go into packages other than the main package, you
need to set SYSTEMD_PACKAGES in your
recipe to identify the packages in which the files will be installed.
You should set SYSTEMD_SERVICE to the
name of the service file. You should also use a package name override to
indicate the package to which the value applies. If the value applies to
the recipe’s main package, use ${
PN}
. Here
is an example from the connman recipe:
SYSTEMD_SERVICE:${PN} = "connman.service"
Services are set up to start on boot automatically unless you have set SYSTEMD_AUTO_ENABLE to “disable”.
For more information on systemd
, see the
“Selecting an Initialization Manager”
section in the Yocto Project Development Tasks Manual.
5.128 systemd-boot.bbclass
The systemd-boot
class provides functions specific to the
systemd-boot bootloader for building bootable images. This is an
internal class and is not intended to be used directly.
Note
The systemd-boot
class is a result from merging the gummiboot
class
used in previous Yocto Project releases with the systemd
project.
Set the EFI_PROVIDER variable to “systemd-boot” to use this class. Doing so creates a standalone EFI bootloader that is not dependent on systemd.
For information on more variables used and supported in this class, see the SYSTEMD_BOOT_CFG, SYSTEMD_BOOT_ENTRIES, and SYSTEMD_BOOT_TIMEOUT variables.
You can also see the Systemd-boot documentation for more information.
5.129 terminal.bbclass
The terminal
class provides support for starting a terminal session.
The OE_TERMINAL variable controls which
terminal emulator is used for the session.
Other classes use the terminal
class anywhere a separate terminal
session needs to be started. For example, the
patch class assuming
PATCHRESOLVE is set to “user”, the
cml1 class, and the
devshell class all use the terminal
class.
5.130 testimage*.bbclass
The testimage*
classes support running automated tests against
images using QEMU and on actual hardware. The classes handle loading the
tests and starting the image. To use the classes, you need to perform
steps to set up the environment.
Note
Best practices include using IMAGE_CLASSES rather than
INHERIT to inherit the testimage
class for automated image
testing.
The tests are commands that run on the target system over ssh
. Each
test is written in Python and makes use of the unittest
module.
The testimage.bbclass
runs tests on an image when called using the
following:
$ bitbake -c testimage image
The testimage-auto
class
runs tests on an image after the image is constructed (i.e.
TESTIMAGE_AUTO must be set to “1”).
For information on how to enable, run, and create new tests, see the “Performing Automated Runtime Testing” section in the Yocto Project Development Tasks Manual.
5.131 testsdk.bbclass
This class supports running automated tests against software development
kits (SDKs). The testsdk
class runs tests on an SDK when called
using the following:
$ bitbake -c testsdk image
Note
Best practices include using IMAGE_CLASSES rather than
INHERIT to inherit the testsdk
class for automated SDK
testing.
5.132 texinfo.bbclass
This class should be inherited by recipes whose upstream packages invoke
the texinfo
utilities at build-time. Native and cross recipes are
made to use the dummy scripts provided by texinfo-dummy-native
, for
improved performance. Target architecture recipes use the genuine
Texinfo utilities. By default, they use the Texinfo utilities on the
host system.
Note
If you want to use the Texinfo recipe shipped with the build system, you can remove “texinfo-native” from ASSUME_PROVIDED and makeinfo from SANITY_REQUIRED_UTILITIES.
5.133 toaster.bbclass
The toaster
class collects information about packages and images and
sends them as events that the BitBake user interface can receive. The
class is enabled when the Toaster user interface is running.
This class is not intended to be used directly.
5.134 toolchain-scripts.bbclass
The toolchain-scripts
class provides the scripts used for setting up
the environment for installed SDKs.
5.135 typecheck.bbclass
The typecheck
class provides support for validating the values of
variables set at the configuration level against their defined types.
The OpenEmbedded build system allows you to define the type of a
variable using the “type” varflag. Here is an example:
IMAGE_FEATURES[type] = "list"
5.136 uboot-config.bbclass
The uboot-config
class provides support for U-Boot configuration for
a machine. Specify the machine in your recipe as follows:
UBOOT_CONFIG ??= <default>
UBOOT_CONFIG[foo] = "config,images"
You can also specify the machine using this method:
UBOOT_MACHINE = "config"
See the UBOOT_CONFIG and UBOOT_MACHINE variables for additional information.
5.137 uninative.bbclass
Attempts to isolate the build system from the host distribution’s C
library in order to make re-use of native shared state artifacts across
different host distributions practical. With this class enabled, a
tarball containing a pre-built C library is downloaded at the start of
the build. In the Poky reference distribution this is enabled by default
through meta/conf/distro/include/yocto-uninative.inc
. Other
distributions that do not derive from poky can also
“require conf/distro/include/yocto-uninative.inc
” to use this.
Alternatively if you prefer, you can build the uninative-tarball recipe
yourself, publish the resulting tarball (e.g. via HTTP) and set
UNINATIVE_URL
and UNINATIVE_CHECKSUM
appropriately. For an
example, see the meta/conf/distro/include/yocto-uninative.inc
.
The uninative
class is also used unconditionally by the extensible
SDK. When building the extensible SDK, uninative-tarball
is built
and the resulting tarball is included within the SDK.
5.138 update-alternatives.bbclass
The update-alternatives
class helps the alternatives system when
multiple sources provide the same command. This situation occurs when
several programs that have the same or similar function are installed
with the same name. For example, the ar
command is available from
the busybox
, binutils
and elfutils
packages. The
update-alternatives
class handles renaming the binaries so that
multiple packages can be installed without conflicts. The ar
command
still works regardless of which packages are installed or subsequently
removed. The class renames the conflicting binary in each package and
symlinks the highest priority binary during installation or removal of
packages.
To use this class, you need to define a number of variables:
These variables list alternative commands needed by a package, provide pathnames for links, default links for targets, and so forth. For details on how to use this class, see the comments in the update-alternatives.bbclass file.
Note
You can use the update-alternatives
command directly in your recipes.
However, this class simplifies things in most cases.
5.139 update-rc.d.bbclass
The update-rc.d
class uses update-rc.d
to safely install an
initialization script on behalf of the package. The OpenEmbedded build
system takes care of details such as making sure the script is stopped
before a package is removed and started when the package is installed.
Three variables control this class: INITSCRIPT_PACKAGES, INITSCRIPT_NAME and INITSCRIPT_PARAMS. See the variable links for details.
5.140 useradd*.bbclass
The useradd*
classes support the addition of users or groups for
usage by the package on the target. For example, if you have packages
that contain system services that should be run under their own user or
group, you can use these classes to enable creation of the user or
group. The meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
recipe in the Source Directory provides a simple
example that shows how to add three users and groups to two packages.
The useradd_base
class provides basic functionality for user or
groups settings.
The useradd*
classes support the
USERADD_PACKAGES,
USERADD_PARAM,
GROUPADD_PARAM, and
GROUPMEMS_PARAM variables.
The useradd-staticids
class supports the addition of users or groups
that have static user identification (uid
) and group identification
(gid
) values.
The default behavior of the OpenEmbedded build system for assigning
uid
and gid
values when packages add users and groups during
package install time is to add them dynamically. This works fine for
programs that do not care what the values of the resulting users and
groups become. In these cases, the order of the installation determines
the final uid
and gid
values. However, if non-deterministic
uid
and gid
values are a problem, you can override the default,
dynamic application of these values by setting static values. When you
set static values, the OpenEmbedded build system looks in
BBPATH for files/passwd
and files/group
files for the values.
To use static uid
and gid
values, you need to set some
variables. See the USERADDEXTENSION,
USERADD_UID_TABLES,
USERADD_GID_TABLES, and
USERADD_ERROR_DYNAMIC variables.
You can also see the useradd class for
additional information.
Note
You do not use the useradd-staticids
class directly. You either enable
or disable the class by setting the USERADDEXTENSION variable. If you
enable or disable the class in a configured system, TMPDIR might
contain incorrect uid
and gid
values. Deleting the TMPDIR
directory will correct this condition.
5.141 utility-tasks.bbclass
The utility-tasks
class provides support for various “utility” type
tasks that are applicable to all recipes, such as
do_clean and
do_listtasks.
This class is enabled by default because it is inherited by the base class.
5.142 utils.bbclass
The utils
class provides some useful Python functions that are
typically used in inline Python expressions (e.g. ${@...}
). One
example use is for bb.utils.contains()
.
This class is enabled by default because it is inherited by the base class.
5.143 vala.bbclass
The vala
class supports recipes that need to build software written
using the Vala programming language.
5.144 waf.bbclass
The waf
class supports recipes that need to build software that uses
the Waf build system. You can use the
EXTRA_OECONF or
PACKAGECONFIG_CONFARGS variables
to specify additional configuration options to be passed on the Waf
command line.
6 Tasks
Tasks are units of execution for BitBake. Recipes (.bb
files) use
tasks to complete configuring, compiling, and packaging software. This
chapter provides a reference of the tasks defined in the OpenEmbedded
build system.
6.1 Normal Recipe Build Tasks
The following sections describe normal tasks associated with building a recipe. For more information on tasks and dependencies, see the “Tasks” and “Dependencies” sections in the BitBake User Manual.
6.1.1 do_build
The default task for all recipes. This task depends on all other normal tasks required to build a recipe.
6.1.2 do_compile
Compiles the source code. This task runs with the current working
directory set to ${
B}
.
The default behavior of this task is to run the oe_runmake
function
if a makefile (Makefile
, makefile
, or GNUmakefile
) is found.
If no such file is found, the do_compile
task does nothing.
6.1.3 do_compile_ptest_base
Compiles the runtime test suite included in the software being built.
6.1.4 do_configure
Configures the source by enabling and disabling any build-time and
configuration options for the software being built. The task runs with
the current working directory set to ${
B}
.
The default behavior of this task is to run oe_runmake clean
if a
makefile (Makefile
, makefile
, or GNUmakefile
) is found and
CLEANBROKEN is not set to “1”. If no such
file is found or the CLEANBROKEN variable is set to “1”, the
do_configure
task does nothing.
6.1.5 do_configure_ptest_base
Configures the runtime test suite included in the software being built.
6.1.6 do_deploy
Writes output files that are to be deployed to
${
DEPLOY_DIR_IMAGE}
. The
task runs with the current working directory set to
${
B}
.
Recipes implementing this task should inherit the
deploy class and should write the output
to ${
DEPLOYDIR}
, which is not to be
confused with ${DEPLOY_DIR}
. The deploy class sets up
do_deploy
as a shared state (sstate) task that can be accelerated
through sstate use. The sstate mechanism takes care of copying the
output from ${DEPLOYDIR}
to ${DEPLOY_DIR_IMAGE}
.
Note
Do not write the output directly to ${DEPLOY_DIR_IMAGE}
, as this causes
the sstate mechanism to malfunction.
The do_deploy
task is not added as a task by default and
consequently needs to be added manually. If you want the task to run
after do_compile, you can add it by doing
the following:
addtask deploy after do_compile
Adding do_deploy
after other tasks works the same way.
Note
You do not need to add before do_build
to the addtask
command
(though it is harmless), because the base class contains the following:
do_build[recrdeptask] += "do_deploy"
See the “Dependencies” section in the BitBake User Manual for more information.
If the do_deploy
task re-executes, any previous output is removed
(i.e. “cleaned”).
6.1.7 do_fetch
Fetches the source code. This task uses the SRC_URI variable and the argument’s prefix to determine the correct fetcher module.
6.1.8 do_image
Starts the image generation process. The do_image
task runs after
the OpenEmbedded build system has run the
do_rootfs task during which packages are
identified for installation into the image and the root filesystem is
created, complete with post-processing.
The do_image
task performs pre-processing on the image through the
IMAGE_PREPROCESS_COMMAND and
dynamically generates supporting do_image_*
tasks as needed.
For more information on image creation, see the “Image Generation” section in the Yocto Project Overview and Concepts Manual.
6.1.9 do_image_complete
Completes the image generation process. The do_image_complete
task
runs after the OpenEmbedded build system has run the
do_image task during which image
pre-processing occurs and through dynamically generated do_image_*
tasks the image is constructed.
The do_image_complete
task performs post-processing on the image
through the
IMAGE_POSTPROCESS_COMMAND.
For more information on image creation, see the “Image Generation” section in the Yocto Project Overview and Concepts Manual.
6.1.10 do_install
Copies files that are to be packaged into the holding area
${
D}
. This task runs with the current
working directory set to ${
B}
, which is the
compilation directory. The do_install
task, as well as other tasks
that either directly or indirectly depend on the installed files (e.g.
do_package, do_package_write_*
, and
do_rootfs), run under
fakeroot.
Note
When installing files, be careful not to set the owner and group IDs
of the installed files to unintended values. Some methods of copying
files, notably when using the recursive cp
command, can preserve
the UID and/or GID of the original file, which is usually not what
you want. The host-user-contaminated
QA check checks for files
that probably have the wrong ownership.
Safe methods for installing files include the following:
The
install
utility. This utility is the preferred method.The
cp
command with the--no-preserve=ownership
option.The
tar
command with the--no-same-owner
option. See thebin_package.bbclass
file in themeta/classes
directory of the Source Directory for an example.
6.1.11 do_install_ptest_base
Copies the runtime test suite files from the compilation directory to a holding area.
6.1.12 do_package
Analyzes the content of the holding area
${
D}
and splits the content into subsets
based on available packages and files. This task makes use of the
PACKAGES and FILES
variables.
The do_package
task, in conjunction with the
do_packagedata task, also saves some
important package metadata. For additional information, see the
PKGDESTWORK variable and the
“Automatically Added Runtime Dependencies”
section in the Yocto Project Overview and Concepts Manual.
6.1.13 do_package_qa
Runs QA checks on packaged files. For more information on these checks, see the insane class.
6.1.14 do_package_write_deb
Creates Debian packages (i.e. *.deb
files) and places them in the
${
DEPLOY_DIR_DEB}
directory in
the package feeds area. For more information, see the
“Package Feeds” section in
the Yocto Project Overview and Concepts Manual.
6.1.15 do_package_write_ipk
Creates IPK packages (i.e. *.ipk
files) and places them in the
${
DEPLOY_DIR_IPK}
directory in
the package feeds area. For more information, see the
“Package Feeds” section in
the Yocto Project Overview and Concepts Manual.
6.1.16 do_package_write_rpm
Creates RPM packages (i.e. *.rpm
files) and places them in the
${
DEPLOY_DIR_RPM}
directory in
the package feeds area. For more information, see the
“Package Feeds” section in
the Yocto Project Overview and Concepts Manual.
6.1.17 do_package_write_tar
Creates tarballs and places them in the
${
DEPLOY_DIR_TAR}
directory in
the package feeds area. For more information, see the
“Package Feeds” section in
the Yocto Project Overview and Concepts Manual.
6.1.18 do_packagedata
Saves package metadata generated by the do_package task in PKGDATA_DIR to make it available globally.
6.1.19 do_patch
Locates patch files and applies them to the source code.
After fetching and unpacking source files, the build system uses the recipe’s SRC_URI statements to locate and apply patch files to the source code.
Note
The build system uses the FILESPATH variable to determine the default set of directories when searching for patches.
Patch files, by default, are *.patch
and *.diff
files created
and kept in a subdirectory of the directory holding the recipe file. For
example, consider the
bluez5
recipe from the OE-Core layer (i.e. poky/meta
):
poky/meta/recipes-connectivity/bluez5
This recipe has two patch files located here:
poky/meta/recipes-connectivity/bluez5/bluez5
In the bluez5
recipe, the SRC_URI statements point to the source
and patch files needed to build the package.
Note
In the case for the bluez5_5.48.bb
recipe, the SRC_URI statements
are from an include file bluez5.inc
.
As mentioned earlier, the build system treats files whose file types are
.patch
and .diff
as patch files. However, you can use the
“apply=yes” parameter with the SRC_URI statement to indicate any
file as a patch file:
SRC_URI = " \
git://path_to_repo/some_package \
file://file;apply=yes \
"
Conversely, if you have a file whose file type is .patch
or .diff
and you want to exclude it so that the do_patch
task does not apply
it during the patch phase, you can use the “apply=no” parameter with the
SRC_URI statement:
SRC_URI = " \
git://path_to_repo/some_package \
file://file1.patch \
file://file2.patch;apply=no \
"
In the previous example file1.patch
would be applied as a patch by default
while file2.patch
would not be applied.
You can find out more about the patching process in the “Patching” section in the Yocto Project Overview and Concepts Manual and the “Patching Code” section in the Yocto Project Development Tasks Manual.
6.1.20 do_populate_lic
Writes license information for the recipe that is collected later when the image is constructed.
6.1.21 do_populate_sdk
Creates the file and directory structure for an installable SDK. See the “SDK Generation” section in the Yocto Project Overview and Concepts Manual for more information.
6.1.22 do_populate_sdk_ext
Creates the file and directory structure for an installable extensible SDK (eSDK). See the “SDK Generation” section in the Yocto Project Overview and Concepts Manual for more information.
6.1.23 do_populate_sysroot
Stages (copies) a subset of the files installed by the
do_install task into the appropriate
sysroot. For information on how to access these files from other
recipes, see the STAGING_DIR* variables.
Directories that would typically not be needed by other recipes at build
time (e.g. /etc
) are not copied by default.
For information on what directories are copied by default, see the SYSROOT_DIRS* variables. You can change these variables inside your recipe if you need to make additional (or fewer) directories available to other recipes at build time.
The do_populate_sysroot
task is a shared state (sstate) task, which
means that the task can be accelerated through sstate use. Realize also
that if the task is re-executed, any previous output is removed (i.e.
“cleaned”).
6.1.24 do_prepare_recipe_sysroot
Installs the files into the individual recipe specific sysroots (i.e.
recipe-sysroot
and recipe-sysroot-native
under
${
WORKDIR}
based upon the
dependencies specified by DEPENDS). See the
“staging” class for more information.
6.1.25 do_rm_work
Removes work files after the OpenEmbedded build system has finished with them. You can learn more by looking at the “rm_work.bbclass” section.
6.1.26 do_unpack
Unpacks the source code into a working directory pointed to by
${
WORKDIR}
. The S
variable also plays a role in where unpacked source files ultimately
reside. For more information on how source files are unpacked, see the
“Source Fetching”
section in the Yocto Project Overview and Concepts Manual and also see
the WORKDIR and S variable descriptions.
6.2 Manually Called Tasks
These tasks are typically manually triggered (e.g. by using the
bitbake -c
command-line option):
6.2.1 do_checkuri
Validates the SRC_URI value.
6.2.2 do_clean
Removes all output files for a target from the
do_unpack task forward (i.e. do_unpack
,
do_configure,
do_compile,
do_install, and
do_package).
You can run this task using BitBake as follows:
$ bitbake -c clean recipe
Running this task does not remove the
sstate cache files.
Consequently, if no changes have been made and the recipe is rebuilt
after cleaning, output files are simply restored from the sstate cache.
If you want to remove the sstate cache files for the recipe, you need to
use the do_cleansstate task instead
(i.e. bitbake -c cleansstate
recipe).
6.2.3 do_cleanall
Removes all output files, shared state
(sstate) cache, and
downloaded source files for a target (i.e. the contents of
DL_DIR). Essentially, the do_cleanall
task is
identical to the do_cleansstate task
with the added removal of downloaded source files.
You can run this task using BitBake as follows:
$ bitbake -c cleanall recipe
Typically, you would not normally use the cleanall
task. Do so only
if you want to start fresh with the do_fetch
task.
6.2.4 do_cleansstate
Removes all output files and shared state
(sstate) cache for a
target. Essentially, the do_cleansstate
task is identical to the
do_clean task with the added removal of
shared state (sstate)
cache.
You can run this task using BitBake as follows:
$ bitbake -c cleansstate recipe
When you run the do_cleansstate
task, the OpenEmbedded build system
no longer uses any sstate. Consequently, building the recipe from
scratch is guaranteed.
Note
The do_cleansstate
task cannot remove sstate from a remote sstate
mirror. If you need to build a target from scratch using remote mirrors, use
the “-f” option as follows:
$ bitbake -f -c do_cleansstate target
6.2.5 do_pydevshell
Starts a shell in which an interactive Python interpreter allows you to
interact with the BitBake build environment. From within this shell, you
can directly examine and set bits from the data store and execute
functions as if within the BitBake environment. See the “Using a Python Development Shell” section in
the Yocto Project Development Tasks Manual for more information about
using pydevshell
.
6.2.6 do_devshell
Starts a shell whose environment is set up for development, debugging,
or both. See the “Using a Development Shell” section in the
Yocto Project Development Tasks Manual for more information about using
devshell
.
6.2.7 do_listtasks
Lists all defined tasks for a target.
6.2.8 do_package_index
Creates or updates the index in the Package Feeds area.
Note
This task is not triggered with the bitbake -c
command-line option as
are the other tasks in this section. Because this task is specifically for
the package-index
recipe, you run it using bitbake package-index
.
7 devtool
Quick Reference
The devtool
command-line tool provides a number of features that
help you build, test, and package software. This command is available
alongside the bitbake
command. Additionally, the devtool
command
is a key part of the extensible SDK.
This chapter provides a Quick Reference for the devtool
command. For
more information on how to apply the command when using the extensible
SDK, see the “Using the Extensible SDK” chapter in the Yocto
Project Application Development and the Extensible Software Development
Kit (eSDK) manual.
7.1 Getting Help
The devtool
command line is organized similarly to Git in that it
has a number of sub-commands for each function. You can run
devtool --help
to see all the commands:
$ devtool -h
NOTE: Starting bitbake server...
usage: devtool [--basepath BASEPATH] [--bbpath BBPATH] [-d] [-q] [--color COLOR] [-h] <subcommand> ...
OpenEmbedded development tool
options:
--basepath BASEPATH Base directory of SDK / build directory
--bbpath BBPATH Explicitly specify the BBPATH, rather than getting it from the metadata
-d, --debug Enable debug output
-q, --quiet Print only errors
--color COLOR Colorize output (where COLOR is auto, always, never)
-h, --help show this help message and exit
subcommands:
Beginning work on a recipe:
add Add a new recipe
modify Modify the source for an existing recipe
upgrade Upgrade an existing recipe
Getting information:
status Show workspace status
latest-version Report the latest version of an existing recipe
check-upgrade-status Report upgradability for multiple (or all) recipes
search Search available recipes
Working on a recipe in the workspace:
build Build a recipe
rename Rename a recipe file in the workspace
edit-recipe Edit a recipe file
find-recipe Find a recipe file
configure-help Get help on configure script options
update-recipe Apply changes from external source tree to recipe
reset Remove a recipe from your workspace
finish Finish working on a recipe in your workspace
Testing changes on target:
deploy-target Deploy recipe output files to live target machine
undeploy-target Undeploy recipe output files in live target machine
build-image Build image including workspace recipe packages
Advanced:
create-workspace Set up workspace in an alternative location
extract Extract the source for an existing recipe
sync Synchronize the source tree for an existing recipe
menuconfig Alter build-time configuration for a recipe
import Import exported tar archive into workspace
export Export workspace into a tar archive
other:
selftest-reverse Reverse value (for selftest)
pluginfile Print the filename of this plugin
bbdir Print the BBPATH directory of this plugin
count How many times have this plugin been registered.
multiloaded How many times have this plugin been initialized
Use devtool <subcommand> --help to get help on a specific command
As directed in the general help output, you can
get more syntax on a specific command by providing the command name and
using --help
:
$ devtool add --help
NOTE: Starting bitbake server...
usage: devtool add [-h] [--same-dir | --no-same-dir] [--fetch URI] [--npm-dev] [--version VERSION] [--no-git] [--srcrev SRCREV | --autorev] [--srcbranch SRCBRANCH] [--binary] [--also-native] [--src-subdir SUBDIR] [--mirrors]
[--provides PROVIDES]
[recipename] [srctree] [fetchuri]
Adds a new recipe to the workspace to build a specified source tree. Can optionally fetch a remote URI and unpack it to create the source tree.
arguments:
recipename Name for new recipe to add (just name - no version, path or extension). If not specified, will attempt to auto-detect it.
srctree Path to external source tree. If not specified, a subdirectory of /media/build1/poky/build/workspace/sources will be used.
fetchuri Fetch the specified URI and extract it to create the source tree
options:
-h, --help show this help message and exit
--same-dir, -s Build in same directory as source
--no-same-dir Force build in a separate build directory
--fetch URI, -f URI Fetch the specified URI and extract it to create the source tree (deprecated - pass as positional argument instead)
--npm-dev For npm, also fetch devDependencies
--version VERSION, -V VERSION
Version to use within recipe (PV)
--no-git, -g If fetching source, do not set up source tree as a git repository
--srcrev SRCREV, -S SRCREV
Source revision to fetch if fetching from an SCM such as git (default latest)
--autorev, -a When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed
--srcbranch SRCBRANCH, -B SRCBRANCH
Branch in source repository if fetching from an SCM such as git (default master)
--binary, -b Treat the source tree as something that should be installed verbatim (no compilation, same directory structure). Useful with binary packages e.g. RPMs.
--also-native Also add native variant (i.e. support building recipe for the build host as well as the target machine)
--src-subdir SUBDIR Specify subdirectory within source tree to use
--mirrors Enable PREMIRRORS and MIRRORS for source tree fetching (disable by default).
--provides PROVIDES, -p PROVIDES
Specify an alias for the item provided by the recipe. E.g. virtual/libgl
7.2 The Workspace Layer Structure
devtool
uses a “Workspace” layer in which to accomplish builds. This
layer is not specific to any single devtool
command but is rather a
common working area used across the tool.
The following figure shows the workspace structure:

attic - A directory created if devtool believes it must preserve
anything when you run "devtool reset". For example, if you
run "devtool add", make changes to the recipe, and then
run "devtool reset", devtool takes notice that the file has
been changed and moves it into the attic should you still
want the recipe.
README - Provides information on what is in workspace layer and how to
manage it.
.devtool_md5 - A checksum file used by devtool.
appends - A directory that contains *.bbappend files, which point to
external source.
conf - A configuration directory that contains the layer.conf file.
recipes - A directory containing recipes. This directory contains a
folder for each directory added whose name matches that of the
added recipe. devtool places the recipe.bb file
within that sub-directory.
sources - A directory containing a working copy of the source files used
when building the recipe. This is the default directory used
as the location of the source tree when you do not provide a
source tree path. This directory contains a folder for each
set of source files matched to a corresponding recipe.
7.3 Adding a New Recipe to the Workspace Layer
Use the devtool add
command to add a new recipe to the workspace
layer. The recipe you add should not exist - devtool
creates it for
you. The source files the recipe uses should exist in an external area.
The following example creates and adds a new recipe named jackson
to
a workspace layer the tool creates. The source code built by the recipes
resides in /home/user/sources/jackson
:
$ devtool add jackson /home/user/sources/jackson
If you add a recipe and the workspace layer does not exist, the command creates the layer and populates it as described in “The Workspace Layer Structure” section.
Running devtool add
when the workspace layer exists causes the tool
to add the recipe, append files, and source files into the existing
workspace layer. The .bbappend
file is created to point to the
external source tree.
Note
If your recipe has runtime dependencies defined, you must be sure that these packages exist on the target hardware before attempting to run your application. If dependent packages (e.g. libraries) do not exist on the target, your application, when run, will fail to find those functions. For more information, see the “Deploying Your Software on the Target Machine” section.
By default, devtool add
uses the latest revision (i.e. master) when
unpacking files from a remote URI. In some cases, you might want to
specify a source revision by branch, tag, or commit hash. You can
specify these options when using the devtool add
command:
To specify a source branch, use the
--srcbranch
option:$ devtool add --srcbranch kirkstone jackson /home/user/sources/jackson
In the previous example, you are checking out the kirkstone branch.
To specify a specific tag or commit hash, use the
--srcrev
option:$ devtool add --srcrev yocto-4.0.1 jackson /home/user/sources/jackson $ devtool add --srcrev some_commit_hash /home/user/sources/jackson
The previous examples check out the yocto-4.0.1 tag and the commit associated with the some_commit_hash hash.
Note
If you prefer to use the latest revision every time the recipe is
built, use the options --autorev
or -a
.
7.4 Extracting the Source for an Existing Recipe
Use the devtool extract
command to extract the source for an
existing recipe. When you use this command, you must supply the root
name of the recipe (i.e. no version, paths, or extensions), and you must
supply the directory to which you want the source extracted.
Additional command options let you control the name of a development branch into which you can checkout the source and whether or not to keep a temporary directory, which is useful for debugging.
7.5 Synchronizing a Recipe’s Extracted Source Tree
Use the devtool sync
command to synchronize a previously extracted
source tree for an existing recipe. When you use this command, you must
supply the root name of the recipe (i.e. no version, paths, or
extensions), and you must supply the directory to which you want the
source extracted.
Additional command options let you control the name of a development branch into which you can checkout the source and whether or not to keep a temporary directory, which is useful for debugging.
7.6 Modifying an Existing Recipe
Use the devtool modify
command to begin modifying the source of an
existing recipe. This command is very similar to the
add command
except that it does not physically create the recipe in the workspace
layer because the recipe already exists in an another layer.
The devtool modify
command extracts the source for a recipe, sets it
up as a Git repository if the source had not already been fetched from
Git, checks out a branch for development, and applies any patches from
the recipe as commits on top. You can use the following command to
checkout the source files:
$ devtool modify recipe
Using the above command form, devtool
uses the existing recipe’s
SRC_URI statement to locate the upstream source,
extracts the source into the default sources location in the workspace.
The default development branch used is “devtool”.
7.7 Edit an Existing Recipe
Use the devtool edit-recipe
command to run the default editor, which
is identified using the EDITOR
variable, on the specified recipe.
When you use the devtool edit-recipe
command, you must supply the
root name of the recipe (i.e. no version, paths, or extensions). Also,
the recipe file itself must reside in the workspace as a result of the
devtool add
or devtool upgrade
commands.
7.8 Updating a Recipe
Use the devtool update-recipe
command to update your recipe with
patches that reflect changes you make to the source files. For example,
if you know you are going to work on some code, you could first use the
devtool modify command to extract
the code and set up the workspace. After which, you could modify,
compile, and test the code.
When you are satisfied with the results and you have committed your
changes to the Git repository, you can then run the
devtool update-recipe
to create the patches and update the recipe:
$ devtool update-recipe recipe
If you run the devtool update-recipe
without committing your changes, the command ignores the changes.
Often, you might want to apply customizations made to your software in
your own layer rather than apply them to the original recipe. If so, you
can use the -a
or --append
option with the
devtool update-recipe
command. These options allow you to specify
the layer into which to write an append file:
$ devtool update-recipe recipe -a base-layer-directory
The *.bbappend
file is created at the
appropriate path within the specified layer directory, which may or may
not be in your bblayers.conf
file. If an append file already exists,
the command updates it appropriately.
7.9 Checking on the Upgrade Status of a Recipe
Upstream recipes change over time. Consequently, you might find that you need to determine if you can upgrade a recipe to a newer version.
To check on the upgrade status of a recipe, you can use the
devtool latest-version recipe
command, which quickly shows the current
version and the latest version available upstream. To get a more global
picture, use the devtool check-upgrade-status
command, which takes a
list of recipes as input, or no arguments, in which case it checks all
available recipes. This command will only print the recipes for which
a new upstream version is available. Each such recipe will have its current
version and latest upstream version, as well as the email of the maintainer
and any additional information such as the commit hash or reason for not
being able to upgrade it, displayed in a table.
This upgrade checking mechanism relies on the optional UPSTREAM_CHECK_URI, UPSTREAM_CHECK_REGEX, UPSTREAM_CHECK_GITTAGREGEX, UPSTREAM_CHECK_COMMITS and UPSTREAM_VERSION_UNKNOWN variables in package recipes.
Note
Most of the time, the above variables are unnecessary. They are only required when upstream does something unusual, and default mechanisms cannot find the new upstream versions.
For the
oe-core
layer, recipe maintainers come from the maintainers.inc file.If the recipe is using the Git Fetcher (git://) rather than a tarball, the commit hash points to the commit that matches the recipe’s latest version tag, or in the absence of suitable tags, to the latest commit (when UPSTREAM_CHECK_COMMITS set to
1
in the recipe).
As with all devtool
commands, you can get help on the individual
command:
$ devtool check-upgrade-status -h
NOTE: Starting bitbake server...
usage: devtool check-upgrade-status [-h] [--all] [recipe [recipe ...]]
Prints a table of recipes together with versions currently provided by recipes, and latest upstream versions, when there is a later version available
arguments:
recipe Name of the recipe to report (omit to report upgrade info for all recipes)
options:
-h, --help show this help message and exit
--all, -a Show all recipes, not just recipes needing upgrade
Unless you provide a specific recipe name on the command line, the command checks all recipes in all configured layers.
Following is a partial example table that reports on all the recipes.
Notice the reported reason for not upgrading the base-passwd
recipe.
In this example, while a new version is available upstream, you do not
want to use it because the dependency on cdebconf
is not easily
satisfied. Maintainers can explicit the reason that is shown by adding
the RECIPE_NO_UPDATE_REASON variable to the corresponding recipe.
See base-passwd.bb
for an example.
$ devtool check-upgrade-status
...
INFO: bind 9.16.20 9.16.21 Armin Kuster <akuster808@gmail.com>
INFO: inetutils 2.1 2.2 Tom Rini <trini@konsulko.com>
INFO: iproute2 5.13.0 5.14.0 Changhyeok Bae <changhyeok.bae@gmail.com>
INFO: openssl 1.1.1l 3.0.0 Alexander Kanavin <alex.kanavin@gmail.com>
INFO: base-passwd 3.5.29 3.5.51 Anuj Mittal <anuj.mittal@intel.com> cannot be updated due to: Version 3.5.38 requires cdebconf for update-passwd utility
...
Last but not least, you may set UPSTREAM_VERSION_UNKNOWN to 1
in a recipe when there’s currently no way to determine its latest upstream
version.
7.10 Upgrading a Recipe
As software matures, upstream recipes are upgraded to newer versions. As
a developer, you need to keep your local recipes up-to-date with the
upstream version releases. There are several ways of upgrading recipes.
You can read about them in the “Upgrading Recipes”
section of the Yocto Project Development Tasks Manual. This section
overviews the devtool upgrade
command.
Before you upgrade a recipe, you can check on its upgrade status. See the “Checking on the Upgrade Status of a Recipe” section for more information.
The devtool upgrade
command upgrades an existing recipe to a more
recent version of the recipe upstream. The command puts the upgraded
recipe file along with any associated files into a “workspace” and, if
necessary, extracts the source tree to a specified location. During the
upgrade, patches associated with the recipe are rebased or added as
needed.
When you use the devtool upgrade
command, you must supply the root
name of the recipe (i.e. no version, paths, or extensions), and you must
supply the directory to which you want the source extracted. Additional
command options let you control things such as the version number to
which you want to upgrade (i.e. the PV), the source
revision to which you want to upgrade (i.e. the
SRCREV), whether or not to apply patches, and so
forth.
You can read more on the devtool upgrade
workflow in the
“Use devtool upgrade to Create a Version of the Recipe that Supports a Newer Version of the Software”
section in the Yocto Project Application Development and the Extensible
Software Development Kit (eSDK) manual. You can also see an example of
how to use devtool upgrade
in the “Using devtool upgrade”
section in the Yocto Project Development Tasks Manual.
7.11 Resetting a Recipe
Use the devtool reset
command to remove a recipe and its
configuration (e.g. the corresponding .bbappend
file) from the
workspace layer. Realize that this command deletes the recipe and the
append file. The command does not physically move them for you.
Consequently, you must be sure to physically relocate your updated
recipe and the append file outside of the workspace layer before running
the devtool reset
command.
If the devtool reset
command detects that the recipe or the append
files have been modified, the command preserves the modified files in a
separate “attic” subdirectory under the workspace layer.
Here is an example that resets the workspace directory that contains the
mtr
recipe:
$ devtool reset mtr
NOTE: Cleaning sysroot for recipe mtr...
NOTE: Leaving source tree /home/scottrif/poky/build/workspace/sources/mtr as-is; if you no longer need it then please delete it manually
$
7.12 Building Your Recipe
Use the devtool build
command to build your recipe. The
devtool build
command is equivalent to the
bitbake -c populate_sysroot
command.
When you use the devtool build
command, you must supply the root
name of the recipe (i.e. do not provide versions, paths, or extensions).
You can use either the -s
or the --disable-parallel-make
options to
disable parallel makes during the build. Here is an example:
$ devtool build recipe
7.13 Building Your Image
Use the devtool build-image
command to build an image, extending it
to include packages from recipes in the workspace. Using this command is
useful when you want an image that ready for immediate deployment onto a
device for testing. For proper integration into a final image, you need
to edit your custom image recipe appropriately.
When you use the devtool build-image
command, you must supply the
name of the image. This command has no command line options:
$ devtool build-image image
7.14 Deploying Your Software on the Target Machine
Use the devtool deploy-target
command to deploy the recipe’s build
output to the live target machine:
$ devtool deploy-target recipe target
The target is the address of the target machine, which must be running
an SSH server (i.e. user@hostname[:destdir]
).
This command deploys all files installed during the do_install task. Furthermore, you do not need to have package management enabled within the target machine. If you do, the package manager is bypassed.
Note
The deploy-target
functionality is for development only. You
should never use it to update an image that will be used in
production.
Some conditions could prevent a deployed application from behaving as expected. When both of the following conditions are met, your application has the potential to not behave correctly when run on the target:
You are deploying a new application to the target and the recipe you used to build the application had correctly defined runtime dependencies.
The target does not physically have the packages on which the application depends installed.
If both of these conditions are met, your application will not behave as
expected. The reason for this misbehavior is because the
devtool deploy-target
command does not deploy the packages (e.g.
libraries) on which your new application depends. The assumption is that
the packages are already on the target. Consequently, when a runtime
call is made in the application for a dependent function (e.g. a library
call), the function cannot be found.
To be sure you have all the dependencies local to the target, you need to be sure that the packages are pre-deployed (installed) on the target before attempting to run your application.
7.15 Removing Your Software from the Target Machine
Use the devtool undeploy-target
command to remove deployed build
output from the target machine. For the devtool undeploy-target
command to work, you must have previously used the
“devtool deploy-target”
command.
$ devtool undeploy-target recipe target
The target is the
address of the target machine, which must be running an SSH server (i.e.
user@hostname
).
7.16 Creating the Workspace Layer in an Alternative Location
Use the devtool create-workspace
command to create a new workspace
layer in your Build Directory. When you create a
new workspace layer, it is populated with the README
file and the
conf
directory only.
The following example creates a new workspace layer in your current working and by default names the workspace layer “workspace”:
$ devtool create-workspace
You can create a workspace layer anywhere by supplying a pathname with the command. The following command creates a new workspace layer named “new-workspace”:
$ devtool create-workspace /home/scottrif/new-workspace
7.17 Get the Status of the Recipes in Your Workspace
Use the devtool status
command to list the recipes currently in your
workspace. Information includes the paths to their respective external
source trees.
The devtool status
command has no command-line options:
$ devtool status
Following is sample output after using
devtool add
to create and add the mtr_0.86.bb
recipe to the workspace
directory:
$ devtool status
mtr:/home/scottrif/poky/build/workspace/sources/mtr (/home/scottrif/poky/build/workspace/recipes/mtr/mtr_0.86.bb)
$
7.18 Search for Available Target Recipes
Use the devtool search
command to search for available target
recipes. The command matches the recipe name, package name, description,
and installed files. The command displays the recipe name as a result of
a match.
When you use the devtool search
command, you must supply a keyword.
The command uses the keyword when searching for a match.
8 OpenEmbedded Kickstart (.wks
) Reference
8.1 Introduction
The current Wic implementation supports only the basic kickstart
partitioning commands: partition
(or part
for short) and
bootloader
.
Note
Future updates will implement more commands and options. If you use anything that is not specifically supported, results can be unpredictable.
This chapter provides a reference on the available kickstart commands. The information lists the commands, their syntax, and meanings. Kickstart commands are based on the Fedora kickstart versions but with modifications to reflect Wic capabilities. You can see the original documentation for those commands at the following link: https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html
8.2 Command: part or partition
Either of these commands creates a partition on the system and uses the following syntax:
part [mntpoint]
partition [mntpoint]
If you do not provide mntpoint, Wic creates a partition but does not mount it.
The mntpoint
is where the partition is mounted and must be in one of
the following forms:
/path
: For example, “/”, “/usr”, or “/home”swap
: The created partition is used as swap space
Specifying a mntpoint causes the partition to automatically be mounted.
Wic achieves this by adding entries to the filesystem table (fstab)
during image generation. In order for Wic to generate a valid fstab, you
must also provide one of the --ondrive
, --ondisk
, or
--use-uuid
partition options as part of the command.
Note
The mount program must understand the PARTUUID syntax you use with
--use-uuid
and non-root mountpoint, including swap. The default
configuration of BusyBox in OpenEmbedded supports this, but this may
be disabled in custom configurations.
Here is an example that uses “/” as the mountpoint. The command uses
--ondisk
to force the partition onto the sdb
disk:
part / --source rootfs --ondisk sdb --fstype=ext3 --label platform --align 1024
Here is a list that describes other supported options you can use with
the part
and partition
commands:
--size
: The minimum partition size. Specify as an integer value optionally followed by one of the units “k” / “K” for kibibyte, “M” for mebibyte and “G” for gibibyte. The default unit if none is given is “M”. You do not need this option if you use--source
.--fixed-size
: The exact partition size. Specify as an integer value optionally followed by one of the units “k” / “K” for kibibyte, “M” for mebibyte and “G” for gibibyte. The default unit if none is given is “M”. Cannot be specify together with--size
. An error occurs when assembling the disk image if the partition data is larger than--fixed-size
.--source
: This option is a Wic-specific option that names the source of the data that populates the partition. The most common value for this option is “rootfs”, but you can use any value that maps to a valid source plugin. For information on the source plugins, see the “Using the Wic Plugin Interface” section in the Yocto Project Development Tasks Manual.If you use
--source rootfs
, Wic creates a partition as large as needed and fills it with the contents of the root filesystem pointed to by the-r
command-line option or the equivalent root filesystem derived from the-e
command-line option. The filesystem type used to create the partition is driven by the value of the--fstype
option specified for the partition. See the entry on--fstype
that follows for more information.If you use
--source plugin-name
, Wic creates a partition as large as needed and fills it with the contents of the partition that is generated by the specified plugin name using the data pointed to by the-r
command-line option or the equivalent root filesystem derived from the-e
command-line option. Exactly what those contents are and filesystem type used are dependent on the given plugin implementation.If you do not use the
--source
option, thewic
command creates an empty partition. Consequently, you must use the--size
option to specify the size of the empty partition.--ondisk
or--ondrive
: Forces the partition to be created on a particular disk.--fstype
: Sets the file system type for the partition. Valid values are:btrfs
erofs
ext2
ext3
ext4
squashfs
swap
vfat
--fsoptions
: Specifies a free-form string of options to be used when mounting the filesystem. This string is copied into the/etc/fstab
file of the installed system and should be enclosed in quotes. If not specified, the default string is “defaults”.--label label
: Specifies the label to give to the filesystem to be made on the partition. If the given label is already in use by another filesystem, a new label is created for the partition.--active
: Marks the partition as active.--align (in KBytes)
: This option is a Wic-specific option that says to start partitions on boundaries given x KBytes.--offset
: This option is a Wic-specific option that says to place a partition at exactly the specified offset. If the partition cannot be placed at the specified offset, the image build will fail. Specify as an integer value optionally followed by one of the units “s” / “S” for 512 byte sector, “k” / “K” for kibibyte, “M” for mebibyte and “G” for gibibyte. The default unit if none is given is “k”.--no-table
: This option is a Wic-specific option. Using the option reserves space for the partition and causes it to become populated. However, the partition is not added to the partition table.--exclude-path
: This option is a Wic-specific option that excludes the given relative path from the resulting image. This option is only effective with the rootfs source plugin.--extra-space
: This option is a Wic-specific option that adds extra space after the space filled by the content of the partition. The final size can exceed the size specified by the--size
option. The default value is 10M. Specify as an integer value optionally followed by one of the units “k” / “K” for kibibyte, “M” for mebibyte and “G” for gibibyte. The default unit if none is given is “M”.--overhead-factor
: This option is a Wic-specific option that multiplies the size of the partition by the option’s value. You must supply a value greater than or equal to “1”. The default value is “1.3”.--part-name
: This option is a Wic-specific option that specifies a name for GPT partitions.--part-type
: This option is a Wic-specific option that specifies the partition type globally unique identifier (GUID) for GPT partitions. You can find the list of partition type GUIDs at https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs.--use-uuid
: This option is a Wic-specific option that causes Wic to generate a random GUID for the partition. The generated identifier is used in the bootloader configuration to specify the root partition.--uuid
: This option is a Wic-specific option that specifies the partition UUID.--fsuuid
: This option is a Wic-specific option that specifies the filesystem UUID. You can generate or modify WKS_FILE with this option if a preconfigured filesystem UUID is added to the kernel command line in the bootloader configuration before you run Wic.--system-id
: This option is a Wic-specific option that specifies the partition system ID, which is a one byte long, hexadecimal parameter with or without the 0x prefix.--mkfs-extraopts
: This option specifies additional options to pass to themkfs
utility. Some default options for certain filesystems do not take effect. See Wic’s help on kickstart (i.e.wic help kickstart
).
8.3 Command: bootloader
This command specifies how the bootloader should be configured and supports the following options:
Note
Bootloader functionality and boot partitions are implemented by the various –source plugins that implement bootloader functionality. The bootloader command essentially provides a means of modifying bootloader configuration.
--timeout
: Specifies the number of seconds before the bootloader times out and boots the default option.--append
: Specifies kernel parameters. These parameters will be added to the syslinux APPEND orgrub
kernel command line.--configfile
: Specifies a user-defined configuration file for the bootloader. You can provide a full pathname for the file or a file located in thecanned-wks
folder. This option overrides all other bootloader options.
9 QA Error and Warning Messages
9.1 Introduction
When building a recipe, the OpenEmbedded build system performs various QA checks on the output to ensure that common issues are detected and reported. Sometimes when you create a new recipe to build new software, it will build with no problems. When this is not the case, or when you have QA issues building any software, it could take a little time to resolve them.
While it is tempting to ignore a QA message or even to disable QA checks, it is best to try and resolve any reported QA issues. This chapter provides a list of the QA messages and brief explanations of the issues you could encounter so that you can properly resolve problems.
The next section provides a list of all QA error and warning messages based on a default configuration. Each entry provides the message or error form along with an explanation.
Note
At the end of each message, the name of the associated QA test (as listed in the “insane.bbclass” section) appears within square brackets.
As mentioned, this list of error and warning messages is for QA checks only. The list does not cover all possible build errors or warnings you could encounter.
Because some QA checks are disabled by default, this list does not include all possible QA check errors and warnings.
9.2 Errors and Warnings
<packagename>: <path> is using libexec please relocate to <libexecdir> [libexec]
The specified package contains files in
/usr/libexec
when the distro configuration uses a different path for<libexecdir>
By default,<libexecdir>
is$prefix/libexec
. However, this default can be changed (e.g.${libdir}
).
package <packagename> contains bad RPATH <rpath> in file <file> [rpaths]
The specified binary produced by the recipe contains dynamic library load paths (rpaths) that contain build system paths such as TMPDIR, which are incorrect for the target and could potentially be a security issue. Check for bad
-rpath
options being passed to the linker in your do_compile log. Depending on the build system used by the software being built, there might be a configure option to disable rpath usage completely within the build of the software.
<packagename>: <file> contains probably-redundant RPATH <rpath> [useless-rpaths]
The specified binary produced by the recipe contains dynamic library load paths (rpaths) that on a standard system are searched by default by the linker (e.g.
/lib
and/usr/lib
). While these paths will not cause any breakage, they do waste space and are unnecessary. Depending on the build system used by the software being built, there might be a configure option to disable rpath usage completely within the build of the software.
<packagename> requires <files>, but no providers in its RDEPENDS [file-rdeps]
A file-level dependency has been identified from the specified package on the specified files, but there is no explicit corresponding entry in RDEPENDS. If particular files are required at runtime then RDEPENDS should be declared in the recipe to ensure the packages providing them are built.
<packagename1> rdepends on <packagename2>, but it isn't a build dependency? [build-deps]
There is a runtime dependency between the two specified packages, but there is nothing explicit within the recipe to enable the OpenEmbedded build system to ensure that dependency is satisfied. This condition is usually triggered by an RDEPENDS value being added at the packaging stage rather than up front, which is usually automatic based on the contents of the package. In most cases, you should change the recipe to add an explicit RDEPENDS for the dependency.
non -dev/-dbg/nativesdk- package contains symlink .so: <packagename> path '<path>' [dev-so]
Symlink
.so
files are for development only, and should therefore go into the-dev
package. This situation might occur if you add*.so*
rather than*.so.*
to a non-dev package. Change FILES (and possibly PACKAGES) such that the specified.so
file goes into an appropriate-dev
package.
non -staticdev package contains static .a library: <packagename> path '<path>' [staticdev]
Static
.a
library files should go into a-staticdev
package. Change FILES (and possibly PACKAGES) such that the specified.a
file goes into an appropriate-staticdev
package.
<packagename>: found library in wrong location [libdir]
The specified file may have been installed into an incorrect (possibly hardcoded) installation path. For example, this test will catch recipes that install
/lib/bar.so
when${base_libdir}
is “lib32”. Another example is when recipes install/usr/lib64/foo.so
when${libdir}
is “/usr/lib”. False positives occasionally exist. For these cases add “libdir” to INSANE_SKIP for the package.
non debug package contains .debug directory: <packagename> path <path> [debug-files]
The specified package contains a
.debug
directory, which should not appear in anything but the-dbg
package. This situation might occur if you add a path which contains a.debug
directory and do not explicitly add the.debug
directory to the-dbg
package. If this is the case, add the.debug
directory explicitly toFILES:${PN}-dbg
. See FILES for additional information on FILES.
<packagename> installs files in <path>, but it is expected to be empty [empty-dirs]
The specified package is installing files into a directory that is normally expected to be empty (such as
/tmp
). These files may be more appropriately installed to a different location, or perhaps alternatively not installed at all, usually by updating thedo_install
task/function.
Architecture did not match (<file_arch>, expected <machine_arch>) in <file> [arch]
By default, the OpenEmbedded build system checks the Executable and Linkable Format (ELF) type, bit size, and endianness of any binaries to ensure they match the target architecture. This test fails if any binaries do not match the type since there would be an incompatibility. The test could indicate that the wrong compiler or compiler options have been used. Sometimes software, like bootloaders, might need to bypass this check. If the file you receive the error for is firmware that is not intended to be executed within the target operating system or is intended to run on a separate processor within the device, you can add “arch” to INSANE_SKIP for the package. Another option is to check the do_compile log and verify that the compiler options being used are correct.
Bit size did not match (<file_bits>, expected <machine_bits>) in <file> [arch]
By default, the OpenEmbedded build system checks the Executable and Linkable Format (ELF) type, bit size, and endianness of any binaries to ensure they match the target architecture. This test fails if any binaries do not match the type since there would be an incompatibility. The test could indicate that the wrong compiler or compiler options have been used. Sometimes software, like bootloaders, might need to bypass this check. If the file you receive the error for is firmware that is not intended to be executed within the target operating system or is intended to run on a separate processor within the device, you can add “arch” to INSANE_SKIP for the package. Another option is to check the do_compile log and verify that the compiler options being used are correct.
Endianness did not match (<file_endianness>, expected <machine_endianness>) in <file> [arch]
By default, the OpenEmbedded build system checks the Executable and Linkable Format (ELF) type, bit size, and endianness of any binaries to ensure they match the target architecture. This test fails if any binaries do not match the type since there would be an incompatibility. The test could indicate that the wrong compiler or compiler options have been used. Sometimes software, like bootloaders, might need to bypass this check. If the file you receive the error for is firmware that is not intended to be executed within the target operating system or is intended to run on a separate processor within the device, you can add “arch” to INSANE_SKIP for the package. Another option is to check the do_compile log and verify that the compiler options being used are correct.
ELF binary '<file>' has relocations in .text [textrel]
The specified ELF binary contains relocations in its
.text
sections. This situation can result in a performance impact at runtime.Typically, the way to solve this performance issue is to add “-fPIC” or “-fpic” to the compiler command-line options. For example, given software that reads CFLAGS when you build it, you could add the following to your recipe:
CFLAGS:append = " -fPIC "
For more information on text relocations at runtime, see https://www.akkadia.org/drepper/textrelocs.html.
File '<file>' in package '<package>' doesn't have GNU_HASH (didn't pass LDFLAGS?) [ldflags]
This indicates that binaries produced when building the recipe have not been linked with the LDFLAGS options provided by the build system. Check to be sure that the LDFLAGS variable is being passed to the linker command. A common workaround for this situation is to pass in LDFLAGS using TARGET_CC_ARCH within the recipe as follows:
TARGET_CC_ARCH += "${LDFLAGS}"
Package <packagename> contains Xorg driver (<driver>) but no xorg-abi- dependencies [xorg-driver-abi]
The specified package contains an Xorg driver, but does not have a corresponding ABI package dependency. The xserver-xorg recipe provides driver ABI names. All drivers should depend on the ABI versions that they have been built against. Driver recipes that include
xorg-driver-input.inc
orxorg-driver-video.inc
will automatically get these versions. Consequently, you should only need to explicitly add dependencies to binary driver recipes.
The /usr/share/info/dir file is not meant to be shipped in a particular package. [infodir]
The
/usr/share/info/dir
should not be packaged. Add the following line to your do_install task or to yourdo_install:append
within the recipe as follows:rm ${D}${infodir}/dir
Symlink <path> in <packagename> points to TMPDIR [symlink-to-sysroot]
The specified symlink points into TMPDIR on the host. Such symlinks will work on the host. However, they are clearly invalid when running on the target. You should either correct the symlink to use a relative path or remove the symlink.
<file> failed sanity test (workdir) in path <path> [la]
The specified
.la
file contains TMPDIR paths. Any.la
file containing these paths is incorrect sincelibtool
adds the correct sysroot prefix when using the files automatically itself.
<file> failed sanity test (tmpdir) in path <path> [pkgconfig]
The specified
.pc
file contains TMPDIR/
WORKDIR paths. Any.pc
file containing these paths is incorrect sincepkg-config
itself adds the correct sysroot prefix when the files are accessed.
<packagename> rdepends on <debug_packagename> [debug-deps]
There is a dependency between the specified non-dbg package (i.e. a package whose name does not end in
-dbg
) and a package that is adbg
package. Thedbg
packages contain debug symbols and are brought in using several different methods:Using the
dbg-pkgs
IMAGE_FEATURES value.Using IMAGE_INSTALL.
As a dependency of another
dbg
package that was brought in using one of the above methods.
The dependency might have been automatically added because the
dbg
package erroneously contains files that it should not contain (e.g. a non-symlink.so
file) or it might have been added manually (e.g. by adding to RDEPENDS).
<packagename> rdepends on <dev_packagename> [dev-deps]
There is a dependency between the specified non-dev package (a package whose name does not end in
-dev
) and a package that is adev
package. Thedev
packages contain development headers and are usually brought in using several different methods:Using the
dev-pkgs
IMAGE_FEATURES value.Using IMAGE_INSTALL.
As a dependency of another
dev
package that was brought in using one of the above methods.
The dependency might have been automatically added (because the
dev
package erroneously contains files that it should not have (e.g. a non-symlink.so
file) or it might have been added manually (e.g. by adding to RDEPENDS).
<var>:<packagename> is invalid: <comparison> (<value>) only comparisons <, =, >, <=, and >= are allowed [dep-cmp]
If you are adding a versioned dependency relationship to one of the dependency variables (RDEPENDS, RRECOMMENDS, RSUGGESTS, RPROVIDES, RREPLACES, or RCONFLICTS), you must only use the named comparison operators. Change the versioned dependency values you are adding to match those listed in the message.
<recipename>: The compile log indicates that host include and/or library paths were used. Please check the log '<logfile>' for more information. [compile-host-path]
The log for the do_compile task indicates that paths on the host were searched for files, which is not appropriate when cross-compiling. Look for “is unsafe for cross-compilation” or “CROSS COMPILE Badness” in the specified log file.
<recipename>: The install log indicates that host include and/or library paths were used. Please check the log '<logfile>' for more information. [install-host-path]
The log for the do_install task indicates that paths on the host were searched for files, which is not appropriate when cross-compiling. Look for “is unsafe for cross-compilation” or “CROSS COMPILE Badness” in the specified log file.
This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities. Rerun configure task after fixing this. [configure-unsafe]
The log for the do_configure task indicates that paths on the host were searched for files, which is not appropriate when cross-compiling. Look for “is unsafe for cross-compilation” or “CROSS COMPILE Badness” in the specified log file.
<packagename> doesn't match the [a-z0-9.+-]+ regex [pkgname]
The convention within the OpenEmbedded build system (sometimes enforced by the package manager itself) is to require that package names are all lower case and to allow a restricted set of characters. If your recipe name does not match this, or you add packages to PACKAGES that do not conform to the convention, then you will receive this error. Rename your recipe. Or, if you have added a non-conforming package name to PACKAGES, change the package name appropriately.
<recipe>: configure was passed unrecognized options: <options> [unknown-configure-option]
The configure script is reporting that the specified options are unrecognized. This situation could be because the options were previously valid but have been removed from the configure script. Or, there was a mistake when the options were added and there is another option that should be used instead. If you are unsure, consult the upstream build documentation, the
./configure --help
output, and the upstream change log or release notes. Once you have worked out what the appropriate change is, you can update EXTRA_OECONF, PACKAGECONFIG_CONFARGS, or the individual PACKAGECONFIG option values accordingly.
Recipe <recipefile> has PN of "<recipename>" which is in OVERRIDES, this can result in unexpected behavior. [pn-overrides]
The specified recipe has a name (PN) value that appears in OVERRIDES. If a recipe is named such that its PN value matches something already in OVERRIDES (e.g. PN happens to be the same as MACHINE or DISTRO), it can have unexpected consequences. For example, assignments such as
FILES:${PN} = "xyz"
effectively turn intoFILES = "xyz"
. Rename your recipe (or if PN is being set explicitly, change the PN value) so that the conflict does not occur. See FILES for additional information.
<recipefile>: Variable <variable> is set as not being package specific, please fix this. [pkgvarcheck]
Certain variables (RDEPENDS, RRECOMMENDS, RSUGGESTS, RCONFLICTS, RPROVIDES, RREPLACES, FILES,
pkg_preinst
,pkg_postinst
,pkg_prerm
,pkg_postrm
, and ALLOW_EMPTY) should always be set specific to a package (i.e. they should be set with a package name override such asRDEPENDS:${PN} = "value"
rather thanRDEPENDS = "value"
). If you receive this error, correct any assignments to these variables within your recipe.recipe uses DEPENDS:${PN}, should use DEPENDS [pkgvarcheck]
File '<file>' from <recipename> was already stripped, this will prevent future debugging! [already-stripped]
Produced binaries have already been stripped prior to the build system extracting debug symbols. It is common for upstream software projects to default to stripping debug symbols for output binaries. In order for debugging to work on the target using
-dbg
packages, this stripping must be disabled.Depending on the build system used by the software being built, disabling this stripping could be as easy as specifying an additional configure option. If not, disabling stripping might involve patching the build scripts. In the latter case, look for references to “strip” or “STRIP”, or the “-s” or “-S” command-line options being specified on the linker command line (possibly through the compiler command line if preceded with “-Wl,”).
Note
Disabling stripping here does not mean that the final packaged binaries will be unstripped. Once the OpenEmbedded build system splits out debug symbols to the
-dbg
package, it will then strip the symbols from the binaries.
<packagename> is listed in PACKAGES multiple times, this leads to packaging errors. [packages-list]
Package names must appear only once in the PACKAGES variable. You might receive this error if you are attempting to add a package to PACKAGES that is already in the variable’s value.
FILES variable for package <packagename> contains '//' which is invalid. Attempting to fix this but you should correct the metadata. [files-invalid]
The string “//” is invalid in a Unix path. Correct all occurrences where this string appears in a FILES variable so that there is only a single “/”.
<recipename>: Files/directories were installed but not shipped in any package [installed-vs-shipped]
Files have been installed within the do_install task but have not been included in any package by way of the FILES variable. Files that do not appear in any package cannot be present in an image later on in the build process. You need to do one of the following:
<oldpackage>-<oldpkgversion> was registered as shlib provider for <library>, changing it to <newpackage>-<newpkgversion> because it was built later
This message means that both
<oldpackage>
and<newpackage>
provide the specified shared library. You can expect this message when a recipe has been renamed. However, if that is not the case, the message might indicate that a private version of a library is being erroneously picked up as the provider for a common library. If that is the case, you should add the library’s.so
filename to PRIVATE_LIBS in the recipe that provides the private version of the library.
LICENSE:<packagename> includes licenses (<licenses>) that are not listed in LICENSE [unlisted-pkg-lics]
The LICENSE of the recipe should be a superset of all the licenses of all packages produced by this recipe. In other words, any license in
LICENSE:*
should also appear in LICENSE.
AM_GNU_GETTEXT used but no inherit gettext [configure-gettext]
If a recipe is building something that uses automake and the automake files contain an
AM_GNU_GETTEXT
directive then this check will fail if there is noinherit gettext
statement in the recipe to ensure that gettext is available during the build. Addinherit gettext
to remove the warning.
package contains mime types but does not inherit mime: <packagename> path '<file>' [mime]
The specified package contains mime type files (
.xml
files in${datadir}/mime/packages
) and yet does not inherit the mime class which will ensure that these get properly installed. Either addinherit mime
to the recipe or remove the files at thedo_install
step if they are not needed.
package contains desktop file with key 'MimeType' but does not inhert mime-xdg: <packagename> path '<file>' [mime-xdg]
The specified package contains a .desktop file with a ‘MimeType’ key present, but does not inherit the mime-xdg class that is required in order for that to be activated. Either add
inherit mime
to the recipe or remove the files at thedo_install
step if they are not needed.
<recipename>: SRC_URI uses unstable GitHub archives [src-uri-bad]
GitHub provides “archive” tarballs, however these can be re-generated on the fly and thus the file’s signature will not necessarily match that in the SRC_URI checksums in future leading to build failures. It is recommended that you use an official release tarball or switch to pulling the corresponding revision in the actual git repository instead.
SRC_URI uses PN not BPN [src-uri-bad]
If some part of SRC_URI needs to reference the recipe name, it should do so using ${BPN} rather than ${PN} as the latter will change for different variants of the same recipe e.g. when BBCLASSEXTEND or multilib are being used. This check will fail if a reference to
${PN}
is found within the SRC_URI value - change it to${BPN}
instead.
<recipename>: recipe doesn't inherit features_check [unhandled-features-check]
This check ensures that if one of the variables that the features_check class supports (e.g. REQUIRED_DISTRO_FEATURES) is used, then the recipe inherits
features_check
in order for the requirement to actually work. If you are seeing this message, either addinherit features_check
to your recipe or remove the reference to the variable if it is not needed.
<recipename>: recipe defines ALTERNATIVE:<packagename> but doesn't inherit update-alternatives. This might fail during do_rootfs later! [missing-update-alternatives]
This check ensures that if a recipe sets the ALTERNATIVE variable that the recipe also inherits update-alternatives such that the alternative will be correctly set up. If you are seeing this message, either add
inherit update-alternatives
to your recipe or remove the reference to the variable if it is not needed.
<packagename>: <file> maximum shebang size exceeded, the maximum size is 128. [shebang-size]
This check ensures that the shebang line (
#!
in the first line) for a script is not longer than 128 characters, which can cause an error at runtime depending on the operating system. If you are seeing this message then the specified script may need to be patched to have a shorter in order to avoid runtime problems.
<packagename> contains perllocal.pod (<files>), should not be installed [perllocalpod]
perllocal.pod
is an index file of locally installed modules and so shouldn’t be installed by any distribution packages. The cpan class already setsNO_PERLLOCAL
to stop this file being generated by most Perl recipes, but if a recipe is usingMakeMaker
directly then they might not be doing this correctly. This check ensures that perllocal.pod is not in any package in order to avoid multiple packages shipping this file and thus their packages conflicting if installed together.
<packagename> package is not obeying usrmerge distro feature. /<path> should be relocated to /usr. [usrmerge]
If
usrmerge
is in DISTRO_FEATURES, this check will ensure that no package installs files to root (/bin
,/sbin
,/lib
,/lib64
) directories. If you are seeing this message, it indicates that thedo_install
step (or perhaps the build process thatdo_install
is calling into, e.g.make install
is using hardcoded paths instead of the variables set up for this (bindir
,sbindir
, etc.), and should be changed so that it does.
Fuzz detected: <patch output> [patch-fuzz]
This check looks for evidence of “fuzz” when applying patches within the
do_patch
task. Patch fuzz is a situation when thepatch
tool ignores some of the context lines in order to apply the patch. Consider this example:Patch to be applied:
--- filename +++ filename context line 1 context line 2 context line 3 +newly added line context line 4 context line 5 context line 6
Original source code:
different context line 1 different context line 2 context line 3 context line 4 different context line 5 different context line 6
Outcome (after applying patch with fuzz):
different context line 1 different context line 2 context line 3 newly added line context line 4 different context line 5 different context line 6
Chances are, the newly added line was actually added in a completely wrong location, or it was already in the original source and was added for the second time. This is especially possible if the context line 3 and 4 are blank or have only generic things in them, such as
#endif
or}
. Depending on the patched code, it is entirely possible for an incorrectly patched file to still compile without errors.How to eliminate patch fuzz warnings
Use the
devtool
command as explained by the warning. First, unpack the source into devtool workspace:devtool modify <recipe>
This will apply all of the patches, and create new commits out of them in the workspace - with the patch context updated.
Then, replace the patches in the recipe layer:
devtool finish --force-patch-refresh <recipe> <layer_path>
The patch updates then need be reviewed (preferably with a side-by-side diff tool) to ensure they are indeed doing the right thing i.e.:
they are applied in the correct location within the file;
they do not introduce duplicate lines, or otherwise do things that are no longer necessary.
To confirm these things, you can also review the patched source code in devtool’s workspace, typically in
<build_dir>/workspace/sources/<recipe>/
Once the review is done, you can create and publish a layer commit with the patch updates that modify the context. Devtool may also refresh other things in the patches, those can be discarded.
9.3 Configuring and Disabling QA Checks
You can configure the QA checks globally so that specific check failures either raise a warning or an error message, using the WARN_QA and ERROR_QA variables, respectively. You can also disable checks within a particular recipe using INSANE_SKIP. For information on how to work with the QA checks, see the “insane.bbclass” section.
Note
Please keep in mind that the QA checks are meant to detect real or potential problems in the packaged output. So exercise caution when disabling these checks.
10 Images
The OpenEmbedded build system provides several example images to satisfy
different needs. When you issue the bitbake
command you provide a
“top-level” recipe that essentially begins the build for the type of
image you want.
Note
Building an image without GNU General Public License Version 3
(GPLv3), GNU Lesser General Public License Version 3 (LGPLv3), and
the GNU Affero General Public License Version 3 (AGPL-3.0) components
is only supported for minimal and base images. Furthermore, if you
are going to build an image using non-GPLv3 and similarly licensed
components, you must make the following changes in the local.conf
file before using the BitBake command to build the minimal or base
image:
1. Comment out the EXTRA_IMAGE_FEATURES line
2. Set INCOMPATIBLE_LICENSE = "GPL-3.0* LGPL-3.0* AGPL-3.0*"
From within the poky
Git repository, you can use the following
command to display the list of directories within the Source Directory
that contain image recipe files:
$ ls meta*/recipes*/images/*.bb
Following is a list of supported recipes:
build-appliance-image
: An example virtual machine that contains all the pieces required to run builds using the build system as well as the build system itself. You can boot and run the image using either the VMware Player or VMware Workstation. For more information on this image, see the Build Appliance page on the Yocto Project website.core-image-base
: A console-only image that fully supports the target device hardware.core-image-full-cmdline
: A console-only image with more full-featured Linux system functionality installed.core-image-lsb
: An image that conforms to the Linux Standard Base (LSB) specification. This image requires a distribution configuration that enables LSB compliance (e.g.poky-lsb
). If you buildcore-image-lsb
without that configuration, the image will not be LSB-compliant.core-image-lsb-dev
: Acore-image-lsb
image that is suitable for development work using the host. The image includes headers and libraries you can use in a host development environment. This image requires a distribution configuration that enables LSB compliance (e.g.poky-lsb
). If you buildcore-image-lsb-dev
without that configuration, the image will not be LSB-compliant.core-image-lsb-sdk
: Acore-image-lsb
that includes everything in the cross-toolchain but also includes development headers and libraries to form a complete standalone SDK. This image requires a distribution configuration that enables LSB compliance (e.g.poky-lsb
). If you buildcore-image-lsb-sdk
without that configuration, the image will not be LSB-compliant. This image is suitable for development using the target.core-image-minimal
: A small image just capable of allowing a device to boot.core-image-minimal-dev
: Acore-image-minimal
image suitable for development work using the host. The image includes headers and libraries you can use in a host development environment.core-image-minimal-initramfs
: Acore-image-minimal
image that has the Minimal RAM-based Initial Root Filesystem (initramfs) as part of the kernel, which allows the system to find the first “init” program more efficiently. See the PACKAGE_INSTALL variable for additional information helpful when working with initramfs images.core-image-minimal-mtdutils
: Acore-image-minimal
image that has support for the Minimal MTD Utilities, which let the user interact with the MTD subsystem in the kernel to perform operations on flash devices.core-image-rt
: Acore-image-minimal
image plus a real-time test suite and tools appropriate for real-time use.core-image-rt-sdk
: Acore-image-rt
image that includes everything in the cross-toolchain. The image also includes development headers and libraries to form a complete stand-alone SDK and is suitable for development using the target.core-image-sato
: An image with Sato support, a mobile environment and visual style that works well with mobile devices. The image supports X11 with a Sato theme and applications such as a terminal, editor, file manager, media player, and so forth.core-image-sato-dev
: Acore-image-sato
image suitable for development using the host. The image includes libraries needed to build applications on the device itself, testing and profiling tools, and debug symbols. This image was formerlycore-image-sdk
.core-image-sato-sdk
: Acore-image-sato
image that includes everything in the cross-toolchain. The image also includes development headers and libraries to form a complete standalone SDK and is suitable for development using the target.core-image-testmaster
: A “controller” image designed to be used for automated runtime testing. Provides a “known good” image that is deployed to a separate partition so that you can boot into it and use it to deploy a second image to be tested. You can find more information about runtime testing in the “Performing Automated Runtime Testing” section in the Yocto Project Development Tasks Manual.core-image-testmaster-initramfs
: A RAM-based Initial Root Filesystem (initramfs) image tailored for use with thecore-image-testmaster
image.core-image-weston
: A very basic Wayland image with a terminal. This image provides the Wayland protocol libraries and the reference Weston compositor. For more information, see the “Using Wayland and Weston” section in the Yocto Project Development Tasks Manual.core-image-x11
: A very basic X11 image with a terminal.
11 Features
This chapter provides a reference of shipped machine and distro features you can include as part of your image, a reference on image features you can select, and a reference on feature backfilling.
Features provide a mechanism for working out which packages should be
included in the generated images. Distributions can select which
features they want to support through the DISTRO_FEATURES variable,
which is set or appended to in a distribution’s configuration file such
as poky.conf
, poky-tiny.conf
, poky-lsb.conf
and so forth.
Machine features are set in the MACHINE_FEATURES variable, which is
set in the machine configuration file and specifies the hardware
features for a given machine.
These two variables combine to work out which kernel modules, utilities, and other packages to include. A given distribution can support a selected subset of features so some machine features might not be included if the distribution itself does not support them.
One method you can use to determine which recipes are checking to see if
a particular feature is contained or not is to grep
through the
Metadata for the feature. Here is an example that
discovers the recipes whose build is potentially changed based on a
given feature:
$ cd poky
$ git grep 'contains.*MACHINE_FEATURES.*feature'
11.1 Machine Features
The items below are features you can use with MACHINE_FEATURES. Features do not have a one-to-one correspondence to packages, and they can go beyond simply controlling the installation of a package or packages. Sometimes a feature can influence how certain recipes are built. For example, a feature might determine whether a particular configure option is specified within the do_configure task for a particular recipe.
This feature list only represents features as shipped with the Yocto Project metadata:
acpi: Hardware has ACPI (x86/x86_64 only)
alsa: Hardware has ALSA audio drivers
apm: Hardware uses APM (or APM emulation)
bluetooth: Hardware has integrated BT
efi: Support for booting through EFI
ext2: Hardware HDD or Microdrive
keyboard: Hardware has a keyboard
pcbios: Support for booting through BIOS
pci: Hardware has a PCI bus
pcmcia: Hardware has PCMCIA or CompactFlash sockets
phone: Mobile phone (voice) support
qvga: Machine has a QVGA (320x240) display
rtc: Machine has a Real-Time Clock
screen: Hardware has a screen
serial: Hardware has serial support (usually RS232)
touchscreen: Hardware has a touchscreen
usbgadget: Hardware is USB gadget device capable
usbhost: Hardware is USB Host capable
vfat: FAT file system support
wifi: Hardware has integrated WiFi
11.2 Distro Features
The items below are features you can use with DISTRO_FEATURES to enable features across your distribution. Features do not have a one-to-one correspondence to packages, and they can go beyond simply controlling the installation of a package or packages. In most cases, the presence or absence of a feature translates to the appropriate option supplied to the configure script during the do_configure task for the recipes that optionally support the feature.
Some distro features are also machine features. These select features make sense to be controlled both at the machine and distribution configuration level. See the COMBINED_FEATURES variable for more information.
This list only represents features as shipped with the Yocto Project metadata:
alsa: Include ALSA support (OSS compatibility kernel modules installed if available).
api-documentation: Enables generation of API documentation during recipe builds. The resulting documentation is added to SDK tarballs when the
bitbake -c populate_sdk
command is used. See the “Adding API Documentation to the Standard SDK” section in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.bluetooth: Include bluetooth support (integrated BT only).
cramfs: Include CramFS support.
directfb: Include DirectFB support.
ext2: Include tools for supporting for devices with internal HDD/Microdrive for storing files (instead of Flash only devices).
ipsec: Include IPSec support.
ipv6: Include IPv6 support.
keyboard: Include keyboard support (e.g. keymaps will be loaded during boot).
ldconfig: Include support for ldconfig and
ld.so.conf
on the target.nfs: Include NFS client support (for mounting NFS exports on device).
opengl: Include the Open Graphics Library, which is a cross-language, multi-platform application programming interface used for rendering two and three-dimensional graphics.
pci: Include PCI bus support.
pcmcia: Include PCMCIA/CompactFlash support.
ppp: Include PPP dialup support.
ptest: Enables building the package tests where supported by individual recipes. For more information on package tests, see the “Testing Packages With ptest” section in the Yocto Project Development Tasks Manual.
smbfs: Include SMB networks client support (for mounting Samba/Microsoft Windows shares on device).
systemd: Include support for this
init
manager, which is a full replacement of forinit
with parallel starting of services, reduced shell overhead, and other features. Thisinit
manager is used by many distributions.usbgadget: Include USB Gadget Device support (for USB networking/serial/storage).
usbhost: Include USB Host support (allows to connect external keyboard, mouse, storage, network etc).
usrmerge: Merges the
/bin
,/sbin
,/lib
, and/lib64
directories into their respective counterparts in the/usr
directory to provide better package and application compatibility.wayland: Include the Wayland display server protocol and the library that supports it.
wifi: Include WiFi support (integrated only).
x11: Include the X server and libraries.
11.3 Image Features
The contents of images generated by the OpenEmbedded build system can be controlled by the IMAGE_FEATURES and EXTRA_IMAGE_FEATURES variables that you typically configure in your image recipes. Through these variables, you can add several different predefined packages such as development utilities or packages with debug information needed to investigate application problems or profile applications.
Here are the image features available for all images:
allow-empty-password: Allows Dropbear and OpenSSH to accept root logins and logins from accounts having an empty password string.
dbg-pkgs: Installs debug symbol packages for all packages installed in a given image.
debug-tweaks: Makes an image suitable for development (e.g. allows root logins without passwords and enables post-installation logging). See the ‘allow-empty-password’, ‘empty-root-password’, and ‘post-install-logging’ features in this list for additional information.
dev-pkgs: Installs development packages (headers and extra library links) for all packages installed in a given image.
doc-pkgs: Installs documentation packages for all packages installed in a given image.
empty-root-password: Sets the root password to an empty string, which allows logins with a blank password.
overlayfs-etc: Configures the
/etc
directory to be inoverlayfs
. This allows to store device specific information elsewhere, especially if the root filesystem is configured to be read-only.package-management: Installs package management tools and preserves the package manager database.
post-install-logging: Enables logging postinstall script runs to the
/var/log/postinstall.log
file on first boot of the image on the target system.Note
To make the
/var/log
directory on the target persistent, use the VOLATILE_LOG_DIR variable by setting it to “no”.ptest-pkgs: Installs ptest packages for all ptest-enabled recipes.
read-only-rootfs: Creates an image whose root filesystem is read-only. See the “Creating a Read-Only Root Filesystem” section in the Yocto Project Development Tasks Manual for more information.
splash: Enables showing a splash screen during boot. By default, this screen is provided by
psplash
, which does allow customization. If you prefer to use an alternative splash screen package, you can do so by setting theSPLASH
variable to a different package name (or names) within the image recipe or at the distro configuration level.staticdev-pkgs: Installs static development packages, which are static libraries (i.e.
*.a
files), for all packages installed in a given image.
Some image features are available only when you inherit the core-image class. The current list of these valid features is as follows:
hwcodecs: Installs hardware acceleration codecs.
nfs-server: Installs an NFS server.
perf: Installs profiling tools such as
perf
,systemtap
, andLTTng
. For general information on user-space tools, see the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.ssh-server-dropbear: Installs the Dropbear minimal SSH server.
ssh-server-openssh: Installs the OpenSSH SSH server, which is more full-featured than Dropbear. Note that if both the OpenSSH SSH server and the Dropbear minimal SSH server are present in IMAGE_FEATURES, then OpenSSH will take precedence and Dropbear will not be installed.
tools-debug: Installs debugging tools such as
strace
andgdb
. For information on GDB, see the “Debugging With the GNU Project Debugger (GDB) Remotely” section in the Yocto Project Development Tasks Manual. For information on tracing and profiling, see the Yocto Project Profiling and Tracing Manual.tools-sdk: Installs a full SDK that runs on the device.
tools-testapps: Installs device testing tools (e.g. touchscreen debugging).
x11: Installs the X server.
x11-base: Installs the X server with a minimal environment.
x11-sato: Installs the OpenedHand Sato environment.
11.4 Feature Backfilling
Sometimes it is necessary in the OpenEmbedded build system to extend
MACHINE_FEATURES or
DISTRO_FEATURES to control functionality
that was previously enabled and not able to be disabled. For these
cases, we need to add an additional feature item to appear in one of
these variables, but we do not want to force developers who have
existing values of the variables in their configuration to add the new
feature in order to retain the same overall level of functionality.
Thus, the OpenEmbedded build system has a mechanism to automatically
“backfill” these added features into existing distro or machine
configurations. You can see the list of features for which this is done
by finding the
DISTRO_FEATURES_BACKFILL and
MACHINE_FEATURES_BACKFILL
variables in the meta/conf/bitbake.conf
file.
Because such features are backfilled by default into all configurations as described in the previous paragraph, developers who wish to disable the new features need to be able to selectively prevent the backfilling from occurring. They can do this by adding the undesired feature or features to the DISTRO_FEATURES_BACKFILL_CONSIDERED or MACHINE_FEATURES_BACKFILL_CONSIDERED variables for distro features and machine features respectively.
Here are two examples to help illustrate feature backfilling:
The “pulseaudio” distro feature option: Previously, PulseAudio support was enabled within the Qt and GStreamer frameworks. Because of this, the feature is backfilled and thus enabled for all distros through the DISTRO_FEATURES_BACKFILL variable in the
meta/conf/bitbake.conf
file. However, your distro needs to disable the feature. You can disable the feature without affecting other existing distro configurations that need PulseAudio support by adding “pulseaudio” to DISTRO_FEATURES_BACKFILL_CONSIDERED in your distro’s.conf
file. Adding the feature to this variable when it also exists in the DISTRO_FEATURES_BACKFILL variable prevents the build system from adding the feature to your configuration’s DISTRO_FEATURES, effectively disabling the feature for that particular distro.The “rtc” machine feature option: Previously, real time clock (RTC) support was enabled for all target devices. Because of this, the feature is backfilled and thus enabled for all machines through the MACHINE_FEATURES_BACKFILL variable in the
meta/conf/bitbake.conf
file. However, your target device does not have this capability. You can disable RTC support for your device without affecting other machines that need RTC support by adding the feature to your machine’s MACHINE_FEATURES_BACKFILL_CONSIDERED list in the machine’s.conf
file. Adding the feature to this variable when it also exists in the MACHINE_FEATURES_BACKFILL variable prevents the build system from adding the feature to your configuration’s MACHINE_FEATURES, effectively disabling RTC support for that particular machine.
12 Variables Glossary
This chapter lists common variables used in the OpenEmbedded build system and gives an overview of their function and contents.
A B C D E F G H I K L M N O P R S T U V W X
- ABIEXTENSION
Extension to the Application Binary Interface (ABI) field of the GNU canonical architecture name (e.g. “eabi”).
ABI extensions are set in the machine include files. For example, the
meta/conf/machine/include/arm/arch-arm.inc
file sets the following extension:ABIEXTENSION = "eabi"
- ALLOW_EMPTY
Specifies whether to produce an output package even if it is empty. By default, BitBake does not produce empty packages. This default behavior can cause issues when there is an RDEPENDS or some other hard runtime requirement on the existence of the package.
Like all package-controlling variables, you must always use them in conjunction with a package name override, as in:
ALLOW_EMPTY:${PN} = "1" ALLOW_EMPTY:${PN}-dev = "1" ALLOW_EMPTY:${PN}-staticdev = "1"
- ALTERNATIVE
Lists commands in a package that need an alternative binary naming scheme. Sometimes the same command is provided in multiple packages. When this occurs, the OpenEmbedded build system needs to use the alternatives system to create a different binary naming scheme so the commands can co-exist.
To use the variable, list out the package’s commands that are also provided by another package. For example, if the
busybox
package has four such commands, you identify them as follows:ALTERNATIVE:busybox = "sh sed test bracket"
For more information on the alternatives system, see the “update-alternatives.bbclass” section.
- ALTERNATIVE_LINK_NAME
Used by the alternatives system to map duplicated commands to actual locations. For example, if the
bracket
command provided by thebusybox
package is duplicated through another package, you must use the ALTERNATIVE_LINK_NAME variable to specify the actual location:ALTERNATIVE_LINK_NAME[bracket] = "/usr/bin/["
In this example, the binary for the
bracket
command (i.e.[
) from thebusybox
package resides in/usr/bin/
.Note
If ALTERNATIVE_LINK_NAME is not defined, it defaults to
${bindir}/name
.For more information on the alternatives system, see the “update-alternatives.bbclass” section.
- ALTERNATIVE_PRIORITY
Used by the alternatives system to create default priorities for duplicated commands. You can use the variable to create a single default regardless of the command name or package, a default for specific duplicated commands regardless of the package, or a default for specific commands tied to particular packages. Here are the available syntax forms:
ALTERNATIVE_PRIORITY = "priority" ALTERNATIVE_PRIORITY[name] = "priority" ALTERNATIVE_PRIORITY_pkg[name] = "priority"
For more information on the alternatives system, see the “update-alternatives.bbclass” section.
- ALTERNATIVE_TARGET
Used by the alternatives system to create default link locations for duplicated commands. You can use the variable to create a single default location for all duplicated commands regardless of the command name or package, a default for specific duplicated commands regardless of the package, or a default for specific commands tied to particular packages. Here are the available syntax forms:
ALTERNATIVE_TARGET = "target" ALTERNATIVE_TARGET[name] = "target" ALTERNATIVE_TARGET_pkg[name] = "target"
Note
If ALTERNATIVE_TARGET is not defined, it inherits the value from the ALTERNATIVE_LINK_NAME variable.
If ALTERNATIVE_LINK_NAME and ALTERNATIVE_TARGET are the same, the target for ALTERNATIVE_TARGET has “
.{BPN}
” appended to it.Finally, if the file referenced has not been renamed, the alternatives system will rename it to avoid the need to rename alternative files in the do_install task while retaining support for the command if necessary.
For more information on the alternatives system, see the “update-alternatives.bbclass” section.
- ANY_OF_DISTRO_FEATURES
When inheriting the features_check class, this variable identifies a list of distribution features where at least one must be enabled in the current configuration in order for the OpenEmbedded build system to build the recipe. In other words, if none of the features listed in ANY_OF_DISTRO_FEATURES appear in DISTRO_FEATURES within the current configuration, then the recipe will be skipped, and if the build system attempts to build the recipe then an error will be triggered.
- APPEND
An override list of append strings for each target specified with LABELS.
See the grub-efi class for more information on how this variable is used.
- AR
The minimal command and arguments used to run
ar
.- ARCHIVER_MODE
When used with the archiver class, determines the type of information used to create a released archive. You can use this variable to create archives of patched source, original source, configured source, and so forth by employing the following variable flags (varflags):
ARCHIVER_MODE[src] = "original" # Uses original (unpacked) source files. ARCHIVER_MODE[src] = "patched" # Uses patched source files. This is the default. ARCHIVER_MODE[src] = "configured" # Uses configured source files. ARCHIVER_MODE[diff] = "1" # Uses patches between do_unpack and do_patch. ARCHIVER_MODE[diff-exclude] ?= "file file ..." # Lists files and directories to exclude from diff. ARCHIVER_MODE[dumpdata] = "1" # Uses environment data. ARCHIVER_MODE[recipe] = "1" # Uses recipe and include files. ARCHIVER_MODE[srpm] = "1" # Uses RPM package files.
For information on how the variable works, see the
meta/classes/archiver.bbclass
file in the Source Directory.- AS
Minimal command and arguments needed to run the assembler.
- ASSUME_PROVIDED
Lists recipe names (PN values) BitBake does not attempt to build. Instead, BitBake assumes these recipes have already been built.
In OpenEmbedded-Core, ASSUME_PROVIDED mostly specifies native tools that should not be built. An example is
git-native
, which when specified, allows for the Git binary from the host to be used rather than buildinggit-native
.- ASSUME_SHLIBS
Provides additional
shlibs
provider mapping information, which adds to or overwrites the information provided automatically by the system. Separate multiple entries using spaces.As an example, use the following form to add an
shlib
provider of shlibname in packagename with the optional version:shlibname:packagename[_version]
Here is an example that adds a shared library named
libEGL.so.1
as being provided by thelibegl-implementation
package:ASSUME_SHLIBS = "libEGL.so.1:libegl-implementation"
- AUTHOR
The email address used to contact the original author or authors in order to send patches and forward bugs.
- AUTO_LIBNAME_PKGS
When the debian class is inherited, which is the default behavior, AUTO_LIBNAME_PKGS specifies which packages should be checked for libraries and renamed according to Debian library package naming.
The default value is “${PACKAGES}”, which causes the debian class to act on all packages that are explicitly generated by the recipe.
- AUTO_SYSLINUXMENU
Enables creating an automatic menu for the syslinux bootloader. You must set this variable in your recipe. The syslinux class checks this variable.
- AUTOREV
When SRCREV is set to the value of this variable, it specifies to use the latest source revision in the repository. Here is an example:
SRCREV = "${AUTOREV}"
If you use the previous statement to retrieve the latest version of software, you need to be sure PV contains
${
SRCPV}
. For example, suppose you have a kernel recipe that inherits the kernel class and you use the previous statement. In this example,${SRCPV}
does not automatically get into PV. Consequently, you need to change PV in your recipe so that it does contain${SRCPV}
.For more information see the “Automatically Incrementing a Package Version Number” section in the Yocto Project Development Tasks Manual.
- AVAILTUNES
The list of defined CPU and Application Binary Interface (ABI) tunings (i.e. “tunes”) available for use by the OpenEmbedded build system.
The list simply presents the tunes that are available. Not all tunes may be compatible with a particular machine configuration, or with each other in a Multilib configuration.
To add a tune to the list, be sure to append it with spaces using the “+=” BitBake operator. Do not simply replace the list by using the “=” operator. See the “Basic Syntax” section in the BitBake User Manual for more information.
- AZ_SAS
Azure Storage Shared Access Signature, when using the Azure Storage fetcher (az://) This variable can be defined to be used by the fetcher to authenticate and gain access to non-public artifacts.
AZ_SAS = ""se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>""
For more information see Microsoft’s Azure Storage documentation at https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview
- B
The directory within the Build Directory in which the OpenEmbedded build system places generated objects during a recipe’s build process. By default, this directory is the same as the S directory, which is defined as:
S = "${WORKDIR}/${BP}"
You can separate the (S) directory and the directory pointed to by the B variable. Most Autotools-based recipes support separating these directories. The build system defaults to using separate directories for
gcc
and some kernel recipes.- BAD_RECOMMENDATIONS
Lists “recommended-only” packages to not install. Recommended-only packages are packages installed only through the RRECOMMENDS variable. You can prevent any of these “recommended” packages from being installed by listing them with the BAD_RECOMMENDATIONS variable:
BAD_RECOMMENDATIONS = "package_name package_name package_name ..."
You can set this variable globally in your
local.conf
file or you can attach it to a specific image recipe by using the recipe name override:BAD_RECOMMENDATIONS:pn-target_image = "package_name"
It is important to realize that if you choose to not install packages using this variable and some other packages are dependent on them (i.e. listed in a recipe’s RDEPENDS variable), the OpenEmbedded build system ignores your request and will install the packages to avoid dependency errors.
This variable is supported only when using the IPK and RPM packaging backends. DEB is not supported.
See the NO_RECOMMENDATIONS and the PACKAGE_EXCLUDE variables for related information.
- BASE_LIB
The library directory name for the CPU or Application Binary Interface (ABI) tune. The BASE_LIB applies only in the Multilib context. See the “Combining Multiple Versions of Library Files into One Image” section in the Yocto Project Development Tasks Manual for information on Multilib.
The BASE_LIB variable is defined in the machine include files in the Source Directory. If Multilib is not being used, the value defaults to “lib”.
- BASE_WORKDIR
Points to the base of the work directory for all recipes. The default value is “${TMPDIR}/work”.
- BB_ALLOWED_NETWORKS
Specifies a space-delimited list of hosts that the fetcher is allowed to use to obtain the required source code. Following are considerations surrounding this variable:
This host list is only used if BB_NO_NETWORK is either not set or set to “0”.
There is limited support for wildcard matching against the beginning of host names. For example, the following setting matches
git.gnu.org
,ftp.gnu.org
, andfoo.git.gnu.org
.BB_ALLOWED_NETWORKS = "*.gnu.org"
Note
The use of the “
*
” character only works at the beginning of a host name and it must be isolated from the remainder of the host name. You cannot use the wildcard character in any other location of the name or combined with the front part of the name.For example,
*.foo.bar
is supported, while*aa.foo.bar
is not.Mirrors not in the host list are skipped and logged in debug.
Attempts to access networks not in the host list cause a failure.
Using BB_ALLOWED_NETWORKS in conjunction with PREMIRRORS is very useful. Adding the host you want to use to PREMIRRORS results in the source code being fetched from an allowed location and avoids raising an error when a host that is not allowed is in a SRC_URI statement. This is because the fetcher does not attempt to use the host listed in SRC_URI after a successful fetch from the PREMIRRORS occurs.
- BB_DANGLINGAPPENDS_WARNONLY
Defines how BitBake handles situations where an append file (
.bbappend
) has no corresponding recipe file (.bb
). This condition often occurs when layers get out of sync (e.g.oe-core
bumps a recipe version and the old recipe no longer exists and the other layer has not been updated to the new version of the recipe yet).The default fatal behavior is safest because it is the sane reaction given something is out of sync. It is important to realize when your changes are no longer being applied.
You can change the default behavior by setting this variable to “1”, “yes”, or “true” in your
local.conf
file, which is located in the Build Directory: Here is an example:BB_DANGLINGAPPENDS_WARNONLY = "1"
- BB_DISKMON_DIRS
Monitors disk space and available inodes during the build and allows you to control the build based on these parameters.
Disk space monitoring is disabled by default. To enable monitoring, add the BB_DISKMON_DIRS variable to your
conf/local.conf
file found in the Build Directory. Use the following form:BB_DISKMON_DIRS = "action,dir,threshold [...]" where: action is: ABORT: Immediately stop the build when a threshold is broken. STOPTASKS: Stop the build after the currently executing tasks have finished when a threshold is broken. WARN: Issue a warning but continue the build when a threshold is broken. Subsequent warnings are issued as defined by the BB_DISKMON_WARNINTERVAL variable, which must be defined in the conf/local.conf file. dir is: Any directory you choose. You can specify one or more directories to monitor by separating the groupings with a space. If two directories are on the same device, only the first directory is monitored. threshold is: Either the minimum available disk space, the minimum number of free inodes, or both. You must specify at least one. To omit one or the other, simply omit the value. Specify the threshold using G, M, K for Gbytes, Mbytes, and Kbytes, respectively. If you do not specify G, M, or K, Kbytes is assumed by default. Do not use GB, MB, or KB.
Here are some examples:
BB_DISKMON_DIRS = "ABORT,${TMPDIR},1G,100K WARN,${SSTATE_DIR},1G,100K" BB_DISKMON_DIRS = "STOPTASKS,${TMPDIR},1G" BB_DISKMON_DIRS = "ABORT,${TMPDIR},,100K"
The first example works only if you also provide the BB_DISKMON_WARNINTERVAL variable in the
conf/local.conf
. This example causes the build system to immediately stop when either the disk space in${TMPDIR}
drops below 1 Gbyte or the available free inodes drops below 100 Kbytes. Because two directories are provided with the variable, the build system also issue a warning when the disk space in the${SSTATE_DIR}
directory drops below 1 Gbyte or the number of free inodes drops below 100 Kbytes. Subsequent warnings are issued during intervals as defined by the BB_DISKMON_WARNINTERVAL variable.The second example stops the build after all currently executing tasks complete when the minimum disk space in the
${TMPDIR}
directory drops below 1 Gbyte. No disk monitoring occurs for the free inodes in this case.The final example immediately stops the build when the number of free inodes in the
${TMPDIR}
directory drops below 100 Kbytes. No disk space monitoring for the directory itself occurs in this case.- BB_DISKMON_WARNINTERVAL
Defines the disk space and free inode warning intervals. To set these intervals, define the variable in your
conf/local.conf
file in the Build Directory.If you are going to use the BB_DISKMON_WARNINTERVAL variable, you must also use the BB_DISKMON_DIRS variable and define its action as “WARN”. During the build, subsequent warnings are issued each time disk space or number of free inodes further reduces by the respective interval.
If you do not provide a BB_DISKMON_WARNINTERVAL variable and you do use BB_DISKMON_DIRS with the “WARN” action, the disk monitoring interval defaults to the following:
BB_DISKMON_WARNINTERVAL = "50M,5K"
When specifying the variable in your configuration file, use the following form:
BB_DISKMON_WARNINTERVAL = "disk_space_interval,disk_inode_interval" where: disk_space_interval is: An interval of memory expressed in either G, M, or K for Gbytes, Mbytes, or Kbytes, respectively. You cannot use GB, MB, or KB. disk_inode_interval is: An interval of free inodes expressed in either G, M, or K for Gbytes, Mbytes, or Kbytes, respectively. You cannot use GB, MB, or KB.
Here is an example:
BB_DISKMON_DIRS = "WARN,${SSTATE_DIR},1G,100K" BB_DISKMON_WARNINTERVAL = "50M,5K"
These variables cause the OpenEmbedded build system to issue subsequent warnings each time the available disk space further reduces by 50 Mbytes or the number of free inodes further reduces by 5 Kbytes in the
${SSTATE_DIR}
directory. Subsequent warnings based on the interval occur each time a respective interval is reached beyond the initial warning (i.e. 1 Gbytes and 100 Kbytes).- BB_GENERATE_MIRROR_TARBALLS
Causes tarballs of the source control repositories (e.g. Git repositories), including metadata, to be placed in the DL_DIR directory.
For performance reasons, creating and placing tarballs of these repositories is not the default action by the OpenEmbedded build system.
BB_GENERATE_MIRROR_TARBALLS = "1"
Set this variable in your
local.conf
file in the Build Directory.Once you have the tarballs containing your source files, you can clean up your DL_DIR directory by deleting any Git or other source control work directories.
- BB_NUMBER_THREADS
The maximum number of tasks BitBake should run in parallel at any one time. The OpenEmbedded build system automatically configures this variable to be equal to the number of cores on the build system. For example, a system with a dual core processor that also uses hyper-threading causes the BB_NUMBER_THREADS variable to default to “4”.
For single socket systems (i.e. one CPU), you should not have to override this variable to gain optimal parallelism during builds. However, if you have very large systems that employ multiple physical CPUs, you might want to make sure the BB_NUMBER_THREADS variable is not set higher than “20”.
For more information on speeding up builds, see the “Speeding Up a Build” section in the Yocto Project Development Tasks Manual.
- BB_SERVER_TIMEOUT
Specifies the time (in seconds) after which to unload the BitBake server due to inactivity. Set BB_SERVER_TIMEOUT to determine how long the BitBake server stays resident between invocations.
For example, the following statement in your
local.conf
file instructs the server to be unloaded after 20 seconds of inactivity:BB_SERVER_TIMEOUT = "20"
If you want the server to never be unloaded, set BB_SERVER_TIMEOUT to “-1”.
- BBCLASSEXTEND
Allows you to extend a recipe so that it builds variants of the software. There are common variants for recipes as “natives” like
quilt-native
, which is a copy of Quilt built to run on the build system; “crosses” such asgcc-cross
, which is a compiler built to run on the build machine but produces binaries that run on the target MACHINE; “nativesdk”, which targets the SDK machine instead of MACHINE; and “mulitlibs” in the form “multilib:
multilib_name”.To build a different variant of the recipe with a minimal amount of code, it usually is as simple as adding the following to your recipe:
BBCLASSEXTEND =+ "native nativesdk" BBCLASSEXTEND =+ "multilib:multilib_name"
Note
Internally, the BBCLASSEXTEND mechanism generates recipe variants by rewriting variable values and applying overrides such as
:class-native
. For example, to generate a native version of a recipe, a DEPENDS on “foo” is rewritten to a DEPENDS on “foo-native”.Even when using BBCLASSEXTEND, the recipe is only parsed once. Parsing once adds some limitations. For example, it is not possible to include a different file depending on the variant, since
include
statements are processed when the recipe is parsed.- BBFILE_COLLECTIONS
Lists the names of configured layers. These names are used to find the other
BBFILE_*
variables. Typically, each layer will append its name to this variable in itsconf/layer.conf
file.- BBFILE_PATTERN
Variable that expands to match files from BBFILES in a particular layer. This variable is used in the
conf/layer.conf
file and must be suffixed with the name of the specific layer (e.g.BBFILE_PATTERN_emenlow
).- BBFILE_PRIORITY
Assigns the priority for recipe files in each layer.
This variable is useful in situations where the same recipe appears in more than one layer. Setting this variable allows you to prioritize a layer against other layers that contain the same recipe - effectively letting you control the precedence for the multiple layers. The precedence established through this variable stands regardless of a recipe’s version (PV variable). For example, a layer that has a recipe with a higher PV value but for which the BBFILE_PRIORITY is set to have a lower precedence still has a lower precedence.
A larger value for the BBFILE_PRIORITY variable results in a higher precedence. For example, the value 6 has a higher precedence than the value 5. If not specified, the BBFILE_PRIORITY variable is set based on layer dependencies (see the LAYERDEPENDS variable for more information. The default priority, if unspecified for a layer with no dependencies, is the lowest defined priority + 1 (or 1 if no priorities are defined).
Tip
You can use the command
bitbake-layers show-layers
to list all configured layers along with their priorities.- BBFILES
A space-separated list of recipe files BitBake uses to build software.
When specifying recipe files, you can pattern match using Python’s glob syntax. For details on the syntax, see the documentation by following the previous link.
- BBFILES_DYNAMIC
Activates content when identified layers are present. You identify the layers by the collections that the layers define.
Use the BBFILES_DYNAMIC variable to avoid
.bbappend
files whose corresponding.bb
file is in a layer that attempts to modify other layers through.bbappend
but does not want to introduce a hard dependency on those other layers.Use the following form for BBFILES_DYNAMIC:
collection_name:filename_pattern
.The following example identifies two collection names and two filename patterns:
BBFILES_DYNAMIC += " \ clang-layer:${LAYERDIR}/bbappends/meta-clang/*/*/*.bbappend \ core:${LAYERDIR}/bbappends/openembedded-core/meta/*/*/*.bbappend \ "
This next example shows an error message that occurs because invalid entries are found, which cause parsing to fail:
ERROR: BBFILES_DYNAMIC entries must be of the form <collection name>:<filename pattern>, not: /work/my-layer/bbappends/meta-security-isafw/*/*/*.bbappend /work/my-layer/bbappends/openembedded-core/meta/*/*/*.bbappend
- BBINCLUDELOGS
Variable that controls how BitBake displays logs on build failure.
- BBINCLUDELOGS_LINES
If BBINCLUDELOGS is set, specifies the maximum number of lines from the task log file to print when reporting a failed task. If you do not set BBINCLUDELOGS_LINES, the entire log is printed.
- BBLAYERS
Lists the layers to enable during the build. This variable is defined in the
bblayers.conf
configuration file in the Build Directory. Here is an example:BBLAYERS = " \ /home/scottrif/poky/meta \ /home/scottrif/poky/meta-poky \ /home/scottrif/poky/meta-yocto-bsp \ /home/scottrif/poky/meta-mykernel \ "
This example enables four layers, one of which is a custom, user-defined layer named
meta-mykernel
.- BBMASK
Prevents BitBake from processing recipes and recipe append files.
You can use the BBMASK variable to “hide” these
.bb
and.bbappend
files. BitBake ignores any recipe or recipe append files that match any of the expressions. It is as if BitBake does not see them at all. Consequently, matching files are not parsed or otherwise used by BitBake.The values you provide are passed to Python’s regular expression compiler. Consequently, the syntax follows Python’s Regular Expression (re) syntax. The expressions are compared against the full paths to the files. For complete syntax information, see Python’s documentation at https://docs.python.org/3/library/re.html#regular-expression-syntax.
The following example uses a complete regular expression to tell BitBake to ignore all recipe and recipe append files in the
meta-ti/recipes-misc/
directory:BBMASK = "meta-ti/recipes-misc/"
If you want to mask out multiple directories or recipes, you can specify multiple regular expression fragments. This next example masks out multiple directories and individual recipes:
BBMASK += "/meta-ti/recipes-misc/ meta-ti/recipes-ti/packagegroup/" BBMASK += "/meta-oe/recipes-support/" BBMASK += "/meta-foo/.*/openldap" BBMASK += "opencv.*\.bbappend" BBMASK += "lzma"
Note
When specifying a directory name, use the trailing slash character to ensure you match just that directory name.
- BBMULTICONFIG
Specifies each additional separate configuration when you are building targets with multiple configurations. Use this variable in your
conf/local.conf
configuration file. Specify a multiconfigname for each configuration file you are using. For example, the following line specifies three configuration files:BBMULTICONFIG = "configA configB configC"
Each configuration file you use must reside in the Build Directory
conf/multiconfig
directory (e.g.build_directory/conf/multiconfig/configA.conf
).For information on how to use BBMULTICONFIG in an environment that supports building targets with multiple configurations, see the “Building Images for Multiple Targets Using Multiple Configurations” section in the Yocto Project Development Tasks Manual.
- BBPATH
Used by BitBake to locate
.bbclass
and configuration files. This variable is analogous to thePATH
variable.Note
If you run BitBake from a directory outside of the Build Directory, you must be sure to set BBPATH to point to the Build Directory. Set the variable as you would any environment variable and then run BitBake:
$ BBPATH = "build_directory" $ export BBPATH $ bitbake target
- BBSERVER
If defined in the BitBake environment, BBSERVER points to the BitBake remote server.
Use the following format to export the variable to the BitBake environment:
export BBSERVER=localhost:$port
By default, BBSERVER also appears in BB_BASEHASH_IGNORE_VARS. Consequently, BBSERVER is excluded from checksum and dependency data.
- BINCONFIG
When inheriting the binconfig-disabled class, this variable specifies binary configuration scripts to disable in favor of using
pkg-config
to query the information. The binconfig-disabled class will modify the specified scripts to return an error so that calls to them can be easily found and replaced.To add multiple scripts, separate them by spaces. Here is an example from the
libpng
recipe:BINCONFIG = "${bindir}/libpng-config ${bindir}/libpng16-config"
- BINCONFIG_GLOB
When inheriting the binconfig class, this variable specifies a wildcard for configuration scripts that need editing. The scripts are edited to correct any paths that have been set up during compilation so that they are correct for use when installed into the sysroot and called by the build processes of other recipes.
Note
The BINCONFIG_GLOB variable uses shell globbing, which is recognition and expansion of wildcards during pattern matching. Shell globbing is very similar to fnmatch and glob.
For more information on how this variable works, see
meta/classes/binconfig.bbclass
in the Source Directory. You can also find general information on the class in the “binconfig.bbclass” section.- BP
The base recipe name and version but without any special recipe name suffix (i.e.
-native
,lib64-
, and so forth). BP is comprised of the following:${BPN}-${PV}
- BPN
This variable is a version of the PN variable with common prefixes and suffixes removed, such as
nativesdk-
,-cross
,-native
, and multilib’slib64-
andlib32-
. The exact lists of prefixes and suffixes removed are specified by the MLPREFIX and SPECIAL_PKGSUFFIX variables, respectively.- BUGTRACKER
Specifies a URL for an upstream bug tracking website for a recipe. The OpenEmbedded build system does not use this variable. Rather, the variable is a useful pointer in case a bug in the software being built needs to be manually reported.
- BUILD_ARCH
Specifies the architecture of the build host (e.g.
i686
). The OpenEmbedded build system sets the value of BUILD_ARCH from the machine name reported by theuname
command.- BUILD_AS_ARCH
Specifies the architecture-specific assembler flags for the build host. By default, the value of BUILD_AS_ARCH is empty.
- BUILD_CC_ARCH
Specifies the architecture-specific C compiler flags for the build host. By default, the value of BUILD_CC_ARCH is empty.
- BUILD_CCLD
Specifies the linker command to be used for the build host when the C compiler is being used as the linker. By default, BUILD_CCLD points to GCC and passes as arguments the value of BUILD_CC_ARCH, assuming BUILD_CC_ARCH is set.
- BUILD_CFLAGS
Specifies the flags to pass to the C compiler when building for the build host. When building in the
-native
context, CFLAGS is set to the value of this variable by default.- BUILD_CPPFLAGS
Specifies the flags to pass to the C preprocessor (i.e. to both the C and the C++ compilers) when building for the build host. When building in the
-native
context, CPPFLAGS is set to the value of this variable by default.- BUILD_CXXFLAGS
Specifies the flags to pass to the C++ compiler when building for the build host. When building in the
-native
context, CXXFLAGS is set to the value of this variable by default.- BUILD_FC
Specifies the Fortran compiler command for the build host. By default, BUILD_FC points to Gfortran and passes as arguments the value of BUILD_CC_ARCH, assuming BUILD_CC_ARCH is set.
- BUILD_LD
Specifies the linker command for the build host. By default, BUILD_LD points to the GNU linker (ld) and passes as arguments the value of BUILD_LD_ARCH, assuming BUILD_LD_ARCH is set.
- BUILD_LD_ARCH
Specifies architecture-specific linker flags for the build host. By default, the value of BUILD_LD_ARCH is empty.
- BUILD_LDFLAGS
Specifies the flags to pass to the linker when building for the build host. When building in the
-native
context, LDFLAGS is set to the value of this variable by default.- BUILD_OPTIMIZATION
Specifies the optimization flags passed to the C compiler when building for the build host or the SDK. The flags are passed through the BUILD_CFLAGS and BUILDSDK_CFLAGS default values.
The default value of the BUILD_OPTIMIZATION variable is “-O2 -pipe”.
- BUILD_OS
Specifies the operating system in use on the build host (e.g. “linux”). The OpenEmbedded build system sets the value of BUILD_OS from the OS reported by the
uname
command - the first word, converted to lower-case characters.- BUILD_PREFIX
The toolchain binary prefix used for native recipes. The OpenEmbedded build system uses the BUILD_PREFIX value to set the TARGET_PREFIX when building for
native
recipes.- BUILD_STRIP
Specifies the command to be used to strip debugging symbols from binaries produced for the build host. By default, BUILD_STRIP points to
${
BUILD_PREFIX}strip
.- BUILD_SYS
Specifies the system, including the architecture and the operating system, to use when building for the build host (i.e. when building
native
recipes).The OpenEmbedded build system automatically sets this variable based on BUILD_ARCH, BUILD_VENDOR, and BUILD_OS. You do not need to set the BUILD_SYS variable yourself.
- BUILD_VENDOR
Specifies the vendor name to use when building for the build host. The default value is an empty string (“”).
- BUILDDIR
Points to the location of the Build Directory. You can define this directory indirectly through the oe-init-build-env script by passing in a Build Directory path when you run the script. If you run the script and do not provide a Build Directory path, the BUILDDIR defaults to
build
in the current directory.- BUILDHISTORY_COMMIT
When inheriting the buildhistory class, this variable specifies whether or not to commit the build history output in a local Git repository. If set to “1”, this local repository will be maintained automatically by the buildhistory class and a commit will be created on every build for changes to each top-level subdirectory of the build history output (images, packages, and sdk). If you want to track changes to build history over time, you should set this value to “1”.
By default, the buildhistory class does not commit the build history output in a local Git repository:
BUILDHISTORY_COMMIT ?= "0"
- BUILDHISTORY_COMMIT_AUTHOR
When inheriting the buildhistory class, this variable specifies the author to use for each Git commit. In order for the BUILDHISTORY_COMMIT_AUTHOR variable to work, the BUILDHISTORY_COMMIT variable must be set to “1”.
Git requires that the value you provide for the BUILDHISTORY_COMMIT_AUTHOR variable takes the form of “name email@host”. Providing an email address or host that is not valid does not produce an error.
By default, the buildhistory class sets the variable as follows:
BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>"
- BUILDHISTORY_DIR
When inheriting the buildhistory class, this variable specifies the directory in which build history information is kept. For more information on how the variable works, see the buildhistory.bbclass class.
By default, the buildhistory class sets the directory as follows:
BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory"
- BUILDHISTORY_FEATURES
When inheriting the buildhistory class, this variable specifies the build history features to be enabled. For more information on how build history works, see the “Maintaining Build Output Quality” section in the Yocto Project Development Tasks Manual.
You can specify these features in the form of a space-separated list:
image: Analysis of the contents of images, which includes the list of installed packages among other things.
package: Analysis of the contents of individual packages.
sdk: Analysis of the contents of the software development kit (SDK).
task: Save output file signatures for shared state (sstate) tasks. This saves one file per task and lists the SHA-256 checksums for each file staged (i.e. the output of the task).
By default, the buildhistory class enables the following features:
BUILDHISTORY_FEATURES ?= "image package sdk"
- BUILDHISTORY_IMAGE_FILES
When inheriting the buildhistory class, this variable specifies a list of paths to files copied from the image contents into the build history directory under an “image-files” directory in the directory for the image, so that you can track the contents of each file. The default is to copy
/etc/passwd
and/etc/group
, which allows you to monitor for changes in user and group entries. You can modify the list to include any file. Specifying an invalid path does not produce an error. Consequently, you can include files that might not always be present.By default, the buildhistory class provides paths to the following files:
BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd /etc/group"
- BUILDHISTORY_PATH_PREFIX_STRIP
When inheriting the buildhistory class, this variable specifies a common path prefix that should be stripped off the beginning of paths in the task signature list when the
task
feature is active in BUILDHISTORY_FEATURES. This can be useful when build history is populated from multiple sources that may not all use the same top level directory.By default, the buildhistory class sets the variable as follows:
BUILDHISTORY_PATH_PREFIX_STRIP ?= ""
In this case, no prefixes will be stripped.
- BUILDHISTORY_PUSH_REPO
When inheriting the buildhistory class, this variable optionally specifies a remote repository to which build history pushes Git changes. In order for BUILDHISTORY_PUSH_REPO to work, BUILDHISTORY_COMMIT must be set to “1”.
The repository should correspond to a remote address that specifies a repository as understood by Git, or alternatively to a remote name that you have set up manually using
git remote
within the local repository.By default, the buildhistory class sets the variable as follows:
BUILDHISTORY_PUSH_REPO ?= ""
- BUILDSDK_CFLAGS
Specifies the flags to pass to the C compiler when building for the SDK. When building in the
nativesdk-
context, CFLAGS is set to the value of this variable by default.- BUILDSDK_CPPFLAGS
Specifies the flags to pass to the C pre-processor (i.e. to both the C and the C++ compilers) when building for the SDK. When building in the
nativesdk-
context, CPPFLAGS is set to the value of this variable by default.- BUILDSDK_CXXFLAGS
Specifies the flags to pass to the C++ compiler when building for the SDK. When building in the
nativesdk-
context, CXXFLAGS is set to the value of this variable by default.- BUILDSDK_LDFLAGS
Specifies the flags to pass to the linker when building for the SDK. When building in the
nativesdk-
context, LDFLAGS is set to the value of this variable by default.- BUILDSTATS_BASE
Points to the location of the directory that holds build statistics when you use and enable the buildstats class. The BUILDSTATS_BASE directory defaults to
${
TMPDIR}/buildstats/
.- BUSYBOX_SPLIT_SUID
For the BusyBox recipe, specifies whether to split the output executable file into two parts: one for features that require
setuid root
, and one for the remaining features (i.e. those that do not requiresetuid root
).The BUSYBOX_SPLIT_SUID variable defaults to “1”, which results in splitting the output executable file. Set the variable to “0” to get a single output executable file.
- CACHE
Specifies the directory BitBake uses to store a cache of the Metadata so it does not need to be parsed every time BitBake is started.
- CC
The minimal command and arguments used to run the C compiler.
- CFLAGS
Specifies the flags to pass to the C compiler. This variable is exported to an environment variable and thus made visible to the software being built during the compilation step.
Default initialization for CFLAGS varies depending on what is being built:
TARGET_CFLAGS when building for the target
BUILD_CFLAGS when building for the build host (i.e.
-native
)BUILDSDK_CFLAGS when building for an SDK (i.e.
nativesdk-
)
- CLASSOVERRIDE
An internal variable specifying the special class override that should currently apply (e.g. “class-target”, “class-native”, and so forth). The classes that use this variable (e.g. native, nativesdk, and so forth) set the variable to appropriate values.
Note
CLASSOVERRIDE gets its default “class-target” value from the
bitbake.conf
file.As an example, the following override allows you to install extra files, but only when building for the target:
do_install:append:class-target() { install my-extra-file ${D}${sysconfdir} }
Here is an example where
FOO
is set to “native” when building for the build host, and to “other” when not building for the build host:FOO:class-native = "native" FOO = "other"
The underlying mechanism behind CLASSOVERRIDE is simply that it is included in the default value of OVERRIDES.
- CLEANBROKEN
If set to “1” within a recipe, CLEANBROKEN specifies that the
make clean
command does not work for the software being built. Consequently, the OpenEmbedded build system will not try to runmake clean
during the do_configure task, which is the default behavior.- COMBINED_FEATURES
Provides a list of hardware features that are enabled in both MACHINE_FEATURES and DISTRO_FEATURES. This select list of features contains features that make sense to be controlled both at the machine and distribution configuration level. For example, the “bluetooth” feature requires hardware support but should also be optional at the distribution level, in case the hardware supports Bluetooth but you do not ever intend to use it.
- COMMON_LICENSE_DIR
Points to
meta/files/common-licenses
in the Source Directory, which is where generic license files reside.- COMPATIBLE_HOST
A regular expression that resolves to one or more hosts (when the recipe is native) or one or more targets (when the recipe is non-native) with which a recipe is compatible. The regular expression is matched against HOST_SYS. You can use the variable to stop recipes from being built for classes of systems with which the recipes are not compatible. Stopping these builds is particularly useful with kernels. The variable also helps to increase parsing speed since the build system skips parsing recipes not compatible with the current system.
- COMPATIBLE_MACHINE
A regular expression that resolves to one or more target machines with which a recipe is compatible. The regular expression is matched against MACHINEOVERRIDES. You can use the variable to stop recipes from being built for machines with which the recipes are not compatible. Stopping these builds is particularly useful with kernels. The variable also helps to increase parsing speed since the build system skips parsing recipes not compatible with the current machine.
- COMPLEMENTARY_GLOB
Defines wildcards to match when installing a list of complementary packages for all the packages explicitly (or implicitly) installed in an image.
Note
The COMPLEMENTARY_GLOB variable uses Unix filename pattern matching (fnmatch), which is similar to the Unix style pathname pattern expansion (glob).
The resulting list of complementary packages is associated with an item that can be added to IMAGE_FEATURES. An example usage of this is the “dev-pkgs” item that when added to IMAGE_FEATURES will install -dev packages (containing headers and other development files) for every package in the image.
To add a new feature item pointing to a wildcard, use a variable flag to specify the feature item name and use the value to specify the wildcard. Here is an example:
COMPLEMENTARY_GLOB[dev-pkgs] = '*-dev'
- COMPONENTS_DIR
Stores sysroot components for each recipe. The OpenEmbedded build system uses COMPONENTS_DIR when constructing recipe-specific sysroots for other recipes.
The default is “
${
STAGING_DIR}-components
.” (i.e. “${
TMPDIR}/sysroots-components
”).- CONF_VERSION
Tracks the version of the local configuration file (i.e.
local.conf
). The value for CONF_VERSION increments each timebuild/conf/
compatibility changes.- CONFFILES
Identifies editable or configurable files that are part of a package. If the Package Management System (PMS) is being used to update packages on the target system, it is possible that configuration files you have changed after the original installation and that you now want to remain unchanged are overwritten. In other words, editable files might exist in the package that you do not want reset as part of the package update process. You can use the CONFFILES variable to list the files in the package that you wish to prevent the PMS from overwriting during this update process.
To use the CONFFILES variable, provide a package name override that identifies the resulting package. Then, provide a space-separated list of files. Here is an example:
CONFFILES:${PN} += "${sysconfdir}/file1 \ ${sysconfdir}/file2 ${sysconfdir}/file3"