yocto-public/2-usage/layercreate.md

67 lines
1.8 KiB
Markdown
Raw Normal View History

2015-07-21 12:22:25 +00:00
# Creating a Layer
The layer is nothing more than a folder with a single configuration file to indicate its name and where to find its resources.
The layer can be put anywhere on the system.
## Manual creation
There are other ways to create layers that are specific to certain usages (BSP, Distribution, ...), but this is the manual way to create a minimal layer.
```sh
#The path to your layer
LAYER=$POKY/build/meta-mylayer
mkdir $LAYER
cd $LAYER
```
Write `$LAYER/conf/layer.conf` (replace `mylayer` by your layer name):
```sh
BBPATH .= ":${LAYERDIR}"
# Register the layer recipes into the variable BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "mylayer"
BBFILE_PATTERN_mylayer = "^${LAYERDIR}/"
BBFILE_PRIORITY_mylayer = "5"
```
<warn data-markdown>
Once created, you will need to add the layer path in the `BBLAYER` variable, usually defined in `$POKY/build/conf/local.conf`
</warn>
## Layer organization
| Path | Role |
|---|---|
|`conf/layer.conf`| Layer configuration |
|`conf/machine/*.conf`| Machines |
|`conf/distro/*.conf`| Distributions |
|`classes/`| Classes |
|`recipes-*/`| Recipes |
|`README`| Readme file (optional) |
## Layer management tools
```sh
bitbake-layers <command> [arguments]
# Available commands:
# help
# display general help or help on a specified command
# show-recipes
# list available recipes, showing the layer they are provided by
# show-cross-depends
# figure out the dependency between recipes that crosses a layer boundary.
# show-appends
# list bbappend files and recipe files they apply to
# flatten
# flattens layer configuration into a separate output directory.
# show-layers
# show current configured layers
# show-overlayed
# list overlayed recipes (where the same recipe exists in another layer)
```