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.5.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-get install gawk wget git-core diffstat unzip texinfo gcc-multilib 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

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.

Move to the poky directory and take a look at the tags:

$ cd poky
$ git fetch --tags
$ git tag
1.1_M1.final
1.1_M1.rc1
1.1_M1.rc2
1.1_M2.final
1.1_M2.rc1
.
.
.
yocto-2.5
yocto-2.5.1
yocto-2.5.2
yocto-2.6
yocto-2.6.1
yocto-2.6.2
yocto-2.7
yocto_1.5_M5.rc8

For this example, check out the branch based on the yocto-3.2 release:

$ git checkout tags/yocto-3.2 -b my-yocto-3.2
Switched to a new branch 'my-yocto-3.2'

The previous Git checkout command creates a local branch named my-yocto-3.2. The files available to you in that branch exactly match the repository’s files in the gatesgarth development branch at the time of the Yocto Project yocto-3.2 release.

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.

  1. 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:
        http://yoctoproject.org/documentation
    
    For more information about OpenEmbedded see their website:
        http://www.openembedded.org/
    
    ### 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'
    

    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.

  2. Examine Your Local Configuration File: When you set up the build environment, a local configuration file named local.conf becomes available in a conf subdirectory of the Build Directory. For this example, the defaults are set to build for a qemux86 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 mirrors. To use mirrors, add these lines to your local.conf file in the Build directory:

    SSTATE_MIRRORS = "\
    file://.* http://sstate.yoctoproject.org/dev/PATH;downloadfilename=PATH \n \
    file://.* http://sstate.yoctoproject.org/3.1.4/PATH;downloadfilename=PATH \n \
    file://.* http://sstate.yoctoproject.org/3.2/PATH;downloadfilename=PATH \n \
    "
    

    The previous examples showed how to add sstate paths for Yocto Project 3.1.4, 3.2, and a development area. For a complete index of sstate locations, see http://sstate.yoctoproject.org/.

  3. 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” section in the BitBake User Manual.

  4. 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.

  5. 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:

  1. Find a Layer: Lots of hardware layers exist. The Yocto Project Source Repositories has many hardware layers. This example adds the meta-altera hardware layer.

  2. 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 now exists with 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.

  3. 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 to cyclone5. 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.

  4. 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 Directory conf 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.

  • Developer Screencast: The Getting Started with the Yocto Project - New Developer Screencast Tutorial provides a 30-minute video created for users unfamiliar with the Yocto Project but familiar with Linux build hosts. While this screencast is somewhat dated, the introductory and fundamental concepts are useful for the beginner.

  • 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. Several mailing lists exist and are grouped according to areas of concern. 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.


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 freenode #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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. Never modify the POKY layer. Never. Ever. When you update to the next release, you’ll lose all of your work. ALL OF IT.

  6. 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.

  7. 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:

    1. Fetch – get the source code

    2. Extract – unpack the sources

    3. Patch – apply patches for bug fixes and new capability

    4. Configure – set up your environment specifications

    5. Build – compile and link

    6. Install – copy files to target directories

    7. 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.

    _images/yp-how-it-works-new-diagram.png
  8. 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.

  9. 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.

  10. 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.

  11. 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.

  12. You will want to learn about and know what’s packaged in rootfs.

  13. 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.

  14. 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

  15. 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.


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 freenode #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.

  1. 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)

  2. 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.

  3. 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.

  4. 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.

  5. 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 the yocto-layer create tool. The bitbake-layers tool also provides a number of other useful layer-related commands. See Creating a General Layer Using the bitbake-layers Script section.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. 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.

  11. Congratulations! You’re well on your way. Welcome to the Yocto Project community.


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 freenode #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.

The following list describes 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:

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.

_images/key-dev-elements.png

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

The following list describes features and advantages of the Yocto Project:

  • Widely Adopted Across the Industry: Semiconductor, operating system, software, and service vendors exist whose products and services adopt and support the Yocto Project. 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 lots of architecture support, the Yocto Project fully supports a wide range of device emulation through 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, 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 install 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

The following list presents 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 how to proceed when varying methods exist by which to accomplish a given task.

  • 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, mechanisms exist 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 or ipk.

  • 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

The following list consists of 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 within devtool. When you use devtool add, a recipe is automatically created. When you use devtool 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. The devtool 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

The following list consists of tools that help 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 “master” 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.

  • Cross-Prelink: Prelinking is the process of pre-computing the load addresses and link tables generated by the dynamic linker as compared to doing this at runtime. Doing this ahead of time results in performance improvements when the application is launched and reduced memory usage for libraries shared by many applications.

    Historically, cross-prelink is a variant of prelink, which was conceived by Jakub Jelínek a number of years ago. Both prelink and cross-prelink are maintained in the same repository albeit on separate branches. By providing an emulated runtime dynamic linker (i.e. glibc-derived ld.so emulation), the cross-prelink project extends the prelink software’s ability to prelink a sysroot environment. Additionally, the cross-prelink software enables the ability to work in sysroot style environments.

    The dynamic linker determines standard load address calculations based on a variety of factors such as mapping addresses, library usage, and library function conflicts. The prelink tool uses this information, from the dynamic linker, to determine unique load addresses for executable and linkable format (ELF) binaries that are shared libraries and dynamically linked. The prelink tool modifies these ELF binaries with the pre-computed information. The result is faster loading and often lower memory consumption because more of the library code can be re-used from shared Copy-On-Write (COW) pages.

    The original upstream prelink project only supports running prelink on the end target device due to the reliance on the target device’s dynamic linker. This restriction causes issues when developing a cross-compiled system. The cross-prelink adds a synthesized dynamic loader that runs on the host, thus permitting cross-prelinking without ever having to run on a read-write target filesystem.

  • 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 definition. Pseudo is a tool that you can either use directly or through the environment variable LD_PRELOAD. Either method allows these operations to succeed as if system administrator privileges exist even when they do not.

    You can read more about Pseudo in the “Fakeroot and Pseudo” section.

2.3.3 Open-Embedded Build System Components

The following list consists of 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

The following lists 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.

  1. 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.

  2. 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.

  3. 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 test deployed software.

This section provides an introduction to the choices or development methods you have when setting up your Build Host. Depending on the your particular workflow preference and the type of operating system your Build Host runs, several choices exist that allow you to use the Yocto Project.

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 familiar shell of 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 utility virtual machine (VM) using virtualization technology.

    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 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 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:

_images/poky-reference-distribution.png
  • 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 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:

_images/YP-flow-diagram.png

Following is a brief summary of the “workflow”:

  1. Developers specify architecture, policies, patches and configuration details.

  2. 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.

  3. 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.

  4. 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.

  5. Different QA and sanity checks run throughout entire build process.

  6. After the binaries are created, the build system generates a binary package feed that is used to create the final root file image.

  7. 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 a list of terms exists 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 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 the 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 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, steps still exist that you must take 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, several methods exist for you to do work 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 using devtool 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 “master” branch of poky and you are going to use meta-intel, be sure to checkout the “master” branch of meta-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.

    _images/source-repos.png

    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.

    _images/index-downloads.png

    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.

    _images/yp-download.png

    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 “master” branch of a given Git repository. The “master” 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.

A somewhat formal method exists 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, a single point of entry exists for changes into a “master” or development branch of the Git repository, which is controlled by the project’s maintainer. And, a set of developers exist who 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.

_images/git-workflow.png

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 master 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 and send-pull-request that ship with the release to facilitate this workflow. You can find these scripts in the scripts 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 “master” 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 and git 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 http://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 http://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.1 Repositories, Tags, and Branches

As mentioned briefly in the previous section and also in the “Git Workflows and the Yocto Project” section, the Yocto Project maintains source repositories at https://git.yoctoproject.org/cgit/cgit.cgi/. If you look at this web-interface of the repositories, each item is a separate Git repository.

Git repositories use branching techniques that track content change (not files) within a project (e.g. a new feature or updated documentation). Creating a tree-like structure based on project divergence allows for excellent historical information over the life of a project. This methodology also allows for an environment from which you can do lots of local experimentation on projects as you develop changes or new features.

A Git repository represents all development efforts for a given project. For example, the Git repository poky contains all changes and developments for that repository over the course of its entire life. That means that all changes that make up all releases are captured. The repository maintains a complete history of changes.

You can create a local copy of any repository by “cloning” it with the git clone command. When you clone a Git repository, you end up with an identical copy of the repository on your development system. Once you have a local copy of a repository, you can take steps to develop locally. For examples on how to clone Git repositories, see the “Locating Yocto Project Source Files” section in the Yocto Project Development Tasks Manual.

It is important to understand that Git tracks content change and not files. Git uses “branches” to organize different development efforts. For example, the poky repository has several branches that include the current “gatesgarth” branch, the “master” branch, and many branches for past Yocto Project releases. You can see all the branches by going to https://git.yoctoproject.org/cgit/cgit.cgi/poky/ and clicking on the [...] link beneath the “Branch” heading.

Each of these branches represents a specific area of development. The “master” branch represents the current or most recent development. All other branches represent offshoots of the “master” branch.

When you create a local copy of a Git repository, the copy has the same set of branches as the original. This means you can use Git to create a local working area (also called a branch) that tracks a specific development branch from the upstream source Git repository. in other words, you can define your local Git environment to work on any development branch in the repository. To help illustrate, consider the following example Git commands:

$ cd ~
$ git clone git://git.yoctoproject.org/poky
$ cd poky
$ git checkout -b gatesgarth origin/gatesgarth

In the previous example after moving to the home directory, the git clone command creates a local copy of the upstream poky Git repository. By default, Git checks out the “master” branch for your work. After changing the working directory to the new local repository (i.e. poky), the git checkout command creates and checks out a local branch named “gatesgarth”, which tracks the upstream “origin/gatesgarth” branch. Changes you make while in this branch would ultimately affect the upstream “gatesgarth” branch of the poky repository.

It is important to understand that when you create and checkout a local working branch based on a branch name, your local environment matches the “tip” of that particular development branch at the time you created your local branch, which could be different from the files in the “master” branch of the upstream repository. In other words, creating and checking out a local branch based on the “gatesgarth” branch name is not the same as checking out the “master” branch in the repository. Keep reading to see how you create a local snapshot of a Yocto Project Release.

Git uses “tags” to mark specific changes in a repository branch structure. Typically, a tag is used to mark a special point such as the final change (or commit) before a project is released. You can see the tags used with the poky Git repository by going to https://git.yoctoproject.org/cgit/cgit.cgi/poky/ and clicking on the [...] link beneath the “Tag” heading.

Some key tags for the poky repository are jethro-14.0.3, morty-16.0.1, pyro-17.0.0, and gatesgarth-24.0.0. These tags represent Yocto Project releases.

When you create a local copy of the Git repository, you also have access to all the tags in the upstream repository. Similar to branches, you can create and checkout a local working Git branch based on a tag name. When you do this, you get a snapshot of the Git repository that reflects the state of the files when the change was made associated with that tag. The most common use is to checkout a working branch that matches a specific Yocto Project release. Here is an example:

$ cd ~
$ git clone git://git.yoctoproject.org/poky
$ cd poky
$ git fetch --tags
$ git checkout tags/rocko-18.0.0 -b my_rocko-18.0.0

In this example, the name of the top-level directory of your local Yocto Project repository is poky. After moving to the poky directory, the git fetch command makes all the upstream tags available locally in your repository. Finally, the git checkout command creates and checks out a branch named “my-rocko-18.0.0” that is based on the upstream branch whose “HEAD” matches the commit in the repository associated with the “rocko-18.0.0” tag. The files in your repository now exactly match that particular Yocto Project release as it is tagged in the upstream Git repository. It is important to understand that when you create and checkout a local working branch based on a tag, your environment matches a specific point in time and not the entire development branch (i.e. from the “tip” of the branch backwards).

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 “master” 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 is named “master”. A typical workflow is to create a temporary branch that is based off “master” that you would use for isolated work. You would make your changes in that isolated branch, stage and commit them locally, switch to the “master” branch, and then use the git merge command to apply the changes from your isolated branch into the currently checked out branch (e.g. “master”). 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. Yocto Project’s 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.

Many layers exist that work 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.

_images/YP-flow-diagram.png

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:

_images/user-configuration.png

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 a conf/site.conf. Then, when BitBake looks for Metadata using BBPATH, it finds the conf/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’s conf/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 the conf/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, three types of layer input exists. You can see them below the “User Configuration” box in the general workflow figure:

  • Metadata (.bb + Patches): Software layers containing user-supplied recipe files, patches, and append files. A good example of a software layer might be the meta-qt5 layer from the OpenEmbedded Layer Index. This layer is for version 5.0 of the popular Qt cross-platform application development framework for desktop, embedded and mobile.

  • Machine BSP Configuration: Board Support Package (BSP) layers (i.e. “BSP Layer” in the following figure) providing machine-specific configurations. This type of information is specific to a particular target architecture. A good example of a BSP layer from the Poky Reference Distribution 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:

_images/layer-input.png

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

Layers exist in the Yocto Project Source Repositories that cannot be found in the OpenEmbedded Layer Index. These 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 are recipes-core and recipes-extra. Hierarchy and contents within a recipes-* 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. Metadata can exist 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. Finally, a combination of the two might exist, which would give the consumer a choice when deciding where to get source files.

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:

_images/source-input.png
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)

Two kinds of mirrors exist: 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:

_images/package-feeds.png

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 exist 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 package architecture support for both i586 and qemux86 exist. 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

Separate documentation exists for the BitBake tool. 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:

_images/source-fetching.png

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).

    • PV: The version of the recipe used to build the package.

    • PR: The revision of the recipe used to build the package.

  • S: Contains the unpacked source files for a given recipe.

    • BPN: The name of the recipe used to build the package. The BPN variable is a version of the PN variable but with common prefixes and suffixes removed.

    • PV: The version of the recipe used to build the package.

Note

In the previous figure, notice that two sample hierarchies exist: 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:

_images/patching.png

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:

_images/configuration-compile-autoreconf.png

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 and recipe-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:

_images/analysis-for-package-splitting.png

The do_package and do_packagedata tasks combine to analyze the files found in the D directory and split them into subsets based on available packages and files. Analysis involves the following as well as other items: splitting out debugging symbols, looking at shared library dependencies between packages, and looking at package relationships.

The do_packagedata task creates package metadata based on the analysis such that the build system can generate the final packages. The do_populate_sysroot task stages (copies) a subset of the files installed by the do_install task into the appropriate sysroot. Working, staged, and intermediate results of the analysis and package splitting process use several areas:

  • PKGD: The destination directory (i.e. package) for packages before they are split into individual packages.

  • PKGDESTWORK: A temporary work area (i.e. pkgdata) used by the do_package task to save package metadata.

  • PKGDEST: The parent directory (i.e. packages-split) for packages after they have been split.

  • PKGDATA_DIR: A shared, global-state directory that holds packaging metadata generated during the packaging process. The packaging process copies metadata from PKGDESTWORK to the PKGDATA_DIR area where it becomes globally available.

  • STAGING_DIR_HOST: The path for the sysroot for the system on which a component is built to run (i.e. recipe-sysroot).

  • STAGING_DIR_NATIVE: The path for the sysroot used when building components for the build host (i.e. recipe-sysroot-native).

  • STAGING_DIR_TARGET: The path for the sysroot used when a component that is built to execute on a system and it generates code for yet another machine (e.g. cross-canadian recipes).

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:

_images/image-generation.png

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, prelink, and any other post-processing commands as defined by the ROOTFS_POSTPROCESS_COMMAND variable. The mklibs process optimizes the size of the libraries, while the prelink process optimizes the dynamic linking of shared libraries to reduce start up time of executables.

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):

_images/sdk-generation.png

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. If such a stamp file exists, the task’s output is assumed to exist and still be valid. If the file does not exist, 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.5.8 Setscene Tasks and Shared State

The description of tasks so far assumes that BitBake needs to build everything and no available prebuilt objects exist. BitBake does support skipping tasks if prebuilt objects are available. These objects are usually made available in the form of a shared state (sstate) cache.

Note

For information on variables affecting sstate, see the SSTATE_DIR and SSTATE_MIRRORS variables.

The idea of a setscene task (i.e do_taskname_setscene) is a version of the task where instead of building something, BitBake can skip to the end result and simply place a set of files into specific locations as needed. In some cases, it makes sense to have a setscene task variant (e.g. generating package files in the do_package_write_* task). In other cases, it does not make sense (e.g. a do_patch task or a do_unpack task) since the work involved would be equal to or greater than the underlying task.

In the build system, the common tasks that have setscene variants are do_package, do_package_write_*, do_deploy, do_packagedata, and do_populate_sysroot. Notice that these tasks represent most of the tasks whose output is an end result.

The build system has knowledge of the relationship between these tasks and other preceding tasks. For example, if BitBake runs do_populate_sysroot_setscene for something, it does not make sense to run any of the do_fetch, do_unpack, do_patch, do_configure, do_compile, and do_install tasks. However, if do_package needs to be run, BitBake needs to run those other tasks.

It becomes more complicated if everything can come from an sstate cache because some objects are simply not required at all. For example, you do not need a compiler or native tools, such as quilt, if nothing exists to compile or patch. If the do_package_write_* packages are available from sstate, BitBake does not need the do_package task data.

To handle all these complexities, BitBake runs in two phases. The first is the “setscene” stage. During this stage, BitBake first checks the sstate cache for any targets it is planning to build. BitBake does a fast check to see if the object exists rather than a complete download. If nothing exists, the second phase, which is the setscene stage, completes and the main build proceeds.

If objects are found in the sstate cache, the build system works backwards from the end targets specified by the user. For example, if an image is being built, the build system first looks for the packages needed for that image and the tools needed to construct an image. If those are available, the compiler is not needed. Thus, the compiler is not even downloaded. If something was found to be unavailable, or the download or setscene task fails, the build system then tries to install dependencies, such as the compiler, from the cache.

The availability of objects in the sstate cache is handled by the function specified by the BB_HASHCHECK_FUNCTION variable and returns a list of available objects. The function specified by the BB_SETSCENE_DEPVALID variable is the function that determines whether a given dependency needs to be followed, and whether for any given relationship the function needs to be passed. The function returns a True or False value.

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:

_images/images.png

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. The deploy/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:

_images/sdk.png

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

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, several variables exist that help configure these files. The following list shows 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.

  • SDK_LOCAL_CONF_WHITELIST: A list of variables allowed through from the build system configuration into the extensible SDK configuration.

  • SDK_LOCAL_CONF_BLACKLIST: A list of variables not allowed through from the build system configuration into the extensible SDK configuration.

  • SDK_INHERIT_BLACKLIST: 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.

_images/cross-development-toolchains.png

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 the gcc-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 bootstrap glibc.

  • 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 the gcc-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 the gcc-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 bootstrap nativesdk-glibc.

  • nativesdk-glibc: The Embedded GLIBC needed to bootstrap the gcc-crosssdk.

  • gcc-crosssdk: The final stage of the bootstrap process for the relocatable cross-compiler. The gcc-crosssdk is a transitory compiler and never leaves the build host. Its purpose is to help in the bootstrap process to create the eventual gcc-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.5 Shared State Cache

By design, the OpenEmbedded build system builds everything from scratch unless BitBake can determine that parts do not need to be rebuilt. Fundamentally, building from scratch is attractive as it means all parts are built fresh and no possibility of stale data exists that can cause problems. When developers hit problems, they typically default back to building from scratch so they have a know state from the start.

Building an image from scratch is both an advantage and a disadvantage to the process. As mentioned in the previous paragraph, building from scratch ensures that everything is current and starts from a known state. However, building from scratch also takes much longer as it generally means rebuilding things that do not necessarily need to be rebuilt.

The Yocto Project implements shared state code that supports incremental builds. The implementation of the shared state code answers the following questions that were fundamental roadblocks within the OpenEmbedded incremental build support system:

  • What pieces of the system have changed and what pieces have not changed?

  • How are changed pieces of software removed and replaced?

  • How are pre-built components that do not need to be rebuilt from scratch used when they are available?

For the first question, the build system detects changes in the “inputs” to a given task by creating a checksum (or signature) of the task’s inputs. If the checksum changes, the system assumes the inputs have changed and the task needs to be rerun. For the second question, the shared state (sstate) code tracks which tasks add which output to the build process. This means the output from a given task can be removed, upgraded or otherwise manipulated. The third question is partly addressed by the solution for the second question assuming the build system can fetch the sstate objects from remote locations and install them if they are deemed to be valid.

Note

The rest of this section goes into detail about the overall incremental build architecture, the checksums (signatures), and shared state.

4.5.1 Overall Architecture

When determining what parts of the system need to be built, BitBake works on a per-task basis rather than a per-recipe basis. You might wonder why using a per-task basis is preferred over a per-recipe basis. To help explain, consider having the IPK packaging backend enabled and then switching to DEB. In this case, the do_install and do_package task outputs are still valid. However, with a per-recipe approach, the build would not include the .deb files. Consequently, you would have to invalidate the whole build and rerun it. Rerunning everything is not the best solution. Also, in this case, the core must be “taught” much about specific tasks. This methodology does not scale well and does not allow users to easily add new tasks in layers or as external recipes without touching the packaged-staging core.

4.5.2 Checksums (Signatures)

The shared state code uses a checksum, which is a unique signature of a task’s inputs, to determine if a task needs to be run again. Because it is a change in a task’s inputs that triggers a rerun, the process needs to detect all the inputs to a given task. For shell tasks, this turns out to be fairly easy because the build process generates a “run” shell script for each task and it is possible to create a checksum that gives you a good idea of when the task’s data changes.

To complicate the problem, there are things that should not be included in the checksum. First, there is the actual specific build path of a given task - the WORKDIR. It does not matter if the work directory changes because it should not affect the output for target packages. Also, the build process has the objective of making native or cross packages relocatable.

Note

Both native and cross packages run on the build host. However, cross packages generate output for the target architecture.

The checksum therefore needs to exclude WORKDIR. The simplistic approach for excluding the work directory is to set WORKDIR to some fixed value and create the checksum for the “run” script.

Another problem results from the “run” scripts containing functions that might or might not get called. The incremental build solution contains code that figures out dependencies between shell functions. This code is used to prune the “run” scripts down to the minimum set, thereby alleviating this problem and making the “run” scripts much more readable as a bonus.

So far, solutions for shell scripts exist. What about Python tasks? The same approach applies even though these tasks are more difficult. The process needs to figure out what variables a Python function accesses and what functions it calls. Again, the incremental build solution contains code that first figures out the variable and function dependencies, and then creates a checksum for the data used as the input to the task.

Like the WORKDIR case, situations exist where dependencies should be ignored. For these situations, you can instruct the build process to ignore a dependency by using a line like the following:

PACKAGE_ARCHS[vardepsexclude] = "MACHINE"

This example ensures that the PACKAGE_ARCHS variable does not depend on the value of MACHINE, even if it does reference it.

Equally, there are cases where you need to add dependencies BitBake is not able to find. You can accomplish this by using a line like the following:

PACKAGE_ARCHS[vardeps] = "MACHINE"

This example explicitly adds the MACHINE variable as a dependency for PACKAGE_ARCHS.

As an example, consider a case with in-line Python where BitBake is not able to figure out dependencies. When running in debug mode (i.e. using -DDD), BitBake produces output when it discovers something for which it cannot figure out dependencies. The Yocto Project team has currently not managed to cover those dependencies in detail and is aware of the need to fix this situation.

Thus far, this section has limited discussion to the direct inputs into a task. Information based on direct inputs is referred to as the “basehash” in the code. However, the question of a task’s indirect inputs still exits - items already built and present in the Build Directory. The checksum (or signature) for a particular task needs to add the hashes of all the tasks on which the particular task depends. Choosing which dependencies to add is a policy decision. However, the effect is to generate a master checksum that combines the basehash and the hashes of the task’s dependencies.

At the code level, a variety of ways exist by which both the basehash and the dependent task hashes can be influenced. Within the BitBake configuration file, you can give BitBake some extra information to help it construct the basehash. The following statement effectively results in a list of global variable dependency excludes (i.e. variables never included in any checksum):

BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH DL_DIR \\
    SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL TERM \\
    USER FILESPATH STAGING_DIR_HOST STAGING_DIR_TARGET COREBASE PRSERV_HOST \\
    PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \\
    CCACHE_DIR EXTERNAL_TOOLCHAIN CCACHE CCACHE_DISABLE LICENSE_PATH SDKPKGSUFFIX"

The previous example excludes WORKDIR since that variable is actually constructed as a path within TMPDIR, which is on the whitelist.

The rules for deciding which hashes of dependent tasks to include through dependency chains are more complex and are generally accomplished with a Python function. The code in meta/lib/oe/sstatesig.py shows two examples of this and also illustrates how you can insert your own policy into the system if so desired. This file defines the two basic signature generators OpenEmbedded-Core (OE-Core) uses: “OEBasic” and “OEBasicHash”. By default, a dummy “noop” signature handler is enabled in BitBake. This means that behavior is unchanged from previous versions. OE-Core uses the “OEBasicHash” signature handler by default through this setting in the bitbake.conf file:

BB_SIGNATURE_HANDLER ?= "OEBasicHash"

The “OEBasicHash” BB_SIGNATURE_HANDLER is the same as the “OEBasic” version but adds the task hash to the stamp files. This results in any metadata change that changes the task hash, automatically causing the task to be run again. This removes the need to bump PR values, and changes to metadata automatically ripple across the build.

It is also worth noting that the end result of these signature generators is to make some dependency and hash information available to the build. This information includes:

  • BB_BASEHASH_task-taskname: The base hashes for each task in the recipe.

  • BB_BASEHASH_filename:taskname: The base hashes for each dependent task.

  • BBHASHDEPS_filename:taskname: The task dependencies for each task.

  • BB_TASKHASH: The hash of the currently running task.

4.5.3 Shared State

Checksums and dependencies, as discussed in the previous section, solve half the problem of supporting a shared state. The other half of the problem is being able to use checksum information during the build and being able to reuse or rebuild specific components.

The sstate class is a relatively generic implementation of how to “capture” a snapshot of a given task. The idea is that the build process does not care about the source of a task’s output. Output could be freshly built or it could be downloaded and unpacked from somewhere. In other words, the build process does not need to worry about its origin.

Two types of output exist. One type is just about creating a directory in WORKDIR. A good example is the output of either do_install or do_package. The other type of output occurs when a set of data is merged into a shared directory tree such as the sysroot.

The Yocto Project team has tried to keep the details of the implementation hidden in sstate class. From a user’s perspective, adding shared state wrapping to a task is as simple as this do_deploy example taken from the deploy class:

DEPLOYDIR = "${WORKDIR}/deploy-${PN}"
SSTATETASKS += "do_deploy"
do_deploy[sstate-inputdirs] = "${DEPLOYDIR}"
do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"

python do_deploy_setscene () {
    sstate_setscene(d)
}
addtask do_deploy_setscene
do_deploy[dirs] = "${DEPLOYDIR} ${B}"
do_deploy[stamp-extra-info] = "${MACHINE_ARCH}"

The following list explains the previous example:

  • Adding “do_deploy” to SSTATETASKS adds some required sstate-related processing, which is implemented in the sstate class, to before and after the do_deploy task.

  • The do_deploy[sstate-inputdirs] = "${DEPLOYDIR}" declares that do_deploy places its output in ${DEPLOYDIR} when run normally (i.e. when not using the sstate cache). This output becomes the input to the shared state cache.

  • The do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}" line causes the contents of the shared state cache to be copied to ${DEPLOY_DIR_IMAGE}.

    Note

    If do_deploy is not already in the shared state cache or if its input checksum (signature) has changed from when the output was cached, the task runs to populate the shared state cache, after which the contents of the shared state cache is copied to ${DEPLOY_DIR_IMAGE}. If do_deploy is in the shared state cache and its signature indicates that the cached output is still valid (i.e. if no relevant task inputs have changed), then the contents of the shared state cache copies directly to ${DEPLOY_DIR_IMAGE} by the do_deploy_setscene task instead, skipping the do_deploy task.

  • The following task definition is glue logic needed to make the previous settings effective:

    python do_deploy_setscene () {
        sstate_setscene(d)
    }
    addtask do_deploy_setscene
    

sstate_setscene() takes the flags above as input and accelerates the do_deploy task through the shared state cache if possible. If the task was accelerated, sstate_setscene() returns True. Otherwise, it returns False, and the normal do_deploy task runs. For more information, see the “setscene” section in the BitBake User Manual.

  • The do_deploy[dirs] = "${DEPLOYDIR} ${B}" line creates ${DEPLOYDIR} and ${B} before the do_deploy task runs, and also sets the current working directory of do_deploy to ${B}. For more information, see the “Variable Flags” section in the BitBake User Manual.

    Note

    In cases where sstate-inputdirs and sstate-outputdirs would be the same, you can use sstate-plaindirs. For example, to preserve the ${PKGD} and ${PKGDEST} output from the do_package task, use the following:

    do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST}"
    
  • The do_deploy[stamp-extra-info] = "${MACHINE_ARCH}" line appends extra metadata to the stamp file. In this case, the metadata makes the task specific to a machine’s architecture. See “The Task List” section in the BitBake User Manual for more information on the stamp-extra-info flag.

  • sstate-inputdirs and sstate-outputdirs can also be used with multiple directories. For example, the following declares PKGDESTWORK and SHLIBWORK as shared state input directories, which populates the shared state cache, and PKGDATA_DIR and SHLIBSDIR as the corresponding shared state output directories:

    do_package[sstate-inputdirs] = "${PKGDESTWORK} ${SHLIBSWORKDIR}"
    do_package[sstate-outputdirs] = "${PKGDATA_DIR} ${SHLIBSDIR}"
    
  • These methods also include the ability to take a lockfile when manipulating shared state directory structures, for cases where file additions or removals are sensitive:

    do_package[sstate-lockfile] = "${PACKAGELOCK}"
    

Behind the scenes, the shared state code works by looking in SSTATE_DIR and SSTATE_MIRRORS for shared state files. Here is an example:

SSTATE_MIRRORS ?= "\
    file://.\* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \
    file://.\* file:///some/local/dir/sstate/PATH"

Note

The shared state directory (SSTATE_DIR) is organized into two-character subdirectories, where the subdirectory names are based on the first two characters of the hash. If the shared state directory structure for a mirror has the same structure as SSTATE_DIR, you must specify “PATH” as part of the URI to enable the build system to map to the appropriate subdirectory.

The shared state package validity can be detected just by looking at the filename since the filename contains the task checksum (or signature) as described earlier in this section. If a valid shared state package is found, the build process downloads it and uses it to accelerate the task.

The build processes use the *_setscene tasks for the task acceleration phase. BitBake goes through this phase before the main execution code and tries to accelerate any tasks for which it can find shared state packages. If a shared state package for a task is available, the shared state package is used. This means the task and any tasks on which it is dependent are not executed.

As a real world example, the aim is when building an IPK-based image, only the do_package_write_ipk tasks would have their shared state packages fetched and extracted. Since the sysroot is not used, it would never get extracted. This is another reason why a task-based approach is preferred over a recipe-based approach, which would have to install the output from every task.

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. Three automatic mechanisms exist (shlibdeps, pcdeps, and depchains) that handle shared libraries, package configuration (pkg-config) modules, and -dev and -dbg packages, respectively. For other types of runtime dependencies, you must manually declare the dependencies.

  • shlibdeps: During the do_package task of each recipe, all shared libraries installed by the recipe are located. For each shared library, the package that contains the shared library is registered as providing the shared library. More specifically, the package is registered as providing the soname of the library. The resulting shared-library-to-package mapping is saved globally in PKGDATA_DIR by the do_packagedata task.

    Simultaneously, all executables and shared libraries installed by the recipe are inspected to see what shared libraries they link against. For each shared library dependency that is found, PKGDATA_DIR is queried to see if some package (likely from a different recipe) contains the shared library. If such a package is found, a runtime dependency is added from the package that depends on the shared library to the package that contains the library.

    The automatically added runtime dependency also includes a version restriction. This version restriction specifies that at least the current version of the package that provides the shared library must be used, as if “package (>= version)” had been added to RDEPENDS. This forces an upgrade of the package containing the shared library when installing the package that depends on the library, if needed.

    If you want to avoid a package being registered as providing a particular shared library (e.g. because the library is for internal use only), then add the library to PRIVATE_LIBS inside the package’s recipe.

  • pcdeps: During the do_package task of each recipe, all pkg-config modules (*.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 the do_packagedata task.

    Simultaneously, all pkg-config modules installed by the recipe are inspected to see what other pkg-config modules they depend on. A module is seen as depending on another module if it contains a “Requires:” line that specifies the other module. For each module dependency, PKGDATA_DIR is queried to see if some package contains the module. If such a package is found, a runtime dependency is added from the package that depends on the module to the package that contains the module.

    Note

    The pcdeps mechanism most often infers dependencies between -dev packages.

  • depchains: If a package foo depends on a package bar, then foo-dev and foo-dbg are also made to depend on bar-dev and bar-dbg, respectively. Taking the -dev packages as an example, the bar-dev package might provide headers and shared library symlinks needed by foo-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 on foo, because the default value of RDEPENDS_${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.

5 Manual Revision History

Revision

Date

Note

2.5

May 2018

The initial document released with the Yocto Project 2.5 Release

2.6

November 2018

Released with the Yocto Project 2.6 Release.

2.7

May 2019

Released with the Yocto Project 2.7 Release.

3.0

October 2019

Released with the Yocto Project 3.0 Release.

3.1

April 2020

Released with the Yocto Project 3.1 Release.


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 freenode #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 16.04 (LTS)

  • Ubuntu 18.04 (LTS)

  • Ubuntu 20.04

  • Fedora 30

  • Fedora 31

  • Fedora 32

  • CentOS 7.x

  • CentOS 8.x

  • Debian GNU/Linux 8.x (Jessie)

  • Debian GNU/Linux 9.x (Stretch)

  • Debian GNU/Linux 10.x (Buster)

  • OpenSUSE Leap 15.1

Note

  • While the Yocto Project Team attempts to ensure all Yocto Project releases are one hundred percent compatible with each officially supported Linux distribution, instances might exist where you encounter a problem while using the Yocto Project on 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

The following list shows 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, either of the following solutions exist:

    $ sudo apt-get build-dep qemu
    $ sudo apt-get remove oss4-dev
    
  • For Debian-8, python3-git and pylint3 are no longer available via apt-get.

    $ sudo pip3 install GitPython pylint==1.9.5
    
  • Essentials: Packages needed to build an image on a headless system:

    $ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib 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
    
  • Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:

    $ sudo apt-get 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 and python3. python3-sphinx is too outdated.

1.2.2 Fedora Packages

The following list shows 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
    
  • 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

The following list shows 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
    $ 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

The following list shows 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 python36-pip xz which SDL-devel xterm mesa-libGL-devel
    $ 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 from epel-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

The following list shows 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
    

    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 as rpcgen and texinfo.

    • The makecache command consumes additional Metadata from epel-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.5.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 buildtools-essential.

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:

  1. 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-3.2 \
      --installer-version 3.2
    

    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 to make sure the installation is functional.

    To avoid the need of sudo privileges, the install-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 the install-buildtools script with the default parameters:

    $ cd poky
    $ scripts/install-buildtools
    
  2. 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 and chrpath. And in the case of the buildtools-extended tarball, additional working versions of tools including gcc, make and the other tools included in packagegroup-core-buildessential.

1.3.2 Downloading a Pre-Built buildtools Tarball

Downloading and running a pre-built buildtools installer is the easiest of the two methods by which you can get these tools:

  1. Locate and download the *.sh at https://downloads.yoctoproject.org/releases/yocto/yocto-3.2/buildtools/

  2. Execute the installation script. Here is an example for the traditional installer:

    $ sh ~/Downloads/x86_64-buildtools-nativesdk-standalone-DISTRO.sh
    

    Here is an example for the extended installer:

    $ sh ~/Downloads/x86_64-buildtools-extended-nativesdk-standalone-DISTRO.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

  3. 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 and chrpath. And in the case of the buildtools-extended tarball, additional working versions of tools including gcc, make and the other tools included in packagegroup-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:

  1. 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).

  2. 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 the tmp/deploy/sdk subdirectory of the Build Directory. The installer file has the string “buildtools” (or “buildtools-extended”) in the name.

  3. Transfer the .sh file from the build host to the machine that does not meet the Git, tar, or Python (or gcc) requirements.

  4. 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-3.2.sh
    

    Here is an example for the extended installer:

    $ sh ~/Downloads/x86_64-buildtools-extended-nativesdk-standalone-3.2.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

  5. 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 and chrpath. And in the case of the buildtools-extended tarball, additional working versions of tools including gcc, make and the other tools included in packagegroup-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 and formfactor_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 “Using .bbappend Files in 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 $HOME/poky
    $ source oe-init-build-env
    
  • Create the Build Directory inside your home directory and specifically name it test-builds:

    $ cd $HOME
    $ 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-POKYVERSION in your home directory within the existing directory mybuilds:

    $ cd $HOME
    $ source $HOME/poky/oe-init-build-env $HOME/mybuilds/YP-POKYVERSION
    

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. The conf/local.conf configuration file in the Build Directory contains user-defined variables that affect every build. The meta-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. the machine/beaglebone.conf configuration file defines variables for the Texas Instruments ARM Cortex-A8 development board).

Container Layer

Layers that hold other layers. An example of a container layer is OpenEmbedded’s meta-openembedded layer. The meta-openembedded layer contains many meta-* 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 repository git://git.yoctoproject.org/poky or expanding a released poky 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 expansion 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 https://downloads.yoctoproject.org/releases/yocto/yocto-3.2/poky-gatesgarth-24.0.0.tar.bz2 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 the poky 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 upstream poky 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 unit of execution for BitBake (e.g. do_compile, do_fetch, do_patch, and so forth).

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 master 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. DISTRO) 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. DISTRO) 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.

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 a strong reason exists 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 exist where community members 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 be run within a target image.

  • oe-selftest: Tests combination BitBake invocations. These tests operate outside the OpenEmbedded build system itself. The oe-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 Migrating to a Newer Yocto Project Release

This chapter provides information you can use to migrate work to a newer Yocto Project release. You can find the same information in the release notes for a given release.

4.1 General Migration Considerations

Some considerations are not tied to a specific Yocto Project release. This section presents information you should consider when migrating to any new Yocto Project release.

  • Dealing with Customized Recipes:

    Issues could arise if you take older recipes that contain customizations and simply copy them forward expecting them to work after you migrate to new Yocto Project metadata. For example, suppose you have a recipe in your layer that is a customized version of a core recipe copied from the earlier release, rather than through the use of an append file. When you migrate to a newer version of Yocto Project, the metadata (e.g. perhaps an include file used by the recipe) could have changed in a way that would break the build. Say, for example, a function is removed from an include file and the customized recipe tries to call that function.

    You could “forward-port” all your customizations in your recipe so that everything works for the new release. However, this is not the optimal solution as you would have to repeat this process with each new release if changes occur that give rise to problems.

    The better solution (where practical) is to use append files (*.bbappend) to capture any customizations you want to make to a recipe. Doing so, isolates your changes from the main recipe making them much more manageable. However, sometimes it is not practical to use an append file. A good example of this is when introducing a newer or older version of a recipe in another layer.

  • Updating Append Files:

    Since append files generally only contain your customizations, they often do not need to be adjusted for new releases. However, if the .bbappend file is specific to a particular version of the recipe (i.e. its name does not use the % wildcard) and the version of the recipe to which it is appending has changed, then you will at a minimum need to rename the append file to match the name of the recipe file. A mismatch between an append file and its corresponding recipe file (.bb) will trigger an error during parsing.

    Depending on the type of customization the append file applies, other incompatibilities might occur when you upgrade. For example, if your append file applies a patch and the recipe to which it is appending is updated to a newer version, the patch might no longer apply. If this is the case and assuming the patch is still needed, you must modify the patch file so that it does apply.

4.2 Moving to the Yocto Project 1.3 Release

This section provides migration information for moving to the Yocto Project 1.3 Release from the prior release.

4.2.1 Local Configuration

Differences include changes for SSTATE_MIRRORS and bblayers.conf.

4.2.1.1 SSTATE_MIRRORS

The shared state cache (sstate-cache), as pointed to by SSTATE_DIR, by default now has two-character subdirectories to prevent issues arising from too many files in the same directory. Also, native sstate-cache packages, which are built to run on the host system, will go into a subdirectory named using the distro ID string. If you copy the newly structured sstate-cache to a mirror location (either local or remote) and then point to it in SSTATE_MIRRORS, you need to append “PATH” to the end of the mirror URL so that the path used by BitBake before the mirror substitution is appended to the path used to access the mirror. Here is an example:

SSTATE_MIRRORS = "file://.* http://someserver.tld/share/sstate/PATH"
4.2.1.2 bblayers.conf

The meta-yocto layer consists of two parts that correspond to the Poky reference distribution and the reference hardware Board Support Packages (BSPs), respectively: meta-yocto and meta-yocto-bsp. When running BitBake for the first time after upgrading, your conf/bblayers.conf file will be updated to handle this change and you will be asked to re-run or restart for the changes to take effect.

4.2.2 Recipes

Differences include changes for the following:

4.2.2.1 Python Function Whitespace

All Python functions must now use four spaces for indentation. Previously, an inconsistent mix of spaces and tabs existed, which made extending these functions using _append or _prepend complicated given that Python treats whitespace as syntactically significant. If you are defining or extending any Python functions (e.g. populate_packages, do_unpack, do_patch and so forth) in custom recipes or classes, you need to ensure you are using consistent four-space indentation.

4.2.2.2 proto= in SRC_URI

Any use of proto= in SRC_URI needs to be changed to protocol=. In particular, this applies to the following URIs:

  • svn://

  • bzr://

  • hg://

  • osc://

Other URIs were already using protocol=. This change improves consistency.

4.2.2.3 nativesdk

The suffix nativesdk is now implemented as a prefix, which simplifies a lot of the packaging code for nativesdk recipes. All custom nativesdk recipes, which are relocatable packages that are native to SDK_ARCH, and any references need to be updated to use nativesdk-* instead of *-nativesdk.

4.2.2.4 Task Recipes

“Task” recipes are now known as “Package groups” and have been renamed from task-*.bb to packagegroup-*.bb. Existing references to the previous task-* names should work in most cases as there is an automatic upgrade path for most packages. However, you should update references in your own recipes and configurations as they could be removed in future releases. You should also rename any custom task-* recipes to packagegroup-*, and change them to inherit packagegroup instead of task, as well as taking the opportunity to remove anything now handled by packagegroup.bbclass, such as providing -dev and -dbg packages, setting LIC_FILES_CHKSUM, and so forth. See the “packagegroup.bbclass” section for further details.

4.2.2.5 IMAGE_FEATURES

Image recipes that previously included apps-console-core in IMAGE_FEATURES should now include splash instead to enable the boot-up splash screen. Retaining apps-console-core will still include the splash screen but generates a warning. The apps-x11-core and apps-x11-games IMAGE_FEATURES features have been removed.

4.2.2.6 Removed Recipes

The following recipes have been removed. For most of them, it is unlikely that you would have any references to them in your own Metadata. However, you should check your metadata against this list to be sure:

  • libx11-trim: Replaced by libx11, which has a negligible size difference with modern Xorg.

  • xserver-xorg-lite: Use xserver-xorg, which has a negligible size difference when DRI and GLX modules are not installed.

  • xserver-kdrive: Effectively unmaintained for many years.

  • mesa-xlib: No longer serves any purpose.

  • galago: Replaced by telepathy.

  • gail: Functionality was integrated into GTK+ 2.13.

  • eggdbus: No longer needed.

  • gcc-*-intermediate: The build has been restructured to avoid the need for this step.

  • libgsmd: Unmaintained for many years. Functionality now provided by ofono instead.

  • contacts, dates, tasks, eds-tools: Largely unmaintained PIM application suite. It has been moved to meta-gnome in meta-openembedded.

In addition to the previously listed changes, the meta-demoapps directory has also been removed because the recipes in it were not being maintained and many had become obsolete or broken. Additionally, these recipes were not parsed in the default configuration. Many of these recipes are already provided in an updated and maintained form within the OpenEmbedded community layers such as meta-oe and meta-gnome. For the remainder, you can now find them in the meta-extras repository, which is in the Source Repositories at https://git.yoctoproject.org/cgit/cgit.cgi/meta-extras/.

4.2.3 Linux Kernel Naming

The naming scheme for kernel output binaries has been changed to now include PE as part of the filename:

KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PE}-${PV}-${PR}-${MACHINE}-${DATETIME}"

Because the PE variable is not set by default, these binary files could result with names that include two dash characters. Here is an example:

bzImage--3.10.9+git0+cd502a8814_7144bcc4b8-r0-qemux86-64-20130830085431.bin

4.3 Moving to the Yocto Project 1.4 Release

This section provides migration information for moving to the Yocto Project 1.4 Release from the prior release.

4.3.1 BitBake

Differences include the following:

  • Comment Continuation: If a comment ends with a line continuation (\) character, then the next line must also be a comment. Any instance where this is not the case, now triggers a warning. You must either remove the continuation character, or be sure the next line is a comment.

  • Package Name Overrides: The runtime package specific variables RDEPENDS, RRECOMMENDS, RSUGGESTS, RPROVIDES, RCONFLICTS, RREPLACES, FILES, ALLOW_EMPTY, and the pre, post, install, and uninstall script functions pkg_preinst, pkg_postinst, pkg_prerm, and pkg_postrm should always have a package name override. For example, use RDEPENDS_${PN} for the main package instead of RDEPENDS. BitBake uses more strict checks when it parses recipes.

4.3.2 Build Behavior

Differences include the following:

  • Shared State Code: The shared state code has been optimized to avoid running unnecessary tasks. For example, the following no longer populates the target sysroot since that is not necessary:

    $ bitbake -c rootfs some-image
    

    Instead, the system just needs to extract the output package contents, re-create the packages, and construct the root filesystem. This change is unlikely to cause any problems unless you have missing declared dependencies.

  • Scanning Directory Names: When scanning for files in SRC_URI, the build system now uses FILESOVERRIDES instead of OVERRIDES for the directory names. In general, the values previously in OVERRIDES are now in FILESOVERRIDES as well. However, if you relied upon an additional value you previously added to OVERRIDES, you might now need to add it to FILESOVERRIDES unless you are already adding it through the MACHINEOVERRIDES or DISTROOVERRIDES variables, as appropriate. For more related changes, see the “Variables” section.

4.3.3 Proxies and Fetching Source

A new oe-git-proxy script has been added to replace previous methods of handling proxies and fetching source from Git. See the meta-yocto/conf/site.conf.sample file for information on how to use this script.

4.3.4 Custom Interfaces File (netbase change)

If you have created your own custom etc/network/interfaces file by creating an append file for the netbase recipe, you now need to create an append file for the init-ifupdown recipe instead, which you can find in the Source Directory at meta/recipes-core/init-ifupdown. For information on how to use append files, see the “Using .bbappend Files in Your Layer” section in the Yocto Project Development Tasks Manual.

4.3.5 Remote Debugging

Support for remote debugging with the Eclipse IDE is now separated into an image feature (eclipse-debug) that corresponds to the packagegroup-core-eclipse-debug package group. Previously, the debugging feature was included through the tools-debug image feature, which corresponds to the packagegroup-core-tools-debug package group.

4.3.6 Variables

The following variables have changed:

  • SANITY_TESTED_DISTROS: This variable now uses a distribution ID, which is composed of the host distributor ID followed by the release. Previously, SANITY_TESTED_DISTROS was composed of the description field. For example, “Ubuntu 12.10” becomes “Ubuntu-12.10”. You do not need to worry about this change if you are not specifically setting this variable, or if you are specifically setting it to “”.

  • SRC_URI: The ${PN}, ${PF}, ${P}, and FILE_DIRNAME directories have been dropped from the default value of the FILESPATH variable, which is used as the search path for finding files referred to in SRC_URI. If you have a recipe that relied upon these directories, which would be unusual, then you will need to add the appropriate paths within the recipe or, alternatively, rearrange the files. The most common locations are still covered by ${BP}, ${BPN}, and “files”, which all remain in the default value of FILESPATH.

4.3.7 Target Package Management with RPM

If runtime package management is enabled and the RPM backend is selected, Smart is now installed for package download, dependency resolution, and upgrades instead of Zypper. For more information on how to use Smart, run the following command on the target:

smart --help
4.3.8 Recipes Moved

The following recipes were moved from their previous locations because they are no longer used by anything in the OpenEmbedded-Core:

  • clutter-box2d: Now resides in the meta-oe layer.

  • evolution-data-server: Now resides in the meta-gnome layer.

  • gthumb: Now resides in the meta-gnome layer.

  • gtkhtml2: Now resides in the meta-oe layer.

  • gupnp: Now resides in the meta-multimedia layer.

  • gypsy: Now resides in the meta-oe layer.

  • libcanberra: Now resides in the meta-gnome layer.

  • libgdata: Now resides in the meta-gnome layer.

  • libmusicbrainz: Now resides in the meta-multimedia layer.

  • metacity: Now resides in the meta-gnome layer.

  • polkit: Now resides in the meta-oe layer.

  • zeroconf: Now resides in the meta-networking layer.

4.3.9 Removals and Renames

The following list shows what has been removed or renamed:

  • evieext: Removed because it has been removed from xserver since 2008.

  • Gtk+ DirectFB: Removed support because upstream Gtk+ no longer supports it as of version 2.18.

  • libxfontcache / xfontcacheproto: Removed because they were removed from the Xorg server in 2008.

  • libxp / libxprintapputil / libxprintutil / printproto: Removed because the XPrint server was removed from Xorg in 2008.

  • libxtrap / xtrapproto: Removed because their functionality was broken upstream.

  • linux-yocto 3.0 kernel: Removed with linux-yocto 3.8 kernel being added. The linux-yocto 3.2 and linux-yocto 3.4 kernels remain as part of the release.

  • lsbsetup: Removed with functionality now provided by lsbtest.

  • matchbox-stroke: Removed because it was never more than a proof-of-concept.

  • matchbox-wm-2 / matchbox-theme-sato-2: Removed because they are not maintained. However, matchbox-wm and matchbox-theme-sato are still provided.

  • mesa-dri: Renamed to mesa.

  • mesa-xlib: Removed because it was no longer useful.

  • mutter: Removed because nothing ever uses it and the recipe is very old.

  • orinoco-conf: Removed because it has become obsolete.

  • update-modules: Removed because it is no longer used. The kernel module postinstall and postrm scripts can now do the same task without the use of this script.

  • web: Removed because it is not maintained. Superseded by web-webkit.

  • xf86bigfontproto: Removed because upstream it has been disabled by default since 2007. Nothing uses xf86bigfontproto.

  • xf86rushproto: Removed because its dependency in xserver was spurious and it was removed in 2005.

  • zypper / libzypp / sat-solver: Removed and been functionally replaced with Smart (python-smartpm) when RPM packaging is used and package management is enabled on the target.

4.4 Moving to the Yocto Project 1.5 Release

This section provides migration information for moving to the Yocto Project 1.5 Release from the prior release.

4.4.1 Host Dependency Changes

The OpenEmbedded build system now has some additional requirements on the host system:

  • Python 2.7.3+

  • Tar 1.24+

  • Git 1.7.8+

  • Patched version of Make if you are using 3.82. Most distributions that provide Make 3.82 use the patched version.

If the Linux distribution you are using on your build host does not provide packages for these, you can install and use the Buildtools tarball, which provides an SDK-like environment containing them.

For more information on this requirement, see the “Required Git, tar, Python and gcc Versions” section.

4.4.2 atom-pc Board Support Package (BSP)

The atom-pc hardware reference BSP has been replaced by a genericx86 BSP. This BSP is not necessarily guaranteed to work on all x86 hardware, but it will run on a wider range of systems than the atom-pc did.

Note

Additionally, a genericx86-64 BSP has been added for 64-bit Atom systems.

4.4.3 BitBake

The following changes have been made that relate to BitBake:

  • BitBake now supports a _remove operator. The addition of this operator means you will have to rename any items in recipe space (functions, variables) whose names currently contain _remove_ or end with _remove to avoid unexpected behavior.

  • BitBake’s global method pool has been removed. This method is not particularly useful and led to clashes between recipes containing functions that had the same name.

  • The “none” server backend has been removed. The “process” server backend has been serving well as the default for a long time now.

  • The bitbake-runtask script has been removed.

  • ${P} and ${PF} are no longer added to PROVIDES by default in bitbake.conf. These version-specific PROVIDES items were seldom used. Attempting to use them could result in two versions being built simultaneously rather than just one version due to the way BitBake resolves dependencies.

4.4.4 QA Warnings

The following changes have been made to the package QA checks:

  • If you have customized ERROR_QA or WARN_QA values in your configuration, check that they contain all of the issues that you wish to be reported. Previous Yocto Project versions contained a bug that meant that any item not mentioned in ERROR_QA or WARN_QA would be treated as a warning. Consequently, several important items were not already in the default value of WARN_QA. All of the possible QA checks are now documented in the “insane.bbclass” section.

  • An additional QA check has been added to check if /usr/share/info/dir is being installed. Your recipe should delete this file within do_install if “make install” is installing it.

  • If you are using the buildhistory class, the check for the package version going backwards is now controlled using a standard QA check. Thus, if you have customized your ERROR_QA or WARN_QA values and still wish to have this check performed, you should add “version-going-backwards” to your value for one or the other variables depending on how you wish it to be handled. See the documented QA checks in the “insane.bbclass” section.

4.4.5 Directory Layout Changes

The following directory changes exist:

  • Output SDK installer files are now named to include the image name and tuning architecture through the SDK_NAME variable.

  • Images and related files are now installed into a directory that is specific to the machine, instead of a parent directory containing output files for multiple machines. The DEPLOY_DIR_IMAGE variable continues to point to the directory containing images for the current MACHINE and should be used anywhere there is a need to refer to this directory. The runqemu script now uses this variable to find images and kernel binaries and will use BitBake to determine the directory. Alternatively, you can set the DEPLOY_DIR_IMAGE variable in the external environment.

  • When buildhistory is enabled, its output is now written under the Build Directory rather than TMPDIR. Doing so makes it easier to delete TMPDIR and preserve the build history. Additionally, data for produced SDKs is now split by IMAGE_NAME.

  • The pkgdata directory produced as part of the packaging process has been collapsed into a single machine-specific directory. This directory is located under sysroots and uses a machine-specific name (i.e. tmp/sysroots/machine/pkgdata).

4.4.6 Shortened Git SRCREV Values

BitBake will now shorten revisions from Git repositories from the normal 40 characters down to 10 characters within SRCPV for improved usability in path and file names. This change should be safe within contexts where these revisions are used because the chances of spatially close collisions is very low. Distant collisions are not a major issue in the way the values are used.

4.4.7 IMAGE_FEATURES

The following changes have been made that relate to IMAGE_FEATURES:

  • The value of IMAGE_FEATURES is now validated to ensure invalid feature items are not added. Some users mistakenly add package names to this variable instead of using IMAGE_INSTALL in order to have the package added to the image, which does not work. This change is intended to catch those kinds of situations. Valid IMAGE_FEATURES are drawn from PACKAGE_GROUP definitions, COMPLEMENTARY_GLOB and a new “validitems” varflag on IMAGE_FEATURES. The “validitems” varflag change allows additional features to be added if they are not provided using the previous two mechanisms.

  • The previously deprecated “apps-console-core” IMAGE_FEATURES item is no longer supported. Add “splash” to IMAGE_FEATURES if you wish to have the splash screen enabled, since this is all that apps-console-core was doing.

4.4.8 /run

The /run directory from the Filesystem Hierarchy Standard 3.0 has been introduced. You can find some of the implications for this change here. The change also means that recipes that install files to /var/run must be changed. You can find a guide on how to make these changes here.

4.4.9 Removal of Package Manager Database Within Image Recipes

The image core-image-minimal no longer adds remove_packaging_data_files to ROOTFS_POSTPROCESS_COMMAND. This addition is now handled automatically when “package-management” is not in IMAGE_FEATURES. If you have custom image recipes that make this addition, you should remove the lines, as they are not needed and might interfere with correct operation of postinstall scripts.

4.4.10 Images Now Rebuild Only on Changes Instead of Every Time

The do_rootfs and other related image construction tasks are no longer marked as “nostamp”. Consequently, they will only be re-executed when their inputs have changed. Previous versions of the OpenEmbedded build system always rebuilt the image when requested rather when necessary.

4.4.11 Task Recipes

The previously deprecated task.bbclass has now been dropped. For recipes that previously inherited from this class, you should rename them from task-* to packagegroup-* and inherit packagegroup instead.

For more information, see the “packagegroup.bbclass” section.

4.4.12 BusyBox

By default, we now split BusyBox into two binaries: one that is suid root for those components that need it, and another for the rest of the components. Splitting BusyBox allows for optimization that eliminates the tinylogin recipe as recommended by upstream. You can disable this split by setting BUSYBOX_SPLIT_SUID to “0”.

4.4.13 Automated Image Testing

A new automated image testing framework has been added through the testimage.bbclass class. This framework replaces the older imagetest-qemu framework.

You can learn more about performing automated image tests in the “Performing Automated Runtime Testing” section in the Yocto Project Development Tasks Manual.

4.4.14 Build History

Following are changes to Build History:

  • Installed package sizes: installed-package-sizes.txt for an image now records the size of the files installed by each package instead of the size of each compressed package archive file.

  • The dependency graphs (depends*.dot) now use the actual package names instead of replacing dashes, dots and plus signs with underscores.

  • The buildhistory-diff and buildhistory-collect-srcrevs utilities have improved command-line handling. Use the --help option for each utility for more information on the new syntax.

For more information on Build History, see the “Maintaining Build Output Quality” section in the Yocto Project Development Tasks Manual.

4.4.15 udev

Following are changes to udev:

  • udev no longer brings in udev-extraconf automatically through RRECOMMENDS, since this was originally intended to be optional. If you need the extra rules, then add udev-extraconf to your image.

  • udev no longer brings in pciutils-ids or usbutils-ids through RRECOMMENDS. These are not needed by udev itself and removing them saves around 350KB.

4.4.16 Removed and Renamed Recipes
  • The linux-yocto 3.2 kernel has been removed.

  • libtool-nativesdk has been renamed to nativesdk-libtool.

  • tinylogin has been removed. It has been replaced by a suid portion of Busybox. See the “BusyBox” section for more information.

  • external-python-tarball has been renamed to buildtools-tarball.

  • web-webkit has been removed. It has been functionally replaced by midori.

  • imake has been removed. It is no longer needed by any other recipe.

  • transfig-native has been removed. It is no longer needed by any other recipe.

  • anjuta-remote-run has been removed. Anjuta IDE integration has not been officially supported for several releases.

4.4.17 Other Changes

Following is a list of short entries describing other changes:

  • run-postinsts: Make this generic.

  • base-files: Remove the unnecessary media/xxx directories.

  • alsa-state: Provide an empty asound.conf by default.

  • classes/image: Ensure BAD_RECOMMENDATIONS supports pre-renamed package names.

  • classes/rootfs_rpm: Implement BAD_RECOMMENDATIONS for RPM.

  • systemd: Remove systemd_unitdir if systemd is not in DISTRO_FEATURES.

  • systemd: Remove init.d dir if systemd unit file is present and sysvinit is not a distro feature.

  • libpam: Deny all services for the OTHER entries.

  • image.bbclass: Move runtime_mapping_rename to avoid conflict with multilib. See YOCTO #4993 in Bugzilla for more information.

  • linux-dtb: Use kernel build system to generate the dtb files.

  • kern-tools: Switch from guilt to new kgit-s2q tool.

4.5 Moving to the Yocto Project 1.6 Release

This section provides migration information for moving to the Yocto Project 1.6 Release from the prior release.

4.5.1 archiver Class

The archiver class has been rewritten and its configuration has been simplified. 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.

4.5.2 Packaging Changes

The following packaging changes have been made:

  • The binutils recipe no longer produces a binutils-symlinks package. update-alternatives is now used to handle the preferred binutils variant on the target instead.

  • The tc (traffic control) utilities have been split out of the main iproute2 package and put into the iproute2-tc package.

  • The gtk-engines schemas have been moved to a dedicated gtk-engines-schemas package.

  • The armv7a with thumb package architecture suffix has changed. The suffix for these packages with the thumb optimization enabled is “t2” as it should be. Use of this suffix was not the case in the 1.5 release. Architecture names will change within package feeds as a result.

4.5.3 BitBake

The following changes have been made to BitBake.

4.5.3.1 Matching Branch Requirement for Git Fetching

When fetching source from a Git repository using SRC_URI, BitBake will now validate the SRCREV value against the branch. You can specify the branch using the following form:

SRC_URI = "git://server.name/repository;branch=branchname"

If you do not specify a branch, BitBake looks in the default “master” branch.

Alternatively, if you need to bypass this check (e.g. if you are fetching a revision corresponding to a tag that is not on any branch), you can add “;nobranch=1” to the end of the URL within SRC_URI.

4.5.3.2 Python Definition substitutions

BitBake had some previously deprecated Python definitions within its bb module removed. You should use their sub-module counterparts instead:

  • bb.MalformedUrl: Use bb.fetch.MalformedUrl.

  • bb.encodeurl: Use bb.fetch.encodeurl.

  • bb.decodeurl: Use bb.fetch.decodeurl

  • bb.mkdirhier: Use bb.utils.mkdirhier.

  • bb.movefile: Use bb.utils.movefile.

  • bb.copyfile: Use bb.utils.copyfile.

  • bb.which: Use bb.utils.which.

  • bb.vercmp_string: Use bb.utils.vercmp_string.

  • bb.vercmp: Use bb.utils.vercmp.

4.5.3.3 SVK Fetcher

The SVK fetcher has been removed from BitBake.

4.5.3.4 Console Output Error Redirection

The BitBake console UI will now output errors to stderr instead of stdout. Consequently, if you are piping or redirecting the output of bitbake to somewhere else, and you wish to retain the errors, you will need to add 2>&1 (or something similar) to the end of your bitbake command line.

4.5.3.5 task-taskname Overrides

task-taskname overrides have been adjusted so that tasks whose names contain underscores have the underscores replaced by hyphens for the override so that they now function properly. For example, the task override for do_populate_sdk is task-populate-sdk.

4.5.4 Changes to Variables

The following variables have changed. For information on the OpenEmbedded build system variables, see the “Variables Glossary” Chapter.

4.5.4.1 TMPDIR

TMPDIR can no longer be on an NFS mount. NFS does not offer full POSIX locking and inode consistency and can cause unexpected issues if used to store TMPDIR.

The check for this occurs on startup. If TMPDIR is detected on an NFS mount, an error occurs.

4.5.4.2 PRINC

The PRINC variable has been deprecated and triggers a warning if detected during a build. For PR increments on changes, use the PR service instead. You can find out more about this service in the “Working With a PR Service” section in the Yocto Project Development Tasks Manual.

4.5.4.3 IMAGE_TYPES

The “sum.jffs2” option for IMAGE_TYPES has been replaced by the “jffs2.sum” option, which fits the processing order.

4.5.4.4 COPY_LIC_MANIFEST

The COPY_LIC_MANIFEST variable must now be set to “1” rather than any value in order to enable it.

4.5.4.5 COPY_LIC_DIRS

The COPY_LIC_DIRS variable must now be set to “1” rather than any value in order to enable it.

4.5.4.6 PACKAGE_GROUP

The PACKAGE_GROUP variable has been renamed to FEATURE_PACKAGES to more accurately reflect its purpose. You can still use PACKAGE_GROUP but the OpenEmbedded build system produces a warning message when it encounters the variable.

4.5.4.7 Preprocess and Post Process Command Variable Behavior

The following variables now expect a semicolon separated list of functions to call and not arbitrary shell commands:

For migration purposes, you can simply wrap shell commands in a shell function and then call the function. Here is an example:

my_postprocess_function() {
   echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "
4.5.5 Package Test (ptest)

Package Tests (ptest) are built but not installed by default. For information on using Package Tests, see the “Testing Packages With ptest” section in the Yocto Project Development Tasks Manual. For information on the ptest class, see the “ptest.bbclass” section.

4.5.6 Build Changes

Separate build and source directories have been enabled by default for selected recipes where it is known to work (a whitelist) and for all recipes that inherit the cmake class. In future releases the autotools class will enable a separate build directory by default as well. Recipes building Autotools-based software that fails to build with a separate build directory should be changed to inherit from the autotools-brokensep class instead of the autotools or autotools_stageclasses.

4.5.7 qemu-native

qemu-native now builds without SDL-based graphical output support by default. The following additional lines are needed in your local.conf to enable it:

PACKAGECONFIG_pn-qemu-native = "sdl"
ASSUME_PROVIDED += "libsdl-native"

Note

The default local.conf contains these statements. Consequently, if you are building a headless system and using a default local.conf file, you will need comment these two lines out.

4.5.8 core-image-basic

core-image-basic has been renamed to core-image-full-cmdline.

In addition to core-image-basic being renamed, packagegroup-core-basic has been renamed to packagegroup-core-full-cmdline to match.

4.5.9 Licensing

The top-level LICENSE file has been changed to better describe the license of the various components of OpenEmbedded-Core (OE-Core). However, the licensing itself remains unchanged.

Normally, this change would not cause any side-effects. However, some recipes point to this file within LIC_FILES_CHKSUM (as ${COREBASE}/LICENSE) and thus the accompanying checksum must be changed from 3f40d7994397109285ec7b81fdeb3b58 to 4d92cd373abda3937c2bc47fbc49d690. A better alternative is to have LIC_FILES_CHKSUM point to a file describing the license that is distributed with the source that the recipe is building, if possible, rather than pointing to ${COREBASE}/LICENSE.

4.5.10 CFLAGS Options

The “-fpermissive” option has been removed from the default CFLAGS value. You need to take action on individual recipes that fail when building with this option. You need to either patch the recipes to fix the issues reported by the compiler, or you need to add “-fpermissive” to CFLAGS in the recipes.

4.5.11 Custom Image Output Types

Custom image output types, as selected using IMAGE_FSTYPES, must declare their dependencies on other image types (if any) using a new IMAGE_TYPEDEP variable.

4.5.12 Tasks

The do_package_write task has been removed. The task is no longer needed.

4.5.13 update-alternative Provider

The default update-alternatives provider has been changed from opkg to opkg-utils. This change resolves some troublesome circular dependencies. The runtime package has also been renamed from update-alternatives-cworth to update-alternatives-opkg.

4.5.14 virtclass Overrides

The virtclass overrides are now deprecated. Use the equivalent class overrides instead (e.g. virtclass-native becomes class-native.)

4.5.15 Removed and Renamed Recipes

The following recipes have been removed:

  • packagegroup-toolset-native - This recipe is largely unused.

  • linux-yocto-3.8 - Support for the Linux yocto 3.8 kernel has been dropped. Support for the 3.10 and 3.14 kernels have been added with the linux-yocto-3.10 and linux-yocto-3.14 recipes.

  • ocf-linux - This recipe has been functionally replaced using cryptodev-linux.

  • genext2fs - genext2fs is no longer used by the build system and is unmaintained upstream.

  • js - This provided an ancient version of Mozilla’s javascript engine that is no longer needed.

  • zaurusd - The recipe has been moved to the meta-handheld layer.

  • eglibc 2.17 - Replaced by the eglibc 2.19 recipe.

  • gcc 4.7.2 - Replaced by the now stable gcc 4.8.2.

  • external-sourcery-toolchain - this recipe is now maintained in the meta-sourcery layer.

  • linux-libc-headers-yocto 3.4+git - Now using version 3.10 of the linux-libc-headers by default.

  • meta-toolchain-gmae - This recipe is obsolete.

  • packagegroup-core-sdk-gmae - This recipe is obsolete.

  • packagegroup-core-standalone-gmae-sdk-target - This recipe is obsolete.

4.5.16 Removed Classes

The following classes have become obsolete and have been removed:

  • module_strip

  • pkg_metainfo

  • pkg_distribute

  • image-empty

4.5.17 Reference Board Support Packages (BSPs)

The following reference BSPs changes occurred:

  • The BeagleBoard (beagleboard) ARM reference hardware has been replaced by the BeagleBone (beaglebone) hardware.

  • The RouterStation Pro (routerstationpro) MIPS reference hardware has been replaced by the EdgeRouter Lite (edgerouter) hardware.

The previous reference BSPs for the beagleboard and routerstationpro machines are still available in a new meta-yocto-bsp-old layer in the Source Repositories at https://git.yoctoproject.org/cgit/cgit.cgi/meta-yocto-bsp-old/.

4.6 Moving to the Yocto Project 1.7 Release

This section provides migration information for moving to the Yocto Project 1.7 Release from the prior release.

4.6.1 Changes to Setting QEMU PACKAGECONFIG Options in local.conf

The QEMU recipe now uses a number of PACKAGECONFIG options to enable various optional features. The method used to set defaults for these options means that existing local.conf files will need to be be modified to append to PACKAGECONFIG for qemu-native and nativesdk-qemu instead of setting it. In other words, to enable graphical output for QEMU, you should now have these lines in local.conf:

PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
4.6.2 Minimum Git version

The minimum Git version required on the build host is now 1.7.8 because the --list option is now required by BitBake’s Git fetcher. As always, if your host distribution does not provide a version of Git that meets this requirement, you can use the buildtools-tarball that does. See the “Required Git, tar, Python and gcc Versions” section for more information.

4.6.3 Autotools Class Changes

The following autotools class changes occurred:

  • A separate build directory is now used by default: The autotools class has been changed to use a directory for building (B), which is separate from the source directory (S). This is commonly referred to as B != S, or an out-of-tree build.

    If the software being built is already capable of building in a directory separate from the source, you do not need to do anything. However, if the software is not capable of being built in this manner, you will need to either patch the software so that it can build separately, or you will need to change the recipe to inherit the autotools-brokensep class instead of the autotools or autotools_stage classes.

  • The --foreign option is no longer passed to automake when running autoconf: This option tells automake that a particular software package does not follow the GNU standards and therefore should not be expected to distribute certain files such as ChangeLog, AUTHORS, and so forth. Because the majority of upstream software packages already tell automake to enable foreign mode themselves, the option is mostly superfluous. However, some recipes will need patches for this change. You can easily make the change by patching configure.ac so that it passes “foreign” to AM_INIT_AUTOMAKE(). See this commit for an example showing how to make the patch.

4.6.4 Binary Configuration Scripts Disabled

Some of the core recipes that package binary configuration scripts now disable the scripts due to the scripts previously requiring error-prone path substitution. Software that links against these libraries using these scripts should use the much more robust pkg-config instead. The list of recipes changed in this version (and their configuration scripts) is as follows:

directfb (directfb-config)
freetype (freetype-config)
gpgme (gpgme-config)
libassuan (libassuan-config)
libcroco (croco-6.0-config)
libgcrypt (libgcrypt-config)
libgpg-error (gpg-error-config)
libksba (ksba-config)
libpcap (pcap-config)
libpcre (pcre-config)
libpng (libpng-config, libpng16-config)
libsdl (sdl-config)
libusb-compat (libusb-config)
libxml2 (xml2-config)
libxslt (xslt-config)
ncurses (ncurses-config)
neon (neon-config)
npth (npth-config)
pth (pth-config)
taglib (taglib-config)

Additionally, support for pkg-config has been added to some recipes in the previous list in the rare cases where the upstream software package does not already provide it.

4.6.5 eglibc 2.19 Replaced with glibc 2.20

Because eglibc and glibc were already fairly close, this replacement should not require any significant changes to other software that links to eglibc. However, there were a number of minor changes in glibc 2.20 upstream that could require patching some software (e.g. the removal of the _BSD_SOURCE feature test macro).

glibc 2.20 requires version 2.6.32 or greater of the Linux kernel. Thus, older kernels will no longer be usable in conjunction with it.

For full details on the changes in glibc 2.20, see the upstream release notes here.

4.6.6 Kernel Module Autoloading

The module_autoload_* variable is now deprecated and a new KERNEL_MODULE_AUTOLOAD variable should be used instead. Also, module_conf_* must now be used in conjunction with a new KERNEL_MODULE_PROBECONF variable. The new variables no longer require you to specify the module name as part of the variable name. This change not only simplifies usage but also allows the values of these variables to be appropriately incorporated into task signatures and thus trigger the appropriate tasks to re-execute when changed. You should replace any references to module_autoload_* with KERNEL_MODULE_AUTOLOAD, and add any modules for which module_conf_* is specified to KERNEL_MODULE_PROBECONF.

4.6.7 QA Check Changes

The following changes have occurred to the QA check process:

  • Additional QA checks file-rdeps and build-deps have been added in order to verify that file dependencies are satisfied (e.g. package contains a script requiring /bin/bash) and build-time dependencies are declared, respectively. For more information, please see the “QA Error and Warning Messages” chapter.

  • Package QA checks are now performed during a new do_package_qa task rather than being part of the do_package task. This allows more parallel execution. This change is unlikely to be an issue except for highly customized recipes that disable packaging tasks themselves by marking them as noexec. For those packages, you will need to disable the do_package_qa task as well.

  • Files being overwritten during the do_populate_sysroot task now trigger an error instead of a warning. Recipes should not be overwriting files written to the sysroot by other recipes. If you have these types of recipes, you need to alter them so that they do not overwrite these files.

    You might now receive this error after changes in configuration or metadata resulting in orphaned files being left in the sysroot. If you do receive this error, the way to resolve the issue is to delete your TMPDIR or to move it out of the way and then re-start the build. Anything that has been fully built up to that point and does not need rebuilding will be restored from the shared state cache and the rest of the build will be able to proceed as normal.

4.6.8 Removed Recipes

The following recipes have been removed:

  • x-load: This recipe has been superseded by U-boot SPL for all Cortex-based TI SoCs. For legacy boards, the meta-ti layer, which contains a maintained recipe, should be used instead.

  • ubootchart: This recipe is obsolete. A bootchart2 recipe has been added to functionally replace it.

  • linux-yocto 3.4: Support for the linux-yocto 3.4 kernel has been dropped. Support for the 3.10 and 3.14 kernels remains, while support for version 3.17 has been added.

  • eglibc has been removed in favor of glibc. See the “eglibc 2.19 Replaced with glibc 2.20” section for more information.

4.6.9 Miscellaneous Changes

The following miscellaneous change occurred:

  • The build history feature now writes build-id.txt instead of build-id. Additionally, build-id.txt now contains the full build header as printed by BitBake upon starting the build. You should manually remove old “build-id” files from your existing build history repositories to avoid confusion. For information on the build history feature, see the “Maintaining Build Output Quality” section in the Yocto Project Development Tasks Manual.

4.7 Moving to the Yocto Project 1.8 Release

This section provides migration information for moving to the Yocto Project 1.8 Release from the prior release.

4.7.1 Removed Recipes

The following recipes have been removed:

  • owl-video: Functionality replaced by gst-player.

  • gaku: Functionality replaced by gst-player.

  • gnome-desktop: This recipe is now available in meta-gnome and is no longer needed.

  • gsettings-desktop-schemas: This recipe is now available in meta-gnome and is no longer needed.

  • python-argparse: The argparse module is already provided in the default Python distribution in a package named python-argparse. Consequently, the separate python-argparse recipe is no longer needed.

  • telepathy-python, libtelepathy, telepathy-glib, telepathy-idle, telepathy-mission-control: All these recipes have moved to meta-oe and are consequently no longer needed by any recipes in OpenEmbedded-Core.

  • linux-yocto_3.10 and linux-yocto_3.17: Support for the linux-yocto 3.10 and 3.17 kernels has been dropped. Support for the 3.14 kernel remains, while support for 3.19 kernel has been added.

  • poky-feed-config-opkg: This recipe has become obsolete and is no longer needed. Use distro-feed-config from meta-oe instead.

  • libav 0.8.x: libav 9.x is now used.

  • sed-native: No longer needed. A working version of sed is expected to be provided by the host distribution.

4.7.2 BlueZ 4.x / 5.x Selection

Proper built-in support for selecting BlueZ 5.x in preference to the default of 4.x now exists. To use BlueZ 5.x, simply add “bluez5” to your DISTRO_FEATURES value. If you had previously added append files (*.bbappend) to make this selection, you can now remove them.

Additionally, a bluetooth class has been added to make selection of the appropriate bluetooth support within a recipe a little easier. If you wish to make use of this class in a recipe, add something such as the following:

inherit bluetooth
PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', '${BLUEZ}', '', d)}"
PACKAGECONFIG[bluez4] = "--enable-bluetooth,--disable-bluetooth,bluez4"
PACKAGECONFIG[bluez5] = "--enable-bluez5,--disable-bluez5,bluez5"
4.7.3 Kernel Build Changes

The kernel build process was changed to place the source in a common shared work area and to place build artifacts separately in the source code tree. In theory, migration paths have been provided for most common usages in kernel recipes but this might not work in all cases. In particular, users need to ensure that ${S} (source files) and ${B} (build artifacts) are used correctly in functions such as do_configure and do_install. For kernel recipes that do not inherit from kernel-yocto or include linux-yocto.inc, you might wish to refer to the linux.inc file in the meta-oe layer for the kinds of changes you need to make. For reference, here is the commit where the linux.inc file in meta-oe was updated.

Recipes that rely on the kernel source code and do not inherit the module classes might need to add explicit dependencies on the do_shared_workdir kernel task, for example:

do_configure[depends] += "virtual/kernel:do_shared_workdir"
4.7.4 SSL 3.0 is Now Disabled in OpenSSL

SSL 3.0 is now disabled when building OpenSSL. Disabling SSL 3.0 avoids any lingering instances of the POODLE vulnerability. If you feel you must re-enable SSL 3.0, then you can add an append file (*.bbappend) for the openssl recipe to remove “-no-ssl3” from EXTRA_OECONF.

4.7.5 Default Sysroot Poisoning

gcc's default sysroot and include directories are now “poisoned”. In other words, the sysroot and include directories are being redirected to a non-existent location in order to catch when host directories are being used due to the correct options not being passed. This poisoning applies both to the cross-compiler used within the build and to the cross-compiler produced in the SDK.

If this change causes something in the build to fail, it almost certainly means the various compiler flags and commands are not being passed correctly to the underlying piece of software. In such cases, you need to take corrective steps.

4.7.6 Rebuild Improvements

Changes have been made to the base, autotools, and cmake classes to clean out generated files when the do_configure task needs to be re-executed.

One of the improvements is to attempt to run “make clean” during the do_configure task if a Makefile exists. Some software packages do not provide a working clean target within their make files. If you have such recipes, you need to set CLEANBROKEN to “1” within the recipe, for example:

CLEANBROKEN = "1"
4.7.7 QA Check and Validation Changes

The following QA Check and Validation Changes have occurred:

  • Usage of PRINC previously triggered a warning. It now triggers an error. You should remove any remaining usage of PRINC in any recipe or append file.

  • An additional QA check has been added to detect usage of ${D} in FILES values where D values should not be used at all. The same check ensures that $D is used in pkg_preinst/pkg_postinst/pkg_prerm/pkg_postrm functions instead of ${D}.

  • S now needs to be set to a valid value within a recipe. If S is not set in the recipe, the directory is not automatically created. If S does not point to a directory that exists at the time the do_unpack task finishes, a warning will be shown.

  • LICENSE is now validated for correct formatting of multiple licenses. If the format is invalid (e.g. multiple licenses are specified with no operators to specify how the multiple licenses interact), then a warning will be shown.

4.7.8 Miscellaneous Changes

The following miscellaneous changes have occurred:

  • The send-error-report script now expects a “-s” option to be specified before the server address. This assumes a server address is being specified.

  • The oe-pkgdata-util script now expects a “-p” option to be specified before the pkgdata directory, which is now optional. If the pkgdata directory is not specified, the script will run BitBake to query PKGDATA_DIR from the build environment.

4.8 Moving to the Yocto Project 2.0 Release

This section provides migration information for moving to the Yocto Project 2.0 Release from the prior release.

4.8.1 GCC 5

The default compiler is now GCC 5.2. This change has required fixes for compilation errors in a number of other recipes.

One important example is a fix for when the Linux kernel freezes at boot time on ARM when built with GCC 5. If you are using your own kernel recipe or source tree and building for ARM, you will likely need to apply this patch. The standard linux-yocto kernel source tree already has a workaround for the same issue.

For further details, see https://gcc.gnu.org/gcc-5/changes.html and the porting guide at https://gcc.gnu.org/gcc-5/porting_to.html.

Alternatively, you can switch back to GCC 4.9 or 4.8 by setting GCCVERSION in your configuration, as follows:

GCCVERSION = "4.9%"
4.8.2 Gstreamer 0.10 Removed

Gstreamer 0.10 has been removed in favor of Gstreamer 1.x. As part of the change, recipes for Gstreamer 0.10 and related software are now located in meta-multimedia. This change results in Qt4 having Phonon and Gstreamer support in QtWebkit disabled by default.

4.8.3 Removed Recipes

The following recipes have been moved or removed:

  • bluez4: The recipe is obsolete and has been moved due to bluez5 becoming fully integrated. The bluez4 recipe now resides in meta-oe.

  • gamin: The recipe is obsolete and has been removed.

  • gnome-icon-theme: The recipe’s functionally has been replaced by adwaita-icon-theme.

  • Gstreamer 0.10 Recipes: Recipes for Gstreamer 0.10 have been removed in favor of the recipes for Gstreamer 1.x.

  • insserv: The recipe is obsolete and has been removed.

  • libunique: The recipe is no longer used and has been moved to meta-oe.

  • midori: The recipe’s functionally has been replaced by epiphany.

  • python-gst: The recipe is obsolete and has been removed since it only contains bindings for Gstreamer 0.10.

  • qt-mobility: The recipe is obsolete and has been removed since it requires Gstreamer 0.10, which has been replaced.

  • subversion: All 1.6.x versions of this recipe have been removed.

  • webkit-gtk: The older 1.8.3 version of this recipe has been removed in favor of webkitgtk.

4.8.4 BitBake datastore improvements

The method by which BitBake’s datastore handles overrides has changed. Overrides are now applied dynamically and bb.data.update_data() is now a no-op. Thus, bb.data.update_data() is no longer required in order to apply the correct overrides. In practice, this change is unlikely to require any changes to Metadata. However, these minor changes in behavior exist:

  • All potential overrides are now visible in the variable history as seen when you run the following:

    $ bitbake -e
    
  • d.delVar('VARNAME') and d.setVar('VARNAME', None) result in the variable and all of its overrides being cleared out. Before the change, only the non-overridden values were cleared.

4.8.5 Shell Message Function Changes

The shell versions of the BitBake message functions (i.e. bbdebug, bbnote, bbwarn, bbplain, bberror, and bbfatal) are now connected through to their BitBake equivalents bb.debug(), bb.note(), bb.warn(), bb.plain(), bb.error(), and bb.fatal(), respectively. Thus, those message functions that you would expect to be printed by the BitBake UI are now actually printed. In practice, this change means two things:

  • If you now see messages on the console that you did not previously see as a result of this change, you might need to clean up the calls to bbwarn, bberror, and so forth. Or, you might want to simply remove the calls.

  • The bbfatal message function now suppresses the full error log in the UI, which means any calls to bbfatal where you still wish to see the full error log should be replaced by die or bbfatal_log.

4.8.6 Extra Development/Debug Package Cleanup

The following recipes have had extra dev/dbg packages removed:

  • acl

  • apmd

  • aspell

  • attr

  • augeas

  • bzip2

  • cogl

  • curl

  • elfutils

  • gcc-target

  • libgcc

  • libtool

  • libxmu

  • opkg

  • pciutils

  • rpm

  • sysfsutils

  • tiff

  • xz

All of the above recipes now conform to the standard packaging scheme where a single -dev, -dbg, and -staticdev package exists per recipe.

4.8.7 Recipe Maintenance Tracking Data Moved to OE-Core

Maintenance tracking data for recipes that was previously part of meta-yocto has been moved to OpenEmbedded-Core (OE-Core). The change includes package_regex.inc and distro_alias.inc, which are typically enabled when using the distrodata class. Additionally, the contents of upstream_tracking.inc has now been split out to the relevant recipes.

4.8.8 Automatic Stale Sysroot File Cleanup

Stale files from recipes that no longer exist in the current configuration are now automatically removed from sysroot as well as removed from any other place managed by shared state. This automatic cleanup means that the build system now properly handles situations such as renaming the build system side of recipes, removal of layers from bblayers.conf, and DISTRO_FEATURES changes.

Additionally, work directories for old versions of recipes are now pruned. If you wish to disable pruning old work directories, you can set the following variable in your configuration:

SSTATE_PRUNE_OBSOLETEWORKDIR = "0"
4.8.9 linux-yocto Kernel Metadata Repository Now Split from Source

The linux-yocto tree has up to now been a combined set of kernel changes and configuration (meta) data carried in a single tree. While this format is effective at keeping kernel configuration and source modifications synchronized, it is not always obvious to developers how to manipulate the Metadata as compared to the source.

Metadata processing has now been removed from the kernel-yocto class and the external Metadata repository yocto-kernel-cache, which has always been used to seed the linux-yocto “meta” branch. This separate linux-yocto cache repository is now the primary location for this data. Due to this change, linux-yocto is no longer able to process combined trees. Thus, if you need to have your own combined kernel repository, you must do the split there as well and update your recipes accordingly. See the meta/recipes-kernel/linux/linux-yocto_4.1.bb recipe for an example.

4.8.10 Additional QA checks

The following QA checks have been added:

  • Added a “host-user-contaminated” check for ownership issues for packaged files outside of /home. The check looks for files that are incorrectly owned by the user that ran BitBake instead of owned by a valid user in the target system.

  • Added an “invalid-chars” check for invalid (non-UTF8) characters in recipe metadata variable values (i.e. DESCRIPTION, SUMMARY, LICENSE, and SECTION). Some package managers do not support these characters.

  • Added an “invalid-packageconfig” check for any options specified in PACKAGECONFIG that do not match any PACKAGECONFIG option defined for the recipe.

4.8.11 Miscellaneous Changes

These additional changes exist:

  • gtk-update-icon-cache has been renamed to gtk-icon-utils.

  • The tools-profile IMAGE_FEATURES item as well as its corresponding packagegroup and packagegroup-core-tools-profile no longer bring in oprofile. Bringing in oprofile was originally added to aid compilation on resource-constrained targets. However, this aid has not been widely used and is not likely to be used going forward due to the more powerful target platforms and the existence of better cross-compilation tools.

  • The IMAGE_FSTYPES variable’s default value now specifies ext4 instead of ext3.

  • All support for the PRINC variable has been removed.

  • The packagegroup-core-full-cmdline packagegroup no longer brings in lighttpd due to the fact that bringing in lighttpd is not really in line with the packagegroup’s purpose, which is to add full versions of command-line tools that by default are provided by busybox.

4.9 Moving to the Yocto Project 2.1 Release

This section provides migration information for moving to the Yocto Project 2.1 Release from the prior release.

4.9.1 Variable Expansion in Python Functions

Variable expressions, such as ${VARNAME} no longer expand automatically within Python functions. Suppressing expansion was done to allow Python functions to construct shell scripts or other code for situations in which you do not want such expressions expanded. For any existing code that relies on these expansions, you need to change the expansions to expand the value of individual variables through d.getVar(). To alternatively expand more complex expressions, use d.expand().

4.9.2 Overrides Must Now be Lower-Case

The convention for overrides has always been for them to be lower-case characters. This practice is now a requirement as BitBake’s datastore now assumes lower-case characters in order to give a slight performance boost during parsing. In practical terms, this requirement means that anything that ends up in OVERRIDES must now appear in lower-case characters (e.g. values for MACHINE, TARGET_ARCH, DISTRO, and also recipe names if _pn-recipename overrides are to be effective).

4.9.3 Expand Parameter to getVar() and getVarFlag() is Now Mandatory

The expand parameter to getVar() and getVarFlag() previously defaulted to False if not specified. Now, however, no default exists so one must be specified. You must change any getVar() calls that do not specify the final expand parameter to calls that do specify the parameter. You can run the following sed command at the base of a layer to make this change:

sed -e 's:\(\.getVar([^,()]*\)):\1, False):g' -i `grep -ril getVar *`
sed -e 's:\(\.getVarFlag([^,()]*,[^,()]*\)):\1, False):g' -i `grep -ril getVarFlag *`

Note

The reason for this change is that it prepares the way for changing the default to True in a future Yocto Project release. This future change is a much more sensible default than False. However, the change needs to be made gradually as a sudden change of the default would potentially cause side-effects that would be difficult to detect.

4.9.4 Makefile Environment Changes

EXTRA_OEMAKE now defaults to “” instead of “-e MAKEFLAGS=”. Setting EXTRA_OEMAKE to “-e MAKEFLAGS=” by default was a historical accident that has required many classes (e.g. autotools, module) and recipes to override this default in order to work with sensible build systems. When upgrading to the release, you must edit any recipe that relies upon this old default by either setting EXTRA_OEMAKE back to “-e MAKEFLAGS=” or by explicitly setting any required variable value overrides using EXTRA_OEMAKE, which is typically only needed when a Makefile sets a default value for a variable that is inappropriate for cross-compilation using the “=” operator rather than the “?=” operator.

4.9.5 libexecdir Reverted to ${prefix}/libexec

The use of ${libdir}/${BPN} as libexecdir is different as compared to all other mainstream distributions, which either uses ${prefix}/libexec or ${libdir}. The use is also contrary to the GNU Coding Standards (i.e. https://www.gnu.org/prep/standards/html_node/Directory-Variables.html) that suggest ${prefix}/libexec and also notes that any package-specific nesting should be done by the package itself. Finally, having libexecdir change between recipes makes it very difficult for different recipes to invoke binaries that have been installed into libexecdir. The Filesystem Hierarchy Standard (i.e. http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html) now recognizes the use of ${prefix}/libexec/, giving distributions the choice between ${prefix}/lib or ${prefix}/libexec without breaking FHS.

4.9.6 ac_cv_sizeof_off_t is No Longer Cached in Site Files

For recipes inheriting the autotools class, ac_cv_sizeof_off_t is no longer cached in the site files for autoconf. The reason for this change is because the ac_cv_sizeof_off_t value is not necessarily static per architecture as was previously assumed. Rather, the value changes based on whether large file support is enabled. For most software that uses autoconf, this change should not be a problem. However, if you have a recipe that bypasses the standard do_configure task from the autotools class and the software the recipe is building uses a very old version of autoconf, the recipe might be incapable of determining the correct size of off_t during do_configure.

The best course of action is to patch the software as necessary to allow the default implementation from the autotools class to work such that autoreconf succeeds and produces a working configure script, and to remove the overridden do_configure task such that the default implementation does get used.

4.9.7 Image Generation is Now Split Out from Filesystem Generation

Previously, for image recipes the do_rootfs task assembled the filesystem and then from that filesystem generated images. With this Yocto Project release, image generation is split into separate do_image tasks for clarity both in operation and in the code.

For most cases, this change does not present any problems. However, if you have made customizations that directly modify the do_rootfs task or that mention do_rootfs, you might need to update those changes. In particular, if you had added any tasks after do_rootfs, you should make edits so that those tasks are after the do_image_complete task rather than after do_rootfs so that the your added tasks run at the correct time.

A minor part of this restructuring is that the post-processing definitions and functions have been moved from the image class to the rootfs-postcommands class. Functionally, however, they remain unchanged.

4.9.8 Removed Recipes

The following recipes have been removed in the 2.1 release:

  • gcc version 4.8: Versions 4.9 and 5.3 remain.

  • qt4: All support for Qt 4.x has been moved out to a separate meta-qt4 layer because Qt 4 is no longer supported upstream.

  • x11vnc: Moved to the meta-oe layer.

  • linux-yocto-3.14: No longer supported.

  • linux-yocto-3.19: No longer supported.

  • libjpeg: Replaced by the libjpeg-turbo recipe.

  • pth: Became obsolete.

  • liboil: Recipe is no longer needed and has been moved to the meta-multimedia layer.

  • gtk-theme-torturer: Recipe is no longer needed and has been moved to the meta-gnome layer.

  • gnome-mime-data: Recipe is no longer needed and has been moved to the meta-gnome layer.

  • udev: Replaced by the eudev recipe for compatibility when using sysvinit with newer kernels.

  • python-pygtk: Recipe became obsolete.

  • adt-installer: Recipe became obsolete. See the “ADT Removed” section for more information.

4.9.9 Class Changes

The following classes have changed:

  • autotools_stage: Removed because the autotools class now provides its functionality. Recipes that inherited from autotools_stage should now inherit from autotools instead.

  • boot-directdisk: Merged into the image-vm class. The boot-directdisk class was rarely directly used. Consequently, this change should not cause any issues.

  • bootimg: Merged into the image-live class. The bootimg class was rarely directly used. Consequently, this change should not cause any issues.

  • packageinfo: Removed due to its limited use by the Hob UI, which has itself been removed.

4.9.10 Build System User Interface Changes

The following changes have been made to the build system user interface:

  • Hob GTK+-based UI: Removed because it is unmaintained and based on the outdated GTK+ 2 library. The Toaster web-based UI is much more capable and is actively maintained. See the “Using the Toaster Web Interface” section in the Toaster User Manual for more information on this interface.

  • “puccho” BitBake UI: Removed because is unmaintained and no longer useful.

4.9.11 ADT Removed

The Application Development Toolkit (ADT) has been removed because its functionality almost completely overlapped with the standard SDK and the extensible SDK. For information on these SDKs and how to build and use them, see the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.

Note

The Yocto Project Eclipse IDE Plug-in is still supported and is not affected by this change.

4.9.12 Poky Reference Distribution Changes

The following changes have been made for the Poky distribution:

  • The meta-yocto layer has been renamed to meta-poky to better match its purpose, which is to provide the Poky reference distribution. The meta-yocto-bsp layer retains its original name since it provides reference machines for the Yocto Project and it is otherwise unrelated to Poky. References to meta-yocto in your conf/bblayers.conf should automatically be updated, so you should not need to change anything unless you are relying on this naming elsewhere.

  • The uninative class is now enabled by default in Poky. This class attempts to isolate the build system from the host distribution’s C library and makes 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.

    The uninative class is enabled through the meta/conf/distro/include/yocto-uninative.inc file, which for those not using the Poky distribution, can include to easily enable the same functionality.

    Alternatively, if you wish to build your own uninative tarball, you can do so by building the uninative-tarball recipe, making it available to your build machines (e.g. over HTTP/HTTPS) and setting a similar configuration as the one set by yocto-uninative.inc.

  • Static library generation, for most cases, is now disabled by default in the Poky distribution. Disabling this generation saves some build time as well as the size used for build output artifacts.

    Disabling this library generation is accomplished through a meta/conf/distro/include/no-static-libs.inc, which for those not using the Poky distribution can easily include to enable the same functionality.

    Any recipe that needs to opt-out of having the “–disable-static” option specified on the configure command line either because it is not a supported option for the configure script or because static libraries are needed should set the following variable:

    DISABLE_STATIC = ""
    
  • The separate poky-tiny distribution now uses the musl C library instead of a heavily pared down glibc. Using musl results in a smaller distribution and facilitates much greater maintainability because musl is designed to have a small footprint.

    If you have used poky-tiny and have customized the glibc configuration you will need to redo those customizations with musl when upgrading to the new release.

4.9.13 Packaging Changes

The following changes have been made to packaging:

  • The runuser and mountpoint binaries, which were previously in the main util-linux package, have been split out into the util-linux-runuser and util-linux-mountpoint packages, respectively.

  • The python-elementtree package has been merged into the python-xml package.

4.9.14 Tuning File Changes

The following changes have been made to the tuning files:

  • The “no-thumb-interwork” tuning feature has been dropped from the ARM tune include files. Because interworking is required for ARM EABI, attempting to disable it through a tuning feature no longer makes sense.

    Note

    Support for ARM OABI was deprecated in gcc 4.7.

  • The tune-cortexm*.inc and tune-cortexr4.inc files have been removed because they are poorly tested. Until the OpenEmbedded build system officially gains support for CPUs without an MMU, these tuning files would probably be better maintained in a separate layer if needed.

4.9.15 Supporting GObject Introspection

This release supports generation of GLib Introspective Repository (GIR) files through GObject introspection, which is the standard mechanism for accessing GObject-based software from runtime environments. You can enable, disable, and test the generation of this data. See the “Enabling GObject Introspection Support” section in the Yocto Project Development Tasks Manual for more information.

4.9.16 Miscellaneous Changes

These additional changes exist:

  • The minimum Git version has been increased to 1.8.3.1. If your host distribution does not provide a sufficiently recent version, you can install the buildtools, which will provide it. See the Required Git, tar, Python and gcc Versions section for more information on the buildtools tarball.

  • The buggy and incomplete support for the RPM version 4 package manager has been removed. The well-tested and maintained support for RPM version 5 remains.

  • Previously, the following list of packages were removed if package-management was not in IMAGE_FEATURES, regardless of any dependencies:

    update-rc.d
    base-passwd
    shadow
    update-alternatives
    run-postinsts
    

    With the Yocto Project 2.1 release, these packages are only removed if “read-only-rootfs” is in IMAGE_FEATURES, since they might still be needed for a read-write image even in the absence of a package manager (e.g. if users need to be added, modified, or removed at runtime).

  • The devtool modify command now defaults to extracting the source since that is most commonly expected. The “-x” or “–extract” options are now no-ops. If you wish to provide your own existing source tree, you will now need to specify either the “-n” or “–no-extract” options when running devtool modify.

  • If the formfactor for a machine is either not supplied or does not specify whether a keyboard is attached, then the default is to assume a keyboard is attached rather than assume no keyboard. This change primarily affects the Sato UI.

  • The .debug directory packaging is now automatic. If your recipe builds software that installs binaries into directories other than the standard ones, you no longer need to take care of setting FILES_${PN}-dbg to pick up the resulting .debug directories as these directories are automatically found and added.

  • Inaccurate disk and CPU percentage data has been dropped from buildstats output. This data has been replaced with getrusage() data and corrected IO statistics. You will probably need to update any custom code that reads the buildstats data.

  • The meta/conf/distro/include/package_regex.inc is now deprecated. The contents of this file have been moved to individual recipes.

    Note

    Because this file will likely be removed in a future Yocto Project release, it is suggested that you remove any references to the file that might be in your configuration.

  • The v86d/uvesafb has been removed from the genericx86 and genericx86-64 reference machines, which are provided by the meta-yocto-bsp layer. Most modern x86 boards do not rely on this file and it only adds kernel error messages during startup. If you do still need to support uvesafb, you can simply add v86d to your image.

  • Build sysroot paths are now removed from debug symbol files. Removing these paths means that remote GDB using an unstripped build system sysroot will no longer work (although this was never documented to work). The supported method to accomplish something similar is to set IMAGE_GEN_DEBUGFS to “1”, which will generate a companion debug image containing unstripped binaries and associated debug sources alongside the image.

4.10 Moving to the Yocto Project 2.2 Release

This section provides migration information for moving to the Yocto Project 2.2 Release from the prior release.

4.10.1 Minimum Kernel Version

The minimum kernel version for the target system and for SDK is now 3.2.0, due to the upgrade to glibc 2.24. Specifically, for AArch64-based targets the version is 3.14. For Nios II-based targets, the minimum kernel version is 3.19.

Note

For x86 and x86_64, you can reset OLDEST_KERNEL to anything down to 2.6.32 if desired.

4.10.2 Staging Directories in Sysroot Has Been Simplified

The way directories are staged in sysroot has been simplified and introduces the new SYSROOT_DIRS, SYSROOT_DIRS_NATIVE, and SYSROOT_DIRS_BLACKLIST. See the v2 patch series on the OE-Core Mailing List for additional information.

4.10.3 Removal of Old Images and Other Files in tmp/deploy Now Enabled

Removal of old images and other files in tmp/deploy/ is now enabled by default due to a new staging method used for those files. As a result of this change, the RM_OLD_IMAGE variable is now redundant.

4.10.4 Python Changes

The following changes for Python occurred:

4.10.4.1 BitBake Now Requires Python 3.4+

BitBake requires Python 3.4 or greater.

4.10.4.2 UTF-8 Locale Required on Build Host

A UTF-8 locale is required on the build host due to Python 3. Since C.UTF-8 is not a standard, the default is en_US.UTF-8.

4.10.4.3 Metadata Must Now Use Python 3 Syntax

The metadata is now required to use Python 3 syntax. For help preparing metadata, see any of the many Python 3 porting guides available. Alternatively, you can reference the conversion commits for Bitbake and you can use OpenEmbedded-Core (OE-Core) as a guide for changes. Following are particular areas of interest:

  • subprocess command-line pipes needing locale decoding

  • the syntax for octal values changed

  • the iter*() functions changed name

  • iterators now return views, not lists

  • changed names for Python modules

4.10.4.4 Target Python Recipes Switched to Python 3

Most target Python recipes have now been switched to Python 3. Unfortunately, systems using RPM as a package manager and providing online package-manager support through SMART still require Python 2.

Note

Python 2 and recipes that use it can still be built for the target as with previous versions.

4.10.4.5 buildtools-tarball Includes Python 3

buildtools-tarball now includes Python 3.

4.10.5 uClibc Replaced by musl

uClibc has been removed in favor of musl. Musl has matured, is better maintained, and is compatible with a wider range of applications as compared to uClibc.

4.10.6 ${B} No Longer Default Working Directory for Tasks

${B} is no longer the default working directory for tasks. Consequently, any custom tasks you define now need to either have the [dirs] flag set, or the task needs to change into the appropriate working directory manually (e.g using cd for a shell task).

Note

The preferred method is to use the [dirs] flag.

4.10.7 runqemu Ported to Python

runqemu has been ported to Python and has changed behavior in some cases. Previous usage patterns continue to be supported.

The new runqemu is a Python script. Machine knowledge is no longer hardcoded into runqemu. You can choose to use the qemuboot configuration file to define the BSP’s own arguments and to make it bootable with runqemu. If you use a configuration file, use the following form:

image-name-machine.qemuboot.conf

The configuration file enables fine-grained tuning of options passed to QEMU without the runqemu script hard-coding any knowledge about different machines. Using a configuration file is particularly convenient when trying to use QEMU with machines other than the qemu* machines in OpenEmbedded-Core (OE-Core). The qemuboot.conf file is generated by the qemuboot class when the root filesystem is being build (i.e. build rootfs). QEMU boot arguments can be set in BSP’s configuration file and the qemuboot class will save them to qemuboot.conf.

If you want to use runqemu without a configuration file, use the following command form:

$ runqemu machine rootfs kernel [options]

Supported machines are as follows:

  • qemuarm

  • qemuarm64

  • qemux86

  • qemux86-64

  • qemuppc

  • qemumips

  • qemumips64

  • qemumipsel

  • qemumips64el

Consider the following example, which uses the qemux86-64 machine, provides a root filesystem, provides an image, and uses the nographic option:

$ runqemu qemux86-64 tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.ext4 tmp/deploy/images/qemux86-64/bzImage nographic

Following is a list of variables that can be set in configuration files such as bsp.conf to enable the BSP to be booted by runqemu:

Note

“QB” means “QEMU Boot”.

QB_SYSTEM_NAME: QEMU name (e.g. "qemu-system-i386")
QB_OPT_APPEND: Options to append to QEMU (e.g. "-show-cursor")
QB_DEFAULT_KERNEL: Default kernel to boot (e.g. "bzImage")
QB_DEFAULT_FSTYPE: Default FSTYPE to boot (e.g. "ext4")
QB_MEM: Memory (e.g. "-m 512")
QB_MACHINE: QEMU machine (e.g. "-machine virt")
QB_CPU: QEMU cpu (e.g. "-cpu qemu32")
QB_CPU_KVM: Similar to QB_CPU except used for kvm support (e.g. "-cpu kvm64")
QB_KERNEL_CMDLINE_APPEND: Options to append to the kernel's -append
                          option (e.g. "console=ttyS0 console=tty")
QB_DTB: QEMU dtb name
QB_AUDIO_DRV: QEMU audio driver (e.g. "alsa", set it when support audio)
QB_AUDIO_OPT: QEMU audio option (e.g. "-soundhw ac97,es1370"), which is used
              when QB_AUDIO_DRV is set.
QB_KERNEL_ROOT: Kernel's root (e.g. /dev/vda)
QB_TAP_OPT: Network option for 'tap' mode (e.g.
            "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no -device virtio-net-device,netdev=net0").
             runqemu will replace "@TAP@" with the one that is used, such as tap0, tap1 ...
QB_SLIRP_OPT: Network option for SLIRP mode (e.g. "-netdev user,id=net0 -device virtio-net-device,netdev=net0")
QB_ROOTFS_OPT: Used as rootfs (e.g.
               "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0").
               runqemu will replace "@ROOTFS@" with the one which is used, such as
               core-image-minimal-qemuarm64.ext4.
QB_SERIAL_OPT: Serial port (e.g. "-serial mon:stdio")
QB_TCPSERIAL_OPT: tcp serial port option (e.g.
                  " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device      virtconsole,chardev=virtcon"
                  runqemu will replace "@PORT@" with the port number which is used.

To use runqemu, set IMAGE_CLASSES as follows and run runqemu:

Note

For command-line syntax, use runqemu help.

IMAGE_CLASSES += "qemuboot"
4.10.8 Default Linker Hash Style Changed

The default linker hash style for gcc-cross is now “sysv” in order to catch recipes that are building software without using the OpenEmbedded LDFLAGS. This change could result in seeing some “No GNU_HASH in the elf binary” QA issues when building such recipes. You need to fix these recipes so that they use the expected LDFLAGS. Depending on how the software is built, the build system used by the software (e.g. a Makefile) might need to be patched. However, sometimes making this fix is as simple as adding the following to the recipe:

TARGET_CC_ARCH += "${LDFLAGS}"
4.10.9 KERNEL_IMAGE_BASE_NAME no Longer Uses KERNEL_IMAGETYPE

The KERNEL_IMAGE_BASE_NAME variable no longer uses the KERNEL_IMAGETYPE variable to create the image’s base name. Because the OpenEmbedded build system can now build multiple kernel image types, this part of the kernel image base name as been removed leaving only the following:

KERNEL_IMAGE_BASE_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"

If you have recipes or classes that use KERNEL_IMAGE_BASE_NAME directly, you might need to update the references to ensure they continue to work.

4.10.10 BitBake Changes

The following changes took place for BitBake:

  • The “goggle” UI and standalone image-writer tool have been removed as they both require GTK+ 2.0 and were not being maintained.

  • The Perforce fetcher now supports SRCREV for specifying the source revision to use, be it ${AUTOREV}, changelist number, p4date, or label, in preference to separate SRC_URI parameters to specify these. This change is more in-line with how the other fetchers work for source control systems. Recipes that fetch from Perforce will need to be updated to use SRCREV in place of specifying the source revision within SRC_URI.

  • Some of BitBake’s internal code structures for accessing the recipe cache needed to be changed to support the new multi-configuration functionality. These changes will affect external tools that use BitBake’s tinfoil module. For information on these changes, see the changes made to the scripts supplied with OpenEmbedded-Core: 1 and 2.

  • The task management code has been rewritten to avoid using ID indirection in order to improve performance. This change is unlikely to cause any problems for most users. However, the setscene verification function as pointed to by BB_SETSCENE_VERIFY_FUNCTION needed to change signature. Consequently, a new variable named BB_SETSCENE_VERIFY_FUNCTION2 has been added allowing multiple versions of BitBake to work with suitably written metadata, which includes OpenEmbedded-Core and Poky. Anyone with custom BitBake task scheduler code might also need to update the code to handle the new structure.

4.10.11 Swabber has Been Removed

Swabber, a tool that was intended to detect host contamination in the build process, has been removed, as it has been unmaintained and unused for some time and was never particularly effective. The OpenEmbedded build system has since incorporated a number of mechanisms including enhanced QA checks that mean that there is less of a need for such a tool.

4.10.12 Removed Recipes

The following recipes have been removed:

  • augeas: No longer needed and has been moved to meta-oe.

  • directfb: Unmaintained and has been moved to meta-oe.

  • gcc: Removed 4.9 version. Versions 5.4 and 6.2 are still present.

  • gnome-doc-utils: No longer needed.

  • gtk-doc-stub: Replaced by gtk-doc.

  • gtk-engines: No longer needed and has been moved to meta-gnome.

  • gtk-sato-engine: Became obsolete.

  • libglade: No longer needed and has been moved to meta-oe.

  • libmad: Unmaintained and functionally replaced by libmpg123. libmad has been moved to meta-oe.

  • libowl: Became obsolete.

  • libxsettings-client: No longer needed.

  • oh-puzzles: Functionally replaced by puzzles.

  • oprofileui: Became obsolete. OProfile has been largely supplanted by perf.

  • packagegroup-core-directfb.bb: Removed.

  • core-image-directfb.bb: Removed.

  • pointercal: No longer needed and has been moved to meta-oe.

  • python-imaging: No longer needed and moved to meta-python

  • python-pyrex: No longer needed and moved to meta-python.

  • sato-icon-theme: Became obsolete.

  • swabber-native: Swabber has been removed. See the entry on Swabber.

  • tslib: No longer needed and has been moved to meta-oe.

  • uclibc: Removed in favor of musl.

  • xtscal: No longer needed and moved to meta-oe

4.10.13 Removed Classes

The following classes have been removed:

  • distutils-native-base: No longer needed.

  • distutils3-native-base: No longer needed.

  • sdl: Only set DEPENDS and SECTION, which are better set within the recipe instead.

  • sip: Mostly unused.

  • swabber: See the entry on Swabber.

4.10.14 Minor Packaging Changes

The following minor packaging changes have occurred:

  • grub: Split grub-editenv into its own package.

  • systemd: Split container and vm related units into a new package, systemd-container.

  • util-linux: Moved prlimit to a separate util-linux-prlimit package.

4.10.15 Miscellaneous Changes

The following miscellaneous changes have occurred:

  • package_regex.inc: Removed because the definitions package_regex.inc previously contained have been moved to their respective recipes.

  • Both devtool add and recipetool create now use a fixed SRCREV by default when fetching from a Git repository. You can override this in either case to use ${AUTOREV} instead by using the -a or DASHDASHautorev command-line option

  • distcc: GTK+ UI is now disabled by default.

  • packagegroup-core-tools-testapps: Removed Piglit.

  • image.bbclass: Renamed COMPRESS(ION) to CONVERSION. This change means that COMPRESSIONTYPES, COMPRESS_DEPENDS and COMPRESS_CMD are deprecated in favor of CONVERSIONTYPES, CONVERSION_DEPENDS and CONVERSION_CMD. The COMPRESS* variable names will still work in the 2.2 release but metadata that does not need to be backwards-compatible should be changed to use the new names as the COMPRESS* ones will be removed in a future release.

  • gtk-doc: A full version of gtk-doc is now made available. However, some old software might not be capable of using the current version of gtk-doc to build documentation. You need to change recipes that build such software so that they explicitly disable building documentation with gtk-doc.

4.11 Moving to the Yocto Project 2.3 Release

This section provides migration information for moving to the Yocto Project 2.3 Release from the prior release.

4.11.1 Recipe-specific Sysroots

The OpenEmbedded build system now uses one sysroot per recipe to resolve long-standing issues with configuration script auto-detection of undeclared dependencies. Consequently, you might find that some of your previously written custom recipes are missing declared dependencies, particularly those dependencies that are incidentally built earlier in a typical build process and thus are already likely to be present in the shared sysroot in previous releases.

Consider the following:

  • Declare Build-Time Dependencies: Because of this new feature, you must explicitly declare all build-time dependencies for your recipe. If you do not declare these dependencies, they are not populated into the sysroot for the recipe.

  • Specify Pre-Installation and Post-Installation Native Tool Dependencies: You must specifically specify any special native tool dependencies of pkg_preinst and pkg_postinst scripts by using the PACKAGE_WRITE_DEPS variable. Specifying these dependencies ensures that these tools are available if these scripts need to be run on the build host during the do_rootfs task.

    As an example, see the dbus recipe. You will see that this recipe has a pkg_postinst that calls systemctl if “systemd” is in DISTRO_FEATURES. In the example, systemd-systemctl-native is added to PACKAGE_WRITE_DEPS, which is also conditional on “systemd” being in DISTRO_FEATURES.

  • Examine Recipes that Use SSTATEPOSTINSTFUNCS: You need to examine any recipe that uses SSTATEPOSTINSTFUNCS and determine steps to take.

    Functions added to SSTATEPOSTINSTFUNCS are still called as they were in previous Yocto Project releases. However, since a separate sysroot is now being populated for every recipe and if existing functions being called through SSTATEPOSTINSTFUNCS are doing relocation, then you will need to change these to use a post-installation script that is installed by a function added to SYSROOT_PREPROCESS_FUNCS.

    For an example, see the pixbufcache class in meta/classes/ in the Yocto Project Source Repositories.

    Note

    The SSTATEPOSTINSTFUNCS variable itself is now deprecated in favor of the do_populate_sysroot[postfuncs] task. Consequently, if you do still have any function or functions that need to be called after the sysroot component is created for a recipe, then you would be well advised to take steps to use a post installation script as described previously. Taking these steps prepares your code for when SSTATEPOSTINSTFUNCS is removed in a future Yocto Project release.

  • Specify the Sysroot when Using Certain External Scripts: Because the shared sysroot is now gone, the scripts oe-find-native-sysroot and oe-run-native have been changed such that you need to specify which recipe’s STAGING_DIR_NATIVE is used.

Note

You can find more information on how recipe-specific sysroots work in the “staging.bbclass” section.

4.11.2 PATH Variable

Within the environment used to run build tasks, the environment variable PATH is now sanitized such that the normal native binary paths (/bin, /sbin, /usr/bin and so forth) are removed and a directory containing symbolic links linking only to the binaries from the host mentioned in the HOSTTOOLS and HOSTTOOLS_NONFATAL variables is added to PATH.

Consequently, any native binaries provided by the host that you need to call needs to be in one of these two variables at the configuration level.

Alternatively, you can add a native recipe (i.e. -native) that provides the binary to the recipe’s DEPENDS value.

Note

PATH is not sanitized in the same way within devshell. If it were, you would have difficulty running host tools for development and debugging within the shell.

4.11.3 Changes to Scripts

The following changes to scripts took place:

  • oe-find-native-sysroot: The usage for the oe-find-native-sysroot script has changed to the following:

    $ . oe-find-native-sysroot recipe
    

    You must now supply a recipe for recipe as part of the command. Prior to the Yocto Project 2.3 release, it was not necessary to provide the script with the command.

  • oe-run-native: The usage for the oe-run-native script has changed to the following:

    $ oe-run-native native_recipe tool
    

    You must supply the name of the native recipe and the tool you want to run as part of the command. Prior to the Yocto Project 2.3 release, it was not necessary to provide the native recipe with the command.

  • cleanup-workdir: The cleanup-workdir script has been removed because the script was found to be deleting files it should not have, which lead to broken build trees. Rather than trying to delete portions of TMPDIR and getting it wrong, it is recommended that you delete TMPDIR and have it restored from shared state (sstate) on subsequent builds.

  • wipe-sysroot: The wipe-sysroot script has been removed as it is no longer needed with recipe-specific sysroots.

4.11.4 Changes to Functions

The previously deprecated bb.data.getVar(), bb.data.setVar(), and related functions have been removed in favor of d.getVar(), d.setVar(), and so forth.

You need to fix any references to these old functions.

4.11.5 BitBake Changes

The following changes took place for BitBake:

  • BitBake’s Graphical Dependency Explorer UI Replaced: BitBake’s graphical dependency explorer UI depexp was replaced by taskexp (“Task Explorer”), which provides a graphical way of exploring the task-depends.dot file. The data presented by Task Explorer is much more accurate than the data that was presented by depexp. Being able to visualize the data is an often requested feature as standard *.dot file viewers cannot usual cope with the size of the task-depends.dot file.

  • BitBake “-g” Output Changes: The package-depends.dot and pn-depends.dot files as previously generated using the bitbake -g command have been removed. A recipe-depends.dot file is now generated as a collapsed version of task-depends.dot instead.

    The reason for this change is because package-depends.dot and pn-depends.dot largely date back to a time before task-based execution and do not take into account task-level dependencies between recipes, which could be misleading.

  • Mirror Variable Splitting Changes: Mirror variables including MIRRORS, PREMIRRORS, and SSTATE_MIRRORS can now separate values entirely with spaces. Consequently, you no longer need “\n”. BitBake looks for pairs of values, which simplifies usage. There should be no change required to existing mirror variable values themselves.

  • The Subversion (SVN) Fetcher Uses an “ssh” Parameter and Not an “rsh” Parameter: The SVN fetcher now takes an “ssh” parameter instead of an “rsh” parameter. This new optional parameter is used when the “protocol” parameter is set to “svn+ssh”. You can only use the new parameter to specify the ssh program used by SVN. The SVN fetcher passes the new parameter through the SVN_SSH environment variable during the do_fetch task.

    See the “Subversion (SVN) Fetcher (svn://)” section in the BitBake User Manual for additional information.

  • BB_SETSCENE_VERIFY_FUNCTION and BB_SETSCENE_VERIFY_FUNCTION2 Removed: Because the mechanism they were part of is no longer necessary with recipe-specific sysroots, the BB_SETSCENE_VERIFY_FUNCTION and BB_SETSCENE_VERIFY_FUNCTION2 variables have been removed.

4.11.7 GPLv2 Versions of GPLv3 Recipes Moved

Older GPLv2 versions of GPLv3 recipes have moved to a separate meta-gplv2 layer.

If you use INCOMPATIBLE_LICENSE to exclude GPLv3 or set PREFERRED_VERSION to substitute a GPLv2 version of a GPLv3 recipe, then you must add the meta-gplv2 layer to your configuration.

Note

You can find meta-gplv2 layer in the OpenEmbedded layer index at https://layers.openembedded.org/layerindex/branch/master/layer/meta-gplv2/.

These relocated GPLv2 recipes do not receive the same level of maintenance as other core recipes. The recipes do not get security fixes and upstream no longer maintains them. In fact, the upstream community is actively hostile towards people that use the old versions of the recipes. Moving these recipes into a separate layer both makes the different needs of the recipes clearer and clearly identifies the number of these recipes.

Note

The long-term solution might be to move to BSD-licensed replacements of the GPLv3 components for those that need to exclude GPLv3-licensed components from the target system. This solution will be investigated for future Yocto Project releases.

4.11.8 Package Management Changes

The following package management changes took place:

  • Smart package manager is replaced by DNF package manager. Smart has become unmaintained upstream, is not ported to Python 3.x. Consequently, Smart needed to be replaced. DNF is the only feasible candidate.

    The change in functionality is that the on-target runtime package management from remote package feeds is now done with a different tool that has a different set of command-line options. If you have scripts that call the tool directly, or use its API, they need to be fixed.

    For more information, see the DNF Documentation.

  • Rpm 5.x is replaced with Rpm 4.x. This is done for two major reasons:

    • DNF is API-incompatible with Rpm 5.x and porting it and maintaining the port is non-trivial.

    • Rpm 5.x itself has limited maintenance upstream, and the Yocto Project is one of the very few remaining users.

  • Berkeley DB 6.x is removed and Berkeley DB 5.x becomes the default:

    • Version 6.x of Berkeley DB has largely been rejected by the open source community due to its AGPLv3 license. As a result, most mainstream open source projects that require DB are still developed and tested with DB 5.x.

    • In OE-core, the only thing that was requiring DB 6.x was Rpm 5.x. Thus, no reason exists to continue carrying DB 6.x in OE-core.

  • createrepo is replaced with createrepo_c.

    createrepo_c is the current incarnation of the tool that generates remote repository metadata. It is written in C as compared to createrepo, which is written in Python. createrepo_c is faster and is maintained.

  • Architecture-independent RPM packages are “noarch” instead of “all”.

    This change was made because too many places in DNF/RPM4 stack already make that assumption. Only the filenames and the architecture tag has changed. Nothing else has changed in OE-core system, particularly in the allarch.bbclass class.

  • Signing of remote package feeds using PACKAGE_FEED_SIGN is not currently supported. This issue will be fully addressed in a future Yocto Project release. See defect 11209 for more information on a solution to package feed signing with RPM in the Yocto Project 2.3 release.

  • OPKG now uses the libsolv backend for resolving package dependencies by default. This is vastly superior to OPKG’s internal ad-hoc solver that was previously used. This change does have a small impact on disk (around 500 KB) and memory footprint.

    Note

    For further details on this change, see the commit message.

4.11.9 Removed Recipes

The following recipes have been removed:

  • linux-yocto 4.8: Version 4.8 has been removed. Versions 4.1 (LTSI), 4.4 (LTS), 4.9 (LTS/LTSI) and 4.10 are now present.

  • python-smartpm: Functionally replaced by dnf.

  • createrepo: Replaced by the createrepo-c recipe.

  • rpmresolve: No longer needed with the move to RPM 4 as RPM itself is used instead.

  • gstreamer: Removed the GStreamer Git version recipes as they have been stale. 1.10.x recipes are still present.

  • alsa-conf-base: Merged into alsa-conf since libasound depended on both. Essentially, no way existed to install only one of these.

  • tremor: Moved to meta-multimedia. Fixed-integer Vorbis decoding is not needed by current hardware. Thus, GStreamer’s ivorbis plugin has been disabled by default eliminating the need for the tremor recipe in OpenEmbedded-Core (OE-Core).

  • gummiboot: Replaced by systemd-boot.

4.11.10 Wic Changes

The following changes have been made to Wic:

Note

For more information on Wic, see the “Creating Partitioned Images Using Wic” section in the Yocto Project Development Tasks Manual.

  • Default Output Directory Changed: Wic’s default output directory is now the current directory by default instead of the unusual /var/tmp/wic.

    The “-o” and “–outdir” options remain unchanged and are used to specify your preferred output directory if you do not want to use the default directory.

  • fsimage Plug-in Removed: The Wic fsimage plugin has been removed as it duplicates functionality of the rawcopy plugin.

4.11.11 QA Changes

The following QA checks have changed:

  • unsafe-references-in-binaries: The unsafe-references-in-binaries QA check, which was disabled by default, has now been removed. This check was intended to detect binaries in /bin that link to libraries in /usr/lib and have the case where the user has /usr on a separate filesystem to /.

    The removed QA check was buggy. Additionally, /usr residing on a separate partition from / is now a rare configuration. Consequently, unsafe-references-in-binaries was removed.

  • file-rdeps: The file-rdeps QA check is now an error by default instead of a warning. Because it is an error instead of a warning, you need to address missing runtime dependencies.

    For additional information, see the insane class and the “Errors and Warnings” section.

4.11.12 Miscellaneous Changes

The following miscellaneous changes have occurred:

  • In this release, a number of recipes have been changed to ignore the largefile DISTRO_FEATURES item, enabling large file support unconditionally. This feature has always been enabled by default. Disabling the feature has not been widely tested.

    Note

    Future releases of the Yocto Project will remove entirely the ability to disable the largefile feature, which would make it unconditionally enabled everywhere.

  • If the DISTRO_VERSION value contains the value of the DATE variable, which is the default between Poky releases, the DATE value is explicitly excluded from /etc/issue and /etc/issue.net, which is displayed at the login prompt, in order to avoid conflicts with Multilib enabled. Regardless, the DATE value is inaccurate if the base-files recipe is restored from shared state (sstate) rather than rebuilt.

    If you need the build date recorded in /etc/issue* or anywhere else in your image, a better method is to define a post-processing function to do it and have the function called from ROOTFS_POSTPROCESS_COMMAND. Doing so ensures the value is always up-to-date with the created image.

  • Dropbear’s init script now disables DSA host keys by default. This change is in line with the systemd service file, which supports RSA keys only, and with recent versions of OpenSSH, which deprecates DSA host keys.

  • The buildhistory class now correctly uses tabs as separators between all columns in installed-package-sizes.txt in order to aid import into other tools.

  • The USE_LDCONFIG variable has been replaced with the “ldconfig” DISTRO_FEATURES feature. Distributions that previously set:

    USE_LDCONFIG = "0"
    

    should now instead use the following:

    DISTRO_FEATURES_BACKFILL_CONSIDERED_append = " ldconfig"
    
  • The default value of COPYLEFT_LICENSE_INCLUDE now includes all versions of AGPL licenses in addition to GPL and LGPL.

    Note

    The default list is not intended to be guaranteed as a complete safe list. You should seek legal advice based on what you are distributing if you are unsure.

  • Kernel module packages are now suffixed with the kernel version in order to allow module packages from multiple kernel versions to co-exist on a target system. If you wish to return to the previous naming scheme that does not include the version suffix, use the following:

    KERNEL_MODULE_PACKAGE_SUFFIX = ""
    
  • Removal of libtool *.la files is now enabled by default. The *.la files are not actually needed on Linux and relocating them is an unnecessary burden.

    If you need to preserve these .la files (e.g. in a custom distribution), you must change INHERIT_DISTRO such that “remove-libtool” is not included in the value.

  • Extensible SDKs built for GCC 5+ now refuse to install on a distribution where the host GCC version is 4.8 or 4.9. This change resulted from the fact that the installation is known to fail due to the way the uninative shared state (sstate) package is built. See the uninative class for additional information.

  • All native and nativesdk recipes now use a separate DISTRO_FEATURES value instead of sharing the value used by recipes for the target, in order to avoid unnecessary rebuilds.

    The DISTRO_FEATURES for native recipes is DISTRO_FEATURES_NATIVE added to an intersection of DISTRO_FEATURES and DISTRO_FEATURES_FILTER_NATIVE.

    For nativesdk recipes, the corresponding variables are DISTRO_FEATURES_NATIVESDK and DISTRO_FEATURES_FILTER_NATIVESDK.

  • The FILESDIR variable, which was previously deprecated and rarely used, has now been removed. You should change any recipes that set FILESDIR to set FILESPATH instead.

  • The MULTIMACH_HOST_SYS variable has been removed as it is no longer needed with recipe-specific sysroots.

4.12 Moving to the Yocto Project 2.4 Release

This section provides migration information for moving to the Yocto Project 2.4 Release from the prior release.

4.12.1 Memory Resident Mode

A persistent mode is now available in BitBake’s default operation, replacing its previous “memory resident mode” (i.e. oe-init-build-env-memres). Now you only need to set BB_SERVER_TIMEOUT to a timeout (in seconds) and BitBake’s server stays resident for that amount of time between invocations. The oe-init-build-env-memres script has been removed since a separate environment setup script is no longer needed.

4.12.2 Packaging Changes

This section provides information about packaging changes that have occurred:

  • python3 Changes:

    • The main “python3” package now brings in all of the standard Python 3 distribution rather than a subset. This behavior matches what is expected based on traditional Linux distributions. If you wish to install a subset of Python 3, specify python-core plus one or more of the individual packages that are still produced.

    • python3: The bz2.py, lzma.py, and _compression.py scripts have been moved from the python3-misc package to the python3-compression package.

  • binutils: The libbfd library is now packaged in a separate “libbfd” package. This packaging saves space when certain tools (e.g. perf) are installed. In such cases, the tools only need libbfd rather than all the packages in binutils.

  • util-linux Changes:

    • The su program is now packaged in a separate “util-linux-su” package, which is only built when “pam” is listed in the DISTRO_FEATURES variable. util-linux should not be installed unless it is needed because su is normally provided through the shadow file format. The main util-linux package has runtime dependencies (i.e. RDEPENDS) on the util-linux-su package when “pam” is in DISTRO_FEATURES.

    • The switch_root program is now packaged in a separate “util-linux-switch-root” package for small initramfs images that do not need the whole util-linux package or the busybox binary, which are both much larger than switch_root. The main util-linux package has a recommended runtime dependency (i.e. RRECOMMENDS) on the util-linux-switch-root package.

    • The ionice program is now packaged in a separate “util-linux-ionice” package. The main util-linux package has a recommended runtime dependency (i.e. RRECOMMENDS) on the util-linux-ionice package.

  • initscripts: The sushell program is now packaged in a separate “initscripts-sushell” package. This packaging change allows systems to pull sushell in when selinux is enabled. The change also eliminates needing to pull in the entire initscripts package. The main initscripts package has a runtime dependency (i.e. RDEPENDS) on the sushell package when “selinux” is in DISTRO_FEATURES.

  • glib-2.0: The glib-2.0 package now has a recommended runtime dependency (i.e. RRECOMMENDS) on the shared-mime-info package, since large portions of GIO are not useful without the MIME database. You can remove the dependency by using the BAD_RECOMMENDATIONS variable if shared-mime-info is too large and is not required.

  • Go Standard Runtime: The Go standard runtime has been split out from the main go recipe into a separate go-runtime recipe.

4.12.3 Removed Recipes

The following recipes have been removed:

  • acpitests: This recipe is not maintained.

  • autogen-native: No longer required by Grub, oe-core, or meta-oe.

  • bdwgc: Nothing in OpenEmbedded-Core requires this recipe. It has moved to meta-oe.

  • byacc: This recipe was only needed by rpm 5.x and has moved to meta-oe.

  • gcc (5.4): The 5.4 series dropped the recipe in favor of 6.3 / 7.2.

  • gnome-common: Deprecated upstream and no longer needed.

  • go-bootstrap-native: Go 1.9 does its own bootstrapping so this recipe has been removed.

  • guile: This recipe was only needed by autogen-native and remake. The recipe is no longer needed by either of these programs.

  • libclass-isa-perl: This recipe was previously needed for LSB 4, no longer needed.

  • libdumpvalue-perl: This recipe was previously needed for LSB 4, no longer needed.

  • libenv-perl: This recipe was previously needed for LSB 4, no longer needed.

  • libfile-checktree-perl: This recipe was previously needed for LSB 4, no longer needed.

  • libi18n-collate-perl: This recipe was previously needed for LSB 4, no longer needed.

  • libiconv: This recipe was only needed for uclibc, which was removed in the previous release. glibc and musl have their own implementations. meta-mingw still needs libiconv, so it has been moved to meta-mingw.

  • libpng12: This recipe was previously needed for LSB. The current libpng is 1.6.x.

  • libpod-plainer-perl: This recipe was previously needed for LSB 4, no longer needed.

  • linux-yocto (4.1): This recipe was removed in favor of 4.4, 4.9, 4.10 and 4.12.

  • mailx: This recipe was previously only needed for LSB compatibility, and upstream is defunct.

  • mesa (git version only): The git version recipe was stale with respect to the release version.

  • ofono (git version only): The git version recipe was stale with respect to the release version.

  • portmap: This recipe is obsolete and is superseded by rpcbind.

  • python3-pygpgme: This recipe is old and unmaintained. It was previously required by dnf, which has switched to official gpgme Python bindings.

  • python-async: This recipe has been removed in favor of the Python 3 version.

  • python-gitdb: This recipe has been removed in favor of the Python 3 version.

  • python-git: This recipe was removed in favor of the Python 3 version.

  • python-mako: This recipe was removed in favor of the Python 3 version.

  • python-pexpect: This recipe was removed in favor of the Python 3 version.

  • python-ptyprocess: This recipe was removed in favor of Python the 3 version.

  • python-pycurl: Nothing is using this recipe in OpenEmbedded-Core (i.e. meta-oe).

  • python-six: This recipe was removed in favor of the Python 3 version.

  • python-smmap: This recipe was removed in favor of the Python 3 version.

  • remake: Using remake as the provider of virtual/make is broken. Consequently, this recipe is not needed in OpenEmbedded-Core.

4.12.4 Kernel Device Tree Move

Kernel Device Tree support is now easier to enable in a kernel recipe. The Device Tree code has moved to a kernel-devicetree class. Functionality is automatically enabled for any recipe that inherits the kernel class and sets the KERNEL_DEVICETREE variable. The previous mechanism for doing this, meta/recipes-kernel/linux/linux-dtb.inc, is still available to avoid breakage, but triggers a deprecation warning. Future releases of the Yocto Project will remove meta/recipes-kernel/linux/linux-dtb.inc. It is advisable to remove any require statements that request meta/recipes-kernel/linux/linux-dtb.inc from any custom kernel recipes you might have. This will avoid breakage in post 2.4 releases.

4.12.5 Package QA Changes

The following package QA changes took place:

  • The “unsafe-references-in-scripts” QA check has been removed.

  • If you refer to ${COREBASE}/LICENSE within LIC_FILES_CHKSUM you receive a warning because this file is a description of the license for OE-Core. Use ${COMMON_LICENSE_DIR}/MIT if your recipe is MIT-licensed and you cannot use the preferred method of referring to a file within the source tree.

4.12.6 README File Changes

The following are changes to README files:

  • The main Poky README file has been moved to the meta-poky layer and has been renamed README.poky. A symlink has been created so that references to the old location work.

  • The README.hardware file has been moved to meta-yocto-bsp. A symlink has been created so that references to the old location work.

  • A README.qemu file has been created with coverage of the qemu* machines.

4.12.7 Miscellaneous Changes

The following are additional changes:

  • The ROOTFS_PKGMANAGE_BOOTSTRAP variable and any references to it have been removed. You should remove this variable from any custom recipes.

  • The meta-yocto directory has been removed.

    Note

    In the Yocto Project 2.1 release meta-yocto was renamed to meta-poky and the meta-yocto subdirectory remained to avoid breaking existing configurations.

  • The maintainers.inc file, which tracks maintainers by listing a primary person responsible for each recipe in OE-Core, has been moved from meta-poky to OE-Core (i.e. from meta-poky/conf/distro/include to meta/conf/distro/include).

  • The buildhistory class now makes a single commit per build rather than one commit per subdirectory in the repository. This behavior assumes the commits are enabled with BUILDHISTORY_COMMIT = “1”, which is typical. Previously, the buildhistory class made one commit per subdirectory in the repository in order to make it easier to see the changes for a particular subdirectory. To view a particular change, specify that subdirectory as the last parameter on the git show or git diff commands.

  • The x86-base.inc file, which is included by all x86-based machine configurations, now sets IMAGE_FSTYPES using ?= to “live” rather than appending with +=. This change makes the default easier to override.

  • BitBake fires multiple “BuildStarted” events when multiconfig is enabled (one per configuration). For more information, see the “Events” section in the BitBake User Manual.

  • By default, the security_flags.inc file sets a GCCPIE variable with an option to enable Position Independent Executables (PIE) within gcc. Enabling PIE in the GNU C Compiler (GCC), makes Return Oriented Programming (ROP) attacks much more difficult to execute.

  • OE-Core now provides a bitbake-layers plugin that implements a “create-layer” subcommand. The implementation of this subcommand has resulted in the yocto-layer script being deprecated and will likely be removed in the next Yocto Project release.

  • The vmdk, vdi, and qcow2 image file types are now used in conjunction with the “wic” image type through CONVERSION_CMD. Consequently, the equivalent image types are now wic.vmdk, wic.vdi, and wic.qcow2, respectively.

  • do_image_<type>[depends] has replaced IMAGE_DEPENDS_<type>. If you have your own classes that implement custom image types, then you need to update them.

  • OpenSSL 1.1 has been introduced. However, the default is still 1.0.x through the PREFERRED_VERSION variable. This preference is set is due to the remaining compatibility issues with other software. The PROVIDES variable in the openssl 1.0 recipe now includes “openssl10” as a marker that can be used in DEPENDS within recipes that build software that still depend on OpenSSL 1.0.

  • To ensure consistent behavior, BitBake’s “-r” and “-R” options (i.e. prefile and postfile), which are used to read or post-read additional configuration files from the command line, now only affect the current BitBake command. Before these BitBake changes, these options would “stick” for future executions.

4.13 Moving to the Yocto Project 2.5 Release

This section provides migration information for moving to the Yocto Project 2.5 Release from the prior release.

4.13.1 Packaging Changes

This section provides information about packaging changes that have occurred:

  • bind-libs: The libraries packaged by the bind recipe are in a separate bind-libs package.

  • libfm-gtk: The libfm GTK+ bindings are split into a separate libfm-gtk package.

  • flex-libfl: The flex recipe splits out libfl into a separate flex-libfl package to avoid too many dependencies being pulled in where only the library is needed.

  • grub-efi: The grub-efi configuration is split into a separate grub-bootconf recipe. However, the dependency relationship from grub-efi is through a virtual/grub-bootconf provider making it possible to have your own recipe provide the dependency. Alternatively, you can use a BitBake append file to bring the configuration back into the grub-efi recipe.

  • armv7a Legacy Package Feed Support: Legacy support is removed for transitioning from armv7a to armv7a-vfp-neon in package feeds, which was previously enabled by setting PKGARCHCOMPAT_ARMV7A. This transition occurred in 2011 and active package feeds should by now be updated to the new naming.

4.13.2 Removed Recipes

The following recipes have been removed:

  • gcc: The version 6.4 recipes are replaced by 7.x.

  • gst-player: Renamed to gst-examples as per upstream.

  • hostap-utils: This software package is obsolete.

  • latencytop: This recipe is no longer maintained upstream. The last release was in 2009.

  • libpfm4: The only file that requires this recipe is oprofile, which has been removed.

  • linux-yocto: The version 4.4, 4.9, and 4.10 recipes have been removed. Versions 4.12, 4.14, and 4.15 remain.

  • man: This recipe has been replaced by modern man-db

  • mkelfimage: This tool has been removed in the upstream coreboot project, and is no longer needed with the removal of the ELF image type.

  • nativesdk-postinst-intercept: This recipe is not maintained.

  • neon: This software package is no longer maintained upstream and is no longer needed by anything in OpenEmbedded-Core.

  • oprofile: The functionality of this recipe is replaced by perf and keeping compatibility on an ongoing basis with musl is difficult.

  • pax: This software package is obsolete.

  • stat: This software package is not maintained upstream. coreutils provides a modern stat binary.

  • zisofs-tools-native: This recipe is no longer needed because the compressed ISO image feature has been removed.

4.13.3 Scripts and Tools Changes

The following are changes to scripts and tools:

  • yocto-bsp, yocto-kernel, and yocto-layer: The yocto-bsp, yocto-kernel, and yocto-layer scripts previously shipped with poky but not in OpenEmbedded-Core have been removed. These scripts are not maintained and are outdated. In many cases, they are also limited in scope. The bitbake-layers create-layer command is a direct replacement for yocto-layer. See the documentation to create a BSP or kernel recipe in the “BSP Kernel Recipe Example” section.

  • devtool finish: devtool finish now exits with an error if there are uncommitted changes or a rebase/am in progress in the recipe’s source repository. If this error occurs, there might be uncommitted changes that will not be included in updates to the patches applied by the recipe. A -f/–force option is provided for situations that the uncommitted changes are inconsequential and you want to proceed regardless.

  • scripts/oe-setup-rpmrepo script: The functionality of scripts/oe-setup-rpmrepo is replaced by bitbake package-index.

  • scripts/test-dependencies.sh script: The script is largely made obsolete by the recipe-specific sysroots functionality introduced in the previous release.

4.13.4 BitBake Changes

The following are BitBake changes:

  • The --runall option has changed. There are two different behaviors people might want:

    • Behavior A: For a given target (or set of targets) look through the task graph and run task X only if it is present and will be built.

    • Behavior B: For a given target (or set of targets) look through the task graph and run task X if any recipe in the taskgraph has such a target, even if it is not in the original task graph.

    The --runall option now performs “Behavior B”. Previously --runall behaved like “Behavior A”. A --runonly option has been added to retain the ability to perform “Behavior A”.

  • Several explicit “run this task for all recipes in the dependency tree” tasks have been removed (e.g. fetchall, checkuriall, and the *all tasks provided by the distrodata and archiver classes). There is a BitBake option to complete this for any arbitrary task. For example:

    bitbake <target> -c fetchall
    

    should now be replaced with:

    bitbake <target> --runall=fetch
    
4.13.5 Python and Python 3 Changes

The following are auto-packaging changes to Python and Python 3:

The script-managed python-*-manifest.inc files that were previously used to generate Python and Python 3 packages have been replaced with a JSON-based file that is easier to read and maintain. A new task is available for maintainers of the Python recipes to update the JSON file when upgrading to new Python versions. You can now edit the file directly instead of having to edit a script and run it to update the file.

One particular change to note is that the Python recipes no longer have build-time provides for their packages. This assumes python-foo is one of the packages provided by the Python recipe. You can no longer run bitbake python-foo or have a DEPENDS on python-foo, but doing either of the following causes the package to work as expected:

IMAGE_INSTALL_append = " python-foo"

or

RDEPENDS_${PN} = "python-foo"

The earlier build-time provides behavior was a quirk of the way the Python manifest file was created. For more information on this change please see this commit.

4.13.6 Miscellaneous Changes

The following are additional changes:

  • The kernel class supports building packages for multiple kernels. If your kernel recipe or .bbappend file mentions packaging at all, you should replace references to the kernel in package names with ${KERNEL_PACKAGE_NAME}. For example, if you disable automatic installation of the kernel image using RDEPENDS_kernel-base = "" you can avoid warnings using RDEPENDS_${KERNEL_PACKAGE_NAME}-base = "" instead.

  • The buildhistory class commits changes to the repository by default so you no longer need to set BUILDHISTORY_COMMIT = "1". If you want to disable commits you need to set BUILDHISTORY_COMMIT = "0" in your configuration.

  • The beaglebone reference machine has been renamed to beaglebone-yocto. The beaglebone-yocto BSP is a reference implementation using only mainline components available in OpenEmbedded-Core and meta-yocto-bsp, whereas Texas Instruments maintains a full-featured BSP in the meta-ti layer. This rename avoids the previous name clash that existed between the two BSPs.

  • The update-alternatives class no longer works with SysV init scripts because this usage has been problematic. Also, the sysklogd recipe no longer uses update-alternatives because it is incompatible with other implementations.

  • By default, the cmake class uses ninja instead of make for building. This improves build performance. If a recipe is broken with ninja, then the recipe can set OECMAKE_GENERATOR = "Unix Makefiles" to change back to make.

  • The previously deprecated base_* functions have been removed in favor of their replacements in meta/lib/oe and bitbake/lib/bb. These are typically used from recipes and classes. Any references to the old functions must be updated. The following table shows the removed functions and their replacements:

    Removed

    Replacement

    base_path_join()

    oe.path.join()

    base_path_relative()

    oe.path.relative()

    base_path_out()

    oe.path.format_display()

    base_read_file()

    oe.utils.read_file()

    base_ifelse()

    oe.utils.ifelse()

    base_conditional()

    oe.utils.conditional()

    base_less_or_equal()

    oe.utils.less_or_equal()

    base_version_less_or_equal()

    oe.utils.version_less_or_equal()

    base_contains()

    bb.utils.contains()

    base_both_contain()

    oe.utils.both_contain()

    base_prune_suffix()

    oe.utils.prune_suffix()

    oe_filter()

    oe.utils.str_filter()

    oe_filter_out()

    oe.utils.str_filter_out() (or use the _remove operator)

  • Using exit 1 to explicitly defer a postinstall script until first boot is now deprecated since it is not an obvious mechanism and can mask actual errors. If you want to explicitly defer a postinstall to first boot on the target rather than at rootfs creation time, use pkg_postinst_ontarget() or call postinst_intercept delay_to_first_boot from pkg_postinst(). Any failure of a pkg_postinst() script (including exit 1) will trigger a warning during do_rootfs.

    For more information, see the “Post-Installation Scripts” section in the Yocto Project Development Tasks Manual.

  • The elf image type has been removed. This image type was removed because the mkelfimage tool that was required to create it is no longer provided by coreboot upstream and required updating every time binutils updated.

  • Support for .iso image compression (previously enabled through COMPRESSISO = "1") has been removed. The userspace tools (zisofs-tools) are unmaintained and squashfs provides better performance and compression. In order to build a live image with squashfs+lz4 compression enabled you should now set LIVE_ROOTFS_TYPE = "squashfs-lz4" and ensure that live is in IMAGE_FSTYPES.

  • Recipes with an unconditional dependency on libpam are only buildable with pam in DISTRO_FEATURES. If the dependency is truly optional then it is recommended that the dependency be conditional upon pam being in DISTRO_FEATURES.

  • For EFI-based machines, the bootloader (grub-efi by default) is installed into the image at /boot. Wic can be used to split the bootloader into separate boot and rootfs partitions if necessary.

  • Patches whose context does not match exactly (i.e. where patch reports “fuzz” when applying) will generate a warning. For an example of this see this commit.

  • Layers are expected to set LAYERSERIES_COMPAT_layername to match the version(s) of OpenEmbedded-Core they are compatible with. This is specified as codenames using spaces to separate multiple values (e.g. “rocko sumo”). If a layer does not set LAYERSERIES_COMPAT_layername, a warning will is shown. If a layer sets a value that does not include the current version (“sumo” for the 2.5 release), then an error will be produced.

  • The TZ environment variable is set to “UTC” within the build environment in order to fix reproducibility problems in some recipes.

4.14 Moving to the Yocto Project 2.6 Release

This section provides migration information for moving to the Yocto Project 2.6 Release from the prior release.

4.14.1 GCC 8.2 is Now Used by Default

The GNU Compiler Collection version 8.2 is now used by default for compilation. For more information on what has changed in the GCC 8.x release, see https://gcc.gnu.org/gcc-8/changes.html.

If you still need to compile with version 7.x, GCC 7.3 is also provided. You can select this version by setting the and can be selected by setting the GCCVERSION variable to “7.%” in your configuration.

4.14.2 Removed Recipes

The following recipes have been removed:

  • beecrypt: No longer needed since moving to RPM 4.

  • bigreqsproto: Replaced by xorgproto.

  • calibrateproto: Removed in favor of xinput.

  • compositeproto: Replaced by xorgproto.

  • damageproto: Replaced by xorgproto.

  • dmxproto: Replaced by xorgproto.

  • dri2proto: Replaced by xorgproto.

  • dri3proto: Replaced by xorgproto.

  • eee-acpi-scripts: Became obsolete.

  • fixesproto: Replaced by xorgproto.

  • fontsproto: Replaced by xorgproto.

  • fstests: Became obsolete.

  • gccmakedep: No longer used.

  • glproto: Replaced by xorgproto.

  • gnome-desktop3: No longer needed. This recipe has moved to meta-oe.

  • icon-naming-utils: No longer used since the Sato theme was removed in 2016.

  • inputproto: Replaced by xorgproto.

  • kbproto: Replaced by xorgproto.

  • libusb-compat: Became obsolete.

  • libuser: Became obsolete.

  • libnfsidmap: No longer an external requirement since nfs-utils 2.2.1. libnfsidmap is now integrated.

  • libxcalibrate: No longer needed with xinput

  • mktemp: Became obsolete. The mktemp command is provided by both busybox and coreutils.

  • ossp-uuid: Is not being maintained and has mostly been replaced by uuid.h in util-linux.

  • pax-utils: No longer needed. Previous QA tests that did use this recipe are now done at build time.

  • pcmciautils: Became obsolete.

  • pixz: No longer needed. xz now supports multi-threaded compression.

  • presentproto: Replaced by xorgproto.

  • randrproto: Replaced by xorgproto.

  • recordproto: Replaced by xorgproto.

  • renderproto: Replaced by xorgproto.

  • resourceproto: Replaced by xorgproto.

  • scrnsaverproto: Replaced by xorgproto.

  • trace-cmd: Became obsolete. perf replaced this recipe’s functionally.

  • videoproto: Replaced by xorgproto.

  • wireless-tools: Became obsolete. Superseded by iw.

  • xcmiscproto: Replaced by xorgproto.

  • xextproto: Replaced by xorgproto.

  • xf86dgaproto: Replaced by xorgproto.

  • xf86driproto: Replaced by xorgproto.

  • xf86miscproto: Replaced by xorgproto.

  • xf86-video-omapfb: Became obsolete. Use kernel modesetting driver instead.

  • xf86-video-omap: Became obsolete. Use kernel modesetting driver instead.

  • xf86vidmodeproto: Replaced by xorgproto.

  • xineramaproto: Replaced by xorgproto.

  • xproto: Replaced by xorgproto.

  • yasm: No longer needed since previous usages are now satisfied by nasm.

4.14.3 Packaging Changes

The following packaging changes have been made:

  • cmake: cmake.m4 and toolchain files have been moved to the main package.

  • iptables: The iptables modules have been split into separate packages.

  • alsa-lib: libasound is now in the main alsa-lib package instead of libasound.

  • glibc: libnss-db is now in its own package along with a /var/db/makedbs.sh script to update databases.

  • python and python3: The main package has been removed from the recipe. You must install specific packages or python-modules / python3-modules for everything.

  • systemtap: Moved systemtap-exporter into its own package.

4.14.4 XOrg Protocol dependencies

The *proto upstream repositories have been combined into one “xorgproto” repository. Thus, the corresponding recipes have also been combined into a single xorgproto recipe. Any recipes that depend upon the older *proto recipes need to be changed to depend on the newer xorgproto recipe instead.

For names of recipes removed because of this repository change, see the Removed Recipes section.

4.14.5 distutils and distutils3 Now Prevent Fetching Dependencies During the do_configure Task

Previously, it was possible for Python recipes that inherited the distutils and distutils3 classes to fetch code during the do_configure task to satisfy dependencies mentioned in setup.py if those dependencies were not provided in the sysroot (i.e. recipes providing the dependencies were missing from DEPENDS).

Note

This change affects classes beyond just the two mentioned (i.e. distutils and distutils3). Any recipe that inherits distutils* classes are affected. For example, the setuptools and setuptools3 recipes are affected since they inherit the distutils* classes.

Fetching these types of dependencies that are not provided in the sysroot negatively affects the ability to reproduce builds. This type of fetching is now explicitly disabled. Consequently, any missing dependencies in Python recipes that use these classes now result in an error during the do_configure task.

4.14.6 linux-yocto Configuration Audit Issues Now Correctly Reported

Due to a bug, the kernel configuration audit functionality was not writing out any resulting warnings during the build. This issue is now corrected. You might notice these warnings now if you have a custom kernel configuration with a linux-yocto style kernel recipe.

4.14.7 Image/Kernel Artifact Naming Changes

The following changes have been made:

  • Name variables (e.g. IMAGE_NAME) use a new IMAGE_VERSION_SUFFIX variable instead of DATETIME. Using IMAGE_VERSION_SUFFIX allows easier and more direct changes.

    The IMAGE_VERSION_SUFFIX variable is set in the bitbake.conf configuration file as follows:

    IMAGE_VERSION_SUFFIX = "-${DATETIME}"
    
  • Several variables have changed names for consistency:

    Old Variable Name             New Variable Name
    ========================================================
    KERNEL_IMAGE_BASE_NAME        KERNEL_IMAGE_NAME
    KERNEL_IMAGE_SYMLINK_NAME     KERNEL_IMAGE_LINK_NAME
    MODULE_TARBALL_BASE_NAME      MODULE_TARBALL_NAME
    MODULE_TARBALL_SYMLINK_NAME   MODULE_TARBALL_LINK_NAME
    INITRAMFS_BASE_NAME           INITRAMFS_NAME
    
  • The MODULE_IMAGE_BASE_NAME variable has been removed. The module tarball name is now controlled directly with the MODULE_TARBALL_NAME variable.

  • The KERNEL_DTB_NAME and KERNEL_DTB_LINK_NAME variables have been introduced to control kernel Device Tree Binary (DTB) artifact names instead of mangling KERNEL_IMAGE_* variables.

  • The KERNEL_FIT_NAME and KERNEL_FIT_LINK_NAME variables have been introduced to specify the name of flattened image tree (FIT) kernel images similar to other deployed artifacts.

  • The MODULE_TARBALL_NAME and MODULE_TARBALL_LINK_NAME variable values no longer include the “module-” prefix or “.tgz” suffix. These parts are now hardcoded so that the values are consistent with other artifact naming variables.

  • Added the INITRAMFS_LINK_NAME variable so that the symlink can be controlled similarly to other artifact types.

  • INITRAMFS_NAME now uses “${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}” instead of “${PV}-${PR}-${MACHINE}-${DATETIME}”, which makes it consistent with other variables.

4.14.8 SERIAL_CONSOLE Deprecated

The SERIAL_CONSOLE variable has been functionally replaced by the SERIAL_CONSOLES variable for some time. With the Yocto Project 2.6 release, SERIAL_CONSOLE has been officially deprecated.

SERIAL_CONSOLE will continue to work as before for the 2.6 release. However, for the sake of future compatibility, it is recommended that you replace all instances of SERIAL_CONSOLE with SERIAL_CONSOLES.

Note

The only difference in usage is that SERIAL_CONSOLES expects entries to be separated using semicolons as compared to SERIAL_CONSOLE, which expects spaces.

4.14.9 Configure Script Reports Unknown Options as Errors

If the configure script reports an unknown option, this now triggers a QA error instead of a warning. Any recipes that previously got away with specifying such unknown options now need to be fixed.

4.14.10 Override Changes

The following changes have occurred:

  • The virtclass-native and virtclass-nativesdk Overrides Have Been Removed: The virtclass-native and virtclass-nativesdk overrides have been deprecated since 2012 in favor of class-native and class-nativesdk, respectively. Both virtclass-native and virtclass-nativesdk are now dropped.

    Note

    The virtclass-multilib- overrides for multilib are still valid.

  • The forcevariable Override Now Has a Higher Priority Than libc Overrides: The forcevariable override is documented to be the highest priority override. However, due to a long-standing quirk of how OVERRIDES is set, the libc overrides (e.g. libc-glibc, libc-musl, and so forth) erroneously had a higher priority. This issue is now corrected.

    It is likely this change will not cause any problems. However, it is possible with some unusual configurations that you might see a change in behavior if you were relying on the previous behavior. Be sure to check how you use forcevariable and libc-* overrides in your custom layers and configuration files to ensure they make sense.

  • The build-${BUILD_OS} Override Has Been Removed: The build-${BUILD_OS}, which is typically build-linux, override has been removed because building on a host operating system other than a recent version of Linux is neither supported nor recommended. Dropping the override avoids giving the impression that other host operating systems might be supported.

  • The “_remove” operator now preserves whitespace. Consequently, when specifying list items to remove, be aware that leading and trailing whitespace resulting from the removal is retained.

    See the “Removal (Override Style Syntax)” section in the BitBake User Manual for a detailed example.

4.14.11 systemd Configuration is Now Split Into systemd-conf

The configuration for the systemd recipe has been moved into a system-conf recipe. Moving this configuration to a separate recipe avoids the systemd recipe from becoming machine-specific for cases where machine-specific configurations need to be applied (e.g. for qemu* machines).

Currently, the new recipe packages the following files:

${sysconfdir}/machine-id
${sysconfdir}/systemd/coredump.conf
${sysconfdir}/systemd/journald.conf
${sysconfdir}/systemd/logind.conf
${sysconfdir}/systemd/system.conf
${sysconfdir}/systemd/user.conf

If you previously used bbappend files to append the systemd recipe to change any of the listed files, you must do so for the systemd-conf recipe instead.

4.14.12 Automatic Testing Changes

This section provides information about automatic testing changes:

  • TEST_IMAGE Variable Removed: Prior to this release, you set the TEST_IMAGE variable to “1” to enable automatic testing for successfully built images. The TEST_IMAGE variable no longer exists and has been replaced by the TESTIMAGE_AUTO variable.

  • Inheriting the testimage and testsdk Classes: Best practices now dictate that you use the IMAGE_CLASSES variable rather than the INHERIT variable when you inherit the testimage and testsdk classes used for automatic testing.

4.14.13 OpenSSL Changes

OpenSSL has been upgraded from 1.0 to 1.1. By default, this upgrade could cause problems for recipes that have both versions in their dependency chains. The problem is that both versions cannot be installed together at build time.

Note

It is possible to have both versions of the library at runtime.

4.14.14 BitBake Changes

The server logfile bitbake-cookerdaemon.log is now always placed in the Build Directory instead of the current directory.

4.14.15 Security Changes

The Poky distribution now uses security compiler flags by default. Inclusion of these flags could cause new failures due to stricter checking for various potential security issues in code.

4.14.16 Post Installation Changes

You must explicitly mark post installs to defer to the target. If you want to explicitly defer a postinstall to first boot on the target rather than at rootfs creation time, use pkg_postinst_ontarget() or call postinst_intercept delay_to_first_boot from pkg_postinst(). Any failure of a pkg_postinst() script (including exit 1) triggers an error during the do_rootfs task.

For more information on post-installation behavior, see the “Post-Installation Scripts” section in the Yocto Project Development Tasks Manual.

4.14.17 Python 3 Profile-Guided Optimization

The python3 recipe now enables profile-guided optimization. Using this optimization requires a little extra build time in exchange for improved performance on the target at runtime. Additionally, the optimization is only enabled if the current MACHINE has support for user-mode emulation in QEMU (i.e. “qemu-usermode” is in MACHINE_FEATURES, which it is by default).

If you wish to disable Python profile-guided optimization regardless of the value of MACHINE_FEATURES, then ensure that PACKAGECONFIG for the python3 recipe does not contain “pgo”. You could accomplish the latter using the following at the configuration level:

PACKAGECONFIG_remove_pn-python3 = "pgo"

Alternatively, you can set PACKAGECONFIG using an append file for the python3 recipe.

4.14.18 Miscellaneous Changes

The following miscellaneous changes occurred:

  • Default to using the Thumb-2 instruction set for armv7a and above. If you have any custom recipes that build software that needs to be built with the ARM instruction set, change the recipe to set the instruction set as follows:

    ARM_INSTRUCTION_SET = "arm"
    
  • run-postinsts no longer uses /etc/*-postinsts for dpkg/opkg in favor of built-in postinst support. RPM behavior remains unchanged.

  • The NOISO and NOHDD variables are no longer used. You now control building *.iso and *.hddimg image types directly by using the IMAGE_FSTYPES variable.

  • The scripts/contrib/mkefidisk.sh has been removed in favor of Wic.

  • kernel-modules has been removed from RRECOMMENDS for qemumips and qemumips64 machines. Removal also impacts the x86-base.inc file.

    Note

    genericx86 and genericx86-64 retain kernel-modules as part of the RRECOMMENDS variable setting.

  • The LGPLv2_WHITELIST_GPL-3.0 variable has been removed. If you are setting this variable in your configuration, set or append it to the WHITELIST_GPL-3.0 variable instead.

  • ${ASNEEDED} is now included in the TARGET_LDFLAGS variable directly. The remaining definitions from meta/conf/distro/include/as-needed.inc have been moved to corresponding recipes.

  • Support for DSA host keys has been dropped from the OpenSSH recipes. If you are still using DSA keys, you must switch over to a more secure algorithm as recommended by OpenSSH upstream.

  • The dhcp recipe now uses the dhcpd6.conf configuration file in dhcpd6.service for IPv6 DHCP rather than re-using dhcpd.conf, which is now reserved for IPv4.

4.15 Moving to the Yocto Project 2.7 Release

This section provides migration information for moving to the Yocto Project 2.7 Release from the prior release.

4.15.1 BitBake Changes

The following changes have been made to BitBake:

  • BitBake now checks anonymous Python functions and pure Python functions (e.g. def funcname:) in the metadata for tab indentation. If found, BitBake produces a warning.

  • Bitbake now checks BBFILE_COLLECTIONS for duplicate entries and triggers an error if any are found.

4.15.2 Eclipse Support Removed

Support for the Eclipse IDE has been removed. Support continues for those releases prior to 2.7 that did include support. The 2.7 release does not include the Eclipse Yocto plugin.

4.15.3 qemu-native Splits the System and User-Mode Parts

The system and user-mode parts of qemu-native are now split. qemu-native provides the user-mode components and qemu-system-native provides the system components. If you have recipes that depend on QEMU’s system emulation functionality at build time, they should now depend upon qemu-system-native instead of qemu-native.

4.15.4 The upstream-tracking.inc File Has Been Removed

The previously deprecated upstream-tracking.inc file is now removed. Any UPSTREAM_TRACKING* variables are now set in the corresponding recipes instead.

Remove any references you have to the upstream-tracking.inc file in your configuration.

4.15.5 The DISTRO_FEATURES_LIBC Variable Has Been Removed

The DISTRO_FEATURES_LIBC variable is no longer used. The ability to configure glibc using kconfig has been removed for quite some time making the libc-* features set no longer effective.

Remove any references you have to DISTRO_FEATURES_LIBC in your own layers.

4.15.6 License Value Corrections

The following corrections have been made to the LICENSE values set by recipes:

  • socat: Corrected LICENSE to be “GPLv2” rather than “GPLv2+”.

  • libgfortran: Set license to “GPL-3.0-with-GCC-exception”.

  • elfutils: Removed “Elfutils-Exception” and set to “GPLv2” for shared libraries

4.15.7 Packaging Changes

This section provides information about packaging changes.

  • bind: The nsupdate binary has been moved to the bind-utils package.

  • Debug split: The default debug split has been changed to create separate source packages (i.e. package_name-dbg and package_name-src). If you are currently using dbg-pkgs in IMAGE_FEATURES to bring in debug symbols and you still need the sources, you must now also add src-pkgs to IMAGE_FEATURES. Source packages remain in the target portion of the SDK by default, unless you have set your own value for SDKIMAGE_FEATURES that does not include src-pkgs.

  • Mount all using util-linux: /etc/default/mountall has moved into the -mount sub-package.

  • Splitting binaries using util-linux: util-linux now splits each binary into its own package for fine-grained control. The main util-linux package pulls in the individual binary packages using the RRECOMMENDS and RDEPENDS variables. As a result, existing images should not see any changes assuming NO_RECOMMENDATIONS is not set.

  • netbase/base-files: /etc/hosts has moved from netbase to base-files.

  • tzdata: The main package has been converted to an empty meta package that pulls in all tzdata packages by default.

  • lrzsz: This package has been removed from packagegroup-self-hosted and packagegroup-core-tools-testapps. The X/Y/ZModem support is less likely to be needed on modern systems. If you are relying on these packagegroups to include the lrzsz package in your image, you now need to explicitly add the package.

4.15.8 Removed Recipes

The following recipes have been removed:

  • gcc: Drop version 7.3 recipes. Version 8.3 now remains.

  • linux-yocto: Drop versions 4.14 and 4.18 recipes. Versions 4.19 and 5.0 remain.

  • go: Drop version 1.9 recipes. Versions 1.11 and 1.12 remain.

  • xvideo-tests: Became obsolete.

  • libart-lgpl: Became obsolete.

  • gtk-icon-utils-native: These tools are now provided by gtk+3-native

  • gcc-cross-initial: No longer needed. gcc-cross/gcc-crosssdk is now used instead.

  • gcc-crosssdk-initial: No longer needed. gcc-cross/gcc-crosssdk is now used instead.

  • glibc-initial: Removed because the benefits of having it for site_config are currently outweighed by the cost of building the recipe.

4.15.9 Removed Classes

The following classes have been removed:

  • distutils-tools: This class was never used.

  • bugzilla.bbclass: Became obsolete.

  • distrodata: This functionally has been replaced by a more modern tinfoil-based implementation.

4.15.10 Miscellaneous Changes

The following miscellaneous changes occurred:

  • The distro subdirectory of the Poky repository has been removed from the top-level scripts directory.

  • Perl now builds for the target using perl-cross for better maintainability and improved build performance. This change should not present any problems unless you have heavily customized your Perl recipe.

  • arm-tunes: Removed the “-march” option if mcpu is already added.

  • update-alternatives: Convert file renames to PACKAGE_PREPROCESS_FUNCS

  • base/pixbufcache: Obsolete sstatecompletions code has been removed.

  • native class: RDEPENDS handling has been enabled.

  • inetutils: This recipe has rsh disabled.

4.16 Moving to the Yocto Project 3.0 Release

This section provides migration information for moving to the Yocto Project 3.0 Release from the prior release.

4.16.1 Init System Selection

Changing the init system manager previously required setting a number of different variables. You can now change the manager by setting the INIT_MANAGER variable and the corresponding include files (i.e. conf/distro/include/init-manager-*.conf). Include files are provided for four values: “none”, “sysvinit”, “systemd”, and “mdev-busybox”. The default value, “none”, for INIT_MANAGER should allow your current settings to continue working. However, it is advisable to explicitly set INIT_MANAGER.

4.16.2 LSB Support Removed

Linux Standard Base (LSB) as a standard is not current, and is not well suited for embedded applications. Support can be continued in a separate layer if needed. However, presently LSB support has been removed from the core.

As a result of this change, the poky-lsb derivative distribution configuration that was also used for testing alternative configurations has been replaced with a poky-altcfg distribution that has LSB parts removed.

4.16.3 Removed Recipes

The following recipes have been removed.

  • core-image-lsb-dev: Part of removed LSB support.

  • core-image-lsb: Part of removed LSB support.

  • core-image-lsb-sdk: Part of removed LSB support.

  • cve-check-tool: Functionally replaced by the cve-update-db recipe and cve-check class.

  • eglinfo: No longer maintained. eglinfo from mesa-demos is an adequate and maintained alternative.

  • gcc-8.3: Version 8.3 removed. Replaced by 9.2.

  • gnome-themes-standard: Only needed by gtk+ 2.x, which has been removed.

  • gtk+: GTK+ 2 is obsolete and has been replaced by gtk+3.

  • irda-utils: Has become obsolete. IrDA support has been removed from the Linux kernel in version 4.17 and later.

  • libnewt-python: libnewt Python support merged into main libnewt recipe.

  • libsdl: Replaced by newer libsdl2.

  • libx11-diet: Became obsolete.

  • libxx86dga: Removed obsolete client library.

  • libxx86misc: Removed. Library is redundant.

  • linux-yocto: Version 5.0 removed, which is now redundant (5.2 / 4.19 present).

  • lsbinitscripts: Part of removed LSB support.

  • lsb: Part of removed LSB support.

  • lsbtest: Part of removed LSB support.

  • openssl10: Replaced by newer openssl version 1.1.

  • packagegroup-core-lsb: Part of removed LSB support.

  • python-nose: Removed the Python 2.x version of the recipe.

  • python-numpy: Removed the Python 2.x version of the recipe.

  • python-scons: Removed the Python 2.x version of the recipe.

  • source-highlight: No longer needed.

  • stress: Replaced by stress-ng.

  • vulkan: Split into vulkan-loader, vulkan-headers, and vulkan-tools.

  • weston-conf: Functionality moved to weston-init.

4.16.4 Packaging Changes

The following packaging changes have occurred.

  • The Epiphany browser has been dropped from packagegroup-self-hosted as it has not been needed inside build-appliance-image for quite some time and was causing resource problems.

  • libcap-ng Python support has been moved to a separate libcap-ng-python recipe to streamline the build process when the Python bindings are not needed.

  • libdrm now packages the file amdgpu.ids into a separate libdrm-amdgpu package.

  • python3: The runpy module is now in the python3-core package as it is required to support the common “python3 -m” command usage.

  • distcc now provides separate distcc-client and distcc-server packages as typically one or the other are needed, rather than both.

  • python*-setuptools recipes now separately package the pkg_resources module in a python-pkg-resources / python3-pkg-resources package as the module is useful independent of the rest of the setuptools package. The main python-setuptools / python3-setuptools package depends on this new package so you should only need to update dependencies unless you want to take advantage of the increased granularity.

4.16.5 CVE Checking

cve-check-tool has been functionally replaced by a new cve-update-db recipe and functionality built into the cve-check class. The result uses NVD JSON data feeds rather than the deprecated XML feeds that cve-check-tool was using, supports CVSSv3 scoring, and makes other improvements.

Additionally, the CVE_CHECK_CVE_WHITELIST variable has been replaced by CVE_CHECK_WHITELIST.

4.16.6 Bitbake Changes

The following BitBake changes have occurred.

  • addtask statements now properly validate dependent tasks. Previously, an invalid task was silently ignored. With this change, the invalid task generates a warning.

  • Other invalid addtask and deltask usages now trigger these warnings: “multiple target tasks arguments with addtask / deltask”, and “multiple before/after clauses”.

  • The “multiconfig” prefix is now shortened to “mc”. “multiconfig” will continue to work, however it may be removed in a future release.

  • The bitbake -g command no longer generates a recipe-depends.dot file as the contents (i.e. a reprocessed version of task-depends.dot) were confusing.

  • The bb.build.FuncFailed exception, previously raised by bb.build.exec_func() when certain other exceptions have occurred, has been removed. The real underlying exceptions will be raised instead. If you have calls to bb.build.exec_func() in custom classes or tinfoil-using scripts, any references to bb.build.FuncFailed should be cleaned up.

  • Additionally, the bb.build.exec_func() no longer accepts the “pythonexception” parameter. The function now always raises exceptions. Remove this argument in any calls to bb.build.exec_func() in custom classes or scripts.

  • The BB_SETSCENE_VERIFY_FUNCTION2 is no longer used. In the unlikely event that you have any references to it, they should be removed.

  • The RunQueueExecuteScenequeue and RunQueueExecuteTasks events have been removed since setscene tasks are now executed as part of the normal runqueue. Any event handling code in custom classes or scripts that handles these two events need to be updated.

  • The arguments passed to functions used with BB_HASHCHECK_FUNCTION have changed. If you are using your own custom hash check function, see https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=40a5e193c4ba45c928fccd899415ea56b5417725 for details.

  • Task specifications in BB_TASKDEPDATA and class implementations used in signature generator classes now use “<fn>:<task>” everywhere rather than the “.” delimiter that was being used in some places. This change makes it consistent with all areas in the code. Custom signature generator classes and code that reads BB_TASKDEPDATA need to be updated to use ‘:’ as a separator rather than ‘.’.

4.16.7 Sanity Checks

The following sanity check changes occurred.

  • SRC_URI is now checked for usage of two problematic items:

    • “${PN}” prefix/suffix use - Warnings always appear if ${PN} is used. You must fix the issue regardless of whether multiconfig or anything else that would cause prefixing/suffixing to happen.

    • Github archive tarballs - these are not guaranteed to be stable. Consequently, it is likely that the tarballs will be refreshed and thus the SRC_URI checksums will fail to apply. It is recommended that you fetch either an official release tarball or a specific revision from the actual Git repository instead.

    Either one of these items now trigger a warning by default. If you wish to disable this check, remove src-uri-bad from WARN_QA.

  • The file-rdeps runtime dependency check no longer expands RDEPENDS recursively as there is no mechanism to ensure they can be fully computed, and thus races sometimes result in errors either showing up or not. Thus, you might now see errors for missing runtime dependencies that were previously satisfied recursively. Here is an example: package A contains a shell script starting with #!/bin/bash but has no dependency on bash. However, package A depends on package B, which does depend on bash. You need to add the missing dependency or dependencies to resolve the warning.

  • Setting DEPENDS_${PN} anywhere (i.e. typically in a recipe) now triggers an error. The error is triggered because DEPENDS is not a package-specific variable unlike RDEPENDS. You should set DEPENDS instead.

  • systemd currently does not work well with the musl C library because only upstream officially supports linking the library with glibc. Thus, a warning is shown when building systemd in conjunction with musl.

4.16.8 Miscellaneous Changes

The following miscellaneous changes have occurred.

  • The gnome class has been removed because it now does very little. You should update recipes that previously inherited this class to do the following: inherit gnomebase gtk-icon-cache gconf mime

  • The meta/recipes-kernel/linux/linux-dtb.inc file has been removed. This file was previously deprecated in favor of setting KERNEL_DEVICETREE in any kernel recipe and only produced a warning. Remove any include or require statements pointing to this file.

  • TARGET_CFLAGS, TARGET_CPPFLAGS, TARGET_CXXFLAGS, and TARGET_LDFLAGS are no longer exported to the external environment. This change did not require any changes to core recipes, which is a good indicator that no changes will be required. However, if for some reason the software being built by one of your recipes is expecting these variables to be set, then building the recipe will fail. In such cases, you must either export the variable or variables in the recipe or change the scripts so that exporting is not necessary.

  • You must change the host distro identifier used in NATIVELSBSTRING to use all lowercase characters even if it does not contain a version number. This change is necessary only if you are not using uninative and SANITY_TESTED_DISTROS.

  • In the base-files recipe, writing the hostname into /etc/hosts and /etc/hostname is now done within the main do_install function rather than in the do_install_basefilesissue function. The reason for the change is because do_install_basefilesissue is more easily overridden without having to duplicate the hostname functionality. If you have done the latter (e.g. in a base-files bbappend), then you should remove it from your customized do_install_basefilesissue function.

  • The wic --expand command now uses commas to separate “key:value” pairs rather than hyphens.

    Note

    The wic command-line help is not updated.

    You must update any scripts or commands where you use wic --expand with multiple “key:value” pairs.

  • UEFI image variable settings have been moved from various places to a central conf/image-uefi.conf. This change should not influence any existing configuration as the meta/conf/image-uefi.conf in the core metadata sets defaults that can be overridden in the same manner as before.

  • conf/distro/include/world-broken.inc has been removed. For cases where certain recipes need to be disabled when using the musl C library, these recipes now have COMPATIBLE_HOST_libc-musl set with a comment that explains why.

4.17 Moving to the Yocto Project 3.1 Release

This section provides migration information for moving to the Yocto Project 3.1 Release from the prior release.

4.17.1 Minimum system requirements

The following versions / requirements of build host components have been updated:

  • gcc 5.0

  • python 3.5

  • tar 1.28

  • rpcgen is now required on the host (part of the libc-dev-bin package on Ubuntu, Debian and related distributions, and the glibc package on RPM-based distributions).

Additionally, the makeinfo and pod2man tools are no longer required on the host.

4.17.2 mpc8315e-rdb machine removed

The MPC8315E-RDB machine is old/obsolete and unobtainable, thus given the maintenance burden the mpc8315e-rdb machine configuration that supported it has been removed in this release. The removal does leave a gap in official PowerPC reference hardware support; this may change in future if a suitable machine with accompanying support resources is found.

4.17.3 Python 2 removed

Due to the expiration of upstream support in January 2020, support for Python 2 has now been removed; it is recommended that you use Python 3 instead. If absolutely needed there is a meta-python2 community layer containing Python 2, related classes and various Python 2-based modules, however it should not be considered as supported.

4.17.4 Reproducible builds now enabled by default

In order to avoid unnecessary differences in output files (aiding binary reproducibility), the Poky distribution configuration (DISTRO = "poky") now inherits the reproducible_build class by default.

4.17.5 Impact of ptest feature is now more significant

The Poky distribution configuration (DISTRO = "poky") enables ptests by default to enable runtime testing of various components. In this release, a dependency needed to be added that has resulted in a significant increase in the number of components that will be built just when building a simple image such as core-image-minimal. If you do not need runtime tests enabled for core components, then it is recommended that you remove “ptest” from DISTRO_FEATURES to save a significant amount of build time e.g. by adding the following in your configuration:

DISTRO_FEATURES_remove = "ptest"
4.17.6 Removed recipes

The following recipes have been removed:

  • chkconfig: obsolete

  • console-tools: obsolete

  • enchant: replaced by enchant2

  • foomatic-filters: obsolete

  • libidn: no longer needed, moved to meta-oe

  • libmodulemd: replaced by libmodulemd-v1

  • linux-yocto: drop 4.19, 5.2 version recipes (5.4 now provided)

  • nspr: no longer needed, moved to meta-oe

  • nss: no longer needed, moved to meta-oe

  • python: Python 2 removed (Python 3 preferred)

  • python-setuptools: Python 2 version removed (python3-setuptools preferred)

  • sysprof: no longer needed, moved to meta-oe

  • texi2html: obsolete

  • u-boot-fw-utils: functionally replaced by libubootenv

4.17.7 features_check class replaces distro_features_check

The distro_features_check class has had its functionality expanded, now supporting ANY_OF_MACHINE_FEATURES, REQUIRED_MACHINE_FEATURES, CONFLICT_MACHINE_FEATURES, ANY_OF_COMBINED_FEATURES, REQUIRED_COMBINED_FEATURES, CONFLICT_COMBINED_FEATURES. As a result the class has now been renamed to features_check; the distro_features_check class still exists but generates a warning and redirects to the new class. In preparation for a future removal of the old class it is recommended that you update recipes currently inheriting distro_features_check to inherit features_check instead.

4.17.8 Removed classes

The following classes have been removed:

  • distutils-base: moved to meta-python2

  • distutils: moved to meta-python2

  • libc-common: merged into the glibc recipe as nothing else used it.

  • python-dir: moved to meta-python2

  • pythonnative: moved to meta-python2

  • setuptools: moved to meta-python2

  • tinderclient: dropped as it was obsolete.

4.17.9 SRC_URI checksum behaviour

Previously, recipes by tradition included both SHA256 and MD5 checksums for remotely fetched files in SRC_URI, even though only one is actually mandated. However, the MD5 checksum does not add much given its inherent weakness; thus when a checksum fails only the SHA256 sum will now be printed. The md5sum will still be verified if it is specified.

4.17.10 npm fetcher changes

The npm fetcher has been completely reworked in this release. The npm fetcher now only fetches the package source itself and no longer the dependencies; there is now also an npmsw fetcher which explicitly fetches the shrinkwrap file and the dependencies. This removes the slightly awkward NPM_LOCKDOWN and NPM_SHRINKWRAP variables which pointed to local files; the lockdown file is no longer needed at all. Additionally, the package name in npm:// entries in SRC_URI is now specified using a package parameter instead of the earlier name which overlapped with the generic name parameter. All recipes using the npm fetcher will need to be changed as a result.

An example of the new scheme:

SRC_URI = "npm://registry.npmjs.org;package=array-flatten;version=1.1.1 \
           npmsw://${THISDIR}/npm-shrinkwrap.json"

Another example where the sources are fetched from git rather than an npm repository:

SRC_URI = "git://github.com/foo/bar.git;protocol=https \
           npmsw://${THISDIR}/npm-shrinkwrap.json"

devtool and recipetool have also been updated to match with the npm fetcher changes. Other than producing working and more complete recipes for npm sources, there is also a minor change to the command line for devtool: the --fetch-dev option has been renamed to --npm-dev as it is npm-specific.

4.17.11 Packaging changes
  • intltool has been removed from packagegroup-core-sdk as it is rarely needed to build modern software - gettext can do most of the things it used to be needed for. intltool has also been removed from packagegroup-core-self-hosted as it is not needed to for standard builds.

  • git: git-am, git-difftool, git-submodule, and git-request-pull are no longer perl-based, so are now installed with the main git package instead of within git-perltools.

  • The ldconfig binary built as part of glibc has now been moved to its own ldconfig package (note no glibc- prefix). This package is in the RRECOMMENDS of the main glibc package if ldconfig is present in DISTRO_FEATURES.

  • libevent now splits each shared library into its own package (as Debian does). Since these are shared libraries and will be pulled in through the normal shared library dependency handling, there should be no impact to existing configurations other than less unnecessary libraries being installed in some cases.

  • linux-firmware now has a new package for bcm4366c and includes available NVRAM config files into the bcm43340, bcm43362, bcm43430 and bcm4356-pcie packages.

  • harfbuzz now splits the new libharfbuzz-subset.so library into its own package to reduce the main package size in cases where libharfbuzz-subset.so is not needed.

4.17.12 Additional warnings

Warnings will now be shown at do_package_qa time in the following circumstances:

  • A recipe installs .desktop files containing MimeType keys but does not inherit the new mime-xdg class

  • A recipe installs .xml files into ${datadir}/mime/packages but does not inherit the mime class

4.17.13 wic image type now used instead of live by default for x86

conf/machine/include/x86-base.inc (inherited by most x86 machine configurations) now specifies wic instead of live by default in IMAGE_FSTYPES. The live image type will likely be removed in a future release so it is recommended that you use wic instead.

4.17.14 Miscellaneous changes
  • The undocumented SRC_DISTRIBUTE_LICENSES variable has now been removed in favour of a new AVAILABLE_LICENSES variable which is dynamically set based upon license files found in ${COMMON_LICENSE_DIR} and ${LICENSE_PATH}.

  • The tune definition for big-endian microblaze machines is now microblaze instead of microblazeeb.

  • newlib no longer has built-in syscalls. libgloss should then provide the syscalls, crt0.o and other functions that are no longer part of newlib itself. If you are using TCLIBC = "newlib" this now means that you must link applications with both newlib and libgloss, whereas before newlib would run in many configurations by itself.

4.18 Moving to the Yocto Project 3.2 Release

This section provides migration information for moving to the Yocto Project 3.2 Release from the prior release.

4.18.1 Minimum system requirements

gcc version 6.0 is now required at minimum on the build host. For older host distributions where this is not available, you can use the buildtools-extended-tarball (easily installable using scripts/install-buildtools).

4.18.2 Removed recipes

The following recipes have been removed:

  • bjam-native: replaced by boost-build-native

  • avahi-ui: folded into the main avahi recipe - the GTK UI can be disabled using PACKAGECONFIG for avahi.

  • build-compare: no longer needed with the removal of the packagefeed-stability class

  • dhcp: obsolete, functionally replaced by dhcpcd and kea

  • libmodulemd-v1: replaced by libmodulemd

  • packagegroup-core-device-devel: obsolete

4.18.3 Removed classes

The following classes (.bbclass files) have been removed:

  • spdx: obsolete - the Yocto Project is a strong supporter of SPDX, but this class was old code using a dated approach and had the potential to be misleading. The meta-sdpxscanner layer is a much more modern and active approach to handling this and is recommended as a replacement.

  • packagefeed-stability: this class had become obsolete with the advent of hash equivalence and reproducible builds.

4.18.4 pseudo path filtering and mismatch behaviour

pseudo now operates on a filtered subset of files. This is a significant change to the way pseudo operates within OpenEmbedded - by default, pseudo monitors and logs (adds to its database) any file created or modified whilst in a fakeroot environment. However, there are large numbers of files that we simply don’t care about the permissions of whilst in that fakeroot context, for example ${S}, ${B}, ${T}, ${SSTATE_DIR}, the central sstate control directories, and others.

As of this release, new functionality in pseudo is enabled to ignore these directory trees (controlled using a new PSEUDO_IGNORE_PATHS variable) resulting in a cleaner database with less chance of “stray” mismatches if files are modified outside pseudo context. It also should reduce some overhead from pseudo as the interprocess round trip to the server is avoided.

There is a possible complication where some existing recipe may break, for example, a recipe was found to be writing to ${B}/install for make install in do_install and since ${B} is listed as not to be tracked, there were errors trying to chown root for files in this location. Another example was the tcl recipe where the source directory S is set to a subdirectory of the source tree but files were written out to the directory structure above that subdirectory. For these types of cases in your own recipes, extend PSEUDO_IGNORE_PATHS to cover additional paths that pseudo should not be monitoring.

In addition, pseudo’s behaviour on mismatches has now been changed - rather than doing what turns out to be a rather dangerous “fixup” if it sees a file with a different path but the same inode as another file it has previously seen, pseudo will throw an abort() and direct you to a wiki page that explains how to deal with this.

4.18.5 MLPREFIX now required for multilib when runtime dependencies conditionally added

In order to solve some previously intractable problems with runtime dependencies and multilib, a change was made that now requires the MLPREFIX value to be explicitly prepended to package names being added as dependencies (e.g. in RDEPENDS and RRECOMMENDS values) where the dependency is conditionally added.

If you have anonymous python or in-line python conditionally adding dependencies in your custom recipes, and you intend for those recipes to work with multilib, then you will need to ensure that ${MLPREFIX} is prefixed on the package names in the dependencies, for example (from the glibc recipe):

RRECOMMENDS_${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}"

This also applies when conditionally adding packages to PACKAGES where those packages have dependencies, for example (from the alsa-plugins recipe):

PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pulseaudio', 'alsa-plugins-pulseaudio-conf', '', d)}"
...
RDEPENDS_${PN}-pulseaudio-conf += "\
        ${MLPREFIX}libasound-module-conf-pulse \
        ${MLPREFIX}libasound-module-ctl-pulse \
        ${MLPREFIX}libasound-module-pcm-pulse \
"
4.18.6 packagegroup-core-device-devel no longer included in images built for qemu* machines

packagegroup-core-device-devel was previously added automatically to images built for qemu* machines, however the purpose of the group and what it should contain is no longer clear, and in general, adding userspace development items to images is best done at the image/class level; thus this packagegroup was removed.

This packagegroup previously pulled in the following:

  • distcc-config

  • nfs-export-root

  • bash

  • binutils-symlinks

If you still need any of these in your image built for a qemu* machine then you will add them explicitly to IMAGE_INSTALL or another appropriate place in the dependency chain for your image (if you have not already done so).

4.18.7 DHCP server/client replaced

The dhcp software package has become unmaintained and thus has been functionally replaced by dhcpcd (client) and kea (server). You will need to replace references to the recipe/package names as appropriate - most commonly, at the package level dhcp-client should be replaced by dhcpcd and dhcp-server should be replaced by kea. If you have any custom configuration files for these they will need to be adapted - refer to the upstream documentation for dhcpcd and kea for further details.

4.18.8 Packaging changes
  • python3: the urllib python package has now moved into the core package, as it is used more commonly than just netclient (e.g. email, xml, mimetypes, pydoc). In addition, the pathlib module is now also part of the core package.

  • iptables: iptables-apply and ip6tables-apply have been split out to their own package to avoid a bash dependency in the main iptables package

4.18.9 Package QA check changes

Previously, the following package QA checks triggered warnings, however they can be indicators of genuine underlying problems and are therefore now treated as errors:

In addition, the following new checks were added and default to triggering an error:

  • shebang-size: Check for shebang (#!) lines longer than 128 characters, which can give an error at runtime depending on the operating system.

  • unhandled-features-check: Check if any of the variables supported by the features_check class is set while not inheriting the class itself.

  • missing-update-alternatives: Check if the recipe sets the ALTERNATIVE variable for any of its packages, and does not inherit the update-alternatives class.

  • A trailing slash or duplicated slashes in the value of S or B will now trigger a warning so that they can be removed and path comparisons can be more reliable - remove any instances of these in your recipes if the warning is displayed.

4.18.10 Globbing no longer supported in file:// entries in SRC_URI

Globbing (* and ? wildcards) in file:// URLs within SRC_URI did not properly support file checksums, thus changes to the source files would not always change the do_fetch task checksum, and consequently would not ensure that the changed files would be incorporated in subsequent builds.

Unfortunately it is not practical to make globbing work generically here, so the decision was taken to remove support for globs in file:// URLs. If you have any usage of these in your recipes, then you will now need to either add each of the files that you expect to match explicitly, or alternatively if you still need files to be pulled in dynamically, put the files into a subdirectory and reference that instead.

4.18.11 deploy class now cleans DEPLOYDIR before do_deploy

do_deploy as implemented in the deploy class now cleans up ${DEPLOYDIR} before running, just as do_install cleans up ${D} before running. This reduces the risk of DEPLOYDIR being accidentally contaminated by files from previous runs, possibly even with different config, in case of incremental builds.

Most recipes and classes that inherit the deploy class or interact with do_deploy are unlikely to be affected by this unless they add prefuncs to do_deploy which also put files into ${DEPLOYDIR} - these should be refactored to use do_deploy_prepend instead.

4.18.12 Custom SDK / SDK-style recipes need to include nativesdk-sdk-provides-dummy

All nativesdk packages require /bin/sh due to their postinstall scriptlets, thus this package has to be dummy-provided within the SDK and nativesdk-sdk-provides-dummy now does this. If you have a custom SDK recipe (or your own SDK-style recipe similar to e.g. buildtools-tarball), you will need to ensure nativesdk-sdk-provides-dummy or an equivalent is included in TOOLCHAIN_HOST_TASK.

4.18.13 ld.so.conf now moved back to main glibc package

There are cases where one doesn’t want ldconfig on target (e.g. for read-only root filesystems, it’s rather pointless), yet one still needs /etc/ld.so.conf to be present at image build time:

When some recipe installs libraries to a non-standard location, and therefore installs in a file in /etc/ld.so.conf.d/foo.conf, we need /etc/ld.so.conf containing:

include /etc/ld.so.conf.d/*.conf

in order to get those other locations picked up.

Thus /etc/ld.so.conf is now in the main glibc package so that there’s always an ld.so.conf present when the build-time ldconfig runs towards the end of image construction.

The ld.so.conf and ld.so.conf.d/*.conf files do not take up significant space (at least not compared to the ~700kB ldconfig binary), and they might be needed in case ldconfig is installable, so they are left in place after the image is built. Technically it would be possible to remove them if desired, though it would not be trivial if you still wanted the build-time ldconfig to function (ROOTFS_POSTPROCESS_COMMAND will not work as ldconfig is run after the functions referred to by that variable).

4.18.14 Host DRI drivers now used for GL support within runqemu

runqemu now uses the mesa-native libraries everywhere virgl is used (i.e. when gl, gl-es or egl-headless options are specified), but instructs them to load DRI drivers from the host. Unfortunately this may not work well with proprietary graphics drivers such as those from Nvidia; if you are using such drivers then you may need to switch to an alternative (such as Nouveau in the case of Nvidia hardware) or avoid using the GL options.

4.18.15 initramfs images now use a blank suffix

The reference initramfs images (core-image-minimal-initramfs, core-image-tiny-initramfs and core-image-testmaster-initramfs) now set an empty string for IMAGE_NAME_SUFFIX, which otherwise defaults to ".rootfs". These images aren’t root filesystems and thus the rootfs label didn’t make sense. If you are looking for the output files generated by these image recipes directly then you will need to adapt to the new naming without the .rootfs part.

4.18.16 Image artifact name variables now centralised in image-artifact-names class

The defaults for the following image artifact name variables have been moved from bitbake.conf to a new image-artifact-names class:

Image-related classes now inherit this class, and typically these variables are only referenced within image recipes so those will be unaffected by this change. However if you have references to these variables in either a recipe that is not an image or a class that is enabled globally, then those will now need to be changed to inherit image-artifact-names.

4.18.17 Miscellaneous changes
  • Support for the long-deprecated PACKAGE_GROUP variable has now been removed - replace any remaining instances with FEATURE_PACKAGES.

  • The FILESPATHPKG variable, having been previously deprecated, has now been removed. Replace any remaining references with appropriate use of FILESEXTRAPATHS.

  • Erroneous use of inherit += (instead of INHERIT +=) in a configuration file now triggers an error instead of silently being ignored.

  • ptest support has been removed from the kbd recipe, as upstream has moved to autotest which is difficult to work with in a cross-compilation environment.

  • oe.utils.is_machine_specific() and oe.utils.machine_paths() have been removed as their utility was questionable. In the unlikely event that you have references to these in your own code, then the code will need to be reworked.

  • The i2ctransfer module is now disabled by default when building busybox in order to be consistent with disabling the other i2c tools there. If you do wish the i2ctransfer module to be built in busybox then add CONFIG_I2CTRANSFER=y to your custom busybox configuration.

  • In the Upstream-Status header convention for patches, Accepted has been replaced with Backport as these almost always mean the same thing i.e. the patch is already upstream and may need to be removed in a future recipe upgrade. If you are adding these headers to your own patches then use Backport to indicate that the patch has been sent upstream.

  • The tune-supersparc.inc tune file has been removed as it does not appear to be widely used and no longer works.

5 Source Directory Structure

The Source Directory consists of numerous files, directories and subdirectories; understanding their locations and contents is key to using the Yocto Project effectively. This chapter describes the Source Directory and gives information about those files and directories.

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.

5.1 Top-Level Core Components

This section describes the top-level components of the Source Directory.

5.1.1 bitbake/

This directory includes a copy of BitBake for ease of use. The copy usually matches the current stable BitBake release from the BitBake project. BitBake, a Metadata interpreter, reads the Yocto Project Metadata and runs the tasks defined by that data. Failures are usually caused by errors in your Metadata and not from BitBake itself; consequently, most users do not need to worry about BitBake.

When you run the bitbake command, the main BitBake executable (which resides in the bitbake/bin/ directory) starts. Sourcing the environment setup script (i.e. oe-init-build-env) places the scripts/ and bitbake/bin/ directories (in that order) into the shell’s PATH environment variable.

For more information on BitBake, see the BitBake User Manual.

5.1.2 build/

This directory contains user configuration files and the output generated by the OpenEmbedded build system in its standard configuration where the source tree is combined with the output. The Build Directory is created initially when you source the OpenEmbedded build environment setup script (i.e. oe-init-build-env).

It is also possible to place output and configuration files in a directory separate from the Source Directory by providing a directory name when you source the setup script. For information on separating output from your local Source Directory files (commonly described as an “out of tree” build), see the “oe-init-build-env” section.

5.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.

5.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.)

5.1.5 meta-poky/

Designed above the meta/ content, this directory adds just enough metadata to define the Poky reference distribution.

5.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.

5.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.

5.1.8 meta-skeleton/

This directory contains template recipes for BSP and kernel development.

5.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.

5.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.

5.1.11 LICENSE, README, and README.hardware

These files are standard top-level files.

5.2 The Build Directory - build/

The OpenEmbedded build system creates the Build Directory when you run the build environment setup script oe-init-build-env. If you do not give the Build Directory a specific name when you run the setup script, the name defaults to build/.

For subsequent parsing and processing, the name of the Build directory is available via the TOPDIR variable.

5.2.1 build/buildhistory/

The OpenEmbedded build system creates this directory when you enable build history via the buildhistory class file. The directory organizes build information into image, packages, and SDK subdirectories. For information on the build history feature, see the “Maintaining Build Output Quality” section in the Yocto Project Development Tasks Manual.

5.2.2 build/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.

5.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.

5.2.4 build/cache/sanity_info

This file indicates the state of the sanity checks and is created during the build.

5.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.

5.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.

5.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.

5.2.8 build/tmp/buildstats/

This directory stores the build statistics.

5.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.

5.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.

5.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.

5.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.

5.2.13 build/tmp/deploy/ipk/

This directory receives .ipk packages produced by the build process.

5.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.

5.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
5.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.

5.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.

5.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.

5.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. Beginning with the 2.3 version of the Yocto Project, sysroots exist in recipe-specific WORKDIR directories. Thus, the build/tmp/sysroots/ directory is unused.

Note

The build/tmp/sysroots/ directory can still be populated using the bitbake build-sysroots command and can be used for compatibility in some cases. However, in general it is not recommended to populate this directory. Individual recipe-specific sysroots should be used.

5.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.

5.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.

5.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/.

5.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).

A number of key subdirectories exist 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 a log.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 the do_package task after the output has been split into individual packages. Subdirectories exist for each individual package created by the recipe.

  • ${WORKDIR}/recipe-sysroot: A directory populated with the target dependencies of the recipe. This directory looks like the target filesystem and contains libraries that the recipe might need to link against (e.g. the C library).

  • ${WORKDIR}/recipe-sysroot-native: A directory populated with the native dependencies of the recipe. This directory contains the tools the recipe needs to build (e.g. the compiler, Autoconf, libtool, and so forth).

  • ${WORKDIR}/build: This subdirectory applies only to recipes that support builds where the source is separate from the build artifacts. The OpenEmbedded build system uses this directory as a separate build directory (i.e. ${B}).

5.2.24 build/tmp/work-shared/

For efficiency, the OpenEmbedded build system creates and uses this directory to hold recipes that share a work directory with other recipes. In practice, this is only used for gcc and its variants (e.g. gcc-cross, libgcc, gcc-runtime, and so forth).

5.3 The Metadata - meta/

As mentioned previously, Metadata is the core of the Yocto Project. Metadata has several important subdivisions:

5.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.

5.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.

5.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.

5.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.

5.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.

5.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.

5.3.7 meta/lib/

This directory contains OpenEmbedded Python library code used during the build process.

5.3.8 meta/recipes-bsp/

This directory contains anything linking to specific hardware or hardware configuration information such as “u-boot” and “grub”.

5.3.9 meta/recipes-connectivity/

This directory contains libraries and applications related to communication with other devices.

5.3.10 meta/recipes-core/

This directory contains what is needed to build a basic working Linux image including commonly used dependencies.

5.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.

5.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 or for Linux Standard Base (LSB) compliance.

5.3.13 meta/recipes-gnome/

This directory contains all things related to the GTK+ application framework.

5.3.14 meta/recipes-graphics/

This directory contains X and other graphically related system libraries.

5.3.15 meta/recipes-kernel/

This directory contains the kernel and generic applications and libraries that have strong kernel dependencies.

5.3.16 meta/recipes-lsb4/

This directory contains recipes specifically added to support the Linux Standard Base (LSB) version 4.x.

5.3.17 meta/recipes-multimedia/

This directory contains codecs and support utilities for audio, images and video.

5.3.18 meta/recipes-rt/

This directory contains package and image recipes for using and testing the PREEMPT_RT kernel.

5.3.19 meta/recipes-sato/

This directory contains the Sato demo/reference UI/UX and its associated applications and configuration data.

5.3.20 meta/recipes-support/

This directory contains recipes used by other recipes, but that are not directly included in images (i.e. dependencies of other recipes).

5.3.21 meta/site/

This directory contains a list of cached results for various architectures. Because certain “autoconf” test results cannot be determined when cross-compiling due to the tests not able to run on a live system, the information in this directory is passed to “autoconf” for the various architectures.

5.3.22 meta/recipes.txt

This file is a description of the contents of recipes-*.

6 Classes

Class files are used to abstract common functionality and share it amongst multiple recipe (.bb) files. To use a class file, you simply make sure the recipe inherits the class. In most cases, when a recipe inherits a class it is enough to enable its features. There are cases, however, where in the recipe you might need to set variables or override some default behavior.

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.

6.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.

6.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.

6.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 to configure 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} as DESTDIR.

6.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.

6.5 bash-completion.bbclass

Sets up packaging and dependencies appropriate for recipes that build software that includes bash-completion data.

6.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;subpath=${BP}"

See the “Fetchers” section in the BitBake User Manual for more information on supported BitBake Fetchers.

6.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.

6.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.

6.9 blacklist.bbclass

The blacklist class prevents the OpenEmbedded build system from building specific recipes (blacklists them). To use this class, inherit the class globally and set PNBLACKLIST for each recipe you wish to blacklist. Specify the PN value as a variable flag (varflag) and provide a reason, which is reported, if the package is requested to be built as the value. For example, if you want to blacklist a recipe called “exoticware”, you add the following to your local.conf or distribution configuration:

INHERIT += "blacklist"
PNBLACKLIST[exoticware] = "Not supported by our organization."

6.10 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.

6.11 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.

6.12 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.

6.13 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. However, using the class can lead to unexpected side-effects. Thus, it is recommended that you do not use this class. See http://ccache.samba.org/ for information on the C/C++ Compiler Cache.

6.14 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.

6.15 clutter.bbclass

The clutter class consolidates the major and minor version naming and other common items used by Clutter and related recipes.

Note

Unlike some other classes related to specific libraries, recipes building other software that uses Clutter do not need to inherit this class unless they use the same recipe versioning scheme that the Clutter and related recipes do.

6.16 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.

6.17 cml1.bbclass

The cml1 class provides basic support for the Linux kernel style build configuration system.

6.18 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.

6.19 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.

6.20 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.

6.21 core-image.bbclass

The core-image class provides common definitions for the core-image-* image recipes, such as support for additional IMAGE_FEATURES.

6.22 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 require cpan.bbclass in their recipes.

  • Modules that use Build.PL-based build system require using cpan_build.bbclass in their recipes.

Both build methods inherit the cpan-base class for basic Perl support.

6.23 cross.bbclass

The cross class provides support for the recipes that build the cross-compilation tools.

6.24 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.

6.25 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.

6.26 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.

6.27 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.

6.28 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.

6.29 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"
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).

6.30 distutils*.bbclass

The distutils* classes support recipes for Python version 2.x extensions, which are simple. These recipes usually only need to point to the source’s archive and then inherit the proper class. Building is split into two methods depending on which method the module authors used.

  • Extensions that use an Autotools-based build system require Autotools and the classes based on distutils in their recipes.

  • Extensions that use build systems based on distutils require the distutils class in their recipes.

  • Extensions that use build systems based on setuptools require the setuptools class in their recipes.

The distutils-common-base class is required by some of the distutils* classes to provide common Python2 support.

6.31 distutils3*.bbclass

The distutils3* classes support recipes for Python version 3.x extensions, which are simple. These recipes usually only need to point to the source’s archive and then inherit the proper class. Building is split into three methods depending on which method the module authors used.

  • Extensions that use an Autotools-based build system require Autotools and distutils-based classes in their recipes.

  • Extensions that use distutils-based build systems require the distutils class in their recipes.

  • Extensions that use build systems based on setuptools3 require the setuptools3 class in their recipes.

The distutils3* classes either inherit their corresponding distutils* class or replicate them using a Python3 version instead (e.g. distutils3-base inherits distutils-common-base, which is the same as distutils-base but inherits python3native instead of pythonnative).

6.32 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.

6.33 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:

inherit extrausers
EXTRA_USERS_PARAMS = "\
    useradd -P tester01 tester-jim; \
    useradd -P tester01 tester-sue; \
    "

Finally, here is an example that sets the root password to “1876*18”:

inherit extrausers
EXTRA_USERS_PARAMS = "\
    usermod -P 1876*18 root; \
    "

6.34 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:

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.

6.35 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.

6.36 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.

6.37 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.

6.38 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.

6.39 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.

6.40 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.

6.41 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).

6.42 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.

6.43 gtk-doc.bbclass

The gtk-doc class is a helper class to pull in the appropriate gtk-doc dependencies and disable gtk-doc.

6.44 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.

6.45 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.

6.46 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.

6.47 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 effectively “blacklist” them by listing the recipes and classes using the ICECC_USER_PACKAGE_BL and ICECC_USER_CLASS_BL, 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_USER_PACKAGE_WL 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 = ""

6.48 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 Concpets Manual.

6.49 image-buildinfo.bbclass

The image-buildinfo class writes information to the target filesystem on /etc/build.

6.50 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.

6.51 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.

6.52 image-mklibs.bbclass

The image-mklibs class enables the use of the mklibs utility during the do_rootfs task, which optimizes the size of libraries contained in the image.

By default, the class is enabled in the local.conf.template using the USER_CLASSES variable as follows:

USER_CLASSES ?= "buildstats image-mklibs image-prelink"

6.54 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 exist in order to detect real or potential problems in the packaged output. So exercise caution when disabling these checks.

The following list shows 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 the initscripts-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 on initscripts-functions so that the OpenEmbedded build system is able to ensure that the initscripts recipe is actually built and thus the initscripts-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 the desktop-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. Some very rare cases do exist for dynamically loaded modules where these symlinks are needed instead in the main package.

  • 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 within do_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 of do_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 since libtool 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 the libexecdir 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 in fs-perms.txt that have an invalid format.

  • perm-line: Reports lines in fs-perms.txt that have an invalid format.

  • perm-link: Reports lines in fs-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 since pkg-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 and pkg_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 as FILES_${PN} = "xyz" effectively turn into FILES = "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 the ELF 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 in LICENSE_* 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

    If you are not using runtime package management on your target system, then you do not need to worry about this situation.

  • xorg-driver-abi: Checks that all packages containing Xorg drivers have ABI dependencies. 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 or xorg-driver-video.inc will automatically get these versions. Consequently, you should only need to explicitly add dependencies to binary driver recipes.

6.55 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.

6.56 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.

6.57 kernel-arch.bbclass

The kernel-arch class sets the ARCH environment variable for Linux kernel compilation (including modules).

6.58 kernel-devicetree.bbclass

The kernel-devicetree class, which is inherited by the kernel class, supports device tree generation.

6.59 kernel-fitimage.bbclass

The kernel-fitimage class provides support to pack a kernel Image, device trees and a RAM disk into a single FIT image. In theory, a FIT image can support any number of kernels, RAM disks and device-trees. However, kernel-fitimage currently only supports limited usescases: just one kernel image, an optional RAM disk, and any number of device tree.

To create a FIT image, it is required that KERNEL_CLASSES is set to “kernel-fitimage” and KERNEL_IMAGETYPE is set to “fitImage”.

The options for the device tree compiler passed to mkimage -D feature 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.

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”.

6.60 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.

6.61 kernel-module-split.bbclass

The kernel-module-split class provides common functionality for splitting Linux kernel modules into separate packages.

6.62 kernel-uboot.bbclass

The kernel-uboot class provides support for building from vmlinux-style kernel sources.

6.63 kernel-uimage.bbclass

The kernel-uimage class provides support to pack uImage.

6.64 kernel-yocto.bbclass

The kernel-yocto class provides common functionality for building from linux-yocto style kernel source repositories.

6.65 kernelsrc.bbclass

The kernelsrc class sets the Linux kernel source and version.

6.66 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.

6.67 libc*.bbclass

The libc* classes support recipes that build packages with libc:

  • The libc-common class provides common support for building with libc.

  • The libc-package class supports packaging up glibc and eglibc.

6.68 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.

6.69 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.

6.70 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.

6.71 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.

6.72 meta.bbclass

The meta class is inherited by recipes that do not build any output packages themselves, but act as a “meta” target for building other recipes.

6.73 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.

6.74 migrate_localcount.bbclass

The migrate_localcount class verifies a recipe’s localcount data and increments it appropriately.

6.75 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.

6.76 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.

6.77 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.

6.78 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.

6.79 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.

6.80 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 the native class. If you use this method, you must order the inherit statement in the recipe after all other inherit statements so that the native 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.

6.81 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 the nativesdk class. If you use this method, you must order the inherit statement in the recipe after all other inherit statements so that the nativesdk 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 code exists 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.

6.82 nopackages.bbclass

Disables packaging tasks for those recipes and classes where packaging is not needed.

6.83 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.

6.84 oelint.bbclass

The oelint class is an obsolete lint checking tool that exists in meta/classes in the Source Directory.

A number of classes exist 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.

6.85 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.

6.86 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 p