Creating a new Layer

From Openembedded.org
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/somefile.inc instead of require somefile.inc). 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 distro layers can use .bbappends for qt4-x11-free and/or qt4-embedded to modify a variable QT_SQL_DRIVER_FLAGS to enable the appropriate plugins. This variable was added to qt4.inc in OE-core specifically to make it easier to enable support for database engines not available in OE-Core.