yocto : create a meta layer by manual procedure

In our another post “Create meta layer using yocto scripts” we seen how you can automatically create meta layer using python scripts from yocto. In this post, we show similar but with manual efforts.

Create a Directory:  Create the directory for your layer. While not strictly required, prepend the name of the folder with the string meta- . For example:

meta-mylayer
meta-GUI_xyz
meta-mymachine

Lets say we want to create, meta-mylayer as name of custom layer.

$ mkdir meta-mylayer

Create a Layer Configuration File: Inside your new layer folder, you need to create a conf/layer.conf file.

$ cd meta-mylayer
$ mkdir conf
$ vim layer.conf
# We have a conf and classes directory, append to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have a recipes directory, add to BBFILES
BBFILES += "${LAYERDIR}/*/*/*.bb ${LAYERDIR}/*/*/*.bbappend ${LAYERDIR}/images/*.bb"

BBFILE_COLLECTIONS += "my-layer"
BBFILE_PATTERN_my-layer := "^${LAYERDIR}/"
BBFILE_PRIORITY_my-layer = "7"

You can also use a layer.conf from our github mata layer.

Here is an explanation of the example:

  • The configuration and classes directory is appended to BBPATH .
  • The recipes for the layers are appended to BBFILES .
  • The BBFILE_COLLECTIONS variable is then appended with the layer name.
  • The BBFILE_PATTERN variable is set to a regular expression and is used to match files from BBFILES into a particular layer. In this case LAYERDIR is used to make BBFILE_PATTERN match within the layer’s a particular layer. In this case, BBFILE_PRIORITY variable then assigns a priority to the layer. Applying priorities is useful in situations where the same recipe might appear in multiple layers and allows you to choose the layer that takes precedence.
  • The LAYERVERSION variable optionally specifies the version of a layer as a single number.
    Note the use of the LAYERDIR variable, which expands to the directory of the current layer.
  • BBPATH variable, BitBake locates class files ( .bbclass ), configuration files, and files that include and require statements. For these cases, BitBake uses the first file that matches the name found in BBPATH . This is similar to the way the PATH variable is used for binaries. It is recommended, Through the use of the are included with therefore, that you use unique class and configuration filenames in your custom layer.

Follow Lynxbee Posts with Google News

Leave a Comment