sbom.rst 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. Creating a Software Bill of Materials
  3. *************************************
  4. Once you are able to build an image for your project, once the licenses for
  5. each software component are all identified (see
  6. ":ref:`dev-manual/licenses:working with licenses`") and once vulnerability
  7. fixes are applied (see ":ref:`dev-manual/vulnerabilities:checking
  8. for vulnerabilities`"), the OpenEmbedded build system can generate
  9. a description of all the components you used, their licenses, their dependencies,
  10. their sources, the changes that were applied to them and the known
  11. vulnerabilities that were fixed.
  12. This description is generated in the form of a *Software Bill of Materials*
  13. (:term:`SBOM`), using the :term:`SPDX` standard.
  14. When you release software, this is the most standard way to provide information
  15. about the Software Supply Chain of your software image and SDK. The
  16. :term:`SBOM` tooling is often used to ensure open source license compliance by
  17. providing the license texts used in the product which legal departments and end
  18. users can read in standardized format.
  19. :term:`SBOM` information is also critical to performing vulnerability exposure
  20. assessments, as all the components used in the Software Supply Chain are listed.
  21. The OpenEmbedded build system doesn't generate such information by default,
  22. though the :term:`Poky` reference distribution has it enabled out of the box.
  23. To enable it, inherit the :ref:`ref-classes-create-spdx` class from a
  24. configuration file::
  25. INHERIT += "create-spdx"
  26. In the :term:`Poky` reference distribution, :term:`SPDX` generation does
  27. consume some build time resources and thus if needed it can be disabled from a
  28. :term:`configuration file`::
  29. INHERIT:remove = "create-spdx"
  30. Upon building an image, you will then get:
  31. - :term:`SPDX` output in JSON format as an ``IMAGE-MACHINE.spdx.json`` file in
  32. ``tmp/deploy/images/MACHINE/`` inside the :term:`Build Directory`.
  33. - This toplevel file is accompanied by an ``IMAGE-MACHINE.spdx.index.json``
  34. containing an index of JSON :term:`SPDX` files for individual recipes.
  35. - The compressed archive ``IMAGE-MACHINE.spdx.tar.zst`` contains the index
  36. and the files for the single recipes.
  37. The :ref:`ref-classes-create-spdx` class offers options to include
  38. more information in the output :term:`SPDX` data:
  39. - Make the json files more human readable by setting (:term:`SPDX_PRETTY`).
  40. - Add compressed archives of the files in the generated target packages by
  41. setting (:term:`SPDX_ARCHIVE_PACKAGED`).
  42. - Add a description of the source files used to generate host tools and target
  43. packages (:term:`SPDX_INCLUDE_SOURCES`)
  44. - Add archives of these source files themselves (:term:`SPDX_ARCHIVE_SOURCES`).
  45. Though the toplevel :term:`SPDX` output is available in
  46. ``tmp/deploy/images/MACHINE/`` inside the :term:`Build Directory`, ancillary
  47. generated files are available in ``tmp/deploy/spdx/MACHINE`` too, such as:
  48. - The individual :term:`SPDX` JSON files in the ``IMAGE-MACHINE.spdx.tar.zst``
  49. archive.
  50. - Compressed archives of the files in the generated target packages,
  51. in ``packages/packagename.tar.zst`` (when :term:`SPDX_ARCHIVE_PACKAGED`
  52. is set).
  53. - Compressed archives of the source files used to build the host tools
  54. and the target packages in ``recipes/recipe-packagename.tar.zst``
  55. (when :term:`SPDX_ARCHIVE_SOURCES` is set). Those are needed to fulfill
  56. "source code access" license requirements.
  57. See also the :term:`SPDX_CUSTOM_ANNOTATION_VARS` variable which allows
  58. to associate custom notes to a recipe.
  59. See the `tools page <https://spdx.dev/resources/tools/>`__ on the :term:`SPDX`
  60. project website for a list of tools to consume and transform the :term:`SPDX`
  61. data generated by the OpenEmbedded build system.
  62. See also Joshua Watt's presentations
  63. `Automated SBoM generation with OpenEmbedded and the Yocto Project <https://youtu.be/Q5UQUM6zxVU>`__
  64. at FOSDEM 2023 and
  65. `SPDX in the Yocto Project <https://fosdem.org/2024/schedule/event/fosdem-2024-3318-spdx-in-the-yocto-project/>`__
  66. at FOSDEM 2024.