9. Metadata Layers

This section contains direct excerpts and quotes from publicly accessible documentation: Metadata, Machine Configuration, and Policy Configuration — © 2010–2021 The Yocto Project.

../_images/layer-input-landscape.png

Figure 9.1 Metadata Layers with Details

In general, three types of layer input exists. You can see them below User Configuration box in Figure 7.1:

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. This layer is for version 5.0 of the popular Qt cross-platform application development framework for desktop, embedded and mobile.

Policy Configuration

Distribution Layers (i.e. Distro Layer in the following Figure 9.1) providing top-level or general policies for the images or SDKs being built for a particular distribution. For example, in the Reference Embedded Distribution (Poky) 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).

Machine BSP Configuration

Board Support Package Layers (i.e. BSP Layer in the following Figure 9.1) providing machine-specific configurations. This type of information is specific to a particular target architecture. A good example of a BSP layer from the Reference Embedded Distribution (Poky) is the meta-yocto-bsp layer.

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.

Hint

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.

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 (.bb), append files (.bbappend), and patches, that your project needs.

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 Project 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 (.bb) and append files (.bbappend) 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.

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.

Attention

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 form factors, graphics support systems, and so forth.

Note

While Figure 9.1 shows several recipes-* directories, not all these directories appear in all BSP layers.