Search code examples
parsingyoctobitbakeopenembedded

How does the parsing of variables in Yocto work?


There are some variables that I just use without knowing what it does. Could someone explain the logic behind all these parsing in Yocto?

What does the underscore do? What are the available arguments other than _append_pn?

PACKAGECONFIG_append_pn-packagename = " packagename"

PREFERRED_VERSION_linux-imx_mx6 = "3.10.17"

SRC_URI_append_toolchain-clang = " file://0004-Remove-clang-unsupported-compiler-flags.patch "

EXTRA_OECONF_append_arm = " --enable-fpm=arm"

How about this one? I know that adding in this way is to single out a package, but how does it work?

LICENSE_FLAGS_WHITELIST_append = " commerical_packagename"

Someone also mentioned something weird with this that worked for them: bitbake: how to add package depending on MACHINE?

IMAGE_INSTALL_append_machine1 += " package1"


Solution

  • The documentation covers this pretty well: https://www.yoctoproject.org/docs/latest/bitbake-user-manual/bitbake-user-manual.html#basic-syntax

    The longer version is that _ introduces an override, which is a way of saying "do something special" instead of just assigning.

    Some are operations such as append and prepend. FOO = "1" FOO_append = "2"

    FOO is now "12" as 2 was appended to 1.

    (_prepend does what you'd expect)

    _remove can be used to remove items from a whitespace-separated list.

      FOO = "1 2 3"
      FOO_remove = "2"
    

    FOO is now "1 3".

    pn_[foo] is an override for a specific recipe name (historical naming, it means package name, but actually refers to the recipe). So your local.conf can do:

    EXTRA_OEMAKE_pn-foo = "bar"
    

    And you've just set EXTRA_OEMAKE for the foo recipe, and just the foo recipe.

    There are other overrides. The architectures all have overrides, so _arm _x86 _mips etc specify that an assignment is specific to those architectures.