What is KAS? Managing Yocto layers and builds with YAML
Grow through practice
No need to finish reading — test nowKAS is a configuration orchestrator for BitBake projects. It does not replace BitBake; it pins repos, layers, machine/distro and local.conf snippets in YAML and generates the build environment.
1. What problem it solves
Manual Yocto setup:
git clone poky
git clone meta-xxx
edit bblayers.conf
edit local.conf
source oe-init-build-env
bitbake core-image-minimal
Problems:
- layer versions/commits live in people's heads;
- changing machines means rewriting local.conf;
- onboarding depends on prose;
- BSP and product config are scattered.
KAS puts this into YAML:
kas.yml
→ fetch repos
→ generate bblayers.conf / local.conf
→ invoke BitBake
2. Minimal configuration
header:
version: 14
machine: qemux86-64
distro: poky
target: core-image-minimal
repos:
poky:
url: https://git.yoctoproject.org/git/poky
commit: 89e6c98d92887913cadf06b2adb97f26cde4849b
layers:
meta:
meta-poky:
meta-yocto-bsp:
local_conf_header:
project: |
EXTRA_IMAGE_FEATURES = "debug-tweaks"
IMAGE_INSTALL:append = " openssh"
Minimal input:
header.version: config format version;machine/distro: written into local.conf;repos: repositories, commits and layers for bblayers;target: BitBake target, defaultcore-image-minimal.
Use the KAS version's documentation for the correct header.version.
3. Common commands
# fetch repos and generate config only
kas checkout kas.yml
# generate config and build the target
kas build kas.yml
# enter a shell with the environment
kas shell kas.yml
# show/dump the final configuration
kas dump kas.yml
# interactive configuration selection
kas menu kas.yml
# generate/update a lockfile
kas lock kas.yml
kas build checks out first, then invokes BitBake. kas shell is for manual debugging.
4. includes: split BSP and product
header:
version: 14
includes:
- base.yml
- bsp.yml
- product.yml
Or include from another repo:
header:
includes:
- repo: meta-bsp
file: kas/bsp.yml
Useful split:
base.yml: distro/tooling;bsp.yml: machine, kernel, drivers;product.yml: image packages, apps, flashing parameters.
5. Lockfile
KAS can pin repositories to exact commits:
kas.yml.lock.yml
During checkout, a lockfile overrides the commit in YAML. Use it for:
- reproducible delivery;
- upstream branch drift;
- CI dependency pinning.
6. local_conf_header and bblayers_conf_header
These are generated content, not separate config files:
local_conf_header→ appended tolocal.conf;bblayers_conf_header→ appended tobblayers.conf.
local_conf_header:
debug: |
EXTRA_IMAGE_FEATURES = "debug-tweaks"
sstate: |
SSTATE_DIR = "${TOPDIR}/../sstate-cache"
Do not manually edit generated build/conf/*; the next checkout can overwrite it.
7. kas-container
kas-container wraps KAS in a container:
kas-container build kas.yml
It mounts the workspace and caches, isolating the build environment from the host. Use KAS_CONTAINER_ENGINE to choose Docker/Podman; rootless setups often prefer Podman.
8. What KAS is not
- Not BitBake: BitBake executes the tasks.
- Not a layer: it declares and fetches layers.
- Not a package manager.
- Not magic reproducibility: host tools, network, sstate, lockfile and external repos still matter.
Verification
- ✅ Official KAS 5.5 docs: Command Line Usage, Project Configuration, Building in a Container.
- ✅ Config semantics: repos/layers, machine/distro/target, includes, local_conf_header, lockfile.
- ⚠️ No full KAS build was run locally; specific version/network combinations were not verified.
- ❓ Not covered: KAS plugin development, complex multiconfig, every container backend difference.
One sentence
KAS turns manual Yocto setup into declarative YAML plus pinned commits; it orchestrates, BitBake builds.
Series: Yocto Build System Notes Related: Practice this page (3 questions) · OpenWrt + Yocto hybrid · Yocto recipe
Comments 0
No comments yet — be the first!