Re: [yocto] Finer build time dependencies to optimize sysroot preparation time

Alexander Kanavin <[email protected]> Mon, 9 Mar 2026 18:28:48 +0100
Newsgroups org.yoctoproject.lists.yocto
Message-ID <CANNYZj8LmoweAeHmx0pdCePzGV5fEcqOAJntAnkvCfr1Dm80_Q@mail.gmail.com>
On Sat, 7 Mar 2026 at 17:50, Francesco Valla via
lists.yoctoproject.org <[email protected]>
wrote:
> This considered, as a workaround you can remove unwanted components from
> the sysroot of recipe A *after* this has been created, for example
> through a postfunc:
>
> remove_unwanted_components () {
>         # remove X, Y and Z
>         rm ${RECIPE_SYSROOT}${datadir}/my-unwanted-data
> }
> do_prepare_recipe_sysroot[postfuncs] += " remove_unwanted_components"
>
> This is obviously absolutely non portable and does not scale well, but
> should be functional.

There are standard variables that can be used per-recipe to control
what gets installed into a sysroot, so they can be set to install less
than default (or more):
SYSROOT_DIRS
SYSROOT_DIRS_NATIVE
SYSROOT_DIRS_IGNORE

There's plenty of examples in oe-core of how to use them. Defaults are
defined in meta/classes-global/staging.bbclass.

Alex