Making a new layer

Before creating our own layer, it's always a good idea to check whether there is a similar one already available at the following website: http://layers.openembedded.org. If we cannot find a suitable layer for our needs, the next step is to create the directory. Usually, the layer name starts with meta-, but this is not a technical restriction.

The layer configuration file is required in every layer, and is placed in <layer>/conf/layer.conf; we can create it manually using any text editor, or populate it with a script provided in Poky, as shown in the following command:

$ ./poky/scripts/yocto-layer create newlayer

The output is shown in the following screenshot:

With the script, we are asked to enter the value for layer priority and answer other questions regarding the sample content that can be generated for the layer. We can use the default values, or enter a custom one. An example of a generated layer is shown in the following figure:

Important variables that may need to be added in case our layer requires other layers to work are as follows:

  • LAYERVERSION: This is an optional variable that specifies the version of the layer in a single number. This variable is used within the LAYERDEPENDS variable in order to depend on a specific version of a layer, and it must be suffixed with the layer's name, for example, LAYERVERSION_newlayer = "1".
  • LAYERDEPENDS: This lists the layers that the recipes depend upon, separated by spaces. Optionally, we can assign a specific layer version for a dependency by adding it to the end of the layer name with a colon, for example, otherlayer:2. This variable must be suffixed with the name of the specific layer, for example, LAYERDEPENDS_newlayer = "otherlayer".

If a dependency cannot be satisfied, or the version numbers do not match, an error is raised. The base of the layer structure is now created. In the following sections, we will learn how to extend it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.249.105