Understanding local.conf and bblayers.conf in a Yocto Build
local.conf holds your per-build settings and bblayers.conf lists the layers to parse. Here is what each variable does and the order BitBake reads them.

The first time you open a Yocto build directory you find a conf folder with two files in it, and everything you will change in the first month lives in one or the other. They look similar, since both are plain text files with VARIABLE = "value" lines, and beginners often put the same setting in the wrong one and wonder why nothing changes. They do different jobs. One says which layers exist, and the other says how to build with them. This post explains each file line by line, shows the order BitBake reads configuration in, and uses Scarthgap 5.0 LTS with BitBake 2.8 as the reference. The wider picture is in the Yocto cornerstone guide.
Where the two files come from
When you run source oe-init-build-env build, the script copies two templates into build/conf/ if the files do not exist. In Scarthgap those templates live under meta-poky/conf/templates/default/ as local.conf.sample and bblayers.conf.sample. After the first copy, the files in your build directory are yours: the script never overwrites them. If you delete the conf directory, the next source recreates the defaults. That is also the quickest way to see what a clean configuration looks like.
Both files are per build directory. If you want two different configurations, for example one for each board, keep two build directories, each with its own conf/local.conf and conf/bblayers.conf, and select one with source oe-init-build-env build-board-a.
bblayers.conf: which layers exist
bblayers.conf has one job: to tell BitBake which layers to include. A default file looks like this:
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/builder/poky/meta \
/home/builder/poky/meta-poky \
/home/builder/poky/meta-yocto-bsp \
"Taking each variable in turn:
| Variable | Meaning |
|---|---|
POKY_BBLAYERS_CONF_VERSION | A version stamp the sanity checker compares with the layer's expectation, so an old file is flagged after an upgrade |
BBPATH | The directories BitBake searches for configuration, classes and includes; ${TOPDIR} is the build directory |
BBFILES | Which recipe files to parse. It is empty here because each layer adds its own pattern from its layer.conf |
BBLAYERS | The absolute paths of the layers to use, one per line, each ending with a backslash except the last quote |
The trailing backslashes continue the string over several lines. Spaces and newlines separate the entries, and each path must be a directory containing conf/layer.conf. Use absolute paths. Relative paths are resolved against whatever BitBake considers the working directory and cause confusing errors.
Order inside BBLAYERS is not the priority of the layers. Priority comes from each layer's own BBFILE_PRIORITY in its layer.conf. The order matters in smaller ways, such as which layer.conf is processed first, so do not treat it as a way to override recipes.
You rarely edit this file by hand. The bitbake-layers add-layer command inserts a path in the right format, and the next section's neighbour post covers it. A layer you add has to satisfy its own dependencies, declared with LAYERDEPENDS in its layer.conf. If it does not, BitBake stops with an error naming the missing layer.
local.conf: how to build
local.conf holds the settings that apply to every recipe in this build. Strip the comments from the Scarthgap sample, and the active lines are few:
MACHINE ??= "qemux86-64"
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
HALT,${TMPDIR},100M,1K \
HALT,${DL_DIR},100M,1K \
HALT,${SSTATE_DIR},100M,1K \
HALT,/tmp,10M,1K"
CONF_VERSION = "2"What the lines do:
MACHINEselects the hardware target. Changing it switches the whole build to another board or architecture.DISTROselects the distribution policy.PACKAGE_CLASSESpicks the package manager's format:package_rpm,package_ipkorpackage_deb. The first listed also decides which one is used for the root filesystem's package database.EXTRA_IMAGE_FEATURESadds features to every image, heredebug-tweaks(empty root password and other development conveniences).USER_CLASSESinherits extra classes into every recipe.buildstatsrecords task timings undertmp/buildstats/.PATCHRESOLVEcontrols what happens when a patch fails to apply interactively.noopmakes it fail instead of opening a prompt.BB_DISKMON_DIRSmakes BitBake watch free disk space and stop or halt the build before the disk is full.CONF_VERSIONis again a version stamp.
The sample file also holds commented lines for DL_DIR, SSTATE_DIR, TMPDIR and SSTATE_MIRRORS. Uncomment and edit these when you move the downloads or the cache somewhere else.
The assignment operators you will see
The first thing that surprises beginners is ??=, ?=, =, += and the rest. They are not decoration: they decide who wins when two files set the same variable.
| Operator | Meaning |
|---|---|
= | Assign, replacing any earlier value |
?= | Assign only if the variable has no value yet |
??= | Assign only if no value exists after everything else is parsed, a weak default |
+= and =+ | Append or prepend with a space |
:append and :prepend | Append or prepend without adding a space, applied late |
:remove | Remove a word from a list |
The practical rule: a ??= line in a distribution or sample file is a default that anything else can override, a ?= line is a firmer default, and a plain = wins unless something later reassigns it. Because MACHINE ??= "qemux86-64" is the weakest form, setting MACHINE = "raspberrypi4-64" in local.conf below it, or even exporting MACHINE in the shell environment, overrides it. The override syntax in the colon form (:append) is the one introduced in Honister, and the migration post in this series covers it.
The order BitBake reads configuration
Configuration is parsed in a fixed order, and understanding it explains why a setting sometimes appears ignored. In outline:
bblayers.confis read first, from the build directory'sconf/, because BitBake must know the layers before it can read anything else.Each layer's
conf/layer.confis read, in the order ofBBLAYERS.conf/bitbake.conffrom OE-Core is read next. It defines the large baseline of variables, directories and defaults.The machine configuration
conf/machine/<MACHINE>.confand the distributionconf/distro/<DISTRO>.confare read.conf/local.confis read, and then, if present,conf/site.conf.Classes listed in
INHERITandUSER_CLASSESare loaded, and then recipes are parsed.
The actual order is more subtle than this list, and the BitBake manual's section on configuration files describes it precisely at https://docs.yoctoproject.org/bitbake/. The consequence you need now is simple: local.conf is read late, so its plain assignments override the machine and distribution defaults, and bitbake.conf is read early, so it sets what everything else builds on.
A small worked example
Suppose you want a different package format and an extra image feature for this build only. In conf/local.conf:
PACKAGE_CLASSES = "package_ipk"
EXTRA_IMAGE_FEATURES += "ssh-server-dropbear"After changing PACKAGE_CLASSES, the next bitbake core-image-minimal rebuilds the packaging steps for every recipe, because the output format is part of the task signature. It will not recompile the sources. The second line appends a feature, which adds the Dropbear SSH server to the image. You can confirm the final values with the technique in the bitbake -e post:
bitbake -e core-image-minimal | grep -E '^(PACKAGE_CLASSES|EXTRA_IMAGE_FEATURES)='EXTRA_IMAGE_FEATURES="debug-tweaks ssh-server-dropbear"
PACKAGE_CLASSES="package_ipk"What does not belong in these files
Product-specific settings belong in your own layer, not in local.conf. local.conf is not under version control in most projects, and anything a colleague must reproduce has to live in a layer or a distribution configuration. A good split is: bblayers.conf and local.conf describe one developer's build directory, and recipes, machine files and distro files describe the product. Teams that want even those two files reproducible often generate them from a template or from a tool such as kas, which a later post covers.


