37 Creating a Software Bill of Materials
Once you are able to build an image for your project, once the licenses for each software component are all identified (see “Working With Licenses”) and once vulnerability fixes are applied (see “Checking for Vulnerabilities”), the OpenEmbedded build system can generate a description of all the components you used, their licenses, their dependencies, their sources, the changes that were applied to them and the known vulnerabilities that were fixed.
This description is generated in the form of a Software Bill of Materials (SBOM), using the SPDX standard.
When you release software, this is the most standard way to provide information about the Software Supply Chain of your software image and SDK. The SBOM tooling is often used to ensure open source license compliance by providing the license texts used in the product which legal departments and end users can read in standardized format.
SBOM information is also critical to performing vulnerability exposure assessments, as all the components used in the Software Supply Chain are listed.
The OpenEmbedded build system generates such information by default (by inheriting the create-spdx class in INHERIT_DISTRO).
If needed, it can be disabled from a configuration file:
INHERIT_DISTRO:remove = "create-spdx"
There are two ways to generate SBOM metadata:
By building an image, you will then get the SPDX output in JSON format as an
IMAGE-MACHINE.spdx.jsonfile intmp/deploy/images/MACHINE/inside the Build Directory.By generating the SBOM document using the recipe metadata only:
$ bitbake <recipe> -c create_recipe_sbom
Note that recipe SBOM is also included in the image SBOM document (for the recipes involved in the build of the image only).
The create-spdx class offers options to include more information in the output SPDX data:
Make the json files more human readable by setting (SPDX_PRETTY).
Add a description of the source files used to generate host tools and target packages (SPDX_INCLUDE_SOURCES)
Add a description of the compiled source files used to generate host tools and target packages (SPDX_INCLUDE_COMPILED_SOURCES)
Export the Linux kernel configuration (
CONFIG_*parameters) into the SPDX document (SPDX_INCLUDE_KERNEL_CONFIG).Export the recipe’s
PACKAGECONFIGfeatures (enabled/disabled) into the SPDX document (SPDX_INCLUDE_PACKAGECONFIG).Exclude specific files from the SPDX output using Python regular expressions (SPDX_FILE_EXCLUDE_PATTERNS).
Attach supplier information to the image SBOM, SDK SBOM, or individual packages (SPDX_IMAGE_SUPPLIER, SPDX_SDK_SUPPLIER, SPDX_PACKAGE_SUPPLIER).
Enrich source downloads with ecosystem-specific Package URLs (PURLs), using the cargo_common, go-mod, pypi, npm, and cpan* classes to automatically populate PURL identifiers for the corresponding language ecosystems.
Record which agent invoked the build and on whose behalf it ran, enabling CI/CD traceability in the SBOM (SPDX_INCLUDE_BITBAKE_PARENT_BUILD, SPDX_INVOKED_BY, SPDX_ON_BEHALF_OF).
See also the SPDX_CUSTOM_ANNOTATION_VARS variable which allows to associate custom notes to a recipe. See the tools page on the SPDX project website for a list of tools to consume and transform the SPDX data generated by the OpenEmbedded build system.
See the definition of the variables starting with SPDX_ in the
Yocto Project Reference Manual glossary for more
information.
See also Joshua Watt’s presentations Automated SBoM generation with OpenEmbedded and the Yocto Project at FOSDEM 2023 and SPDX in the Yocto Project at FOSDEM 2024.