Recipes often need to use files provided by other recipes on the build host. For example, an application linking to a common library needs access to the library itself and its associated headers. The way this access is accomplished is by populating sysroot with files. One sysroot exists per "machine" for which the image is being built. In practical terms, this means a sysroot exists for the target machine, and a sysroot exists for the build host.
STAGING_DIR
variable).
Recipes should never populate the sysroot directly (i.e. write
files into sysroot).
Instead, files should be installed into standard locations
during the
do_install
task within the
${
D
}
directory.
A subset of these files, as defined by the
the SYSROOT_DIRS
variable, automatically populates the sysroot.
The reason for this limitation is that almost all files that
populate the sysroot are cataloged in manifests in order to
ensure the files can be removed later when a recipe is either
modified or removed.
Thus, the sysroot is able to remain free from stale files.
It is possible to modify the list of directories that populate
the sysroot.
The following example shows how you could add the
/opt
directory to the list of
directories:
SYSROOT_DIRS += "/opt"
For information on variables you can use to help control how
files sysroot is populated, see the
SYSROOT_DIRS
,
SYSROOT_DIRS_NATIVE
,
and
SYSROOT_DIRS_BLACKLIST
variables.