Insight
Yocto BSP hygiene: keep machines, distros, and apps apart
A practical layer layout for embedded Linux — meta-bsp, meta-distro, and meta-software — so board bring-up does not poison every product image.
- Yocto
- Embedded Linux
- BSP
- Software
Framing note: Layering guidance distilled from common Yocto Project BSP and Compatible practices. Illustrative for TriXCore’s insights feed — not a client engagement write-up.
Most painful Yocto trees fail the same way: one “god layer” that mixes machine configs, kernel fragments, init policies, and application recipes. Six months later nobody can upgrade the BSP without breaking the product image — or ship a second board without forking the whole repo.
Three layers, three jobs
Keep responsibilities separate even if they live in one monorepo:
| Layer | Owns | Typical contents |
| --- | --- | --- |
| meta-<board> (BSP) | Hardware bring-up | conf/machine, U-Boot, kernel, firmware blobs, machine-scoped .bbappends |
| meta-<product> (distro) | Userspace policy | init system, users, systemd units, package choices, DISTRO_FEATURES |
| meta-<apps> (software) | Your code | application recipes, services, OTA agents, factory tools |
Poky is a reference distro, not your product. Clone the pattern, then put product policy in your own distro layer.
Do not break other machines
A BSP layer included in bblayers.conf must not silently change builds for machines it does not own.
- Prefer machine overrides (
DEPENDS:myboard = "foo") over blanketDEPENDS = "foo". - Put machine-specific files under paths that only resolve for that
MACHINE. - Prefer small
.bbappends over copying entire upstream recipes into your layer. - Document required layers, licenses, build, and boot steps in the BSP
README— treat that as part of the deliverable.
If you can add the BSP layer and still build an unrelated machine cleanly, you are on the right track. Layer-check tooling exists for a reason; run it before you call the BSP “done.”
Distro vs image recipes
Distro config answers: which init, which libc features, which default packages, which security posture.
Image recipes answer: what goes on this flash partition for this SKU.
Keep SKU variance in image recipes and packagegroups. Keep policy that should apply to every image in the distro. When those two blur, every new SKU becomes a copy-paste fork.
Reproducibility gates
Before you trust a rootfs in the field:
- Pin layers (git SHAs or release tags) and record them next to the image hash.
- Build the same revision twice; compare sstate and image digests.
- Boot to a known userspace marker (version file, os-release fields you control).
- Exercise update / rollback on hardware, not only in QEMU.
What “done” looks like for a BSP handoff
Hand a board team something they can rebuild without tribal knowledge:
- Documented
MACHINEand required layers - Kernel / U-Boot configs that match the schematic revision
- A minimal image that reaches a console and network
- Clear ownership: who accepts patches for the BSP vs the product distro
Separate layers do not slow you down. They are what make the second board, the second SKU, and the next Yocto upgrade survivable.