This post is part of the series about my
personal
BeagleBone Black project. The
Yocto
tutorial already shows, under "Further Topics", how to create your own
layer with bitbake-layers create-layer, write a recipe, and extend the
kernel via a .bbappend including a device-tree change. That’s plenty for
a hobby project — but once a real product with multiple hardware
revisions, multiple software variants, and a team behind it is involved,
the single-layer approach hits its limits. This post covers what typically
gets added at that point.
Why a single layer isn’t enough
A single meta-mybbb layer mixes three things that actually vary
independently:
Hardware-specific — pinmux, device-tree changes, which kernel drivers are needed (changes per board revision)
Distro policy — which init manager, which C library, which security hardening (changes per product line, not per board)
Application logic — the actual application and its dependencies (changes most frequently, independent of hardware and distro)
The established Yocto convention splits this into three layer types:
| Layer type | Content |
|---|---|
| Board support: machine definitions, kernel `.bbappend`s, device tree |
| Distro policy file ( |
| Application recipes, image definitions |
This three-way split isn’t worth it for every project — for a single board with one firmware variant, the single-layer approach from the main Yocto tutorial is often the more pragmatic choice. The split pays off once at least two of the three dimensions (hardware, distro, application) vary independently of each other. |
Layer priorities and dependencies in detail
Each layer’s conf/layer.conf defines more than just the layer name:
BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "mybbb-bsp"
BBFILE_PATTERN_mybbb-bsp = "^${LAYERDIR}/"
BBFILE_PRIORITY_mybbb-bsp = "8"
LAYERDEPENDS_mybbb-bsp = "core ti-bsp"
LAYERSERIES_COMPAT_mybbb-bsp = "scarthgap"| Parameter | Meaning |
|---|---|
| Decides which layer "wins" when |
| Which other layers must be present — |
| Which Yocto release codenames (here |
A common mistake: two of your own layers (e.g. |
PACKAGECONFIG: toggling recipe features without forking
Many more complex recipes (e.g. for libraries with optional dependencies)
define PACKAGECONFIG flags that let you selectively enable or disable
individual build features without modifying the recipe itself:
# in your own .bbappend, e.g. for a library with optional SSL support
PACKAGECONFIG:append = " ssl"
PACKAGECONFIG[ssl] = "--with-ssl,--without-ssl,openssl"The three comma-separated values in PACKAGECONFIG[<feature>] mean:
configure flag when enabled, configure flag when disabled, additional
build dependency when enabled.
The most reliable way to find out which |
bblayers.conf: ordering pitfalls
bblayers.conf lists all active layers in BBLAYERS. Two points that
regularly cause confusion in practice:
The order in
BBLAYERSitself has no effect on recipe priority — that’s controlled exclusively byBBFILE_PRIORITYinlayer.conf(see above). Many developers first try to solve problems by reorderingbblayers.conf— that leads nowhereA layer listed in
bblayers.confwhoseLAYERDEPENDSaren’t satisfied makes bitbake abort at startup with a clear error message — unlike silent priority conflicts, a comparatively harmless failure mode
Keeping rebuild times under control
Yocto builds are long — which clean command discards how much decides between minutes and hours:
| Command | Effect |
|---|---|
| Only deletes this recipe’s work directories, shared state is kept — fastest rebuild |
| Additionally deletes this recipe’s shared-state cache entries — needed when the task hash doesn’t change but, e.g., a local patch file outside the hash system was modified |
| Additionally deletes downloaded sources — only needed if the source download itself was corrupted |
Applying |
Summary
| Aspect | Key takeaway |
|---|---|
Multi-layer BSP structure | Worth it once hardware, distro policy, and application vary independently — otherwise one layer suffices |
Layer priority | Controls |
PACKAGECONFIG | Allows feature toggling without forking the recipe |
Rebuild time |
|