Creating a new Layer

Revision as of 08:50, 10 April 2013 by PaulEggleton (talk | contribs) (Change link to layer index)

Jump to: navigation, search

Before creating a new layer

Check if someone has already created a layer containing the metadata you're looking for - the layer index is the place where layers are tracked.

How to create a new layer

Creating a layer is simple:

  1. Create a new directory (traditionally meta-<something>)
  2. Create a conf/layer.conf. You can simply copy meta-oe's one and just change "openembedded-layer" to something appropriate for your layer; you may also want to set the priority as appropriate.
  3. Depending on the type of layer, add the content:
    • If the layer is adding support for a machine, add the machine configuration in conf/machine/
    • If the layer is adding distro policy, add the distro configuration in conf/distro/
    • If the layer introduces new recipes, put the recipes you need in recipes-* subdirectories of the layer directory. If you are bringing recipes across from OE-Classic see Migrating metadata to OE-Core.

Best practices

To aid maintainability, the following recommendations are made for creating new layers:

  • Avoid "overlaying" entire recipes from other layers in your configuration (i.e. copying the entire recipe into your layer and modifying it). Use .bbappend files to override the parts of the recipe you need to modify.
  • Avoid duplicating include files - use .bbappends for each recipe that uses the inc file, or if you're introducing a new recipe that requires it, use the full path to refer to the original (e.g. require recipes-core/somepackage/ instead of require If you're finding you have to overlay the inc file it may indicate a deficiency in the inc file in the layer it originally belongs to, which should be addressed instead. An example here would be the way Qt 4 database support plugins are configured - OE-core doesn't have MySQL or PostgreSQL, however meta-oe does, so meta-oe uses .bbappends to modify a variable QT_SQL_DRIVER_FLAGS to enable the appropriate plugins. This variable was added to in OE-core specifically to allow meta-oe to be able to control which plugins are built.