summaryrefslogtreecommitdiffstats
path: root/documentation/ref-manual/classes.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/ref-manual/classes.rst')
-rw-r--r--documentation/ref-manual/classes.rst590
1 files changed, 463 insertions, 127 deletions
diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
index ab71cbe40c..4705ca3f4d 100644
--- a/documentation/ref-manual/classes.rst
+++ b/documentation/ref-manual/classes.rst
@@ -128,6 +128,43 @@ It's useful to have some idea of how the tasks defined by the
128- :ref:`ref-tasks-install` --- runs ``make install`` and 128- :ref:`ref-tasks-install` --- runs ``make install`` and
129 passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``. 129 passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``.
130 130
131.. _ref-classes-barebox:
132
133``barebox``
134===========
135
136The :ref:`ref-classes-barebox` class manages building the barebox bootloader.
137
138If a file named ``defconfig`` is included in the :term:`SRC_URI`, it will be
139copied to ``.config`` in the build directory and used as the barebox
140configuration.
141Instead of providing a ``defconfig`` file, you can set :term:`BAREBOX_CONFIG`
142to a defconfig provided by the barebox source tree.
143If neither ``defconfig`` nor :term:`BAREBOX_CONFIG` is specified, the class
144will raise an error.
145
146The :ref:`ref-classes-barebox` class supports config fragments and internally
147includes the :ref:`ref-classes-cml1` class to provide `Kconfig
148<https://docs.kernel.org/kbuild/kconfig-language.html>`__ support for
149barebox, enabling tasks such as :ref:`ref-tasks-menuconfig` and
150:ref:`ref-tasks-diffconfig`.
151
152The generated barebox binaries are deployed to
153:term:`DEPLOY_DIR_IMAGE` as well as installed to ``BAREBOX_INSTALL_PATH``
154(``/boot`` by default) making them part of the recipe’s base package.
155This setup supports both using the barebox binaries as independent artifacts
156and installing them into a rootfs.
157:term:`BAREBOX_BINARY` can be used to select a distinct binary to deploy and
158install.
159If ``barebox`` is set as the :term:`EFI_PROVIDER`, the class will leverage
160:oe_git:`conf/image-uefi.conf </openembedded-core/tree/meta/conf/image-uefi.conf>`
161to define the default installation paths and naming conventions.
162
163The compiled-in barebox environment can be extended by adding environment files
164to the ``BAREBOX_ENV_DIR``.
165The ``BAREBOX_FIRMWARE_DIR`` variable allows you to specify the firmware blob
166search directory, enabling loading of additional firmware like TF-A or OP-TEE.
167
131.. _ref-classes-base: 168.. _ref-classes-base:
132 169
133``base`` 170``base``
@@ -159,27 +196,38 @@ software that includes bash-completion data.
159``bin_package`` 196``bin_package``
160=============== 197===============
161 198
162The :ref:`ref-classes-bin-package` class is a helper class for recipes that extract the 199The :ref:`ref-classes-bin-package` class is a helper class for recipes, that
163contents of a binary package (e.g. an RPM) and install those contents 200disables the :ref:`ref-tasks-configure` and :ref:`ref-tasks-compile` tasks and
164rather than building the binary from source. The binary package is 201copies the content of the :term:`S` directory into the :term:`D` directory. This
165extracted and new packages in the configured output package format are 202is useful for installing binary packages (e.g. RPM packages) by passing the
166created. Extraction and installation of proprietary binaries is a good 203package in the :term:`SRC_URI` variable and inheriting this class.
167example use for this class.
168 204
169.. note:: 205For RPMs and other packages that do not contain a subdirectory, you should set
206the :term:`SRC_URI` option ``subdir`` to :term:`BP` so that the contents are
207extracted to the directory expected by the default value of :term:`S`. For
208example::
209
210 SRC_URI = "https://example.com/downloads/somepackage.rpm;subdir=${BP}"
211
212This class can also be used for tarballs. For example::
170 213
171 For RPMs and other packages that do not contain a subdirectory, you 214 SRC_URI = "file://somepackage.tar.xz;subdir=${BP}"
172 should specify an appropriate fetcher parameter to point to the
173 subdirectory. For example, if BitBake is using the Git fetcher (``git://``),
174 the "subpath" parameter limits the checkout to a specific subpath
175 of the tree. Here is an example where ``${BP}`` is used so that the files
176 are extracted into the subdirectory expected by the default value of
177 :term:`S`::
178 215
179 SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=main;subpath=${BP}" 216The :ref:`ref-classes-bin-package` class will copy the extracted content of the
217tarball from :term:`S` to :term:`D`.
180 218
181 See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for 219This class assumes that the content of the package as installed in :term:`S`
182 more information on supported BitBake Fetchers. 220mirrors the expected layout once installed on the target, which is generally the
221case for binary packages. For example, an RPM package for a library would
222usually contain the ``usr/lib`` directory, and should be extracted to
223``${S}/usr/lib/<library>.so.<version>`` to be installed in :term:`D` correctly.
224
225.. note::
226
227 The extraction of the package passed in :term:`SRC_URI` is not handled by the
228 :ref:`ref-classes-bin-package` class, but rather by the appropriate
229 :ref:`fetcher <bitbake-user-manual/bitbake-user-manual-fetching:fetchers>`
230 depending on the file extension.
183 231
184.. _ref-classes-binconfig: 232.. _ref-classes-binconfig:
185 233
@@ -552,7 +600,7 @@ You can also look for vulnerabilities in specific packages by passing
552``-c cve_check`` to BitBake. 600``-c cve_check`` to BitBake.
553 601
554After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve`` 602After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
555and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files. 603and image specific summaries in ``tmp/deploy/images/*.json`` files.
556 604
557When building, the CVE checker will emit build time warnings for any detected 605When building, the CVE checker will emit build time warnings for any detected
558issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component 606issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
@@ -564,6 +612,13 @@ The ``Patched`` state of a CVE issue is detected from patch files with the forma
564``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using 612``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
565CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file. 613CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
566 614
615.. note::
616
617 Commit message metadata (``CVE: CVE-ID`` in a patch header) will not be scanned
618 in any patches that are remote, i.e. that are anything other than local files
619 referenced via ``file://`` in SRC_URI. However, a ``CVE-ID`` in a remote patch
620 file name itself will be registered.
621
567If the recipe adds ``CVE-ID`` as flag of the :term:`CVE_STATUS` variable with status 622If the recipe adds ``CVE-ID`` as flag of the :term:`CVE_STATUS` variable with status
568mapped to ``Ignored``, then the CVE state is reported as ``Ignored``:: 623mapped to ``Ignored``, then the CVE state is reported as ``Ignored``::
569 624
@@ -596,6 +651,15 @@ You will find some more details in the
596":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`" 651":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`"
597section in the Development Tasks Manual. 652section in the Development Tasks Manual.
598 653
654.. _ref-classes-cython:
655
656``cython``
657==========
658
659The :ref:`ref-classes-cython` class can be used by Python recipes that require
660`Cython <https://cython.org/>`__ as part of their build dependencies
661(:term:`DEPENDS`).
662
599.. _ref-classes-debian: 663.. _ref-classes-debian:
600 664
601``debian`` 665``debian``
@@ -665,7 +729,7 @@ The padding size can be modified by setting :term:`DT_PADDING_SIZE`
665to the desired size, in bytes. 729to the desired size, in bytes.
666 730
667See :oe_git:`devicetree.bbclass sources 731See :oe_git:`devicetree.bbclass sources
668</openembedded-core/tree/meta/classes-recipe/devicetree.bbclass>` 732</openembedded-core/tree/meta/classes-recipe/devicetree.bbclass>`
669for further variables controlling this class. 733for further variables controlling this class.
670 734
671Here is an excerpt of an example ``recipes-kernel/linux/devicetree-acme.bb`` 735Here is an excerpt of an example ``recipes-kernel/linux/devicetree-acme.bb``
@@ -939,6 +1003,20 @@ The :ref:`ref-classes-go-mod` class allows to use Go modules, and inherits the
939 1003
940See the associated :term:`GO_WORKDIR` variable. 1004See the associated :term:`GO_WORKDIR` variable.
941 1005
1006.. _ref-classes-go-vendor:
1007
1008``go-vendor``
1009=============
1010
1011The :ref:`ref-classes-go-vendor` class implements support for offline builds,
1012also known as Go vendoring. In such a scenario, the module dependencias are
1013downloaded during the :ref:`ref-tasks-fetch` task rather than when modules are
1014imported, thus being coherent with Yocto's concept of fetching every source
1015beforehand.
1016
1017The dependencies are unpacked into the modules' ``vendor`` directory, where a
1018manifest file is generated.
1019
942.. _ref-classes-gobject-introspection: 1020.. _ref-classes-gobject-introspection:
943 1021
944``gobject-introspection`` 1022``gobject-introspection``
@@ -970,6 +1048,7 @@ This class supports several variables:
970 1048
971- :term:`INITRD`: Indicates list of filesystem images to 1049- :term:`INITRD`: Indicates list of filesystem images to
972 concatenate and use as an initial RAM disk (initrd) (optional). 1050 concatenate and use as an initial RAM disk (initrd) (optional).
1051 Can be specified for each ``LABEL``.
973 1052
974- :term:`ROOTFS`: Indicates a filesystem image to include 1053- :term:`ROOTFS`: Indicates a filesystem image to include
975 as the root filesystem (optional). 1054 as the root filesystem (optional).
@@ -983,6 +1062,9 @@ This class supports several variables:
983- :term:`APPEND`: An override list of append strings for 1062- :term:`APPEND`: An override list of append strings for
984 each ``LABEL``. 1063 each ``LABEL``.
985 1064
1065- :term:`GRUB_TITLE`: A custom title for each ``LABEL``. If a label does not
1066 have a custom title, the label is used as title for the GRUB menu entry.
1067
986- :term:`GRUB_OPTS`: Additional options to add to the 1068- :term:`GRUB_OPTS`: Additional options to add to the
987 configuration (optional). Options are delimited using semi-colon 1069 configuration (optional). Options are delimited using semi-colon
988 characters (``;``). 1070 characters (``;``).
@@ -990,6 +1072,18 @@ This class supports several variables:
990- :term:`GRUB_TIMEOUT`: Timeout before executing 1072- :term:`GRUB_TIMEOUT`: Timeout before executing
991 the default ``LABEL`` (optional). 1073 the default ``LABEL`` (optional).
992 1074
1075Each ``LABEL`` defined in the :term:`LABELS` variable creates a GRUB boot
1076entry, and some variables can be defined individually per ``LABEL``. The label
1077specific override names are defined as ``grub_LABEL``.
1078
1079For example, for a label ``factory``, the override name would be
1080``grub_factory``. A custom GRUB menu entry titled "Factory Install" with the
1081additional parameter ``factory=yes`` can be achieved as follows::
1082
1083 LABELS:append = " factory"
1084 APPEND:grub_factory = "factory=yes"
1085 GRUB_TITLE:grub_factory = "Factory Install"
1086
993.. _ref-classes-gsettings: 1087.. _ref-classes-gsettings:
994 1088
995``gsettings`` 1089``gsettings``
@@ -1440,12 +1534,11 @@ The tests you can list with the :term:`WARN_QA` and
1440- ``patch-fuzz:`` Checks for fuzz in patch files that may allow 1534- ``patch-fuzz:`` Checks for fuzz in patch files that may allow
1441 them to apply incorrectly if the underlying code changes. 1535 them to apply incorrectly if the underlying code changes.
1442 1536
1443- ``patch-status-core:`` Checks that the Upstream-Status is specified 1537- ``patch-status:`` Checks that the ``Upstream-Status`` is specified and valid
1444 and valid in the headers of patches for recipes in the OE-Core layer. 1538 in the headers of patches for recipes.
1445 1539
1446- ``patch-status-noncore:`` Checks that the Upstream-Status is specified 1540- ``pep517-backend:`` checks that a recipe inheriting
1447 and valid in the headers of patches for recipes in layers other than 1541 :ref:`ref-classes-setuptools3` has a PEP517-compliant backend.
1448 OE-Core.
1449 1542
1450- ``perllocalpod:`` Checks for ``perllocal.pod`` being erroneously 1543- ``perllocalpod:`` Checks for ``perllocal.pod`` being erroneously
1451 installed and packaged by a recipe. 1544 installed and packaged by a recipe.
@@ -1498,6 +1591,10 @@ The tests you can list with the :term:`WARN_QA` and
1498 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively 1591 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
1499 turn into ``FILES = "xyz"``. 1592 turn into ``FILES = "xyz"``.
1500 1593
1594- ``recipe-naming:`` Checks that the recipe name and recipe class match, so
1595 that ``*-native`` recipes inherit :ref:`ref-classes-native` and
1596 ``nativesdk-*`` recipes inherit :ref:`ref-classes-nativesdk`.
1597
1501- ``rpaths:`` Checks for rpaths in the binaries that contain build 1598- ``rpaths:`` Checks for rpaths in the binaries that contain build
1502 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath`` 1599 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
1503 options are being passed to the linker commands and your binaries 1600 options are being passed to the linker commands and your binaries
@@ -1568,6 +1665,12 @@ The tests you can list with the :term:`WARN_QA` and
1568 This is only relevant when you are using runtime package management 1665 This is only relevant when you are using runtime package management
1569 on your target system. 1666 on your target system.
1570 1667
1668- ``virtual-slash:`` Checks to see if ``virtual/`` is being used in
1669 :term:`RDEPENDS` or :term:`RPROVIDES`, which is not good practice ---
1670 ``virtual/`` is a convention intended for use in the build context
1671 (i.e. :term:`PROVIDES` and :term:`DEPENDS`) rather than the runtime
1672 context.
1673
1571- ``xorg-driver-abi:`` Checks that all packages containing Xorg 1674- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1572 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides 1675 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1573 driver ABI names. All drivers should depend on the ABI versions that 1676 driver ABI names. All drivers should depend on the ABI versions that
@@ -1633,77 +1736,158 @@ Its behavior is mainly controlled by the following variables:
1633- :term:`KERNEL_DTC_FLAGS`: flags for ``dtc``, the Device Tree Compiler 1736- :term:`KERNEL_DTC_FLAGS`: flags for ``dtc``, the Device Tree Compiler
1634- :term:`KERNEL_PACKAGE_NAME`: base name of the kernel packages 1737- :term:`KERNEL_PACKAGE_NAME`: base name of the kernel packages
1635 1738
1636.. _ref-classes-kernel-fitimage: 1739.. _ref-classes-kernel-fit-image:
1637 1740
1638``kernel-fitimage`` 1741``kernel-fit-image``
1639=================== 1742====================
1640 1743
1641The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image, 1744The :ref:`ref-classes-kernel-fit-image` class provides support to pack a kernel image,
1642device trees, a U-boot script, an :term:`Initramfs` bundle and a RAM disk 1745device trees, a U-boot script, and an :term:`Initramfs` into a single FIT image.
1643into a single FIT image. In theory, a FIT image can support any number 1746In theory, a FIT image can support any number of kernels, U-boot scripts,
1644of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees. 1747:term:`Initramfs`, and device trees.
1645However, :ref:`ref-classes-kernel-fitimage` currently only supports 1748However, :ref:`ref-classes-kernel-fit-image` currently only supports
1646limited usecases: just one kernel image, an optional U-boot script, 1749limited usecases: just one kernel image, an optional U-boot script,
1647an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of 1750an optional :term:`Initramfs`, and any number of device trees.
1648device trees. 1751
1649 1752The FIT image is created by a recipe which inherits the
1650To create a FIT image, it is required that :term:`KERNEL_CLASSES` 1753:ref:`ref-classes-kernel-fit-image` class.
1651is set to include ":ref:`ref-classes-kernel-fitimage`" and one of :term:`KERNEL_IMAGETYPE`, 1754One such example is the ``linux-yocto-fitimage`` recipe which creates a FIT
1652:term:`KERNEL_ALT_IMAGETYPE` or :term:`KERNEL_IMAGETYPES` to include "fitImage". 1755image for the Linux Yocto kernel.
1653 1756Additionally, it is required that :term:`KERNEL_CLASSES` is set to include
1654The options for the device tree compiler passed to ``mkimage -D`` 1757:ref:`ref-classes-kernel-fit-extra-artifacts`.
1655when creating the FIT image are specified using the 1758The :ref:`ref-classes-kernel-fit-extra-artifacts` class exposes the required kernel
1656:term:`UBOOT_MKIMAGE_DTCOPTS` variable. 1759artifacts to the :term:`DEPLOY_DIR_IMAGE` which are used by the
1657 1760:ref:`ref-classes-kernel-fit-image` class to create the FIT image.
1658Only a single kernel can be added to the FIT image created by 1761
1659:ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The 1762The simplest example for building a FIT image is to add::
1660address where the kernel image is to be loaded by U-Boot is 1763
1661specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by 1764 KERNEL_CLASSES += "kernel-fit-extra-artifacts"
1662:term:`UBOOT_ENTRYPOINT`. Setting :term:`FIT_ADDRESS_CELLS` to "2" 1765
1663is necessary if such addresses are 64 bit ones. 1766to the machine :term:`configuration file` and to execute::
1664 1767
1665Multiple device trees can be added to the FIT image created by 1768 bitbake linux-yocto-fitimage
1666:ref:`ref-classes-kernel-fitimage` and the device tree is optional. 1769
1667The address where the device tree is to be loaded by U-Boot is 1770This results in a ``fitImage`` file deployed to the :term:`DEPLOY_DIR_IMAGE`
1668specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays 1771directory and a ``linux-yocto-fitimage`` package which can be installed.
1669and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries. 1772
1670 1773The same approach works for all variants of the ``linux-yocto`` kernel.
1671Only a single RAM disk can be added to the FIT image created by 1774For example, if the ``linux-yocto-rt`` kernel should be used, add the following
1672:ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional. 1775lines to the machine configuration file::
1673The address where the RAM disk image is to be loaded by U-Boot 1776
1674is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by 1777 KERNEL_CLASSES += "kernel-fit-extra-artifacts"
1675:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to the FIT image when 1778 PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-rt"
1676:term:`INITRAMFS_IMAGE` is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE` 1779
1677is not set to 1. 1780The FIT image, this time including the RT kernel, is built again by calling::
1678 1781
1679Only a single :term:`Initramfs` bundle can be added to the FIT image created by 1782 bitbake linux-yocto-fitimage
1680:ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional. 1783
1681In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem 1784For other kernels provided by other layers, the same approach would work.
1682in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin). 1785However, it is usually more intuitive to add a custom FIT image recipe next to
1683When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem. 1786the custom kernel recipe.
1684The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE` 1787For example, if a layer provides a ``linux-vanilla`` recipe, a
1685is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1. 1788``linux-vanilla-fitimage`` recipe may be added as well.
1686The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified 1789The ``linux-vanilla-fitimage`` recipe can be created as a customized copy of
1687by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`. 1790the ``linux-yocto-fitimage`` recipe.
1688 1791
1689Only a single U-boot boot script can be added to the FIT image created by 1792Usually the kernel is built as a dependency of an image.
1690:ref:`ref-classes-kernel-fitimage` and the boot script is optional. 1793If the FIT image should be used as a replacement for the kernel image which
1691The boot script is specified in the ITS file as a text file containing 1794is installed in the root filesystem, then the following variables can be set
1692U-boot commands. When using a boot script the user should configure the 1795e.g. in the machine configuration file::
1693U-boot :ref:`ref-tasks-install` task to copy the script to sysroot. 1796
1694So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage` 1797 # Create and deploy the vmlinux artifact which gets included into the FIT image
1695class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to 1798 KERNEL_CLASSES += "kernel-fit-extra-artifacts"
1696load the boot script from the FIT image and execute it. 1799
1697 1800 # Do not install the kernel image package
1698The FIT image generated by the :ref:`ref-classes-kernel-fitimage` class is signed when the 1801 RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base = ""
1699variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`, 1802 # Install the FIT image package
1700:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set 1803 MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "linux-yocto-fitimage"
1701appropriately. The default values used for :term:`FIT_HASH_ALG` and 1804
1702:term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and 1805 # Configure the image.bbclass to depend on the FIT image instead of only
1703"rsa2048" respectively. The keys for signing the FIT image can be generated using 1806 # the kernel to ensure the FIT image is built and deployed with the image
1704the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and 1807 KERNEL_DEPLOY_DEPEND = "linux-yocto-fitimage:do_deploy"
1705:term:`UBOOT_SIGN_ENABLE` are set to "1". 1808
1706 1809The :ref:`ref-classes-kernel-fit-image` class processes several variables that
1810allow configuration:
1811
1812- The options for the device tree compiler passed to ``mkimage -D``
1813 when creating the FIT image are specified using the
1814 :term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1815
1816- Only a single kernel can be added to the FIT image created by
1817 :ref:`ref-classes-kernel-fit-image` and it is a mandatory component of the
1818 FIT image.
1819 The address where the kernel image is to be loaded by U-Boot is
1820 specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
1821 :term:`UBOOT_ENTRYPOINT`. Setting :term:`FIT_ADDRESS_CELLS` to "2"
1822 is necessary if such addresses are 64 bit ones.
1823
1824- Multiple device trees can be added to the FIT image created by
1825 :ref:`ref-classes-kernel-fit-image` and the device tree is optional.
1826 The address where the device tree is to be loaded by U-Boot is
1827 specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
1828 and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
1829
1830- Only a single :term:`Initramfs` can be added to the FIT image created by
1831 :ref:`ref-classes-kernel-fit-image`. The :term:`Initramfs` in FIT is optional.
1832 The address where the RAM disk image is to be loaded by U-Boot
1833 is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
1834 :term:`UBOOT_RD_ENTRYPOINT`. The :term:`Initramfs` is added to the FIT image
1835 when :term:`INITRAMFS_IMAGE` is specified.
1836
1837- It's recommended to add the :term:`Initramfs` and the kernel image as
1838 independent image nodes to the FIT image.
1839 Bundling a RAM disk image with the kernel image and including the bundle
1840 (:term:`INITRAMFS_IMAGE_BUNDLE` set to "1") in the FIT image is possible.
1841 However, this approach has the disadvantage that any change to the RAM
1842 disk image necessitates rebuilding the kernel image.
1843 This process requires the full kernel build directory, which is kind of
1844 incompatible with the :term:`SSTATE_DIR` and, consequently, with SDKs.
1845
1846- Only a single U-Boot boot script can be added to the FIT image created by
1847 :ref:`ref-classes-kernel-fit-image`. The boot script is optional.
1848 The boot script is specified in the ITS file as a text file containing
1849 U-Boot commands. When using a boot script the recipe which inherits the
1850 :ref:`ref-classes-kernel-fit-image` class should add the script to
1851 :term:`SRC_URI` and set the :term:`FIT_UBOOT_ENV` variable to the name of the
1852 file like the following::
1853
1854 FIT_UBOOT_ENV = "boot.txt"
1855 SRC_URI += "file://${FIT_UBOOT_ENV}"
1856
1857 At run-time, U-boot's boot command can be configured to load the boot script
1858 from the FIT image and source it.
1859
1860- The FIT image generated by the :ref:`ref-classes-kernel-fit-image` class is signed when the
1861 variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1862 :term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1863 appropriately. The default values used for :term:`FIT_HASH_ALG` and
1864 :term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fit-image` are "sha256" and
1865 "rsa2048" respectively. The keys for signing the FIT image can be generated using
1866 the :ref:`ref-classes-kernel-fit-image` class when both :term:`FIT_GENERATE_KEYS` and
1867 :term:`UBOOT_SIGN_ENABLE` are set to "1".
1868
1869.. _ref-classes-kernel-fit-extra-artifacts:
1870
1871``kernel-fit-extra-artifacts``
1872==============================
1873
1874The :ref:`ref-classes-kernel-fit-extra-artifacts` class exposes the required
1875kernel artifacts to the :term:`DEPLOY_DIR_IMAGE` directory.
1876These artifacts are used by the :ref:`ref-classes-kernel-fit-image` class to
1877create a FIT image that can include the kernel, device trees, an optional
1878U-Boot script, and an optional Initramfs.
1879
1880This class is typically included by adding it to the :term:`KERNEL_CLASSES`
1881variable in your kernel recipe or machine configuration when building FIT images.
1882It ensures that all necessary files are available for packaging into the FIT image,
1883such as the kernel binary, device tree blobs (DTBs), and other related files.
1884
1885For example, to enable this class, set::
1886
1887 KERNEL_CLASSES += "kernel-fit-extra-artifacts"
1888
1889This is required when using the :ref:`ref-classes-kernel-fit-image` class to
1890generate FIT images for your kernel.
1707 1891
1708.. _ref-classes-kernel-grub: 1892.. _ref-classes-kernel-grub:
1709 1893
@@ -1840,14 +2024,6 @@ each layer before starting every build. The :ref:`ref-classes-metadata_scm`
1840class is enabled by default because it is inherited by the 2024class is enabled by default because it is inherited by the
1841:ref:`ref-classes-base` class. 2025:ref:`ref-classes-base` class.
1842 2026
1843.. _ref-classes-migrate_localcount:
1844
1845``migrate_localcount``
1846======================
1847
1848The :ref:`ref-classes-migrate_localcount` class verifies a recipe's localcount data and
1849increments it appropriately.
1850
1851.. _ref-classes-mime: 2027.. _ref-classes-mime:
1852 2028
1853``mime`` 2029``mime``
@@ -1959,7 +2135,8 @@ a couple different ways:
1959 Not using this naming convention can lead to subtle problems 2135 Not using this naming convention can lead to subtle problems
1960 caused by existing code that depends on that naming convention. 2136 caused by existing code that depends on that naming convention.
1961 2137
1962- Create or modify a target recipe that contains the following:: 2138- Or, create a :ref:`ref-classes-native` variant of any target recipe (e.g.
2139 ``myrecipe.bb``) by adding the following to the recipe::
1963 2140
1964 BBCLASSEXTEND = "native" 2141 BBCLASSEXTEND = "native"
1965 2142
@@ -1990,24 +2167,25 @@ couple different ways:
1990 inherit statement in the recipe after all other inherit statements so 2167 inherit statement in the recipe after all other inherit statements so
1991 that the :ref:`ref-classes-nativesdk` class is inherited last. 2168 that the :ref:`ref-classes-nativesdk` class is inherited last.
1992 2169
1993- Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following:: 2170 .. note::
1994 2171
1995 BBCLASSEXTEND = "nativesdk" 2172 When creating a recipe, you must follow this naming convention::
1996 2173
1997 Inside the 2174 nativesdk-myrecipe.bb
1998 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
1999 specify any functionality specific to the respective SDK machine or
2000 target case.
2001 2175
2002.. note::
2003 2176
2004 When creating a recipe, you must follow this naming convention:: 2177 Not doing so can lead to subtle problems because there is code that
2178 depends on the naming convention.
2005 2179
2006 nativesdk-myrecipe.bb 2180- Or, create a :ref:`ref-classes-nativesdk` variant of any target recipe (e.g.
2181 ``myrecipe.bb``) by adding the following to the recipe::
2007 2182
2183 BBCLASSEXTEND = "nativesdk"
2008 2184
2009 Not doing so can lead to subtle problems because there is code that 2185 Inside the
2010 depends on the naming convention. 2186 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
2187 specify any functionality specific to the respective SDK machine or
2188 target case.
2011 2189
2012Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both 2190Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both
2013methods. The advantage of the second method is that you do not need to 2191methods. The advantage of the second method is that you do not need to
@@ -2022,6 +2200,14 @@ and the target. All common parts of the recipe are automatically shared.
2022Disables packaging tasks for those recipes and classes where packaging 2200Disables packaging tasks for those recipes and classes where packaging
2023is not needed. 2201is not needed.
2024 2202
2203.. _ref-classes-nospdx:
2204
2205``nospdx``
2206==========
2207
2208The :ref:`ref-classes-nospdx` allows a recipe to opt out of SPDX
2209generation provided by :ref:`ref-classes-create-spdx`.
2210
2025.. _ref-classes-npm: 2211.. _ref-classes-npm:
2026 2212
2027``npm`` 2213``npm``
@@ -2360,6 +2546,24 @@ Python modules built with ``flit_core.buildapi`` are pure Python (no
2360 2546
2361Internally this uses the :ref:`ref-classes-python_pep517` class. 2547Internally this uses the :ref:`ref-classes-python_pep517` class.
2362 2548
2549.. _ref-classes-python_maturin:
2550
2551``python_maturin``
2552==================
2553
2554The :ref:`ref-classes-python_maturin` class provides support for python-maturin, a replacement
2555for setuptools_rust and another "backend" for building Python Wheels.
2556
2557.. _ref-classes-python_mesonpy:
2558
2559``python_mesonpy``
2560==================
2561
2562The :ref:`ref-classes-python_mesonpy` class enables building Python modules which use the
2563meson-python build system.
2564
2565Internally this uses the :ref:`ref-classes-python_pep517` class.
2566
2363.. _ref-classes-python_pep517: 2567.. _ref-classes-python_pep517:
2364 2568
2365``python_pep517`` 2569``python_pep517``
@@ -2563,7 +2767,7 @@ runtime tests for recipes that build software that provides these tests.
2563This class is intended to be inherited by individual recipes. However, 2767This class is intended to be inherited by individual recipes. However,
2564the class' functionality is largely disabled unless "ptest" appears in 2768the class' functionality is largely disabled unless "ptest" appears in
2565:term:`DISTRO_FEATURES`. See the 2769:term:`DISTRO_FEATURES`. See the
2566":ref:`dev-manual/packages:testing packages with ptest`" 2770":ref:`test-manual/ptest:testing packages with ptest`"
2567section in the Yocto Project Development Tasks Manual for more information 2771section in the Yocto Project Development Tasks Manual for more information
2568on ptest. 2772on ptest.
2569 2773
@@ -2587,9 +2791,23 @@ Enables package tests (ptests) specifically for GNOME packages, which
2587have tests intended to be executed with ``gnome-desktop-testing``. 2791have tests intended to be executed with ``gnome-desktop-testing``.
2588 2792
2589For information on setting up and running ptests, see the 2793For information on setting up and running ptests, see the
2590":ref:`dev-manual/packages:testing packages with ptest`" 2794":ref:`test-manual/ptest:testing packages with ptest`"
2591section in the Yocto Project Development Tasks Manual. 2795section in the Yocto Project Development Tasks Manual.
2592 2796
2797.. _ref-classes-ptest-python-pytest:
2798
2799``ptest-python-pytest``
2800=======================
2801
2802The :ref:`ref-classes-ptest-python-pytest` class can be inherited in Python-based
2803recipes to automatically configure the :ref:`ref-classes-ptest` class for Python
2804packages leveraging the `pytest <https://docs.pytest.org>`__ unit test framework.
2805
2806Within the recipe, the :term:`PTEST_PYTEST_DIR` variable specifies the path to
2807the directory containing the tests that will be installed in :term:`D` by the
2808:ref:`ref-tasks-install_ptest_base` task, as well as a specific ``run-ptest``
2809script for this task.
2810
2593.. _ref-classes-python3-dir: 2811.. _ref-classes-python3-dir:
2594 2812
2595``python3-dir`` 2813``python3-dir``
@@ -2683,6 +2901,23 @@ commit, and log. From the information, report files using a JSON format
2683are created and stored in 2901are created and stored in
2684``${``\ :term:`LOG_DIR`\ ``}/error-report``. 2902``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2685 2903
2904.. _ref-classes-retain:
2905
2906``retain``
2907==========
2908
2909The :ref:`ref-classes-retain` class can be used to create a tarball of the work
2910directory for a recipe when one of its tasks fails, or any other nominated
2911directories. It is useful in cases where the environment in which builds are run
2912is ephemeral or otherwise inaccessible for examination during debugging.
2913
2914To enable, add the following to your configuration::
2915
2916 INHERIT += "retain"
2917
2918The class can be disabled for specific recipes using the :term:`RETAIN_ENABLED`
2919variable.
2920
2686.. _ref-classes-rm-work: 2921.. _ref-classes-rm-work:
2687 2922
2688``rm_work`` 2923``rm_work``
@@ -2870,15 +3105,6 @@ in the :ref:`ref-classes-setuptools3` class and inherit this class instead.
2870 3105
2871The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages. 3106The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages.
2872 3107
2873.. _ref-classes-siteconfig:
2874
2875``siteconfig``
2876==============
2877
2878The :ref:`ref-classes-siteconfig` class provides functionality for handling site
2879configuration. The class is used by the :ref:`ref-classes-autotools` class to
2880accelerate the :ref:`ref-tasks-configure` task.
2881
2882.. _ref-classes-siteinfo: 3108.. _ref-classes-siteinfo:
2883 3109
2884``siteinfo`` 3110``siteinfo``
@@ -3160,8 +3386,8 @@ after it is built, you can set :term:`TESTIMAGE_AUTO`::
3160 TESTIMAGE_AUTO = "1" 3386 TESTIMAGE_AUTO = "1"
3161 3387
3162For information on how to enable, run, and create new tests, see the 3388For information on how to enable, run, and create new tests, see the
3163":ref:`dev-manual/runtime-testing:performing automated runtime testing`" 3389":ref:`test-manual/runtime-testing:performing automated runtime testing`"
3164section in the Yocto Project Development Tasks Manual. 3390section in the Yocto Project Test Environment Manual.
3165 3391
3166.. _ref-classes-testsdk: 3392.. _ref-classes-testsdk:
3167 3393
@@ -3270,21 +3496,86 @@ The variables used by this class are:
3270- :term:`UBOOT_FIT_KEY_REQ_ARGS`: ``openssl req`` arguments. 3496- :term:`UBOOT_FIT_KEY_REQ_ARGS`: ``openssl req`` arguments.
3271- :term:`UBOOT_FIT_SIGN_ALG`: signature algorithm for the FIT image. 3497- :term:`UBOOT_FIT_SIGN_ALG`: signature algorithm for the FIT image.
3272- :term:`UBOOT_FIT_SIGN_NUMBITS`: size of the private key for FIT image 3498- :term:`UBOOT_FIT_SIGN_NUMBITS`: size of the private key for FIT image
3273 signing. 3499 signing.
3274- :term:`UBOOT_FIT_KEY_SIGN_PKCS`: algorithm for the public key certificate 3500- :term:`UBOOT_FIT_KEY_SIGN_PKCS`: algorithm for the public key certificate
3275 for FIT image signing. 3501 for FIT image signing.
3276- :term:`UBOOT_FITIMAGE_ENABLE`: enable the generation of a U-Boot FIT image. 3502- :term:`UBOOT_FITIMAGE_ENABLE`: enable the generation of a U-Boot FIT image.
3277- :term:`UBOOT_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when 3503- :term:`UBOOT_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3278 rebuilding the FIT image containing the kernel. 3504 rebuilding the FIT image containing the kernel.
3505- :term:`UBOOT_FIT_ARM_TRUSTED_FIRMWARE`: include the Trusted Firmware-A
3506 (TF-A) binary in the U-Boot FIT image.
3507- :term:`UBOOT_FIT_ARM_TRUSTED_FIRMWARE_IMAGE`: specifies the path to the
3508 Trusted Firmware-A (TF-A) binary.
3509- :term:`UBOOT_FIT_TEE`: include the Trusted Execution Environment (TEE)
3510 binary in the U-Boot FIT image.
3511- :term:`UBOOT_FIT_TEE_IMAGE`: specifies the path to the Trusted Execution
3512 Environment (TEE) binary.
3513- :term:`UBOOT_FIT_USER_SETTINGS`: adds a user-specific snippet to the U-Boot
3514 Image Tree Source (ITS). Users can include their custom U-Boot Image Tree
3515 Source (ITS) snippet in this variable.
3516- :term:`UBOOT_FIT_CONF_FIRMWARE`: adds one image to the ``firmware`` property
3517 of the configuration node.
3518- :term:`UBOOT_FIT_CONF_USER_LOADABLES`: adds one or more user-defined images
3519 to the ``loadables`` property of the configuration node.
3279 3520
3280See U-Boot's documentation for details about `verified boot 3521See U-Boot's documentation for details about `verified boot
3281<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/verified-boot.txt>`__ 3522<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/verified-boot.txt>`__
3282and the `signature process 3523and the `signature process
3283<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/signature.txt>`__. 3524<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/signature.txt>`__.
3284 3525
3285See also the description of :ref:`ref-classes-kernel-fitimage` class, which this class 3526See also the description of :ref:`ref-classes-kernel-fit-image` class, which this class
3286imitates. 3527imitates.
3287 3528
3529.. _ref-classes-uki:
3530
3531``uki``
3532=======
3533
3534The :ref:`ref-classes-uki` class provides support for `Unified Kernel Image
3535(UKI) <https://uapi-group.org/specifications/specs/unified_kernel_image/>`__
3536format. UKIs combine kernel, :term:`Initramfs`, signatures, metadata etc to a
3537single UEFI firmware compatible binary. The class is intended to be inherited
3538by rootfs image recipes. The build configuration should also use an
3539:term:`Initramfs`, ``systemd-boot`` as boot menu provider and have UEFI support
3540on target hardware. Using ``systemd`` as init is recommended. Image builds
3541should create an ESP partition for UEFI firmware and copy ``systemd-boot`` and
3542UKI files there. Sample configuration for Wic images is provided in
3543:oe_git:`scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in
3544</openembedded-core/tree/scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in>`.
3545UKIs are generated using ``systemd`` reference implementation `ukify
3546<https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__.
3547This class uses a number of variables but tries to find sensible defaults for
3548them.
3549
3550The variables used by this class are:
3551
3552- :term:`EFI_ARCH`: architecture name within EFI standard, set in
3553 :oe_git:`meta/conf/image-uefi.conf
3554 </openembedded-core/tree/meta/conf/image-uefi.conf>`
3555- :term:`IMAGE_EFI_BOOT_FILES`: files to install to EFI boot partition
3556 created by the ``bootimg-efi`` Wic plugin
3557- :term:`INITRAMFS_IMAGE`: initramfs recipe name
3558- :term:`KERNEL_DEVICETREE`: optional devicetree files to embed into UKI
3559- :term:`UKIFY_CMD`: `ukify
3560 <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__
3561 command to build the UKI image
3562- :term:`UKI_CMDLINE`: kernel command line to use with UKI
3563- :term:`UKI_CONFIG_FILE`: optional config file for `ukify
3564 <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__
3565- :term:`UKI_FILENAME`: output file name for the UKI image
3566- :term:`UKI_KERNEL_FILENAME`: kernel image file name
3567- :term:`UKI_SB_CERT`: optional UEFI secureboot certificate matching the
3568 private key
3569- :term:`UKI_SB_KEY`: optional UEFI secureboot private key to sign UKI with
3570
3571For examples on how to use this class see oeqa selftest
3572:oe_git:`meta/lib/oeqa/selftest/cases/uki.py
3573</openembedded-core/tree/meta/lib/oeqa/selftest/cases/uki.py>`.
3574Also an oeqa runtime test :oe_git:`meta/lib/oeqa/runtime/cases/uki.py
3575</openembedded-core/tree/meta/lib/oeqa/runtime/cases/uki.py>` is provided which
3576verifies that the target system booted the same UKI binary as was set at
3577buildtime via :term:`UKI_FILENAME`.
3578
3288.. _ref-classes-uninative: 3579.. _ref-classes-uninative:
3289 3580
3290``uninative`` 3581``uninative``
@@ -3444,6 +3735,31 @@ This class is enabled by default because it is inherited by the
3444The :ref:`ref-classes-vala` class supports recipes that need to build software written 3735The :ref:`ref-classes-vala` class supports recipes that need to build software written
3445using the Vala programming language. 3736using the Vala programming language.
3446 3737
3738.. _ref-classes-vex:
3739
3740``vex``
3741========
3742
3743The :ref:`ref-classes-vex` class is used to generate metadata needed by external
3744tools to check for vulnerabilities, for example CVEs. It can be used as a
3745replacement for :ref:`ref-classes-cve-check`.
3746
3747In order to use this class, inherit the class in the ``local.conf`` file and it
3748will add the ``generate_vex`` task for every recipe::
3749
3750 INHERIT += "vex"
3751
3752If an image is built it will generate a report in :term:`DEPLOY_DIR_IMAGE` for
3753all the packages used, it will also generate a file for all recipes used in the
3754build.
3755
3756Variables use the ``CVE_CHECK`` prefix to keep compatibility with the
3757:ref:`ref-classes-cve-check` class.
3758
3759Example usage::
3760
3761 bitbake -c generate_vex openssl
3762
3447.. _ref-classes-waf: 3763.. _ref-classes-waf:
3448 3764
3449``waf`` 3765``waf``
@@ -3455,3 +3771,23 @@ the Waf build system. You can use the
3455:term:`PACKAGECONFIG_CONFARGS` variables 3771:term:`PACKAGECONFIG_CONFARGS` variables
3456to specify additional configuration options to be passed on the Waf 3772to specify additional configuration options to be passed on the Waf
3457command line. 3773command line.
3774
3775.. _ref-classes-yocto-check-layer:
3776
3777``yocto-check-layer``
3778=====================
3779
3780The :ref:`ref-classes-yocto-check-layer` class is used by the
3781:oe_git:`yocto-check-layer </openembedded-core/tree/scripts/yocto-check-layer>`
3782script to ensure that packages from Yocto Project Compatible layers don't skip
3783required QA checks listed in :term:`CHECKLAYER_REQUIRED_TESTS` defined by the
3784:ref:`ref-classes-insane` class.
3785
3786It adds an anonymous python function with extra processing to all recipes,
3787and globally inheriting this class with :term:`INHERIT` is not advised. Instead
3788the ``yocto-check-layer`` script should be used as it handles usage of this
3789class.
3790
3791For more information on the Yocto Project
3792Compatible layers, see the :ref:`dev-manual/layers:Making Sure Your Layer is
3793Compatible With Yocto Project` section of the Yocto Project Development Manual.