Create a new layer in Yocto - Manual/Script

What is a layer in Yocto?

A layer contains meta data. meta data means configuration files, classes and recipes. Layers allow you to isolate different type of customizations from each other.

When you clone the poky source code.
$ git clone -b thud git://git.yoctoproject.org/poky.git

You already have the following layers:

  • meta
  • meta-skeleton
  • meta-yocto-bsp
  • meta-poky
  • meta-selftest
You may need to include additional layers as per your requirement for example, if you are building image for raspberry pi3 you need to add the layer: meta-raspberrypi

Two ways to add an existing layer:
1. Manual: Add the existing layer path inside BBLAYERS variable in conf/bblayers.conf file
2. Using script: bitbake-layers add-layer <path to existing layer>. This will update bblayers.conf file.

You can find existing layers on layers.openembedded.org.

If you don't find a layer with the recipes you need, you can also create your own layer. There are two ways to create your own layer.
1. Manually
2. Using script

Manually:
  • Create a directory for the layer. For example: 'meta-mylayer'
  • Inside this directory, create conf/local.conf with the following contents.


Using Script:

Initialize the build environment: source poky/oe-init-build-env build > /dev/null
Run the command 'bitbake-layers create-layer meta-mylayer' to create a new layer automatically


In either of the approach, you need to add this newly created layer in conf/bblayers.conf file for the recipes to be included in the bitbake path.

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

PR, PN and PV Variable in Yocto