blob: 8763e9e17efda66d998c11766e0035c37eee01ec [file] [log] [blame]
Andrew Geisslerf0343792020-11-18 10:42:21 -06001.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002
3*******
4Classes
5*******
6
7Class files are used to abstract common functionality and share it
8amongst multiple recipe (``.bb``) files. To use a class file, you simply
9make sure the recipe inherits the class. In most cases, when a recipe
10inherits a class it is enough to enable its features. There are cases,
11however, where in the recipe you might need to set variables or override
12some default behavior.
13
14Any :term:`Metadata` usually found in a recipe can also be
15placed in a class file. Class files are identified by the extension
Patrick Williams975a06f2022-10-21 14:42:47 -050016``.bbclass`` and are usually placed in one of a set of subdirectories
17beneath 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 Geisslerc9f78652020-09-18 14:11:35 -050024Class 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
27in :term:`BBPATH` using the same method by which ``.conf``
28files are searched.
29
30This chapter discusses only the most useful and important classes. Other
Patrick Williams975a06f2022-10-21 14:42:47 -050031classes do exist within the ``meta/classes*`` directories in the Source
Andrew Geisslerc9f78652020-09-18 14:11:35 -050032Directory. You can reference the ``.bbclass`` files directly for more
33information.
34
35.. _ref-classes-allarch:
36
Andrew Geissler517393d2023-01-13 08:55:19 -060037``allarch``
38===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -050039
Andrew Geissler517393d2023-01-13 08:55:19 -060040The :ref:`ref-classes-allarch` class is inherited by recipes that do not produce
Andrew Geisslerc9f78652020-09-18 14:11:35 -050041architecture-specific output. The class disables functionality that is
42normally needed for recipes that produce executable binaries (such as
43building the cross-compiler and a C library as pre-requisites, and
44splitting 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 Geissler517393d2023-01-13 08:55:19 -060052 configured for all architectures using :ref:`ref-classes-allarch`. This is the case
Andrew Geisslerc9f78652020-09-18 14:11:35 -050053 even if the recipes do not produce architecture-specific output.
54
55 Configuring such recipes for all architectures causes the
Patrick Williams2194f502022-10-16 14:26:09 -050056 :ref:`do_package_write_* <ref-tasks-package_write_deb>` tasks to
Andrew Geisslerc9f78652020-09-18 14:11:35 -050057 have different signatures for the machines with different tunings.
58 Additionally, unnecessary rebuilds occur every time an image for a
Andrew Geissler09036742021-06-25 14:25:14 -050059 different :term:`MACHINE` is built even when the recipe never changes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050060
Andrew Geissler517393d2023-01-13 08:55:19 -060061By default, all recipes inherit the :ref:`ref-classes-base` and
62:ref:`ref-classes-package` classes, which enable
Andrew Geisslerc9f78652020-09-18 14:11:35 -050063functionality needed for recipes that produce executable output. If your
64recipe, for example, only produces packages that contain configuration
65files, media files, or scripts (e.g. Python and Perl), then it should
Andrew Geissler517393d2023-01-13 08:55:19 -060066inherit the :ref:`ref-classes-allarch` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050067
68.. _ref-classes-archiver:
69
Andrew Geissler517393d2023-01-13 08:55:19 -060070``archiver``
71============
Andrew Geisslerc9f78652020-09-18 14:11:35 -050072
Andrew Geissler517393d2023-01-13 08:55:19 -060073The :ref:`ref-classes-archiver` class supports releasing source code and other
Andrew Geisslerc9f78652020-09-18 14:11:35 -050074materials with the binaries.
75
Andrew Geissler517393d2023-01-13 08:55:19 -060076For 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 Geisslerc9f78652020-09-18 14:11:35 -050078section in the Yocto Project Development Tasks Manual. You can also see
79the :term:`ARCHIVER_MODE` variable for information
80about the variable flags (varflags) that help control archive creation.
81
82.. _ref-classes-autotools:
83
Andrew Geissler517393d2023-01-13 08:55:19 -060084``autotools*``
85==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -050086
Patrick Williams2390b1b2022-11-03 13:47:49 -050087The :ref:`autotools* <ref-classes-autotools>` classes support packages built with the
Patrick Williams7784c422022-11-17 07:29:11 -060088:wikipedia:`GNU Autotools <GNU_Autotools>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050089
90The ``autoconf``, ``automake``, and ``libtool`` packages bring
91standardization. This class defines a set of tasks (e.g. ``configure``,
92``compile`` and so forth) that work for all Autotooled packages. It
93should usually be enough to define a few standard variables and then
94simply ``inherit autotools``. These classes can also work with software
95that emulates Autotools. For more information, see the
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060096":ref:`dev-manual/new-recipe:building an autotooled package`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -050097in the Yocto Project Development Tasks Manual.
98
Patrick Williams2390b1b2022-11-03 13:47:49 -050099By default, the :ref:`autotools* <ref-classes-autotools>` classes use out-of-tree builds (i.e.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500100``autotools.bbclass`` building with ``B != S``).
101
102If the software being built by a recipe does not support using
103out-of-tree builds, you should have the recipe inherit the
Patrick Williams2390b1b2022-11-03 13:47:49 -0500104:ref:`autotools-brokensep <ref-classes-autotools>` class. The :ref:`autotools-brokensep <ref-classes-autotools>` class behaves
Andrew Geissler517393d2023-01-13 08:55:19 -0600105the same as the :ref:`ref-classes-autotools` class but builds with :term:`B`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500106== :term:`S`. This method is useful when out-of-tree build
107support 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
114It's useful to have some idea of how the tasks defined by the
Patrick Williams2390b1b2022-11-03 13:47:49 -0500115:ref:`autotools* <ref-classes-autotools>` classes work and what they do behind the scenes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500116
Andrew Geissler615f2f12022-07-15 14:00:58 -0500117- :ref:`ref-tasks-configure` --- regenerates the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500118 configure script (using ``autoreconf``) and then launches it with a
119 standard set of arguments used during cross-compilation. You can pass
Andrew Geissler09036742021-06-25 14:25:14 -0500120 additional parameters to ``configure`` through the :term:`EXTRA_OECONF`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500121 or :term:`PACKAGECONFIG_CONFARGS`
122 variables.
123
Andrew Geissler615f2f12022-07-15 14:00:58 -0500124- :ref:`ref-tasks-compile` --- runs ``make`` with
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500125 arguments that specify the compiler and linker. You can pass
Andrew Geissler5f350902021-07-23 13:09:54 -0400126 additional arguments through the :term:`EXTRA_OEMAKE` variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500127
Andrew Geissler615f2f12022-07-15 14:00:58 -0500128- :ref:`ref-tasks-install` --- runs ``make install`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500129 passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``.
130
Patrick Williams96e4b4e2025-02-03 15:49:15 -0500131.. _ref-classes-barebox:
132
133``barebox``
134===========
135
136The :ref:`ref-classes-barebox` class manages building the barebox bootloader.
137
138If a file named ``defconfig`` is included in the :term:`SRC_URI`, it will be
139copied to ``.config`` in the build directory and used as the barebox
140configuration.
141Instead of providing a ``defconfig`` file, you can set :term:`BAREBOX_CONFIG`
142to a defconfig provided by the barebox source tree.
143If neither ``defconfig`` nor :term:`BAREBOX_CONFIG` is specified, the class
144will raise an error.
145
146The :ref:`ref-classes-barebox` class supports config fragments and internally
147includes the :ref:`ref-classes-cml1` class to provide `Kconfig
148<https://docs.kernel.org/kbuild/kconfig-language.html>`__ support for
149barebox, enabling tasks such as :ref:`ref-tasks-menuconfig` and
150:ref:`ref-tasks-diffconfig`.
151
152The generated barebox binaries are deployed to
153:term:`DEPLOY_DIR_IMAGE` as well as installed to ``BAREBOX_INSTALL_PATH``
154(``/boot`` by default) making them part of the recipe’s base package.
155This setup supports both using the barebox binaries as independent artifacts
156and installing them into a rootfs.
157:term:`BAREBOX_BINARY` can be used to select a distinct binary to deploy and
158install.
159If ``barebox`` is set as the :term:`EFI_PROVIDER`, the class will leverage
160:oe_git:`conf/image-uefi.conf </openembedded-core/tree/meta/conf/image-uefi.conf>`
161to define the default installation paths and naming conventions.
162
163The compiled-in barebox environment can be extended by adding environment files
164to the ``BAREBOX_ENV_DIR``.
165The ``BAREBOX_FIRMWARE_DIR`` variable allows you to specify the firmware blob
166search directory, enabling loading of additional firmware like TF-A or OP-TEE.
167
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500168.. _ref-classes-base:
169
Andrew Geissler517393d2023-01-13 08:55:19 -0600170``base``
171========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500172
Andrew Geissler517393d2023-01-13 08:55:19 -0600173The :ref:`ref-classes-base` class is special in that every ``.bb`` file implicitly
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500174inherits the class. This class contains definitions for standard basic
175tasks such as fetching, unpacking, configuring (empty by default),
176compiling (runs any ``Makefile`` present), installing (empty by default)
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500177and packaging (empty by default). These tasks are often overridden or
Andrew Geissler517393d2023-01-13 08:55:19 -0600178extended by other classes such as the :ref:`ref-classes-autotools` class or the
179:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500180
181The 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
184arguments passed directly to ``oe_runmake``.
185
186.. _ref-classes-bash-completion:
187
Andrew Geissler517393d2023-01-13 08:55:19 -0600188``bash-completion``
189===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500190
191Sets up packaging and dependencies appropriate for recipes that build
192software that includes bash-completion data.
193
194.. _ref-classes-bin-package:
195
Andrew Geissler517393d2023-01-13 08:55:19 -0600196``bin_package``
197===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500198
Patrick Williams84603582024-12-14 08:00:57 -0500199The :ref:`ref-classes-bin-package` class is a helper class for recipes, that
200disables the :ref:`ref-tasks-configure` and :ref:`ref-tasks-compile` tasks and
201copies the content of the :term:`S` directory into the :term:`D` directory. This
202is useful for installing binary packages (e.g. RPM packages) by passing the
203package in the :term:`SRC_URI` variable and inheriting this class.
204
205For RPMs and other packages that do not contain a subdirectory, you should set
206the :term:`SRC_URI` option ``subdir`` to :term:`BP` so that the contents are
207extracted to the directory expected by the default value of :term:`S`. For
208example::
209
210 SRC_URI = "https://example.com/downloads/somepackage.rpm;subdir=${BP}"
211
212This class can also be used for tarballs. For example::
213
214 SRC_URI = "file://somepackage.tar.xz;subdir=${BP}"
215
216The :ref:`ref-classes-bin-package` class will copy the extracted content of the
217tarball from :term:`S` to :term:`D`.
218
219This class assumes that the content of the package as installed in :term:`S`
220mirrors the expected layout once installed on the target, which is generally the
221case for binary packages. For example, an RPM package for a library would
222usually contain the ``usr/lib`` directory, and should be extracted to
223``${S}/usr/lib/<library>.so.<version>`` to be installed in :term:`D` correctly.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500224
225.. note::
226
Patrick Williams84603582024-12-14 08:00:57 -0500227 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 Geisslerc9f78652020-09-18 14:11:35 -0500231
232.. _ref-classes-binconfig:
233
Andrew Geissler517393d2023-01-13 08:55:19 -0600234``binconfig``
235=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500236
Andrew Geissler517393d2023-01-13 08:55:19 -0600237The :ref:`ref-classes-binconfig` class helps to correct paths in shell scripts.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500238
239Before ``pkg-config`` had become widespread, libraries shipped shell
240scripts to give information about the libraries and include paths needed
241to build software (usually named ``LIBNAME-config``). This class assists
242any recipe using such scripts.
243
244During staging, the OpenEmbedded build system installs such scripts into
245the ``sysroots/`` directory. Inheriting this class results in all paths
246in these scripts being changed to point into the ``sysroots/`` directory
247so that all builds that use the script use the correct directories for
248the cross compiling layout. See the
249:term:`BINCONFIG_GLOB` variable for more
250information.
251
252.. _ref-classes-binconfig-disabled:
253
Andrew Geissler517393d2023-01-13 08:55:19 -0600254``binconfig-disabled``
255======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500256
Andrew Geissler517393d2023-01-13 08:55:19 -0600257An alternative version of the :ref:`ref-classes-binconfig`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500258class, which disables binary configuration scripts by making them return
259an error in favor of using ``pkg-config`` to query the information. The
Andrew Geissler517393d2023-01-13 08:55:19 -0600260scripts to be disabled should be specified using the :term:`BINCONFIG`
261variable within the recipe inheriting the class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500262
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500263.. _ref-classes-buildhistory:
264
Andrew Geissler517393d2023-01-13 08:55:19 -0600265``buildhistory``
266================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500267
Andrew Geissler517393d2023-01-13 08:55:19 -0600268The :ref:`ref-classes-buildhistory` class records a history of build output metadata,
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500269which can be used to detect possible regressions as well as used for
270analysis of the build output. For more information on using Build
271History, see the
Andrew Geissler517393d2023-01-13 08:55:19 -0600272":ref:`dev-manual/build-quality:maintaining build output quality`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500273section in the Yocto Project Development Tasks Manual.
274
275.. _ref-classes-buildstats:
276
Andrew Geissler517393d2023-01-13 08:55:19 -0600277``buildstats``
278==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500279
Andrew Geissler517393d2023-01-13 08:55:19 -0600280The :ref:`ref-classes-buildstats` class records performance statistics about each task
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500281executed during the build (e.g. elapsed time, CPU usage, and I/O usage).
282
283When you use this class, the output goes into the
284:term:`BUILDSTATS_BASE` directory, which defaults
285to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using
286``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading
287chart of the entire build process and can be useful for highlighting
288bottlenecks.
289
290Collecting 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
293enable the class. However, if you want to disable the class, simply
Andrew Geissler517393d2023-01-13 08:55:19 -0600294remove ":ref:`ref-classes-buildstats`" from the :term:`USER_CLASSES` list.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500295
296.. _ref-classes-buildstats-summary:
297
Andrew Geissler517393d2023-01-13 08:55:19 -0600298``buildstats-summary``
299======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500300
301When inherited globally, prints statistics at the end of the build on
302sstate re-use. In order to function, this class requires the
Andrew Geissler517393d2023-01-13 08:55:19 -0600303:ref:`ref-classes-buildstats` class be enabled.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500304
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600305.. _ref-classes-cargo:
306
307``cargo``
308=========
309
310The :ref:`ref-classes-cargo` class allows to compile Rust language programs
311using `Cargo <https://doc.rust-lang.org/cargo/>`__. Cargo is Rust's package
312manager, allowing to fetch package dependencies and build your program.
313
314Using this class makes it very easy to build Rust programs. All you need
315is to use the :term:`SRC_URI` variable to point to a source repository
316which can be built by Cargo, typically one that was created by the
Andrew Geissler5082cc72023-09-11 08:41:39 -0400317``cargo new`` command, containing a ``Cargo.toml`` file, a ``Cargo.lock`` file and a ``src``
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600318subdirectory.
319
Andrew Geissler5082cc72023-09-11 08:41:39 -0400320If 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
323You 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>`
325recipe. Another example, with only crate dependencies, is the
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600326:oe_git:`uutils-coreutils </meta-openembedded/tree/meta-oe/recipes-core/uutils-coreutils>`
327recipe, which was generated by the `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__
328tool.
329
330This class inherits the :ref:`ref-classes-cargo_common` class.
331
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600332.. _ref-classes-cargo_c:
333
334``cargo_c``
335===========
336
337The :ref:`ref-classes-cargo_c` class can be inherited by a recipe to generate
338a Rust library that can be called by C/C++ code. The recipe which inherits this
339class has to only replace ``inherit cargo`` by ``inherit cargo_c``.
340
341See the :yocto_git:`rust-c-lib-example_git.bb
342</poky/tree/meta-selftest/recipes-devtools/rust/rust-c-lib-example_git.bb>`
343example recipe.
344
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600345.. _ref-classes-cargo_common:
346
347``cargo_common``
348================
349
350The :ref:`ref-classes-cargo_common` class is an internal class
351that is not intended to be used directly.
352
353An exception is the "rust" recipe, to build the Rust compiler and runtime
354library, which is built by Cargo but cannot use the :ref:`ref-classes-cargo`
355class. This is why this class was introduced.
356
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600357.. _ref-classes-cargo-update-recipe-crates:
358
359``cargo-update-recipe-crates``
360===============================
361
362The :ref:`ref-classes-cargo-update-recipe-crates` class allows
363recipe developers to update the list of Cargo crates in :term:`SRC_URI`
364by reading the ``Cargo.lock`` file in the source tree.
365
366To do so, create a recipe for your program, for example using
367:doc:`devtool </ref-manual/devtool-reference>`,
368make 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
373This creates a ``recipe-crates.inc`` file that you can include in your
374recipe::
375
376 require ${BPN}-crates.inc
377
378That's also something you can achieve by using the
379`cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__ tool.
380
Andrew Geissler5082cc72023-09-11 08:41:39 -0400381.. _ref-classes-ccache:
382
Andrew Geissler517393d2023-01-13 08:55:19 -0600383``ccache``
384==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500385
Andrew Geissler517393d2023-01-13 08:55:19 -0600386The :ref:`ref-classes-ccache` class enables the C/C++ Compiler Cache for the build.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500387This class is used to give a minor performance boost during the build.
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000388
389See https://ccache.samba.org/ for information on the C/C++ Compiler
390Cache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>`
391file for details about how to enable this mechanism in your configuration
392file, how to disable it for specific recipes, and how to share ``ccache``
393files between builds.
394
395However, using the class can lead to unexpected side-effects. Thus, using
396this class is not recommended.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500397
398.. _ref-classes-chrpath:
399
Andrew Geissler517393d2023-01-13 08:55:19 -0600400``chrpath``
401===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500402
Andrew Geissler517393d2023-01-13 08:55:19 -0600403The :ref:`ref-classes-chrpath` class is a wrapper around the "chrpath" utility, which
404is 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 Geisslerc9f78652020-09-18 14:11:35 -0500406in order to make them relocatable.
407
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500408.. _ref-classes-cmake:
409
Andrew Geissler517393d2023-01-13 08:55:19 -0600410``cmake``
411=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500412
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600413The :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
416pass to the ``cmake`` command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500417
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600418By default, the :ref:`ref-classes-cmake` class uses
419`Ninja <https://ninja-build.org/>`__ instead of GNU make for building, which
420offers better build performance. If a recipe is broken with Ninja, then the
421recipe can set the :term:`OECMAKE_GENERATOR` variable to ``Unix Makefiles`` to
422use GNU make instead.
423
424If you need to install custom CMake toolchain files supplied by the application
425being built, you should install them (during :ref:`ref-tasks-install`) to the
426preferred CMake Module directory: ``${D}${datadir}/cmake/modules/``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500427
Patrick Williams705982a2024-01-12 09:51:57 -0600428.. _ref-classes-cmake-qemu:
429
430``cmake-qemu``
431==============
432
433The :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
436the ``CMAKE_CROSSCOMPILING_EMULATOR`` setting to ``cmake``. This allows to use
437QEMU user-mode emulation for the execution of cross-compiled binaries on the
438host machine. For more information about ``CMAKE_CROSSCOMPILING_EMULATOR``
439please refer to the `related section of the CMake documentation
440<https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html>`__.
441
442Not 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
444involves a certain risk, which is also the reason why this feature is not part of
445the main :ref:`ref-classes-cmake` class by default.
446
447One use case is the execution of cross-compiled unit tests with CTest on the build
448machine. If ``CMAKE_CROSSCOMPILING_EMULATOR`` is configured::
449
450 cmake --build --target test
451
452works transparently with QEMU user-mode.
453
454If the CMake project is developed with this use case in mind this works very nicely.
455This also applies to an IDE configured to use ``cmake-native`` for cross-compiling.
456
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500457.. _ref-classes-cml1:
458
Andrew Geissler517393d2023-01-13 08:55:19 -0600459``cml1``
460========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500461
Andrew Geissler517393d2023-01-13 08:55:19 -0600462The :ref:`ref-classes-cml1` class provides basic support for the Linux kernel style
Patrick Williamsac13d5f2023-11-24 18:59:46 -0600463build configuration system. "cml" stands for "Configuration Menu Language", which
464originates from the Linux kernel but is also used in other projects such as U-Boot
465and BusyBox. It could have been called "kconfig" too.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500466
467.. _ref-classes-compress_doc:
468
Andrew Geissler517393d2023-01-13 08:55:19 -0600469``compress_doc``
470================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500471
Patrick Williams03514f12024-04-05 07:04:11 -0500472Enables compression for manual and info pages. This class is intended
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500473to be inherited globally. The default compression mechanism is gz (gzip)
474but you can select an alternative mechanism by setting the
475:term:`DOC_COMPRESS` variable.
476
477.. _ref-classes-copyleft_compliance:
478
Andrew Geissler517393d2023-01-13 08:55:19 -0600479``copyleft_compliance``
480=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500481
Andrew Geissler517393d2023-01-13 08:55:19 -0600482The :ref:`ref-classes-copyleft_compliance` class preserves source code for the purposes
483of license compliance. This class is an alternative to the :ref:`ref-classes-archiver`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500484class and is still used by some users even though it has been deprecated
Andrew Geissler517393d2023-01-13 08:55:19 -0600485in favor of the :ref:`ref-classes-archiver` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500486
487.. _ref-classes-copyleft_filter:
488
Andrew Geissler517393d2023-01-13 08:55:19 -0600489``copyleft_filter``
490===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500491
Andrew Geissler517393d2023-01-13 08:55:19 -0600492A class used by the :ref:`ref-classes-archiver` and
493:ref:`ref-classes-copyleft_compliance` classes
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500494for filtering licenses. The ``copyleft_filter`` class is an internal
495class and is not intended to be used directly.
496
497.. _ref-classes-core-image:
498
Andrew Geissler517393d2023-01-13 08:55:19 -0600499``core-image``
500==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500501
Andrew Geissler517393d2023-01-13 08:55:19 -0600502The :ref:`ref-classes-core-image` class provides common definitions for the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500503``core-image-*`` image recipes, such as support for additional
504:term:`IMAGE_FEATURES`.
505
506.. _ref-classes-cpan:
507
Andrew Geissler517393d2023-01-13 08:55:19 -0600508``cpan*``
509=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500510
Patrick Williams2390b1b2022-11-03 13:47:49 -0500511The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500512
513Recipes for Perl modules are simple. These recipes usually only need to
514point to the source's archive and then inherit the proper class file.
515Building is split into two methods depending on which method the module
516authors 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 Williams2390b1b2022-11-03 13:47:49 -0500524Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500525support.
526
Patrick Williams975a06f2022-10-21 14:42:47 -0500527.. _ref-classes-create-spdx:
528
Andrew Geissler517393d2023-01-13 08:55:19 -0600529``create-spdx``
530===============
Patrick Williams975a06f2022-10-21 14:42:47 -0500531
Andrew Geissler517393d2023-01-13 08:55:19 -0600532The :ref:`ref-classes-create-spdx` class provides support for
Patrick Williams7784c422022-11-17 07:29:11 -0600533automatically creating :term:`SPDX` :term:`SBOM` documents based upon image
534and SDK contents.
535
536This class is meant to be inherited globally from a configuration file::
537
538 INHERIT += "create-spdx"
539
540The 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,
543as well as in ``tmp/deploy/spdx``.
544
545The exact behaviour of this class, and the amount of output can be controlled
546by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`,
547:term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables.
548
549See the description of these variables and the
Andrew Geissler517393d2023-01-13 08:55:19 -0600550":ref:`dev-manual/sbom:creating a software bill of materials`"
Patrick Williams7784c422022-11-17 07:29:11 -0600551section in the Yocto Project Development Manual for more details.
Patrick Williams975a06f2022-10-21 14:42:47 -0500552
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500553.. _ref-classes-cross:
554
Andrew Geissler517393d2023-01-13 08:55:19 -0600555``cross``
556=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500557
Andrew Geissler517393d2023-01-13 08:55:19 -0600558The :ref:`ref-classes-cross` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500559cross-compilation tools.
560
561.. _ref-classes-cross-canadian:
562
Andrew Geissler517393d2023-01-13 08:55:19 -0600563``cross-canadian``
564==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500565
Andrew Geissler517393d2023-01-13 08:55:19 -0600566The :ref:`ref-classes-cross-canadian` class provides support for the recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500567the Canadian Cross-compilation tools for SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600568":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500569section in the Yocto Project Overview and Concepts Manual for more
570discussion on these cross-compilation tools.
571
572.. _ref-classes-crosssdk:
573
Andrew Geissler517393d2023-01-13 08:55:19 -0600574``crosssdk``
575============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500576
Andrew Geissler517393d2023-01-13 08:55:19 -0600577The :ref:`ref-classes-crosssdk` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500578cross-compilation tools used for building SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600579":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500580section in the Yocto Project Overview and Concepts Manual for more
581discussion on these cross-compilation tools.
582
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500583.. _ref-classes-cve-check:
584
Andrew Geissler517393d2023-01-13 08:55:19 -0600585``cve-check``
586=============
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500587
Andrew Geissler517393d2023-01-13 08:55:19 -0600588The :ref:`ref-classes-cve-check` class looks for known CVEs (Common Vulnerabilities
Patrick Williams2390b1b2022-11-03 13:47:49 -0500589and Exposures) while building with BitBake. This class is meant to be
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500590inherited globally from a configuration file::
591
592 INHERIT += "cve-check"
593
Patrick Williams2390b1b2022-11-03 13:47:49 -0500594To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
595add following line to the build configuration file::
596
597 include cve-extra-exclusions.inc
598
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500599You can also look for vulnerabilities in specific packages by passing
Patrick Williams2390b1b2022-11-03 13:47:49 -0500600``-c cve_check`` to BitBake.
601
602After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
603and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files.
604
605When building, the CVE checker will emit build time warnings for any detected
606issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
607and version being compiled and no patches to address the issue are applied. Other states
608for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
609applied, and ``Ignored`` meaning that the issue can be ignored.
610
611The ``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
613CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
614
Patrick Williams2f814a62024-04-16 16:28:03 -0500615.. 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 Williams2a254922023-08-11 09:48:11 -0500622If the recipe adds ``CVE-ID`` as flag of the :term:`CVE_STATUS` variable with status
623mapped to ``Ignored``, then the CVE state is reported as ``Ignored``::
Patrick Williams2390b1b2022-11-03 13:47:49 -0500624
Patrick Williams2a254922023-08-11 09:48:11 -0500625 CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows"
Patrick Williams2390b1b2022-11-03 13:47:49 -0500626
627If CVE check reports that a recipe contains false positives or false negatives, these may be
628fixed 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
630database vendor and product pairs using the syntax::
631
632 CVE_PRODUCT = "flex_project:flex"
633
634where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
635if the default recipe version :term:`PV` does not match the version numbers of the software component
636in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
637CVE database compatible version number, for example::
638
639 CVE_VERSION = "2.39"
640
641Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
642via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
643
644Users should note that security is a process, not a product, and thus also CVE checking, analyzing results,
645patching and updating the software should be done as a regular process. The data and assumptions
646required for CVE checker to reliably detect issues are frequently broken in various ways.
647These can only be detected by reviewing the details of the issues and iterating over the generated reports,
648and following what happens in other Linux distributions and in the greater open source community.
649
650You will find some more details in the
Andrew Geissler517393d2023-01-13 08:55:19 -0600651":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500652section in the Development Tasks Manual.
653
Patrick Williams96e4b4e2025-02-03 15:49:15 -0500654.. _ref-classes-cython:
655
656``cython``
657==========
658
659The :ref:`ref-classes-cython` class can be used by Python recipes that require
660`Cython <https://cython.org/>`__ as part of their build dependencies
661(:term:`DEPENDS`).
662
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500663.. _ref-classes-debian:
664
Andrew Geissler517393d2023-01-13 08:55:19 -0600665``debian``
666==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500667
Andrew Geissler517393d2023-01-13 08:55:19 -0600668The :ref:`ref-classes-debian` class renames output packages so that they follow the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500669Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
670``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
671name and version as part of the package name.
672
673If a recipe creates packages for multiple libraries (shared object files
674of ``.so`` type), use the :term:`LEAD_SONAME`
675variable in the recipe to specify the library on which to apply the
676naming scheme.
677
678.. _ref-classes-deploy:
679
Andrew Geissler517393d2023-01-13 08:55:19 -0600680``deploy``
681==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500682
Andrew Geissler517393d2023-01-13 08:55:19 -0600683The :ref:`ref-classes-deploy` class handles deploying files to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500684:term:`DEPLOY_DIR_IMAGE` directory. The main
685function of this class is to allow the deploy step to be accelerated by
686shared state. Recipes that inherit this class should define their own
687:ref:`ref-tasks-deploy` function to copy the files to be
688deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
689add 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 Geissler09036742021-06-25 14:25:14 -0500692staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500693
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500694.. _ref-classes-devicetree:
695
696``devicetree``
697==============
698
699The :ref:`ref-classes-devicetree` class allows to build a recipe that compiles
700device tree source files that are not in the kernel tree.
701
702The compilation of out-of-tree device tree sources is the same as the kernel
703in-tree device tree compilation process. This includes the ability to include
704sources from the kernel such as SoC ``dtsi`` files as well as C header files,
705such as ``gpio.h``.
706
707The :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 Williams520786c2023-06-25 16:20:36 -0500714This class deploys the generated device tree binaries into
715``${``\ :term:`DEPLOY_DIR_IMAGE`\ ``}/devicetree/``. This is similar to
716what the :ref:`ref-classes-kernel-devicetree` class does, with the added
717``devicetree`` subdirectory to avoid name clashes. Additionally, the device
718trees are populated into the sysroot for access via the sysroot from within
719other recipes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500720
Patrick Williamsb542dec2023-06-09 01:26:37 -0500721By default, all device tree sources located in :term:`DT_FILES_PATH` directory
722are compiled. To select only particular sources, set :term:`DT_FILES` to
723a space-separated list of files (relative to :term:`DT_FILES_PATH`). For
724convenience, both ``.dts`` and ``.dtb`` extensions can be used.
725
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500726An extra padding is appended to non-overlay device trees binaries. This
727can typically be used as extra space for adding extra properties at boot time.
Patrick Williamsb542dec2023-06-09 01:26:37 -0500728The padding size can be modified by setting :term:`DT_PADDING_SIZE`
729to the desired size, in bytes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500730
731See :oe_git:`devicetree.bbclass sources
Patrick Williams44b3caf2024-04-12 16:51:14 -0500732</openembedded-core/tree/meta/classes-recipe/devicetree.bbclass>`
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500733for further variables controlling this class.
734
735Here is an excerpt of an example ``recipes-kernel/linux/devicetree-acme.bb``
736recipe inheriting this class::
737
738 inherit devicetree
739 COMPATIBLE_MACHINE = "^mymachine$"
740 SRC_URI:mymachine = "file://mymachine.dts"
741
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500742.. _ref-classes-devshell:
743
Andrew Geissler517393d2023-01-13 08:55:19 -0600744``devshell``
745============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500746
Andrew Geissler517393d2023-01-13 08:55:19 -0600747The :ref:`ref-classes-devshell` class adds the :ref:`ref-tasks-devshell` task. Distribution
748policy dictates whether to include this class. See the ":ref:`dev-manual/development-shell:using a development shell`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500749section in the Yocto Project Development Tasks Manual for more
Andrew Geissler517393d2023-01-13 08:55:19 -0600750information about using :ref:`ref-classes-devshell`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500751
752.. _ref-classes-devupstream:
753
Andrew Geissler517393d2023-01-13 08:55:19 -0600754``devupstream``
755===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500756
Andrew Geissler517393d2023-01-13 08:55:19 -0600757The :ref:`ref-classes-devupstream` class uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500758:term:`BBCLASSEXTEND` to add a variant of the
759recipe that fetches from an alternative URI (e.g. Git) instead of a
Patrick Williams39653562024-03-01 08:54:02 -0600760tarball. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500761
762 BBCLASSEXTEND = "devupstream:target"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000763 SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500764 SRCREV:class-devupstream = "abcd1234"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500765
766Adding the above statements to your recipe creates a variant that has
767:term:`DEFAULT_PREFERENCE` set to "-1".
768Consequently, you need to select the variant of the recipe to use it.
769Any development-specific adjustments can be done by using the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500770``class-devupstream`` override. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500771
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500772 DEPENDS:append:class-devupstream = " gperf-native"
773 do_configure:prepend:class-devupstream() {
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500774 touch ${S}/README
775 }
776
777The class
778currently only supports creating a development variant of the target
Andrew Geissler517393d2023-01-13 08:55:19 -0600779recipe, not :ref:`ref-classes-native` or :ref:`ref-classes-nativesdk` variants.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500780
Andrew Geissler09036742021-06-25 14:25:14 -0500781The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
Andrew Geissler517393d2023-01-13 08:55:19 -0600782support for :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` variants. Consequently, this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500783functionality can be added in a future release.
784
785Support for other version control systems such as Subversion is limited
786due to BitBake's automatic fetch dependencies (e.g.
787``subversion-native``).
788
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500789.. _ref-classes-externalsrc:
790
Andrew Geissler517393d2023-01-13 08:55:19 -0600791``externalsrc``
792===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500793
Andrew Geissler517393d2023-01-13 08:55:19 -0600794The :ref:`ref-classes-externalsrc` class supports building software from source code
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500795that is external to the OpenEmbedded build system. Building software
796from an external source tree means that the build system's normal fetch,
797unpack, and patch process is not used.
798
799By default, the OpenEmbedded build system uses the :term:`S`
800and :term:`B` variables to locate unpacked recipe source code
801and to build it, respectively. When your recipe inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -0600802:ref:`ref-classes-externalsrc` class, you use the
803:term:`EXTERNALSRC` and :term:`EXTERNALSRC_BUILD` variables to
Andrew Geissler09036742021-06-25 14:25:14 -0500804ultimately define :term:`S` and :term:`B`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500805
806By default, this class expects the source code to support recipe builds
807that use the :term:`B` variable to point to the directory in
808which the OpenEmbedded build system places the generated objects built
Andrew Geissler09036742021-06-25 14:25:14 -0500809from the recipes. By default, the :term:`B` directory is set to the
810following, which is separate from the source directory (:term:`S`)::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500811
Andrew Geissler5199d832021-09-24 16:47:35 -0500812 ${WORKDIR}/${BPN}-{PV}/
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500813
814See these variables for more information:
815:term:`WORKDIR`, :term:`BPN`, and
816:term:`PV`,
817
Andrew Geissler517393d2023-01-13 08:55:19 -0600818For more information on the :ref:`ref-classes-externalsrc` class, see the comments in
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500819``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
Andrew Geissler517393d2023-01-13 08:55:19 -0600820For 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 Geisslerc9f78652020-09-18 14:11:35 -0500822section in the Yocto Project Development Tasks Manual.
823
824.. _ref-classes-extrausers:
825
Andrew Geissler517393d2023-01-13 08:55:19 -0600826``extrausers``
827==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500828
Andrew Geissler517393d2023-01-13 08:55:19 -0600829The :ref:`ref-classes-extrausers` class allows additional user and group configuration
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500830to be applied at the image level. Inheriting this class either globally
831or from an image recipe allows additional user and group operations to
832be performed using the
833:term:`EXTRA_USERS_PARAMS` variable.
834
835.. note::
836
Andrew Geissler517393d2023-01-13 08:55:19 -0600837 The user and group operations added using the :ref:`ref-classes-extrausers`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500838 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 Geissler517393d2023-01-13 08:55:19 -0600840 whole. Use the :ref:`ref-classes-useradd` class to add user and group
841 configuration to a specific recipe.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500842
Andrew Geisslerc926e172021-05-07 16:11:35 -0500843Here is an example that uses this class in an image recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500844
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
855Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
Andrew Geissler9aee5002022-03-30 16:27:02 +0000856passwords. First on host, create the (escaped) password hash::
Andrew Geisslereff27472021-10-29 15:35:00 -0500857
Andrew Geissler9aee5002022-03-30 16:27:02 +0000858 printf "%q" $(mkpasswd -m sha256crypt tester01)
Andrew Geisslereff27472021-10-29 15:35:00 -0500859
Andrew Geissler9aee5002022-03-30 16:27:02 +0000860The resulting hash is set to a variable and used in ``useradd`` command parameters::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500861
862 inherit extrausers
Andrew Geisslereff27472021-10-29 15:35:00 -0500863 PASSWD = "\$X\$ABC123\$A-Long-Hash"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500864 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500865 useradd -p '${PASSWD}' tester-jim; \
866 useradd -p '${PASSWD}' tester-sue; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500867 "
868
Andrew Geisslereff27472021-10-29 15:35:00 -0500869Finally, here is an example that sets the root password::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500870
871 inherit extrausers
872 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500873 usermod -p '${PASSWD}' root; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500874 "
875
Patrick Williams03907ee2022-05-01 06:28:52 -0500876.. note::
877
878 From a security perspective, hardcoding a default password is not
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500879 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 Williams03907ee2022-05-01 06:28:52 -0500881 image.
882
883
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600884.. _ref-classes-features_check:
885
Andrew Geissler517393d2023-01-13 08:55:19 -0600886``features_check``
887==================
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600888
Andrew Geissler517393d2023-01-13 08:55:19 -0600889The :ref:`ref-classes-features_check` class allows individual recipes to check
890for required and conflicting :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES`
891or :term:`COMBINED_FEATURES`.
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600892
893This 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
905If any conditions specified in the recipe using the above
906variables are not met, the recipe will be skipped, and if the
907build system attempts to build the recipe then an error will be
908triggered.
909
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500910.. _ref-classes-fontcache:
911
Andrew Geissler517393d2023-01-13 08:55:19 -0600912``fontcache``
913=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500914
Andrew Geissler517393d2023-01-13 08:55:19 -0600915The :ref:`ref-classes-fontcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500916post-remove (postinst and postrm) scriptlets for font packages. These
917scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
918to the font information cache. Since the cache files are
919architecture-specific, ``fc-cache`` runs using QEMU if the postinst
920scriptlets need to be run on the build host during image creation.
921
922If the fonts being installed are in packages other than the main
923package, set :term:`FONT_PACKAGES` to specify the
924packages containing the fonts.
925
926.. _ref-classes-fs-uuid:
927
Andrew Geissler517393d2023-01-13 08:55:19 -0600928``fs-uuid``
929===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500930
Andrew Geissler517393d2023-01-13 08:55:19 -0600931The :ref:`ref-classes-fs-uuid` class extracts UUID from
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500932``${``\ :term:`ROOTFS`\ ``}``, which must have been built
Andrew Geissler517393d2023-01-13 08:55:19 -0600933by the time that this function gets called. The :ref:`ref-classes-fs-uuid` class only
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500934works on ``ext`` file systems and depends on ``tune2fs``.
935
936.. _ref-classes-gconf:
937
Andrew Geissler517393d2023-01-13 08:55:19 -0600938``gconf``
939=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500940
Andrew Geissler517393d2023-01-13 08:55:19 -0600941The :ref:`ref-classes-gconf` class provides common functionality for recipes that need
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500942to install GConf schemas. The schemas will be put into a separate
943package (``${``\ :term:`PN`\ ``}-gconf``) that is created
944automatically when this class is inherited. This package uses the
945appropriate post-install and post-remove (postinst/postrm) scriptlets to
946register and unregister the schemas in the target image.
947
948.. _ref-classes-gettext:
949
Andrew Geissler517393d2023-01-13 08:55:19 -0600950``gettext``
951===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500952
Andrew Geissler517393d2023-01-13 08:55:19 -0600953The :ref:`ref-classes-gettext` class provides support for building
954software that uses the GNU ``gettext`` internationalization and localization
955system. All recipes building software that use ``gettext`` should inherit this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500956class.
957
Patrick Williams975a06f2022-10-21 14:42:47 -0500958.. _ref-classes-github-releases:
959
Andrew Geissler517393d2023-01-13 08:55:19 -0600960``github-releases``
961===================
Patrick Williams975a06f2022-10-21 14:42:47 -0500962
Andrew Geissler517393d2023-01-13 08:55:19 -0600963For recipes that fetch release tarballs from github, the :ref:`ref-classes-github-releases`
Patrick Williams975a06f2022-10-21 14:42:47 -0500964class sets up a standard way for checking available upstream versions
965(to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)).
966
Andrew Geissler517393d2023-01-13 08:55:19 -0600967To use it, add ":ref:`ref-classes-github-releases`" to the inherit line in the recipe,
Patrick Williams975a06f2022-10-21 14:42:47 -0500968and if the default value of :term:`GITHUB_BASE_URI` is not suitable,
969then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}``
970in the value you set for :term:`SRC_URI` within the recipe.
971
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500972.. _ref-classes-gnomebase:
973
Andrew Geissler517393d2023-01-13 08:55:19 -0600974``gnomebase``
975=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500976
Andrew Geissler517393d2023-01-13 08:55:19 -0600977The :ref:`ref-classes-gnomebase` class is the base class for recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500978software from the GNOME stack. This class sets
979:term:`SRC_URI` to download the source from the GNOME
980mirrors as well as extending :term:`FILES` with the typical
981GNOME installation paths.
982
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600983.. _ref-classes-go:
984
985``go``
986======
987
988The :ref:`ref-classes-go` class supports building Go programs. The behavior of
989this class is controlled by the mandatory :term:`GO_IMPORT` variable, and
990by the optional :term:`GO_INSTALL` and :term:`GO_INSTALL_FILTEROUT` ones.
991
992To 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>`
994recipe as an example.
995
996.. _ref-classes-go-mod:
997
998``go-mod``
999==========
1000
1001The :ref:`ref-classes-go-mod` class allows to use Go modules, and inherits the
1002:ref:`ref-classes-go` class.
1003
1004See the associated :term:`GO_WORKDIR` variable.
1005
Patrick Williams44b3caf2024-04-12 16:51:14 -05001006.. _ref-classes-go-vendor:
1007
1008``go-vendor``
1009=============
1010
1011The :ref:`ref-classes-go-vendor` class implements support for offline builds,
1012also known as Go vendoring. In such a scenario, the module dependencias are
1013downloaded during the :ref:`ref-tasks-fetch` task rather than when modules are
1014imported, thus being coherent with Yocto's concept of fetching every source
1015beforehand.
1016
1017The dependencies are unpacked into the modules' ``vendor`` directory, where a
1018manifest file is generated.
1019
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001020.. _ref-classes-gobject-introspection:
1021
Andrew Geissler517393d2023-01-13 08:55:19 -06001022``gobject-introspection``
1023=========================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001024
1025Provides support for recipes building software that supports GObject
1026introspection. 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 Geisslerfc113ea2023-03-31 09:59:46 -05001034 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 Geissler09036742021-06-25 14:25:14 -05001037 :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001038
1039.. _ref-classes-grub-efi:
1040
Andrew Geissler517393d2023-01-13 08:55:19 -06001041``grub-efi``
1042============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001043
Andrew Geissler517393d2023-01-13 08:55:19 -06001044The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001045building bootable images.
1046
1047This 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).
Patrick Williams43a6b7c2025-02-13 15:13:32 -05001051 Can be specified for each ``LABEL``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001052
1053- :term:`ROOTFS`: Indicates a filesystem image to include
1054 as the root filesystem (optional).
1055
1056- :term:`GRUB_GFXSERIAL`: Set this to "1" to have
1057 graphics and serial in the boot menu.
1058
1059- :term:`LABELS`: A list of targets for the automatic
1060 configuration.
1061
1062- :term:`APPEND`: An override list of append strings for
1063 each ``LABEL``.
1064
Patrick Williams43a6b7c2025-02-13 15:13:32 -05001065- :term:`GRUB_TITLE`: A custom title for each ``LABEL``. If a label does not
1066 have a custom title, the label is used as title for the GRUB menu entry.
1067
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001068- :term:`GRUB_OPTS`: Additional options to add to the
1069 configuration (optional). Options are delimited using semi-colon
1070 characters (``;``).
1071
1072- :term:`GRUB_TIMEOUT`: Timeout before executing
1073 the default ``LABEL`` (optional).
1074
Patrick Williams43a6b7c2025-02-13 15:13:32 -05001075Each ``LABEL`` defined in the :term:`LABELS` variable creates a GRUB boot
1076entry, and some variables can be defined individually per ``LABEL``. The label
1077specific override names are defined as ``grub_LABEL``.
1078
1079For example, for a label ``factory``, the override name would be
1080``grub_factory``. A custom GRUB menu entry titled "Factory Install" with the
1081additional parameter ``factory=yes`` can be achieved as follows::
1082
1083 LABELS:append = " factory"
1084 APPEND:grub_factory = "factory=yes"
1085 GRUB_TITLE:grub_factory = "Factory Install"
1086
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001087.. _ref-classes-gsettings:
1088
Andrew Geissler517393d2023-01-13 08:55:19 -06001089``gsettings``
1090=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001091
Andrew Geissler517393d2023-01-13 08:55:19 -06001092The :ref:`ref-classes-gsettings` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001093need to install GSettings (glib) schemas. The schemas are assumed to be
1094part of the main package. Appropriate post-install and post-remove
1095(postinst/postrm) scriptlets are added to register and unregister the
1096schemas in the target image.
1097
1098.. _ref-classes-gtk-doc:
1099
Andrew Geissler517393d2023-01-13 08:55:19 -06001100``gtk-doc``
1101===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001102
Andrew Geissler517393d2023-01-13 08:55:19 -06001103The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001104``gtk-doc`` dependencies and disable ``gtk-doc``.
1105
1106.. _ref-classes-gtk-icon-cache:
1107
Andrew Geissler517393d2023-01-13 08:55:19 -06001108``gtk-icon-cache``
1109==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001110
Andrew Geissler517393d2023-01-13 08:55:19 -06001111The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001112post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
1113install icons. These scriptlets call ``gtk-update-icon-cache`` to add
1114the fonts to GTK+'s icon cache. Since the cache files are
1115architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
1116the postinst scriptlets need to be run on the build host during image
1117creation.
1118
1119.. _ref-classes-gtk-immodules-cache:
1120
Andrew Geissler517393d2023-01-13 08:55:19 -06001121``gtk-immodules-cache``
1122=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001123
Andrew Geissler517393d2023-01-13 08:55:19 -06001124The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001125post-remove (postinst/postrm) scriptlets for packages that install GTK+
1126input method modules for virtual keyboards. These scriptlets call
1127``gtk-update-icon-cache`` to add the input method modules to the cache.
1128Since the cache files are architecture-specific,
1129``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
1130need to be run on the build host during image creation.
1131
1132If the input method modules being installed are in packages other than
1133the main package, set
1134:term:`GTKIMMODULES_PACKAGES` to specify
1135the packages containing the modules.
1136
1137.. _ref-classes-gzipnative:
1138
Andrew Geissler517393d2023-01-13 08:55:19 -06001139``gzipnative``
1140==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001141
Andrew Geissler517393d2023-01-13 08:55:19 -06001142The :ref:`ref-classes-gzipnative` class enables the use of different native versions of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001143``gzip`` and ``pigz`` rather than the versions of these tools from the
1144build host.
1145
1146.. _ref-classes-icecc:
1147
Andrew Geissler517393d2023-01-13 08:55:19 -06001148``icecc``
1149=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001150
Andrew Geissler517393d2023-01-13 08:55:19 -06001151The :ref:`ref-classes-icecc` class supports
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001152`Icecream <https://github.com/icecc/icecream>`__, which facilitates
1153taking compile jobs and distributing them among remote machines.
1154
1155The class stages directories with symlinks from ``gcc`` and ``g++`` to
1156``icecc``, for both native and cross compilers. Depending on each
1157configure or compile, the OpenEmbedded build system adds the directories
1158at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001159``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001160compilers, respectively.
1161
1162For the cross compiler, the class creates a ``tar.gz`` file that
1163contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
1164is the version of the cross-compiler used in the cross-development
1165toolchain, accordingly.
1166
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001167The class handles all three different compile stages (i.e native,
1168cross-kernel and target) and creates the necessary environment
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001169``tar.gz`` file to be used by the remote machines. The class also
1170supports SDK generation.
1171
1172If :term:`ICECC_PATH` is not set in your
1173``local.conf`` file, then the class tries to locate the ``icecc`` binary
1174using ``which``. If :term:`ICECC_ENV_EXEC` is set
1175in your ``local.conf`` file, the variable should point to the
1176``icecc-create-env`` script provided by the user. If you do not point to
1177a user-provided script, the build system uses the default script
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001178provided by the recipe :oe_git:`icecc-create-env_0.1.bb
1179</openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001180
1181.. note::
1182
1183 This script is a modified version and not the one that comes with
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001184 ``icecream``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001185
1186If you do not want the Icecream distributed compile support to apply to
Andrew Geissler595f6302022-01-24 19:11:47 +00001187specific recipes or classes, you can ask them to be ignored by Icecream
1188by listing the recipes and classes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001189:term:`ICECC_RECIPE_DISABLE` and
1190:term:`ICECC_CLASS_DISABLE` variables,
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001191respectively, in your ``local.conf`` file. Doing so causes the
1192OpenEmbedded build system to handle these compilations locally.
1193
1194Additionally, you can list recipes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001195:term:`ICECC_RECIPE_ENABLE` variable in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001196your ``local.conf`` file to force ``icecc`` to be enabled for recipes
1197using an empty :term:`PARALLEL_MAKE` variable.
1198
Andrew Geissler517393d2023-01-13 08:55:19 -06001199Inheriting the :ref:`ref-classes-icecc` class changes all sstate signatures.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001200Consequently, if a development team has a dedicated build system that
1201populates :term:`SSTATE_MIRRORS` and they want to
Andrew Geissler09036742021-06-25 14:25:14 -05001202reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
Andrew Geissler517393d2023-01-13 08:55:19 -06001203system need to either inherit the :ref:`ref-classes-icecc` class or nobody should.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001204
Andrew Geissler517393d2023-01-13 08:55:19 -06001205At the distribution level, you can inherit the :ref:`ref-classes-icecc` class to be
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001206sure that all builders start with the same sstate signatures. After
1207inheriting the class, you can then disable the feature by setting the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001208:term:`ICECC_DISABLED` variable to "1" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001209
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001210 INHERIT_DISTRO:append = " icecc"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001211 ICECC_DISABLED ??= "1"
1212
1213This practice
1214makes sure everyone is using the same signatures but also requires
1215individuals that do want to use Icecream to enable the feature
Andrew Geisslerc926e172021-05-07 16:11:35 -05001216individually as follows in your ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001217
1218 ICECC_DISABLED = ""
1219
1220.. _ref-classes-image:
1221
Andrew Geissler517393d2023-01-13 08:55:19 -06001222``image``
1223=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001224
Andrew Geissler517393d2023-01-13 08:55:19 -06001225The :ref:`ref-classes-image` class helps support creating images in different formats.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001226First, the root filesystem is created from packages using one of the
1227``rootfs*.bbclass`` files (depending on the package format used) and
1228then one or more image files are created.
1229
Andrew Geissler09036742021-06-25 14:25:14 -05001230- The :term:`IMAGE_FSTYPES` variable controls the types of images to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001231 generate.
1232
Andrew Geissler09036742021-06-25 14:25:14 -05001233- The :term:`IMAGE_INSTALL` variable controls the list of packages to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001234 install into the image.
1235
1236For information on customizing images, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001237":ref:`dev-manual/customizing-images:customizing images`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001238in the Yocto Project Development Tasks Manual. For information on how
1239images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001240":ref:`overview-manual/concepts:images`" section in the
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001241Yocto Project Overview and Concepts Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001242
1243.. _ref-classes-image-buildinfo:
1244
Andrew Geissler517393d2023-01-13 08:55:19 -06001245``image-buildinfo``
1246===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001247
Andrew Geissler517393d2023-01-13 08:55:19 -06001248The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing
Patrick Williams975a06f2022-10-21 14:42:47 -05001249build information to the target filesystem at ``${sysconfdir}/buildinfo``
Patrick Williams7784c422022-11-17 07:29:11 -06001250by default (as specified by :term:`IMAGE_BUILDINFO_FILE`).
Patrick Williams975a06f2022-10-21 14:42:47 -05001251This can be useful for manually determining the origin of any given
1252image. It writes out two sections:
1253
Andrew Geissler517393d2023-01-13 08:55:19 -06001254#. `Build Configuration`: a list of variables and their values (specified
Patrick Williams975a06f2022-10-21 14:42:47 -05001255 by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and
1256 :term:`DISTRO_VERSION`)
1257
Andrew Geissler517393d2023-01-13 08:55:19 -06001258#. `Layer Revisions`: the revisions of all of the layers used in the
Patrick Williams975a06f2022-10-21 14:42:47 -05001259 build.
1260
1261Additionally, when building an SDK it will write the same contents
1262to ``/buildinfo`` by default (as specified by
1263:term:`SDK_BUILDINFO_FILE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001264
1265.. _ref-classes-image_types:
1266
Andrew Geissler517393d2023-01-13 08:55:19 -06001267``image_types``
1268===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001269
Andrew Geissler517393d2023-01-13 08:55:19 -06001270The :ref:`ref-classes-image_types` class defines all of the standard image output types
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001271that you can enable through the
1272:term:`IMAGE_FSTYPES` variable. You can use this
1273class as a reference on how to add support for custom image output
1274types.
1275
Andrew Geissler517393d2023-01-13 08:55:19 -06001276By default, the :ref:`ref-classes-image` class automatically
1277enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001278``IMGCLASSES`` variable as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001279
1280 IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
Patrick Williams03514f12024-04-05 07:04:11 -05001281 # Only Linux SDKs support populate_sdk_ext, fall back to populate_sdk_base
1282 # in the non-Linux SDK_OS case, such as mingw32
1283 inherit populate_sdk_base
1284 IMGCLASSES += "${@['', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001285 IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
1286 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
1287 IMGCLASSES += "image_types_wic"
1288 IMGCLASSES += "rootfs-postcommands"
1289 IMGCLASSES += "image-postinst-intercepts"
Patrick Williams03514f12024-04-05 07:04:11 -05001290 IMGCLASSES += "overlayfs-etc"
1291 inherit_defer ${IMGCLASSES}
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001292
Andrew Geissler517393d2023-01-13 08:55:19 -06001293The :ref:`ref-classes-image_types` class also handles conversion and compression of images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001294
1295.. note::
1296
1297 To build a VMware VMDK image, you need to add "wic.vmdk" to
Andrew Geissler09036742021-06-25 14:25:14 -05001298 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001299 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001300
1301.. _ref-classes-image-live:
1302
Andrew Geissler517393d2023-01-13 08:55:19 -06001303``image-live``
1304==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001305
1306This class controls building "live" (i.e. HDDIMG and ISO) images. Live
1307images contain syslinux for legacy booting, as well as the bootloader
1308specified by :term:`EFI_PROVIDER` if
1309:term:`MACHINE_FEATURES` contains "efi".
1310
1311Normally, you do not use this class directly. Instead, you add "live" to
1312:term:`IMAGE_FSTYPES`.
1313
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001314.. _ref-classes-insane:
1315
Andrew Geissler517393d2023-01-13 08:55:19 -06001316``insane``
1317==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001318
Andrew Geissler517393d2023-01-13 08:55:19 -06001319The :ref:`ref-classes-insane` class adds a step to the package generation process so
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001320that output quality assurance checks are generated by the OpenEmbedded
1321build system. A range of checks are performed that check the build's
1322output for common problems that show up during runtime. Distribution
1323policy usually dictates whether to include this class.
1324
1325You can configure the sanity checks so that specific test failures
1326either raise a warning or an error message. Typically, failures for new
1327tests generate a warning. Subsequent failures for the same test would
1328then generate an error message once the metadata is in a known and good
Andrew Geissler09209ee2020-12-13 08:44:15 -06001329condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001330and error messages you might encounter using a default configuration.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001331
1332Use the :term:`WARN_QA` and
1333:term:`ERROR_QA` variables to control the behavior of
1334these checks at the global level (i.e. in your custom distro
1335configuration). However, to skip one or more checks in recipes, you
1336should use :term:`INSANE_SKIP`. For example, to skip
1337the check for symbolic link ``.so`` files in the main package of a
1338recipe, add the following to the recipe. You need to realize that the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001339package name override, in this example ``${PN}``, must be used::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001340
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001341 INSANE_SKIP:${PN} += "dev-so"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001342
1343Please keep in mind that the QA checks
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001344are meant to detect real or potential problems in the packaged
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001345output. So exercise caution when disabling these checks.
1346
Patrick Williams39653562024-03-01 08:54:02 -06001347The tests you can list with the :term:`WARN_QA` and
1348:term:`ERROR_QA` variables are:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001349
1350- ``already-stripped:`` Checks that produced binaries have not
1351 already been stripped prior to the build system extracting debug
1352 symbols. It is common for upstream software projects to default to
1353 stripping debug symbols for output binaries. In order for debugging
1354 to work on the target using ``-dbg`` packages, this stripping must be
1355 disabled.
1356
1357- ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1358 size, and endianness of any binaries to ensure they match the target
1359 architecture. This test fails if any binaries do not match the type
1360 since there would be an incompatibility. The test could indicate that
1361 the wrong compiler or compiler options have been used. Sometimes
1362 software, like bootloaders, might need to bypass this check.
1363
1364- ``buildpaths:`` Checks for paths to locations on the build host
Patrick Williams975a06f2022-10-21 14:42:47 -05001365 inside the output files. Not only can these leak information about
1366 the build environment, they also hinder binary reproducibility.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001367
1368- ``build-deps:`` Determines if a build-time dependency that is
1369 specified through :term:`DEPENDS`, explicit
1370 :term:`RDEPENDS`, or task-level dependencies exists
1371 to match any runtime dependency. This determination is particularly
1372 useful to discover where runtime dependencies are detected and added
1373 during packaging. If no explicit dependency has been specified within
1374 the metadata, at the packaging stage it is too late to ensure that
1375 the dependency is built, and thus you can end up with an error when
1376 the package is installed into the image during the
1377 :ref:`ref-tasks-rootfs` task because the auto-detected
1378 dependency was not satisfied. An example of this would be where the
Andrew Geissler517393d2023-01-13 08:55:19 -06001379 :ref:`ref-classes-update-rc.d` class automatically
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001380 adds a dependency on the ``initscripts-functions`` package to
1381 packages that install an initscript that refers to
1382 ``/etc/init.d/functions``. The recipe should really have an explicit
Andrew Geissler5f350902021-07-23 13:09:54 -04001383 :term:`RDEPENDS` for the package in question on ``initscripts-functions``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001384 so that the OpenEmbedded build system is able to ensure that the
1385 ``initscripts`` recipe is actually built and thus the
1386 ``initscripts-functions`` package is made available.
1387
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001388- ``configure-gettext:`` Checks that if a recipe is building something
1389 that uses automake and the automake files contain an ``AM_GNU_GETTEXT``
1390 directive, that the recipe also inherits the :ref:`ref-classes-gettext`
1391 class to ensure that gettext is available during the build.
1392
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001393- ``compile-host-path:`` Checks the
1394 :ref:`ref-tasks-compile` log for indications that
1395 paths to locations on the build host were used. Using such paths
1396 might result in host contamination of the build output.
1397
Patrick Williamsb58112e2024-03-07 11:16:36 -06001398- ``cve_status_not_in_db:`` Checks for each component if CVEs that are ignored
1399 via :term:`CVE_STATUS`, that those are (still) reported for this component
1400 in the NIST database. If not, a warning is printed. This check is disabled
1401 by default.
1402
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001403- ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1404 do not depend on ``-dbg`` packages, which would cause a packaging
1405 bug.
1406
1407- ``debug-files:`` Checks for ``.debug`` directories in anything but
1408 the ``-dbg`` package. The debug files should all be in the ``-dbg``
1409 package. Thus, anything packaged elsewhere is incorrect packaging.
1410
1411- ``dep-cmp:`` Checks for invalid version comparison statements in
1412 runtime dependency relationships between packages (i.e. in
1413 :term:`RDEPENDS`,
1414 :term:`RRECOMMENDS`,
1415 :term:`RSUGGESTS`,
1416 :term:`RPROVIDES`,
1417 :term:`RREPLACES`, and
1418 :term:`RCONFLICTS` variable values). Any invalid
1419 comparisons might trigger failures or undesirable behavior when
1420 passed to the package manager.
1421
1422- ``desktop:`` Runs the ``desktop-file-validate`` program against any
1423 ``.desktop`` files to validate their contents against the
1424 specification for ``.desktop`` files.
1425
1426- ``dev-deps:`` Checks that all packages except ``-dev`` or
1427 ``-staticdev`` packages do not depend on ``-dev`` packages, which
1428 would be a packaging bug.
1429
1430- ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1431 ``-dev`` package and not in any of the other packages. In general,
1432 these symlinks are only useful for development purposes. Thus, the
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001433 ``-dev`` package is the correct location for them. In very rare
1434 cases, such as dynamically loaded modules, these symlinks
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001435 are needed instead in the main package.
1436
Patrick Williams03907ee2022-05-01 06:28:52 -05001437- ``empty-dirs:`` Checks that packages are not installing files to
1438 directories that are normally expected to be empty (such as ``/tmp``)
1439 The list of directories that are checked is specified by the
1440 :term:`QA_EMPTY_DIRS` variable.
1441
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001442- ``file-rdeps:`` Checks that file-level dependencies identified by
1443 the OpenEmbedded build system at packaging time are satisfied. For
1444 example, a shell script might start with the line ``#!/bin/bash``.
1445 This line would translate to a file dependency on ``/bin/bash``. Of
1446 the three package managers that the OpenEmbedded build system
1447 supports, only RPM directly handles file-level dependencies,
1448 resolving them automatically to packages providing the files.
1449 However, the lack of that functionality in the other two package
1450 managers does not mean the dependencies do not still need resolving.
1451 This QA check attempts to ensure that explicitly declared
1452 :term:`RDEPENDS` exist to handle any file-level
1453 dependency detected in packaged files.
1454
1455- ``files-invalid:`` Checks for :term:`FILES` variable
1456 values that contain "//", which is invalid.
1457
1458- ``host-user-contaminated:`` Checks that no package produced by the
1459 recipe contains any files outside of ``/home`` with a user or group
1460 ID that matches the user running BitBake. A match usually indicates
1461 that the files are being installed with an incorrect UID/GID, since
1462 target IDs are independent from host IDs. For additional information,
1463 see the section describing the
1464 :ref:`ref-tasks-install` task.
1465
1466- ``incompatible-license:`` Report when packages are excluded from
1467 being created due to being marked with a license that is in
1468 :term:`INCOMPATIBLE_LICENSE`.
1469
1470- ``install-host-path:`` Checks the
1471 :ref:`ref-tasks-install` log for indications that
1472 paths to locations on the build host were used. Using such paths
1473 might result in host contamination of the build output.
1474
1475- ``installed-vs-shipped:`` Reports when files have been installed
Patrick Williams2194f502022-10-16 14:26:09 -05001476 within :ref:`ref-tasks-install` but have not been included in any package by
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001477 way of the :term:`FILES` variable. Files that do not
1478 appear in any package cannot be present in an image later on in the
1479 build process. Ideally, all installed files should be packaged or not
1480 installed at all. These files can be deleted at the end of
Patrick Williams2194f502022-10-16 14:26:09 -05001481 :ref:`ref-tasks-install` if the files are not needed in any package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001482
1483- ``invalid-chars:`` Checks that the recipe metadata variables
1484 :term:`DESCRIPTION`,
1485 :term:`SUMMARY`, :term:`LICENSE`, and
1486 :term:`SECTION` do not contain non-UTF-8 characters.
1487 Some package managers do not support such characters.
1488
1489- ``invalid-packageconfig:`` Checks that no undefined features are
1490 being added to :term:`PACKAGECONFIG`. For
Andrew Geisslerc926e172021-05-07 16:11:35 -05001491 example, any name "foo" for which the following form does not exist::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001492
1493 PACKAGECONFIG[foo] = "..."
1494
Andrew Geissler09036742021-06-25 14:25:14 -05001495- ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001496 file containing these paths is incorrect since ``libtool`` adds the
1497 correct sysroot prefix when using the files automatically itself.
1498
1499- ``ldflags:`` Ensures that the binaries were linked with the
1500 :term:`LDFLAGS` options provided by the build system.
Andrew Geissler09036742021-06-25 14:25:14 -05001501 If this test fails, check that the :term:`LDFLAGS` variable is being
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001502 passed to the linker command.
1503
1504- ``libdir:`` Checks for libraries being installed into incorrect
1505 (possibly hardcoded) installation paths. For example, this test will
1506 catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1507 "lib32". Another example is when recipes install
1508 ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1509
1510- ``libexec:`` Checks if a package contains files in
1511 ``/usr/libexec``. This check is not performed if the ``libexecdir``
1512 variable has been set explicitly to ``/usr/libexec``.
1513
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001514- ``mime:`` Check that if a package contains mime type files (``.xml``
1515 files in ``${datadir}/mime/packages``) that the recipe also inherits
1516 the :ref:`ref-classes-mime` class in order to ensure that these get
1517 properly installed.
1518
1519- ``mime-xdg:`` Checks that if a package contains a .desktop file with a
1520 'MimeType' key present, that the recipe inherits the
1521 :ref:`ref-classes-mime-xdg` class that is required in order for that
1522 to be activated.
1523
1524- ``missing-update-alternatives:`` Check that if a recipe sets the
1525 :term:`ALTERNATIVE` variable that the recipe also inherits
1526 :ref:`ref-classes-update-alternatives` such that the alternative will
1527 be correctly set up.
1528
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001529- ``packages-list:`` Checks for the same package being listed
1530 multiple times through the :term:`PACKAGES` variable
1531 value. Installing the package in this manner can cause errors during
1532 packaging.
1533
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001534- ``patch-fuzz:`` Checks for fuzz in patch files that may allow
1535 them to apply incorrectly if the underlying code changes.
1536
Patrick Williams84603582024-12-14 08:00:57 -05001537- ``patch-status:`` Checks that the ``Upstream-Status`` is specified and valid
1538 in the headers of patches for recipes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001539
Patrick Williams84603582024-12-14 08:00:57 -05001540- ``pep517-backend:`` checks that a recipe inheriting
1541 :ref:`ref-classes-setuptools3` has a PEP517-compliant backend.
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001542
1543- ``perllocalpod:`` Checks for ``perllocal.pod`` being erroneously
1544 installed and packaged by a recipe.
1545
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001546- ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1547 invalid format.
1548
1549- ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1550 invalid format.
1551
1552- ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1553 'link' where the specified target already exists.
1554
1555- ``perms:`` Currently, this check is unused but reserved.
1556
1557- ``pkgconfig:`` Checks ``.pc`` files for any
1558 :term:`TMPDIR`/:term:`WORKDIR` paths.
1559 Any ``.pc`` file containing these paths is incorrect since
1560 ``pkg-config`` itself adds the correct sysroot prefix when the files
1561 are accessed.
1562
1563- ``pkgname:`` Checks that all packages in
1564 :term:`PACKAGES` have names that do not contain
1565 invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1566 -).
1567
Andrew Geissler09036742021-06-25 14:25:14 -05001568- ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001569 undefined during :ref:`ref-tasks-package`.
1570
1571- ``pkgvarcheck:`` Checks through the variables
1572 :term:`RDEPENDS`,
1573 :term:`RRECOMMENDS`,
1574 :term:`RSUGGESTS`,
1575 :term:`RCONFLICTS`,
1576 :term:`RPROVIDES`,
1577 :term:`RREPLACES`, :term:`FILES`,
1578 :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1579 ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1580 there are variable sets that are not package-specific. Using these
1581 variables without a package suffix is bad practice, and might
1582 unnecessarily complicate dependencies of other packages within the
1583 same recipe or have other unintended consequences.
1584
1585- ``pn-overrides:`` Checks that a recipe does not have a name
1586 (:term:`PN`) value that appears in
1587 :term:`OVERRIDES`. If a recipe is named such that
Andrew Geissler09036742021-06-25 14:25:14 -05001588 its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
1589 :term:`PN` happens to be the same as :term:`MACHINE` or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001590 :term:`DISTRO`), it can have unexpected consequences.
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001591 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001592 turn into ``FILES = "xyz"``.
1593
1594- ``rpaths:`` Checks for rpaths in the binaries that contain build
Andrew Geissler5f350902021-07-23 13:09:54 -04001595 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001596 options are being passed to the linker commands and your binaries
1597 have potential security issues.
1598
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001599- ``shebang-size:`` Check that the shebang line (``#!`` in the first line)
1600 in a packaged script is not longer than 128 characters, which can cause
1601 an error at runtime depending on the operating system.
1602
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001603- ``split-strip:`` Reports that splitting or stripping debug symbols
1604 from binaries has failed.
1605
1606- ``staticdev:`` Checks for static library files (``*.a``) in
1607 non-``staticdev`` packages.
1608
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001609- ``src-uri-bad:`` Checks that the :term:`SRC_URI` value set by a recipe
1610 does not contain a reference to ``${PN}`` (instead of the correct
1611 ``${BPN}``) nor refers to unstable Github archive tarballs.
1612
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001613- ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1614 into :term:`TMPDIR` on the host. Such symlinks will
1615 work on the host, but are clearly invalid when running on the target.
1616
1617- ``textrel:`` Checks for ELF binaries that contain relocations in
1618 their ``.text`` sections, which can result in a performance impact at
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001619 runtime. See the explanation for the ``ELF binary`` message in
Andrew Geissler09209ee2020-12-13 08:44:15 -06001620 ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001621 issues.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001622
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001623- ``unhandled-features-check:`` check that if one of the variables that
1624 the :ref:`ref-classes-features_check` class supports (e.g.
Patrick Williamsb542dec2023-06-09 01:26:37 -05001625 :term:`REQUIRED_DISTRO_FEATURES`) is set by a recipe, then the recipe
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001626 also inherits :ref:`ref-classes-features_check` in order for the
1627 requirement to actually work.
1628
Patrick Williamsac13d5f2023-11-24 18:59:46 -06001629- ``unimplemented-ptest:`` Checks that ptests are implemented for upstream
1630 tests.
1631
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001632- ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1633 for a package are also declared on the recipe level (i.e. any license
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001634 in ``LICENSE:*`` should appear in :term:`LICENSE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001635
1636- ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1637 in the binaries that by default on a standard system are searched by
1638 the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1639 not cause any breakage, they do waste space and are unnecessary.
1640
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001641- ``usrmerge:`` If ``usrmerge`` is in :term:`DISTRO_FEATURES`, this
1642 check will ensure that no package installs files to root (``/bin``,
1643 ``/sbin``, ``/lib``, ``/lib64``) directories.
1644
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001645- ``var-undefined:`` Reports when variables fundamental to packaging
1646 (i.e. :term:`WORKDIR`,
1647 :term:`DEPLOY_DIR`, :term:`D`,
1648 :term:`PN`, and :term:`PKGD`) are undefined
1649 during :ref:`ref-tasks-package`.
1650
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001651- ``version-going-backwards:`` If the :ref:`ref-classes-buildhistory`
1652 class is enabled, reports when a package being written out has a lower
1653 version than the previously written package under the same name. If
1654 you are placing output packages into a feed and upgrading packages on
1655 a target system using that feed, the version of a package going
1656 backwards can result in the target system not correctly upgrading to
1657 the "new" version of the package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001658
1659 .. note::
1660
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001661 This is only relevant when you are using runtime package management
1662 on your target system.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001663
Patrick Williams2f814a62024-04-16 16:28:03 -05001664- ``virtual-slash:`` Checks to see if ``virtual/`` is being used in
1665 :term:`RDEPENDS` or :term:`RPROVIDES`, which is not good practice ---
1666 ``virtual/`` is a convention intended for use in the build context
1667 (i.e. :term:`PROVIDES` and :term:`DEPENDS`) rather than the runtime
1668 context.
1669
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001670- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1671 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1672 driver ABI names. All drivers should depend on the ABI versions that
1673 they have been built against. Driver recipes that include
1674 ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1675 automatically get these versions. Consequently, you should only need
1676 to explicitly add dependencies to binary driver recipes.
1677
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001678.. _ref-classes-kernel:
1679
Andrew Geissler517393d2023-01-13 08:55:19 -06001680``kernel``
1681==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001682
Andrew Geissler517393d2023-01-13 08:55:19 -06001683The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001684code to build all kernel trees. All needed headers are staged into the
Andrew Geissler5f350902021-07-23 13:09:54 -04001685:term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
Andrew Geissler517393d2023-01-13 08:55:19 -06001686using the :ref:`ref-classes-module` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001687
Andrew Geissler3eeda902023-05-19 10:14:02 -05001688If a file named ``defconfig`` is listed in :term:`SRC_URI`, then by default
1689:ref:`ref-tasks-configure` copies it as ``.config`` in the build directory,
1690so it is automatically used as the kernel configuration for the build. This
1691copy is not performed in case ``.config`` already exists there: this allows
1692recipes to produce a configuration by other means in
1693``do_configure:prepend``.
1694
1695Each built kernel module is packaged separately and inter-module
1696dependencies are created by parsing the ``modinfo`` output. If all modules
1697are required, then installing the ``kernel-modules`` package installs all
1698packages with modules and various other kernel packages such as
1699``kernel-vmlinux``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001700
Andrew Geissler517393d2023-01-13 08:55:19 -06001701The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial
Patrick Williams2194f502022-10-16 14:26:09 -05001702RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
1703information on how to build an :term:`Initramfs`, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001704":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001705the Yocto Project Development Tasks Manual.
1706
Andrew Geissler517393d2023-01-13 08:55:19 -06001707Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes
1708internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and
1709:ref:`ref-classes-linux-kernel-base` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001710
1711.. _ref-classes-kernel-arch:
1712
Andrew Geissler517393d2023-01-13 08:55:19 -06001713``kernel-arch``
1714===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001715
Andrew Geissler517393d2023-01-13 08:55:19 -06001716The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001717Linux kernel compilation (including modules).
1718
1719.. _ref-classes-kernel-devicetree:
1720
Andrew Geissler517393d2023-01-13 08:55:19 -06001721``kernel-devicetree``
1722=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001723
Andrew Geissler517393d2023-01-13 08:55:19 -06001724The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the
1725:ref:`ref-classes-kernel` class, supports device tree generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001726
Patrick Williamsb542dec2023-06-09 01:26:37 -05001727Its behavior is mainly controlled by the following variables:
1728
1729- :term:`KERNEL_DEVICETREE_BUNDLE`: whether to bundle the kernel and device tree
1730- :term:`KERNEL_DTBDEST`: directory where to install DTB files
1731- :term:`KERNEL_DTBVENDORED`: whether to keep vendor subdirectories
1732- :term:`KERNEL_DTC_FLAGS`: flags for ``dtc``, the Device Tree Compiler
1733- :term:`KERNEL_PACKAGE_NAME`: base name of the kernel packages
1734
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001735.. _ref-classes-kernel-fitimage:
1736
Andrew Geissler517393d2023-01-13 08:55:19 -06001737``kernel-fitimage``
1738===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001739
Andrew Geissler517393d2023-01-13 08:55:19 -06001740The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image,
Patrick Williamsb542dec2023-06-09 01:26:37 -05001741device trees, a U-boot script, an :term:`Initramfs` bundle and a RAM disk
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001742into a single FIT image. In theory, a FIT image can support any number
Andrew Geissler517393d2023-01-13 08:55:19 -06001743of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees.
1744However, :ref:`ref-classes-kernel-fitimage` currently only supports
Patrick Williams975a06f2022-10-21 14:42:47 -05001745limited usecases: just one kernel image, an optional U-boot script,
Andrew Geissler517393d2023-01-13 08:55:19 -06001746an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of
Patrick Williamsb542dec2023-06-09 01:26:37 -05001747device trees.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001748
1749To create a FIT image, it is required that :term:`KERNEL_CLASSES`
Patrick Williams2a254922023-08-11 09:48:11 -05001750is set to include ":ref:`ref-classes-kernel-fitimage`" and one of :term:`KERNEL_IMAGETYPE`,
1751:term:`KERNEL_ALT_IMAGETYPE` or :term:`KERNEL_IMAGETYPES` to include "fitImage".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001752
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001753The options for the device tree compiler passed to ``mkimage -D``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001754when creating the FIT image are specified using the
1755:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1756
1757Only a single kernel can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001758:ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001759address where the kernel image is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001760specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
Andrew Geissler3eeda902023-05-19 10:14:02 -05001761:term:`UBOOT_ENTRYPOINT`. Setting :term:`FIT_ADDRESS_CELLS` to "2"
1762is necessary if such addresses are 64 bit ones.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001763
1764Multiple device trees can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001765:ref:`ref-classes-kernel-fitimage` and the device tree is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001766The address where the device tree is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001767specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001768and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001769
1770Only a single RAM disk can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001771:ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001772The address where the RAM disk image is to be loaded by U-Boot
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001773is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
Patrick Williams2a254922023-08-11 09:48:11 -05001774:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to the FIT image when
1775:term:`INITRAMFS_IMAGE` is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE`
1776is not set to 1.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001777
Andrew Geissler517393d2023-01-13 08:55:19 -06001778Only a single :term:`Initramfs` bundle can be added to the FIT image created by
1779:ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional.
1780In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001781in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
Andrew Geissler517393d2023-01-13 08:55:19 -06001782When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem.
1783The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE`
Patrick Williams2a254922023-08-11 09:48:11 -05001784is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
Andrew Geissler517393d2023-01-13 08:55:19 -06001785The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001786by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1787
1788Only a single U-boot boot script can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001789:ref:`ref-classes-kernel-fitimage` and the boot script is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001790The boot script is specified in the ITS file as a text file containing
1791U-boot commands. When using a boot script the user should configure the
Patrick Williams2194f502022-10-16 14:26:09 -05001792U-boot :ref:`ref-tasks-install` task to copy the script to sysroot.
Andrew Geissler517393d2023-01-13 08:55:19 -06001793So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001794class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
Patrick Williams2a254922023-08-11 09:48:11 -05001795load the boot script from the FIT image and execute it.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001796
Patrick Williams2a254922023-08-11 09:48:11 -05001797The FIT image generated by the :ref:`ref-classes-kernel-fitimage` class is signed when the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001798variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1799:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1800appropriately. The default values used for :term:`FIT_HASH_ALG` and
Andrew Geissler517393d2023-01-13 08:55:19 -06001801:term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and
Patrick Williams2a254922023-08-11 09:48:11 -05001802"rsa2048" respectively. The keys for signing the FIT image can be generated using
Andrew Geissler517393d2023-01-13 08:55:19 -06001803the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001804:term:`UBOOT_SIGN_ENABLE` are set to "1".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001805
1806
1807.. _ref-classes-kernel-grub:
1808
Andrew Geissler517393d2023-01-13 08:55:19 -06001809``kernel-grub``
1810===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001811
Andrew Geissler517393d2023-01-13 08:55:19 -06001812The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001813the kernel as the priority boot mechanism while installing a RPM to
1814update the kernel on a deployed target.
1815
1816.. _ref-classes-kernel-module-split:
1817
Andrew Geissler517393d2023-01-13 08:55:19 -06001818``kernel-module-split``
1819=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001820
Andrew Geissler517393d2023-01-13 08:55:19 -06001821The :ref:`ref-classes-kernel-module-split` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001822splitting Linux kernel modules into separate packages.
1823
1824.. _ref-classes-kernel-uboot:
1825
Andrew Geissler517393d2023-01-13 08:55:19 -06001826``kernel-uboot``
1827================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001828
Andrew Geissler517393d2023-01-13 08:55:19 -06001829The :ref:`ref-classes-kernel-uboot` class provides support for building from
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001830vmlinux-style kernel sources.
1831
1832.. _ref-classes-kernel-uimage:
1833
Andrew Geissler517393d2023-01-13 08:55:19 -06001834``kernel-uimage``
1835=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001836
Andrew Geissler517393d2023-01-13 08:55:19 -06001837The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001838
1839.. _ref-classes-kernel-yocto:
1840
Andrew Geissler517393d2023-01-13 08:55:19 -06001841``kernel-yocto``
1842================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001843
Andrew Geissler517393d2023-01-13 08:55:19 -06001844The :ref:`ref-classes-kernel-yocto` class provides common functionality for building
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001845from linux-yocto style kernel source repositories.
1846
1847.. _ref-classes-kernelsrc:
1848
Andrew Geissler517393d2023-01-13 08:55:19 -06001849``kernelsrc``
1850=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001851
Andrew Geissler517393d2023-01-13 08:55:19 -06001852The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001853
1854.. _ref-classes-lib_package:
1855
Andrew Geissler517393d2023-01-13 08:55:19 -06001856``lib_package``
1857===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001858
Andrew Geissler517393d2023-01-13 08:55:19 -06001859The :ref:`ref-classes-lib_package` class supports recipes that build libraries and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001860produce executable binaries, where those binaries should not be
1861installed by default along with the library. Instead, the binaries are
1862added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1863make their installation optional.
1864
1865.. _ref-classes-libc*:
1866
Andrew Geissler517393d2023-01-13 08:55:19 -06001867``libc*``
1868=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001869
Andrew Geissler517393d2023-01-13 08:55:19 -06001870The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001871
Patrick Williams2390b1b2022-11-03 13:47:49 -05001872- The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001873 ``libc``.
1874
Patrick Williams2390b1b2022-11-03 13:47:49 -05001875- The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001876 ``eglibc``.
1877
1878.. _ref-classes-license:
1879
Andrew Geissler517393d2023-01-13 08:55:19 -06001880``license``
1881===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001882
Andrew Geissler517393d2023-01-13 08:55:19 -06001883The :ref:`ref-classes-license` class provides license manifest creation and license
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001884exclusion. This class is enabled by default using the default value for
1885the :term:`INHERIT_DISTRO` variable.
1886
1887.. _ref-classes-linux-kernel-base:
1888
Andrew Geissler517393d2023-01-13 08:55:19 -06001889``linux-kernel-base``
1890=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001891
Andrew Geissler517393d2023-01-13 08:55:19 -06001892The :ref:`ref-classes-linux-kernel-base` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001893recipes that build out of the Linux kernel source tree. These builds
1894goes beyond the kernel itself. For example, the Perf recipe also
1895inherits this class.
1896
1897.. _ref-classes-linuxloader:
1898
Andrew Geissler517393d2023-01-13 08:55:19 -06001899``linuxloader``
1900===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001901
1902Provides the function ``linuxloader()``, which gives the value of the
1903dynamic loader/linker provided on the platform. This value is used by a
1904number of other classes.
1905
1906.. _ref-classes-logging:
1907
Andrew Geissler517393d2023-01-13 08:55:19 -06001908``logging``
1909===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001910
Andrew Geissler517393d2023-01-13 08:55:19 -06001911The :ref:`ref-classes-logging` class provides the standard shell functions used to log
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001912messages for various BitBake severity levels (i.e. ``bbplain``,
1913``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1914
Andrew Geissler517393d2023-01-13 08:55:19 -06001915This class is enabled by default since it is inherited by the :ref:`ref-classes-base`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001916class.
1917
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001918.. _ref-classes-meson:
1919
1920``meson``
1921=========
1922
1923The :ref:`ref-classes-meson` class allows to create recipes that build software
Patrick Williamsac13d5f2023-11-24 18:59:46 -06001924using the `Meson <https://mesonbuild.com/>`__ build system. You can use the
1925:term:`MESON_BUILDTYPE`, :term:`MESON_TARGET` and :term:`EXTRA_OEMESON`
1926variables to specify additional configuration options to be passed using the
1927``meson`` command line.
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001928
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001929.. _ref-classes-metadata_scm:
1930
Andrew Geissler517393d2023-01-13 08:55:19 -06001931``metadata_scm``
1932================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001933
Andrew Geissler517393d2023-01-13 08:55:19 -06001934The :ref:`ref-classes-metadata_scm` class provides functionality for querying the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001935branch and revision of a Source Code Manager (SCM) repository.
1936
Andrew Geissler517393d2023-01-13 08:55:19 -06001937The :ref:`ref-classes-base` class uses this class to print the revisions of
1938each layer before starting every build. The :ref:`ref-classes-metadata_scm`
1939class is enabled by default because it is inherited by the
1940:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001941
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001942.. _ref-classes-mime:
1943
Andrew Geissler517393d2023-01-13 08:55:19 -06001944``mime``
1945========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001946
Andrew Geissler517393d2023-01-13 08:55:19 -06001947The :ref:`ref-classes-mime` class generates the proper post-install and post-remove
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001948(postinst/postrm) scriptlets for packages that install MIME type files.
1949These scriptlets call ``update-mime-database`` to add the MIME types to
1950the shared database.
1951
Patrick Williams7784c422022-11-17 07:29:11 -06001952.. _ref-classes-mime-xdg:
1953
Andrew Geissler517393d2023-01-13 08:55:19 -06001954``mime-xdg``
1955============
Patrick Williams7784c422022-11-17 07:29:11 -06001956
Andrew Geissler517393d2023-01-13 08:55:19 -06001957The :ref:`ref-classes-mime-xdg` class generates the proper
Patrick Williams7784c422022-11-17 07:29:11 -06001958post-install and post-remove (postinst/postrm) scriptlets for packages
1959that install ``.desktop`` files containing ``MimeType`` entries.
1960These scriptlets call ``update-desktop-database`` to add the MIME types
1961to the database of MIME types handled by desktop files.
1962
1963Thanks to this class, when users open a file through a file browser
1964on recently created images, they don't have to choose the application
1965to open the file from the pool of all known applications, even the ones
1966that cannot open the selected file.
1967
1968If you have recipes installing their ``.desktop`` files as absolute
1969symbolic links, the detection of such files cannot be done by the current
1970implementation of this class. In this case, you have to add the corresponding
1971package names to the :term:`MIME_XDG_PACKAGES` variable.
1972
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001973.. _ref-classes-mirrors:
1974
Andrew Geissler517393d2023-01-13 08:55:19 -06001975``mirrors``
1976===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001977
Andrew Geissler517393d2023-01-13 08:55:19 -06001978The :ref:`ref-classes-mirrors` class sets up some standard
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001979:term:`MIRRORS` entries for source code mirrors. These
1980mirrors provide a fall-back path in case the upstream source specified
1981in :term:`SRC_URI` within recipes is unavailable.
1982
1983This class is enabled by default since it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06001984:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001985
1986.. _ref-classes-module:
1987
Andrew Geissler517393d2023-01-13 08:55:19 -06001988``module``
1989==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001990
Andrew Geissler517393d2023-01-13 08:55:19 -06001991The :ref:`ref-classes-module` class provides support for building out-of-tree Linux
1992kernel modules. The class inherits the :ref:`ref-classes-module-base` and
1993:ref:`ref-classes-kernel-module-split` classes, and implements the
1994:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001995everything needed to build and package a kernel module.
1996
1997For general information on out-of-tree Linux kernel modules, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001998":ref:`kernel-dev/common:incorporating out-of-tree modules`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001999section in the Yocto Project Linux Kernel Development Manual.
2000
2001.. _ref-classes-module-base:
2002
Andrew Geissler517393d2023-01-13 08:55:19 -06002003``module-base``
2004===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002005
Andrew Geissler517393d2023-01-13 08:55:19 -06002006The :ref:`ref-classes-module-base` class provides the base functionality for
2007building Linux kernel modules. Typically, a recipe that builds software that
2008includes one or more kernel modules and has its own means of building the module
2009inherits this class as opposed to inheriting the :ref:`ref-classes-module`
2010class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002011
2012.. _ref-classes-multilib*:
2013
Andrew Geissler517393d2023-01-13 08:55:19 -06002014``multilib*``
2015=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002016
Andrew Geissler517393d2023-01-13 08:55:19 -06002017The :ref:`ref-classes-multilib*` classes provide support for building libraries with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002018different target optimizations or target architectures and installing
2019them side-by-side in the same image.
2020
2021For more information on using the Multilib feature, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002022":ref:`dev-manual/libraries:combining multiple versions of library files into one image`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002023section in the Yocto Project Development Tasks Manual.
2024
2025.. _ref-classes-native:
2026
Andrew Geissler517393d2023-01-13 08:55:19 -06002027``native``
2028==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002029
Andrew Geissler517393d2023-01-13 08:55:19 -06002030The :ref:`ref-classes-native` class provides common functionality for recipes that
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002031build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
2032or other tools from the build host).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002033
2034You can create a recipe that builds tools that run natively on the host
2035a couple different ways:
2036
Andrew Geissler517393d2023-01-13 08:55:19 -06002037- Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002038 class. If you use this method, you must order the inherit statement
2039 in the recipe after all other inherit statements so that the
Andrew Geissler517393d2023-01-13 08:55:19 -06002040 :ref:`ref-classes-native` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002041
2042 .. note::
2043
2044 When creating a recipe this way, the recipe name must follow this
Andrew Geisslerc926e172021-05-07 16:11:35 -05002045 naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002046
2047 myrecipe-native.bb
2048
2049
2050 Not using this naming convention can lead to subtle problems
2051 caused by existing code that depends on that naming convention.
2052
Andrew Geisslerc926e172021-05-07 16:11:35 -05002053- Create or modify a target recipe that contains the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002054
2055 BBCLASSEXTEND = "native"
2056
2057 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05002058 recipe, use ``:class-native`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002059 specify any functionality specific to the respective native or target
2060 case.
2061
Andrew Geissler517393d2023-01-13 08:55:19 -06002062Although applied differently, the :ref:`ref-classes-native` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002063methods. The advantage of the second method is that you do not need to
2064have two separate recipes (assuming you need both) for native and
2065target. All common parts of the recipe are automatically shared.
2066
2067.. _ref-classes-nativesdk:
2068
Andrew Geissler517393d2023-01-13 08:55:19 -06002069``nativesdk``
2070=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002071
Andrew Geissler517393d2023-01-13 08:55:19 -06002072The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002073wish to build tools to run as part of an SDK (i.e. tools that run on
2074:term:`SDKMACHINE`).
2075
2076You can create a recipe that builds tools that run on the SDK machine a
2077couple different ways:
2078
Andrew Geisslereff27472021-10-29 15:35:00 -05002079- Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -06002080 :ref:`ref-classes-nativesdk` class. If you use this method, you must order the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002081 inherit statement in the recipe after all other inherit statements so
Andrew Geissler517393d2023-01-13 08:55:19 -06002082 that the :ref:`ref-classes-nativesdk` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002083
Andrew Geissler517393d2023-01-13 08:55:19 -06002084- Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002085
2086 BBCLASSEXTEND = "nativesdk"
2087
2088 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05002089 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002090 specify any functionality specific to the respective SDK machine or
2091 target case.
2092
2093.. note::
2094
Andrew Geisslerc926e172021-05-07 16:11:35 -05002095 When creating a recipe, you must follow this naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002096
2097 nativesdk-myrecipe.bb
2098
2099
William A. Kennington IIIac69b482021-06-02 12:28:27 -07002100 Not doing so can lead to subtle problems because there is code that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002101 depends on the naming convention.
2102
Andrew Geissler517393d2023-01-13 08:55:19 -06002103Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002104methods. The advantage of the second method is that you do not need to
2105have two separate recipes (assuming you need both) for the SDK machine
2106and the target. All common parts of the recipe are automatically shared.
2107
2108.. _ref-classes-nopackages:
2109
Andrew Geissler517393d2023-01-13 08:55:19 -06002110``nopackages``
2111==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002112
2113Disables packaging tasks for those recipes and classes where packaging
2114is not needed.
2115
Patrick Williams84603582024-12-14 08:00:57 -05002116.. _ref-classes-nospdx:
2117
2118``nospdx``
2119==========
2120
2121The :ref:`ref-classes-nospdx` allows a recipe to opt out of SPDX
2122generation provided by :ref:`ref-classes-create-spdx`.
2123
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002124.. _ref-classes-npm:
2125
Andrew Geissler517393d2023-01-13 08:55:19 -06002126``npm``
2127=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002128
Patrick Williams7784c422022-11-17 07:29:11 -06002129Provides support for building Node.js software fetched using the
2130:wikipedia:`node package manager (NPM) <Npm_(software)>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002131
2132.. note::
2133
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002134 Currently, recipes inheriting this class must use the ``npm://``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002135 fetcher to have dependencies fetched and packaged automatically.
2136
2137For information on how to create NPM packages, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002138":ref:`dev-manual/packages:creating node package manager (npm) packages`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002139section in the Yocto Project Development Tasks Manual.
2140
2141.. _ref-classes-oelint:
2142
Andrew Geissler517393d2023-01-13 08:55:19 -06002143``oelint``
2144==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002145
Andrew Geissler517393d2023-01-13 08:55:19 -06002146The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002147``meta/classes`` in the :term:`Source Directory`.
2148
William A. Kennington IIIac69b482021-06-02 12:28:27 -07002149There are some classes that could be generally useful in OE-Core but
Andrew Geissler517393d2023-01-13 08:55:19 -06002150are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002151one such example. However, being aware of this class can reduce the
2152proliferation of different versions of similar classes across multiple
2153layers.
2154
Andrew Geissler5199d832021-09-24 16:47:35 -05002155.. _ref-classes-overlayfs:
2156
Andrew Geissler517393d2023-01-13 08:55:19 -06002157``overlayfs``
2158=============
Andrew Geissler5199d832021-09-24 16:47:35 -05002159
Andrew Geissler595f6302022-01-24 19:11:47 +00002160It's often desired in Embedded System design to have a read-only root filesystem.
Andrew Geissler5199d832021-09-24 16:47:35 -05002161But a lot of different applications might want to have read-write access to
2162some parts of a filesystem. It can be especially useful when your update mechanism
Andrew Geissler595f6302022-01-24 19:11:47 +00002163overwrites the whole root filesystem, but you may want your application data to be preserved
Andrew Geissler517393d2023-01-13 08:55:19 -06002164between updates. The :ref:`ref-classes-overlayfs` class provides a way
Andrew Geissler5199d832021-09-24 16:47:35 -05002165to achieve that by means of ``overlayfs`` and at the same time keeping the base
Andrew Geissler595f6302022-01-24 19:11:47 +00002166root filesystem read-only.
Andrew Geissler5199d832021-09-24 16:47:35 -05002167
2168To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
2169layer in your machine configuration. The underlying file system can be anything that
2170is supported by ``overlayfs``. This has to be done in your machine configuration::
2171
2172 OVERLAYFS_MOUNT_POINT[data] = "/data"
2173
2174.. note::
2175
2176 * QA checks fail to catch file existence if you redefine this variable in your recipe!
2177 * Only the existence of the systemd mount unit file is checked, not its contents.
2178 * To get more details on ``overlayfs``, its internals and supported operations, please refer
Patrick Williams2390b1b2022-11-03 13:47:49 -05002179 to the official documentation of the `Linux kernel <https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html>`__.
Andrew Geissler5199d832021-09-24 16:47:35 -05002180
2181The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
2182(e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
2183
2184Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
2185
2186 OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
2187
2188To support several mount points you can use a different variable flag. Assuming we
2189want to have a writable location on the file system, but do not need that the data
Andrew Geissler595f6302022-01-24 19:11:47 +00002190survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
2191file system.
Andrew Geissler5199d832021-09-24 16:47:35 -05002192
2193In your machine configuration::
2194
2195 OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
2196
2197and then in your recipe::
2198
2199 OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
2200
Andrew Geissler595f6302022-01-24 19:11:47 +00002201On a practical note, your application recipe might require multiple
2202overlays to be mounted before running to avoid writing to the underlying
2203file system (which can be forbidden in case of read-only file system)
Andrew Geissler517393d2023-01-13 08:55:19 -06002204To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd``
Andrew Geissler595f6302022-01-24 19:11:47 +00002205helper service for mounting overlays. This helper service is named
2206``${PN}-overlays.service`` and can be depended on in your application recipe
2207(named ``application`` in the following example) ``systemd`` unit by adding
2208to the unit the following::
2209
2210 [Unit]
2211 After=application-overlays.service
2212 Requires=application-overlays.service
2213
Andrew Geissler5199d832021-09-24 16:47:35 -05002214.. note::
2215
2216 The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
Andrew Geissler517393d2023-01-13 08:55:19 -06002217 In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`.
Andrew Geissler595f6302022-01-24 19:11:47 +00002218
2219.. _ref-classes-overlayfs-etc:
2220
Andrew Geissler517393d2023-01-13 08:55:19 -06002221``overlayfs-etc``
2222=================
Andrew Geissler595f6302022-01-24 19:11:47 +00002223
2224In order to have the ``/etc`` directory in overlayfs a special handling at early
2225boot stage is required. The idea is to supply a custom init script that mounts
2226``/etc`` before launching the actual init program, because the latter already
2227requires ``/etc`` to be mounted.
2228
2229Example usage in image recipe::
2230
2231 IMAGE_FEATURES += "overlayfs-etc"
2232
2233.. note::
2234
2235 This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
2236
2237Your machine configuration should define at least the device, mount point, and file system type
2238you are going to use for ``overlayfs``::
2239
2240 OVERLAYFS_ETC_MOUNT_POINT = "/data"
2241 OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
2242 OVERLAYFS_ETC_FSTYPE ?= "ext4"
2243
2244To control more mount options you should consider setting mount options
2245(``defaults`` is used by default)::
2246
2247 OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
2248
2249The class provides two options for ``/sbin/init`` generation:
2250
2251- The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
2252 and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
2253 that you won't need to change any kernel parameters in order to make it work,
2254 but it poses a restriction that package-management can't be used, because updating
2255 the init manager would remove the generated script.
2256
2257- If you wish to keep original init as is, you can set::
2258
2259 OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
2260
2261 Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
2262 kernel parameters manually in your bootloader configuration.
Andrew Geissler5199d832021-09-24 16:47:35 -05002263
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002264.. _ref-classes-own-mirrors:
2265
Andrew Geissler517393d2023-01-13 08:55:19 -06002266``own-mirrors``
2267===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002268
Andrew Geissler517393d2023-01-13 08:55:19 -06002269The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002270:term:`PREMIRRORS` from which to first fetch source
2271before attempting to fetch it from the upstream specified in
2272:term:`SRC_URI` within each recipe.
2273
2274To use this class, inherit it globally and specify
Andrew Geisslerc926e172021-05-07 16:11:35 -05002275:term:`SOURCE_MIRROR_URL`. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002276
2277 INHERIT += "own-mirrors"
2278 SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
2279
2280You can specify only a single URL
Andrew Geissler09036742021-06-25 14:25:14 -05002281in :term:`SOURCE_MIRROR_URL`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002282
2283.. _ref-classes-package:
2284
Andrew Geissler517393d2023-01-13 08:55:19 -06002285``package``
2286===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002287
Andrew Geissler517393d2023-01-13 08:55:19 -06002288The :ref:`ref-classes-package` class supports generating packages from a build's
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002289output. The core generic functionality is in ``package.bbclass``. The
2290code specific to particular package types resides in these
Andrew Geissler517393d2023-01-13 08:55:19 -06002291package-specific classes: :ref:`ref-classes-package_deb`,
Patrick Williams8e7b46e2023-05-01 14:19:06 -05002292:ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002293
2294You can control the list of resulting package formats by using the
Andrew Geissler09036742021-06-25 14:25:14 -05002295:term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002296configuration file, which is located in the :term:`Build Directory`.
Patrick Williams2390b1b2022-11-03 13:47:49 -05002297When defining the variable, you can specify one or more package types.
2298Since images are generated from packages, a packaging class is needed
2299to enable image generation. The first class listed in this variable is
2300used for image generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002301
2302If you take the optional step to set up a repository (package feed) on
2303the development host that can be used by DNF, you can install packages
2304from the feed while you are running the image on the target (i.e.
2305runtime installation of packages). For more information, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002306":ref:`dev-manual/packages:using runtime package management`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002307section in the Yocto Project Development Tasks Manual.
2308
2309The package-specific class you choose can affect build-time performance
2310and has space ramifications. In general, building a package with IPK
2311takes about thirty percent less time as compared to using RPM to build
2312the same or similar package. This comparison takes into account a
2313complete build of the package with all dependencies previously built.
2314The reason for this discrepancy is because the RPM package manager
2315creates and processes more :term:`Metadata` than the IPK package
Andrew Geissler09036742021-06-25 14:25:14 -05002316manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
Andrew Geissler517393d2023-01-13 08:55:19 -06002317":ref:`ref-classes-package_ipk`" if you are building smaller systems.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002318
2319Before making your package manager decision, however, you should
2320consider some further things about using RPM:
2321
2322- RPM starts to provide more abilities than IPK due to the fact that it
2323 processes more Metadata. For example, this information includes
2324 individual file types, file checksum generation and evaluation on
2325 install, sparse file support, conflict detection and resolution for
2326 Multilib systems, ACID style upgrade, and repackaging abilities for
2327 rollbacks.
2328
2329- For smaller systems, the extra space used for the Berkeley Database
2330 and the amount of metadata when using RPM can affect your ability to
2331 perform on-device upgrades.
2332
2333You can find additional information on the effects of the package class
2334at these two Yocto Project mailing list links:
2335
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002336- :yocto_lists:`/pipermail/poky/2011-May/006362.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002337
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002338- :yocto_lists:`/pipermail/poky/2011-May/006363.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002339
2340.. _ref-classes-package_deb:
2341
Andrew Geissler517393d2023-01-13 08:55:19 -06002342``package_deb``
2343===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002344
Andrew Geissler517393d2023-01-13 08:55:19 -06002345The :ref:`ref-classes-package_deb` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002346use the Debian (i.e. ``.deb``) file format. The class ensures the
2347packages are written out in a ``.deb`` file format to the
2348``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
2349
Andrew Geissler517393d2023-01-13 08:55:19 -06002350This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002351is enabled through the :term:`PACKAGE_CLASSES`
2352variable in the ``local.conf`` file.
2353
2354.. _ref-classes-package_ipk:
2355
Andrew Geissler517393d2023-01-13 08:55:19 -06002356``package_ipk``
2357===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002358
Andrew Geissler517393d2023-01-13 08:55:19 -06002359The :ref:`ref-classes-package_ipk` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002360use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
2361are written out in a ``.ipk`` file format to the
2362``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
2363
Andrew Geissler517393d2023-01-13 08:55:19 -06002364This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002365is enabled through the :term:`PACKAGE_CLASSES`
2366variable in the ``local.conf`` file.
2367
2368.. _ref-classes-package_rpm:
2369
Andrew Geissler517393d2023-01-13 08:55:19 -06002370``package_rpm``
2371===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002372
Andrew Geissler517393d2023-01-13 08:55:19 -06002373The :ref:`ref-classes-package_rpm` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002374use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
2375are written out in a ``.rpm`` file format to the
2376``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
2377
Andrew Geissler517393d2023-01-13 08:55:19 -06002378This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002379is enabled through the :term:`PACKAGE_CLASSES`
2380variable in the ``local.conf`` file.
2381
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002382.. _ref-classes-packagedata:
2383
Andrew Geissler517393d2023-01-13 08:55:19 -06002384``packagedata``
2385===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002386
Andrew Geissler517393d2023-01-13 08:55:19 -06002387The :ref:`ref-classes-packagedata` class provides common functionality for reading
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002388``pkgdata`` files found in :term:`PKGDATA_DIR`. These
2389files contain information about each output package produced by the
2390OpenEmbedded build system.
2391
2392This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002393:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002394
2395.. _ref-classes-packagegroup:
2396
Andrew Geissler517393d2023-01-13 08:55:19 -06002397``packagegroup``
2398================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002399
Andrew Geissler517393d2023-01-13 08:55:19 -06002400The :ref:`ref-classes-packagegroup` class sets default values appropriate for package
Andrew Geissler09036742021-06-25 14:25:14 -05002401group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002402so forth). It is highly recommended that all package group recipes
2403inherit this class.
2404
2405For information on how to use this class, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002406":ref:`dev-manual/customizing-images:customizing images using custom package groups`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002407section in the Yocto Project Development Tasks Manual.
2408
2409Previously, this class was called the ``task`` class.
2410
2411.. _ref-classes-patch:
2412
Andrew Geissler517393d2023-01-13 08:55:19 -06002413``patch``
2414=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002415
Andrew Geissler517393d2023-01-13 08:55:19 -06002416The :ref:`ref-classes-patch` class provides all functionality for applying patches
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002417during the :ref:`ref-tasks-patch` task.
2418
2419This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002420:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002421
2422.. _ref-classes-perlnative:
2423
Andrew Geissler517393d2023-01-13 08:55:19 -06002424``perlnative``
2425==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002426
Andrew Geissler517393d2023-01-13 08:55:19 -06002427When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002428native version of Perl built by the build system rather than using the
2429version provided by the build host.
2430
Patrick Williams975a06f2022-10-21 14:42:47 -05002431.. _ref-classes-pypi:
2432
Andrew Geissler517393d2023-01-13 08:55:19 -06002433``pypi``
2434========
Patrick Williams975a06f2022-10-21 14:42:47 -05002435
Andrew Geissler517393d2023-01-13 08:55:19 -06002436The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build
Patrick Williams975a06f2022-10-21 14:42:47 -05002437Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
2438By default it determines the PyPI package name based upon :term:`BPN`
2439(stripping the "python-" or "python3-" prefix off if present), however in
2440some cases you may need to set it manually in the recipe by setting
2441:term:`PYPI_PACKAGE`.
2442
Andrew Geissler517393d2023-01-13 08:55:19 -06002443Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`,
Patrick Williams975a06f2022-10-21 14:42:47 -05002444:term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
2445and :term:`CVE_PRODUCT`.
2446
Patrick Williams45852732022-04-02 08:58:32 -05002447.. _ref-classes-python_flit_core:
2448
Andrew Geissler517393d2023-01-13 08:55:19 -06002449``python_flit_core``
2450====================
Patrick Williams45852732022-04-02 08:58:32 -05002451
Andrew Geissler517393d2023-01-13 08:55:19 -06002452The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare
Patrick Williams45852732022-04-02 08:58:32 -05002453the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2454``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
2455section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2456
2457Python modules built with ``flit_core.buildapi`` are pure Python (no
2458``C`` or ``Rust`` extensions).
2459
Andrew Geissler517393d2023-01-13 08:55:19 -06002460Internally this uses the :ref:`ref-classes-python_pep517` class.
Patrick Williams45852732022-04-02 08:58:32 -05002461
Patrick Williams2f814a62024-04-16 16:28:03 -05002462.. _ref-classes-python_maturin:
2463
2464``python_maturin``
2465==================
2466
2467The :ref:`ref-classes-python_maturin` class provides support for python-maturin, a replacement
2468for setuptools_rust and another "backend" for building Python Wheels.
2469
2470.. _ref-classes-python_mesonpy:
2471
2472``python_mesonpy``
2473==================
2474
2475The :ref:`ref-classes-python_mesonpy` class enables building Python modules which use the
2476meson-python build system.
2477
2478Internally this uses the :ref:`ref-classes-python_pep517` class.
2479
Andrew Geissler9aee5002022-03-30 16:27:02 +00002480.. _ref-classes-python_pep517:
2481
Andrew Geissler517393d2023-01-13 08:55:19 -06002482``python_pep517``
2483=================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002484
Andrew Geissler517393d2023-01-13 08:55:19 -06002485The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary
Patrick Williams45852732022-04-02 08:58:32 -05002486archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
Andrew Geissler9aee5002022-03-30 16:27:02 +00002487
Patrick Williams45852732022-04-02 08:58:32 -05002488Recipes wouldn't inherit this directly, instead typically another class will
Andrew Geissler615f2f12022-07-15 14:00:58 -05002489inherit this and add the relevant native dependencies.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002490
Andrew Geissler517393d2023-01-13 08:55:19 -06002491Examples of classes which do this are :ref:`ref-classes-python_flit_core`,
2492:ref:`ref-classes-python_setuptools_build_meta`, and
2493:ref:`ref-classes-python_poetry_core`.
Patrick Williams45852732022-04-02 08:58:32 -05002494
2495.. _ref-classes-python_poetry_core:
2496
Andrew Geissler517393d2023-01-13 08:55:19 -06002497``python_poetry_core``
2498======================
Patrick Williams45852732022-04-02 08:58:32 -05002499
Andrew Geissler517393d2023-01-13 08:55:19 -06002500The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the
Patrick Williams45852732022-04-02 08:58:32 -05002501`Poetry Core <https://python-poetry.org>`__ build system.
2502
Andrew Geissler517393d2023-01-13 08:55:19 -06002503Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002504
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002505.. _ref-classes-python_pyo3:
2506
2507``python_pyo3``
2508===============
2509
2510The :ref:`ref-classes-python_pyo3` class helps make sure that Python extensions
2511written in Rust and built with `PyO3 <https://pyo3.rs/>`__, properly set up the
2512environment for cross compilation.
2513
2514This class is internal to the :ref:`ref-classes-python-setuptools3_rust` class
2515and is not meant to be used directly in recipes.
2516
2517.. _ref-classes-python-setuptools3_rust:
2518
2519``python-setuptools3_rust``
2520===========================
2521
2522The :ref:`ref-classes-python-setuptools3_rust` class enables building Python
2523extensions implemented in Rust with `PyO3 <https://pyo3.rs/>`__, which allows
2524to compile and distribute Python extensions written in Rust as easily
2525as if they were written in C.
2526
2527This class inherits the :ref:`ref-classes-setuptools3` and
2528:ref:`ref-classes-python_pyo3` classes.
2529
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002530.. _ref-classes-pixbufcache:
2531
Andrew Geissler517393d2023-01-13 08:55:19 -06002532``pixbufcache``
2533===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002534
Andrew Geissler517393d2023-01-13 08:55:19 -06002535The :ref:`ref-classes-pixbufcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002536post-remove (postinst/postrm) scriptlets for packages that install
2537pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
2538call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
2539Since the cache files are architecture-specific, ``update_pixbuf_cache``
2540is run using QEMU if the postinst scriptlets need to be run on the build
2541host during image creation.
2542
2543If the pixbuf loaders being installed are in packages other than the
2544recipe's main package, set
2545:term:`PIXBUF_PACKAGES` to specify the packages
2546containing the loaders.
2547
2548.. _ref-classes-pkgconfig:
2549
Andrew Geissler517393d2023-01-13 08:55:19 -06002550``pkgconfig``
2551=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002552
Andrew Geissler517393d2023-01-13 08:55:19 -06002553The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002554library information by using ``pkg-config``. This class aims to smooth
2555integration of ``pkg-config`` into libraries that use it.
2556
2557During staging, BitBake installs ``pkg-config`` data into the
2558``sysroots/`` directory. By making use of sysroot functionality within
Andrew Geissler517393d2023-01-13 08:55:19 -06002559``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002560files.
2561
2562.. _ref-classes-populate-sdk:
2563
Andrew Geissler517393d2023-01-13 08:55:19 -06002564``populate_sdk``
2565================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002566
Andrew Geissler517393d2023-01-13 08:55:19 -06002567The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002568information on advantages gained when building a cross-development
2569toolchain using the :ref:`ref-tasks-populate_sdk`
Andrew Geissler09209ee2020-12-13 08:44:15 -06002570task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002571section in the Yocto Project Application Development and the Extensible
2572Software Development Kit (eSDK) manual.
2573
2574.. _ref-classes-populate-sdk-*:
2575
Andrew Geissler517393d2023-01-13 08:55:19 -06002576``populate_sdk_*``
2577==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002578
Andrew Geissler517393d2023-01-13 08:55:19 -06002579The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002580following classes:
2581
Patrick Williams2390b1b2022-11-03 13:47:49 -05002582- :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002583 all package managers (i.e. DEB, RPM, and opkg).
2584
Patrick Williams2390b1b2022-11-03 13:47:49 -05002585- :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002586 package manager.
2587
Patrick Williams2390b1b2022-11-03 13:47:49 -05002588- :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002589 package manager.
2590
Patrick Williams2390b1b2022-11-03 13:47:49 -05002591- :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002592 (IPK format) package manager.
2593
Patrick Williams2390b1b2022-11-03 13:47:49 -05002594- :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002595 package managers.
2596
Patrick Williams2390b1b2022-11-03 13:47:49 -05002597The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002598``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2599:term:`IMAGE_PKGTYPE`.
2600
2601The base class ensures all source and destination directories are
2602established and then populates the SDK. After populating the SDK, the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002603:ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002604``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2605contains the cross-compiler and associated tooling, and the target,
2606which contains a target root filesystem that is configured for the SDK
2607usage. These two images reside in :term:`SDK_OUTPUT`,
Andrew Geisslerc926e172021-05-07 16:11:35 -05002608which consists of the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002609
2610 ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2611 ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2612
2613Finally, the base populate SDK class creates the toolchain environment
2614setup script, the tarball of the SDK, and the installer.
2615
Patrick Williams2390b1b2022-11-03 13:47:49 -05002616The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and
2617:ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK.
2618These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002619class.
2620
2621For more information on the cross-development toolchain generation, see
Andrew Geissler09209ee2020-12-13 08:44:15 -06002622the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002623section in the Yocto Project Overview and Concepts Manual. For
2624information on advantages gained when building a cross-development
2625toolchain using the :ref:`ref-tasks-populate_sdk`
2626task, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002627":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002628section in the Yocto Project Application Development and the Extensible
2629Software Development Kit (eSDK) manual.
2630
2631.. _ref-classes-prexport:
2632
Andrew Geissler517393d2023-01-13 08:55:19 -06002633``prexport``
2634============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002635
Andrew Geissler517393d2023-01-13 08:55:19 -06002636The :ref:`ref-classes-prexport` class provides functionality for exporting
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002637:term:`PR` values.
2638
2639.. note::
2640
2641 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002642 when using "``bitbake-prserv-tool export``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002643
2644.. _ref-classes-primport:
2645
Andrew Geissler517393d2023-01-13 08:55:19 -06002646``primport``
2647============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002648
Andrew Geissler517393d2023-01-13 08:55:19 -06002649The :ref:`ref-classes-primport` class provides functionality for importing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002650:term:`PR` values.
2651
2652.. note::
2653
2654 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002655 when using "``bitbake-prserv-tool import``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002656
2657.. _ref-classes-prserv:
2658
Andrew Geissler517393d2023-01-13 08:55:19 -06002659``prserv``
2660==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002661
Andrew Geissler517393d2023-01-13 08:55:19 -06002662The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR
2663service <dev-manual/packages:working with a pr service>` in order to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002664automatically manage the incrementing of the :term:`PR`
2665variable for each recipe.
2666
2667This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002668:ref:`ref-classes-package` class. However, the OpenEmbedded
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002669build system will not enable the functionality of this class unless
2670:term:`PRSERV_HOST` has been set.
2671
2672.. _ref-classes-ptest:
2673
Andrew Geissler517393d2023-01-13 08:55:19 -06002674``ptest``
2675=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002676
Andrew Geissler517393d2023-01-13 08:55:19 -06002677The :ref:`ref-classes-ptest` class provides functionality for packaging and installing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002678runtime tests for recipes that build software that provides these tests.
2679
2680This class is intended to be inherited by individual recipes. However,
2681the class' functionality is largely disabled unless "ptest" appears in
2682:term:`DISTRO_FEATURES`. See the
Patrick Williams96e4b4e2025-02-03 15:49:15 -05002683":ref:`test-manual/ptest:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002684section in the Yocto Project Development Tasks Manual for more information
2685on ptest.
2686
Andrew Geissler5082cc72023-09-11 08:41:39 -04002687.. _ref-classes-ptest-cargo:
2688
2689``ptest-cargo``
2690===============
2691
2692The :ref:`ref-classes-ptest-cargo` class is a class which extends the
2693:ref:`ref-classes-cargo` class and adds ``compile_ptest_cargo`` and
2694``install_ptest_cargo`` steps to respectively build and install
2695test suites defined in the ``Cargo.toml`` file, into a dedicated
2696``-ptest`` package.
2697
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002698.. _ref-classes-ptest-gnome:
2699
Andrew Geissler517393d2023-01-13 08:55:19 -06002700``ptest-gnome``
2701===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002702
2703Enables package tests (ptests) specifically for GNOME packages, which
2704have tests intended to be executed with ``gnome-desktop-testing``.
2705
2706For information on setting up and running ptests, see the
Patrick Williams96e4b4e2025-02-03 15:49:15 -05002707":ref:`test-manual/ptest:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002708section in the Yocto Project Development Tasks Manual.
2709
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002710.. _ref-classes-python3-dir:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002711
Andrew Geissler517393d2023-01-13 08:55:19 -06002712``python3-dir``
2713===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002714
Andrew Geissler517393d2023-01-13 08:55:19 -06002715The :ref:`ref-classes-python3-dir` class provides the base version, location, and site
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002716package location for Python 3.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002717
2718.. _ref-classes-python3native:
2719
Andrew Geissler517393d2023-01-13 08:55:19 -06002720``python3native``
2721=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002722
Andrew Geissler517393d2023-01-13 08:55:19 -06002723The :ref:`ref-classes-python3native` class supports using the native version of Python
Andrew Geisslerc9f78652020-09-18 14:11:35 -050027243 built by the build system rather than support of the version provided
2725by the build host.
2726
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002727.. _ref-classes-python3targetconfig:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002728
Andrew Geissler517393d2023-01-13 08:55:19 -06002729``python3targetconfig``
2730=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002731
Andrew Geissler517393d2023-01-13 08:55:19 -06002732The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050027333 built by the build system rather than support of the version provided
2734by the build host, except that the configuration for the target machine
2735is accessible (such as correct installation directories). This also adds a
2736dependency on target ``python3``, so should only be used where appropriate
2737in order to avoid unnecessarily lengthening builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002738
2739.. _ref-classes-qemu:
2740
Andrew Geissler517393d2023-01-13 08:55:19 -06002741``qemu``
2742========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002743
Andrew Geissler517393d2023-01-13 08:55:19 -06002744The :ref:`ref-classes-qemu` class provides functionality for recipes that either need
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002745QEMU or test for the existence of QEMU. Typically, this class is used to
2746run programs for a target system on the build host using QEMU's
2747application emulation mode.
2748
2749.. _ref-classes-recipe_sanity:
2750
Andrew Geissler517393d2023-01-13 08:55:19 -06002751``recipe_sanity``
2752=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002753
Andrew Geissler517393d2023-01-13 08:55:19 -06002754The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002755recipe prerequisites that might affect the build (e.g. variables that
2756are set or software that is present).
2757
2758.. _ref-classes-relocatable:
2759
Andrew Geissler517393d2023-01-13 08:55:19 -06002760``relocatable``
2761===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002762
Andrew Geissler517393d2023-01-13 08:55:19 -06002763The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002764installed into the sysroot.
2765
Andrew Geissler517393d2023-01-13 08:55:19 -06002766This class makes use of the :ref:`ref-classes-chrpath` class and is used by
2767both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002768
2769.. _ref-classes-remove-libtool:
2770
Andrew Geissler517393d2023-01-13 08:55:19 -06002771``remove-libtool``
2772==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002773
Andrew Geissler517393d2023-01-13 08:55:19 -06002774The :ref:`ref-classes-remove-libtool` class adds a post function to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002775:ref:`ref-tasks-install` task to remove all ``.la`` files
2776installed by ``libtool``. Removing these files results in them being
2777absent from both the sysroot and target packages.
2778
2779If a recipe needs the ``.la`` files to be installed, then the recipe can
Andrew Geisslerc926e172021-05-07 16:11:35 -05002780override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002781
2782 REMOVE_LIBTOOL_LA = "0"
2783
2784.. note::
2785
Andrew Geissler517393d2023-01-13 08:55:19 -06002786 The :ref:`ref-classes-remove-libtool` class is not enabled by default.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002787
2788.. _ref-classes-report-error:
2789
Andrew Geissler517393d2023-01-13 08:55:19 -06002790``report-error``
2791================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002792
Andrew Geissler517393d2023-01-13 08:55:19 -06002793The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting
2794tool <dev-manual/error-reporting-tool:using the error reporting tool>`",
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002795which allows you to submit build error information to a central database.
2796
2797The class collects debug information for recipe, recipe version, task,
2798machine, distro, build system, target system, host distro, branch,
2799commit, and log. From the information, report files using a JSON format
2800are created and stored in
2801``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2802
Patrick Williams84603582024-12-14 08:00:57 -05002803.. _ref-classes-retain:
2804
2805``retain``
2806==========
2807
2808The :ref:`ref-classes-retain` class can be used to create a tarball of the work
2809directory for a recipe when one of its tasks fails, or any other nominated
2810directories. It is useful in cases where the environment in which builds are run
2811is ephemeral or otherwise inaccessible for examination during debugging.
2812
2813To enable, add the following to your configuration::
2814
2815 INHERIT += "retain"
2816
2817The class can be disabled for specific recipes using the :term:`RETAIN_ENABLED`
2818variable.
2819
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002820.. _ref-classes-rm-work:
2821
Andrew Geissler517393d2023-01-13 08:55:19 -06002822``rm_work``
2823===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002824
Andrew Geissler517393d2023-01-13 08:55:19 -06002825The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002826can ease your hard drive demands during builds.
2827
2828The OpenEmbedded build system can use a substantial amount of disk space
2829during the build process. A portion of this space is the work files
2830under the ``${TMPDIR}/work`` directory for each recipe. Once the build
2831system generates the packages for a recipe, the work files for that
2832recipe are no longer needed. However, by default, the build system
2833preserves these files for inspection and possible debugging purposes. If
Andrew Geissler517393d2023-01-13 08:55:19 -06002834you would rather have these files deleted to save disk space as the build
2835progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to
Patrick Williams2390b1b2022-11-03 13:47:49 -05002836your ``local.conf`` file, which is found in the :term:`Build Directory`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002837
2838 INHERIT += "rm_work"
2839
Andrew Geissler517393d2023-01-13 08:55:19 -06002840If you are modifying and building source code out of the work directory for a
2841recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your
2842changes to the source being lost. To exclude some recipes from having their work
2843directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the
2844recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable,
2845which can also be set in your ``local.conf`` file. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002846
2847 RM_WORK_EXCLUDE += "busybox glibc"
2848
2849.. _ref-classes-rootfs*:
2850
Andrew Geissler517393d2023-01-13 08:55:19 -06002851``rootfs*``
2852===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002853
Andrew Geissler517393d2023-01-13 08:55:19 -06002854The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002855image and consist of the following classes:
2856
Patrick Williams2390b1b2022-11-03 13:47:49 -05002857- The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002858 post-processing functions for image recipes.
2859
Patrick Williams2390b1b2022-11-03 13:47:49 -05002860- The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002861 for images built using ``.deb`` packages.
2862
Patrick Williams2390b1b2022-11-03 13:47:49 -05002863- The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002864 for images built using ``.rpm`` packages.
2865
Patrick Williams2390b1b2022-11-03 13:47:49 -05002866- The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002867 for images built using ``.ipk`` packages.
2868
Patrick Williams2390b1b2022-11-03 13:47:49 -05002869- The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002870 on the build host directly into the root filesystem.
2871
2872The root filesystem is created from packages using one of the
Andrew Geissler517393d2023-01-13 08:55:19 -06002873:ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES`
2874variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002875
2876For information on how root filesystem images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002877":ref:`overview-manual/concepts:image generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002878section in the Yocto Project Overview and Concepts Manual.
2879
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002880.. _ref-classes-rust:
2881
2882``rust``
2883========
2884
2885The :ref:`ref-classes-rust` class is an internal class which is just used
2886in the "rust" recipe, to build the Rust compiler and runtime
2887library. Except for this recipe, it is not intended to be used directly.
2888
2889.. _ref-classes-rust-common:
2890
2891``rust-common``
2892===============
2893
2894The :ref:`ref-classes-rust-common` class is an internal class to the
2895:ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not
2896intended to be used directly.
2897
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002898.. _ref-classes-sanity:
2899
Andrew Geissler517393d2023-01-13 08:55:19 -06002900``sanity``
2901==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002902
Andrew Geissler517393d2023-01-13 08:55:19 -06002903The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002904on the host system so that users can be notified of potential problems
2905that might affect their build. The class also performs basic user
2906configuration checks from the ``local.conf`` configuration file to
2907prevent common mistakes that cause build failures. Distribution policy
2908usually determines whether to include this class.
2909
2910.. _ref-classes-scons:
2911
Andrew Geissler517393d2023-01-13 08:55:19 -06002912``scons``
2913=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002914
Andrew Geissler517393d2023-01-13 08:55:19 -06002915The :ref:`ref-classes-scons` class supports recipes that need to build software
2916that uses the SCons build system. You can use the :term:`EXTRA_OESCONS`
2917variable to specify additional configuration options you want to pass SCons
2918command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002919
2920.. _ref-classes-sdl:
2921
Andrew Geissler517393d2023-01-13 08:55:19 -06002922``sdl``
2923=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002924
Andrew Geissler517393d2023-01-13 08:55:19 -06002925The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002926the Simple DirectMedia Layer (SDL) library.
2927
Patrick Williams45852732022-04-02 08:58:32 -05002928.. _ref-classes-python_setuptools_build_meta:
Andrew Geissler9aee5002022-03-30 16:27:02 +00002929
Andrew Geissler517393d2023-01-13 08:55:19 -06002930``python_setuptools_build_meta``
2931================================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002932
Andrew Geissler517393d2023-01-13 08:55:19 -06002933The :ref:`ref-classes-python_setuptools_build_meta` class enables building
2934Python modules which declare the
Andrew Geissler9aee5002022-03-30 16:27:02 +00002935`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2936``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
2937section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2938
2939Python modules built with ``setuptools.build_meta`` can be pure Python or
2940include ``C`` or ``Rust`` extensions).
2941
Andrew Geissler517393d2023-01-13 08:55:19 -06002942Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002943
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002944.. _ref-classes-setuptools3:
2945
Andrew Geissler517393d2023-01-13 08:55:19 -06002946``setuptools3``
2947===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002948
Andrew Geissler517393d2023-01-13 08:55:19 -06002949The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions
2950that use build systems based on ``setuptools`` (e.g. only have a ``setup.py``
2951and have not migrated to the official ``pyproject.toml`` format). If your recipe
2952uses these build systems, the recipe needs to inherit the
2953:ref:`ref-classes-setuptools3` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002954
2955 .. note::
2956
Andrew Geissler517393d2023-01-13 08:55:19 -06002957 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls
Andrew Geissler9aee5002022-03-30 16:27:02 +00002958 ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
2959 (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
2960
2961 A consequence of this is that legacy software still using deprecated
2962 ``distutils`` from the Python standard library cannot be packaged as
2963 ``wheels``. A common solution is the replace
2964 ``from distutils.core import setup`` with ``from setuptools import setup``.
2965
2966 .. note::
2967
Andrew Geissler517393d2023-01-13 08:55:19 -06002968 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now
2969 installs the ``wheel`` binary archive. In current versions of
2970 ``setuptools`` the legacy ``setup.py install`` method is deprecated. If
2971 the ``setup.py`` cannot be used with wheels, for example it creates files
2972 outside of the Python module or standard entry points, then
2973 :ref:`ref-classes-setuptools3_legacy` should be used.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002974
2975.. _ref-classes-setuptools3_legacy:
2976
Andrew Geissler517393d2023-01-13 08:55:19 -06002977``setuptools3_legacy``
2978======================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002979
Andrew Geissler517393d2023-01-13 08:55:19 -06002980The :ref:`ref-classes-setuptools3_legacy` class supports
2981Python version 3.x extensions that use build systems based on ``setuptools``
2982(e.g. only have a ``setup.py`` and have not migrated to the official
2983``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`,
2984this uses the traditional ``setup.py`` ``build`` and ``install`` commands and
2985not wheels. This use of ``setuptools`` like this is
Patrick Williams2390b1b2022-11-03 13:47:49 -05002986`deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__
Andrew Geissler9aee5002022-03-30 16:27:02 +00002987but still relatively common.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002988
Andrew Geissler595f6302022-01-24 19:11:47 +00002989.. _ref-classes-setuptools3-base:
2990
Andrew Geissler517393d2023-01-13 08:55:19 -06002991``setuptools3-base``
2992====================
Andrew Geissler595f6302022-01-24 19:11:47 +00002993
Andrew Geissler517393d2023-01-13 08:55:19 -06002994The :ref:`ref-classes-setuptools3-base` class provides a reusable base for
2995other classes that support building Python version 3.x extensions. If you need
2996functionality that is not provided by the :ref:`ref-classes-setuptools3` class,
2997you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks
2998in the :ref:`ref-classes-setuptools3` class and inherit this class instead.
Andrew Geissler595f6302022-01-24 19:11:47 +00002999
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003000.. _ref-classes-sign_rpm:
3001
Andrew Geissler517393d2023-01-13 08:55:19 -06003002``sign_rpm``
3003============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003004
Andrew Geissler517393d2023-01-13 08:55:19 -06003005The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003006
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003007.. _ref-classes-siteinfo:
3008
Andrew Geissler517393d2023-01-13 08:55:19 -06003009``siteinfo``
3010============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003011
Andrew Geissler517393d2023-01-13 08:55:19 -06003012The :ref:`ref-classes-siteinfo` class provides information about the targets
3013that might be needed by other classes or recipes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003014
3015As an example, consider Autotools, which can require tests that must
3016execute on the target hardware. Since this is not possible in general
3017when cross compiling, site information is used to provide cached test
3018results so these tests can be skipped over but still make the correct
3019values available. The ``meta/site directory`` contains test results
3020sorted into different categories such as architecture, endianness, and
3021the ``libc`` used. Site information provides a list of files containing
Andrew Geissler09036742021-06-25 14:25:14 -05003022data relevant to the current build in the :term:`CONFIG_SITE` variable that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003023Autotools automatically picks up.
3024
Andrew Geissler09036742021-06-25 14:25:14 -05003025The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
3026:term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003027
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003028.. _ref-classes-sstate:
3029
Andrew Geissler517393d2023-01-13 08:55:19 -06003030``sstate``
3031==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003032
Andrew Geissler517393d2023-01-13 08:55:19 -06003033The :ref:`ref-classes-sstate` class provides support for Shared State (sstate).
3034By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's
3035default value.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003036
3037For more information on sstate, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06003038":ref:`overview-manual/concepts:shared state cache`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003039section in the Yocto Project Overview and Concepts Manual.
3040
3041.. _ref-classes-staging:
3042
Andrew Geissler517393d2023-01-13 08:55:19 -06003043``staging``
3044===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003045
Andrew Geissler517393d2023-01-13 08:55:19 -06003046The :ref:`ref-classes-staging` class installs files into individual recipe work
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003047directories for sysroots. The class contains the following key tasks:
3048
3049- The :ref:`ref-tasks-populate_sysroot` task,
3050 which is responsible for handing the files that end up in the recipe
3051 sysroots.
3052
3053- The
3054 :ref:`ref-tasks-prepare_recipe_sysroot`
3055 task (a "partner" task to the ``populate_sysroot`` task), which
3056 installs the files into the individual recipe work directories (i.e.
3057 :term:`WORKDIR`).
3058
Andrew Geissler517393d2023-01-13 08:55:19 -06003059The code in the :ref:`ref-classes-staging` class is complex and basically works
3060in two stages:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003061
3062- *Stage One:* The first stage addresses recipes that have files they
3063 want to share with other recipes that have dependencies on the
3064 originating recipe. Normally these dependencies are installed through
3065 the :ref:`ref-tasks-install` task into
Patrick Williams2194f502022-10-16 14:26:09 -05003066 ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003067 copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
3068 subset of files is controlled by the
3069 :term:`SYSROOT_DIRS`,
3070 :term:`SYSROOT_DIRS_NATIVE`, and
Andrew Geissler9aee5002022-03-30 16:27:02 +00003071 :term:`SYSROOT_DIRS_IGNORE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003072 variables.
3073
3074 .. note::
3075
3076 Additionally, a recipe can customize the files further by
Andrew Geissler09036742021-06-25 14:25:14 -05003077 declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003078 variable.
3079
3080 A shared state (sstate) object is built from these files and the
3081 files are placed into a subdirectory of
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003082 :ref:`structure-build-tmp-sysroots-components`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003083 The files are scanned for hardcoded paths to the original
3084 installation location. If the location is found in text files, the
3085 hardcoded locations are replaced by tokens and a list of the files
3086 needing such replacements is created. These adjustments are referred
3087 to as "FIXMEs". The list of files that are scanned for paths is
3088 controlled by the :term:`SSTATE_SCAN_FILES`
3089 variable.
3090
3091- *Stage Two:* The second stage addresses recipes that want to use
3092 something from another recipe and declare a dependency on that recipe
3093 through the :term:`DEPENDS` variable. The recipe will
3094 have a
3095 :ref:`ref-tasks-prepare_recipe_sysroot`
3096 task and when this task executes, it creates the ``recipe-sysroot``
3097 and ``recipe-sysroot-native`` in the recipe work directory (i.e.
3098 :term:`WORKDIR`). The OpenEmbedded build system
3099 creates hard links to copies of the relevant files from
3100 ``sysroots-components`` into the recipe work directory.
3101
3102 .. note::
3103
3104 If hard links are not possible, the build system uses actual
3105 copies.
3106
3107 The build system then addresses any "FIXMEs" to paths as defined from
3108 the list created in the first stage.
3109
3110 Finally, any files in ``${bindir}`` within the sysroot that have the
3111 prefix "``postinst-``" are executed.
3112
3113 .. note::
3114
3115 Although such sysroot post installation scripts are not
3116 recommended for general use, the files do allow some issues such
3117 as user creation and module indexes to be addressed.
3118
Andrew Geissler09036742021-06-25 14:25:14 -05003119 Because recipes can have other dependencies outside of :term:`DEPENDS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003120 (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
3121 the sysroot creation function ``extend_recipe_sysroot`` is also added
3122 as a pre-function for those tasks whose dependencies are not through
Andrew Geissler09036742021-06-25 14:25:14 -05003123 :term:`DEPENDS` but operate similarly.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003124
3125 When installing dependencies into the sysroot, the code traverses the
3126 dependency graph and processes dependencies in exactly the same way
3127 as the dependencies would or would not be when installed from sstate.
3128 This processing means, for example, a native tool would have its
3129 native dependencies added but a target library would not have its
3130 dependencies traversed or installed. The same sstate dependency code
3131 is used so that builds should be identical regardless of whether
3132 sstate was used or not. For a closer look, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06003133 ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003134
3135 The build system is careful to maintain manifests of the files it
3136 installs so that any given dependency can be installed as needed. The
3137 sstate hash of the installed item is also stored so that if it
3138 changes, the build system can reinstall it.
3139
3140.. _ref-classes-syslinux:
3141
Andrew Geissler517393d2023-01-13 08:55:19 -06003142``syslinux``
3143============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003144
Andrew Geissler517393d2023-01-13 08:55:19 -06003145The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for
3146building bootable images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003147
3148The class supports the following variables:
3149
3150- :term:`INITRD`: Indicates list of filesystem images to
3151 concatenate and use as an initial RAM disk (initrd). This variable is
3152 optional.
3153
3154- :term:`ROOTFS`: Indicates a filesystem image to include
3155 as the root filesystem. This variable is optional.
3156
3157- :term:`AUTO_SYSLINUXMENU`: Enables creating
3158 an automatic menu when set to "1".
3159
3160- :term:`LABELS`: Lists targets for automatic
3161 configuration.
3162
3163- :term:`APPEND`: Lists append string overrides for each
3164 label.
3165
3166- :term:`SYSLINUX_OPTS`: Lists additional options
3167 to add to the syslinux file. Semicolon characters separate multiple
3168 options.
3169
3170- :term:`SYSLINUX_SPLASH`: Lists a background
3171 for the VGA boot menu when you are using the boot menu.
3172
3173- :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
3174 to "console=ttyX" to change kernel boot default console.
3175
3176- :term:`SYSLINUX_SERIAL`: Sets an alternate
3177 serial port. Or, turns off serial when the variable is set with an
3178 empty string.
3179
3180- :term:`SYSLINUX_SERIAL_TTY`: Sets an
3181 alternate "console=tty..." kernel boot argument.
3182
3183.. _ref-classes-systemd:
3184
Andrew Geissler517393d2023-01-13 08:55:19 -06003185``systemd``
3186===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003187
Andrew Geissler517393d2023-01-13 08:55:19 -06003188The :ref:`ref-classes-systemd` class provides support for recipes that install
3189systemd unit files.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003190
3191The functionality for this class is disabled unless you have "systemd"
3192in :term:`DISTRO_FEATURES`.
3193
3194Under this class, the recipe or Makefile (i.e. whatever the recipe is
3195calling during the :ref:`ref-tasks-install` task)
3196installs unit files into
3197``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
3198files being installed go into packages other than the main package, you
3199need to set :term:`SYSTEMD_PACKAGES` in your
3200recipe to identify the packages in which the files will be installed.
3201
3202You should set :term:`SYSTEMD_SERVICE` to the
3203name of the service file. You should also use a package name override to
3204indicate the package to which the value applies. If the value applies to
3205the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
Andrew Geisslerc926e172021-05-07 16:11:35 -05003206is an example from the connman recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003207
Patrick Williams0ca19cc2021-08-16 14:03:13 -05003208 SYSTEMD_SERVICE:${PN} = "connman.service"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003209
3210Services are set up to start on boot automatically
3211unless you have set
3212:term:`SYSTEMD_AUTO_ENABLE` to "disable".
3213
Andrew Geissler517393d2023-01-13 08:55:19 -06003214For more information on :ref:`ref-classes-systemd`, see the
3215":ref:`dev-manual/init-manager:selecting an initialization manager`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003216section in the Yocto Project Development Tasks Manual.
3217
3218.. _ref-classes-systemd-boot:
3219
Andrew Geissler517393d2023-01-13 08:55:19 -06003220``systemd-boot``
3221================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003222
Andrew Geissler517393d2023-01-13 08:55:19 -06003223The :ref:`ref-classes-systemd-boot` class provides functions specific to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003224systemd-boot bootloader for building bootable images. This is an
3225internal class and is not intended to be used directly.
3226
3227.. note::
3228
Andrew Geissler517393d2023-01-13 08:55:19 -06003229 The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003230 used in previous Yocto Project releases with the ``systemd`` project.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003231
Andrew Geissler517393d2023-01-13 08:55:19 -06003232Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to
3233use this class. Doing so creates a standalone EFI bootloader that is not
3234dependent on systemd.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003235
3236For information on more variables used and supported in this class, see
3237the :term:`SYSTEMD_BOOT_CFG`,
3238:term:`SYSTEMD_BOOT_ENTRIES`, and
3239:term:`SYSTEMD_BOOT_TIMEOUT` variables.
3240
3241You can also see the `Systemd-boot
Andrew Geisslerd1e89492021-02-12 15:35:20 -06003242documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003243for more information.
3244
3245.. _ref-classes-terminal:
3246
Andrew Geissler517393d2023-01-13 08:55:19 -06003247``terminal``
3248============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003249
Andrew Geissler517393d2023-01-13 08:55:19 -06003250The :ref:`ref-classes-terminal` class provides support for starting a terminal
3251session. The :term:`OE_TERMINAL` variable controls which terminal emulator is
3252used for the session.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003253
Andrew Geissler517393d2023-01-13 08:55:19 -06003254Other classes use the :ref:`ref-classes-terminal` class anywhere a separate
3255terminal session needs to be started. For example, the :ref:`ref-classes-patch`
3256class assuming :term:`PATCHRESOLVE` is set to "user", the
3257:ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all
3258use the :ref:`ref-classes-terminal` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003259
Patrick Williams975a06f2022-10-21 14:42:47 -05003260.. _ref-classes-testimage:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003261
Andrew Geissler517393d2023-01-13 08:55:19 -06003262``testimage``
3263=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003264
Andrew Geissler517393d2023-01-13 08:55:19 -06003265The :ref:`ref-classes-testimage` class supports running automated tests against
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003266images using QEMU and on actual hardware. The classes handle loading the
3267tests and starting the image. To use the classes, you need to perform
3268steps to set up the environment.
3269
Patrick Williams975a06f2022-10-21 14:42:47 -05003270To enable this class, add the following to your configuration::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003271
Patrick Williams975a06f2022-10-21 14:42:47 -05003272 IMAGE_CLASSES += "testimage"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003273
3274The tests are commands that run on the target system over ``ssh``. Each
3275test is written in Python and makes use of the ``unittest`` module.
3276
Andrew Geissler517393d2023-01-13 08:55:19 -06003277The :ref:`ref-classes-testimage` class runs tests on an image when called using the
Andrew Geisslerc926e172021-05-07 16:11:35 -05003278following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003279
3280 $ bitbake -c testimage image
3281
Patrick Williams975a06f2022-10-21 14:42:47 -05003282Alternatively, if you wish to have tests automatically run for each image
3283after it is built, you can set :term:`TESTIMAGE_AUTO`::
3284
3285 TESTIMAGE_AUTO = "1"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003286
3287For information on how to enable, run, and create new tests, see the
Patrick Williams96e4b4e2025-02-03 15:49:15 -05003288":ref:`test-manual/runtime-testing:performing automated runtime testing`"
3289section in the Yocto Project Test Environment Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003290
3291.. _ref-classes-testsdk:
3292
Andrew Geissler517393d2023-01-13 08:55:19 -06003293``testsdk``
3294===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003295
3296This class supports running automated tests against software development
Andrew Geissler517393d2023-01-13 08:55:19 -06003297kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called
Andrew Geisslerc926e172021-05-07 16:11:35 -05003298using the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003299
3300 $ bitbake -c testsdk image
3301
3302.. note::
3303
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003304 Best practices include using :term:`IMAGE_CLASSES` rather than
Andrew Geissler517393d2023-01-13 08:55:19 -06003305 :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003306 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003307
3308.. _ref-classes-texinfo:
3309
Andrew Geissler517393d2023-01-13 08:55:19 -06003310``texinfo``
3311===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003312
3313This class should be inherited by recipes whose upstream packages invoke
3314the ``texinfo`` utilities at build-time. Native and cross recipes are
3315made to use the dummy scripts provided by ``texinfo-dummy-native``, for
3316improved performance. Target architecture recipes use the genuine
3317Texinfo utilities. By default, they use the Texinfo utilities on the
3318host system.
3319
3320.. note::
3321
3322 If you want to use the Texinfo recipe shipped with the build system,
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003323 you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
3324 from :term:`SANITY_REQUIRED_UTILITIES`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003325
3326.. _ref-classes-toaster:
3327
Andrew Geissler517393d2023-01-13 08:55:19 -06003328``toaster``
3329===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003330
Andrew Geissler517393d2023-01-13 08:55:19 -06003331The :ref:`ref-classes-toaster` class collects information about packages and images and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003332sends them as events that the BitBake user interface can receive. The
3333class is enabled when the Toaster user interface is running.
3334
3335This class is not intended to be used directly.
3336
3337.. _ref-classes-toolchain-scripts:
3338
Andrew Geissler517393d2023-01-13 08:55:19 -06003339``toolchain-scripts``
3340=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003341
Andrew Geissler517393d2023-01-13 08:55:19 -06003342The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003343the environment for installed SDKs.
3344
3345.. _ref-classes-typecheck:
3346
Andrew Geissler517393d2023-01-13 08:55:19 -06003347``typecheck``
3348=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003349
Andrew Geissler517393d2023-01-13 08:55:19 -06003350The :ref:`ref-classes-typecheck` class provides support for validating the values of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003351variables set at the configuration level against their defined types.
3352The OpenEmbedded build system allows you to define the type of a
Andrew Geisslerc926e172021-05-07 16:11:35 -05003353variable using the "type" varflag. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003354
3355 IMAGE_FEATURES[type] = "list"
3356
3357.. _ref-classes-uboot-config:
3358
Andrew Geissler517393d2023-01-13 08:55:19 -06003359``uboot-config``
3360================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003361
Andrew Geissler517393d2023-01-13 08:55:19 -06003362The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for
Andrew Geisslerc926e172021-05-07 16:11:35 -05003363a machine. Specify the machine in your recipe as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003364
3365 UBOOT_CONFIG ??= <default>
Patrick Williams705982a2024-01-12 09:51:57 -06003366 UBOOT_CONFIG[foo] = "config,images,binary"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003367
Andrew Geisslerc926e172021-05-07 16:11:35 -05003368You can also specify the machine using this method::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003369
3370 UBOOT_MACHINE = "config"
3371
3372See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
3373information.
3374
Patrick Williamsb542dec2023-06-09 01:26:37 -05003375.. _ref-classes-uboot-sign:
3376
3377``uboot-sign``
3378==============
3379
3380The :ref:`ref-classes-uboot-sign` class provides support for U-Boot verified boot.
3381It is intended to be inherited from U-Boot recipes.
3382
Patrick Williams39653562024-03-01 08:54:02 -06003383The variables used by this class are:
Patrick Williamsb542dec2023-06-09 01:26:37 -05003384
3385- :term:`SPL_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3386 building the FIT image.
3387- :term:`SPL_SIGN_ENABLE`: enable signing the FIT image.
3388- :term:`SPL_SIGN_KEYDIR`: directory containing the signing keys.
3389- :term:`SPL_SIGN_KEYNAME`: base filename of the signing keys.
3390- :term:`UBOOT_FIT_ADDRESS_CELLS`: ``#address-cells`` value for the FIT image.
3391- :term:`UBOOT_FIT_DESC`: description string encoded into the FIT image.
3392- :term:`UBOOT_FIT_GENERATE_KEYS`: generate the keys if they don't exist yet.
3393- :term:`UBOOT_FIT_HASH_ALG`: hash algorithm for the FIT image.
3394- :term:`UBOOT_FIT_KEY_GENRSA_ARGS`: ``openssl genrsa`` arguments.
3395- :term:`UBOOT_FIT_KEY_REQ_ARGS`: ``openssl req`` arguments.
3396- :term:`UBOOT_FIT_SIGN_ALG`: signature algorithm for the FIT image.
3397- :term:`UBOOT_FIT_SIGN_NUMBITS`: size of the private key for FIT image
Patrick Williams44b3caf2024-04-12 16:51:14 -05003398 signing.
Patrick Williamsb542dec2023-06-09 01:26:37 -05003399- :term:`UBOOT_FIT_KEY_SIGN_PKCS`: algorithm for the public key certificate
3400 for FIT image signing.
3401- :term:`UBOOT_FITIMAGE_ENABLE`: enable the generation of a U-Boot FIT image.
3402- :term:`UBOOT_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3403 rebuilding the FIT image containing the kernel.
3404
3405See U-Boot's documentation for details about `verified boot
3406<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/verified-boot.txt>`__
3407and the `signature process
3408<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/signature.txt>`__.
3409
3410See also the description of :ref:`ref-classes-kernel-fitimage` class, which this class
3411imitates.
3412
Patrick Williams84603582024-12-14 08:00:57 -05003413.. _ref-classes-uki:
3414
3415``uki``
3416=======
3417
3418The :ref:`ref-classes-uki` class provides support for `Unified Kernel Image
3419(UKI) <https://uapi-group.org/specifications/specs/unified_kernel_image/>`__
3420format. UKIs combine kernel, :term:`Initramfs`, signatures, metadata etc to a
3421single UEFI firmware compatible binary. The class is intended to be inherited
3422by rootfs image recipes. The build configuration should also use an
3423:term:`Initramfs`, ``systemd-boot`` as boot menu provider and have UEFI support
3424on target hardware. Using ``systemd`` as init is recommended. Image builds
3425should create an ESP partition for UEFI firmware and copy ``systemd-boot`` and
3426UKI files there. Sample configuration for Wic images is provided in
3427:oe_git:`scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in
3428<openembedded-core/tree/scripts/lib/wic/canned-wks/efi-uki-bootdisk.wks.in>`.
3429UKIs are generated using ``systemd`` reference implementation `ukify
3430<https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__.
3431This class uses a number of variables but tries to find sensible defaults for
3432them.
3433
3434The variables used by this class are:
3435
3436- :term:`EFI_ARCH`: architecture name within EFI standard, set in
3437 :oe_git:`meta/conf/image-uefi.conf
3438 <openembedded-core/tree/meta/conf/image-uefi.conf>`
3439- :term:`IMAGE_EFI_BOOT_FILES`: files to install to EFI boot partition
3440 created by the ``bootimg-efi`` Wic plugin
3441- :term:`INITRAMFS_IMAGE`: initramfs recipe name
3442- :term:`KERNEL_DEVICETREE`: optional devicetree files to embed into UKI
3443- :term:`UKIFY_CMD`: `ukify
3444 <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__
3445 command to build the UKI image
3446- :term:`UKI_CMDLINE`: kernel command line to use with UKI
3447- :term:`UKI_CONFIG_FILE`: optional config file for `ukify
3448 <https://www.freedesktop.org/software/systemd/man/latest/ukify.html>`__
3449- :term:`UKI_FILENAME`: output file name for the UKI image
3450- :term:`UKI_KERNEL_FILENAME`: kernel image file name
3451- :term:`UKI_SB_CERT`: optional UEFI secureboot certificate matching the
3452 private key
3453- :term:`UKI_SB_KEY`: optional UEFI secureboot private key to sign UKI with
3454
3455For examples on how to use this class see oeqa selftest
3456:oe_git:`meta/lib/oeqa/selftest/cases/uki.py
3457<openembedded-core/tree/meta/lib/oeqa/selftest/cases/uki.py>`.
3458Also an oeqa runtime test :oe_git:`meta/lib/oeqa/runtime/cases/uki.py
3459<openembedded-core/tree/meta/lib/oeqa/runtime/cases/uki.py>` is provided which
3460verifies that the target system booted the same UKI binary as was set at
3461buildtime via :term:`UKI_FILENAME`.
3462
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003463.. _ref-classes-uninative:
3464
Andrew Geissler517393d2023-01-13 08:55:19 -06003465``uninative``
3466=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003467
3468Attempts to isolate the build system from the host distribution's C
3469library in order to make re-use of native shared state artifacts across
3470different host distributions practical. With this class enabled, a
3471tarball containing a pre-built C library is downloaded at the start of
3472the build. In the Poky reference distribution this is enabled by default
3473through ``meta/conf/distro/include/yocto-uninative.inc``. Other
3474distributions that do not derive from poky can also
3475"``require conf/distro/include/yocto-uninative.inc``" to use this.
3476Alternatively if you prefer, you can build the uninative-tarball recipe
3477yourself, publish the resulting tarball (e.g. via HTTP) and set
3478``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
3479example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
3480
Andrew Geissler517393d2023-01-13 08:55:19 -06003481The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003482SDK. When building the extensible SDK, ``uninative-tarball`` is built
3483and the resulting tarball is included within the SDK.
3484
3485.. _ref-classes-update-alternatives:
3486
Andrew Geissler517393d2023-01-13 08:55:19 -06003487``update-alternatives``
3488=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003489
Andrew Geissler517393d2023-01-13 08:55:19 -06003490The :ref:`ref-classes-update-alternatives` class helps the alternatives system when
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003491multiple sources provide the same command. This situation occurs when
3492several programs that have the same or similar function are installed
3493with the same name. For example, the ``ar`` command is available from
3494the ``busybox``, ``binutils`` and ``elfutils`` packages. The
Andrew Geissler517393d2023-01-13 08:55:19 -06003495:ref:`ref-classes-update-alternatives` class handles renaming the binaries so that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003496multiple packages can be installed without conflicts. The ``ar`` command
3497still works regardless of which packages are installed or subsequently
3498removed. The class renames the conflicting binary in each package and
3499symlinks the highest priority binary during installation or removal of
3500packages.
3501
3502To use this class, you need to define a number of variables:
3503
3504- :term:`ALTERNATIVE`
3505
3506- :term:`ALTERNATIVE_LINK_NAME`
3507
3508- :term:`ALTERNATIVE_TARGET`
3509
3510- :term:`ALTERNATIVE_PRIORITY`
3511
3512These variables list alternative commands needed by a package, provide
3513pathnames for links, default links for targets, and so forth. For
3514details on how to use this class, see the comments in the
Patrick Williams975a06f2022-10-21 14:42:47 -05003515:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003516file.
3517
3518.. note::
3519
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003520 You can use the ``update-alternatives`` command directly in your recipes.
3521 However, this class simplifies things in most cases.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003522
3523.. _ref-classes-update-rc.d:
3524
Andrew Geissler517393d2023-01-13 08:55:19 -06003525``update-rc.d``
3526===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003527
Andrew Geissler517393d2023-01-13 08:55:19 -06003528The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003529initialization script on behalf of the package. The OpenEmbedded build
3530system takes care of details such as making sure the script is stopped
3531before a package is removed and started when the package is installed.
3532
Andrew Geissler09036742021-06-25 14:25:14 -05003533Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
3534:term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003535for details.
3536
3537.. _ref-classes-useradd:
3538
Andrew Geissler517393d2023-01-13 08:55:19 -06003539``useradd*``
3540============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003541
Patrick Williams2390b1b2022-11-03 13:47:49 -05003542The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003543usage by the package on the target. For example, if you have packages
3544that contain system services that should be run under their own user or
3545group, you can use these classes to enable creation of the user or
Andrew Geissler595f6302022-01-24 19:11:47 +00003546group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
3547</openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003548recipe in the :term:`Source Directory` provides a simple
3549example that shows how to add three users and groups to two packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003550
Patrick Williams2390b1b2022-11-03 13:47:49 -05003551The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003552groups settings.
3553
Patrick Williams2390b1b2022-11-03 13:47:49 -05003554The :ref:`useradd* <ref-classes-useradd>` classes support the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003555:term:`USERADD_PACKAGES`,
3556:term:`USERADD_PARAM`,
3557:term:`GROUPADD_PARAM`, and
3558:term:`GROUPMEMS_PARAM` variables.
3559
Patrick Williams2390b1b2022-11-03 13:47:49 -05003560The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003561that have static user identification (``uid``) and group identification
3562(``gid``) values.
3563
3564The default behavior of the OpenEmbedded build system for assigning
3565``uid`` and ``gid`` values when packages add users and groups during
3566package install time is to add them dynamically. This works fine for
3567programs that do not care what the values of the resulting users and
3568groups become. In these cases, the order of the installation determines
3569the final ``uid`` and ``gid`` values. However, if non-deterministic
3570``uid`` and ``gid`` values are a problem, you can override the default,
3571dynamic application of these values by setting static values. When you
3572set static values, the OpenEmbedded build system looks in
3573:term:`BBPATH` for ``files/passwd`` and ``files/group``
3574files for the values.
3575
Andrew Geissler517393d2023-01-13 08:55:19 -06003576To use static ``uid`` and ``gid`` values, you need to set some variables. See
3577the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`,
3578:term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables.
3579You can also see the :ref:`ref-classes-useradd` class for additional
3580information.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003581
3582.. note::
3583
Patrick Williams2390b1b2022-11-03 13:47:49 -05003584 You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable
Andrew Geissler09036742021-06-25 14:25:14 -05003585 or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003586 enable or disable the class in a configured system, :term:`TMPDIR` might
Andrew Geissler09036742021-06-25 14:25:14 -05003587 contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003588 directory will correct this condition.
3589
3590.. _ref-classes-utility-tasks:
3591
Andrew Geissler517393d2023-01-13 08:55:19 -06003592``utility-tasks``
3593=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003594
Andrew Geissler517393d2023-01-13 08:55:19 -06003595The :ref:`ref-classes-utility-tasks` class provides support for various
3596"utility" type tasks that are applicable to all recipes, such as
3597:ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003598
3599This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003600:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003601
3602.. _ref-classes-utils:
3603
Andrew Geissler517393d2023-01-13 08:55:19 -06003604``utils``
3605=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003606
Andrew Geissler517393d2023-01-13 08:55:19 -06003607The :ref:`ref-classes-utils` class provides some useful Python functions that are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003608typically used in inline Python expressions (e.g. ``${@...}``). One
3609example use is for ``bb.utils.contains()``.
3610
3611This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003612:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003613
3614.. _ref-classes-vala:
3615
Andrew Geissler517393d2023-01-13 08:55:19 -06003616``vala``
3617========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003618
Andrew Geissler517393d2023-01-13 08:55:19 -06003619The :ref:`ref-classes-vala` class supports recipes that need to build software written
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003620using the Vala programming language.
3621
Patrick Williams84603582024-12-14 08:00:57 -05003622.. _ref-classes-vex:
3623
3624``vex``
3625========
3626
3627The :ref:`ref-classes-vex` class is used to generate metadata needed by external
3628tools to check for vulnerabilities, for example CVEs. It can be used as a
3629replacement for :ref:`ref-classes-cve-check`.
3630
3631In order to use this class, inherit the class in the ``local.conf`` file and it
3632will add the ``generate_vex`` task for every recipe::
3633
3634 INHERIT += "vex"
3635
3636If an image is built it will generate a report in :term:`DEPLOY_DIR_IMAGE` for
3637all the packages used, it will also generate a file for all recipes used in the
3638build.
3639
3640Variables use the ``CVE_CHECK`` prefix to keep compatibility with the
3641:ref:`ref-classes-cve-check` class.
3642
3643Example usage::
3644
3645 bitbake -c generate_vex openssl
3646
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003647.. _ref-classes-waf:
3648
Andrew Geissler517393d2023-01-13 08:55:19 -06003649``waf``
3650=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003651
Andrew Geissler517393d2023-01-13 08:55:19 -06003652The :ref:`ref-classes-waf` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003653the Waf build system. You can use the
3654:term:`EXTRA_OECONF` or
3655:term:`PACKAGECONFIG_CONFARGS` variables
3656to specify additional configuration options to be passed on the Waf
3657command line.
Patrick Williams96e4b4e2025-02-03 15:49:15 -05003658
3659.. _ref-classes-yocto-check-layer:
3660
3661``yocto-check-layer``
3662=====================
3663
3664The :ref:`ref-classes-yocto-check-layer` class is used by the
3665:oe_git:`yocto-check-layer </openembedded-core/tree/scripts/yocto-check-layer>`
3666script to ensure that packages from Yocto Project Compatible layers don't skip
3667required QA checks listed in :term:`CHECKLAYER_REQUIRED_TESTS` defined by the
3668:ref:`ref-classes-insane` class.
3669
3670It adds an anonymous python function with extra processing to all recipes,
3671and globally inheriting this class with :term:`INHERIT` is not advised. Instead
3672the ``yocto-check-layer`` script should be used as it handles usage of this
3673class.
3674
3675For more information on the Yocto Project
3676Compatible layers, see the :ref:`dev-manual/layers:Making Sure Your Layer is
3677Compatible With Yocto Project` section of the Yocto Project Development Manual.