Skip to content
systemcoding.dev
Embedded Linux

Trace where a variable was set from bitbake -e history

bitbake -e prints every assignment to a variable above its final value, so you can see which file set it, in Scarthgap 5.0 and later.

1 min read
Summarize in AI

This is the tip for the moment a variable has the wrong value and you do not know which file wrote it. bitbake -e dumps the whole environment for a recipe, and each variable is preceded by comment lines that record its history: every set, append, prepend and override, with the file and line. Filtering the comment lines with sed keeps the output readable, and the final IMAGE_INSTALL= line is the value BitBake actually uses. This was written for Scarthgap 5.0 with BitBake 2.8.

Shell
bitbake -e core-image-minimal | grep -B 8 '^IMAGE_INSTALL=' | sed 's/^# //'
Text
$IMAGE_INSTALL [2 operations]
  set /build/poky/meta/classes-recipe/image.bbclass:34
    "${@bb.utils.contains('IMAGE_FEATURES', 'ssh-server-dropbear', 'dropbear', '', d)}"
  append /build/conf/local.conf:61
    " htop"
pre-expansion value:
  " htop"
IMAGE_INSTALL=" htop"

The history is kept by the data store as the parser reads files, so it names the real source even when an include or a bbappend did the work. File paths and line numbers will differ on your tree. The dump is large and slow on a cold parse; for one variable, bitbake-getvar is quicker.

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.