Skip to content
systemcoding.dev
Embedded Linux

Query one variable quickly with bitbake-getvar

bitbake-getvar prints one variable's value for a recipe without dumping the whole environment, on Scarthgap 5.0.

1 min read
Summarize in AI

The documented way to read a variable is bitbake -e | grep, which parses the recipe, expands thousands of variables and prints them all. bitbake-getvar is the quiet alternative that most guides skip: it does the same expansion and prints only the variable you ask for. With -r it targets a recipe, and --value drops the NAME="..." wrapper so the result can feed a script. This was written for Scarthgap 5.0 with BitBake 2.8.

Shell
bitbake-getvar -r busybox PV
bitbake-getvar -r busybox --value WORKDIR
Text
PV="1.36.1"
/build/tmp/work/cortexa72-poky-linux/busybox/1.36.1

Without -r the command reads the global configuration, which is right for variables such as MACHINE or DL_DIR. Add --flag to read a variable flag and --quiet to suppress the parse messages when the output is parsed by a script. It still starts the BitBake server and parses the layers, so it is faster than -e but not instant. The path above is an example and will differ on your build host.

Also inToolchains
Taggedyocto
Share

More snippets

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.