Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2 | |
| 3 | ******* |
| 4 | Classes |
| 5 | ******* |
| 6 | |
| 7 | Class files are used to abstract common functionality and share it |
| 8 | amongst multiple recipe (``.bb``) files. To use a class file, you simply |
| 9 | make sure the recipe inherits the class. In most cases, when a recipe |
| 10 | inherits a class it is enough to enable its features. There are cases, |
| 11 | however, where in the recipe you might need to set variables or override |
| 12 | some default behavior. |
| 13 | |
| 14 | Any :term:`Metadata` usually found in a recipe can also be |
| 15 | placed in a class file. Class files are identified by the extension |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 16 | ``.bbclass`` and are usually placed in one of a set of subdirectories |
| 17 | beneath the ``meta*/`` directory found in the :term:`Source Directory`: |
| 18 | |
| 19 | - ``classes-recipe/`` - classes intended to be inherited by recipes |
| 20 | individually |
| 21 | - ``classes-global/`` - classes intended to be inherited globally |
| 22 | - ``classes/`` - classes whose usage context is not clearly defined |
| 23 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 24 | Class files can also be pointed to by |
| 25 | :term:`BUILDDIR` (e.g. ``build/``) in the same way as |
| 26 | ``.conf`` files in the ``conf`` directory. Class files are searched for |
| 27 | in :term:`BBPATH` using the same method by which ``.conf`` |
| 28 | files are searched. |
| 29 | |
| 30 | This chapter discusses only the most useful and important classes. Other |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 31 | classes do exist within the ``meta/classes*`` directories in the Source |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 32 | Directory. You can reference the ``.bbclass`` files directly for more |
| 33 | information. |
| 34 | |
| 35 | .. _ref-classes-allarch: |
| 36 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 37 | ``allarch`` |
| 38 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 39 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 40 | The :ref:`ref-classes-allarch` class is inherited by recipes that do not produce |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 41 | architecture-specific output. The class disables functionality that is |
| 42 | normally needed for recipes that produce executable binaries (such as |
| 43 | building the cross-compiler and a C library as pre-requisites, and |
| 44 | splitting out of debug symbols during packaging). |
| 45 | |
| 46 | .. note:: |
| 47 | |
| 48 | Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that |
| 49 | produce packages that depend on tunings through use of the |
| 50 | :term:`RDEPENDS` and |
| 51 | :term:`TUNE_PKGARCH` variables, should never be |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 52 | configured for all architectures using :ref:`ref-classes-allarch`. This is the case |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 53 | even if the recipes do not produce architecture-specific output. |
| 54 | |
| 55 | Configuring such recipes for all architectures causes the |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 56 | :ref:`do_package_write_* <ref-tasks-package_write_deb>` tasks to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 57 | have different signatures for the machines with different tunings. |
| 58 | Additionally, unnecessary rebuilds occur every time an image for a |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 59 | different :term:`MACHINE` is built even when the recipe never changes. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 60 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 61 | By default, all recipes inherit the :ref:`ref-classes-base` and |
| 62 | :ref:`ref-classes-package` classes, which enable |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 63 | functionality needed for recipes that produce executable output. If your |
| 64 | recipe, for example, only produces packages that contain configuration |
| 65 | files, media files, or scripts (e.g. Python and Perl), then it should |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 66 | inherit the :ref:`ref-classes-allarch` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 67 | |
| 68 | .. _ref-classes-archiver: |
| 69 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 70 | ``archiver`` |
| 71 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 72 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 73 | The :ref:`ref-classes-archiver` class supports releasing source code and other |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 74 | materials with the binaries. |
| 75 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 76 | For more details on the source :ref:`ref-classes-archiver`, see the |
| 77 | ":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 78 | section in the Yocto Project Development Tasks Manual. You can also see |
| 79 | the :term:`ARCHIVER_MODE` variable for information |
| 80 | about the variable flags (varflags) that help control archive creation. |
| 81 | |
| 82 | .. _ref-classes-autotools: |
| 83 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 84 | ``autotools*`` |
| 85 | ============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 86 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 87 | The :ref:`autotools* <ref-classes-autotools>` classes support packages built with the |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 88 | :wikipedia:`GNU Autotools <GNU_Autotools>`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 89 | |
| 90 | The ``autoconf``, ``automake``, and ``libtool`` packages bring |
| 91 | standardization. This class defines a set of tasks (e.g. ``configure``, |
| 92 | ``compile`` and so forth) that work for all Autotooled packages. It |
| 93 | should usually be enough to define a few standard variables and then |
| 94 | simply ``inherit autotools``. These classes can also work with software |
| 95 | that emulates Autotools. For more information, see the |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 96 | ":ref:`dev-manual/new-recipe:building an autotooled package`" section |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 97 | in the Yocto Project Development Tasks Manual. |
| 98 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 99 | By default, the :ref:`autotools* <ref-classes-autotools>` classes use out-of-tree builds (i.e. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 100 | ``autotools.bbclass`` building with ``B != S``). |
| 101 | |
| 102 | If the software being built by a recipe does not support using |
| 103 | out-of-tree builds, you should have the recipe inherit the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 104 | :ref:`autotools-brokensep <ref-classes-autotools>` class. The :ref:`autotools-brokensep <ref-classes-autotools>` class behaves |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 105 | the same as the :ref:`ref-classes-autotools` class but builds with :term:`B` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 106 | == :term:`S`. This method is useful when out-of-tree build |
| 107 | support is either not present or is broken. |
| 108 | |
| 109 | .. note:: |
| 110 | |
| 111 | It is recommended that out-of-tree support be fixed and used if at |
| 112 | all possible. |
| 113 | |
| 114 | It's useful to have some idea of how the tasks defined by the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 115 | :ref:`autotools* <ref-classes-autotools>` classes work and what they do behind the scenes. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 116 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 117 | - :ref:`ref-tasks-configure` --- regenerates the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 118 | configure script (using ``autoreconf``) and then launches it with a |
| 119 | standard set of arguments used during cross-compilation. You can pass |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 120 | additional parameters to ``configure`` through the :term:`EXTRA_OECONF` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 121 | or :term:`PACKAGECONFIG_CONFARGS` |
| 122 | variables. |
| 123 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 124 | - :ref:`ref-tasks-compile` --- runs ``make`` with |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 125 | arguments that specify the compiler and linker. You can pass |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 126 | additional arguments through the :term:`EXTRA_OEMAKE` variable. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 127 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 128 | - :ref:`ref-tasks-install` --- runs ``make install`` and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 129 | passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``. |
| 130 | |
Patrick Williams | 96e4b4e | 2025-02-03 15:49:15 -0500 | [diff] [blame^] | 131 | .. _ref-classes-barebox: |
| 132 | |
| 133 | ``barebox`` |
| 134 | =========== |
| 135 | |
| 136 | The :ref:`ref-classes-barebox` class manages building the barebox bootloader. |
| 137 | |
| 138 | If a file named ``defconfig`` is included in the :term:`SRC_URI`, it will be |
| 139 | copied to ``.config`` in the build directory and used as the barebox |
| 140 | configuration. |
| 141 | Instead of providing a ``defconfig`` file, you can set :term:`BAREBOX_CONFIG` |
| 142 | to a defconfig provided by the barebox source tree. |
| 143 | If neither ``defconfig`` nor :term:`BAREBOX_CONFIG` is specified, the class |
| 144 | will raise an error. |
| 145 | |
| 146 | The :ref:`ref-classes-barebox` class supports config fragments and internally |
| 147 | includes the :ref:`ref-classes-cml1` class to provide `Kconfig |
| 148 | <https://docs.kernel.org/kbuild/kconfig-language.html>`__ support for |
| 149 | barebox, enabling tasks such as :ref:`ref-tasks-menuconfig` and |
| 150 | :ref:`ref-tasks-diffconfig`. |
| 151 | |
| 152 | The 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. |
| 155 | This setup supports both using the barebox binaries as independent artifacts |
| 156 | and installing them into a rootfs. |
| 157 | :term:`BAREBOX_BINARY` can be used to select a distinct binary to deploy and |
| 158 | install. |
| 159 | If ``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>` |
| 161 | to define the default installation paths and naming conventions. |
| 162 | |
| 163 | The compiled-in barebox environment can be extended by adding environment files |
| 164 | to the ``BAREBOX_ENV_DIR``. |
| 165 | The ``BAREBOX_FIRMWARE_DIR`` variable allows you to specify the firmware blob |
| 166 | search directory, enabling loading of additional firmware like TF-A or OP-TEE. |
| 167 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 168 | .. _ref-classes-base: |
| 169 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 170 | ``base`` |
| 171 | ======== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 172 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 173 | The :ref:`ref-classes-base` class is special in that every ``.bb`` file implicitly |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 174 | inherits the class. This class contains definitions for standard basic |
| 175 | tasks such as fetching, unpacking, configuring (empty by default), |
| 176 | compiling (runs any ``Makefile`` present), installing (empty by default) |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 177 | and packaging (empty by default). These tasks are often overridden or |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 178 | extended by other classes such as the :ref:`ref-classes-autotools` class or the |
| 179 | :ref:`ref-classes-package` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 180 | |
| 181 | The class also contains some commonly used functions such as |
| 182 | ``oe_runmake``, which runs ``make`` with the arguments specified in |
| 183 | :term:`EXTRA_OEMAKE` variable as well as the |
| 184 | arguments passed directly to ``oe_runmake``. |
| 185 | |
| 186 | .. _ref-classes-bash-completion: |
| 187 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 188 | ``bash-completion`` |
| 189 | =================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 190 | |
| 191 | Sets up packaging and dependencies appropriate for recipes that build |
| 192 | software that includes bash-completion data. |
| 193 | |
| 194 | .. _ref-classes-bin-package: |
| 195 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 196 | ``bin_package`` |
| 197 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 198 | |
Patrick Williams | 8460358 | 2024-12-14 08:00:57 -0500 | [diff] [blame] | 199 | The :ref:`ref-classes-bin-package` class is a helper class for recipes, that |
| 200 | disables the :ref:`ref-tasks-configure` and :ref:`ref-tasks-compile` tasks and |
| 201 | copies the content of the :term:`S` directory into the :term:`D` directory. This |
| 202 | is useful for installing binary packages (e.g. RPM packages) by passing the |
| 203 | package in the :term:`SRC_URI` variable and inheriting this class. |
| 204 | |
| 205 | For RPMs and other packages that do not contain a subdirectory, you should set |
| 206 | the :term:`SRC_URI` option ``subdir`` to :term:`BP` so that the contents are |
| 207 | extracted to the directory expected by the default value of :term:`S`. For |
| 208 | example:: |
| 209 | |
| 210 | SRC_URI = "https://example.com/downloads/somepackage.rpm;subdir=${BP}" |
| 211 | |
| 212 | This class can also be used for tarballs. For example:: |
| 213 | |
| 214 | SRC_URI = "file://somepackage.tar.xz;subdir=${BP}" |
| 215 | |
| 216 | The :ref:`ref-classes-bin-package` class will copy the extracted content of the |
| 217 | tarball from :term:`S` to :term:`D`. |
| 218 | |
| 219 | This class assumes that the content of the package as installed in :term:`S` |
| 220 | mirrors the expected layout once installed on the target, which is generally the |
| 221 | case for binary packages. For example, an RPM package for a library would |
| 222 | usually contain the ``usr/lib`` directory, and should be extracted to |
| 223 | ``${S}/usr/lib/<library>.so.<version>`` to be installed in :term:`D` correctly. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 224 | |
| 225 | .. note:: |
| 226 | |
Patrick Williams | 8460358 | 2024-12-14 08:00:57 -0500 | [diff] [blame] | 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. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 231 | |
| 232 | .. _ref-classes-binconfig: |
| 233 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 234 | ``binconfig`` |
| 235 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 236 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 237 | The :ref:`ref-classes-binconfig` class helps to correct paths in shell scripts. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 238 | |
| 239 | Before ``pkg-config`` had become widespread, libraries shipped shell |
| 240 | scripts to give information about the libraries and include paths needed |
| 241 | to build software (usually named ``LIBNAME-config``). This class assists |
| 242 | any recipe using such scripts. |
| 243 | |
| 244 | During staging, the OpenEmbedded build system installs such scripts into |
| 245 | the ``sysroots/`` directory. Inheriting this class results in all paths |
| 246 | in these scripts being changed to point into the ``sysroots/`` directory |
| 247 | so that all builds that use the script use the correct directories for |
| 248 | the cross compiling layout. See the |
| 249 | :term:`BINCONFIG_GLOB` variable for more |
| 250 | information. |
| 251 | |
| 252 | .. _ref-classes-binconfig-disabled: |
| 253 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 254 | ``binconfig-disabled`` |
| 255 | ====================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 256 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 257 | An alternative version of the :ref:`ref-classes-binconfig` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 258 | class, which disables binary configuration scripts by making them return |
| 259 | an error in favor of using ``pkg-config`` to query the information. The |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 260 | scripts to be disabled should be specified using the :term:`BINCONFIG` |
| 261 | variable within the recipe inheriting the class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 262 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 263 | .. _ref-classes-buildhistory: |
| 264 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 265 | ``buildhistory`` |
| 266 | ================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 267 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 268 | The :ref:`ref-classes-buildhistory` class records a history of build output metadata, |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 269 | which can be used to detect possible regressions as well as used for |
| 270 | analysis of the build output. For more information on using Build |
| 271 | History, see the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 272 | ":ref:`dev-manual/build-quality:maintaining build output quality`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 273 | section in the Yocto Project Development Tasks Manual. |
| 274 | |
| 275 | .. _ref-classes-buildstats: |
| 276 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 277 | ``buildstats`` |
| 278 | ============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 279 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 280 | The :ref:`ref-classes-buildstats` class records performance statistics about each task |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 281 | executed during the build (e.g. elapsed time, CPU usage, and I/O usage). |
| 282 | |
| 283 | When you use this class, the output goes into the |
| 284 | :term:`BUILDSTATS_BASE` directory, which defaults |
| 285 | to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using |
| 286 | ``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading |
| 287 | chart of the entire build process and can be useful for highlighting |
| 288 | bottlenecks. |
| 289 | |
| 290 | Collecting build statistics is enabled by default through the |
| 291 | :term:`USER_CLASSES` variable from your |
| 292 | ``local.conf`` file. Consequently, you do not have to do anything to |
| 293 | enable the class. However, if you want to disable the class, simply |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 294 | remove ":ref:`ref-classes-buildstats`" from the :term:`USER_CLASSES` list. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 295 | |
| 296 | .. _ref-classes-buildstats-summary: |
| 297 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 298 | ``buildstats-summary`` |
| 299 | ====================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 300 | |
| 301 | When inherited globally, prints statistics at the end of the build on |
| 302 | sstate re-use. In order to function, this class requires the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 303 | :ref:`ref-classes-buildstats` class be enabled. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 304 | |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 305 | .. _ref-classes-cargo: |
| 306 | |
| 307 | ``cargo`` |
| 308 | ========= |
| 309 | |
| 310 | The :ref:`ref-classes-cargo` class allows to compile Rust language programs |
| 311 | using `Cargo <https://doc.rust-lang.org/cargo/>`__. Cargo is Rust's package |
| 312 | manager, allowing to fetch package dependencies and build your program. |
| 313 | |
| 314 | Using this class makes it very easy to build Rust programs. All you need |
| 315 | is to use the :term:`SRC_URI` variable to point to a source repository |
| 316 | which can be built by Cargo, typically one that was created by the |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 317 | ``cargo new`` command, containing a ``Cargo.toml`` file, a ``Cargo.lock`` file and a ``src`` |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 318 | subdirectory. |
| 319 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 320 | If you want to build and package tests of the program, inherit the |
| 321 | :ref:`ref-classes-ptest-cargo` class instead of :ref:`ref-classes-cargo`. |
| 322 | |
| 323 | You will find an example (that show also how to handle possible git source dependencies) in the |
| 324 | :oe_git:`zvariant_3.12.0.bb </openembedded-core/tree/meta-selftest/recipes-extended/zvariant/zvariant_3.12.0.bb>` |
| 325 | recipe. Another example, with only crate dependencies, is the |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 326 | :oe_git:`uutils-coreutils </meta-openembedded/tree/meta-oe/recipes-core/uutils-coreutils>` |
| 327 | recipe, which was generated by the `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__ |
| 328 | tool. |
| 329 | |
| 330 | This class inherits the :ref:`ref-classes-cargo_common` class. |
| 331 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 332 | .. _ref-classes-cargo_c: |
| 333 | |
| 334 | ``cargo_c`` |
| 335 | =========== |
| 336 | |
| 337 | The :ref:`ref-classes-cargo_c` class can be inherited by a recipe to generate |
| 338 | a Rust library that can be called by C/C++ code. The recipe which inherits this |
| 339 | class has to only replace ``inherit cargo`` by ``inherit cargo_c``. |
| 340 | |
| 341 | See the :yocto_git:`rust-c-lib-example_git.bb |
| 342 | </poky/tree/meta-selftest/recipes-devtools/rust/rust-c-lib-example_git.bb>` |
| 343 | example recipe. |
| 344 | |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 345 | .. _ref-classes-cargo_common: |
| 346 | |
| 347 | ``cargo_common`` |
| 348 | ================ |
| 349 | |
| 350 | The :ref:`ref-classes-cargo_common` class is an internal class |
| 351 | that is not intended to be used directly. |
| 352 | |
| 353 | An exception is the "rust" recipe, to build the Rust compiler and runtime |
| 354 | library, which is built by Cargo but cannot use the :ref:`ref-classes-cargo` |
| 355 | class. This is why this class was introduced. |
| 356 | |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 357 | .. _ref-classes-cargo-update-recipe-crates: |
| 358 | |
| 359 | ``cargo-update-recipe-crates`` |
| 360 | =============================== |
| 361 | |
| 362 | The :ref:`ref-classes-cargo-update-recipe-crates` class allows |
| 363 | recipe developers to update the list of Cargo crates in :term:`SRC_URI` |
| 364 | by reading the ``Cargo.lock`` file in the source tree. |
| 365 | |
| 366 | To do so, create a recipe for your program, for example using |
| 367 | :doc:`devtool </ref-manual/devtool-reference>`, |
| 368 | make it inherit the :ref:`ref-classes-cargo` and |
| 369 | :ref:`ref-classes-cargo-update-recipe-crates` and run:: |
| 370 | |
| 371 | bitbake -c update_crates recipe |
| 372 | |
| 373 | This creates a ``recipe-crates.inc`` file that you can include in your |
| 374 | recipe:: |
| 375 | |
| 376 | require ${BPN}-crates.inc |
| 377 | |
| 378 | That's also something you can achieve by using the |
| 379 | `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__ tool. |
| 380 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 381 | .. _ref-classes-ccache: |
| 382 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 383 | ``ccache`` |
| 384 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 385 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 386 | The :ref:`ref-classes-ccache` class enables the C/C++ Compiler Cache for the build. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 387 | This class is used to give a minor performance boost during the build. |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 388 | |
| 389 | See https://ccache.samba.org/ for information on the C/C++ Compiler |
| 390 | Cache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>` |
| 391 | file for details about how to enable this mechanism in your configuration |
| 392 | file, how to disable it for specific recipes, and how to share ``ccache`` |
| 393 | files between builds. |
| 394 | |
| 395 | However, using the class can lead to unexpected side-effects. Thus, using |
| 396 | this class is not recommended. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 397 | |
| 398 | .. _ref-classes-chrpath: |
| 399 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 400 | ``chrpath`` |
| 401 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 402 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 403 | The :ref:`ref-classes-chrpath` class is a wrapper around the "chrpath" utility, which |
| 404 | is used during the build process for :ref:`ref-classes-nativesdk`, :ref:`ref-classes-cross`, and |
| 405 | :ref:`ref-classes-cross-canadian` recipes to change ``RPATH`` records within binaries |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 406 | in order to make them relocatable. |
| 407 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 408 | .. _ref-classes-cmake: |
| 409 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 410 | ``cmake`` |
| 411 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 412 | |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 413 | The :ref:`ref-classes-cmake` class allows recipes to build software using the |
| 414 | `CMake <https://cmake.org/overview/>`__ build system. You can use the |
| 415 | :term:`EXTRA_OECMAKE` variable to specify additional configuration options to |
| 416 | pass to the ``cmake`` command line. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 417 | |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 418 | By default, the :ref:`ref-classes-cmake` class uses |
| 419 | `Ninja <https://ninja-build.org/>`__ instead of GNU make for building, which |
| 420 | offers better build performance. If a recipe is broken with Ninja, then the |
| 421 | recipe can set the :term:`OECMAKE_GENERATOR` variable to ``Unix Makefiles`` to |
| 422 | use GNU make instead. |
| 423 | |
| 424 | If you need to install custom CMake toolchain files supplied by the application |
| 425 | being built, you should install them (during :ref:`ref-tasks-install`) to the |
| 426 | preferred CMake Module directory: ``${D}${datadir}/cmake/modules/``. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 427 | |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 428 | .. _ref-classes-cmake-qemu: |
| 429 | |
| 430 | ``cmake-qemu`` |
| 431 | ============== |
| 432 | |
| 433 | The :ref:`ref-classes-cmake-qemu` class might be used instead of the |
| 434 | :ref:`ref-classes-cmake` class. In addition to the features provided by the |
| 435 | :ref:`ref-classes-cmake` class, the :ref:`ref-classes-cmake-qemu` class passes |
| 436 | the ``CMAKE_CROSSCOMPILING_EMULATOR`` setting to ``cmake``. This allows to use |
| 437 | QEMU user-mode emulation for the execution of cross-compiled binaries on the |
| 438 | host machine. For more information about ``CMAKE_CROSSCOMPILING_EMULATOR`` |
| 439 | please refer to the `related section of the CMake documentation |
| 440 | <https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html>`__. |
| 441 | |
| 442 | Not all platforms are supported by QEMU. This class only works for machines with |
| 443 | ``qemu-usermode`` in the :ref:`ref-features-machine`. Using QEMU user-mode therefore |
| 444 | involves a certain risk, which is also the reason why this feature is not part of |
| 445 | the main :ref:`ref-classes-cmake` class by default. |
| 446 | |
| 447 | One use case is the execution of cross-compiled unit tests with CTest on the build |
| 448 | machine. If ``CMAKE_CROSSCOMPILING_EMULATOR`` is configured:: |
| 449 | |
| 450 | cmake --build --target test |
| 451 | |
| 452 | works transparently with QEMU user-mode. |
| 453 | |
| 454 | If the CMake project is developed with this use case in mind this works very nicely. |
| 455 | This also applies to an IDE configured to use ``cmake-native`` for cross-compiling. |
| 456 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 457 | .. _ref-classes-cml1: |
| 458 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 459 | ``cml1`` |
| 460 | ======== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 461 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 462 | The :ref:`ref-classes-cml1` class provides basic support for the Linux kernel style |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 463 | build configuration system. "cml" stands for "Configuration Menu Language", which |
| 464 | originates from the Linux kernel but is also used in other projects such as U-Boot |
| 465 | and BusyBox. It could have been called "kconfig" too. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 466 | |
| 467 | .. _ref-classes-compress_doc: |
| 468 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 469 | ``compress_doc`` |
| 470 | ================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 471 | |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame] | 472 | Enables compression for manual and info pages. This class is intended |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 473 | to be inherited globally. The default compression mechanism is gz (gzip) |
| 474 | but you can select an alternative mechanism by setting the |
| 475 | :term:`DOC_COMPRESS` variable. |
| 476 | |
| 477 | .. _ref-classes-copyleft_compliance: |
| 478 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 479 | ``copyleft_compliance`` |
| 480 | ======================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 481 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 482 | The :ref:`ref-classes-copyleft_compliance` class preserves source code for the purposes |
| 483 | of license compliance. This class is an alternative to the :ref:`ref-classes-archiver` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 484 | class and is still used by some users even though it has been deprecated |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 485 | in favor of the :ref:`ref-classes-archiver` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 486 | |
| 487 | .. _ref-classes-copyleft_filter: |
| 488 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 489 | ``copyleft_filter`` |
| 490 | =================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 491 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 492 | A class used by the :ref:`ref-classes-archiver` and |
| 493 | :ref:`ref-classes-copyleft_compliance` classes |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 494 | for filtering licenses. The ``copyleft_filter`` class is an internal |
| 495 | class and is not intended to be used directly. |
| 496 | |
| 497 | .. _ref-classes-core-image: |
| 498 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 499 | ``core-image`` |
| 500 | ============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 501 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 502 | The :ref:`ref-classes-core-image` class provides common definitions for the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 503 | ``core-image-*`` image recipes, such as support for additional |
| 504 | :term:`IMAGE_FEATURES`. |
| 505 | |
| 506 | .. _ref-classes-cpan: |
| 507 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 508 | ``cpan*`` |
| 509 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 510 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 511 | The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 512 | |
| 513 | Recipes for Perl modules are simple. These recipes usually only need to |
| 514 | point to the source's archive and then inherit the proper class file. |
| 515 | Building is split into two methods depending on which method the module |
| 516 | authors used. |
| 517 | |
| 518 | - Modules that use old ``Makefile.PL``-based build system require |
| 519 | ``cpan.bbclass`` in their recipes. |
| 520 | |
| 521 | - Modules that use ``Build.PL``-based build system require using |
| 522 | ``cpan_build.bbclass`` in their recipes. |
| 523 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 524 | Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 525 | support. |
| 526 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 527 | .. _ref-classes-create-spdx: |
| 528 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 529 | ``create-spdx`` |
| 530 | =============== |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 531 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 532 | The :ref:`ref-classes-create-spdx` class provides support for |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 533 | automatically creating :term:`SPDX` :term:`SBOM` documents based upon image |
| 534 | and SDK contents. |
| 535 | |
| 536 | This class is meant to be inherited globally from a configuration file:: |
| 537 | |
| 538 | INHERIT += "create-spdx" |
| 539 | |
| 540 | The toplevel :term:`SPDX` output file is generated in JSON format as a |
| 541 | ``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the |
| 542 | :term:`Build Directory`. There are other related files in the same directory, |
| 543 | as well as in ``tmp/deploy/spdx``. |
| 544 | |
| 545 | The exact behaviour of this class, and the amount of output can be controlled |
| 546 | by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`, |
| 547 | :term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables. |
| 548 | |
| 549 | See the description of these variables and the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 550 | ":ref:`dev-manual/sbom:creating a software bill of materials`" |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 551 | section in the Yocto Project Development Manual for more details. |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 552 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 553 | .. _ref-classes-cross: |
| 554 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 555 | ``cross`` |
| 556 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 557 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 558 | The :ref:`ref-classes-cross` class provides support for the recipes that build the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 559 | cross-compilation tools. |
| 560 | |
| 561 | .. _ref-classes-cross-canadian: |
| 562 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 563 | ``cross-canadian`` |
| 564 | ================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 565 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 566 | The :ref:`ref-classes-cross-canadian` class provides support for the recipes that build |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 567 | the Canadian Cross-compilation tools for SDKs. See the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 568 | ":ref:`overview-manual/concepts:cross-development toolchain generation`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 569 | section in the Yocto Project Overview and Concepts Manual for more |
| 570 | discussion on these cross-compilation tools. |
| 571 | |
| 572 | .. _ref-classes-crosssdk: |
| 573 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 574 | ``crosssdk`` |
| 575 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 576 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 577 | The :ref:`ref-classes-crosssdk` class provides support for the recipes that build the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 578 | cross-compilation tools used for building SDKs. See the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 579 | ":ref:`overview-manual/concepts:cross-development toolchain generation`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 580 | section in the Yocto Project Overview and Concepts Manual for more |
| 581 | discussion on these cross-compilation tools. |
| 582 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 583 | .. _ref-classes-cve-check: |
| 584 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 585 | ``cve-check`` |
| 586 | ============= |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 587 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 588 | The :ref:`ref-classes-cve-check` class looks for known CVEs (Common Vulnerabilities |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 589 | and Exposures) while building with BitBake. This class is meant to be |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 590 | inherited globally from a configuration file:: |
| 591 | |
| 592 | INHERIT += "cve-check" |
| 593 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 594 | To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core, |
| 595 | add following line to the build configuration file:: |
| 596 | |
| 597 | include cve-extra-exclusions.inc |
| 598 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 599 | You can also look for vulnerabilities in specific packages by passing |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 600 | ``-c cve_check`` to BitBake. |
| 601 | |
| 602 | After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve`` |
| 603 | and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files. |
| 604 | |
| 605 | When building, the CVE checker will emit build time warnings for any detected |
| 606 | issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component |
| 607 | and version being compiled and no patches to address the issue are applied. Other states |
| 608 | for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already |
| 609 | applied, and ``Ignored`` meaning that the issue can be ignored. |
| 610 | |
| 611 | The ``Patched`` state of a CVE issue is detected from patch files with the format |
| 612 | ``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using |
| 613 | CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file. |
| 614 | |
Patrick Williams | 2f814a6 | 2024-04-16 16:28:03 -0500 | [diff] [blame] | 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 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 622 | If the recipe adds ``CVE-ID`` as flag of the :term:`CVE_STATUS` variable with status |
| 623 | mapped to ``Ignored``, then the CVE state is reported as ``Ignored``:: |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 624 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 625 | CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows" |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 626 | |
| 627 | If CVE check reports that a recipe contains false positives or false negatives, these may be |
| 628 | fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables. |
| 629 | :term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE |
| 630 | database vendor and product pairs using the syntax:: |
| 631 | |
| 632 | CVE_PRODUCT = "flex_project:flex" |
| 633 | |
| 634 | where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly |
| 635 | if the default recipe version :term:`PV` does not match the version numbers of the software component |
| 636 | in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the |
| 637 | CVE database compatible version number, for example:: |
| 638 | |
| 639 | CVE_VERSION = "2.39" |
| 640 | |
| 641 | Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database |
| 642 | via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__. |
| 643 | |
| 644 | Users should note that security is a process, not a product, and thus also CVE checking, analyzing results, |
| 645 | patching and updating the software should be done as a regular process. The data and assumptions |
| 646 | required for CVE checker to reliably detect issues are frequently broken in various ways. |
| 647 | These can only be detected by reviewing the details of the issues and iterating over the generated reports, |
| 648 | and following what happens in other Linux distributions and in the greater open source community. |
| 649 | |
| 650 | You will find some more details in the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 651 | ":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`" |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 652 | section in the Development Tasks Manual. |
| 653 | |
Patrick Williams | 96e4b4e | 2025-02-03 15:49:15 -0500 | [diff] [blame^] | 654 | .. _ref-classes-cython: |
| 655 | |
| 656 | ``cython`` |
| 657 | ========== |
| 658 | |
| 659 | The :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 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 663 | .. _ref-classes-debian: |
| 664 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 665 | ``debian`` |
| 666 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 667 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 668 | The :ref:`ref-classes-debian` class renames output packages so that they follow the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 669 | Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and |
| 670 | ``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library |
| 671 | name and version as part of the package name. |
| 672 | |
| 673 | If a recipe creates packages for multiple libraries (shared object files |
| 674 | of ``.so`` type), use the :term:`LEAD_SONAME` |
| 675 | variable in the recipe to specify the library on which to apply the |
| 676 | naming scheme. |
| 677 | |
| 678 | .. _ref-classes-deploy: |
| 679 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 680 | ``deploy`` |
| 681 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 682 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 683 | The :ref:`ref-classes-deploy` class handles deploying files to the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 684 | :term:`DEPLOY_DIR_IMAGE` directory. The main |
| 685 | function of this class is to allow the deploy step to be accelerated by |
| 686 | shared state. Recipes that inherit this class should define their own |
| 687 | :ref:`ref-tasks-deploy` function to copy the files to be |
| 688 | deployed to :term:`DEPLOYDIR`, and use ``addtask`` to |
| 689 | add the task at the appropriate place, which is usually after |
| 690 | :ref:`ref-tasks-compile` or |
| 691 | :ref:`ref-tasks-install`. The class then takes care of |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 692 | staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 693 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 694 | .. _ref-classes-devicetree: |
| 695 | |
| 696 | ``devicetree`` |
| 697 | ============== |
| 698 | |
| 699 | The :ref:`ref-classes-devicetree` class allows to build a recipe that compiles |
| 700 | device tree source files that are not in the kernel tree. |
| 701 | |
| 702 | The compilation of out-of-tree device tree sources is the same as the kernel |
| 703 | in-tree device tree compilation process. This includes the ability to include |
| 704 | sources from the kernel such as SoC ``dtsi`` files as well as C header files, |
| 705 | such as ``gpio.h``. |
| 706 | |
| 707 | The :ref:`ref-tasks-compile` task will compile two kinds of files: |
| 708 | |
| 709 | - Regular device tree sources with a ``.dts`` extension. |
| 710 | |
| 711 | - Device tree overlays, detected from the presence of the ``/plugin/;`` |
| 712 | string in the file contents. |
| 713 | |
Patrick Williams | 520786c | 2023-06-25 16:20:36 -0500 | [diff] [blame] | 714 | This class deploys the generated device tree binaries into |
| 715 | ``${``\ :term:`DEPLOY_DIR_IMAGE`\ ``}/devicetree/``. This is similar to |
| 716 | what the :ref:`ref-classes-kernel-devicetree` class does, with the added |
| 717 | ``devicetree`` subdirectory to avoid name clashes. Additionally, the device |
| 718 | trees are populated into the sysroot for access via the sysroot from within |
| 719 | other recipes. |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 720 | |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 721 | By default, all device tree sources located in :term:`DT_FILES_PATH` directory |
| 722 | are compiled. To select only particular sources, set :term:`DT_FILES` to |
| 723 | a space-separated list of files (relative to :term:`DT_FILES_PATH`). For |
| 724 | convenience, both ``.dts`` and ``.dtb`` extensions can be used. |
| 725 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 726 | An extra padding is appended to non-overlay device trees binaries. This |
| 727 | can typically be used as extra space for adding extra properties at boot time. |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 728 | The padding size can be modified by setting :term:`DT_PADDING_SIZE` |
| 729 | to the desired size, in bytes. |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 730 | |
| 731 | See :oe_git:`devicetree.bbclass sources |
Patrick Williams | 44b3caf | 2024-04-12 16:51:14 -0500 | [diff] [blame] | 732 | </openembedded-core/tree/meta/classes-recipe/devicetree.bbclass>` |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 733 | for further variables controlling this class. |
| 734 | |
| 735 | Here is an excerpt of an example ``recipes-kernel/linux/devicetree-acme.bb`` |
| 736 | recipe inheriting this class:: |
| 737 | |
| 738 | inherit devicetree |
| 739 | COMPATIBLE_MACHINE = "^mymachine$" |
| 740 | SRC_URI:mymachine = "file://mymachine.dts" |
| 741 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 742 | .. _ref-classes-devshell: |
| 743 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 744 | ``devshell`` |
| 745 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 746 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 747 | The :ref:`ref-classes-devshell` class adds the :ref:`ref-tasks-devshell` task. Distribution |
| 748 | policy dictates whether to include this class. See the ":ref:`dev-manual/development-shell:using a development shell`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 749 | section in the Yocto Project Development Tasks Manual for more |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 750 | information about using :ref:`ref-classes-devshell`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 751 | |
| 752 | .. _ref-classes-devupstream: |
| 753 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 754 | ``devupstream`` |
| 755 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 756 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 757 | The :ref:`ref-classes-devupstream` class uses |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 758 | :term:`BBCLASSEXTEND` to add a variant of the |
| 759 | recipe that fetches from an alternative URI (e.g. Git) instead of a |
Patrick Williams | 3965356 | 2024-03-01 08:54:02 -0600 | [diff] [blame] | 760 | tarball. Here is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 761 | |
| 762 | BBCLASSEXTEND = "devupstream:target" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 763 | SRC_URI:class-devupstream = "git://git.example.com/example;branch=main" |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 764 | SRCREV:class-devupstream = "abcd1234" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 765 | |
| 766 | Adding the above statements to your recipe creates a variant that has |
| 767 | :term:`DEFAULT_PREFERENCE` set to "-1". |
| 768 | Consequently, you need to select the variant of the recipe to use it. |
| 769 | Any development-specific adjustments can be done by using the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 770 | ``class-devupstream`` override. Here is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 771 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 772 | DEPENDS:append:class-devupstream = " gperf-native" |
| 773 | do_configure:prepend:class-devupstream() { |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 774 | touch ${S}/README |
| 775 | } |
| 776 | |
| 777 | The class |
| 778 | currently only supports creating a development variant of the target |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 779 | recipe, not :ref:`ref-classes-native` or :ref:`ref-classes-nativesdk` variants. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 780 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 781 | The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 782 | support for :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` variants. Consequently, this |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 783 | functionality can be added in a future release. |
| 784 | |
| 785 | Support for other version control systems such as Subversion is limited |
| 786 | due to BitBake's automatic fetch dependencies (e.g. |
| 787 | ``subversion-native``). |
| 788 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 789 | .. _ref-classes-externalsrc: |
| 790 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 791 | ``externalsrc`` |
| 792 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 793 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 794 | The :ref:`ref-classes-externalsrc` class supports building software from source code |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 795 | that is external to the OpenEmbedded build system. Building software |
| 796 | from an external source tree means that the build system's normal fetch, |
| 797 | unpack, and patch process is not used. |
| 798 | |
| 799 | By default, the OpenEmbedded build system uses the :term:`S` |
| 800 | and :term:`B` variables to locate unpacked recipe source code |
| 801 | and to build it, respectively. When your recipe inherits the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 802 | :ref:`ref-classes-externalsrc` class, you use the |
| 803 | :term:`EXTERNALSRC` and :term:`EXTERNALSRC_BUILD` variables to |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 804 | ultimately define :term:`S` and :term:`B`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 805 | |
| 806 | By default, this class expects the source code to support recipe builds |
| 807 | that use the :term:`B` variable to point to the directory in |
| 808 | which the OpenEmbedded build system places the generated objects built |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 809 | from the recipes. By default, the :term:`B` directory is set to the |
| 810 | following, which is separate from the source directory (:term:`S`):: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 811 | |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 812 | ${WORKDIR}/${BPN}-{PV}/ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 813 | |
| 814 | See these variables for more information: |
| 815 | :term:`WORKDIR`, :term:`BPN`, and |
| 816 | :term:`PV`, |
| 817 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 818 | For more information on the :ref:`ref-classes-externalsrc` class, see the comments in |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 819 | ``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`. |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 820 | For information on how to use the :ref:`ref-classes-externalsrc` class, see the |
| 821 | ":ref:`dev-manual/building:building software from an external source`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 822 | section in the Yocto Project Development Tasks Manual. |
| 823 | |
| 824 | .. _ref-classes-extrausers: |
| 825 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 826 | ``extrausers`` |
| 827 | ============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 828 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 829 | The :ref:`ref-classes-extrausers` class allows additional user and group configuration |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 830 | to be applied at the image level. Inheriting this class either globally |
| 831 | or from an image recipe allows additional user and group operations to |
| 832 | be performed using the |
| 833 | :term:`EXTRA_USERS_PARAMS` variable. |
| 834 | |
| 835 | .. note:: |
| 836 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 837 | The user and group operations added using the :ref:`ref-classes-extrausers` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 838 | class are not tied to a specific recipe outside of the recipe for the |
| 839 | image. Thus, the operations can be performed across the image as a |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 840 | whole. Use the :ref:`ref-classes-useradd` class to add user and group |
| 841 | configuration to a specific recipe. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 842 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 843 | Here is an example that uses this class in an image recipe:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 844 | |
| 845 | inherit extrausers |
| 846 | EXTRA_USERS_PARAMS = "\ |
| 847 | useradd -p '' tester; \ |
| 848 | groupadd developers; \ |
| 849 | userdel nobody; \ |
| 850 | groupdel -g video; \ |
| 851 | groupmod -g 1020 developers; \ |
| 852 | usermod -s /bin/sh tester; \ |
| 853 | " |
| 854 | |
| 855 | Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 856 | passwords. First on host, create the (escaped) password hash:: |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 857 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 858 | printf "%q" $(mkpasswd -m sha256crypt tester01) |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 859 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 860 | The resulting hash is set to a variable and used in ``useradd`` command parameters:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 861 | |
| 862 | inherit extrausers |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 863 | PASSWD = "\$X\$ABC123\$A-Long-Hash" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 864 | EXTRA_USERS_PARAMS = "\ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 865 | useradd -p '${PASSWD}' tester-jim; \ |
| 866 | useradd -p '${PASSWD}' tester-sue; \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 867 | " |
| 868 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 869 | Finally, here is an example that sets the root password:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 870 | |
| 871 | inherit extrausers |
| 872 | EXTRA_USERS_PARAMS = "\ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 873 | usermod -p '${PASSWD}' root; \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 874 | " |
| 875 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 876 | .. note:: |
| 877 | |
| 878 | From a security perspective, hardcoding a default password is not |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 879 | generally a good idea or even legal in some jurisdictions. It is |
| 880 | recommended that you do not do this if you are building a production |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 881 | image. |
| 882 | |
| 883 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 884 | .. _ref-classes-features_check: |
| 885 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 886 | ``features_check`` |
| 887 | ================== |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 888 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 889 | The :ref:`ref-classes-features_check` class allows individual recipes to check |
| 890 | for required and conflicting :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES` |
| 891 | or :term:`COMBINED_FEATURES`. |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 892 | |
| 893 | This class provides support for the following variables: |
| 894 | |
| 895 | - :term:`REQUIRED_DISTRO_FEATURES` |
| 896 | - :term:`CONFLICT_DISTRO_FEATURES` |
| 897 | - :term:`ANY_OF_DISTRO_FEATURES` |
| 898 | - ``REQUIRED_MACHINE_FEATURES`` |
| 899 | - ``CONFLICT_MACHINE_FEATURES`` |
| 900 | - ``ANY_OF_MACHINE_FEATURES`` |
| 901 | - ``REQUIRED_COMBINED_FEATURES`` |
| 902 | - ``CONFLICT_COMBINED_FEATURES`` |
| 903 | - ``ANY_OF_COMBINED_FEATURES`` |
| 904 | |
| 905 | If any conditions specified in the recipe using the above |
| 906 | variables are not met, the recipe will be skipped, and if the |
| 907 | build system attempts to build the recipe then an error will be |
| 908 | triggered. |
| 909 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 910 | .. _ref-classes-fontcache: |
| 911 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 912 | ``fontcache`` |
| 913 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 914 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 915 | The :ref:`ref-classes-fontcache` class generates the proper post-install and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 916 | post-remove (postinst and postrm) scriptlets for font packages. These |
| 917 | scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts |
| 918 | to the font information cache. Since the cache files are |
| 919 | architecture-specific, ``fc-cache`` runs using QEMU if the postinst |
| 920 | scriptlets need to be run on the build host during image creation. |
| 921 | |
| 922 | If the fonts being installed are in packages other than the main |
| 923 | package, set :term:`FONT_PACKAGES` to specify the |
| 924 | packages containing the fonts. |
| 925 | |
| 926 | .. _ref-classes-fs-uuid: |
| 927 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 928 | ``fs-uuid`` |
| 929 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 930 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 931 | The :ref:`ref-classes-fs-uuid` class extracts UUID from |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 932 | ``${``\ :term:`ROOTFS`\ ``}``, which must have been built |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 933 | by the time that this function gets called. The :ref:`ref-classes-fs-uuid` class only |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 934 | works on ``ext`` file systems and depends on ``tune2fs``. |
| 935 | |
| 936 | .. _ref-classes-gconf: |
| 937 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 938 | ``gconf`` |
| 939 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 940 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 941 | The :ref:`ref-classes-gconf` class provides common functionality for recipes that need |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 942 | to install GConf schemas. The schemas will be put into a separate |
| 943 | package (``${``\ :term:`PN`\ ``}-gconf``) that is created |
| 944 | automatically when this class is inherited. This package uses the |
| 945 | appropriate post-install and post-remove (postinst/postrm) scriptlets to |
| 946 | register and unregister the schemas in the target image. |
| 947 | |
| 948 | .. _ref-classes-gettext: |
| 949 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 950 | ``gettext`` |
| 951 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 952 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 953 | The :ref:`ref-classes-gettext` class provides support for building |
| 954 | software that uses the GNU ``gettext`` internationalization and localization |
| 955 | system. All recipes building software that use ``gettext`` should inherit this |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 956 | class. |
| 957 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 958 | .. _ref-classes-github-releases: |
| 959 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 960 | ``github-releases`` |
| 961 | =================== |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 962 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 963 | For recipes that fetch release tarballs from github, the :ref:`ref-classes-github-releases` |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 964 | class sets up a standard way for checking available upstream versions |
| 965 | (to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)). |
| 966 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 967 | To use it, add ":ref:`ref-classes-github-releases`" to the inherit line in the recipe, |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 968 | and if the default value of :term:`GITHUB_BASE_URI` is not suitable, |
| 969 | then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}`` |
| 970 | in the value you set for :term:`SRC_URI` within the recipe. |
| 971 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 972 | .. _ref-classes-gnomebase: |
| 973 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 974 | ``gnomebase`` |
| 975 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 976 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 977 | The :ref:`ref-classes-gnomebase` class is the base class for recipes that build |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 978 | software from the GNOME stack. This class sets |
| 979 | :term:`SRC_URI` to download the source from the GNOME |
| 980 | mirrors as well as extending :term:`FILES` with the typical |
| 981 | GNOME installation paths. |
| 982 | |
Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame] | 983 | .. _ref-classes-go: |
| 984 | |
| 985 | ``go`` |
| 986 | ====== |
| 987 | |
| 988 | The :ref:`ref-classes-go` class supports building Go programs. The behavior of |
| 989 | this class is controlled by the mandatory :term:`GO_IMPORT` variable, and |
| 990 | by the optional :term:`GO_INSTALL` and :term:`GO_INSTALL_FILTEROUT` ones. |
| 991 | |
| 992 | To build a Go program with the Yocto Project, you can use the |
| 993 | :yocto_git:`go-helloworld_0.1.bb </poky/tree/meta/recipes-extended/go-examples/go-helloworld_0.1.bb>` |
| 994 | recipe as an example. |
| 995 | |
| 996 | .. _ref-classes-go-mod: |
| 997 | |
| 998 | ``go-mod`` |
| 999 | ========== |
| 1000 | |
| 1001 | The :ref:`ref-classes-go-mod` class allows to use Go modules, and inherits the |
| 1002 | :ref:`ref-classes-go` class. |
| 1003 | |
| 1004 | See the associated :term:`GO_WORKDIR` variable. |
| 1005 | |
Patrick Williams | 44b3caf | 2024-04-12 16:51:14 -0500 | [diff] [blame] | 1006 | .. _ref-classes-go-vendor: |
| 1007 | |
| 1008 | ``go-vendor`` |
| 1009 | ============= |
| 1010 | |
| 1011 | The :ref:`ref-classes-go-vendor` class implements support for offline builds, |
| 1012 | also known as Go vendoring. In such a scenario, the module dependencias are |
| 1013 | downloaded during the :ref:`ref-tasks-fetch` task rather than when modules are |
| 1014 | imported, thus being coherent with Yocto's concept of fetching every source |
| 1015 | beforehand. |
| 1016 | |
| 1017 | The dependencies are unpacked into the modules' ``vendor`` directory, where a |
| 1018 | manifest file is generated. |
| 1019 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1020 | .. _ref-classes-gobject-introspection: |
| 1021 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1022 | ``gobject-introspection`` |
| 1023 | ========================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1024 | |
| 1025 | Provides support for recipes building software that supports GObject |
| 1026 | introspection. This functionality is only enabled if the |
| 1027 | "gobject-introspection-data" feature is in |
| 1028 | :term:`DISTRO_FEATURES` as well as |
| 1029 | "qemu-usermode" being in |
| 1030 | :term:`MACHINE_FEATURES`. |
| 1031 | |
| 1032 | .. note:: |
| 1033 | |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 1034 | This functionality is :ref:`backfilled <ref-features-backfill>` by default |
| 1035 | and, if not applicable, should be disabled through |
| 1036 | :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1037 | :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1038 | |
| 1039 | .. _ref-classes-grub-efi: |
| 1040 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1041 | ``grub-efi`` |
| 1042 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1043 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1044 | The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1045 | building bootable images. |
| 1046 | |
| 1047 | This class supports several variables: |
| 1048 | |
| 1049 | - :term:`INITRD`: Indicates list of filesystem images to |
| 1050 | concatenate and use as an initial RAM disk (initrd) (optional). |
| 1051 | |
| 1052 | - :term:`ROOTFS`: Indicates a filesystem image to include |
| 1053 | as the root filesystem (optional). |
| 1054 | |
| 1055 | - :term:`GRUB_GFXSERIAL`: Set this to "1" to have |
| 1056 | graphics and serial in the boot menu. |
| 1057 | |
| 1058 | - :term:`LABELS`: A list of targets for the automatic |
| 1059 | configuration. |
| 1060 | |
| 1061 | - :term:`APPEND`: An override list of append strings for |
| 1062 | each ``LABEL``. |
| 1063 | |
| 1064 | - :term:`GRUB_OPTS`: Additional options to add to the |
| 1065 | configuration (optional). Options are delimited using semi-colon |
| 1066 | characters (``;``). |
| 1067 | |
| 1068 | - :term:`GRUB_TIMEOUT`: Timeout before executing |
| 1069 | the default ``LABEL`` (optional). |
| 1070 | |
| 1071 | .. _ref-classes-gsettings: |
| 1072 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1073 | ``gsettings`` |
| 1074 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1075 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1076 | The :ref:`ref-classes-gsettings` class provides common functionality for recipes that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1077 | need to install GSettings (glib) schemas. The schemas are assumed to be |
| 1078 | part of the main package. Appropriate post-install and post-remove |
| 1079 | (postinst/postrm) scriptlets are added to register and unregister the |
| 1080 | schemas in the target image. |
| 1081 | |
| 1082 | .. _ref-classes-gtk-doc: |
| 1083 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1084 | ``gtk-doc`` |
| 1085 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1086 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1087 | The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1088 | ``gtk-doc`` dependencies and disable ``gtk-doc``. |
| 1089 | |
| 1090 | .. _ref-classes-gtk-icon-cache: |
| 1091 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1092 | ``gtk-icon-cache`` |
| 1093 | ================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1094 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1095 | The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1096 | post-remove (postinst/postrm) scriptlets for packages that use GTK+ and |
| 1097 | install icons. These scriptlets call ``gtk-update-icon-cache`` to add |
| 1098 | the fonts to GTK+'s icon cache. Since the cache files are |
| 1099 | architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if |
| 1100 | the postinst scriptlets need to be run on the build host during image |
| 1101 | creation. |
| 1102 | |
| 1103 | .. _ref-classes-gtk-immodules-cache: |
| 1104 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1105 | ``gtk-immodules-cache`` |
| 1106 | ======================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1107 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1108 | The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1109 | post-remove (postinst/postrm) scriptlets for packages that install GTK+ |
| 1110 | input method modules for virtual keyboards. These scriptlets call |
| 1111 | ``gtk-update-icon-cache`` to add the input method modules to the cache. |
| 1112 | Since the cache files are architecture-specific, |
| 1113 | ``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets |
| 1114 | need to be run on the build host during image creation. |
| 1115 | |
| 1116 | If the input method modules being installed are in packages other than |
| 1117 | the main package, set |
| 1118 | :term:`GTKIMMODULES_PACKAGES` to specify |
| 1119 | the packages containing the modules. |
| 1120 | |
| 1121 | .. _ref-classes-gzipnative: |
| 1122 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1123 | ``gzipnative`` |
| 1124 | ============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1125 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1126 | The :ref:`ref-classes-gzipnative` class enables the use of different native versions of |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1127 | ``gzip`` and ``pigz`` rather than the versions of these tools from the |
| 1128 | build host. |
| 1129 | |
| 1130 | .. _ref-classes-icecc: |
| 1131 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1132 | ``icecc`` |
| 1133 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1134 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1135 | The :ref:`ref-classes-icecc` class supports |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1136 | `Icecream <https://github.com/icecc/icecream>`__, which facilitates |
| 1137 | taking compile jobs and distributing them among remote machines. |
| 1138 | |
| 1139 | The class stages directories with symlinks from ``gcc`` and ``g++`` to |
| 1140 | ``icecc``, for both native and cross compilers. Depending on each |
| 1141 | configure or compile, the OpenEmbedded build system adds the directories |
| 1142 | at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 1143 | ``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1144 | compilers, respectively. |
| 1145 | |
| 1146 | For the cross compiler, the class creates a ``tar.gz`` file that |
| 1147 | contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which |
| 1148 | is the version of the cross-compiler used in the cross-development |
| 1149 | toolchain, accordingly. |
| 1150 | |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 1151 | The class handles all three different compile stages (i.e native, |
| 1152 | cross-kernel and target) and creates the necessary environment |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1153 | ``tar.gz`` file to be used by the remote machines. The class also |
| 1154 | supports SDK generation. |
| 1155 | |
| 1156 | If :term:`ICECC_PATH` is not set in your |
| 1157 | ``local.conf`` file, then the class tries to locate the ``icecc`` binary |
| 1158 | using ``which``. If :term:`ICECC_ENV_EXEC` is set |
| 1159 | in your ``local.conf`` file, the variable should point to the |
| 1160 | ``icecc-create-env`` script provided by the user. If you do not point to |
| 1161 | a user-provided script, the build system uses the default script |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 1162 | provided by the recipe :oe_git:`icecc-create-env_0.1.bb |
| 1163 | </openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1164 | |
| 1165 | .. note:: |
| 1166 | |
| 1167 | This script is a modified version and not the one that comes with |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 1168 | ``icecream``. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1169 | |
| 1170 | If you do not want the Icecream distributed compile support to apply to |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1171 | specific recipes or classes, you can ask them to be ignored by Icecream |
| 1172 | by listing the recipes and classes using the |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 1173 | :term:`ICECC_RECIPE_DISABLE` and |
| 1174 | :term:`ICECC_CLASS_DISABLE` variables, |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1175 | respectively, in your ``local.conf`` file. Doing so causes the |
| 1176 | OpenEmbedded build system to handle these compilations locally. |
| 1177 | |
| 1178 | Additionally, you can list recipes using the |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 1179 | :term:`ICECC_RECIPE_ENABLE` variable in |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1180 | your ``local.conf`` file to force ``icecc`` to be enabled for recipes |
| 1181 | using an empty :term:`PARALLEL_MAKE` variable. |
| 1182 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1183 | Inheriting the :ref:`ref-classes-icecc` class changes all sstate signatures. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1184 | Consequently, if a development team has a dedicated build system that |
| 1185 | populates :term:`SSTATE_MIRRORS` and they want to |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1186 | reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1187 | system need to either inherit the :ref:`ref-classes-icecc` class or nobody should. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1188 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1189 | At the distribution level, you can inherit the :ref:`ref-classes-icecc` class to be |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1190 | sure that all builders start with the same sstate signatures. After |
| 1191 | inheriting the class, you can then disable the feature by setting the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1192 | :term:`ICECC_DISABLED` variable to "1" as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1193 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 1194 | INHERIT_DISTRO:append = " icecc" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1195 | ICECC_DISABLED ??= "1" |
| 1196 | |
| 1197 | This practice |
| 1198 | makes sure everyone is using the same signatures but also requires |
| 1199 | individuals that do want to use Icecream to enable the feature |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1200 | individually as follows in your ``local.conf`` file:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1201 | |
| 1202 | ICECC_DISABLED = "" |
| 1203 | |
| 1204 | .. _ref-classes-image: |
| 1205 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1206 | ``image`` |
| 1207 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1208 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1209 | The :ref:`ref-classes-image` class helps support creating images in different formats. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1210 | First, the root filesystem is created from packages using one of the |
| 1211 | ``rootfs*.bbclass`` files (depending on the package format used) and |
| 1212 | then one or more image files are created. |
| 1213 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1214 | - The :term:`IMAGE_FSTYPES` variable controls the types of images to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1215 | generate. |
| 1216 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1217 | - The :term:`IMAGE_INSTALL` variable controls the list of packages to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1218 | install into the image. |
| 1219 | |
| 1220 | For information on customizing images, see the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1221 | ":ref:`dev-manual/customizing-images:customizing images`" section |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1222 | in the Yocto Project Development Tasks Manual. For information on how |
| 1223 | images are created, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1224 | ":ref:`overview-manual/concepts:images`" section in the |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1225 | Yocto Project Overview and Concepts Manual. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1226 | |
| 1227 | .. _ref-classes-image-buildinfo: |
| 1228 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1229 | ``image-buildinfo`` |
| 1230 | =================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1231 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1232 | The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 1233 | build information to the target filesystem at ``${sysconfdir}/buildinfo`` |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 1234 | by default (as specified by :term:`IMAGE_BUILDINFO_FILE`). |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 1235 | This can be useful for manually determining the origin of any given |
| 1236 | image. It writes out two sections: |
| 1237 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1238 | #. `Build Configuration`: a list of variables and their values (specified |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 1239 | by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and |
| 1240 | :term:`DISTRO_VERSION`) |
| 1241 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1242 | #. `Layer Revisions`: the revisions of all of the layers used in the |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 1243 | build. |
| 1244 | |
| 1245 | Additionally, when building an SDK it will write the same contents |
| 1246 | to ``/buildinfo`` by default (as specified by |
| 1247 | :term:`SDK_BUILDINFO_FILE`). |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1248 | |
| 1249 | .. _ref-classes-image_types: |
| 1250 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1251 | ``image_types`` |
| 1252 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1253 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1254 | The :ref:`ref-classes-image_types` class defines all of the standard image output types |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1255 | that you can enable through the |
| 1256 | :term:`IMAGE_FSTYPES` variable. You can use this |
| 1257 | class as a reference on how to add support for custom image output |
| 1258 | types. |
| 1259 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1260 | By default, the :ref:`ref-classes-image` class automatically |
| 1261 | enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1262 | ``IMGCLASSES`` variable as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1263 | |
| 1264 | IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}" |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame] | 1265 | # Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk_base |
| 1266 | # in the non-Linux SDK_OS case, such as mingw32 |
| 1267 | inherit populate_sdk_base |
| 1268 | IMGCLASSES += "${@['', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1269 | IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}" |
| 1270 | IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}" |
| 1271 | IMGCLASSES += "image_types_wic" |
| 1272 | IMGCLASSES += "rootfs-postcommands" |
| 1273 | IMGCLASSES += "image-postinst-intercepts" |
Patrick Williams | 03514f1 | 2024-04-05 07:04:11 -0500 | [diff] [blame] | 1274 | IMGCLASSES += "overlayfs-etc" |
| 1275 | inherit_defer ${IMGCLASSES} |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1276 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1277 | The :ref:`ref-classes-image_types` class also handles conversion and compression of images. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1278 | |
| 1279 | .. note:: |
| 1280 | |
| 1281 | To build a VMware VMDK image, you need to add "wic.vmdk" to |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1282 | :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1283 | Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1284 | |
| 1285 | .. _ref-classes-image-live: |
| 1286 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1287 | ``image-live`` |
| 1288 | ============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1289 | |
| 1290 | This class controls building "live" (i.e. HDDIMG and ISO) images. Live |
| 1291 | images contain syslinux for legacy booting, as well as the bootloader |
| 1292 | specified by :term:`EFI_PROVIDER` if |
| 1293 | :term:`MACHINE_FEATURES` contains "efi". |
| 1294 | |
| 1295 | Normally, you do not use this class directly. Instead, you add "live" to |
| 1296 | :term:`IMAGE_FSTYPES`. |
| 1297 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1298 | .. _ref-classes-insane: |
| 1299 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1300 | ``insane`` |
| 1301 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1302 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1303 | The :ref:`ref-classes-insane` class adds a step to the package generation process so |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1304 | that output quality assurance checks are generated by the OpenEmbedded |
| 1305 | build system. A range of checks are performed that check the build's |
| 1306 | output for common problems that show up during runtime. Distribution |
| 1307 | policy usually dictates whether to include this class. |
| 1308 | |
| 1309 | You can configure the sanity checks so that specific test failures |
| 1310 | either raise a warning or an error message. Typically, failures for new |
| 1311 | tests generate a warning. Subsequent failures for the same test would |
| 1312 | then generate an error message once the metadata is in a known and good |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1313 | condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1314 | and error messages you might encounter using a default configuration. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1315 | |
| 1316 | Use the :term:`WARN_QA` and |
| 1317 | :term:`ERROR_QA` variables to control the behavior of |
| 1318 | these checks at the global level (i.e. in your custom distro |
| 1319 | configuration). However, to skip one or more checks in recipes, you |
| 1320 | should use :term:`INSANE_SKIP`. For example, to skip |
| 1321 | the check for symbolic link ``.so`` files in the main package of a |
| 1322 | recipe, add the following to the recipe. You need to realize that the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1323 | package name override, in this example ``${PN}``, must be used:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1324 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 1325 | INSANE_SKIP:${PN} += "dev-so" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1326 | |
| 1327 | Please keep in mind that the QA checks |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1328 | are meant to detect real or potential problems in the packaged |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1329 | output. So exercise caution when disabling these checks. |
| 1330 | |
Patrick Williams | 3965356 | 2024-03-01 08:54:02 -0600 | [diff] [blame] | 1331 | The tests you can list with the :term:`WARN_QA` and |
| 1332 | :term:`ERROR_QA` variables are: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1333 | |
| 1334 | - ``already-stripped:`` Checks that produced binaries have not |
| 1335 | already been stripped prior to the build system extracting debug |
| 1336 | symbols. It is common for upstream software projects to default to |
| 1337 | stripping debug symbols for output binaries. In order for debugging |
| 1338 | to work on the target using ``-dbg`` packages, this stripping must be |
| 1339 | disabled. |
| 1340 | |
| 1341 | - ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit |
| 1342 | size, and endianness of any binaries to ensure they match the target |
| 1343 | architecture. This test fails if any binaries do not match the type |
| 1344 | since there would be an incompatibility. The test could indicate that |
| 1345 | the wrong compiler or compiler options have been used. Sometimes |
| 1346 | software, like bootloaders, might need to bypass this check. |
| 1347 | |
| 1348 | - ``buildpaths:`` Checks for paths to locations on the build host |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 1349 | inside the output files. Not only can these leak information about |
| 1350 | the build environment, they also hinder binary reproducibility. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1351 | |
| 1352 | - ``build-deps:`` Determines if a build-time dependency that is |
| 1353 | specified through :term:`DEPENDS`, explicit |
| 1354 | :term:`RDEPENDS`, or task-level dependencies exists |
| 1355 | to match any runtime dependency. This determination is particularly |
| 1356 | useful to discover where runtime dependencies are detected and added |
| 1357 | during packaging. If no explicit dependency has been specified within |
| 1358 | the metadata, at the packaging stage it is too late to ensure that |
| 1359 | the dependency is built, and thus you can end up with an error when |
| 1360 | the package is installed into the image during the |
| 1361 | :ref:`ref-tasks-rootfs` task because the auto-detected |
| 1362 | dependency was not satisfied. An example of this would be where the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1363 | :ref:`ref-classes-update-rc.d` class automatically |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1364 | adds a dependency on the ``initscripts-functions`` package to |
| 1365 | packages that install an initscript that refers to |
| 1366 | ``/etc/init.d/functions``. The recipe should really have an explicit |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 1367 | :term:`RDEPENDS` for the package in question on ``initscripts-functions`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1368 | so that the OpenEmbedded build system is able to ensure that the |
| 1369 | ``initscripts`` recipe is actually built and thus the |
| 1370 | ``initscripts-functions`` package is made available. |
| 1371 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1372 | - ``configure-gettext:`` Checks that if a recipe is building something |
| 1373 | that uses automake and the automake files contain an ``AM_GNU_GETTEXT`` |
| 1374 | directive, that the recipe also inherits the :ref:`ref-classes-gettext` |
| 1375 | class to ensure that gettext is available during the build. |
| 1376 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1377 | - ``compile-host-path:`` Checks the |
| 1378 | :ref:`ref-tasks-compile` log for indications that |
| 1379 | paths to locations on the build host were used. Using such paths |
| 1380 | might result in host contamination of the build output. |
| 1381 | |
Patrick Williams | b58112e | 2024-03-07 11:16:36 -0600 | [diff] [blame] | 1382 | - ``cve_status_not_in_db:`` Checks for each component if CVEs that are ignored |
| 1383 | via :term:`CVE_STATUS`, that those are (still) reported for this component |
| 1384 | in the NIST database. If not, a warning is printed. This check is disabled |
| 1385 | by default. |
| 1386 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1387 | - ``debug-deps:`` Checks that all packages except ``-dbg`` packages |
| 1388 | do not depend on ``-dbg`` packages, which would cause a packaging |
| 1389 | bug. |
| 1390 | |
| 1391 | - ``debug-files:`` Checks for ``.debug`` directories in anything but |
| 1392 | the ``-dbg`` package. The debug files should all be in the ``-dbg`` |
| 1393 | package. Thus, anything packaged elsewhere is incorrect packaging. |
| 1394 | |
| 1395 | - ``dep-cmp:`` Checks for invalid version comparison statements in |
| 1396 | runtime dependency relationships between packages (i.e. in |
| 1397 | :term:`RDEPENDS`, |
| 1398 | :term:`RRECOMMENDS`, |
| 1399 | :term:`RSUGGESTS`, |
| 1400 | :term:`RPROVIDES`, |
| 1401 | :term:`RREPLACES`, and |
| 1402 | :term:`RCONFLICTS` variable values). Any invalid |
| 1403 | comparisons might trigger failures or undesirable behavior when |
| 1404 | passed to the package manager. |
| 1405 | |
| 1406 | - ``desktop:`` Runs the ``desktop-file-validate`` program against any |
| 1407 | ``.desktop`` files to validate their contents against the |
| 1408 | specification for ``.desktop`` files. |
| 1409 | |
| 1410 | - ``dev-deps:`` Checks that all packages except ``-dev`` or |
| 1411 | ``-staticdev`` packages do not depend on ``-dev`` packages, which |
| 1412 | would be a packaging bug. |
| 1413 | |
| 1414 | - ``dev-so:`` Checks that the ``.so`` symbolic links are in the |
| 1415 | ``-dev`` package and not in any of the other packages. In general, |
| 1416 | these symlinks are only useful for development purposes. Thus, the |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1417 | ``-dev`` package is the correct location for them. In very rare |
| 1418 | cases, such as dynamically loaded modules, these symlinks |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1419 | are needed instead in the main package. |
| 1420 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 1421 | - ``empty-dirs:`` Checks that packages are not installing files to |
| 1422 | directories that are normally expected to be empty (such as ``/tmp``) |
| 1423 | The list of directories that are checked is specified by the |
| 1424 | :term:`QA_EMPTY_DIRS` variable. |
| 1425 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1426 | - ``file-rdeps:`` Checks that file-level dependencies identified by |
| 1427 | the OpenEmbedded build system at packaging time are satisfied. For |
| 1428 | example, a shell script might start with the line ``#!/bin/bash``. |
| 1429 | This line would translate to a file dependency on ``/bin/bash``. Of |
| 1430 | the three package managers that the OpenEmbedded build system |
| 1431 | supports, only RPM directly handles file-level dependencies, |
| 1432 | resolving them automatically to packages providing the files. |
| 1433 | However, the lack of that functionality in the other two package |
| 1434 | managers does not mean the dependencies do not still need resolving. |
| 1435 | This QA check attempts to ensure that explicitly declared |
| 1436 | :term:`RDEPENDS` exist to handle any file-level |
| 1437 | dependency detected in packaged files. |
| 1438 | |
| 1439 | - ``files-invalid:`` Checks for :term:`FILES` variable |
| 1440 | values that contain "//", which is invalid. |
| 1441 | |
| 1442 | - ``host-user-contaminated:`` Checks that no package produced by the |
| 1443 | recipe contains any files outside of ``/home`` with a user or group |
| 1444 | ID that matches the user running BitBake. A match usually indicates |
| 1445 | that the files are being installed with an incorrect UID/GID, since |
| 1446 | target IDs are independent from host IDs. For additional information, |
| 1447 | see the section describing the |
| 1448 | :ref:`ref-tasks-install` task. |
| 1449 | |
| 1450 | - ``incompatible-license:`` Report when packages are excluded from |
| 1451 | being created due to being marked with a license that is in |
| 1452 | :term:`INCOMPATIBLE_LICENSE`. |
| 1453 | |
| 1454 | - ``install-host-path:`` Checks the |
| 1455 | :ref:`ref-tasks-install` log for indications that |
| 1456 | paths to locations on the build host were used. Using such paths |
| 1457 | might result in host contamination of the build output. |
| 1458 | |
| 1459 | - ``installed-vs-shipped:`` Reports when files have been installed |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1460 | within :ref:`ref-tasks-install` but have not been included in any package by |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1461 | way of the :term:`FILES` variable. Files that do not |
| 1462 | appear in any package cannot be present in an image later on in the |
| 1463 | build process. Ideally, all installed files should be packaged or not |
| 1464 | installed at all. These files can be deleted at the end of |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1465 | :ref:`ref-tasks-install` if the files are not needed in any package. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1466 | |
| 1467 | - ``invalid-chars:`` Checks that the recipe metadata variables |
| 1468 | :term:`DESCRIPTION`, |
| 1469 | :term:`SUMMARY`, :term:`LICENSE`, and |
| 1470 | :term:`SECTION` do not contain non-UTF-8 characters. |
| 1471 | Some package managers do not support such characters. |
| 1472 | |
| 1473 | - ``invalid-packageconfig:`` Checks that no undefined features are |
| 1474 | being added to :term:`PACKAGECONFIG`. For |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1475 | example, any name "foo" for which the following form does not exist:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1476 | |
| 1477 | PACKAGECONFIG[foo] = "..." |
| 1478 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1479 | - ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1480 | file containing these paths is incorrect since ``libtool`` adds the |
| 1481 | correct sysroot prefix when using the files automatically itself. |
| 1482 | |
| 1483 | - ``ldflags:`` Ensures that the binaries were linked with the |
| 1484 | :term:`LDFLAGS` options provided by the build system. |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1485 | If this test fails, check that the :term:`LDFLAGS` variable is being |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1486 | passed to the linker command. |
| 1487 | |
| 1488 | - ``libdir:`` Checks for libraries being installed into incorrect |
| 1489 | (possibly hardcoded) installation paths. For example, this test will |
| 1490 | catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is |
| 1491 | "lib32". Another example is when recipes install |
| 1492 | ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib". |
| 1493 | |
| 1494 | - ``libexec:`` Checks if a package contains files in |
| 1495 | ``/usr/libexec``. This check is not performed if the ``libexecdir`` |
| 1496 | variable has been set explicitly to ``/usr/libexec``. |
| 1497 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1498 | - ``mime:`` Check that if a package contains mime type files (``.xml`` |
| 1499 | files in ``${datadir}/mime/packages``) that the recipe also inherits |
| 1500 | the :ref:`ref-classes-mime` class in order to ensure that these get |
| 1501 | properly installed. |
| 1502 | |
| 1503 | - ``mime-xdg:`` Checks that if a package contains a .desktop file with a |
| 1504 | 'MimeType' key present, that the recipe inherits the |
| 1505 | :ref:`ref-classes-mime-xdg` class that is required in order for that |
| 1506 | to be activated. |
| 1507 | |
| 1508 | - ``missing-update-alternatives:`` Check that if a recipe sets the |
| 1509 | :term:`ALTERNATIVE` variable that the recipe also inherits |
| 1510 | :ref:`ref-classes-update-alternatives` such that the alternative will |
| 1511 | be correctly set up. |
| 1512 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1513 | - ``packages-list:`` Checks for the same package being listed |
| 1514 | multiple times through the :term:`PACKAGES` variable |
| 1515 | value. Installing the package in this manner can cause errors during |
| 1516 | packaging. |
| 1517 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1518 | - ``patch-fuzz:`` Checks for fuzz in patch files that may allow |
| 1519 | them to apply incorrectly if the underlying code changes. |
| 1520 | |
Patrick Williams | 8460358 | 2024-12-14 08:00:57 -0500 | [diff] [blame] | 1521 | - ``patch-status:`` Checks that the ``Upstream-Status`` is specified and valid |
| 1522 | in the headers of patches for recipes. |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1523 | |
Patrick Williams | 8460358 | 2024-12-14 08:00:57 -0500 | [diff] [blame] | 1524 | - ``pep517-backend:`` checks that a recipe inheriting |
| 1525 | :ref:`ref-classes-setuptools3` has a PEP517-compliant backend. |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1526 | |
| 1527 | - ``perllocalpod:`` Checks for ``perllocal.pod`` being erroneously |
| 1528 | installed and packaged by a recipe. |
| 1529 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1530 | - ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an |
| 1531 | invalid format. |
| 1532 | |
| 1533 | - ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an |
| 1534 | invalid format. |
| 1535 | |
| 1536 | - ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify |
| 1537 | 'link' where the specified target already exists. |
| 1538 | |
| 1539 | - ``perms:`` Currently, this check is unused but reserved. |
| 1540 | |
| 1541 | - ``pkgconfig:`` Checks ``.pc`` files for any |
| 1542 | :term:`TMPDIR`/:term:`WORKDIR` paths. |
| 1543 | Any ``.pc`` file containing these paths is incorrect since |
| 1544 | ``pkg-config`` itself adds the correct sysroot prefix when the files |
| 1545 | are accessed. |
| 1546 | |
| 1547 | - ``pkgname:`` Checks that all packages in |
| 1548 | :term:`PACKAGES` have names that do not contain |
| 1549 | invalid characters (i.e. characters other than 0-9, a-z, ., +, and |
| 1550 | -). |
| 1551 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1552 | - ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1553 | undefined during :ref:`ref-tasks-package`. |
| 1554 | |
| 1555 | - ``pkgvarcheck:`` Checks through the variables |
| 1556 | :term:`RDEPENDS`, |
| 1557 | :term:`RRECOMMENDS`, |
| 1558 | :term:`RSUGGESTS`, |
| 1559 | :term:`RCONFLICTS`, |
| 1560 | :term:`RPROVIDES`, |
| 1561 | :term:`RREPLACES`, :term:`FILES`, |
| 1562 | :term:`ALLOW_EMPTY`, ``pkg_preinst``, |
| 1563 | ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if |
| 1564 | there are variable sets that are not package-specific. Using these |
| 1565 | variables without a package suffix is bad practice, and might |
| 1566 | unnecessarily complicate dependencies of other packages within the |
| 1567 | same recipe or have other unintended consequences. |
| 1568 | |
| 1569 | - ``pn-overrides:`` Checks that a recipe does not have a name |
| 1570 | (:term:`PN`) value that appears in |
| 1571 | :term:`OVERRIDES`. If a recipe is named such that |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1572 | its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g. |
| 1573 | :term:`PN` happens to be the same as :term:`MACHINE` or |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1574 | :term:`DISTRO`), it can have unexpected consequences. |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 1575 | For example, assignments such as ``FILES:${PN} = "xyz"`` effectively |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1576 | turn into ``FILES = "xyz"``. |
| 1577 | |
| 1578 | - ``rpaths:`` Checks for rpaths in the binaries that contain build |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 1579 | system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1580 | options are being passed to the linker commands and your binaries |
| 1581 | have potential security issues. |
| 1582 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1583 | - ``shebang-size:`` Check that the shebang line (``#!`` in the first line) |
| 1584 | in a packaged script is not longer than 128 characters, which can cause |
| 1585 | an error at runtime depending on the operating system. |
| 1586 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1587 | - ``split-strip:`` Reports that splitting or stripping debug symbols |
| 1588 | from binaries has failed. |
| 1589 | |
| 1590 | - ``staticdev:`` Checks for static library files (``*.a``) in |
| 1591 | non-``staticdev`` packages. |
| 1592 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1593 | - ``src-uri-bad:`` Checks that the :term:`SRC_URI` value set by a recipe |
| 1594 | does not contain a reference to ``${PN}`` (instead of the correct |
| 1595 | ``${BPN}``) nor refers to unstable Github archive tarballs. |
| 1596 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1597 | - ``symlink-to-sysroot:`` Checks for symlinks in packages that point |
| 1598 | into :term:`TMPDIR` on the host. Such symlinks will |
| 1599 | work on the host, but are clearly invalid when running on the target. |
| 1600 | |
| 1601 | - ``textrel:`` Checks for ELF binaries that contain relocations in |
| 1602 | their ``.text`` sections, which can result in a performance impact at |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1603 | runtime. See the explanation for the ``ELF binary`` message in |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1604 | ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1605 | issues. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1606 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1607 | - ``unhandled-features-check:`` check that if one of the variables that |
| 1608 | the :ref:`ref-classes-features_check` class supports (e.g. |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 1609 | :term:`REQUIRED_DISTRO_FEATURES`) is set by a recipe, then the recipe |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1610 | also inherits :ref:`ref-classes-features_check` in order for the |
| 1611 | requirement to actually work. |
| 1612 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 1613 | - ``unimplemented-ptest:`` Checks that ptests are implemented for upstream |
| 1614 | tests. |
| 1615 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1616 | - ``unlisted-pkg-lics:`` Checks that all declared licenses applying |
| 1617 | for a package are also declared on the recipe level (i.e. any license |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 1618 | in ``LICENSE:*`` should appear in :term:`LICENSE`). |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1619 | |
| 1620 | - ``useless-rpaths:`` Checks for dynamic library load paths (rpaths) |
| 1621 | in the binaries that by default on a standard system are searched by |
| 1622 | the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will |
| 1623 | not cause any breakage, they do waste space and are unnecessary. |
| 1624 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1625 | - ``usrmerge:`` If ``usrmerge`` is in :term:`DISTRO_FEATURES`, this |
| 1626 | check will ensure that no package installs files to root (``/bin``, |
| 1627 | ``/sbin``, ``/lib``, ``/lib64``) directories. |
| 1628 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1629 | - ``var-undefined:`` Reports when variables fundamental to packaging |
| 1630 | (i.e. :term:`WORKDIR`, |
| 1631 | :term:`DEPLOY_DIR`, :term:`D`, |
| 1632 | :term:`PN`, and :term:`PKGD`) are undefined |
| 1633 | during :ref:`ref-tasks-package`. |
| 1634 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 1635 | - ``version-going-backwards:`` If the :ref:`ref-classes-buildhistory` |
| 1636 | class is enabled, reports when a package being written out has a lower |
| 1637 | version than the previously written package under the same name. If |
| 1638 | you are placing output packages into a feed and upgrading packages on |
| 1639 | a target system using that feed, the version of a package going |
| 1640 | backwards can result in the target system not correctly upgrading to |
| 1641 | the "new" version of the package. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1642 | |
| 1643 | .. note:: |
| 1644 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1645 | This is only relevant when you are using runtime package management |
| 1646 | on your target system. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1647 | |
Patrick Williams | 2f814a6 | 2024-04-16 16:28:03 -0500 | [diff] [blame] | 1648 | - ``virtual-slash:`` Checks to see if ``virtual/`` is being used in |
| 1649 | :term:`RDEPENDS` or :term:`RPROVIDES`, which is not good practice --- |
| 1650 | ``virtual/`` is a convention intended for use in the build context |
| 1651 | (i.e. :term:`PROVIDES` and :term:`DEPENDS`) rather than the runtime |
| 1652 | context. |
| 1653 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1654 | - ``xorg-driver-abi:`` Checks that all packages containing Xorg |
| 1655 | drivers have ABI dependencies. The ``xserver-xorg`` recipe provides |
| 1656 | driver ABI names. All drivers should depend on the ABI versions that |
| 1657 | they have been built against. Driver recipes that include |
| 1658 | ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will |
| 1659 | automatically get these versions. Consequently, you should only need |
| 1660 | to explicitly add dependencies to binary driver recipes. |
| 1661 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1662 | .. _ref-classes-kernel: |
| 1663 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1664 | ``kernel`` |
| 1665 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1666 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1667 | The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1668 | code to build all kernel trees. All needed headers are staged into the |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 1669 | :term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1670 | using the :ref:`ref-classes-module` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1671 | |
Andrew Geissler | 3eeda90 | 2023-05-19 10:14:02 -0500 | [diff] [blame] | 1672 | If a file named ``defconfig`` is listed in :term:`SRC_URI`, then by default |
| 1673 | :ref:`ref-tasks-configure` copies it as ``.config`` in the build directory, |
| 1674 | so it is automatically used as the kernel configuration for the build. This |
| 1675 | copy is not performed in case ``.config`` already exists there: this allows |
| 1676 | recipes to produce a configuration by other means in |
| 1677 | ``do_configure:prepend``. |
| 1678 | |
| 1679 | Each built kernel module is packaged separately and inter-module |
| 1680 | dependencies are created by parsing the ``modinfo`` output. If all modules |
| 1681 | are required, then installing the ``kernel-modules`` package installs all |
| 1682 | packages with modules and various other kernel packages such as |
| 1683 | ``kernel-vmlinux``. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1684 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1685 | The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1686 | RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For |
| 1687 | information on how to build an :term:`Initramfs`, see the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1688 | ":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1689 | the Yocto Project Development Tasks Manual. |
| 1690 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1691 | Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes |
| 1692 | internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and |
| 1693 | :ref:`ref-classes-linux-kernel-base` classes. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1694 | |
| 1695 | .. _ref-classes-kernel-arch: |
| 1696 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1697 | ``kernel-arch`` |
| 1698 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1699 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1700 | The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1701 | Linux kernel compilation (including modules). |
| 1702 | |
| 1703 | .. _ref-classes-kernel-devicetree: |
| 1704 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1705 | ``kernel-devicetree`` |
| 1706 | ===================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1707 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1708 | The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the |
| 1709 | :ref:`ref-classes-kernel` class, supports device tree generation. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1710 | |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 1711 | Its behavior is mainly controlled by the following variables: |
| 1712 | |
| 1713 | - :term:`KERNEL_DEVICETREE_BUNDLE`: whether to bundle the kernel and device tree |
| 1714 | - :term:`KERNEL_DTBDEST`: directory where to install DTB files |
| 1715 | - :term:`KERNEL_DTBVENDORED`: whether to keep vendor subdirectories |
| 1716 | - :term:`KERNEL_DTC_FLAGS`: flags for ``dtc``, the Device Tree Compiler |
| 1717 | - :term:`KERNEL_PACKAGE_NAME`: base name of the kernel packages |
| 1718 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1719 | .. _ref-classes-kernel-fitimage: |
| 1720 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1721 | ``kernel-fitimage`` |
| 1722 | =================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1723 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1724 | The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image, |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 1725 | device trees, a U-boot script, an :term:`Initramfs` bundle and a RAM disk |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1726 | into a single FIT image. In theory, a FIT image can support any number |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1727 | of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees. |
| 1728 | However, :ref:`ref-classes-kernel-fitimage` currently only supports |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 1729 | limited usecases: just one kernel image, an optional U-boot script, |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1730 | an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 1731 | device trees. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1732 | |
| 1733 | To create a FIT image, it is required that :term:`KERNEL_CLASSES` |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 1734 | is set to include ":ref:`ref-classes-kernel-fitimage`" and one of :term:`KERNEL_IMAGETYPE`, |
| 1735 | :term:`KERNEL_ALT_IMAGETYPE` or :term:`KERNEL_IMAGETYPES` to include "fitImage". |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1736 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1737 | The options for the device tree compiler passed to ``mkimage -D`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1738 | when creating the FIT image are specified using the |
| 1739 | :term:`UBOOT_MKIMAGE_DTCOPTS` variable. |
| 1740 | |
| 1741 | Only a single kernel can be added to the FIT image created by |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1742 | :ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1743 | address where the kernel image is to be loaded by U-Boot is |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1744 | specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by |
Andrew Geissler | 3eeda90 | 2023-05-19 10:14:02 -0500 | [diff] [blame] | 1745 | :term:`UBOOT_ENTRYPOINT`. Setting :term:`FIT_ADDRESS_CELLS` to "2" |
| 1746 | is necessary if such addresses are 64 bit ones. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1747 | |
| 1748 | Multiple device trees can be added to the FIT image created by |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1749 | :ref:`ref-classes-kernel-fitimage` and the device tree is optional. |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1750 | The address where the device tree is to be loaded by U-Boot is |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1751 | specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1752 | and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1753 | |
| 1754 | Only a single RAM disk can be added to the FIT image created by |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1755 | :ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional. |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1756 | The address where the RAM disk image is to be loaded by U-Boot |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1757 | is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 1758 | :term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to the FIT image when |
| 1759 | :term:`INITRAMFS_IMAGE` is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE` |
| 1760 | is not set to 1. |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1761 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1762 | Only a single :term:`Initramfs` bundle can be added to the FIT image created by |
| 1763 | :ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional. |
| 1764 | In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1765 | in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin). |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1766 | When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem. |
| 1767 | The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE` |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 1768 | is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1. |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1769 | The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1770 | by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`. |
| 1771 | |
| 1772 | Only a single U-boot boot script can be added to the FIT image created by |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1773 | :ref:`ref-classes-kernel-fitimage` and the boot script is optional. |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1774 | The boot script is specified in the ITS file as a text file containing |
| 1775 | U-boot commands. When using a boot script the user should configure the |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1776 | U-boot :ref:`ref-tasks-install` task to copy the script to sysroot. |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1777 | So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage` |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1778 | class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 1779 | load the boot script from the FIT image and execute it. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1780 | |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 1781 | The FIT image generated by the :ref:`ref-classes-kernel-fitimage` class is signed when the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1782 | variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`, |
| 1783 | :term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set |
| 1784 | appropriately. The default values used for :term:`FIT_HASH_ALG` and |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1785 | :term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and |
Patrick Williams | 2a25492 | 2023-08-11 09:48:11 -0500 | [diff] [blame] | 1786 | "rsa2048" respectively. The keys for signing the FIT image can be generated using |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1787 | the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 1788 | :term:`UBOOT_SIGN_ENABLE` are set to "1". |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1789 | |
| 1790 | |
| 1791 | .. _ref-classes-kernel-grub: |
| 1792 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1793 | ``kernel-grub`` |
| 1794 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1795 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1796 | The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1797 | the kernel as the priority boot mechanism while installing a RPM to |
| 1798 | update the kernel on a deployed target. |
| 1799 | |
| 1800 | .. _ref-classes-kernel-module-split: |
| 1801 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1802 | ``kernel-module-split`` |
| 1803 | ======================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1804 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1805 | The :ref:`ref-classes-kernel-module-split` class provides common functionality for |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1806 | splitting Linux kernel modules into separate packages. |
| 1807 | |
| 1808 | .. _ref-classes-kernel-uboot: |
| 1809 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1810 | ``kernel-uboot`` |
| 1811 | ================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1812 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1813 | The :ref:`ref-classes-kernel-uboot` class provides support for building from |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1814 | vmlinux-style kernel sources. |
| 1815 | |
| 1816 | .. _ref-classes-kernel-uimage: |
| 1817 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1818 | ``kernel-uimage`` |
| 1819 | ================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1820 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1821 | The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1822 | |
| 1823 | .. _ref-classes-kernel-yocto: |
| 1824 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1825 | ``kernel-yocto`` |
| 1826 | ================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1827 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1828 | The :ref:`ref-classes-kernel-yocto` class provides common functionality for building |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1829 | from linux-yocto style kernel source repositories. |
| 1830 | |
| 1831 | .. _ref-classes-kernelsrc: |
| 1832 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1833 | ``kernelsrc`` |
| 1834 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1835 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1836 | The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1837 | |
| 1838 | .. _ref-classes-lib_package: |
| 1839 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1840 | ``lib_package`` |
| 1841 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1842 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1843 | The :ref:`ref-classes-lib_package` class supports recipes that build libraries and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1844 | produce executable binaries, where those binaries should not be |
| 1845 | installed by default along with the library. Instead, the binaries are |
| 1846 | added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to |
| 1847 | make their installation optional. |
| 1848 | |
| 1849 | .. _ref-classes-libc*: |
| 1850 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1851 | ``libc*`` |
| 1852 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1853 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1854 | The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1855 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1856 | - The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1857 | ``libc``. |
| 1858 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1859 | - The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1860 | ``eglibc``. |
| 1861 | |
| 1862 | .. _ref-classes-license: |
| 1863 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1864 | ``license`` |
| 1865 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1866 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1867 | The :ref:`ref-classes-license` class provides license manifest creation and license |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1868 | exclusion. This class is enabled by default using the default value for |
| 1869 | the :term:`INHERIT_DISTRO` variable. |
| 1870 | |
| 1871 | .. _ref-classes-linux-kernel-base: |
| 1872 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1873 | ``linux-kernel-base`` |
| 1874 | ===================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1875 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1876 | The :ref:`ref-classes-linux-kernel-base` class provides common functionality for |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1877 | recipes that build out of the Linux kernel source tree. These builds |
| 1878 | goes beyond the kernel itself. For example, the Perf recipe also |
| 1879 | inherits this class. |
| 1880 | |
| 1881 | .. _ref-classes-linuxloader: |
| 1882 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1883 | ``linuxloader`` |
| 1884 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1885 | |
| 1886 | Provides the function ``linuxloader()``, which gives the value of the |
| 1887 | dynamic loader/linker provided on the platform. This value is used by a |
| 1888 | number of other classes. |
| 1889 | |
| 1890 | .. _ref-classes-logging: |
| 1891 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1892 | ``logging`` |
| 1893 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1894 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1895 | The :ref:`ref-classes-logging` class provides the standard shell functions used to log |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1896 | messages for various BitBake severity levels (i.e. ``bbplain``, |
| 1897 | ``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``). |
| 1898 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1899 | This class is enabled by default since it is inherited by the :ref:`ref-classes-base` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1900 | class. |
| 1901 | |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 1902 | .. _ref-classes-meson: |
| 1903 | |
| 1904 | ``meson`` |
| 1905 | ========= |
| 1906 | |
| 1907 | The :ref:`ref-classes-meson` class allows to create recipes that build software |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 1908 | using the `Meson <https://mesonbuild.com/>`__ build system. You can use the |
| 1909 | :term:`MESON_BUILDTYPE`, :term:`MESON_TARGET` and :term:`EXTRA_OEMESON` |
| 1910 | variables to specify additional configuration options to be passed using the |
| 1911 | ``meson`` command line. |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 1912 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1913 | .. _ref-classes-metadata_scm: |
| 1914 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1915 | ``metadata_scm`` |
| 1916 | ================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1917 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1918 | The :ref:`ref-classes-metadata_scm` class provides functionality for querying the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1919 | branch and revision of a Source Code Manager (SCM) repository. |
| 1920 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1921 | The :ref:`ref-classes-base` class uses this class to print the revisions of |
| 1922 | each layer before starting every build. The :ref:`ref-classes-metadata_scm` |
| 1923 | class is enabled by default because it is inherited by the |
| 1924 | :ref:`ref-classes-base` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1925 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1926 | .. _ref-classes-mime: |
| 1927 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1928 | ``mime`` |
| 1929 | ======== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1930 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1931 | The :ref:`ref-classes-mime` class generates the proper post-install and post-remove |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1932 | (postinst/postrm) scriptlets for packages that install MIME type files. |
| 1933 | These scriptlets call ``update-mime-database`` to add the MIME types to |
| 1934 | the shared database. |
| 1935 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 1936 | .. _ref-classes-mime-xdg: |
| 1937 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1938 | ``mime-xdg`` |
| 1939 | ============ |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 1940 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1941 | The :ref:`ref-classes-mime-xdg` class generates the proper |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 1942 | post-install and post-remove (postinst/postrm) scriptlets for packages |
| 1943 | that install ``.desktop`` files containing ``MimeType`` entries. |
| 1944 | These scriptlets call ``update-desktop-database`` to add the MIME types |
| 1945 | to the database of MIME types handled by desktop files. |
| 1946 | |
| 1947 | Thanks to this class, when users open a file through a file browser |
| 1948 | on recently created images, they don't have to choose the application |
| 1949 | to open the file from the pool of all known applications, even the ones |
| 1950 | that cannot open the selected file. |
| 1951 | |
| 1952 | If you have recipes installing their ``.desktop`` files as absolute |
| 1953 | symbolic links, the detection of such files cannot be done by the current |
| 1954 | implementation of this class. In this case, you have to add the corresponding |
| 1955 | package names to the :term:`MIME_XDG_PACKAGES` variable. |
| 1956 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1957 | .. _ref-classes-mirrors: |
| 1958 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1959 | ``mirrors`` |
| 1960 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1961 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1962 | The :ref:`ref-classes-mirrors` class sets up some standard |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1963 | :term:`MIRRORS` entries for source code mirrors. These |
| 1964 | mirrors provide a fall-back path in case the upstream source specified |
| 1965 | in :term:`SRC_URI` within recipes is unavailable. |
| 1966 | |
| 1967 | This class is enabled by default since it is inherited by the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1968 | :ref:`ref-classes-base` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1969 | |
| 1970 | .. _ref-classes-module: |
| 1971 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1972 | ``module`` |
| 1973 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1974 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1975 | The :ref:`ref-classes-module` class provides support for building out-of-tree Linux |
| 1976 | kernel modules. The class inherits the :ref:`ref-classes-module-base` and |
| 1977 | :ref:`ref-classes-kernel-module-split` classes, and implements the |
| 1978 | :ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1979 | everything needed to build and package a kernel module. |
| 1980 | |
| 1981 | For general information on out-of-tree Linux kernel modules, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1982 | ":ref:`kernel-dev/common:incorporating out-of-tree modules`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1983 | section in the Yocto Project Linux Kernel Development Manual. |
| 1984 | |
| 1985 | .. _ref-classes-module-base: |
| 1986 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1987 | ``module-base`` |
| 1988 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1989 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1990 | The :ref:`ref-classes-module-base` class provides the base functionality for |
| 1991 | building Linux kernel modules. Typically, a recipe that builds software that |
| 1992 | includes one or more kernel modules and has its own means of building the module |
| 1993 | inherits this class as opposed to inheriting the :ref:`ref-classes-module` |
| 1994 | class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1995 | |
| 1996 | .. _ref-classes-multilib*: |
| 1997 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1998 | ``multilib*`` |
| 1999 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2000 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2001 | The :ref:`ref-classes-multilib*` classes provide support for building libraries with |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2002 | different target optimizations or target architectures and installing |
| 2003 | them side-by-side in the same image. |
| 2004 | |
| 2005 | For more information on using the Multilib feature, see the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2006 | ":ref:`dev-manual/libraries:combining multiple versions of library files into one image`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2007 | section in the Yocto Project Development Tasks Manual. |
| 2008 | |
| 2009 | .. _ref-classes-native: |
| 2010 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2011 | ``native`` |
| 2012 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2013 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2014 | The :ref:`ref-classes-native` class provides common functionality for recipes that |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2015 | build tools to run on the :term:`Build Host` (i.e. tools that use the compiler |
| 2016 | or other tools from the build host). |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2017 | |
| 2018 | You can create a recipe that builds tools that run natively on the host |
| 2019 | a couple different ways: |
| 2020 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2021 | - Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2022 | class. If you use this method, you must order the inherit statement |
| 2023 | in the recipe after all other inherit statements so that the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2024 | :ref:`ref-classes-native` class is inherited last. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2025 | |
| 2026 | .. note:: |
| 2027 | |
| 2028 | When creating a recipe this way, the recipe name must follow this |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2029 | naming convention:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2030 | |
| 2031 | myrecipe-native.bb |
| 2032 | |
| 2033 | |
| 2034 | Not using this naming convention can lead to subtle problems |
| 2035 | caused by existing code that depends on that naming convention. |
| 2036 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2037 | - Create or modify a target recipe that contains the following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2038 | |
| 2039 | BBCLASSEXTEND = "native" |
| 2040 | |
| 2041 | Inside the |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 2042 | recipe, use ``:class-native`` and ``:class-target`` overrides to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2043 | specify any functionality specific to the respective native or target |
| 2044 | case. |
| 2045 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2046 | Although applied differently, the :ref:`ref-classes-native` class is used with both |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2047 | methods. The advantage of the second method is that you do not need to |
| 2048 | have two separate recipes (assuming you need both) for native and |
| 2049 | target. All common parts of the recipe are automatically shared. |
| 2050 | |
| 2051 | .. _ref-classes-nativesdk: |
| 2052 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2053 | ``nativesdk`` |
| 2054 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2055 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2056 | The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2057 | wish to build tools to run as part of an SDK (i.e. tools that run on |
| 2058 | :term:`SDKMACHINE`). |
| 2059 | |
| 2060 | You can create a recipe that builds tools that run on the SDK machine a |
| 2061 | couple different ways: |
| 2062 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 2063 | - Create a ``nativesdk-myrecipe.bb`` recipe that inherits the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2064 | :ref:`ref-classes-nativesdk` class. If you use this method, you must order the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2065 | inherit statement in the recipe after all other inherit statements so |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2066 | that the :ref:`ref-classes-nativesdk` class is inherited last. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2067 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2068 | - Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2069 | |
| 2070 | BBCLASSEXTEND = "nativesdk" |
| 2071 | |
| 2072 | Inside the |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 2073 | recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2074 | specify any functionality specific to the respective SDK machine or |
| 2075 | target case. |
| 2076 | |
| 2077 | .. note:: |
| 2078 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2079 | When creating a recipe, you must follow this naming convention:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2080 | |
| 2081 | nativesdk-myrecipe.bb |
| 2082 | |
| 2083 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 2084 | Not doing so can lead to subtle problems because there is code that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2085 | depends on the naming convention. |
| 2086 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2087 | Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2088 | methods. The advantage of the second method is that you do not need to |
| 2089 | have two separate recipes (assuming you need both) for the SDK machine |
| 2090 | and the target. All common parts of the recipe are automatically shared. |
| 2091 | |
| 2092 | .. _ref-classes-nopackages: |
| 2093 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2094 | ``nopackages`` |
| 2095 | ============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2096 | |
| 2097 | Disables packaging tasks for those recipes and classes where packaging |
| 2098 | is not needed. |
| 2099 | |
Patrick Williams | 8460358 | 2024-12-14 08:00:57 -0500 | [diff] [blame] | 2100 | .. _ref-classes-nospdx: |
| 2101 | |
| 2102 | ``nospdx`` |
| 2103 | ========== |
| 2104 | |
| 2105 | The :ref:`ref-classes-nospdx` allows a recipe to opt out of SPDX |
| 2106 | generation provided by :ref:`ref-classes-create-spdx`. |
| 2107 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2108 | .. _ref-classes-npm: |
| 2109 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2110 | ``npm`` |
| 2111 | ======= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2112 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 2113 | Provides support for building Node.js software fetched using the |
| 2114 | :wikipedia:`node package manager (NPM) <Npm_(software)>`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2115 | |
| 2116 | .. note:: |
| 2117 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2118 | Currently, recipes inheriting this class must use the ``npm://`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2119 | fetcher to have dependencies fetched and packaged automatically. |
| 2120 | |
| 2121 | For information on how to create NPM packages, see the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2122 | ":ref:`dev-manual/packages:creating node package manager (npm) packages`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2123 | section in the Yocto Project Development Tasks Manual. |
| 2124 | |
| 2125 | .. _ref-classes-oelint: |
| 2126 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2127 | ``oelint`` |
| 2128 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2129 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2130 | The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2131 | ``meta/classes`` in the :term:`Source Directory`. |
| 2132 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 2133 | There are some classes that could be generally useful in OE-Core but |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2134 | are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2135 | one such example. However, being aware of this class can reduce the |
| 2136 | proliferation of different versions of similar classes across multiple |
| 2137 | layers. |
| 2138 | |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 2139 | .. _ref-classes-overlayfs: |
| 2140 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2141 | ``overlayfs`` |
| 2142 | ============= |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 2143 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2144 | It's often desired in Embedded System design to have a read-only root filesystem. |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 2145 | But a lot of different applications might want to have read-write access to |
| 2146 | some parts of a filesystem. It can be especially useful when your update mechanism |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2147 | overwrites the whole root filesystem, but you may want your application data to be preserved |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2148 | between updates. The :ref:`ref-classes-overlayfs` class provides a way |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 2149 | to achieve that by means of ``overlayfs`` and at the same time keeping the base |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2150 | root filesystem read-only. |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 2151 | |
| 2152 | To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper |
| 2153 | layer in your machine configuration. The underlying file system can be anything that |
| 2154 | is supported by ``overlayfs``. This has to be done in your machine configuration:: |
| 2155 | |
| 2156 | OVERLAYFS_MOUNT_POINT[data] = "/data" |
| 2157 | |
| 2158 | .. note:: |
| 2159 | |
| 2160 | * QA checks fail to catch file existence if you redefine this variable in your recipe! |
| 2161 | * Only the existence of the systemd mount unit file is checked, not its contents. |
| 2162 | * To get more details on ``overlayfs``, its internals and supported operations, please refer |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2163 | to the official documentation of the `Linux kernel <https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html>`__. |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 2164 | |
| 2165 | The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP |
| 2166 | (e.g. in ``systemd-machine-units`` recipe) and it's installed into the image. |
| 2167 | |
| 2168 | Then you can specify writable directories on a recipe basis (e.g. in my-application.bb):: |
| 2169 | |
| 2170 | OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application" |
| 2171 | |
| 2172 | To support several mount points you can use a different variable flag. Assuming we |
| 2173 | want to have a writable location on the file system, but do not need that the data |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2174 | survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs`` |
| 2175 | file system. |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 2176 | |
| 2177 | In your machine configuration:: |
| 2178 | |
| 2179 | OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay" |
| 2180 | |
| 2181 | and then in your recipe:: |
| 2182 | |
| 2183 | OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application" |
| 2184 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2185 | On a practical note, your application recipe might require multiple |
| 2186 | overlays to be mounted before running to avoid writing to the underlying |
| 2187 | file system (which can be forbidden in case of read-only file system) |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2188 | To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd`` |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2189 | helper service for mounting overlays. This helper service is named |
| 2190 | ``${PN}-overlays.service`` and can be depended on in your application recipe |
| 2191 | (named ``application`` in the following example) ``systemd`` unit by adding |
| 2192 | to the unit the following:: |
| 2193 | |
| 2194 | [Unit] |
| 2195 | After=application-overlays.service |
| 2196 | Requires=application-overlays.service |
| 2197 | |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 2198 | .. note:: |
| 2199 | |
| 2200 | The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it. |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2201 | In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`. |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2202 | |
| 2203 | .. _ref-classes-overlayfs-etc: |
| 2204 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2205 | ``overlayfs-etc`` |
| 2206 | ================= |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2207 | |
| 2208 | In order to have the ``/etc`` directory in overlayfs a special handling at early |
| 2209 | boot stage is required. The idea is to supply a custom init script that mounts |
| 2210 | ``/etc`` before launching the actual init program, because the latter already |
| 2211 | requires ``/etc`` to be mounted. |
| 2212 | |
| 2213 | Example usage in image recipe:: |
| 2214 | |
| 2215 | IMAGE_FEATURES += "overlayfs-etc" |
| 2216 | |
| 2217 | .. note:: |
| 2218 | |
| 2219 | This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES` |
| 2220 | |
| 2221 | Your machine configuration should define at least the device, mount point, and file system type |
| 2222 | you are going to use for ``overlayfs``:: |
| 2223 | |
| 2224 | OVERLAYFS_ETC_MOUNT_POINT = "/data" |
| 2225 | OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2" |
| 2226 | OVERLAYFS_ETC_FSTYPE ?= "ext4" |
| 2227 | |
| 2228 | To control more mount options you should consider setting mount options |
| 2229 | (``defaults`` is used by default):: |
| 2230 | |
| 2231 | OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync" |
| 2232 | |
| 2233 | The class provides two options for ``/sbin/init`` generation: |
| 2234 | |
| 2235 | - The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig`` |
| 2236 | and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage |
| 2237 | that you won't need to change any kernel parameters in order to make it work, |
| 2238 | but it poses a restriction that package-management can't be used, because updating |
| 2239 | the init manager would remove the generated script. |
| 2240 | |
| 2241 | - If you wish to keep original init as is, you can set:: |
| 2242 | |
| 2243 | OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0" |
| 2244 | |
| 2245 | Then the generated init will be named ``/sbin/preinit`` and you would need to extend your |
| 2246 | kernel parameters manually in your bootloader configuration. |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 2247 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2248 | .. _ref-classes-own-mirrors: |
| 2249 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2250 | ``own-mirrors`` |
| 2251 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2252 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2253 | The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2254 | :term:`PREMIRRORS` from which to first fetch source |
| 2255 | before attempting to fetch it from the upstream specified in |
| 2256 | :term:`SRC_URI` within each recipe. |
| 2257 | |
| 2258 | To use this class, inherit it globally and specify |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2259 | :term:`SOURCE_MIRROR_URL`. Here is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2260 | |
| 2261 | INHERIT += "own-mirrors" |
| 2262 | SOURCE_MIRROR_URL = "http://example.com/my-source-mirror" |
| 2263 | |
| 2264 | You can specify only a single URL |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2265 | in :term:`SOURCE_MIRROR_URL`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2266 | |
| 2267 | .. _ref-classes-package: |
| 2268 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2269 | ``package`` |
| 2270 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2271 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2272 | The :ref:`ref-classes-package` class supports generating packages from a build's |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2273 | output. The core generic functionality is in ``package.bbclass``. The |
| 2274 | code specific to particular package types resides in these |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2275 | package-specific classes: :ref:`ref-classes-package_deb`, |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 2276 | :ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2277 | |
| 2278 | You can control the list of resulting package formats by using the |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2279 | :term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2280 | configuration file, which is located in the :term:`Build Directory`. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2281 | When defining the variable, you can specify one or more package types. |
| 2282 | Since images are generated from packages, a packaging class is needed |
| 2283 | to enable image generation. The first class listed in this variable is |
| 2284 | used for image generation. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2285 | |
| 2286 | If you take the optional step to set up a repository (package feed) on |
| 2287 | the development host that can be used by DNF, you can install packages |
| 2288 | from the feed while you are running the image on the target (i.e. |
| 2289 | runtime installation of packages). For more information, see the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2290 | ":ref:`dev-manual/packages:using runtime package management`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2291 | section in the Yocto Project Development Tasks Manual. |
| 2292 | |
| 2293 | The package-specific class you choose can affect build-time performance |
| 2294 | and has space ramifications. In general, building a package with IPK |
| 2295 | takes about thirty percent less time as compared to using RPM to build |
| 2296 | the same or similar package. This comparison takes into account a |
| 2297 | complete build of the package with all dependencies previously built. |
| 2298 | The reason for this discrepancy is because the RPM package manager |
| 2299 | creates and processes more :term:`Metadata` than the IPK package |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2300 | manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2301 | ":ref:`ref-classes-package_ipk`" if you are building smaller systems. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2302 | |
| 2303 | Before making your package manager decision, however, you should |
| 2304 | consider some further things about using RPM: |
| 2305 | |
| 2306 | - RPM starts to provide more abilities than IPK due to the fact that it |
| 2307 | processes more Metadata. For example, this information includes |
| 2308 | individual file types, file checksum generation and evaluation on |
| 2309 | install, sparse file support, conflict detection and resolution for |
| 2310 | Multilib systems, ACID style upgrade, and repackaging abilities for |
| 2311 | rollbacks. |
| 2312 | |
| 2313 | - For smaller systems, the extra space used for the Berkeley Database |
| 2314 | and the amount of metadata when using RPM can affect your ability to |
| 2315 | perform on-device upgrades. |
| 2316 | |
| 2317 | You can find additional information on the effects of the package class |
| 2318 | at these two Yocto Project mailing list links: |
| 2319 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2320 | - :yocto_lists:`/pipermail/poky/2011-May/006362.html` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2321 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2322 | - :yocto_lists:`/pipermail/poky/2011-May/006363.html` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2323 | |
| 2324 | .. _ref-classes-package_deb: |
| 2325 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2326 | ``package_deb`` |
| 2327 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2328 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2329 | The :ref:`ref-classes-package_deb` class provides support for creating packages that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2330 | use the Debian (i.e. ``.deb``) file format. The class ensures the |
| 2331 | packages are written out in a ``.deb`` file format to the |
| 2332 | ``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory. |
| 2333 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2334 | This class inherits the :ref:`ref-classes-package` class and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2335 | is enabled through the :term:`PACKAGE_CLASSES` |
| 2336 | variable in the ``local.conf`` file. |
| 2337 | |
| 2338 | .. _ref-classes-package_ipk: |
| 2339 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2340 | ``package_ipk`` |
| 2341 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2342 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2343 | The :ref:`ref-classes-package_ipk` class provides support for creating packages that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2344 | use the IPK (i.e. ``.ipk``) file format. The class ensures the packages |
| 2345 | are written out in a ``.ipk`` file format to the |
| 2346 | ``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory. |
| 2347 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2348 | This class inherits the :ref:`ref-classes-package` class and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2349 | is enabled through the :term:`PACKAGE_CLASSES` |
| 2350 | variable in the ``local.conf`` file. |
| 2351 | |
| 2352 | .. _ref-classes-package_rpm: |
| 2353 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2354 | ``package_rpm`` |
| 2355 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2356 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2357 | The :ref:`ref-classes-package_rpm` class provides support for creating packages that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2358 | use the RPM (i.e. ``.rpm``) file format. The class ensures the packages |
| 2359 | are written out in a ``.rpm`` file format to the |
| 2360 | ``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory. |
| 2361 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2362 | This class inherits the :ref:`ref-classes-package` class and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2363 | is enabled through the :term:`PACKAGE_CLASSES` |
| 2364 | variable in the ``local.conf`` file. |
| 2365 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2366 | .. _ref-classes-packagedata: |
| 2367 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2368 | ``packagedata`` |
| 2369 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2370 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2371 | The :ref:`ref-classes-packagedata` class provides common functionality for reading |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2372 | ``pkgdata`` files found in :term:`PKGDATA_DIR`. These |
| 2373 | files contain information about each output package produced by the |
| 2374 | OpenEmbedded build system. |
| 2375 | |
| 2376 | This class is enabled by default because it is inherited by the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2377 | :ref:`ref-classes-package` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2378 | |
| 2379 | .. _ref-classes-packagegroup: |
| 2380 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2381 | ``packagegroup`` |
| 2382 | ================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2383 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2384 | The :ref:`ref-classes-packagegroup` class sets default values appropriate for package |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2385 | group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2386 | so forth). It is highly recommended that all package group recipes |
| 2387 | inherit this class. |
| 2388 | |
| 2389 | For information on how to use this class, see the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2390 | ":ref:`dev-manual/customizing-images:customizing images using custom package groups`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2391 | section in the Yocto Project Development Tasks Manual. |
| 2392 | |
| 2393 | Previously, this class was called the ``task`` class. |
| 2394 | |
| 2395 | .. _ref-classes-patch: |
| 2396 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2397 | ``patch`` |
| 2398 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2399 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2400 | The :ref:`ref-classes-patch` class provides all functionality for applying patches |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2401 | during the :ref:`ref-tasks-patch` task. |
| 2402 | |
| 2403 | This class is enabled by default because it is inherited by the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2404 | :ref:`ref-classes-base` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2405 | |
| 2406 | .. _ref-classes-perlnative: |
| 2407 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2408 | ``perlnative`` |
| 2409 | ============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2410 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2411 | When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2412 | native version of Perl built by the build system rather than using the |
| 2413 | version provided by the build host. |
| 2414 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2415 | .. _ref-classes-pypi: |
| 2416 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2417 | ``pypi`` |
| 2418 | ======== |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2419 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2420 | The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2421 | Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index. |
| 2422 | By default it determines the PyPI package name based upon :term:`BPN` |
| 2423 | (stripping the "python-" or "python3-" prefix off if present), however in |
| 2424 | some cases you may need to set it manually in the recipe by setting |
| 2425 | :term:`PYPI_PACKAGE`. |
| 2426 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2427 | Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`, |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2428 | :term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX` |
| 2429 | and :term:`CVE_PRODUCT`. |
| 2430 | |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2431 | .. _ref-classes-python_flit_core: |
| 2432 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2433 | ``python_flit_core`` |
| 2434 | ==================== |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2435 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2436 | The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2437 | the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant |
| 2438 | ``flit_core.buildapi`` ``build-backend`` in the ``[build-system]`` |
| 2439 | section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__). |
| 2440 | |
| 2441 | Python modules built with ``flit_core.buildapi`` are pure Python (no |
| 2442 | ``C`` or ``Rust`` extensions). |
| 2443 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2444 | Internally this uses the :ref:`ref-classes-python_pep517` class. |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2445 | |
Patrick Williams | 2f814a6 | 2024-04-16 16:28:03 -0500 | [diff] [blame] | 2446 | .. _ref-classes-python_maturin: |
| 2447 | |
| 2448 | ``python_maturin`` |
| 2449 | ================== |
| 2450 | |
| 2451 | The :ref:`ref-classes-python_maturin` class provides support for python-maturin, a replacement |
| 2452 | for setuptools_rust and another "backend" for building Python Wheels. |
| 2453 | |
| 2454 | .. _ref-classes-python_mesonpy: |
| 2455 | |
| 2456 | ``python_mesonpy`` |
| 2457 | ================== |
| 2458 | |
| 2459 | The :ref:`ref-classes-python_mesonpy` class enables building Python modules which use the |
| 2460 | meson-python build system. |
| 2461 | |
| 2462 | Internally this uses the :ref:`ref-classes-python_pep517` class. |
| 2463 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2464 | .. _ref-classes-python_pep517: |
| 2465 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2466 | ``python_pep517`` |
| 2467 | ================= |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2468 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2469 | The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2470 | archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__). |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2471 | |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2472 | Recipes wouldn't inherit this directly, instead typically another class will |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 2473 | inherit this and add the relevant native dependencies. |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2474 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2475 | Examples of classes which do this are :ref:`ref-classes-python_flit_core`, |
| 2476 | :ref:`ref-classes-python_setuptools_build_meta`, and |
| 2477 | :ref:`ref-classes-python_poetry_core`. |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2478 | |
| 2479 | .. _ref-classes-python_poetry_core: |
| 2480 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2481 | ``python_poetry_core`` |
| 2482 | ====================== |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2483 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2484 | The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2485 | `Poetry Core <https://python-poetry.org>`__ build system. |
| 2486 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2487 | Internally this uses the :ref:`ref-classes-python_pep517` class. |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2488 | |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 2489 | .. _ref-classes-python_pyo3: |
| 2490 | |
| 2491 | ``python_pyo3`` |
| 2492 | =============== |
| 2493 | |
| 2494 | The :ref:`ref-classes-python_pyo3` class helps make sure that Python extensions |
| 2495 | written in Rust and built with `PyO3 <https://pyo3.rs/>`__, properly set up the |
| 2496 | environment for cross compilation. |
| 2497 | |
| 2498 | This class is internal to the :ref:`ref-classes-python-setuptools3_rust` class |
| 2499 | and is not meant to be used directly in recipes. |
| 2500 | |
| 2501 | .. _ref-classes-python-setuptools3_rust: |
| 2502 | |
| 2503 | ``python-setuptools3_rust`` |
| 2504 | =========================== |
| 2505 | |
| 2506 | The :ref:`ref-classes-python-setuptools3_rust` class enables building Python |
| 2507 | extensions implemented in Rust with `PyO3 <https://pyo3.rs/>`__, which allows |
| 2508 | to compile and distribute Python extensions written in Rust as easily |
| 2509 | as if they were written in C. |
| 2510 | |
| 2511 | This class inherits the :ref:`ref-classes-setuptools3` and |
| 2512 | :ref:`ref-classes-python_pyo3` classes. |
| 2513 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2514 | .. _ref-classes-pixbufcache: |
| 2515 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2516 | ``pixbufcache`` |
| 2517 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2518 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2519 | The :ref:`ref-classes-pixbufcache` class generates the proper post-install and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2520 | post-remove (postinst/postrm) scriptlets for packages that install |
| 2521 | pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets |
| 2522 | call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache. |
| 2523 | Since the cache files are architecture-specific, ``update_pixbuf_cache`` |
| 2524 | is run using QEMU if the postinst scriptlets need to be run on the build |
| 2525 | host during image creation. |
| 2526 | |
| 2527 | If the pixbuf loaders being installed are in packages other than the |
| 2528 | recipe's main package, set |
| 2529 | :term:`PIXBUF_PACKAGES` to specify the packages |
| 2530 | containing the loaders. |
| 2531 | |
| 2532 | .. _ref-classes-pkgconfig: |
| 2533 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2534 | ``pkgconfig`` |
| 2535 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2536 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2537 | The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2538 | library information by using ``pkg-config``. This class aims to smooth |
| 2539 | integration of ``pkg-config`` into libraries that use it. |
| 2540 | |
| 2541 | During staging, BitBake installs ``pkg-config`` data into the |
| 2542 | ``sysroots/`` directory. By making use of sysroot functionality within |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2543 | ``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2544 | files. |
| 2545 | |
| 2546 | .. _ref-classes-populate-sdk: |
| 2547 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2548 | ``populate_sdk`` |
| 2549 | ================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2550 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2551 | The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2552 | information on advantages gained when building a cross-development |
| 2553 | toolchain using the :ref:`ref-tasks-populate_sdk` |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2554 | task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2555 | section in the Yocto Project Application Development and the Extensible |
| 2556 | Software Development Kit (eSDK) manual. |
| 2557 | |
| 2558 | .. _ref-classes-populate-sdk-*: |
| 2559 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2560 | ``populate_sdk_*`` |
| 2561 | ================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2562 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2563 | The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2564 | following classes: |
| 2565 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2566 | - :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2567 | all package managers (i.e. DEB, RPM, and opkg). |
| 2568 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2569 | - :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2570 | package manager. |
| 2571 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2572 | - :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2573 | package manager. |
| 2574 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2575 | - :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2576 | (IPK format) package manager. |
| 2577 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2578 | - :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2579 | package managers. |
| 2580 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2581 | The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2582 | ``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on |
| 2583 | :term:`IMAGE_PKGTYPE`. |
| 2584 | |
| 2585 | The base class ensures all source and destination directories are |
| 2586 | established and then populates the SDK. After populating the SDK, the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2587 | :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2588 | ``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which |
| 2589 | contains the cross-compiler and associated tooling, and the target, |
| 2590 | which contains a target root filesystem that is configured for the SDK |
| 2591 | usage. These two images reside in :term:`SDK_OUTPUT`, |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2592 | which consists of the following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2593 | |
| 2594 | ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs |
| 2595 | ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs |
| 2596 | |
| 2597 | Finally, the base populate SDK class creates the toolchain environment |
| 2598 | setup script, the tarball of the SDK, and the installer. |
| 2599 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2600 | The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and |
| 2601 | :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK. |
| 2602 | These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2603 | class. |
| 2604 | |
| 2605 | For more information on the cross-development toolchain generation, see |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2606 | the ":ref:`overview-manual/concepts:cross-development toolchain generation`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2607 | section in the Yocto Project Overview and Concepts Manual. For |
| 2608 | information on advantages gained when building a cross-development |
| 2609 | toolchain using the :ref:`ref-tasks-populate_sdk` |
| 2610 | task, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2611 | ":ref:`sdk-manual/appendix-obtain:building an sdk installer`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2612 | section in the Yocto Project Application Development and the Extensible |
| 2613 | Software Development Kit (eSDK) manual. |
| 2614 | |
| 2615 | .. _ref-classes-prexport: |
| 2616 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2617 | ``prexport`` |
| 2618 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2619 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2620 | The :ref:`ref-classes-prexport` class provides functionality for exporting |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2621 | :term:`PR` values. |
| 2622 | |
| 2623 | .. note:: |
| 2624 | |
| 2625 | This class is not intended to be used directly. Rather, it is enabled |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2626 | when using "``bitbake-prserv-tool export``". |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2627 | |
| 2628 | .. _ref-classes-primport: |
| 2629 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2630 | ``primport`` |
| 2631 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2632 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2633 | The :ref:`ref-classes-primport` class provides functionality for importing |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2634 | :term:`PR` values. |
| 2635 | |
| 2636 | .. note:: |
| 2637 | |
| 2638 | This class is not intended to be used directly. Rather, it is enabled |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2639 | when using "``bitbake-prserv-tool import``". |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2640 | |
| 2641 | .. _ref-classes-prserv: |
| 2642 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2643 | ``prserv`` |
| 2644 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2645 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2646 | The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR |
| 2647 | service <dev-manual/packages:working with a pr service>` in order to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2648 | automatically manage the incrementing of the :term:`PR` |
| 2649 | variable for each recipe. |
| 2650 | |
| 2651 | This class is enabled by default because it is inherited by the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2652 | :ref:`ref-classes-package` class. However, the OpenEmbedded |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2653 | build system will not enable the functionality of this class unless |
| 2654 | :term:`PRSERV_HOST` has been set. |
| 2655 | |
| 2656 | .. _ref-classes-ptest: |
| 2657 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2658 | ``ptest`` |
| 2659 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2660 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2661 | The :ref:`ref-classes-ptest` class provides functionality for packaging and installing |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2662 | runtime tests for recipes that build software that provides these tests. |
| 2663 | |
| 2664 | This class is intended to be inherited by individual recipes. However, |
| 2665 | the class' functionality is largely disabled unless "ptest" appears in |
| 2666 | :term:`DISTRO_FEATURES`. See the |
Patrick Williams | 96e4b4e | 2025-02-03 15:49:15 -0500 | [diff] [blame^] | 2667 | ":ref:`test-manual/ptest:testing packages with ptest`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2668 | section in the Yocto Project Development Tasks Manual for more information |
| 2669 | on ptest. |
| 2670 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 2671 | .. _ref-classes-ptest-cargo: |
| 2672 | |
| 2673 | ``ptest-cargo`` |
| 2674 | =============== |
| 2675 | |
| 2676 | The :ref:`ref-classes-ptest-cargo` class is a class which extends the |
| 2677 | :ref:`ref-classes-cargo` class and adds ``compile_ptest_cargo`` and |
| 2678 | ``install_ptest_cargo`` steps to respectively build and install |
| 2679 | test suites defined in the ``Cargo.toml`` file, into a dedicated |
| 2680 | ``-ptest`` package. |
| 2681 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2682 | .. _ref-classes-ptest-gnome: |
| 2683 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2684 | ``ptest-gnome`` |
| 2685 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2686 | |
| 2687 | Enables package tests (ptests) specifically for GNOME packages, which |
| 2688 | have tests intended to be executed with ``gnome-desktop-testing``. |
| 2689 | |
| 2690 | For information on setting up and running ptests, see the |
Patrick Williams | 96e4b4e | 2025-02-03 15:49:15 -0500 | [diff] [blame^] | 2691 | ":ref:`test-manual/ptest:testing packages with ptest`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2692 | section in the Yocto Project Development Tasks Manual. |
| 2693 | |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 2694 | .. _ref-classes-python3-dir: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2695 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2696 | ``python3-dir`` |
| 2697 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2698 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2699 | The :ref:`ref-classes-python3-dir` class provides the base version, location, and site |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 2700 | package location for Python 3. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2701 | |
| 2702 | .. _ref-classes-python3native: |
| 2703 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2704 | ``python3native`` |
| 2705 | ================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2706 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2707 | The :ref:`ref-classes-python3native` class supports using the native version of Python |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2708 | 3 built by the build system rather than support of the version provided |
| 2709 | by the build host. |
| 2710 | |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 2711 | .. _ref-classes-python3targetconfig: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2712 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2713 | ``python3targetconfig`` |
| 2714 | ======================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2715 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2716 | The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 2717 | 3 built by the build system rather than support of the version provided |
| 2718 | by the build host, except that the configuration for the target machine |
| 2719 | is accessible (such as correct installation directories). This also adds a |
| 2720 | dependency on target ``python3``, so should only be used where appropriate |
| 2721 | in order to avoid unnecessarily lengthening builds. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2722 | |
| 2723 | .. _ref-classes-qemu: |
| 2724 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2725 | ``qemu`` |
| 2726 | ======== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2727 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2728 | The :ref:`ref-classes-qemu` class provides functionality for recipes that either need |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2729 | QEMU or test for the existence of QEMU. Typically, this class is used to |
| 2730 | run programs for a target system on the build host using QEMU's |
| 2731 | application emulation mode. |
| 2732 | |
| 2733 | .. _ref-classes-recipe_sanity: |
| 2734 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2735 | ``recipe_sanity`` |
| 2736 | ================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2737 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2738 | The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2739 | recipe prerequisites that might affect the build (e.g. variables that |
| 2740 | are set or software that is present). |
| 2741 | |
| 2742 | .. _ref-classes-relocatable: |
| 2743 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2744 | ``relocatable`` |
| 2745 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2746 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2747 | The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2748 | installed into the sysroot. |
| 2749 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2750 | This class makes use of the :ref:`ref-classes-chrpath` class and is used by |
| 2751 | both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2752 | |
| 2753 | .. _ref-classes-remove-libtool: |
| 2754 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2755 | ``remove-libtool`` |
| 2756 | ================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2757 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2758 | The :ref:`ref-classes-remove-libtool` class adds a post function to the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2759 | :ref:`ref-tasks-install` task to remove all ``.la`` files |
| 2760 | installed by ``libtool``. Removing these files results in them being |
| 2761 | absent from both the sysroot and target packages. |
| 2762 | |
| 2763 | If a recipe needs the ``.la`` files to be installed, then the recipe can |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2764 | override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2765 | |
| 2766 | REMOVE_LIBTOOL_LA = "0" |
| 2767 | |
| 2768 | .. note:: |
| 2769 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2770 | The :ref:`ref-classes-remove-libtool` class is not enabled by default. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2771 | |
| 2772 | .. _ref-classes-report-error: |
| 2773 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2774 | ``report-error`` |
| 2775 | ================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2776 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2777 | The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting |
| 2778 | tool <dev-manual/error-reporting-tool:using the error reporting tool>`", |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2779 | which allows you to submit build error information to a central database. |
| 2780 | |
| 2781 | The class collects debug information for recipe, recipe version, task, |
| 2782 | machine, distro, build system, target system, host distro, branch, |
| 2783 | commit, and log. From the information, report files using a JSON format |
| 2784 | are created and stored in |
| 2785 | ``${``\ :term:`LOG_DIR`\ ``}/error-report``. |
| 2786 | |
Patrick Williams | 8460358 | 2024-12-14 08:00:57 -0500 | [diff] [blame] | 2787 | .. _ref-classes-retain: |
| 2788 | |
| 2789 | ``retain`` |
| 2790 | ========== |
| 2791 | |
| 2792 | The :ref:`ref-classes-retain` class can be used to create a tarball of the work |
| 2793 | directory for a recipe when one of its tasks fails, or any other nominated |
| 2794 | directories. It is useful in cases where the environment in which builds are run |
| 2795 | is ephemeral or otherwise inaccessible for examination during debugging. |
| 2796 | |
| 2797 | To enable, add the following to your configuration:: |
| 2798 | |
| 2799 | INHERIT += "retain" |
| 2800 | |
| 2801 | The class can be disabled for specific recipes using the :term:`RETAIN_ENABLED` |
| 2802 | variable. |
| 2803 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2804 | .. _ref-classes-rm-work: |
| 2805 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2806 | ``rm_work`` |
| 2807 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2808 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2809 | The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2810 | can ease your hard drive demands during builds. |
| 2811 | |
| 2812 | The OpenEmbedded build system can use a substantial amount of disk space |
| 2813 | during the build process. A portion of this space is the work files |
| 2814 | under the ``${TMPDIR}/work`` directory for each recipe. Once the build |
| 2815 | system generates the packages for a recipe, the work files for that |
| 2816 | recipe are no longer needed. However, by default, the build system |
| 2817 | preserves these files for inspection and possible debugging purposes. If |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2818 | you would rather have these files deleted to save disk space as the build |
| 2819 | progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2820 | your ``local.conf`` file, which is found in the :term:`Build Directory`:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2821 | |
| 2822 | INHERIT += "rm_work" |
| 2823 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2824 | If you are modifying and building source code out of the work directory for a |
| 2825 | recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your |
| 2826 | changes to the source being lost. To exclude some recipes from having their work |
| 2827 | directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the |
| 2828 | recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable, |
| 2829 | which can also be set in your ``local.conf`` file. Here is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2830 | |
| 2831 | RM_WORK_EXCLUDE += "busybox glibc" |
| 2832 | |
| 2833 | .. _ref-classes-rootfs*: |
| 2834 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2835 | ``rootfs*`` |
| 2836 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2837 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2838 | The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2839 | image and consist of the following classes: |
| 2840 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2841 | - The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2842 | post-processing functions for image recipes. |
| 2843 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2844 | - The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2845 | for images built using ``.deb`` packages. |
| 2846 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2847 | - The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2848 | for images built using ``.rpm`` packages. |
| 2849 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2850 | - The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2851 | for images built using ``.ipk`` packages. |
| 2852 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2853 | - The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2854 | on the build host directly into the root filesystem. |
| 2855 | |
| 2856 | The root filesystem is created from packages using one of the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2857 | :ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES` |
| 2858 | variable. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2859 | |
| 2860 | For information on how root filesystem images are created, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2861 | ":ref:`overview-manual/concepts:image generation`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2862 | section in the Yocto Project Overview and Concepts Manual. |
| 2863 | |
Andrew Geissler | 6aa7eec | 2023-03-03 12:41:14 -0600 | [diff] [blame] | 2864 | .. _ref-classes-rust: |
| 2865 | |
| 2866 | ``rust`` |
| 2867 | ======== |
| 2868 | |
| 2869 | The :ref:`ref-classes-rust` class is an internal class which is just used |
| 2870 | in the "rust" recipe, to build the Rust compiler and runtime |
| 2871 | library. Except for this recipe, it is not intended to be used directly. |
| 2872 | |
| 2873 | .. _ref-classes-rust-common: |
| 2874 | |
| 2875 | ``rust-common`` |
| 2876 | =============== |
| 2877 | |
| 2878 | The :ref:`ref-classes-rust-common` class is an internal class to the |
| 2879 | :ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not |
| 2880 | intended to be used directly. |
| 2881 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2882 | .. _ref-classes-sanity: |
| 2883 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2884 | ``sanity`` |
| 2885 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2886 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2887 | The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2888 | on the host system so that users can be notified of potential problems |
| 2889 | that might affect their build. The class also performs basic user |
| 2890 | configuration checks from the ``local.conf`` configuration file to |
| 2891 | prevent common mistakes that cause build failures. Distribution policy |
| 2892 | usually determines whether to include this class. |
| 2893 | |
| 2894 | .. _ref-classes-scons: |
| 2895 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2896 | ``scons`` |
| 2897 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2898 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2899 | The :ref:`ref-classes-scons` class supports recipes that need to build software |
| 2900 | that uses the SCons build system. You can use the :term:`EXTRA_OESCONS` |
| 2901 | variable to specify additional configuration options you want to pass SCons |
| 2902 | command line. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2903 | |
| 2904 | .. _ref-classes-sdl: |
| 2905 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2906 | ``sdl`` |
| 2907 | ======= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2908 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2909 | The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2910 | the Simple DirectMedia Layer (SDL) library. |
| 2911 | |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2912 | .. _ref-classes-python_setuptools_build_meta: |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2913 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2914 | ``python_setuptools_build_meta`` |
| 2915 | ================================ |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2916 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2917 | The :ref:`ref-classes-python_setuptools_build_meta` class enables building |
| 2918 | Python modules which declare the |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2919 | `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant |
| 2920 | ``setuptools.build_meta`` ``build-backend`` in the ``[build-system]`` |
| 2921 | section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__). |
| 2922 | |
| 2923 | Python modules built with ``setuptools.build_meta`` can be pure Python or |
| 2924 | include ``C`` or ``Rust`` extensions). |
| 2925 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2926 | Internally this uses the :ref:`ref-classes-python_pep517` class. |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2927 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2928 | .. _ref-classes-setuptools3: |
| 2929 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2930 | ``setuptools3`` |
| 2931 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2932 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2933 | The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions |
| 2934 | that use build systems based on ``setuptools`` (e.g. only have a ``setup.py`` |
| 2935 | and have not migrated to the official ``pyproject.toml`` format). If your recipe |
| 2936 | uses these build systems, the recipe needs to inherit the |
| 2937 | :ref:`ref-classes-setuptools3` class. |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2938 | |
| 2939 | .. note:: |
| 2940 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2941 | The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2942 | ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format |
| 2943 | (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__). |
| 2944 | |
| 2945 | A consequence of this is that legacy software still using deprecated |
| 2946 | ``distutils`` from the Python standard library cannot be packaged as |
| 2947 | ``wheels``. A common solution is the replace |
| 2948 | ``from distutils.core import setup`` with ``from setuptools import setup``. |
| 2949 | |
| 2950 | .. note:: |
| 2951 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2952 | The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now |
| 2953 | installs the ``wheel`` binary archive. In current versions of |
| 2954 | ``setuptools`` the legacy ``setup.py install`` method is deprecated. If |
| 2955 | the ``setup.py`` cannot be used with wheels, for example it creates files |
| 2956 | outside of the Python module or standard entry points, then |
| 2957 | :ref:`ref-classes-setuptools3_legacy` should be used. |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2958 | |
| 2959 | .. _ref-classes-setuptools3_legacy: |
| 2960 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2961 | ``setuptools3_legacy`` |
| 2962 | ====================== |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2963 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2964 | The :ref:`ref-classes-setuptools3_legacy` class supports |
| 2965 | Python version 3.x extensions that use build systems based on ``setuptools`` |
| 2966 | (e.g. only have a ``setup.py`` and have not migrated to the official |
| 2967 | ``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`, |
| 2968 | this uses the traditional ``setup.py`` ``build`` and ``install`` commands and |
| 2969 | not wheels. This use of ``setuptools`` like this is |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2970 | `deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__ |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2971 | but still relatively common. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2972 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2973 | .. _ref-classes-setuptools3-base: |
| 2974 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2975 | ``setuptools3-base`` |
| 2976 | ==================== |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2977 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2978 | The :ref:`ref-classes-setuptools3-base` class provides a reusable base for |
| 2979 | other classes that support building Python version 3.x extensions. If you need |
| 2980 | functionality that is not provided by the :ref:`ref-classes-setuptools3` class, |
| 2981 | you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks |
| 2982 | in the :ref:`ref-classes-setuptools3` class and inherit this class instead. |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2983 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2984 | .. _ref-classes-sign_rpm: |
| 2985 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2986 | ``sign_rpm`` |
| 2987 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2988 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2989 | The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2990 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2991 | .. _ref-classes-siteinfo: |
| 2992 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2993 | ``siteinfo`` |
| 2994 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2995 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 2996 | The :ref:`ref-classes-siteinfo` class provides information about the targets |
| 2997 | that might be needed by other classes or recipes. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2998 | |
| 2999 | As an example, consider Autotools, which can require tests that must |
| 3000 | execute on the target hardware. Since this is not possible in general |
| 3001 | when cross compiling, site information is used to provide cached test |
| 3002 | results so these tests can be skipped over but still make the correct |
| 3003 | values available. The ``meta/site directory`` contains test results |
| 3004 | sorted into different categories such as architecture, endianness, and |
| 3005 | the ``libc`` used. Site information provides a list of files containing |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3006 | data relevant to the current build in the :term:`CONFIG_SITE` variable that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3007 | Autotools automatically picks up. |
| 3008 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3009 | The class also provides variables like :term:`SITEINFO_ENDIANNESS` and |
| 3010 | :term:`SITEINFO_BITS` that can be used elsewhere in the metadata. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3011 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3012 | .. _ref-classes-sstate: |
| 3013 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3014 | ``sstate`` |
| 3015 | ========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3016 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3017 | The :ref:`ref-classes-sstate` class provides support for Shared State (sstate). |
| 3018 | By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's |
| 3019 | default value. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3020 | |
| 3021 | For more information on sstate, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 3022 | ":ref:`overview-manual/concepts:shared state cache`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3023 | section in the Yocto Project Overview and Concepts Manual. |
| 3024 | |
| 3025 | .. _ref-classes-staging: |
| 3026 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3027 | ``staging`` |
| 3028 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3029 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3030 | The :ref:`ref-classes-staging` class installs files into individual recipe work |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3031 | directories for sysroots. The class contains the following key tasks: |
| 3032 | |
| 3033 | - The :ref:`ref-tasks-populate_sysroot` task, |
| 3034 | which is responsible for handing the files that end up in the recipe |
| 3035 | sysroots. |
| 3036 | |
| 3037 | - The |
| 3038 | :ref:`ref-tasks-prepare_recipe_sysroot` |
| 3039 | task (a "partner" task to the ``populate_sysroot`` task), which |
| 3040 | installs the files into the individual recipe work directories (i.e. |
| 3041 | :term:`WORKDIR`). |
| 3042 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3043 | The code in the :ref:`ref-classes-staging` class is complex and basically works |
| 3044 | in two stages: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3045 | |
| 3046 | - *Stage One:* The first stage addresses recipes that have files they |
| 3047 | want to share with other recipes that have dependencies on the |
| 3048 | originating recipe. Normally these dependencies are installed through |
| 3049 | the :ref:`ref-tasks-install` task into |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 3050 | ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3051 | copies a subset of these files into ``${SYSROOT_DESTDIR}``. This |
| 3052 | subset of files is controlled by the |
| 3053 | :term:`SYSROOT_DIRS`, |
| 3054 | :term:`SYSROOT_DIRS_NATIVE`, and |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 3055 | :term:`SYSROOT_DIRS_IGNORE` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3056 | variables. |
| 3057 | |
| 3058 | .. note:: |
| 3059 | |
| 3060 | Additionally, a recipe can customize the files further by |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3061 | declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3062 | variable. |
| 3063 | |
| 3064 | A shared state (sstate) object is built from these files and the |
| 3065 | files are placed into a subdirectory of |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 3066 | :ref:`structure-build-tmp-sysroots-components`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3067 | The files are scanned for hardcoded paths to the original |
| 3068 | installation location. If the location is found in text files, the |
| 3069 | hardcoded locations are replaced by tokens and a list of the files |
| 3070 | needing such replacements is created. These adjustments are referred |
| 3071 | to as "FIXMEs". The list of files that are scanned for paths is |
| 3072 | controlled by the :term:`SSTATE_SCAN_FILES` |
| 3073 | variable. |
| 3074 | |
| 3075 | - *Stage Two:* The second stage addresses recipes that want to use |
| 3076 | something from another recipe and declare a dependency on that recipe |
| 3077 | through the :term:`DEPENDS` variable. The recipe will |
| 3078 | have a |
| 3079 | :ref:`ref-tasks-prepare_recipe_sysroot` |
| 3080 | task and when this task executes, it creates the ``recipe-sysroot`` |
| 3081 | and ``recipe-sysroot-native`` in the recipe work directory (i.e. |
| 3082 | :term:`WORKDIR`). The OpenEmbedded build system |
| 3083 | creates hard links to copies of the relevant files from |
| 3084 | ``sysroots-components`` into the recipe work directory. |
| 3085 | |
| 3086 | .. note:: |
| 3087 | |
| 3088 | If hard links are not possible, the build system uses actual |
| 3089 | copies. |
| 3090 | |
| 3091 | The build system then addresses any "FIXMEs" to paths as defined from |
| 3092 | the list created in the first stage. |
| 3093 | |
| 3094 | Finally, any files in ``${bindir}`` within the sysroot that have the |
| 3095 | prefix "``postinst-``" are executed. |
| 3096 | |
| 3097 | .. note:: |
| 3098 | |
| 3099 | Although such sysroot post installation scripts are not |
| 3100 | recommended for general use, the files do allow some issues such |
| 3101 | as user creation and module indexes to be addressed. |
| 3102 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3103 | Because recipes can have other dependencies outside of :term:`DEPENDS` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3104 | (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``), |
| 3105 | the sysroot creation function ``extend_recipe_sysroot`` is also added |
| 3106 | as a pre-function for those tasks whose dependencies are not through |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3107 | :term:`DEPENDS` but operate similarly. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3108 | |
| 3109 | When installing dependencies into the sysroot, the code traverses the |
| 3110 | dependency graph and processes dependencies in exactly the same way |
| 3111 | as the dependencies would or would not be when installed from sstate. |
| 3112 | This processing means, for example, a native tool would have its |
| 3113 | native dependencies added but a target library would not have its |
| 3114 | dependencies traversed or installed. The same sstate dependency code |
| 3115 | is used so that builds should be identical regardless of whether |
| 3116 | sstate was used or not. For a closer look, see the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3117 | ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3118 | |
| 3119 | The build system is careful to maintain manifests of the files it |
| 3120 | installs so that any given dependency can be installed as needed. The |
| 3121 | sstate hash of the installed item is also stored so that if it |
| 3122 | changes, the build system can reinstall it. |
| 3123 | |
| 3124 | .. _ref-classes-syslinux: |
| 3125 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3126 | ``syslinux`` |
| 3127 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3128 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3129 | The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for |
| 3130 | building bootable images. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3131 | |
| 3132 | The class supports the following variables: |
| 3133 | |
| 3134 | - :term:`INITRD`: Indicates list of filesystem images to |
| 3135 | concatenate and use as an initial RAM disk (initrd). This variable is |
| 3136 | optional. |
| 3137 | |
| 3138 | - :term:`ROOTFS`: Indicates a filesystem image to include |
| 3139 | as the root filesystem. This variable is optional. |
| 3140 | |
| 3141 | - :term:`AUTO_SYSLINUXMENU`: Enables creating |
| 3142 | an automatic menu when set to "1". |
| 3143 | |
| 3144 | - :term:`LABELS`: Lists targets for automatic |
| 3145 | configuration. |
| 3146 | |
| 3147 | - :term:`APPEND`: Lists append string overrides for each |
| 3148 | label. |
| 3149 | |
| 3150 | - :term:`SYSLINUX_OPTS`: Lists additional options |
| 3151 | to add to the syslinux file. Semicolon characters separate multiple |
| 3152 | options. |
| 3153 | |
| 3154 | - :term:`SYSLINUX_SPLASH`: Lists a background |
| 3155 | for the VGA boot menu when you are using the boot menu. |
| 3156 | |
| 3157 | - :term:`SYSLINUX_DEFAULT_CONSOLE`: Set |
| 3158 | to "console=ttyX" to change kernel boot default console. |
| 3159 | |
| 3160 | - :term:`SYSLINUX_SERIAL`: Sets an alternate |
| 3161 | serial port. Or, turns off serial when the variable is set with an |
| 3162 | empty string. |
| 3163 | |
| 3164 | - :term:`SYSLINUX_SERIAL_TTY`: Sets an |
| 3165 | alternate "console=tty..." kernel boot argument. |
| 3166 | |
| 3167 | .. _ref-classes-systemd: |
| 3168 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3169 | ``systemd`` |
| 3170 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3171 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3172 | The :ref:`ref-classes-systemd` class provides support for recipes that install |
| 3173 | systemd unit files. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3174 | |
| 3175 | The functionality for this class is disabled unless you have "systemd" |
| 3176 | in :term:`DISTRO_FEATURES`. |
| 3177 | |
| 3178 | Under this class, the recipe or Makefile (i.e. whatever the recipe is |
| 3179 | calling during the :ref:`ref-tasks-install` task) |
| 3180 | installs unit files into |
| 3181 | ``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit |
| 3182 | files being installed go into packages other than the main package, you |
| 3183 | need to set :term:`SYSTEMD_PACKAGES` in your |
| 3184 | recipe to identify the packages in which the files will be installed. |
| 3185 | |
| 3186 | You should set :term:`SYSTEMD_SERVICE` to the |
| 3187 | name of the service file. You should also use a package name override to |
| 3188 | indicate the package to which the value applies. If the value applies to |
| 3189 | the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 3190 | is an example from the connman recipe:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3191 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 3192 | SYSTEMD_SERVICE:${PN} = "connman.service" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3193 | |
| 3194 | Services are set up to start on boot automatically |
| 3195 | unless you have set |
| 3196 | :term:`SYSTEMD_AUTO_ENABLE` to "disable". |
| 3197 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3198 | For more information on :ref:`ref-classes-systemd`, see the |
| 3199 | ":ref:`dev-manual/init-manager:selecting an initialization manager`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3200 | section in the Yocto Project Development Tasks Manual. |
| 3201 | |
| 3202 | .. _ref-classes-systemd-boot: |
| 3203 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3204 | ``systemd-boot`` |
| 3205 | ================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3206 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3207 | The :ref:`ref-classes-systemd-boot` class provides functions specific to the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3208 | systemd-boot bootloader for building bootable images. This is an |
| 3209 | internal class and is not intended to be used directly. |
| 3210 | |
| 3211 | .. note:: |
| 3212 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3213 | The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 3214 | used in previous Yocto Project releases with the ``systemd`` project. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3215 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3216 | Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to |
| 3217 | use this class. Doing so creates a standalone EFI bootloader that is not |
| 3218 | dependent on systemd. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3219 | |
| 3220 | For information on more variables used and supported in this class, see |
| 3221 | the :term:`SYSTEMD_BOOT_CFG`, |
| 3222 | :term:`SYSTEMD_BOOT_ENTRIES`, and |
| 3223 | :term:`SYSTEMD_BOOT_TIMEOUT` variables. |
| 3224 | |
| 3225 | You can also see the `Systemd-boot |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 3226 | documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3227 | for more information. |
| 3228 | |
| 3229 | .. _ref-classes-terminal: |
| 3230 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3231 | ``terminal`` |
| 3232 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3233 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3234 | The :ref:`ref-classes-terminal` class provides support for starting a terminal |
| 3235 | session. The :term:`OE_TERMINAL` variable controls which terminal emulator is |
| 3236 | used for the session. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3237 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3238 | Other classes use the :ref:`ref-classes-terminal` class anywhere a separate |
| 3239 | terminal session needs to be started. For example, the :ref:`ref-classes-patch` |
| 3240 | class assuming :term:`PATCHRESOLVE` is set to "user", the |
| 3241 | :ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all |
| 3242 | use the :ref:`ref-classes-terminal` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3243 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 3244 | .. _ref-classes-testimage: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3245 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3246 | ``testimage`` |
| 3247 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3248 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3249 | The :ref:`ref-classes-testimage` class supports running automated tests against |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3250 | images using QEMU and on actual hardware. The classes handle loading the |
| 3251 | tests and starting the image. To use the classes, you need to perform |
| 3252 | steps to set up the environment. |
| 3253 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 3254 | To enable this class, add the following to your configuration:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3255 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 3256 | IMAGE_CLASSES += "testimage" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3257 | |
| 3258 | The tests are commands that run on the target system over ``ssh``. Each |
| 3259 | test is written in Python and makes use of the ``unittest`` module. |
| 3260 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3261 | The :ref:`ref-classes-testimage` class runs tests on an image when called using the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 3262 | following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3263 | |
| 3264 | $ bitbake -c testimage image |
| 3265 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 3266 | Alternatively, if you wish to have tests automatically run for each image |
| 3267 | after it is built, you can set :term:`TESTIMAGE_AUTO`:: |
| 3268 | |
| 3269 | TESTIMAGE_AUTO = "1" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3270 | |
| 3271 | For information on how to enable, run, and create new tests, see the |
Patrick Williams | 96e4b4e | 2025-02-03 15:49:15 -0500 | [diff] [blame^] | 3272 | ":ref:`test-manual/runtime-testing:performing automated runtime testing`" |
| 3273 | section in the Yocto Project Test Environment Manual. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3274 | |
| 3275 | .. _ref-classes-testsdk: |
| 3276 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3277 | ``testsdk`` |
| 3278 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3279 | |
| 3280 | This class supports running automated tests against software development |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3281 | kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 3282 | using the following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3283 | |
| 3284 | $ bitbake -c testsdk image |
| 3285 | |
| 3286 | .. note:: |
| 3287 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 3288 | Best practices include using :term:`IMAGE_CLASSES` rather than |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3289 | :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 3290 | testing. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3291 | |
| 3292 | .. _ref-classes-texinfo: |
| 3293 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3294 | ``texinfo`` |
| 3295 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3296 | |
| 3297 | This class should be inherited by recipes whose upstream packages invoke |
| 3298 | the ``texinfo`` utilities at build-time. Native and cross recipes are |
| 3299 | made to use the dummy scripts provided by ``texinfo-dummy-native``, for |
| 3300 | improved performance. Target architecture recipes use the genuine |
| 3301 | Texinfo utilities. By default, they use the Texinfo utilities on the |
| 3302 | host system. |
| 3303 | |
| 3304 | .. note:: |
| 3305 | |
| 3306 | If you want to use the Texinfo recipe shipped with the build system, |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 3307 | you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo |
| 3308 | from :term:`SANITY_REQUIRED_UTILITIES`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3309 | |
| 3310 | .. _ref-classes-toaster: |
| 3311 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3312 | ``toaster`` |
| 3313 | =========== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3314 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3315 | The :ref:`ref-classes-toaster` class collects information about packages and images and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3316 | sends them as events that the BitBake user interface can receive. The |
| 3317 | class is enabled when the Toaster user interface is running. |
| 3318 | |
| 3319 | This class is not intended to be used directly. |
| 3320 | |
| 3321 | .. _ref-classes-toolchain-scripts: |
| 3322 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3323 | ``toolchain-scripts`` |
| 3324 | ===================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3325 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3326 | The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3327 | the environment for installed SDKs. |
| 3328 | |
| 3329 | .. _ref-classes-typecheck: |
| 3330 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3331 | ``typecheck`` |
| 3332 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3333 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3334 | The :ref:`ref-classes-typecheck` class provides support for validating the values of |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3335 | variables set at the configuration level against their defined types. |
| 3336 | The OpenEmbedded build system allows you to define the type of a |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 3337 | variable using the "type" varflag. Here is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3338 | |
| 3339 | IMAGE_FEATURES[type] = "list" |
| 3340 | |
| 3341 | .. _ref-classes-uboot-config: |
| 3342 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3343 | ``uboot-config`` |
| 3344 | ================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3345 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3346 | The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 3347 | a machine. Specify the machine in your recipe as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3348 | |
| 3349 | UBOOT_CONFIG ??= <default> |
Patrick Williams | 705982a | 2024-01-12 09:51:57 -0600 | [diff] [blame] | 3350 | UBOOT_CONFIG[foo] = "config,images,binary" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3351 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 3352 | You can also specify the machine using this method:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3353 | |
| 3354 | UBOOT_MACHINE = "config" |
| 3355 | |
| 3356 | See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional |
| 3357 | information. |
| 3358 | |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 3359 | .. _ref-classes-uboot-sign: |
| 3360 | |
| 3361 | ``uboot-sign`` |
| 3362 | ============== |
| 3363 | |
| 3364 | The :ref:`ref-classes-uboot-sign` class provides support for U-Boot verified boot. |
| 3365 | It is intended to be inherited from U-Boot recipes. |
| 3366 | |
Patrick Williams | 3965356 | 2024-03-01 08:54:02 -0600 | [diff] [blame] | 3367 | The variables used by this class are: |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 3368 | |
| 3369 | - :term:`SPL_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when |
| 3370 | building the FIT image. |
| 3371 | - :term:`SPL_SIGN_ENABLE`: enable signing the FIT image. |
| 3372 | - :term:`SPL_SIGN_KEYDIR`: directory containing the signing keys. |
| 3373 | - :term:`SPL_SIGN_KEYNAME`: base filename of the signing keys. |
| 3374 | - :term:`UBOOT_FIT_ADDRESS_CELLS`: ``#address-cells`` value for the FIT image. |
| 3375 | - :term:`UBOOT_FIT_DESC`: description string encoded into the FIT image. |
| 3376 | - :term:`UBOOT_FIT_GENERATE_KEYS`: generate the keys if they don't exist yet. |
| 3377 | - :term:`UBOOT_FIT_HASH_ALG`: hash algorithm for the FIT image. |
| 3378 | - :term:`UBOOT_FIT_KEY_GENRSA_ARGS`: ``openssl genrsa`` arguments. |
| 3379 | - :term:`UBOOT_FIT_KEY_REQ_ARGS`: ``openssl req`` arguments. |
| 3380 | - :term:`UBOOT_FIT_SIGN_ALG`: signature algorithm for the FIT image. |
| 3381 | - :term:`UBOOT_FIT_SIGN_NUMBITS`: size of the private key for FIT image |
Patrick Williams | 44b3caf | 2024-04-12 16:51:14 -0500 | [diff] [blame] | 3382 | signing. |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 3383 | - :term:`UBOOT_FIT_KEY_SIGN_PKCS`: algorithm for the public key certificate |
| 3384 | for FIT image signing. |
| 3385 | - :term:`UBOOT_FITIMAGE_ENABLE`: enable the generation of a U-Boot FIT image. |
| 3386 | - :term:`UBOOT_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when |
| 3387 | rebuilding the FIT image containing the kernel. |
| 3388 | |
| 3389 | See U-Boot's documentation for details about `verified boot |
| 3390 | <https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/verified-boot.txt>`__ |
| 3391 | and the `signature process |
| 3392 | <https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/signature.txt>`__. |
| 3393 | |
| 3394 | See also the description of :ref:`ref-classes-kernel-fitimage` class, which this class |
| 3395 | imitates. |
| 3396 | |
Patrick Williams | 8460358 | 2024-12-14 08:00:57 -0500 | [diff] [blame] | 3397 | .. _ref-classes-uki: |
| 3398 | |
| 3399 | ``uki`` |
| 3400 | ======= |
| 3401 | |
| 3402 | The :ref:`ref-classes-uki` class provides support for `Unified Kernel Image |
| 3403 | (UKI) <https://uapi-group.org/specifications/specs/unified_kernel_image/>`__ |
| 3404 | format. UKIs combine kernel, :term:`Initramfs`, signatures, metadata etc to a |
| 3405 | single UEFI firmware compatible binary. The class is intended to be inherited |
| 3406 | by rootfs image recipes. The build configuration should also use an |
| 3407 | :term:`Initramfs`, ``systemd-boot`` as boot menu provider and have UEFI support |
| 3408 | on target hardware. Using ``systemd`` as init is recommended. Image builds |
| 3409 | should create an ESP partition for UEFI firmware and copy ``systemd-boot`` and |
| 3410 | UKI files there. Sample configuration for Wic images is provided in |
| 3411 | :oe_git:`scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in |
| 3412 | <openembedded-core/tree/scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in>`. |
| 3413 | UKIs are generated using ``systemd`` reference implementation `ukify |
| 3414 | <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__. |
| 3415 | This class uses a number of variables but tries to find sensible defaults for |
| 3416 | them. |
| 3417 | |
| 3418 | The variables used by this class are: |
| 3419 | |
| 3420 | - :term:`EFI_ARCH`: architecture name within EFI standard, set in |
| 3421 | :oe_git:`meta/conf/image-uefi.conf |
| 3422 | <openembedded-core/tree/meta/conf/image-uefi.conf>` |
| 3423 | - :term:`IMAGE_EFI_BOOT_FILES`: files to install to EFI boot partition |
| 3424 | created by the ``bootimg-efi`` Wic plugin |
| 3425 | - :term:`INITRAMFS_IMAGE`: initramfs recipe name |
| 3426 | - :term:`KERNEL_DEVICETREE`: optional devicetree files to embed into UKI |
| 3427 | - :term:`UKIFY_CMD`: `ukify |
| 3428 | <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__ |
| 3429 | command to build the UKI image |
| 3430 | - :term:`UKI_CMDLINE`: kernel command line to use with UKI |
| 3431 | - :term:`UKI_CONFIG_FILE`: optional config file for `ukify |
| 3432 | <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__ |
| 3433 | - :term:`UKI_FILENAME`: output file name for the UKI image |
| 3434 | - :term:`UKI_KERNEL_FILENAME`: kernel image file name |
| 3435 | - :term:`UKI_SB_CERT`: optional UEFI secureboot certificate matching the |
| 3436 | private key |
| 3437 | - :term:`UKI_SB_KEY`: optional UEFI secureboot private key to sign UKI with |
| 3438 | |
| 3439 | For examples on how to use this class see oeqa selftest |
| 3440 | :oe_git:`meta/lib/oeqa/selftest/cases/uki.py |
| 3441 | <openembedded-core/tree/meta/lib/oeqa/selftest/cases/uki.py>`. |
| 3442 | Also an oeqa runtime test :oe_git:`meta/lib/oeqa/runtime/cases/uki.py |
| 3443 | <openembedded-core/tree/meta/lib/oeqa/runtime/cases/uki.py>` is provided which |
| 3444 | verifies that the target system booted the same UKI binary as was set at |
| 3445 | buildtime via :term:`UKI_FILENAME`. |
| 3446 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3447 | .. _ref-classes-uninative: |
| 3448 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3449 | ``uninative`` |
| 3450 | ============= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3451 | |
| 3452 | Attempts to isolate the build system from the host distribution's C |
| 3453 | library in order to make re-use of native shared state artifacts across |
| 3454 | different host distributions practical. With this class enabled, a |
| 3455 | tarball containing a pre-built C library is downloaded at the start of |
| 3456 | the build. In the Poky reference distribution this is enabled by default |
| 3457 | through ``meta/conf/distro/include/yocto-uninative.inc``. Other |
| 3458 | distributions that do not derive from poky can also |
| 3459 | "``require conf/distro/include/yocto-uninative.inc``" to use this. |
| 3460 | Alternatively if you prefer, you can build the uninative-tarball recipe |
| 3461 | yourself, publish the resulting tarball (e.g. via HTTP) and set |
| 3462 | ``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an |
| 3463 | example, see the ``meta/conf/distro/include/yocto-uninative.inc``. |
| 3464 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3465 | The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3466 | SDK. When building the extensible SDK, ``uninative-tarball`` is built |
| 3467 | and the resulting tarball is included within the SDK. |
| 3468 | |
| 3469 | .. _ref-classes-update-alternatives: |
| 3470 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3471 | ``update-alternatives`` |
| 3472 | ======================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3473 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3474 | The :ref:`ref-classes-update-alternatives` class helps the alternatives system when |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3475 | multiple sources provide the same command. This situation occurs when |
| 3476 | several programs that have the same or similar function are installed |
| 3477 | with the same name. For example, the ``ar`` command is available from |
| 3478 | the ``busybox``, ``binutils`` and ``elfutils`` packages. The |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3479 | :ref:`ref-classes-update-alternatives` class handles renaming the binaries so that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3480 | multiple packages can be installed without conflicts. The ``ar`` command |
| 3481 | still works regardless of which packages are installed or subsequently |
| 3482 | removed. The class renames the conflicting binary in each package and |
| 3483 | symlinks the highest priority binary during installation or removal of |
| 3484 | packages. |
| 3485 | |
| 3486 | To use this class, you need to define a number of variables: |
| 3487 | |
| 3488 | - :term:`ALTERNATIVE` |
| 3489 | |
| 3490 | - :term:`ALTERNATIVE_LINK_NAME` |
| 3491 | |
| 3492 | - :term:`ALTERNATIVE_TARGET` |
| 3493 | |
| 3494 | - :term:`ALTERNATIVE_PRIORITY` |
| 3495 | |
| 3496 | These variables list alternative commands needed by a package, provide |
| 3497 | pathnames for links, default links for targets, and so forth. For |
| 3498 | details on how to use this class, see the comments in the |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 3499 | :yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3500 | file. |
| 3501 | |
| 3502 | .. note:: |
| 3503 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 3504 | You can use the ``update-alternatives`` command directly in your recipes. |
| 3505 | However, this class simplifies things in most cases. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3506 | |
| 3507 | .. _ref-classes-update-rc.d: |
| 3508 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3509 | ``update-rc.d`` |
| 3510 | =============== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3511 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3512 | The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3513 | initialization script on behalf of the package. The OpenEmbedded build |
| 3514 | system takes care of details such as making sure the script is stopped |
| 3515 | before a package is removed and started when the package is installed. |
| 3516 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3517 | Three variables control this class: :term:`INITSCRIPT_PACKAGES`, |
| 3518 | :term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3519 | for details. |
| 3520 | |
| 3521 | .. _ref-classes-useradd: |
| 3522 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3523 | ``useradd*`` |
| 3524 | ============ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3525 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3526 | The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3527 | usage by the package on the target. For example, if you have packages |
| 3528 | that contain system services that should be run under their own user or |
| 3529 | group, you can use these classes to enable creation of the user or |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 3530 | group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb |
| 3531 | </openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3532 | recipe in the :term:`Source Directory` provides a simple |
| 3533 | example that shows how to add three users and groups to two packages. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3534 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3535 | The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3536 | groups settings. |
| 3537 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3538 | The :ref:`useradd* <ref-classes-useradd>` classes support the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3539 | :term:`USERADD_PACKAGES`, |
| 3540 | :term:`USERADD_PARAM`, |
| 3541 | :term:`GROUPADD_PARAM`, and |
| 3542 | :term:`GROUPMEMS_PARAM` variables. |
| 3543 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3544 | The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3545 | that have static user identification (``uid``) and group identification |
| 3546 | (``gid``) values. |
| 3547 | |
| 3548 | The default behavior of the OpenEmbedded build system for assigning |
| 3549 | ``uid`` and ``gid`` values when packages add users and groups during |
| 3550 | package install time is to add them dynamically. This works fine for |
| 3551 | programs that do not care what the values of the resulting users and |
| 3552 | groups become. In these cases, the order of the installation determines |
| 3553 | the final ``uid`` and ``gid`` values. However, if non-deterministic |
| 3554 | ``uid`` and ``gid`` values are a problem, you can override the default, |
| 3555 | dynamic application of these values by setting static values. When you |
| 3556 | set static values, the OpenEmbedded build system looks in |
| 3557 | :term:`BBPATH` for ``files/passwd`` and ``files/group`` |
| 3558 | files for the values. |
| 3559 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3560 | To use static ``uid`` and ``gid`` values, you need to set some variables. See |
| 3561 | the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`, |
| 3562 | :term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables. |
| 3563 | You can also see the :ref:`ref-classes-useradd` class for additional |
| 3564 | information. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3565 | |
| 3566 | .. note:: |
| 3567 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3568 | You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3569 | or disable the class by setting the :term:`USERADDEXTENSION` variable. If you |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 3570 | enable or disable the class in a configured system, :term:`TMPDIR` might |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3571 | contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3572 | directory will correct this condition. |
| 3573 | |
| 3574 | .. _ref-classes-utility-tasks: |
| 3575 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3576 | ``utility-tasks`` |
| 3577 | ================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3578 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3579 | The :ref:`ref-classes-utility-tasks` class provides support for various |
| 3580 | "utility" type tasks that are applicable to all recipes, such as |
| 3581 | :ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3582 | |
| 3583 | This class is enabled by default because it is inherited by the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3584 | :ref:`ref-classes-base` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3585 | |
| 3586 | .. _ref-classes-utils: |
| 3587 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3588 | ``utils`` |
| 3589 | ========= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3590 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3591 | The :ref:`ref-classes-utils` class provides some useful Python functions that are |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3592 | typically used in inline Python expressions (e.g. ``${@...}``). One |
| 3593 | example use is for ``bb.utils.contains()``. |
| 3594 | |
| 3595 | This class is enabled by default because it is inherited by the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3596 | :ref:`ref-classes-base` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3597 | |
| 3598 | .. _ref-classes-vala: |
| 3599 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3600 | ``vala`` |
| 3601 | ======== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3602 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3603 | The :ref:`ref-classes-vala` class supports recipes that need to build software written |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3604 | using the Vala programming language. |
| 3605 | |
Patrick Williams | 8460358 | 2024-12-14 08:00:57 -0500 | [diff] [blame] | 3606 | .. _ref-classes-vex: |
| 3607 | |
| 3608 | ``vex`` |
| 3609 | ======== |
| 3610 | |
| 3611 | The :ref:`ref-classes-vex` class is used to generate metadata needed by external |
| 3612 | tools to check for vulnerabilities, for example CVEs. It can be used as a |
| 3613 | replacement for :ref:`ref-classes-cve-check`. |
| 3614 | |
| 3615 | In order to use this class, inherit the class in the ``local.conf`` file and it |
| 3616 | will add the ``generate_vex`` task for every recipe:: |
| 3617 | |
| 3618 | INHERIT += "vex" |
| 3619 | |
| 3620 | If an image is built it will generate a report in :term:`DEPLOY_DIR_IMAGE` for |
| 3621 | all the packages used, it will also generate a file for all recipes used in the |
| 3622 | build. |
| 3623 | |
| 3624 | Variables use the ``CVE_CHECK`` prefix to keep compatibility with the |
| 3625 | :ref:`ref-classes-cve-check` class. |
| 3626 | |
| 3627 | Example usage:: |
| 3628 | |
| 3629 | bitbake -c generate_vex openssl |
| 3630 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3631 | .. _ref-classes-waf: |
| 3632 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3633 | ``waf`` |
| 3634 | ======= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3635 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 3636 | The :ref:`ref-classes-waf` class supports recipes that need to build software that uses |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3637 | the Waf build system. You can use the |
| 3638 | :term:`EXTRA_OECONF` or |
| 3639 | :term:`PACKAGECONFIG_CONFARGS` variables |
| 3640 | to specify additional configuration options to be passed on the Waf |
| 3641 | command line. |
Patrick Williams | 96e4b4e | 2025-02-03 15:49:15 -0500 | [diff] [blame^] | 3642 | |
| 3643 | .. _ref-classes-yocto-check-layer: |
| 3644 | |
| 3645 | ``yocto-check-layer`` |
| 3646 | ===================== |
| 3647 | |
| 3648 | The :ref:`ref-classes-yocto-check-layer` class is used by the |
| 3649 | :oe_git:`yocto-check-layer </openembedded-core/tree/scripts/yocto-check-layer>` |
| 3650 | script to ensure that packages from Yocto Project Compatible layers don't skip |
| 3651 | required QA checks listed in :term:`CHECKLAYER_REQUIRED_TESTS` defined by the |
| 3652 | :ref:`ref-classes-insane` class. |
| 3653 | |
| 3654 | It adds an anonymous python function with extra processing to all recipes, |
| 3655 | and globally inheriting this class with :term:`INHERIT` is not advised. Instead |
| 3656 | the ``yocto-check-layer`` script should be used as it handles usage of this |
| 3657 | class. |
| 3658 | |
| 3659 | For more information on the Yocto Project |
| 3660 | Compatible layers, see the :ref:`dev-manual/layers:Making Sure Your Layer is |
| 3661 | Compatible With Yocto Project` section of the Yocto Project Development Manual. |