blob: 3f0d4844e89d5fa2bba623954d9a99c9c29c44ae [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
131.. _ref-classes-base:
132
Andrew Geissler517393d2023-01-13 08:55:19 -0600133``base``
134========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500135
Andrew Geissler517393d2023-01-13 08:55:19 -0600136The :ref:`ref-classes-base` class is special in that every ``.bb`` file implicitly
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500137inherits the class. This class contains definitions for standard basic
138tasks such as fetching, unpacking, configuring (empty by default),
139compiling (runs any ``Makefile`` present), installing (empty by default)
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500140and packaging (empty by default). These tasks are often overridden or
Andrew Geissler517393d2023-01-13 08:55:19 -0600141extended by other classes such as the :ref:`ref-classes-autotools` class or the
142:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500143
144The class also contains some commonly used functions such as
145``oe_runmake``, which runs ``make`` with the arguments specified in
146:term:`EXTRA_OEMAKE` variable as well as the
147arguments passed directly to ``oe_runmake``.
148
149.. _ref-classes-bash-completion:
150
Andrew Geissler517393d2023-01-13 08:55:19 -0600151``bash-completion``
152===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500153
154Sets up packaging and dependencies appropriate for recipes that build
155software that includes bash-completion data.
156
157.. _ref-classes-bin-package:
158
Andrew Geissler517393d2023-01-13 08:55:19 -0600159``bin_package``
160===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500161
Andrew Geissler517393d2023-01-13 08:55:19 -0600162The :ref:`ref-classes-bin-package` class is a helper class for recipes that extract the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500163contents of a binary package (e.g. an RPM) and install those contents
164rather than building the binary from source. The binary package is
165extracted and new packages in the configured output package format are
166created. Extraction and installation of proprietary binaries is a good
167example use for this class.
168
169.. note::
170
171 For RPMs and other packages that do not contain a subdirectory, you
172 should specify an appropriate fetcher parameter to point to the
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500173 subdirectory. For example, if BitBake is using the Git fetcher (``git://``),
174 the "subpath" parameter limits the checkout to a specific subpath
175 of the tree. Here is an example where ``${BP}`` is used so that the files
176 are extracted into the subdirectory expected by the default value of
Andrew Geissler09036742021-06-25 14:25:14 -0500177 :term:`S`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500178
Andrew Geissler9aee5002022-03-30 16:27:02 +0000179 SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=main;subpath=${BP}"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500180
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500181 See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for
182 more information on supported BitBake Fetchers.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500183
184.. _ref-classes-binconfig:
185
Andrew Geissler517393d2023-01-13 08:55:19 -0600186``binconfig``
187=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500188
Andrew Geissler517393d2023-01-13 08:55:19 -0600189The :ref:`ref-classes-binconfig` class helps to correct paths in shell scripts.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500190
191Before ``pkg-config`` had become widespread, libraries shipped shell
192scripts to give information about the libraries and include paths needed
193to build software (usually named ``LIBNAME-config``). This class assists
194any recipe using such scripts.
195
196During staging, the OpenEmbedded build system installs such scripts into
197the ``sysroots/`` directory. Inheriting this class results in all paths
198in these scripts being changed to point into the ``sysroots/`` directory
199so that all builds that use the script use the correct directories for
200the cross compiling layout. See the
201:term:`BINCONFIG_GLOB` variable for more
202information.
203
204.. _ref-classes-binconfig-disabled:
205
Andrew Geissler517393d2023-01-13 08:55:19 -0600206``binconfig-disabled``
207======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500208
Andrew Geissler517393d2023-01-13 08:55:19 -0600209An alternative version of the :ref:`ref-classes-binconfig`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500210class, which disables binary configuration scripts by making them return
211an error in favor of using ``pkg-config`` to query the information. The
Andrew Geissler517393d2023-01-13 08:55:19 -0600212scripts to be disabled should be specified using the :term:`BINCONFIG`
213variable within the recipe inheriting the class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500214
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500215.. _ref-classes-buildhistory:
216
Andrew Geissler517393d2023-01-13 08:55:19 -0600217``buildhistory``
218================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500219
Andrew Geissler517393d2023-01-13 08:55:19 -0600220The :ref:`ref-classes-buildhistory` class records a history of build output metadata,
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500221which can be used to detect possible regressions as well as used for
222analysis of the build output. For more information on using Build
223History, see the
Andrew Geissler517393d2023-01-13 08:55:19 -0600224":ref:`dev-manual/build-quality:maintaining build output quality`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500225section in the Yocto Project Development Tasks Manual.
226
227.. _ref-classes-buildstats:
228
Andrew Geissler517393d2023-01-13 08:55:19 -0600229``buildstats``
230==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500231
Andrew Geissler517393d2023-01-13 08:55:19 -0600232The :ref:`ref-classes-buildstats` class records performance statistics about each task
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500233executed during the build (e.g. elapsed time, CPU usage, and I/O usage).
234
235When you use this class, the output goes into the
236:term:`BUILDSTATS_BASE` directory, which defaults
237to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using
238``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading
239chart of the entire build process and can be useful for highlighting
240bottlenecks.
241
242Collecting build statistics is enabled by default through the
243:term:`USER_CLASSES` variable from your
244``local.conf`` file. Consequently, you do not have to do anything to
245enable the class. However, if you want to disable the class, simply
Andrew Geissler517393d2023-01-13 08:55:19 -0600246remove ":ref:`ref-classes-buildstats`" from the :term:`USER_CLASSES` list.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500247
248.. _ref-classes-buildstats-summary:
249
Andrew Geissler517393d2023-01-13 08:55:19 -0600250``buildstats-summary``
251======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500252
253When inherited globally, prints statistics at the end of the build on
254sstate re-use. In order to function, this class requires the
Andrew Geissler517393d2023-01-13 08:55:19 -0600255:ref:`ref-classes-buildstats` class be enabled.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500256
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600257.. _ref-classes-cargo:
258
259``cargo``
260=========
261
262The :ref:`ref-classes-cargo` class allows to compile Rust language programs
263using `Cargo <https://doc.rust-lang.org/cargo/>`__. Cargo is Rust's package
264manager, allowing to fetch package dependencies and build your program.
265
266Using this class makes it very easy to build Rust programs. All you need
267is to use the :term:`SRC_URI` variable to point to a source repository
268which can be built by Cargo, typically one that was created by the
Andrew Geissler5082cc72023-09-11 08:41:39 -0400269``cargo new`` command, containing a ``Cargo.toml`` file, a ``Cargo.lock`` file and a ``src``
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600270subdirectory.
271
Andrew Geissler5082cc72023-09-11 08:41:39 -0400272If you want to build and package tests of the program, inherit the
273:ref:`ref-classes-ptest-cargo` class instead of :ref:`ref-classes-cargo`.
274
275You will find an example (that show also how to handle possible git source dependencies) in the
276:oe_git:`zvariant_3.12.0.bb </openembedded-core/tree/meta-selftest/recipes-extended/zvariant/zvariant_3.12.0.bb>`
277recipe. Another example, with only crate dependencies, is the
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600278:oe_git:`uutils-coreutils </meta-openembedded/tree/meta-oe/recipes-core/uutils-coreutils>`
279recipe, which was generated by the `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__
280tool.
281
282This class inherits the :ref:`ref-classes-cargo_common` class.
283
284.. _ref-classes-cargo_common:
285
286``cargo_common``
287================
288
289The :ref:`ref-classes-cargo_common` class is an internal class
290that is not intended to be used directly.
291
292An exception is the "rust" recipe, to build the Rust compiler and runtime
293library, which is built by Cargo but cannot use the :ref:`ref-classes-cargo`
294class. This is why this class was introduced.
295
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600296.. _ref-classes-cargo-update-recipe-crates:
297
298``cargo-update-recipe-crates``
299===============================
300
301The :ref:`ref-classes-cargo-update-recipe-crates` class allows
302recipe developers to update the list of Cargo crates in :term:`SRC_URI`
303by reading the ``Cargo.lock`` file in the source tree.
304
305To do so, create a recipe for your program, for example using
306:doc:`devtool </ref-manual/devtool-reference>`,
307make it inherit the :ref:`ref-classes-cargo` and
308:ref:`ref-classes-cargo-update-recipe-crates` and run::
309
310 bitbake -c update_crates recipe
311
312This creates a ``recipe-crates.inc`` file that you can include in your
313recipe::
314
315 require ${BPN}-crates.inc
316
317That's also something you can achieve by using the
318`cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__ tool.
319
Andrew Geissler5082cc72023-09-11 08:41:39 -0400320.. _ref-classes-ccache:
321
Andrew Geissler517393d2023-01-13 08:55:19 -0600322``ccache``
323==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500324
Andrew Geissler517393d2023-01-13 08:55:19 -0600325The :ref:`ref-classes-ccache` class enables the C/C++ Compiler Cache for the build.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500326This class is used to give a minor performance boost during the build.
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000327
328See https://ccache.samba.org/ for information on the C/C++ Compiler
329Cache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>`
330file for details about how to enable this mechanism in your configuration
331file, how to disable it for specific recipes, and how to share ``ccache``
332files between builds.
333
334However, using the class can lead to unexpected side-effects. Thus, using
335this class is not recommended.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500336
337.. _ref-classes-chrpath:
338
Andrew Geissler517393d2023-01-13 08:55:19 -0600339``chrpath``
340===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500341
Andrew Geissler517393d2023-01-13 08:55:19 -0600342The :ref:`ref-classes-chrpath` class is a wrapper around the "chrpath" utility, which
343is used during the build process for :ref:`ref-classes-nativesdk`, :ref:`ref-classes-cross`, and
344:ref:`ref-classes-cross-canadian` recipes to change ``RPATH`` records within binaries
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500345in order to make them relocatable.
346
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500347.. _ref-classes-cmake:
348
Andrew Geissler517393d2023-01-13 08:55:19 -0600349``cmake``
350=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500351
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600352The :ref:`ref-classes-cmake` class allows recipes to build software using the
353`CMake <https://cmake.org/overview/>`__ build system. You can use the
354:term:`EXTRA_OECMAKE` variable to specify additional configuration options to
355pass to the ``cmake`` command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500356
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600357By default, the :ref:`ref-classes-cmake` class uses
358`Ninja <https://ninja-build.org/>`__ instead of GNU make for building, which
359offers better build performance. If a recipe is broken with Ninja, then the
360recipe can set the :term:`OECMAKE_GENERATOR` variable to ``Unix Makefiles`` to
361use GNU make instead.
362
363If you need to install custom CMake toolchain files supplied by the application
364being built, you should install them (during :ref:`ref-tasks-install`) to the
365preferred CMake Module directory: ``${D}${datadir}/cmake/modules/``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500366
367.. _ref-classes-cml1:
368
Andrew Geissler517393d2023-01-13 08:55:19 -0600369``cml1``
370========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500371
Andrew Geissler517393d2023-01-13 08:55:19 -0600372The :ref:`ref-classes-cml1` class provides basic support for the Linux kernel style
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500373build configuration system.
374
375.. _ref-classes-compress_doc:
376
Andrew Geissler517393d2023-01-13 08:55:19 -0600377``compress_doc``
378================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500379
380Enables compression for man pages and info pages. This class is intended
381to be inherited globally. The default compression mechanism is gz (gzip)
382but you can select an alternative mechanism by setting the
383:term:`DOC_COMPRESS` variable.
384
385.. _ref-classes-copyleft_compliance:
386
Andrew Geissler517393d2023-01-13 08:55:19 -0600387``copyleft_compliance``
388=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500389
Andrew Geissler517393d2023-01-13 08:55:19 -0600390The :ref:`ref-classes-copyleft_compliance` class preserves source code for the purposes
391of license compliance. This class is an alternative to the :ref:`ref-classes-archiver`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500392class and is still used by some users even though it has been deprecated
Andrew Geissler517393d2023-01-13 08:55:19 -0600393in favor of the :ref:`ref-classes-archiver` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500394
395.. _ref-classes-copyleft_filter:
396
Andrew Geissler517393d2023-01-13 08:55:19 -0600397``copyleft_filter``
398===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500399
Andrew Geissler517393d2023-01-13 08:55:19 -0600400A class used by the :ref:`ref-classes-archiver` and
401:ref:`ref-classes-copyleft_compliance` classes
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500402for filtering licenses. The ``copyleft_filter`` class is an internal
403class and is not intended to be used directly.
404
405.. _ref-classes-core-image:
406
Andrew Geissler517393d2023-01-13 08:55:19 -0600407``core-image``
408==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500409
Andrew Geissler517393d2023-01-13 08:55:19 -0600410The :ref:`ref-classes-core-image` class provides common definitions for the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500411``core-image-*`` image recipes, such as support for additional
412:term:`IMAGE_FEATURES`.
413
414.. _ref-classes-cpan:
415
Andrew Geissler517393d2023-01-13 08:55:19 -0600416``cpan*``
417=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500418
Patrick Williams2390b1b2022-11-03 13:47:49 -0500419The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500420
421Recipes for Perl modules are simple. These recipes usually only need to
422point to the source's archive and then inherit the proper class file.
423Building is split into two methods depending on which method the module
424authors used.
425
426- Modules that use old ``Makefile.PL``-based build system require
427 ``cpan.bbclass`` in their recipes.
428
429- Modules that use ``Build.PL``-based build system require using
430 ``cpan_build.bbclass`` in their recipes.
431
Patrick Williams2390b1b2022-11-03 13:47:49 -0500432Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500433support.
434
Patrick Williams975a06f2022-10-21 14:42:47 -0500435.. _ref-classes-create-spdx:
436
Andrew Geissler517393d2023-01-13 08:55:19 -0600437``create-spdx``
438===============
Patrick Williams975a06f2022-10-21 14:42:47 -0500439
Andrew Geissler517393d2023-01-13 08:55:19 -0600440The :ref:`ref-classes-create-spdx` class provides support for
Patrick Williams7784c422022-11-17 07:29:11 -0600441automatically creating :term:`SPDX` :term:`SBOM` documents based upon image
442and SDK contents.
443
444This class is meant to be inherited globally from a configuration file::
445
446 INHERIT += "create-spdx"
447
448The toplevel :term:`SPDX` output file is generated in JSON format as a
449``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the
450:term:`Build Directory`. There are other related files in the same directory,
451as well as in ``tmp/deploy/spdx``.
452
453The exact behaviour of this class, and the amount of output can be controlled
454by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`,
455:term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables.
456
457See the description of these variables and the
Andrew Geissler517393d2023-01-13 08:55:19 -0600458":ref:`dev-manual/sbom:creating a software bill of materials`"
Patrick Williams7784c422022-11-17 07:29:11 -0600459section in the Yocto Project Development Manual for more details.
Patrick Williams975a06f2022-10-21 14:42:47 -0500460
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500461.. _ref-classes-cross:
462
Andrew Geissler517393d2023-01-13 08:55:19 -0600463``cross``
464=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500465
Andrew Geissler517393d2023-01-13 08:55:19 -0600466The :ref:`ref-classes-cross` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500467cross-compilation tools.
468
469.. _ref-classes-cross-canadian:
470
Andrew Geissler517393d2023-01-13 08:55:19 -0600471``cross-canadian``
472==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500473
Andrew Geissler517393d2023-01-13 08:55:19 -0600474The :ref:`ref-classes-cross-canadian` class provides support for the recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500475the Canadian Cross-compilation tools for SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600476":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500477section in the Yocto Project Overview and Concepts Manual for more
478discussion on these cross-compilation tools.
479
480.. _ref-classes-crosssdk:
481
Andrew Geissler517393d2023-01-13 08:55:19 -0600482``crosssdk``
483============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500484
Andrew Geissler517393d2023-01-13 08:55:19 -0600485The :ref:`ref-classes-crosssdk` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500486cross-compilation tools used for building SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600487":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500488section in the Yocto Project Overview and Concepts Manual for more
489discussion on these cross-compilation tools.
490
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500491.. _ref-classes-cve-check:
492
Andrew Geissler517393d2023-01-13 08:55:19 -0600493``cve-check``
494=============
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500495
Andrew Geissler517393d2023-01-13 08:55:19 -0600496The :ref:`ref-classes-cve-check` class looks for known CVEs (Common Vulnerabilities
Patrick Williams2390b1b2022-11-03 13:47:49 -0500497and Exposures) while building with BitBake. This class is meant to be
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500498inherited globally from a configuration file::
499
500 INHERIT += "cve-check"
501
Patrick Williams2390b1b2022-11-03 13:47:49 -0500502To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
503add following line to the build configuration file::
504
505 include cve-extra-exclusions.inc
506
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500507You can also look for vulnerabilities in specific packages by passing
Patrick Williams2390b1b2022-11-03 13:47:49 -0500508``-c cve_check`` to BitBake.
509
510After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
511and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files.
512
513When building, the CVE checker will emit build time warnings for any detected
514issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
515and version being compiled and no patches to address the issue are applied. Other states
516for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
517applied, and ``Ignored`` meaning that the issue can be ignored.
518
519The ``Patched`` state of a CVE issue is detected from patch files with the format
520``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
521CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
522
Patrick Williams2a254922023-08-11 09:48:11 -0500523If the recipe adds ``CVE-ID`` as flag of the :term:`CVE_STATUS` variable with status
524mapped to ``Ignored``, then the CVE state is reported as ``Ignored``::
Patrick Williams2390b1b2022-11-03 13:47:49 -0500525
Patrick Williams2a254922023-08-11 09:48:11 -0500526 CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows"
Patrick Williams2390b1b2022-11-03 13:47:49 -0500527
528If CVE check reports that a recipe contains false positives or false negatives, these may be
529fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables.
530:term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE
531database vendor and product pairs using the syntax::
532
533 CVE_PRODUCT = "flex_project:flex"
534
535where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
536if the default recipe version :term:`PV` does not match the version numbers of the software component
537in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
538CVE database compatible version number, for example::
539
540 CVE_VERSION = "2.39"
541
542Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
543via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
544
545Users should note that security is a process, not a product, and thus also CVE checking, analyzing results,
546patching and updating the software should be done as a regular process. The data and assumptions
547required for CVE checker to reliably detect issues are frequently broken in various ways.
548These can only be detected by reviewing the details of the issues and iterating over the generated reports,
549and following what happens in other Linux distributions and in the greater open source community.
550
551You will find some more details in the
Andrew Geissler517393d2023-01-13 08:55:19 -0600552":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500553section in the Development Tasks Manual.
554
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500555.. _ref-classes-debian:
556
Andrew Geissler517393d2023-01-13 08:55:19 -0600557``debian``
558==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500559
Andrew Geissler517393d2023-01-13 08:55:19 -0600560The :ref:`ref-classes-debian` class renames output packages so that they follow the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500561Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
562``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
563name and version as part of the package name.
564
565If a recipe creates packages for multiple libraries (shared object files
566of ``.so`` type), use the :term:`LEAD_SONAME`
567variable in the recipe to specify the library on which to apply the
568naming scheme.
569
570.. _ref-classes-deploy:
571
Andrew Geissler517393d2023-01-13 08:55:19 -0600572``deploy``
573==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500574
Andrew Geissler517393d2023-01-13 08:55:19 -0600575The :ref:`ref-classes-deploy` class handles deploying files to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500576:term:`DEPLOY_DIR_IMAGE` directory. The main
577function of this class is to allow the deploy step to be accelerated by
578shared state. Recipes that inherit this class should define their own
579:ref:`ref-tasks-deploy` function to copy the files to be
580deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
581add the task at the appropriate place, which is usually after
582:ref:`ref-tasks-compile` or
583:ref:`ref-tasks-install`. The class then takes care of
Andrew Geissler09036742021-06-25 14:25:14 -0500584staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500585
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500586.. _ref-classes-devicetree:
587
588``devicetree``
589==============
590
591The :ref:`ref-classes-devicetree` class allows to build a recipe that compiles
592device tree source files that are not in the kernel tree.
593
594The compilation of out-of-tree device tree sources is the same as the kernel
595in-tree device tree compilation process. This includes the ability to include
596sources from the kernel such as SoC ``dtsi`` files as well as C header files,
597such as ``gpio.h``.
598
599The :ref:`ref-tasks-compile` task will compile two kinds of files:
600
601- Regular device tree sources with a ``.dts`` extension.
602
603- Device tree overlays, detected from the presence of the ``/plugin/;``
604 string in the file contents.
605
Patrick Williams520786c2023-06-25 16:20:36 -0500606This class deploys the generated device tree binaries into
607``${``\ :term:`DEPLOY_DIR_IMAGE`\ ``}/devicetree/``. This is similar to
608what the :ref:`ref-classes-kernel-devicetree` class does, with the added
609``devicetree`` subdirectory to avoid name clashes. Additionally, the device
610trees are populated into the sysroot for access via the sysroot from within
611other recipes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500612
Patrick Williamsb542dec2023-06-09 01:26:37 -0500613By default, all device tree sources located in :term:`DT_FILES_PATH` directory
614are compiled. To select only particular sources, set :term:`DT_FILES` to
615a space-separated list of files (relative to :term:`DT_FILES_PATH`). For
616convenience, both ``.dts`` and ``.dtb`` extensions can be used.
617
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500618An extra padding is appended to non-overlay device trees binaries. This
619can typically be used as extra space for adding extra properties at boot time.
Patrick Williamsb542dec2023-06-09 01:26:37 -0500620The padding size can be modified by setting :term:`DT_PADDING_SIZE`
621to the desired size, in bytes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500622
623See :oe_git:`devicetree.bbclass sources
624</openembedded-core/tree/meta/classes-recipe/devicetree.bbclass>`
625for further variables controlling this class.
626
627Here is an excerpt of an example ``recipes-kernel/linux/devicetree-acme.bb``
628recipe inheriting this class::
629
630 inherit devicetree
631 COMPATIBLE_MACHINE = "^mymachine$"
632 SRC_URI:mymachine = "file://mymachine.dts"
633
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500634.. _ref-classes-devshell:
635
Andrew Geissler517393d2023-01-13 08:55:19 -0600636``devshell``
637============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500638
Andrew Geissler517393d2023-01-13 08:55:19 -0600639The :ref:`ref-classes-devshell` class adds the :ref:`ref-tasks-devshell` task. Distribution
640policy dictates whether to include this class. See the ":ref:`dev-manual/development-shell:using a development shell`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500641section in the Yocto Project Development Tasks Manual for more
Andrew Geissler517393d2023-01-13 08:55:19 -0600642information about using :ref:`ref-classes-devshell`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500643
644.. _ref-classes-devupstream:
645
Andrew Geissler517393d2023-01-13 08:55:19 -0600646``devupstream``
647===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500648
Andrew Geissler517393d2023-01-13 08:55:19 -0600649The :ref:`ref-classes-devupstream` class uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500650:term:`BBCLASSEXTEND` to add a variant of the
651recipe that fetches from an alternative URI (e.g. Git) instead of a
Andrew Geisslerc926e172021-05-07 16:11:35 -0500652tarball. Following is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500653
654 BBCLASSEXTEND = "devupstream:target"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000655 SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500656 SRCREV:class-devupstream = "abcd1234"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500657
658Adding the above statements to your recipe creates a variant that has
659:term:`DEFAULT_PREFERENCE` set to "-1".
660Consequently, you need to select the variant of the recipe to use it.
661Any development-specific adjustments can be done by using the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500662``class-devupstream`` override. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500663
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500664 DEPENDS:append:class-devupstream = " gperf-native"
665 do_configure:prepend:class-devupstream() {
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500666 touch ${S}/README
667 }
668
669The class
670currently only supports creating a development variant of the target
Andrew Geissler517393d2023-01-13 08:55:19 -0600671recipe, not :ref:`ref-classes-native` or :ref:`ref-classes-nativesdk` variants.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500672
Andrew Geissler09036742021-06-25 14:25:14 -0500673The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
Andrew Geissler517393d2023-01-13 08:55:19 -0600674support for :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` variants. Consequently, this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500675functionality can be added in a future release.
676
677Support for other version control systems such as Subversion is limited
678due to BitBake's automatic fetch dependencies (e.g.
679``subversion-native``).
680
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500681.. _ref-classes-externalsrc:
682
Andrew Geissler517393d2023-01-13 08:55:19 -0600683``externalsrc``
684===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500685
Andrew Geissler517393d2023-01-13 08:55:19 -0600686The :ref:`ref-classes-externalsrc` class supports building software from source code
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500687that is external to the OpenEmbedded build system. Building software
688from an external source tree means that the build system's normal fetch,
689unpack, and patch process is not used.
690
691By default, the OpenEmbedded build system uses the :term:`S`
692and :term:`B` variables to locate unpacked recipe source code
693and to build it, respectively. When your recipe inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -0600694:ref:`ref-classes-externalsrc` class, you use the
695:term:`EXTERNALSRC` and :term:`EXTERNALSRC_BUILD` variables to
Andrew Geissler09036742021-06-25 14:25:14 -0500696ultimately define :term:`S` and :term:`B`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500697
698By default, this class expects the source code to support recipe builds
699that use the :term:`B` variable to point to the directory in
700which the OpenEmbedded build system places the generated objects built
Andrew Geissler09036742021-06-25 14:25:14 -0500701from the recipes. By default, the :term:`B` directory is set to the
702following, which is separate from the source directory (:term:`S`)::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500703
Andrew Geissler5199d832021-09-24 16:47:35 -0500704 ${WORKDIR}/${BPN}-{PV}/
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500705
706See these variables for more information:
707:term:`WORKDIR`, :term:`BPN`, and
708:term:`PV`,
709
Andrew Geissler517393d2023-01-13 08:55:19 -0600710For more information on the :ref:`ref-classes-externalsrc` class, see the comments in
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500711``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
Andrew Geissler517393d2023-01-13 08:55:19 -0600712For information on how to use the :ref:`ref-classes-externalsrc` class, see the
713":ref:`dev-manual/building:building software from an external source`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500714section in the Yocto Project Development Tasks Manual.
715
716.. _ref-classes-extrausers:
717
Andrew Geissler517393d2023-01-13 08:55:19 -0600718``extrausers``
719==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500720
Andrew Geissler517393d2023-01-13 08:55:19 -0600721The :ref:`ref-classes-extrausers` class allows additional user and group configuration
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500722to be applied at the image level. Inheriting this class either globally
723or from an image recipe allows additional user and group operations to
724be performed using the
725:term:`EXTRA_USERS_PARAMS` variable.
726
727.. note::
728
Andrew Geissler517393d2023-01-13 08:55:19 -0600729 The user and group operations added using the :ref:`ref-classes-extrausers`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500730 class are not tied to a specific recipe outside of the recipe for the
731 image. Thus, the operations can be performed across the image as a
Andrew Geissler517393d2023-01-13 08:55:19 -0600732 whole. Use the :ref:`ref-classes-useradd` class to add user and group
733 configuration to a specific recipe.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500734
Andrew Geisslerc926e172021-05-07 16:11:35 -0500735Here is an example that uses this class in an image recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500736
737 inherit extrausers
738 EXTRA_USERS_PARAMS = "\
739 useradd -p '' tester; \
740 groupadd developers; \
741 userdel nobody; \
742 groupdel -g video; \
743 groupmod -g 1020 developers; \
744 usermod -s /bin/sh tester; \
745 "
746
747Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
Andrew Geissler9aee5002022-03-30 16:27:02 +0000748passwords. First on host, create the (escaped) password hash::
Andrew Geisslereff27472021-10-29 15:35:00 -0500749
Andrew Geissler9aee5002022-03-30 16:27:02 +0000750 printf "%q" $(mkpasswd -m sha256crypt tester01)
Andrew Geisslereff27472021-10-29 15:35:00 -0500751
Andrew Geissler9aee5002022-03-30 16:27:02 +0000752The resulting hash is set to a variable and used in ``useradd`` command parameters::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500753
754 inherit extrausers
Andrew Geisslereff27472021-10-29 15:35:00 -0500755 PASSWD = "\$X\$ABC123\$A-Long-Hash"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500756 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500757 useradd -p '${PASSWD}' tester-jim; \
758 useradd -p '${PASSWD}' tester-sue; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500759 "
760
Andrew Geisslereff27472021-10-29 15:35:00 -0500761Finally, here is an example that sets the root password::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500762
763 inherit extrausers
764 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500765 usermod -p '${PASSWD}' root; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500766 "
767
Patrick Williams03907ee2022-05-01 06:28:52 -0500768.. note::
769
770 From a security perspective, hardcoding a default password is not
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500771 generally a good idea or even legal in some jurisdictions. It is
772 recommended that you do not do this if you are building a production
Patrick Williams03907ee2022-05-01 06:28:52 -0500773 image.
774
775
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600776.. _ref-classes-features_check:
777
Andrew Geissler517393d2023-01-13 08:55:19 -0600778``features_check``
779==================
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600780
Andrew Geissler517393d2023-01-13 08:55:19 -0600781The :ref:`ref-classes-features_check` class allows individual recipes to check
782for required and conflicting :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES`
783or :term:`COMBINED_FEATURES`.
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600784
785This class provides support for the following variables:
786
787- :term:`REQUIRED_DISTRO_FEATURES`
788- :term:`CONFLICT_DISTRO_FEATURES`
789- :term:`ANY_OF_DISTRO_FEATURES`
790- ``REQUIRED_MACHINE_FEATURES``
791- ``CONFLICT_MACHINE_FEATURES``
792- ``ANY_OF_MACHINE_FEATURES``
793- ``REQUIRED_COMBINED_FEATURES``
794- ``CONFLICT_COMBINED_FEATURES``
795- ``ANY_OF_COMBINED_FEATURES``
796
797If any conditions specified in the recipe using the above
798variables are not met, the recipe will be skipped, and if the
799build system attempts to build the recipe then an error will be
800triggered.
801
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500802.. _ref-classes-fontcache:
803
Andrew Geissler517393d2023-01-13 08:55:19 -0600804``fontcache``
805=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500806
Andrew Geissler517393d2023-01-13 08:55:19 -0600807The :ref:`ref-classes-fontcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500808post-remove (postinst and postrm) scriptlets for font packages. These
809scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
810to the font information cache. Since the cache files are
811architecture-specific, ``fc-cache`` runs using QEMU if the postinst
812scriptlets need to be run on the build host during image creation.
813
814If the fonts being installed are in packages other than the main
815package, set :term:`FONT_PACKAGES` to specify the
816packages containing the fonts.
817
818.. _ref-classes-fs-uuid:
819
Andrew Geissler517393d2023-01-13 08:55:19 -0600820``fs-uuid``
821===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500822
Andrew Geissler517393d2023-01-13 08:55:19 -0600823The :ref:`ref-classes-fs-uuid` class extracts UUID from
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500824``${``\ :term:`ROOTFS`\ ``}``, which must have been built
Andrew Geissler517393d2023-01-13 08:55:19 -0600825by the time that this function gets called. The :ref:`ref-classes-fs-uuid` class only
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500826works on ``ext`` file systems and depends on ``tune2fs``.
827
828.. _ref-classes-gconf:
829
Andrew Geissler517393d2023-01-13 08:55:19 -0600830``gconf``
831=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500832
Andrew Geissler517393d2023-01-13 08:55:19 -0600833The :ref:`ref-classes-gconf` class provides common functionality for recipes that need
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500834to install GConf schemas. The schemas will be put into a separate
835package (``${``\ :term:`PN`\ ``}-gconf``) that is created
836automatically when this class is inherited. This package uses the
837appropriate post-install and post-remove (postinst/postrm) scriptlets to
838register and unregister the schemas in the target image.
839
840.. _ref-classes-gettext:
841
Andrew Geissler517393d2023-01-13 08:55:19 -0600842``gettext``
843===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500844
Andrew Geissler517393d2023-01-13 08:55:19 -0600845The :ref:`ref-classes-gettext` class provides support for building
846software that uses the GNU ``gettext`` internationalization and localization
847system. All recipes building software that use ``gettext`` should inherit this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500848class.
849
Patrick Williams975a06f2022-10-21 14:42:47 -0500850.. _ref-classes-github-releases:
851
Andrew Geissler517393d2023-01-13 08:55:19 -0600852``github-releases``
853===================
Patrick Williams975a06f2022-10-21 14:42:47 -0500854
Andrew Geissler517393d2023-01-13 08:55:19 -0600855For recipes that fetch release tarballs from github, the :ref:`ref-classes-github-releases`
Patrick Williams975a06f2022-10-21 14:42:47 -0500856class sets up a standard way for checking available upstream versions
857(to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)).
858
Andrew Geissler517393d2023-01-13 08:55:19 -0600859To use it, add ":ref:`ref-classes-github-releases`" to the inherit line in the recipe,
Patrick Williams975a06f2022-10-21 14:42:47 -0500860and if the default value of :term:`GITHUB_BASE_URI` is not suitable,
861then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}``
862in the value you set for :term:`SRC_URI` within the recipe.
863
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500864.. _ref-classes-gnomebase:
865
Andrew Geissler517393d2023-01-13 08:55:19 -0600866``gnomebase``
867=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500868
Andrew Geissler517393d2023-01-13 08:55:19 -0600869The :ref:`ref-classes-gnomebase` class is the base class for recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500870software from the GNOME stack. This class sets
871:term:`SRC_URI` to download the source from the GNOME
872mirrors as well as extending :term:`FILES` with the typical
873GNOME installation paths.
874
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600875.. _ref-classes-go:
876
877``go``
878======
879
880The :ref:`ref-classes-go` class supports building Go programs. The behavior of
881this class is controlled by the mandatory :term:`GO_IMPORT` variable, and
882by the optional :term:`GO_INSTALL` and :term:`GO_INSTALL_FILTEROUT` ones.
883
884To build a Go program with the Yocto Project, you can use the
885:yocto_git:`go-helloworld_0.1.bb </poky/tree/meta/recipes-extended/go-examples/go-helloworld_0.1.bb>`
886recipe as an example.
887
888.. _ref-classes-go-mod:
889
890``go-mod``
891==========
892
893The :ref:`ref-classes-go-mod` class allows to use Go modules, and inherits the
894:ref:`ref-classes-go` class.
895
896See the associated :term:`GO_WORKDIR` variable.
897
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500898.. _ref-classes-gobject-introspection:
899
Andrew Geissler517393d2023-01-13 08:55:19 -0600900``gobject-introspection``
901=========================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500902
903Provides support for recipes building software that supports GObject
904introspection. This functionality is only enabled if the
905"gobject-introspection-data" feature is in
906:term:`DISTRO_FEATURES` as well as
907"qemu-usermode" being in
908:term:`MACHINE_FEATURES`.
909
910.. note::
911
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500912 This functionality is :ref:`backfilled <ref-features-backfill>` by default
913 and, if not applicable, should be disabled through
914 :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
Andrew Geissler09036742021-06-25 14:25:14 -0500915 :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500916
917.. _ref-classes-grub-efi:
918
Andrew Geissler517393d2023-01-13 08:55:19 -0600919``grub-efi``
920============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500921
Andrew Geissler517393d2023-01-13 08:55:19 -0600922The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500923building bootable images.
924
925This class supports several variables:
926
927- :term:`INITRD`: Indicates list of filesystem images to
928 concatenate and use as an initial RAM disk (initrd) (optional).
929
930- :term:`ROOTFS`: Indicates a filesystem image to include
931 as the root filesystem (optional).
932
933- :term:`GRUB_GFXSERIAL`: Set this to "1" to have
934 graphics and serial in the boot menu.
935
936- :term:`LABELS`: A list of targets for the automatic
937 configuration.
938
939- :term:`APPEND`: An override list of append strings for
940 each ``LABEL``.
941
942- :term:`GRUB_OPTS`: Additional options to add to the
943 configuration (optional). Options are delimited using semi-colon
944 characters (``;``).
945
946- :term:`GRUB_TIMEOUT`: Timeout before executing
947 the default ``LABEL`` (optional).
948
949.. _ref-classes-gsettings:
950
Andrew Geissler517393d2023-01-13 08:55:19 -0600951``gsettings``
952=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500953
Andrew Geissler517393d2023-01-13 08:55:19 -0600954The :ref:`ref-classes-gsettings` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500955need to install GSettings (glib) schemas. The schemas are assumed to be
956part of the main package. Appropriate post-install and post-remove
957(postinst/postrm) scriptlets are added to register and unregister the
958schemas in the target image.
959
960.. _ref-classes-gtk-doc:
961
Andrew Geissler517393d2023-01-13 08:55:19 -0600962``gtk-doc``
963===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500964
Andrew Geissler517393d2023-01-13 08:55:19 -0600965The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500966``gtk-doc`` dependencies and disable ``gtk-doc``.
967
968.. _ref-classes-gtk-icon-cache:
969
Andrew Geissler517393d2023-01-13 08:55:19 -0600970``gtk-icon-cache``
971==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500972
Andrew Geissler517393d2023-01-13 08:55:19 -0600973The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500974post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
975install icons. These scriptlets call ``gtk-update-icon-cache`` to add
976the fonts to GTK+'s icon cache. Since the cache files are
977architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
978the postinst scriptlets need to be run on the build host during image
979creation.
980
981.. _ref-classes-gtk-immodules-cache:
982
Andrew Geissler517393d2023-01-13 08:55:19 -0600983``gtk-immodules-cache``
984=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500985
Andrew Geissler517393d2023-01-13 08:55:19 -0600986The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500987post-remove (postinst/postrm) scriptlets for packages that install GTK+
988input method modules for virtual keyboards. These scriptlets call
989``gtk-update-icon-cache`` to add the input method modules to the cache.
990Since the cache files are architecture-specific,
991``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
992need to be run on the build host during image creation.
993
994If the input method modules being installed are in packages other than
995the main package, set
996:term:`GTKIMMODULES_PACKAGES` to specify
997the packages containing the modules.
998
999.. _ref-classes-gzipnative:
1000
Andrew Geissler517393d2023-01-13 08:55:19 -06001001``gzipnative``
1002==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001003
Andrew Geissler517393d2023-01-13 08:55:19 -06001004The :ref:`ref-classes-gzipnative` class enables the use of different native versions of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001005``gzip`` and ``pigz`` rather than the versions of these tools from the
1006build host.
1007
1008.. _ref-classes-icecc:
1009
Andrew Geissler517393d2023-01-13 08:55:19 -06001010``icecc``
1011=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001012
Andrew Geissler517393d2023-01-13 08:55:19 -06001013The :ref:`ref-classes-icecc` class supports
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001014`Icecream <https://github.com/icecc/icecream>`__, which facilitates
1015taking compile jobs and distributing them among remote machines.
1016
1017The class stages directories with symlinks from ``gcc`` and ``g++`` to
1018``icecc``, for both native and cross compilers. Depending on each
1019configure or compile, the OpenEmbedded build system adds the directories
1020at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001021``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001022compilers, respectively.
1023
1024For the cross compiler, the class creates a ``tar.gz`` file that
1025contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
1026is the version of the cross-compiler used in the cross-development
1027toolchain, accordingly.
1028
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001029The class handles all three different compile stages (i.e native,
1030cross-kernel and target) and creates the necessary environment
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001031``tar.gz`` file to be used by the remote machines. The class also
1032supports SDK generation.
1033
1034If :term:`ICECC_PATH` is not set in your
1035``local.conf`` file, then the class tries to locate the ``icecc`` binary
1036using ``which``. If :term:`ICECC_ENV_EXEC` is set
1037in your ``local.conf`` file, the variable should point to the
1038``icecc-create-env`` script provided by the user. If you do not point to
1039a user-provided script, the build system uses the default script
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001040provided by the recipe :oe_git:`icecc-create-env_0.1.bb
1041</openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001042
1043.. note::
1044
1045 This script is a modified version and not the one that comes with
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001046 ``icecream``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001047
1048If you do not want the Icecream distributed compile support to apply to
Andrew Geissler595f6302022-01-24 19:11:47 +00001049specific recipes or classes, you can ask them to be ignored by Icecream
1050by listing the recipes and classes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001051:term:`ICECC_RECIPE_DISABLE` and
1052:term:`ICECC_CLASS_DISABLE` variables,
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001053respectively, in your ``local.conf`` file. Doing so causes the
1054OpenEmbedded build system to handle these compilations locally.
1055
1056Additionally, you can list recipes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001057:term:`ICECC_RECIPE_ENABLE` variable in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001058your ``local.conf`` file to force ``icecc`` to be enabled for recipes
1059using an empty :term:`PARALLEL_MAKE` variable.
1060
Andrew Geissler517393d2023-01-13 08:55:19 -06001061Inheriting the :ref:`ref-classes-icecc` class changes all sstate signatures.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001062Consequently, if a development team has a dedicated build system that
1063populates :term:`SSTATE_MIRRORS` and they want to
Andrew Geissler09036742021-06-25 14:25:14 -05001064reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
Andrew Geissler517393d2023-01-13 08:55:19 -06001065system need to either inherit the :ref:`ref-classes-icecc` class or nobody should.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001066
Andrew Geissler517393d2023-01-13 08:55:19 -06001067At the distribution level, you can inherit the :ref:`ref-classes-icecc` class to be
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001068sure that all builders start with the same sstate signatures. After
1069inheriting the class, you can then disable the feature by setting the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001070:term:`ICECC_DISABLED` variable to "1" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001071
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001072 INHERIT_DISTRO:append = " icecc"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001073 ICECC_DISABLED ??= "1"
1074
1075This practice
1076makes sure everyone is using the same signatures but also requires
1077individuals that do want to use Icecream to enable the feature
Andrew Geisslerc926e172021-05-07 16:11:35 -05001078individually as follows in your ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001079
1080 ICECC_DISABLED = ""
1081
1082.. _ref-classes-image:
1083
Andrew Geissler517393d2023-01-13 08:55:19 -06001084``image``
1085=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001086
Andrew Geissler517393d2023-01-13 08:55:19 -06001087The :ref:`ref-classes-image` class helps support creating images in different formats.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001088First, the root filesystem is created from packages using one of the
1089``rootfs*.bbclass`` files (depending on the package format used) and
1090then one or more image files are created.
1091
Andrew Geissler09036742021-06-25 14:25:14 -05001092- The :term:`IMAGE_FSTYPES` variable controls the types of images to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001093 generate.
1094
Andrew Geissler09036742021-06-25 14:25:14 -05001095- The :term:`IMAGE_INSTALL` variable controls the list of packages to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001096 install into the image.
1097
1098For information on customizing images, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001099":ref:`dev-manual/customizing-images:customizing images`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001100in the Yocto Project Development Tasks Manual. For information on how
1101images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001102":ref:`overview-manual/concepts:images`" section in the
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001103Yocto Project Overview and Concepts Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001104
1105.. _ref-classes-image-buildinfo:
1106
Andrew Geissler517393d2023-01-13 08:55:19 -06001107``image-buildinfo``
1108===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001109
Andrew Geissler517393d2023-01-13 08:55:19 -06001110The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing
Patrick Williams975a06f2022-10-21 14:42:47 -05001111build information to the target filesystem at ``${sysconfdir}/buildinfo``
Patrick Williams7784c422022-11-17 07:29:11 -06001112by default (as specified by :term:`IMAGE_BUILDINFO_FILE`).
Patrick Williams975a06f2022-10-21 14:42:47 -05001113This can be useful for manually determining the origin of any given
1114image. It writes out two sections:
1115
Andrew Geissler517393d2023-01-13 08:55:19 -06001116#. `Build Configuration`: a list of variables and their values (specified
Patrick Williams975a06f2022-10-21 14:42:47 -05001117 by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and
1118 :term:`DISTRO_VERSION`)
1119
Andrew Geissler517393d2023-01-13 08:55:19 -06001120#. `Layer Revisions`: the revisions of all of the layers used in the
Patrick Williams975a06f2022-10-21 14:42:47 -05001121 build.
1122
1123Additionally, when building an SDK it will write the same contents
1124to ``/buildinfo`` by default (as specified by
1125:term:`SDK_BUILDINFO_FILE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001126
1127.. _ref-classes-image_types:
1128
Andrew Geissler517393d2023-01-13 08:55:19 -06001129``image_types``
1130===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001131
Andrew Geissler517393d2023-01-13 08:55:19 -06001132The :ref:`ref-classes-image_types` class defines all of the standard image output types
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001133that you can enable through the
1134:term:`IMAGE_FSTYPES` variable. You can use this
1135class as a reference on how to add support for custom image output
1136types.
1137
Andrew Geissler517393d2023-01-13 08:55:19 -06001138By default, the :ref:`ref-classes-image` class automatically
1139enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001140``IMGCLASSES`` variable as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001141
1142 IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
1143 IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
1144 IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
1145 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
1146 IMGCLASSES += "image_types_wic"
1147 IMGCLASSES += "rootfs-postcommands"
1148 IMGCLASSES += "image-postinst-intercepts"
1149 inherit ${IMGCLASSES}
1150
Andrew Geissler517393d2023-01-13 08:55:19 -06001151The :ref:`ref-classes-image_types` class also handles conversion and compression of images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001152
1153.. note::
1154
1155 To build a VMware VMDK image, you need to add "wic.vmdk" to
Andrew Geissler09036742021-06-25 14:25:14 -05001156 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001157 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001158
1159.. _ref-classes-image-live:
1160
Andrew Geissler517393d2023-01-13 08:55:19 -06001161``image-live``
1162==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001163
1164This class controls building "live" (i.e. HDDIMG and ISO) images. Live
1165images contain syslinux for legacy booting, as well as the bootloader
1166specified by :term:`EFI_PROVIDER` if
1167:term:`MACHINE_FEATURES` contains "efi".
1168
1169Normally, you do not use this class directly. Instead, you add "live" to
1170:term:`IMAGE_FSTYPES`.
1171
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001172.. _ref-classes-insane:
1173
Andrew Geissler517393d2023-01-13 08:55:19 -06001174``insane``
1175==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001176
Andrew Geissler517393d2023-01-13 08:55:19 -06001177The :ref:`ref-classes-insane` class adds a step to the package generation process so
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001178that output quality assurance checks are generated by the OpenEmbedded
1179build system. A range of checks are performed that check the build's
1180output for common problems that show up during runtime. Distribution
1181policy usually dictates whether to include this class.
1182
1183You can configure the sanity checks so that specific test failures
1184either raise a warning or an error message. Typically, failures for new
1185tests generate a warning. Subsequent failures for the same test would
1186then generate an error message once the metadata is in a known and good
Andrew Geissler09209ee2020-12-13 08:44:15 -06001187condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001188and error messages you might encounter using a default configuration.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001189
1190Use the :term:`WARN_QA` and
1191:term:`ERROR_QA` variables to control the behavior of
1192these checks at the global level (i.e. in your custom distro
1193configuration). However, to skip one or more checks in recipes, you
1194should use :term:`INSANE_SKIP`. For example, to skip
1195the check for symbolic link ``.so`` files in the main package of a
1196recipe, add the following to the recipe. You need to realize that the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001197package name override, in this example ``${PN}``, must be used::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001198
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001199 INSANE_SKIP:${PN} += "dev-so"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001200
1201Please keep in mind that the QA checks
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001202are meant to detect real or potential problems in the packaged
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001203output. So exercise caution when disabling these checks.
1204
Andrew Geissler09036742021-06-25 14:25:14 -05001205Here are the tests you can list with the :term:`WARN_QA` and
Andrew Geissler5f350902021-07-23 13:09:54 -04001206:term:`ERROR_QA` variables:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001207
1208- ``already-stripped:`` Checks that produced binaries have not
1209 already been stripped prior to the build system extracting debug
1210 symbols. It is common for upstream software projects to default to
1211 stripping debug symbols for output binaries. In order for debugging
1212 to work on the target using ``-dbg`` packages, this stripping must be
1213 disabled.
1214
1215- ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1216 size, and endianness of any binaries to ensure they match the target
1217 architecture. This test fails if any binaries do not match the type
1218 since there would be an incompatibility. The test could indicate that
1219 the wrong compiler or compiler options have been used. Sometimes
1220 software, like bootloaders, might need to bypass this check.
1221
1222- ``buildpaths:`` Checks for paths to locations on the build host
Patrick Williams975a06f2022-10-21 14:42:47 -05001223 inside the output files. Not only can these leak information about
1224 the build environment, they also hinder binary reproducibility.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001225
1226- ``build-deps:`` Determines if a build-time dependency that is
1227 specified through :term:`DEPENDS`, explicit
1228 :term:`RDEPENDS`, or task-level dependencies exists
1229 to match any runtime dependency. This determination is particularly
1230 useful to discover where runtime dependencies are detected and added
1231 during packaging. If no explicit dependency has been specified within
1232 the metadata, at the packaging stage it is too late to ensure that
1233 the dependency is built, and thus you can end up with an error when
1234 the package is installed into the image during the
1235 :ref:`ref-tasks-rootfs` task because the auto-detected
1236 dependency was not satisfied. An example of this would be where the
Andrew Geissler517393d2023-01-13 08:55:19 -06001237 :ref:`ref-classes-update-rc.d` class automatically
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001238 adds a dependency on the ``initscripts-functions`` package to
1239 packages that install an initscript that refers to
1240 ``/etc/init.d/functions``. The recipe should really have an explicit
Andrew Geissler5f350902021-07-23 13:09:54 -04001241 :term:`RDEPENDS` for the package in question on ``initscripts-functions``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001242 so that the OpenEmbedded build system is able to ensure that the
1243 ``initscripts`` recipe is actually built and thus the
1244 ``initscripts-functions`` package is made available.
1245
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001246- ``configure-gettext:`` Checks that if a recipe is building something
1247 that uses automake and the automake files contain an ``AM_GNU_GETTEXT``
1248 directive, that the recipe also inherits the :ref:`ref-classes-gettext`
1249 class to ensure that gettext is available during the build.
1250
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001251- ``compile-host-path:`` Checks the
1252 :ref:`ref-tasks-compile` log for indications that
1253 paths to locations on the build host were used. Using such paths
1254 might result in host contamination of the build output.
1255
1256- ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1257 do not depend on ``-dbg`` packages, which would cause a packaging
1258 bug.
1259
1260- ``debug-files:`` Checks for ``.debug`` directories in anything but
1261 the ``-dbg`` package. The debug files should all be in the ``-dbg``
1262 package. Thus, anything packaged elsewhere is incorrect packaging.
1263
1264- ``dep-cmp:`` Checks for invalid version comparison statements in
1265 runtime dependency relationships between packages (i.e. in
1266 :term:`RDEPENDS`,
1267 :term:`RRECOMMENDS`,
1268 :term:`RSUGGESTS`,
1269 :term:`RPROVIDES`,
1270 :term:`RREPLACES`, and
1271 :term:`RCONFLICTS` variable values). Any invalid
1272 comparisons might trigger failures or undesirable behavior when
1273 passed to the package manager.
1274
1275- ``desktop:`` Runs the ``desktop-file-validate`` program against any
1276 ``.desktop`` files to validate their contents against the
1277 specification for ``.desktop`` files.
1278
1279- ``dev-deps:`` Checks that all packages except ``-dev`` or
1280 ``-staticdev`` packages do not depend on ``-dev`` packages, which
1281 would be a packaging bug.
1282
1283- ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1284 ``-dev`` package and not in any of the other packages. In general,
1285 these symlinks are only useful for development purposes. Thus, the
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001286 ``-dev`` package is the correct location for them. In very rare
1287 cases, such as dynamically loaded modules, these symlinks
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001288 are needed instead in the main package.
1289
Patrick Williams03907ee2022-05-01 06:28:52 -05001290- ``empty-dirs:`` Checks that packages are not installing files to
1291 directories that are normally expected to be empty (such as ``/tmp``)
1292 The list of directories that are checked is specified by the
1293 :term:`QA_EMPTY_DIRS` variable.
1294
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001295- ``file-rdeps:`` Checks that file-level dependencies identified by
1296 the OpenEmbedded build system at packaging time are satisfied. For
1297 example, a shell script might start with the line ``#!/bin/bash``.
1298 This line would translate to a file dependency on ``/bin/bash``. Of
1299 the three package managers that the OpenEmbedded build system
1300 supports, only RPM directly handles file-level dependencies,
1301 resolving them automatically to packages providing the files.
1302 However, the lack of that functionality in the other two package
1303 managers does not mean the dependencies do not still need resolving.
1304 This QA check attempts to ensure that explicitly declared
1305 :term:`RDEPENDS` exist to handle any file-level
1306 dependency detected in packaged files.
1307
1308- ``files-invalid:`` Checks for :term:`FILES` variable
1309 values that contain "//", which is invalid.
1310
1311- ``host-user-contaminated:`` Checks that no package produced by the
1312 recipe contains any files outside of ``/home`` with a user or group
1313 ID that matches the user running BitBake. A match usually indicates
1314 that the files are being installed with an incorrect UID/GID, since
1315 target IDs are independent from host IDs. For additional information,
1316 see the section describing the
1317 :ref:`ref-tasks-install` task.
1318
1319- ``incompatible-license:`` Report when packages are excluded from
1320 being created due to being marked with a license that is in
1321 :term:`INCOMPATIBLE_LICENSE`.
1322
1323- ``install-host-path:`` Checks the
1324 :ref:`ref-tasks-install` log for indications that
1325 paths to locations on the build host were used. Using such paths
1326 might result in host contamination of the build output.
1327
1328- ``installed-vs-shipped:`` Reports when files have been installed
Patrick Williams2194f502022-10-16 14:26:09 -05001329 within :ref:`ref-tasks-install` but have not been included in any package by
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001330 way of the :term:`FILES` variable. Files that do not
1331 appear in any package cannot be present in an image later on in the
1332 build process. Ideally, all installed files should be packaged or not
1333 installed at all. These files can be deleted at the end of
Patrick Williams2194f502022-10-16 14:26:09 -05001334 :ref:`ref-tasks-install` if the files are not needed in any package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001335
1336- ``invalid-chars:`` Checks that the recipe metadata variables
1337 :term:`DESCRIPTION`,
1338 :term:`SUMMARY`, :term:`LICENSE`, and
1339 :term:`SECTION` do not contain non-UTF-8 characters.
1340 Some package managers do not support such characters.
1341
1342- ``invalid-packageconfig:`` Checks that no undefined features are
1343 being added to :term:`PACKAGECONFIG`. For
Andrew Geisslerc926e172021-05-07 16:11:35 -05001344 example, any name "foo" for which the following form does not exist::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001345
1346 PACKAGECONFIG[foo] = "..."
1347
Andrew Geissler09036742021-06-25 14:25:14 -05001348- ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001349 file containing these paths is incorrect since ``libtool`` adds the
1350 correct sysroot prefix when using the files automatically itself.
1351
1352- ``ldflags:`` Ensures that the binaries were linked with the
1353 :term:`LDFLAGS` options provided by the build system.
Andrew Geissler09036742021-06-25 14:25:14 -05001354 If this test fails, check that the :term:`LDFLAGS` variable is being
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001355 passed to the linker command.
1356
1357- ``libdir:`` Checks for libraries being installed into incorrect
1358 (possibly hardcoded) installation paths. For example, this test will
1359 catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1360 "lib32". Another example is when recipes install
1361 ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1362
1363- ``libexec:`` Checks if a package contains files in
1364 ``/usr/libexec``. This check is not performed if the ``libexecdir``
1365 variable has been set explicitly to ``/usr/libexec``.
1366
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001367- ``mime:`` Check that if a package contains mime type files (``.xml``
1368 files in ``${datadir}/mime/packages``) that the recipe also inherits
1369 the :ref:`ref-classes-mime` class in order to ensure that these get
1370 properly installed.
1371
1372- ``mime-xdg:`` Checks that if a package contains a .desktop file with a
1373 'MimeType' key present, that the recipe inherits the
1374 :ref:`ref-classes-mime-xdg` class that is required in order for that
1375 to be activated.
1376
1377- ``missing-update-alternatives:`` Check that if a recipe sets the
1378 :term:`ALTERNATIVE` variable that the recipe also inherits
1379 :ref:`ref-classes-update-alternatives` such that the alternative will
1380 be correctly set up.
1381
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001382- ``packages-list:`` Checks for the same package being listed
1383 multiple times through the :term:`PACKAGES` variable
1384 value. Installing the package in this manner can cause errors during
1385 packaging.
1386
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001387- ``patch-fuzz:`` Checks for fuzz in patch files that may allow
1388 them to apply incorrectly if the underlying code changes.
1389
1390- ``patch-status-core:`` Checks that the Upstream-Status is specified
1391 and valid in the headers of patches for recipes in the OE-Core layer.
1392
1393- ``patch-status-noncore:`` Checks that the Upstream-Status is specified
1394 and valid in the headers of patches for recipes in layers other than
1395 OE-Core.
1396
1397- ``perllocalpod:`` Checks for ``perllocal.pod`` being erroneously
1398 installed and packaged by a recipe.
1399
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001400- ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1401 invalid format.
1402
1403- ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1404 invalid format.
1405
1406- ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1407 'link' where the specified target already exists.
1408
1409- ``perms:`` Currently, this check is unused but reserved.
1410
1411- ``pkgconfig:`` Checks ``.pc`` files for any
1412 :term:`TMPDIR`/:term:`WORKDIR` paths.
1413 Any ``.pc`` file containing these paths is incorrect since
1414 ``pkg-config`` itself adds the correct sysroot prefix when the files
1415 are accessed.
1416
1417- ``pkgname:`` Checks that all packages in
1418 :term:`PACKAGES` have names that do not contain
1419 invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1420 -).
1421
Andrew Geissler09036742021-06-25 14:25:14 -05001422- ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001423 undefined during :ref:`ref-tasks-package`.
1424
1425- ``pkgvarcheck:`` Checks through the variables
1426 :term:`RDEPENDS`,
1427 :term:`RRECOMMENDS`,
1428 :term:`RSUGGESTS`,
1429 :term:`RCONFLICTS`,
1430 :term:`RPROVIDES`,
1431 :term:`RREPLACES`, :term:`FILES`,
1432 :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1433 ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1434 there are variable sets that are not package-specific. Using these
1435 variables without a package suffix is bad practice, and might
1436 unnecessarily complicate dependencies of other packages within the
1437 same recipe or have other unintended consequences.
1438
1439- ``pn-overrides:`` Checks that a recipe does not have a name
1440 (:term:`PN`) value that appears in
1441 :term:`OVERRIDES`. If a recipe is named such that
Andrew Geissler09036742021-06-25 14:25:14 -05001442 its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
1443 :term:`PN` happens to be the same as :term:`MACHINE` or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001444 :term:`DISTRO`), it can have unexpected consequences.
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001445 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001446 turn into ``FILES = "xyz"``.
1447
1448- ``rpaths:`` Checks for rpaths in the binaries that contain build
Andrew Geissler5f350902021-07-23 13:09:54 -04001449 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001450 options are being passed to the linker commands and your binaries
1451 have potential security issues.
1452
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001453- ``shebang-size:`` Check that the shebang line (``#!`` in the first line)
1454 in a packaged script is not longer than 128 characters, which can cause
1455 an error at runtime depending on the operating system.
1456
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001457- ``split-strip:`` Reports that splitting or stripping debug symbols
1458 from binaries has failed.
1459
1460- ``staticdev:`` Checks for static library files (``*.a``) in
1461 non-``staticdev`` packages.
1462
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001463- ``src-uri-bad:`` Checks that the :term:`SRC_URI` value set by a recipe
1464 does not contain a reference to ``${PN}`` (instead of the correct
1465 ``${BPN}``) nor refers to unstable Github archive tarballs.
1466
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001467- ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1468 into :term:`TMPDIR` on the host. Such symlinks will
1469 work on the host, but are clearly invalid when running on the target.
1470
1471- ``textrel:`` Checks for ELF binaries that contain relocations in
1472 their ``.text`` sections, which can result in a performance impact at
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001473 runtime. See the explanation for the ``ELF binary`` message in
Andrew Geissler09209ee2020-12-13 08:44:15 -06001474 ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001475 issues.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001476
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001477- ``unhandled-features-check:`` check that if one of the variables that
1478 the :ref:`ref-classes-features_check` class supports (e.g.
Patrick Williamsb542dec2023-06-09 01:26:37 -05001479 :term:`REQUIRED_DISTRO_FEATURES`) is set by a recipe, then the recipe
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001480 also inherits :ref:`ref-classes-features_check` in order for the
1481 requirement to actually work.
1482
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001483- ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1484 for a package are also declared on the recipe level (i.e. any license
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001485 in ``LICENSE:*`` should appear in :term:`LICENSE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001486
1487- ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1488 in the binaries that by default on a standard system are searched by
1489 the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1490 not cause any breakage, they do waste space and are unnecessary.
1491
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001492- ``usrmerge:`` If ``usrmerge`` is in :term:`DISTRO_FEATURES`, this
1493 check will ensure that no package installs files to root (``/bin``,
1494 ``/sbin``, ``/lib``, ``/lib64``) directories.
1495
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001496- ``var-undefined:`` Reports when variables fundamental to packaging
1497 (i.e. :term:`WORKDIR`,
1498 :term:`DEPLOY_DIR`, :term:`D`,
1499 :term:`PN`, and :term:`PKGD`) are undefined
1500 during :ref:`ref-tasks-package`.
1501
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001502- ``version-going-backwards:`` If the :ref:`ref-classes-buildhistory`
1503 class is enabled, reports when a package being written out has a lower
1504 version than the previously written package under the same name. If
1505 you are placing output packages into a feed and upgrading packages on
1506 a target system using that feed, the version of a package going
1507 backwards can result in the target system not correctly upgrading to
1508 the "new" version of the package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001509
1510 .. note::
1511
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001512 This is only relevant when you are using runtime package management
1513 on your target system.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001514
1515- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1516 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1517 driver ABI names. All drivers should depend on the ABI versions that
1518 they have been built against. Driver recipes that include
1519 ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1520 automatically get these versions. Consequently, you should only need
1521 to explicitly add dependencies to binary driver recipes.
1522
1523.. _ref-classes-insserv:
1524
Andrew Geissler517393d2023-01-13 08:55:19 -06001525``insserv``
1526===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001527
Andrew Geissler517393d2023-01-13 08:55:19 -06001528The :ref:`ref-classes-insserv` class uses the ``insserv`` utility to update the order
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001529of symbolic links in ``/etc/rc?.d/`` within an image based on
1530dependencies specified by LSB headers in the ``init.d`` scripts
1531themselves.
1532
1533.. _ref-classes-kernel:
1534
Andrew Geissler517393d2023-01-13 08:55:19 -06001535``kernel``
1536==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001537
Andrew Geissler517393d2023-01-13 08:55:19 -06001538The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001539code to build all kernel trees. All needed headers are staged into the
Andrew Geissler5f350902021-07-23 13:09:54 -04001540:term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
Andrew Geissler517393d2023-01-13 08:55:19 -06001541using the :ref:`ref-classes-module` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001542
Andrew Geissler3eeda902023-05-19 10:14:02 -05001543If a file named ``defconfig`` is listed in :term:`SRC_URI`, then by default
1544:ref:`ref-tasks-configure` copies it as ``.config`` in the build directory,
1545so it is automatically used as the kernel configuration for the build. This
1546copy is not performed in case ``.config`` already exists there: this allows
1547recipes to produce a configuration by other means in
1548``do_configure:prepend``.
1549
1550Each built kernel module is packaged separately and inter-module
1551dependencies are created by parsing the ``modinfo`` output. If all modules
1552are required, then installing the ``kernel-modules`` package installs all
1553packages with modules and various other kernel packages such as
1554``kernel-vmlinux``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001555
Andrew Geissler517393d2023-01-13 08:55:19 -06001556The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial
Patrick Williams2194f502022-10-16 14:26:09 -05001557RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
1558information on how to build an :term:`Initramfs`, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001559":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001560the Yocto Project Development Tasks Manual.
1561
Andrew Geissler517393d2023-01-13 08:55:19 -06001562Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes
1563internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and
1564:ref:`ref-classes-linux-kernel-base` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001565
1566.. _ref-classes-kernel-arch:
1567
Andrew Geissler517393d2023-01-13 08:55:19 -06001568``kernel-arch``
1569===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001570
Andrew Geissler517393d2023-01-13 08:55:19 -06001571The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001572Linux kernel compilation (including modules).
1573
1574.. _ref-classes-kernel-devicetree:
1575
Andrew Geissler517393d2023-01-13 08:55:19 -06001576``kernel-devicetree``
1577=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001578
Andrew Geissler517393d2023-01-13 08:55:19 -06001579The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the
1580:ref:`ref-classes-kernel` class, supports device tree generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001581
Patrick Williamsb542dec2023-06-09 01:26:37 -05001582Its behavior is mainly controlled by the following variables:
1583
1584- :term:`KERNEL_DEVICETREE_BUNDLE`: whether to bundle the kernel and device tree
1585- :term:`KERNEL_DTBDEST`: directory where to install DTB files
1586- :term:`KERNEL_DTBVENDORED`: whether to keep vendor subdirectories
1587- :term:`KERNEL_DTC_FLAGS`: flags for ``dtc``, the Device Tree Compiler
1588- :term:`KERNEL_PACKAGE_NAME`: base name of the kernel packages
1589
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001590.. _ref-classes-kernel-fitimage:
1591
Andrew Geissler517393d2023-01-13 08:55:19 -06001592``kernel-fitimage``
1593===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001594
Andrew Geissler517393d2023-01-13 08:55:19 -06001595The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image,
Patrick Williamsb542dec2023-06-09 01:26:37 -05001596device trees, a U-boot script, an :term:`Initramfs` bundle and a RAM disk
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001597into a single FIT image. In theory, a FIT image can support any number
Andrew Geissler517393d2023-01-13 08:55:19 -06001598of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees.
1599However, :ref:`ref-classes-kernel-fitimage` currently only supports
Patrick Williams975a06f2022-10-21 14:42:47 -05001600limited usecases: just one kernel image, an optional U-boot script,
Andrew Geissler517393d2023-01-13 08:55:19 -06001601an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of
Patrick Williamsb542dec2023-06-09 01:26:37 -05001602device trees.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001603
1604To create a FIT image, it is required that :term:`KERNEL_CLASSES`
Patrick Williams2a254922023-08-11 09:48:11 -05001605is set to include ":ref:`ref-classes-kernel-fitimage`" and one of :term:`KERNEL_IMAGETYPE`,
1606:term:`KERNEL_ALT_IMAGETYPE` or :term:`KERNEL_IMAGETYPES` to include "fitImage".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001607
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001608The options for the device tree compiler passed to ``mkimage -D``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001609when creating the FIT image are specified using the
1610:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1611
1612Only a single kernel can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001613:ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001614address where the kernel image is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001615specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
Andrew Geissler3eeda902023-05-19 10:14:02 -05001616:term:`UBOOT_ENTRYPOINT`. Setting :term:`FIT_ADDRESS_CELLS` to "2"
1617is necessary if such addresses are 64 bit ones.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001618
1619Multiple device trees can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001620:ref:`ref-classes-kernel-fitimage` and the device tree is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001621The address where the device tree is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001622specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001623and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001624
1625Only a single RAM disk can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001626:ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001627The address where the RAM disk image is to be loaded by U-Boot
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001628is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
Patrick Williams2a254922023-08-11 09:48:11 -05001629:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to the FIT image when
1630:term:`INITRAMFS_IMAGE` is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE`
1631is not set to 1.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001632
Andrew Geissler517393d2023-01-13 08:55:19 -06001633Only a single :term:`Initramfs` bundle can be added to the FIT image created by
1634:ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional.
1635In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001636in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
Andrew Geissler517393d2023-01-13 08:55:19 -06001637When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem.
1638The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE`
Patrick Williams2a254922023-08-11 09:48:11 -05001639is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
Andrew Geissler517393d2023-01-13 08:55:19 -06001640The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001641by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1642
1643Only a single U-boot boot script can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001644:ref:`ref-classes-kernel-fitimage` and the boot script is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001645The boot script is specified in the ITS file as a text file containing
1646U-boot commands. When using a boot script the user should configure the
Patrick Williams2194f502022-10-16 14:26:09 -05001647U-boot :ref:`ref-tasks-install` task to copy the script to sysroot.
Andrew Geissler517393d2023-01-13 08:55:19 -06001648So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001649class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
Patrick Williams2a254922023-08-11 09:48:11 -05001650load the boot script from the FIT image and execute it.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001651
Patrick Williams2a254922023-08-11 09:48:11 -05001652The FIT image generated by the :ref:`ref-classes-kernel-fitimage` class is signed when the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001653variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1654:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1655appropriately. The default values used for :term:`FIT_HASH_ALG` and
Andrew Geissler517393d2023-01-13 08:55:19 -06001656:term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and
Patrick Williams2a254922023-08-11 09:48:11 -05001657"rsa2048" respectively. The keys for signing the FIT image can be generated using
Andrew Geissler517393d2023-01-13 08:55:19 -06001658the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001659:term:`UBOOT_SIGN_ENABLE` are set to "1".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001660
1661
1662.. _ref-classes-kernel-grub:
1663
Andrew Geissler517393d2023-01-13 08:55:19 -06001664``kernel-grub``
1665===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001666
Andrew Geissler517393d2023-01-13 08:55:19 -06001667The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001668the kernel as the priority boot mechanism while installing a RPM to
1669update the kernel on a deployed target.
1670
1671.. _ref-classes-kernel-module-split:
1672
Andrew Geissler517393d2023-01-13 08:55:19 -06001673``kernel-module-split``
1674=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001675
Andrew Geissler517393d2023-01-13 08:55:19 -06001676The :ref:`ref-classes-kernel-module-split` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001677splitting Linux kernel modules into separate packages.
1678
1679.. _ref-classes-kernel-uboot:
1680
Andrew Geissler517393d2023-01-13 08:55:19 -06001681``kernel-uboot``
1682================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001683
Andrew Geissler517393d2023-01-13 08:55:19 -06001684The :ref:`ref-classes-kernel-uboot` class provides support for building from
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001685vmlinux-style kernel sources.
1686
1687.. _ref-classes-kernel-uimage:
1688
Andrew Geissler517393d2023-01-13 08:55:19 -06001689``kernel-uimage``
1690=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001691
Andrew Geissler517393d2023-01-13 08:55:19 -06001692The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001693
1694.. _ref-classes-kernel-yocto:
1695
Andrew Geissler517393d2023-01-13 08:55:19 -06001696``kernel-yocto``
1697================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001698
Andrew Geissler517393d2023-01-13 08:55:19 -06001699The :ref:`ref-classes-kernel-yocto` class provides common functionality for building
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001700from linux-yocto style kernel source repositories.
1701
1702.. _ref-classes-kernelsrc:
1703
Andrew Geissler517393d2023-01-13 08:55:19 -06001704``kernelsrc``
1705=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001706
Andrew Geissler517393d2023-01-13 08:55:19 -06001707The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001708
1709.. _ref-classes-lib_package:
1710
Andrew Geissler517393d2023-01-13 08:55:19 -06001711``lib_package``
1712===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001713
Andrew Geissler517393d2023-01-13 08:55:19 -06001714The :ref:`ref-classes-lib_package` class supports recipes that build libraries and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001715produce executable binaries, where those binaries should not be
1716installed by default along with the library. Instead, the binaries are
1717added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1718make their installation optional.
1719
1720.. _ref-classes-libc*:
1721
Andrew Geissler517393d2023-01-13 08:55:19 -06001722``libc*``
1723=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001724
Andrew Geissler517393d2023-01-13 08:55:19 -06001725The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001726
Patrick Williams2390b1b2022-11-03 13:47:49 -05001727- The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001728 ``libc``.
1729
Patrick Williams2390b1b2022-11-03 13:47:49 -05001730- The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001731 ``eglibc``.
1732
1733.. _ref-classes-license:
1734
Andrew Geissler517393d2023-01-13 08:55:19 -06001735``license``
1736===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001737
Andrew Geissler517393d2023-01-13 08:55:19 -06001738The :ref:`ref-classes-license` class provides license manifest creation and license
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001739exclusion. This class is enabled by default using the default value for
1740the :term:`INHERIT_DISTRO` variable.
1741
1742.. _ref-classes-linux-kernel-base:
1743
Andrew Geissler517393d2023-01-13 08:55:19 -06001744``linux-kernel-base``
1745=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001746
Andrew Geissler517393d2023-01-13 08:55:19 -06001747The :ref:`ref-classes-linux-kernel-base` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001748recipes that build out of the Linux kernel source tree. These builds
1749goes beyond the kernel itself. For example, the Perf recipe also
1750inherits this class.
1751
1752.. _ref-classes-linuxloader:
1753
Andrew Geissler517393d2023-01-13 08:55:19 -06001754``linuxloader``
1755===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001756
1757Provides the function ``linuxloader()``, which gives the value of the
1758dynamic loader/linker provided on the platform. This value is used by a
1759number of other classes.
1760
1761.. _ref-classes-logging:
1762
Andrew Geissler517393d2023-01-13 08:55:19 -06001763``logging``
1764===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001765
Andrew Geissler517393d2023-01-13 08:55:19 -06001766The :ref:`ref-classes-logging` class provides the standard shell functions used to log
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001767messages for various BitBake severity levels (i.e. ``bbplain``,
1768``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1769
Andrew Geissler517393d2023-01-13 08:55:19 -06001770This class is enabled by default since it is inherited by the :ref:`ref-classes-base`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001771class.
1772
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001773.. _ref-classes-meson:
1774
1775``meson``
1776=========
1777
1778The :ref:`ref-classes-meson` class allows to create recipes that build software
1779using the `Meson <https://mesonbuild.com/>`__ build system. You can use
1780the :term:`MESON_BUILDTYPE` and :term:`EXTRA_OEMESON` variables to specify
1781additional configuration options to be passed using the ``meson`` command line.
1782
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001783.. _ref-classes-metadata_scm:
1784
Andrew Geissler517393d2023-01-13 08:55:19 -06001785``metadata_scm``
1786================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001787
Andrew Geissler517393d2023-01-13 08:55:19 -06001788The :ref:`ref-classes-metadata_scm` class provides functionality for querying the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001789branch and revision of a Source Code Manager (SCM) repository.
1790
Andrew Geissler517393d2023-01-13 08:55:19 -06001791The :ref:`ref-classes-base` class uses this class to print the revisions of
1792each layer before starting every build. The :ref:`ref-classes-metadata_scm`
1793class is enabled by default because it is inherited by the
1794:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001795
1796.. _ref-classes-migrate_localcount:
1797
Andrew Geissler517393d2023-01-13 08:55:19 -06001798``migrate_localcount``
1799======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001800
Andrew Geissler517393d2023-01-13 08:55:19 -06001801The :ref:`ref-classes-migrate_localcount` class verifies a recipe's localcount data and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001802increments it appropriately.
1803
1804.. _ref-classes-mime:
1805
Andrew Geissler517393d2023-01-13 08:55:19 -06001806``mime``
1807========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001808
Andrew Geissler517393d2023-01-13 08:55:19 -06001809The :ref:`ref-classes-mime` class generates the proper post-install and post-remove
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001810(postinst/postrm) scriptlets for packages that install MIME type files.
1811These scriptlets call ``update-mime-database`` to add the MIME types to
1812the shared database.
1813
Patrick Williams7784c422022-11-17 07:29:11 -06001814.. _ref-classes-mime-xdg:
1815
Andrew Geissler517393d2023-01-13 08:55:19 -06001816``mime-xdg``
1817============
Patrick Williams7784c422022-11-17 07:29:11 -06001818
Andrew Geissler517393d2023-01-13 08:55:19 -06001819The :ref:`ref-classes-mime-xdg` class generates the proper
Patrick Williams7784c422022-11-17 07:29:11 -06001820post-install and post-remove (postinst/postrm) scriptlets for packages
1821that install ``.desktop`` files containing ``MimeType`` entries.
1822These scriptlets call ``update-desktop-database`` to add the MIME types
1823to the database of MIME types handled by desktop files.
1824
1825Thanks to this class, when users open a file through a file browser
1826on recently created images, they don't have to choose the application
1827to open the file from the pool of all known applications, even the ones
1828that cannot open the selected file.
1829
1830If you have recipes installing their ``.desktop`` files as absolute
1831symbolic links, the detection of such files cannot be done by the current
1832implementation of this class. In this case, you have to add the corresponding
1833package names to the :term:`MIME_XDG_PACKAGES` variable.
1834
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001835.. _ref-classes-mirrors:
1836
Andrew Geissler517393d2023-01-13 08:55:19 -06001837``mirrors``
1838===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001839
Andrew Geissler517393d2023-01-13 08:55:19 -06001840The :ref:`ref-classes-mirrors` class sets up some standard
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001841:term:`MIRRORS` entries for source code mirrors. These
1842mirrors provide a fall-back path in case the upstream source specified
1843in :term:`SRC_URI` within recipes is unavailable.
1844
1845This class is enabled by default since it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06001846:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001847
1848.. _ref-classes-module:
1849
Andrew Geissler517393d2023-01-13 08:55:19 -06001850``module``
1851==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001852
Andrew Geissler517393d2023-01-13 08:55:19 -06001853The :ref:`ref-classes-module` class provides support for building out-of-tree Linux
1854kernel modules. The class inherits the :ref:`ref-classes-module-base` and
1855:ref:`ref-classes-kernel-module-split` classes, and implements the
1856:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001857everything needed to build and package a kernel module.
1858
1859For general information on out-of-tree Linux kernel modules, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001860":ref:`kernel-dev/common:incorporating out-of-tree modules`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001861section in the Yocto Project Linux Kernel Development Manual.
1862
1863.. _ref-classes-module-base:
1864
Andrew Geissler517393d2023-01-13 08:55:19 -06001865``module-base``
1866===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001867
Andrew Geissler517393d2023-01-13 08:55:19 -06001868The :ref:`ref-classes-module-base` class provides the base functionality for
1869building Linux kernel modules. Typically, a recipe that builds software that
1870includes one or more kernel modules and has its own means of building the module
1871inherits this class as opposed to inheriting the :ref:`ref-classes-module`
1872class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001873
1874.. _ref-classes-multilib*:
1875
Andrew Geissler517393d2023-01-13 08:55:19 -06001876``multilib*``
1877=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001878
Andrew Geissler517393d2023-01-13 08:55:19 -06001879The :ref:`ref-classes-multilib*` classes provide support for building libraries with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001880different target optimizations or target architectures and installing
1881them side-by-side in the same image.
1882
1883For more information on using the Multilib feature, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001884":ref:`dev-manual/libraries:combining multiple versions of library files into one image`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001885section in the Yocto Project Development Tasks Manual.
1886
1887.. _ref-classes-native:
1888
Andrew Geissler517393d2023-01-13 08:55:19 -06001889``native``
1890==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001891
Andrew Geissler517393d2023-01-13 08:55:19 -06001892The :ref:`ref-classes-native` class provides common functionality for recipes that
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001893build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
1894or other tools from the build host).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001895
1896You can create a recipe that builds tools that run natively on the host
1897a couple different ways:
1898
Andrew Geissler517393d2023-01-13 08:55:19 -06001899- Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001900 class. If you use this method, you must order the inherit statement
1901 in the recipe after all other inherit statements so that the
Andrew Geissler517393d2023-01-13 08:55:19 -06001902 :ref:`ref-classes-native` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001903
1904 .. note::
1905
1906 When creating a recipe this way, the recipe name must follow this
Andrew Geisslerc926e172021-05-07 16:11:35 -05001907 naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001908
1909 myrecipe-native.bb
1910
1911
1912 Not using this naming convention can lead to subtle problems
1913 caused by existing code that depends on that naming convention.
1914
Andrew Geisslerc926e172021-05-07 16:11:35 -05001915- Create or modify a target recipe that contains the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001916
1917 BBCLASSEXTEND = "native"
1918
1919 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001920 recipe, use ``:class-native`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001921 specify any functionality specific to the respective native or target
1922 case.
1923
Andrew Geissler517393d2023-01-13 08:55:19 -06001924Although applied differently, the :ref:`ref-classes-native` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001925methods. The advantage of the second method is that you do not need to
1926have two separate recipes (assuming you need both) for native and
1927target. All common parts of the recipe are automatically shared.
1928
1929.. _ref-classes-nativesdk:
1930
Andrew Geissler517393d2023-01-13 08:55:19 -06001931``nativesdk``
1932=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001933
Andrew Geissler517393d2023-01-13 08:55:19 -06001934The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001935wish to build tools to run as part of an SDK (i.e. tools that run on
1936:term:`SDKMACHINE`).
1937
1938You can create a recipe that builds tools that run on the SDK machine a
1939couple different ways:
1940
Andrew Geisslereff27472021-10-29 15:35:00 -05001941- Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -06001942 :ref:`ref-classes-nativesdk` class. If you use this method, you must order the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001943 inherit statement in the recipe after all other inherit statements so
Andrew Geissler517393d2023-01-13 08:55:19 -06001944 that the :ref:`ref-classes-nativesdk` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001945
Andrew Geissler517393d2023-01-13 08:55:19 -06001946- Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001947
1948 BBCLASSEXTEND = "nativesdk"
1949
1950 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001951 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001952 specify any functionality specific to the respective SDK machine or
1953 target case.
1954
1955.. note::
1956
Andrew Geisslerc926e172021-05-07 16:11:35 -05001957 When creating a recipe, you must follow this naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001958
1959 nativesdk-myrecipe.bb
1960
1961
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001962 Not doing so can lead to subtle problems because there is code that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001963 depends on the naming convention.
1964
Andrew Geissler517393d2023-01-13 08:55:19 -06001965Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001966methods. The advantage of the second method is that you do not need to
1967have two separate recipes (assuming you need both) for the SDK machine
1968and the target. All common parts of the recipe are automatically shared.
1969
1970.. _ref-classes-nopackages:
1971
Andrew Geissler517393d2023-01-13 08:55:19 -06001972``nopackages``
1973==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001974
1975Disables packaging tasks for those recipes and classes where packaging
1976is not needed.
1977
1978.. _ref-classes-npm:
1979
Andrew Geissler517393d2023-01-13 08:55:19 -06001980``npm``
1981=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001982
Patrick Williams7784c422022-11-17 07:29:11 -06001983Provides support for building Node.js software fetched using the
1984:wikipedia:`node package manager (NPM) <Npm_(software)>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001985
1986.. note::
1987
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001988 Currently, recipes inheriting this class must use the ``npm://``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001989 fetcher to have dependencies fetched and packaged automatically.
1990
1991For information on how to create NPM packages, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001992":ref:`dev-manual/packages:creating node package manager (npm) packages`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001993section in the Yocto Project Development Tasks Manual.
1994
1995.. _ref-classes-oelint:
1996
Andrew Geissler517393d2023-01-13 08:55:19 -06001997``oelint``
1998==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001999
Andrew Geissler517393d2023-01-13 08:55:19 -06002000The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002001``meta/classes`` in the :term:`Source Directory`.
2002
William A. Kennington IIIac69b482021-06-02 12:28:27 -07002003There are some classes that could be generally useful in OE-Core but
Andrew Geissler517393d2023-01-13 08:55:19 -06002004are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002005one such example. However, being aware of this class can reduce the
2006proliferation of different versions of similar classes across multiple
2007layers.
2008
Andrew Geissler5199d832021-09-24 16:47:35 -05002009.. _ref-classes-overlayfs:
2010
Andrew Geissler517393d2023-01-13 08:55:19 -06002011``overlayfs``
2012=============
Andrew Geissler5199d832021-09-24 16:47:35 -05002013
Andrew Geissler595f6302022-01-24 19:11:47 +00002014It's often desired in Embedded System design to have a read-only root filesystem.
Andrew Geissler5199d832021-09-24 16:47:35 -05002015But a lot of different applications might want to have read-write access to
2016some parts of a filesystem. It can be especially useful when your update mechanism
Andrew Geissler595f6302022-01-24 19:11:47 +00002017overwrites the whole root filesystem, but you may want your application data to be preserved
Andrew Geissler517393d2023-01-13 08:55:19 -06002018between updates. The :ref:`ref-classes-overlayfs` class provides a way
Andrew Geissler5199d832021-09-24 16:47:35 -05002019to achieve that by means of ``overlayfs`` and at the same time keeping the base
Andrew Geissler595f6302022-01-24 19:11:47 +00002020root filesystem read-only.
Andrew Geissler5199d832021-09-24 16:47:35 -05002021
2022To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
2023layer in your machine configuration. The underlying file system can be anything that
2024is supported by ``overlayfs``. This has to be done in your machine configuration::
2025
2026 OVERLAYFS_MOUNT_POINT[data] = "/data"
2027
2028.. note::
2029
2030 * QA checks fail to catch file existence if you redefine this variable in your recipe!
2031 * Only the existence of the systemd mount unit file is checked, not its contents.
2032 * To get more details on ``overlayfs``, its internals and supported operations, please refer
Patrick Williams2390b1b2022-11-03 13:47:49 -05002033 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 -05002034
2035The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
2036(e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
2037
2038Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
2039
2040 OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
2041
2042To support several mount points you can use a different variable flag. Assuming we
2043want to have a writable location on the file system, but do not need that the data
Andrew Geissler595f6302022-01-24 19:11:47 +00002044survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
2045file system.
Andrew Geissler5199d832021-09-24 16:47:35 -05002046
2047In your machine configuration::
2048
2049 OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
2050
2051and then in your recipe::
2052
2053 OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
2054
Andrew Geissler595f6302022-01-24 19:11:47 +00002055On a practical note, your application recipe might require multiple
2056overlays to be mounted before running to avoid writing to the underlying
2057file system (which can be forbidden in case of read-only file system)
Andrew Geissler517393d2023-01-13 08:55:19 -06002058To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd``
Andrew Geissler595f6302022-01-24 19:11:47 +00002059helper service for mounting overlays. This helper service is named
2060``${PN}-overlays.service`` and can be depended on in your application recipe
2061(named ``application`` in the following example) ``systemd`` unit by adding
2062to the unit the following::
2063
2064 [Unit]
2065 After=application-overlays.service
2066 Requires=application-overlays.service
2067
Andrew Geissler5199d832021-09-24 16:47:35 -05002068.. note::
2069
2070 The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
Andrew Geissler517393d2023-01-13 08:55:19 -06002071 In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`.
Andrew Geissler595f6302022-01-24 19:11:47 +00002072
2073.. _ref-classes-overlayfs-etc:
2074
Andrew Geissler517393d2023-01-13 08:55:19 -06002075``overlayfs-etc``
2076=================
Andrew Geissler595f6302022-01-24 19:11:47 +00002077
2078In order to have the ``/etc`` directory in overlayfs a special handling at early
2079boot stage is required. The idea is to supply a custom init script that mounts
2080``/etc`` before launching the actual init program, because the latter already
2081requires ``/etc`` to be mounted.
2082
2083Example usage in image recipe::
2084
2085 IMAGE_FEATURES += "overlayfs-etc"
2086
2087.. note::
2088
2089 This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
2090
2091Your machine configuration should define at least the device, mount point, and file system type
2092you are going to use for ``overlayfs``::
2093
2094 OVERLAYFS_ETC_MOUNT_POINT = "/data"
2095 OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
2096 OVERLAYFS_ETC_FSTYPE ?= "ext4"
2097
2098To control more mount options you should consider setting mount options
2099(``defaults`` is used by default)::
2100
2101 OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
2102
2103The class provides two options for ``/sbin/init`` generation:
2104
2105- The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
2106 and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
2107 that you won't need to change any kernel parameters in order to make it work,
2108 but it poses a restriction that package-management can't be used, because updating
2109 the init manager would remove the generated script.
2110
2111- If you wish to keep original init as is, you can set::
2112
2113 OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
2114
2115 Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
2116 kernel parameters manually in your bootloader configuration.
Andrew Geissler5199d832021-09-24 16:47:35 -05002117
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002118.. _ref-classes-own-mirrors:
2119
Andrew Geissler517393d2023-01-13 08:55:19 -06002120``own-mirrors``
2121===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002122
Andrew Geissler517393d2023-01-13 08:55:19 -06002123The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002124:term:`PREMIRRORS` from which to first fetch source
2125before attempting to fetch it from the upstream specified in
2126:term:`SRC_URI` within each recipe.
2127
2128To use this class, inherit it globally and specify
Andrew Geisslerc926e172021-05-07 16:11:35 -05002129:term:`SOURCE_MIRROR_URL`. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002130
2131 INHERIT += "own-mirrors"
2132 SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
2133
2134You can specify only a single URL
Andrew Geissler09036742021-06-25 14:25:14 -05002135in :term:`SOURCE_MIRROR_URL`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002136
2137.. _ref-classes-package:
2138
Andrew Geissler517393d2023-01-13 08:55:19 -06002139``package``
2140===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002141
Andrew Geissler517393d2023-01-13 08:55:19 -06002142The :ref:`ref-classes-package` class supports generating packages from a build's
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002143output. The core generic functionality is in ``package.bbclass``. The
2144code specific to particular package types resides in these
Andrew Geissler517393d2023-01-13 08:55:19 -06002145package-specific classes: :ref:`ref-classes-package_deb`,
Patrick Williams8e7b46e2023-05-01 14:19:06 -05002146:ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002147
2148You can control the list of resulting package formats by using the
Andrew Geissler09036742021-06-25 14:25:14 -05002149:term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002150configuration file, which is located in the :term:`Build Directory`.
Patrick Williams2390b1b2022-11-03 13:47:49 -05002151When defining the variable, you can specify one or more package types.
2152Since images are generated from packages, a packaging class is needed
2153to enable image generation. The first class listed in this variable is
2154used for image generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002155
2156If you take the optional step to set up a repository (package feed) on
2157the development host that can be used by DNF, you can install packages
2158from the feed while you are running the image on the target (i.e.
2159runtime installation of packages). For more information, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002160":ref:`dev-manual/packages:using runtime package management`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002161section in the Yocto Project Development Tasks Manual.
2162
2163The package-specific class you choose can affect build-time performance
2164and has space ramifications. In general, building a package with IPK
2165takes about thirty percent less time as compared to using RPM to build
2166the same or similar package. This comparison takes into account a
2167complete build of the package with all dependencies previously built.
2168The reason for this discrepancy is because the RPM package manager
2169creates and processes more :term:`Metadata` than the IPK package
Andrew Geissler09036742021-06-25 14:25:14 -05002170manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
Andrew Geissler517393d2023-01-13 08:55:19 -06002171":ref:`ref-classes-package_ipk`" if you are building smaller systems.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002172
2173Before making your package manager decision, however, you should
2174consider some further things about using RPM:
2175
2176- RPM starts to provide more abilities than IPK due to the fact that it
2177 processes more Metadata. For example, this information includes
2178 individual file types, file checksum generation and evaluation on
2179 install, sparse file support, conflict detection and resolution for
2180 Multilib systems, ACID style upgrade, and repackaging abilities for
2181 rollbacks.
2182
2183- For smaller systems, the extra space used for the Berkeley Database
2184 and the amount of metadata when using RPM can affect your ability to
2185 perform on-device upgrades.
2186
2187You can find additional information on the effects of the package class
2188at these two Yocto Project mailing list links:
2189
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002190- :yocto_lists:`/pipermail/poky/2011-May/006362.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002191
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002192- :yocto_lists:`/pipermail/poky/2011-May/006363.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002193
2194.. _ref-classes-package_deb:
2195
Andrew Geissler517393d2023-01-13 08:55:19 -06002196``package_deb``
2197===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002198
Andrew Geissler517393d2023-01-13 08:55:19 -06002199The :ref:`ref-classes-package_deb` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002200use the Debian (i.e. ``.deb``) file format. The class ensures the
2201packages are written out in a ``.deb`` file format to the
2202``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
2203
Andrew Geissler517393d2023-01-13 08:55:19 -06002204This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002205is enabled through the :term:`PACKAGE_CLASSES`
2206variable in the ``local.conf`` file.
2207
2208.. _ref-classes-package_ipk:
2209
Andrew Geissler517393d2023-01-13 08:55:19 -06002210``package_ipk``
2211===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002212
Andrew Geissler517393d2023-01-13 08:55:19 -06002213The :ref:`ref-classes-package_ipk` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002214use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
2215are written out in a ``.ipk`` file format to the
2216``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
2217
Andrew Geissler517393d2023-01-13 08:55:19 -06002218This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002219is enabled through the :term:`PACKAGE_CLASSES`
2220variable in the ``local.conf`` file.
2221
2222.. _ref-classes-package_rpm:
2223
Andrew Geissler517393d2023-01-13 08:55:19 -06002224``package_rpm``
2225===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002226
Andrew Geissler517393d2023-01-13 08:55:19 -06002227The :ref:`ref-classes-package_rpm` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002228use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
2229are written out in a ``.rpm`` file format to the
2230``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
2231
Andrew Geissler517393d2023-01-13 08:55:19 -06002232This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002233is enabled through the :term:`PACKAGE_CLASSES`
2234variable in the ``local.conf`` file.
2235
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002236.. _ref-classes-packagedata:
2237
Andrew Geissler517393d2023-01-13 08:55:19 -06002238``packagedata``
2239===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002240
Andrew Geissler517393d2023-01-13 08:55:19 -06002241The :ref:`ref-classes-packagedata` class provides common functionality for reading
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002242``pkgdata`` files found in :term:`PKGDATA_DIR`. These
2243files contain information about each output package produced by the
2244OpenEmbedded build system.
2245
2246This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002247:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002248
2249.. _ref-classes-packagegroup:
2250
Andrew Geissler517393d2023-01-13 08:55:19 -06002251``packagegroup``
2252================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002253
Andrew Geissler517393d2023-01-13 08:55:19 -06002254The :ref:`ref-classes-packagegroup` class sets default values appropriate for package
Andrew Geissler09036742021-06-25 14:25:14 -05002255group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002256so forth). It is highly recommended that all package group recipes
2257inherit this class.
2258
2259For information on how to use this class, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002260":ref:`dev-manual/customizing-images:customizing images using custom package groups`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002261section in the Yocto Project Development Tasks Manual.
2262
2263Previously, this class was called the ``task`` class.
2264
2265.. _ref-classes-patch:
2266
Andrew Geissler517393d2023-01-13 08:55:19 -06002267``patch``
2268=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002269
Andrew Geissler517393d2023-01-13 08:55:19 -06002270The :ref:`ref-classes-patch` class provides all functionality for applying patches
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002271during the :ref:`ref-tasks-patch` task.
2272
2273This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002274:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002275
2276.. _ref-classes-perlnative:
2277
Andrew Geissler517393d2023-01-13 08:55:19 -06002278``perlnative``
2279==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002280
Andrew Geissler517393d2023-01-13 08:55:19 -06002281When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002282native version of Perl built by the build system rather than using the
2283version provided by the build host.
2284
Patrick Williams975a06f2022-10-21 14:42:47 -05002285.. _ref-classes-pypi:
2286
Andrew Geissler517393d2023-01-13 08:55:19 -06002287``pypi``
2288========
Patrick Williams975a06f2022-10-21 14:42:47 -05002289
Andrew Geissler517393d2023-01-13 08:55:19 -06002290The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build
Patrick Williams975a06f2022-10-21 14:42:47 -05002291Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
2292By default it determines the PyPI package name based upon :term:`BPN`
2293(stripping the "python-" or "python3-" prefix off if present), however in
2294some cases you may need to set it manually in the recipe by setting
2295:term:`PYPI_PACKAGE`.
2296
Andrew Geissler517393d2023-01-13 08:55:19 -06002297Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`,
Patrick Williams975a06f2022-10-21 14:42:47 -05002298:term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
2299and :term:`CVE_PRODUCT`.
2300
Patrick Williams45852732022-04-02 08:58:32 -05002301.. _ref-classes-python_flit_core:
2302
Andrew Geissler517393d2023-01-13 08:55:19 -06002303``python_flit_core``
2304====================
Patrick Williams45852732022-04-02 08:58:32 -05002305
Andrew Geissler517393d2023-01-13 08:55:19 -06002306The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare
Patrick Williams45852732022-04-02 08:58:32 -05002307the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2308``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
2309section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2310
2311Python modules built with ``flit_core.buildapi`` are pure Python (no
2312``C`` or ``Rust`` extensions).
2313
Andrew Geissler517393d2023-01-13 08:55:19 -06002314Internally this uses the :ref:`ref-classes-python_pep517` class.
Patrick Williams45852732022-04-02 08:58:32 -05002315
Andrew Geissler9aee5002022-03-30 16:27:02 +00002316.. _ref-classes-python_pep517:
2317
Andrew Geissler517393d2023-01-13 08:55:19 -06002318``python_pep517``
2319=================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002320
Andrew Geissler517393d2023-01-13 08:55:19 -06002321The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary
Patrick Williams45852732022-04-02 08:58:32 -05002322archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
Andrew Geissler9aee5002022-03-30 16:27:02 +00002323
Patrick Williams45852732022-04-02 08:58:32 -05002324Recipes wouldn't inherit this directly, instead typically another class will
Andrew Geissler615f2f12022-07-15 14:00:58 -05002325inherit this and add the relevant native dependencies.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002326
Andrew Geissler517393d2023-01-13 08:55:19 -06002327Examples of classes which do this are :ref:`ref-classes-python_flit_core`,
2328:ref:`ref-classes-python_setuptools_build_meta`, and
2329:ref:`ref-classes-python_poetry_core`.
Patrick Williams45852732022-04-02 08:58:32 -05002330
2331.. _ref-classes-python_poetry_core:
2332
Andrew Geissler517393d2023-01-13 08:55:19 -06002333``python_poetry_core``
2334======================
Patrick Williams45852732022-04-02 08:58:32 -05002335
Andrew Geissler517393d2023-01-13 08:55:19 -06002336The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the
Patrick Williams45852732022-04-02 08:58:32 -05002337`Poetry Core <https://python-poetry.org>`__ build system.
2338
Andrew Geissler517393d2023-01-13 08:55:19 -06002339Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002340
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002341.. _ref-classes-python_pyo3:
2342
2343``python_pyo3``
2344===============
2345
2346The :ref:`ref-classes-python_pyo3` class helps make sure that Python extensions
2347written in Rust and built with `PyO3 <https://pyo3.rs/>`__, properly set up the
2348environment for cross compilation.
2349
2350This class is internal to the :ref:`ref-classes-python-setuptools3_rust` class
2351and is not meant to be used directly in recipes.
2352
2353.. _ref-classes-python-setuptools3_rust:
2354
2355``python-setuptools3_rust``
2356===========================
2357
2358The :ref:`ref-classes-python-setuptools3_rust` class enables building Python
2359extensions implemented in Rust with `PyO3 <https://pyo3.rs/>`__, which allows
2360to compile and distribute Python extensions written in Rust as easily
2361as if they were written in C.
2362
2363This class inherits the :ref:`ref-classes-setuptools3` and
2364:ref:`ref-classes-python_pyo3` classes.
2365
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002366.. _ref-classes-pixbufcache:
2367
Andrew Geissler517393d2023-01-13 08:55:19 -06002368``pixbufcache``
2369===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002370
Andrew Geissler517393d2023-01-13 08:55:19 -06002371The :ref:`ref-classes-pixbufcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002372post-remove (postinst/postrm) scriptlets for packages that install
2373pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
2374call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
2375Since the cache files are architecture-specific, ``update_pixbuf_cache``
2376is run using QEMU if the postinst scriptlets need to be run on the build
2377host during image creation.
2378
2379If the pixbuf loaders being installed are in packages other than the
2380recipe's main package, set
2381:term:`PIXBUF_PACKAGES` to specify the packages
2382containing the loaders.
2383
2384.. _ref-classes-pkgconfig:
2385
Andrew Geissler517393d2023-01-13 08:55:19 -06002386``pkgconfig``
2387=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002388
Andrew Geissler517393d2023-01-13 08:55:19 -06002389The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002390library information by using ``pkg-config``. This class aims to smooth
2391integration of ``pkg-config`` into libraries that use it.
2392
2393During staging, BitBake installs ``pkg-config`` data into the
2394``sysroots/`` directory. By making use of sysroot functionality within
Andrew Geissler517393d2023-01-13 08:55:19 -06002395``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002396files.
2397
2398.. _ref-classes-populate-sdk:
2399
Andrew Geissler517393d2023-01-13 08:55:19 -06002400``populate_sdk``
2401================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002402
Andrew Geissler517393d2023-01-13 08:55:19 -06002403The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002404information on advantages gained when building a cross-development
2405toolchain using the :ref:`ref-tasks-populate_sdk`
Andrew Geissler09209ee2020-12-13 08:44:15 -06002406task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002407section in the Yocto Project Application Development and the Extensible
2408Software Development Kit (eSDK) manual.
2409
2410.. _ref-classes-populate-sdk-*:
2411
Andrew Geissler517393d2023-01-13 08:55:19 -06002412``populate_sdk_*``
2413==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002414
Andrew Geissler517393d2023-01-13 08:55:19 -06002415The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002416following classes:
2417
Patrick Williams2390b1b2022-11-03 13:47:49 -05002418- :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002419 all package managers (i.e. DEB, RPM, and opkg).
2420
Patrick Williams2390b1b2022-11-03 13:47:49 -05002421- :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002422 package manager.
2423
Patrick Williams2390b1b2022-11-03 13:47:49 -05002424- :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002425 package manager.
2426
Patrick Williams2390b1b2022-11-03 13:47:49 -05002427- :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002428 (IPK format) package manager.
2429
Patrick Williams2390b1b2022-11-03 13:47:49 -05002430- :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002431 package managers.
2432
Patrick Williams2390b1b2022-11-03 13:47:49 -05002433The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002434``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2435:term:`IMAGE_PKGTYPE`.
2436
2437The base class ensures all source and destination directories are
2438established and then populates the SDK. After populating the SDK, the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002439:ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002440``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2441contains the cross-compiler and associated tooling, and the target,
2442which contains a target root filesystem that is configured for the SDK
2443usage. These two images reside in :term:`SDK_OUTPUT`,
Andrew Geisslerc926e172021-05-07 16:11:35 -05002444which consists of the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002445
2446 ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2447 ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2448
2449Finally, the base populate SDK class creates the toolchain environment
2450setup script, the tarball of the SDK, and the installer.
2451
Patrick Williams2390b1b2022-11-03 13:47:49 -05002452The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and
2453:ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK.
2454These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002455class.
2456
2457For more information on the cross-development toolchain generation, see
Andrew Geissler09209ee2020-12-13 08:44:15 -06002458the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002459section in the Yocto Project Overview and Concepts Manual. For
2460information on advantages gained when building a cross-development
2461toolchain using the :ref:`ref-tasks-populate_sdk`
2462task, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002463":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002464section in the Yocto Project Application Development and the Extensible
2465Software Development Kit (eSDK) manual.
2466
2467.. _ref-classes-prexport:
2468
Andrew Geissler517393d2023-01-13 08:55:19 -06002469``prexport``
2470============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002471
Andrew Geissler517393d2023-01-13 08:55:19 -06002472The :ref:`ref-classes-prexport` class provides functionality for exporting
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002473:term:`PR` values.
2474
2475.. note::
2476
2477 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002478 when using "``bitbake-prserv-tool export``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002479
2480.. _ref-classes-primport:
2481
Andrew Geissler517393d2023-01-13 08:55:19 -06002482``primport``
2483============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002484
Andrew Geissler517393d2023-01-13 08:55:19 -06002485The :ref:`ref-classes-primport` class provides functionality for importing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002486:term:`PR` values.
2487
2488.. note::
2489
2490 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002491 when using "``bitbake-prserv-tool import``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002492
2493.. _ref-classes-prserv:
2494
Andrew Geissler517393d2023-01-13 08:55:19 -06002495``prserv``
2496==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002497
Andrew Geissler517393d2023-01-13 08:55:19 -06002498The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR
2499service <dev-manual/packages:working with a pr service>` in order to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002500automatically manage the incrementing of the :term:`PR`
2501variable for each recipe.
2502
2503This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002504:ref:`ref-classes-package` class. However, the OpenEmbedded
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002505build system will not enable the functionality of this class unless
2506:term:`PRSERV_HOST` has been set.
2507
2508.. _ref-classes-ptest:
2509
Andrew Geissler517393d2023-01-13 08:55:19 -06002510``ptest``
2511=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002512
Andrew Geissler517393d2023-01-13 08:55:19 -06002513The :ref:`ref-classes-ptest` class provides functionality for packaging and installing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002514runtime tests for recipes that build software that provides these tests.
2515
2516This class is intended to be inherited by individual recipes. However,
2517the class' functionality is largely disabled unless "ptest" appears in
2518:term:`DISTRO_FEATURES`. See the
Andrew Geissler517393d2023-01-13 08:55:19 -06002519":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002520section in the Yocto Project Development Tasks Manual for more information
2521on ptest.
2522
Andrew Geissler5082cc72023-09-11 08:41:39 -04002523.. _ref-classes-ptest-cargo:
2524
2525``ptest-cargo``
2526===============
2527
2528The :ref:`ref-classes-ptest-cargo` class is a class which extends the
2529:ref:`ref-classes-cargo` class and adds ``compile_ptest_cargo`` and
2530``install_ptest_cargo`` steps to respectively build and install
2531test suites defined in the ``Cargo.toml`` file, into a dedicated
2532``-ptest`` package.
2533
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002534.. _ref-classes-ptest-gnome:
2535
Andrew Geissler517393d2023-01-13 08:55:19 -06002536``ptest-gnome``
2537===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002538
2539Enables package tests (ptests) specifically for GNOME packages, which
2540have tests intended to be executed with ``gnome-desktop-testing``.
2541
2542For information on setting up and running ptests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002543":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002544section in the Yocto Project Development Tasks Manual.
2545
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002546.. _ref-classes-python3-dir:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002547
Andrew Geissler517393d2023-01-13 08:55:19 -06002548``python3-dir``
2549===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002550
Andrew Geissler517393d2023-01-13 08:55:19 -06002551The :ref:`ref-classes-python3-dir` class provides the base version, location, and site
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002552package location for Python 3.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002553
2554.. _ref-classes-python3native:
2555
Andrew Geissler517393d2023-01-13 08:55:19 -06002556``python3native``
2557=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002558
Andrew Geissler517393d2023-01-13 08:55:19 -06002559The :ref:`ref-classes-python3native` class supports using the native version of Python
Andrew Geisslerc9f78652020-09-18 14:11:35 -050025603 built by the build system rather than support of the version provided
2561by the build host.
2562
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002563.. _ref-classes-python3targetconfig:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002564
Andrew Geissler517393d2023-01-13 08:55:19 -06002565``python3targetconfig``
2566=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002567
Andrew Geissler517393d2023-01-13 08:55:19 -06002568The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050025693 built by the build system rather than support of the version provided
2570by the build host, except that the configuration for the target machine
2571is accessible (such as correct installation directories). This also adds a
2572dependency on target ``python3``, so should only be used where appropriate
2573in order to avoid unnecessarily lengthening builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002574
2575.. _ref-classes-qemu:
2576
Andrew Geissler517393d2023-01-13 08:55:19 -06002577``qemu``
2578========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002579
Andrew Geissler517393d2023-01-13 08:55:19 -06002580The :ref:`ref-classes-qemu` class provides functionality for recipes that either need
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002581QEMU or test for the existence of QEMU. Typically, this class is used to
2582run programs for a target system on the build host using QEMU's
2583application emulation mode.
2584
2585.. _ref-classes-recipe_sanity:
2586
Andrew Geissler517393d2023-01-13 08:55:19 -06002587``recipe_sanity``
2588=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002589
Andrew Geissler517393d2023-01-13 08:55:19 -06002590The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002591recipe prerequisites that might affect the build (e.g. variables that
2592are set or software that is present).
2593
2594.. _ref-classes-relocatable:
2595
Andrew Geissler517393d2023-01-13 08:55:19 -06002596``relocatable``
2597===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002598
Andrew Geissler517393d2023-01-13 08:55:19 -06002599The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002600installed into the sysroot.
2601
Andrew Geissler517393d2023-01-13 08:55:19 -06002602This class makes use of the :ref:`ref-classes-chrpath` class and is used by
2603both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002604
2605.. _ref-classes-remove-libtool:
2606
Andrew Geissler517393d2023-01-13 08:55:19 -06002607``remove-libtool``
2608==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002609
Andrew Geissler517393d2023-01-13 08:55:19 -06002610The :ref:`ref-classes-remove-libtool` class adds a post function to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002611:ref:`ref-tasks-install` task to remove all ``.la`` files
2612installed by ``libtool``. Removing these files results in them being
2613absent from both the sysroot and target packages.
2614
2615If a recipe needs the ``.la`` files to be installed, then the recipe can
Andrew Geisslerc926e172021-05-07 16:11:35 -05002616override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002617
2618 REMOVE_LIBTOOL_LA = "0"
2619
2620.. note::
2621
Andrew Geissler517393d2023-01-13 08:55:19 -06002622 The :ref:`ref-classes-remove-libtool` class is not enabled by default.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002623
2624.. _ref-classes-report-error:
2625
Andrew Geissler517393d2023-01-13 08:55:19 -06002626``report-error``
2627================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002628
Andrew Geissler517393d2023-01-13 08:55:19 -06002629The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting
2630tool <dev-manual/error-reporting-tool:using the error reporting tool>`",
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002631which allows you to submit build error information to a central database.
2632
2633The class collects debug information for recipe, recipe version, task,
2634machine, distro, build system, target system, host distro, branch,
2635commit, and log. From the information, report files using a JSON format
2636are created and stored in
2637``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2638
2639.. _ref-classes-rm-work:
2640
Andrew Geissler517393d2023-01-13 08:55:19 -06002641``rm_work``
2642===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002643
Andrew Geissler517393d2023-01-13 08:55:19 -06002644The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002645can ease your hard drive demands during builds.
2646
2647The OpenEmbedded build system can use a substantial amount of disk space
2648during the build process. A portion of this space is the work files
2649under the ``${TMPDIR}/work`` directory for each recipe. Once the build
2650system generates the packages for a recipe, the work files for that
2651recipe are no longer needed. However, by default, the build system
2652preserves these files for inspection and possible debugging purposes. If
Andrew Geissler517393d2023-01-13 08:55:19 -06002653you would rather have these files deleted to save disk space as the build
2654progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to
Patrick Williams2390b1b2022-11-03 13:47:49 -05002655your ``local.conf`` file, which is found in the :term:`Build Directory`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002656
2657 INHERIT += "rm_work"
2658
Andrew Geissler517393d2023-01-13 08:55:19 -06002659If you are modifying and building source code out of the work directory for a
2660recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your
2661changes to the source being lost. To exclude some recipes from having their work
2662directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the
2663recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable,
2664which can also be set in your ``local.conf`` file. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002665
2666 RM_WORK_EXCLUDE += "busybox glibc"
2667
2668.. _ref-classes-rootfs*:
2669
Andrew Geissler517393d2023-01-13 08:55:19 -06002670``rootfs*``
2671===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002672
Andrew Geissler517393d2023-01-13 08:55:19 -06002673The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002674image and consist of the following classes:
2675
Patrick Williams2390b1b2022-11-03 13:47:49 -05002676- The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002677 post-processing functions for image recipes.
2678
Patrick Williams2390b1b2022-11-03 13:47:49 -05002679- The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002680 for images built using ``.deb`` packages.
2681
Patrick Williams2390b1b2022-11-03 13:47:49 -05002682- The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002683 for images built using ``.rpm`` packages.
2684
Patrick Williams2390b1b2022-11-03 13:47:49 -05002685- The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002686 for images built using ``.ipk`` packages.
2687
Patrick Williams2390b1b2022-11-03 13:47:49 -05002688- The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002689 on the build host directly into the root filesystem.
2690
2691The root filesystem is created from packages using one of the
Andrew Geissler517393d2023-01-13 08:55:19 -06002692:ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES`
2693variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002694
2695For information on how root filesystem images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002696":ref:`overview-manual/concepts:image generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002697section in the Yocto Project Overview and Concepts Manual.
2698
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002699.. _ref-classes-rust:
2700
2701``rust``
2702========
2703
2704The :ref:`ref-classes-rust` class is an internal class which is just used
2705in the "rust" recipe, to build the Rust compiler and runtime
2706library. Except for this recipe, it is not intended to be used directly.
2707
2708.. _ref-classes-rust-common:
2709
2710``rust-common``
2711===============
2712
2713The :ref:`ref-classes-rust-common` class is an internal class to the
2714:ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not
2715intended to be used directly.
2716
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002717.. _ref-classes-sanity:
2718
Andrew Geissler517393d2023-01-13 08:55:19 -06002719``sanity``
2720==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002721
Andrew Geissler517393d2023-01-13 08:55:19 -06002722The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002723on the host system so that users can be notified of potential problems
2724that might affect their build. The class also performs basic user
2725configuration checks from the ``local.conf`` configuration file to
2726prevent common mistakes that cause build failures. Distribution policy
2727usually determines whether to include this class.
2728
2729.. _ref-classes-scons:
2730
Andrew Geissler517393d2023-01-13 08:55:19 -06002731``scons``
2732=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002733
Andrew Geissler517393d2023-01-13 08:55:19 -06002734The :ref:`ref-classes-scons` class supports recipes that need to build software
2735that uses the SCons build system. You can use the :term:`EXTRA_OESCONS`
2736variable to specify additional configuration options you want to pass SCons
2737command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002738
2739.. _ref-classes-sdl:
2740
Andrew Geissler517393d2023-01-13 08:55:19 -06002741``sdl``
2742=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002743
Andrew Geissler517393d2023-01-13 08:55:19 -06002744The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002745the Simple DirectMedia Layer (SDL) library.
2746
Patrick Williams45852732022-04-02 08:58:32 -05002747.. _ref-classes-python_setuptools_build_meta:
Andrew Geissler9aee5002022-03-30 16:27:02 +00002748
Andrew Geissler517393d2023-01-13 08:55:19 -06002749``python_setuptools_build_meta``
2750================================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002751
Andrew Geissler517393d2023-01-13 08:55:19 -06002752The :ref:`ref-classes-python_setuptools_build_meta` class enables building
2753Python modules which declare the
Andrew Geissler9aee5002022-03-30 16:27:02 +00002754`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2755``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
2756section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2757
2758Python modules built with ``setuptools.build_meta`` can be pure Python or
2759include ``C`` or ``Rust`` extensions).
2760
Andrew Geissler517393d2023-01-13 08:55:19 -06002761Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002762
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002763.. _ref-classes-setuptools3:
2764
Andrew Geissler517393d2023-01-13 08:55:19 -06002765``setuptools3``
2766===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002767
Andrew Geissler517393d2023-01-13 08:55:19 -06002768The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions
2769that use build systems based on ``setuptools`` (e.g. only have a ``setup.py``
2770and have not migrated to the official ``pyproject.toml`` format). If your recipe
2771uses these build systems, the recipe needs to inherit the
2772:ref:`ref-classes-setuptools3` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002773
2774 .. note::
2775
Andrew Geissler517393d2023-01-13 08:55:19 -06002776 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls
Andrew Geissler9aee5002022-03-30 16:27:02 +00002777 ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
2778 (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
2779
2780 A consequence of this is that legacy software still using deprecated
2781 ``distutils`` from the Python standard library cannot be packaged as
2782 ``wheels``. A common solution is the replace
2783 ``from distutils.core import setup`` with ``from setuptools import setup``.
2784
2785 .. note::
2786
Andrew Geissler517393d2023-01-13 08:55:19 -06002787 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now
2788 installs the ``wheel`` binary archive. In current versions of
2789 ``setuptools`` the legacy ``setup.py install`` method is deprecated. If
2790 the ``setup.py`` cannot be used with wheels, for example it creates files
2791 outside of the Python module or standard entry points, then
2792 :ref:`ref-classes-setuptools3_legacy` should be used.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002793
2794.. _ref-classes-setuptools3_legacy:
2795
Andrew Geissler517393d2023-01-13 08:55:19 -06002796``setuptools3_legacy``
2797======================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002798
Andrew Geissler517393d2023-01-13 08:55:19 -06002799The :ref:`ref-classes-setuptools3_legacy` class supports
2800Python version 3.x extensions that use build systems based on ``setuptools``
2801(e.g. only have a ``setup.py`` and have not migrated to the official
2802``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`,
2803this uses the traditional ``setup.py`` ``build`` and ``install`` commands and
2804not wheels. This use of ``setuptools`` like this is
Patrick Williams2390b1b2022-11-03 13:47:49 -05002805`deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__
Andrew Geissler9aee5002022-03-30 16:27:02 +00002806but still relatively common.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002807
Andrew Geissler595f6302022-01-24 19:11:47 +00002808.. _ref-classes-setuptools3-base:
2809
Andrew Geissler517393d2023-01-13 08:55:19 -06002810``setuptools3-base``
2811====================
Andrew Geissler595f6302022-01-24 19:11:47 +00002812
Andrew Geissler517393d2023-01-13 08:55:19 -06002813The :ref:`ref-classes-setuptools3-base` class provides a reusable base for
2814other classes that support building Python version 3.x extensions. If you need
2815functionality that is not provided by the :ref:`ref-classes-setuptools3` class,
2816you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks
2817in the :ref:`ref-classes-setuptools3` class and inherit this class instead.
Andrew Geissler595f6302022-01-24 19:11:47 +00002818
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002819.. _ref-classes-sign_rpm:
2820
Andrew Geissler517393d2023-01-13 08:55:19 -06002821``sign_rpm``
2822============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002823
Andrew Geissler517393d2023-01-13 08:55:19 -06002824The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002825
2826.. _ref-classes-siteconfig:
2827
Andrew Geissler517393d2023-01-13 08:55:19 -06002828``siteconfig``
2829==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002830
Andrew Geissler517393d2023-01-13 08:55:19 -06002831The :ref:`ref-classes-siteconfig` class provides functionality for handling site
2832configuration. The class is used by the :ref:`ref-classes-autotools` class to
2833accelerate the :ref:`ref-tasks-configure` task.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002834
2835.. _ref-classes-siteinfo:
2836
Andrew Geissler517393d2023-01-13 08:55:19 -06002837``siteinfo``
2838============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002839
Andrew Geissler517393d2023-01-13 08:55:19 -06002840The :ref:`ref-classes-siteinfo` class provides information about the targets
2841that might be needed by other classes or recipes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002842
2843As an example, consider Autotools, which can require tests that must
2844execute on the target hardware. Since this is not possible in general
2845when cross compiling, site information is used to provide cached test
2846results so these tests can be skipped over but still make the correct
2847values available. The ``meta/site directory`` contains test results
2848sorted into different categories such as architecture, endianness, and
2849the ``libc`` used. Site information provides a list of files containing
Andrew Geissler09036742021-06-25 14:25:14 -05002850data relevant to the current build in the :term:`CONFIG_SITE` variable that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002851Autotools automatically picks up.
2852
Andrew Geissler09036742021-06-25 14:25:14 -05002853The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
2854:term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002855
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002856.. _ref-classes-sstate:
2857
Andrew Geissler517393d2023-01-13 08:55:19 -06002858``sstate``
2859==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002860
Andrew Geissler517393d2023-01-13 08:55:19 -06002861The :ref:`ref-classes-sstate` class provides support for Shared State (sstate).
2862By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's
2863default value.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002864
2865For more information on sstate, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002866":ref:`overview-manual/concepts:shared state cache`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002867section in the Yocto Project Overview and Concepts Manual.
2868
2869.. _ref-classes-staging:
2870
Andrew Geissler517393d2023-01-13 08:55:19 -06002871``staging``
2872===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002873
Andrew Geissler517393d2023-01-13 08:55:19 -06002874The :ref:`ref-classes-staging` class installs files into individual recipe work
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002875directories for sysroots. The class contains the following key tasks:
2876
2877- The :ref:`ref-tasks-populate_sysroot` task,
2878 which is responsible for handing the files that end up in the recipe
2879 sysroots.
2880
2881- The
2882 :ref:`ref-tasks-prepare_recipe_sysroot`
2883 task (a "partner" task to the ``populate_sysroot`` task), which
2884 installs the files into the individual recipe work directories (i.e.
2885 :term:`WORKDIR`).
2886
Andrew Geissler517393d2023-01-13 08:55:19 -06002887The code in the :ref:`ref-classes-staging` class is complex and basically works
2888in two stages:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002889
2890- *Stage One:* The first stage addresses recipes that have files they
2891 want to share with other recipes that have dependencies on the
2892 originating recipe. Normally these dependencies are installed through
2893 the :ref:`ref-tasks-install` task into
Patrick Williams2194f502022-10-16 14:26:09 -05002894 ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002895 copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
2896 subset of files is controlled by the
2897 :term:`SYSROOT_DIRS`,
2898 :term:`SYSROOT_DIRS_NATIVE`, and
Andrew Geissler9aee5002022-03-30 16:27:02 +00002899 :term:`SYSROOT_DIRS_IGNORE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002900 variables.
2901
2902 .. note::
2903
2904 Additionally, a recipe can customize the files further by
Andrew Geissler09036742021-06-25 14:25:14 -05002905 declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002906 variable.
2907
2908 A shared state (sstate) object is built from these files and the
2909 files are placed into a subdirectory of
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002910 :ref:`structure-build-tmp-sysroots-components`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002911 The files are scanned for hardcoded paths to the original
2912 installation location. If the location is found in text files, the
2913 hardcoded locations are replaced by tokens and a list of the files
2914 needing such replacements is created. These adjustments are referred
2915 to as "FIXMEs". The list of files that are scanned for paths is
2916 controlled by the :term:`SSTATE_SCAN_FILES`
2917 variable.
2918
2919- *Stage Two:* The second stage addresses recipes that want to use
2920 something from another recipe and declare a dependency on that recipe
2921 through the :term:`DEPENDS` variable. The recipe will
2922 have a
2923 :ref:`ref-tasks-prepare_recipe_sysroot`
2924 task and when this task executes, it creates the ``recipe-sysroot``
2925 and ``recipe-sysroot-native`` in the recipe work directory (i.e.
2926 :term:`WORKDIR`). The OpenEmbedded build system
2927 creates hard links to copies of the relevant files from
2928 ``sysroots-components`` into the recipe work directory.
2929
2930 .. note::
2931
2932 If hard links are not possible, the build system uses actual
2933 copies.
2934
2935 The build system then addresses any "FIXMEs" to paths as defined from
2936 the list created in the first stage.
2937
2938 Finally, any files in ``${bindir}`` within the sysroot that have the
2939 prefix "``postinst-``" are executed.
2940
2941 .. note::
2942
2943 Although such sysroot post installation scripts are not
2944 recommended for general use, the files do allow some issues such
2945 as user creation and module indexes to be addressed.
2946
Andrew Geissler09036742021-06-25 14:25:14 -05002947 Because recipes can have other dependencies outside of :term:`DEPENDS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002948 (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
2949 the sysroot creation function ``extend_recipe_sysroot`` is also added
2950 as a pre-function for those tasks whose dependencies are not through
Andrew Geissler09036742021-06-25 14:25:14 -05002951 :term:`DEPENDS` but operate similarly.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002952
2953 When installing dependencies into the sysroot, the code traverses the
2954 dependency graph and processes dependencies in exactly the same way
2955 as the dependencies would or would not be when installed from sstate.
2956 This processing means, for example, a native tool would have its
2957 native dependencies added but a target library would not have its
2958 dependencies traversed or installed. The same sstate dependency code
2959 is used so that builds should be identical regardless of whether
2960 sstate was used or not. For a closer look, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002961 ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002962
2963 The build system is careful to maintain manifests of the files it
2964 installs so that any given dependency can be installed as needed. The
2965 sstate hash of the installed item is also stored so that if it
2966 changes, the build system can reinstall it.
2967
2968.. _ref-classes-syslinux:
2969
Andrew Geissler517393d2023-01-13 08:55:19 -06002970``syslinux``
2971============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002972
Andrew Geissler517393d2023-01-13 08:55:19 -06002973The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for
2974building bootable images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002975
2976The class supports the following variables:
2977
2978- :term:`INITRD`: Indicates list of filesystem images to
2979 concatenate and use as an initial RAM disk (initrd). This variable is
2980 optional.
2981
2982- :term:`ROOTFS`: Indicates a filesystem image to include
2983 as the root filesystem. This variable is optional.
2984
2985- :term:`AUTO_SYSLINUXMENU`: Enables creating
2986 an automatic menu when set to "1".
2987
2988- :term:`LABELS`: Lists targets for automatic
2989 configuration.
2990
2991- :term:`APPEND`: Lists append string overrides for each
2992 label.
2993
2994- :term:`SYSLINUX_OPTS`: Lists additional options
2995 to add to the syslinux file. Semicolon characters separate multiple
2996 options.
2997
2998- :term:`SYSLINUX_SPLASH`: Lists a background
2999 for the VGA boot menu when you are using the boot menu.
3000
3001- :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
3002 to "console=ttyX" to change kernel boot default console.
3003
3004- :term:`SYSLINUX_SERIAL`: Sets an alternate
3005 serial port. Or, turns off serial when the variable is set with an
3006 empty string.
3007
3008- :term:`SYSLINUX_SERIAL_TTY`: Sets an
3009 alternate "console=tty..." kernel boot argument.
3010
3011.. _ref-classes-systemd:
3012
Andrew Geissler517393d2023-01-13 08:55:19 -06003013``systemd``
3014===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003015
Andrew Geissler517393d2023-01-13 08:55:19 -06003016The :ref:`ref-classes-systemd` class provides support for recipes that install
3017systemd unit files.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003018
3019The functionality for this class is disabled unless you have "systemd"
3020in :term:`DISTRO_FEATURES`.
3021
3022Under this class, the recipe or Makefile (i.e. whatever the recipe is
3023calling during the :ref:`ref-tasks-install` task)
3024installs unit files into
3025``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
3026files being installed go into packages other than the main package, you
3027need to set :term:`SYSTEMD_PACKAGES` in your
3028recipe to identify the packages in which the files will be installed.
3029
3030You should set :term:`SYSTEMD_SERVICE` to the
3031name of the service file. You should also use a package name override to
3032indicate the package to which the value applies. If the value applies to
3033the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
Andrew Geisslerc926e172021-05-07 16:11:35 -05003034is an example from the connman recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003035
Patrick Williams0ca19cc2021-08-16 14:03:13 -05003036 SYSTEMD_SERVICE:${PN} = "connman.service"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003037
3038Services are set up to start on boot automatically
3039unless you have set
3040:term:`SYSTEMD_AUTO_ENABLE` to "disable".
3041
Andrew Geissler517393d2023-01-13 08:55:19 -06003042For more information on :ref:`ref-classes-systemd`, see the
3043":ref:`dev-manual/init-manager:selecting an initialization manager`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003044section in the Yocto Project Development Tasks Manual.
3045
3046.. _ref-classes-systemd-boot:
3047
Andrew Geissler517393d2023-01-13 08:55:19 -06003048``systemd-boot``
3049================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003050
Andrew Geissler517393d2023-01-13 08:55:19 -06003051The :ref:`ref-classes-systemd-boot` class provides functions specific to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003052systemd-boot bootloader for building bootable images. This is an
3053internal class and is not intended to be used directly.
3054
3055.. note::
3056
Andrew Geissler517393d2023-01-13 08:55:19 -06003057 The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003058 used in previous Yocto Project releases with the ``systemd`` project.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003059
Andrew Geissler517393d2023-01-13 08:55:19 -06003060Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to
3061use this class. Doing so creates a standalone EFI bootloader that is not
3062dependent on systemd.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003063
3064For information on more variables used and supported in this class, see
3065the :term:`SYSTEMD_BOOT_CFG`,
3066:term:`SYSTEMD_BOOT_ENTRIES`, and
3067:term:`SYSTEMD_BOOT_TIMEOUT` variables.
3068
3069You can also see the `Systemd-boot
Andrew Geisslerd1e89492021-02-12 15:35:20 -06003070documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003071for more information.
3072
3073.. _ref-classes-terminal:
3074
Andrew Geissler517393d2023-01-13 08:55:19 -06003075``terminal``
3076============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003077
Andrew Geissler517393d2023-01-13 08:55:19 -06003078The :ref:`ref-classes-terminal` class provides support for starting a terminal
3079session. The :term:`OE_TERMINAL` variable controls which terminal emulator is
3080used for the session.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003081
Andrew Geissler517393d2023-01-13 08:55:19 -06003082Other classes use the :ref:`ref-classes-terminal` class anywhere a separate
3083terminal session needs to be started. For example, the :ref:`ref-classes-patch`
3084class assuming :term:`PATCHRESOLVE` is set to "user", the
3085:ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all
3086use the :ref:`ref-classes-terminal` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003087
Patrick Williams975a06f2022-10-21 14:42:47 -05003088.. _ref-classes-testimage:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003089
Andrew Geissler517393d2023-01-13 08:55:19 -06003090``testimage``
3091=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003092
Andrew Geissler517393d2023-01-13 08:55:19 -06003093The :ref:`ref-classes-testimage` class supports running automated tests against
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003094images using QEMU and on actual hardware. The classes handle loading the
3095tests and starting the image. To use the classes, you need to perform
3096steps to set up the environment.
3097
Patrick Williams975a06f2022-10-21 14:42:47 -05003098To enable this class, add the following to your configuration::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003099
Patrick Williams975a06f2022-10-21 14:42:47 -05003100 IMAGE_CLASSES += "testimage"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003101
3102The tests are commands that run on the target system over ``ssh``. Each
3103test is written in Python and makes use of the ``unittest`` module.
3104
Andrew Geissler517393d2023-01-13 08:55:19 -06003105The :ref:`ref-classes-testimage` class runs tests on an image when called using the
Andrew Geisslerc926e172021-05-07 16:11:35 -05003106following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003107
3108 $ bitbake -c testimage image
3109
Patrick Williams975a06f2022-10-21 14:42:47 -05003110Alternatively, if you wish to have tests automatically run for each image
3111after it is built, you can set :term:`TESTIMAGE_AUTO`::
3112
3113 TESTIMAGE_AUTO = "1"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003114
3115For information on how to enable, run, and create new tests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06003116":ref:`dev-manual/runtime-testing:performing automated runtime testing`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003117section in the Yocto Project Development Tasks Manual.
3118
3119.. _ref-classes-testsdk:
3120
Andrew Geissler517393d2023-01-13 08:55:19 -06003121``testsdk``
3122===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003123
3124This class supports running automated tests against software development
Andrew Geissler517393d2023-01-13 08:55:19 -06003125kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called
Andrew Geisslerc926e172021-05-07 16:11:35 -05003126using the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003127
3128 $ bitbake -c testsdk image
3129
3130.. note::
3131
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003132 Best practices include using :term:`IMAGE_CLASSES` rather than
Andrew Geissler517393d2023-01-13 08:55:19 -06003133 :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003134 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003135
3136.. _ref-classes-texinfo:
3137
Andrew Geissler517393d2023-01-13 08:55:19 -06003138``texinfo``
3139===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003140
3141This class should be inherited by recipes whose upstream packages invoke
3142the ``texinfo`` utilities at build-time. Native and cross recipes are
3143made to use the dummy scripts provided by ``texinfo-dummy-native``, for
3144improved performance. Target architecture recipes use the genuine
3145Texinfo utilities. By default, they use the Texinfo utilities on the
3146host system.
3147
3148.. note::
3149
3150 If you want to use the Texinfo recipe shipped with the build system,
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003151 you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
3152 from :term:`SANITY_REQUIRED_UTILITIES`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003153
3154.. _ref-classes-toaster:
3155
Andrew Geissler517393d2023-01-13 08:55:19 -06003156``toaster``
3157===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003158
Andrew Geissler517393d2023-01-13 08:55:19 -06003159The :ref:`ref-classes-toaster` class collects information about packages and images and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003160sends them as events that the BitBake user interface can receive. The
3161class is enabled when the Toaster user interface is running.
3162
3163This class is not intended to be used directly.
3164
3165.. _ref-classes-toolchain-scripts:
3166
Andrew Geissler517393d2023-01-13 08:55:19 -06003167``toolchain-scripts``
3168=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003169
Andrew Geissler517393d2023-01-13 08:55:19 -06003170The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003171the environment for installed SDKs.
3172
3173.. _ref-classes-typecheck:
3174
Andrew Geissler517393d2023-01-13 08:55:19 -06003175``typecheck``
3176=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003177
Andrew Geissler517393d2023-01-13 08:55:19 -06003178The :ref:`ref-classes-typecheck` class provides support for validating the values of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003179variables set at the configuration level against their defined types.
3180The OpenEmbedded build system allows you to define the type of a
Andrew Geisslerc926e172021-05-07 16:11:35 -05003181variable using the "type" varflag. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003182
3183 IMAGE_FEATURES[type] = "list"
3184
3185.. _ref-classes-uboot-config:
3186
Andrew Geissler517393d2023-01-13 08:55:19 -06003187``uboot-config``
3188================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003189
Andrew Geissler517393d2023-01-13 08:55:19 -06003190The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for
Andrew Geisslerc926e172021-05-07 16:11:35 -05003191a machine. Specify the machine in your recipe as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003192
3193 UBOOT_CONFIG ??= <default>
3194 UBOOT_CONFIG[foo] = "config,images"
3195
Andrew Geisslerc926e172021-05-07 16:11:35 -05003196You can also specify the machine using this method::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003197
3198 UBOOT_MACHINE = "config"
3199
3200See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
3201information.
3202
Patrick Williamsb542dec2023-06-09 01:26:37 -05003203.. _ref-classes-uboot-sign:
3204
3205``uboot-sign``
3206==============
3207
3208The :ref:`ref-classes-uboot-sign` class provides support for U-Boot verified boot.
3209It is intended to be inherited from U-Boot recipes.
3210
3211Here are variables used by this class:
3212
3213- :term:`SPL_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3214 building the FIT image.
3215- :term:`SPL_SIGN_ENABLE`: enable signing the FIT image.
3216- :term:`SPL_SIGN_KEYDIR`: directory containing the signing keys.
3217- :term:`SPL_SIGN_KEYNAME`: base filename of the signing keys.
3218- :term:`UBOOT_FIT_ADDRESS_CELLS`: ``#address-cells`` value for the FIT image.
3219- :term:`UBOOT_FIT_DESC`: description string encoded into the FIT image.
3220- :term:`UBOOT_FIT_GENERATE_KEYS`: generate the keys if they don't exist yet.
3221- :term:`UBOOT_FIT_HASH_ALG`: hash algorithm for the FIT image.
3222- :term:`UBOOT_FIT_KEY_GENRSA_ARGS`: ``openssl genrsa`` arguments.
3223- :term:`UBOOT_FIT_KEY_REQ_ARGS`: ``openssl req`` arguments.
3224- :term:`UBOOT_FIT_SIGN_ALG`: signature algorithm for the FIT image.
3225- :term:`UBOOT_FIT_SIGN_NUMBITS`: size of the private key for FIT image
3226 signing.
3227- :term:`UBOOT_FIT_KEY_SIGN_PKCS`: algorithm for the public key certificate
3228 for FIT image signing.
3229- :term:`UBOOT_FITIMAGE_ENABLE`: enable the generation of a U-Boot FIT image.
3230- :term:`UBOOT_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3231 rebuilding the FIT image containing the kernel.
3232
3233See U-Boot's documentation for details about `verified boot
3234<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/verified-boot.txt>`__
3235and the `signature process
3236<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/signature.txt>`__.
3237
3238See also the description of :ref:`ref-classes-kernel-fitimage` class, which this class
3239imitates.
3240
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003241.. _ref-classes-uninative:
3242
Andrew Geissler517393d2023-01-13 08:55:19 -06003243``uninative``
3244=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003245
3246Attempts to isolate the build system from the host distribution's C
3247library in order to make re-use of native shared state artifacts across
3248different host distributions practical. With this class enabled, a
3249tarball containing a pre-built C library is downloaded at the start of
3250the build. In the Poky reference distribution this is enabled by default
3251through ``meta/conf/distro/include/yocto-uninative.inc``. Other
3252distributions that do not derive from poky can also
3253"``require conf/distro/include/yocto-uninative.inc``" to use this.
3254Alternatively if you prefer, you can build the uninative-tarball recipe
3255yourself, publish the resulting tarball (e.g. via HTTP) and set
3256``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
3257example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
3258
Andrew Geissler517393d2023-01-13 08:55:19 -06003259The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003260SDK. When building the extensible SDK, ``uninative-tarball`` is built
3261and the resulting tarball is included within the SDK.
3262
3263.. _ref-classes-update-alternatives:
3264
Andrew Geissler517393d2023-01-13 08:55:19 -06003265``update-alternatives``
3266=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003267
Andrew Geissler517393d2023-01-13 08:55:19 -06003268The :ref:`ref-classes-update-alternatives` class helps the alternatives system when
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003269multiple sources provide the same command. This situation occurs when
3270several programs that have the same or similar function are installed
3271with the same name. For example, the ``ar`` command is available from
3272the ``busybox``, ``binutils`` and ``elfutils`` packages. The
Andrew Geissler517393d2023-01-13 08:55:19 -06003273:ref:`ref-classes-update-alternatives` class handles renaming the binaries so that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003274multiple packages can be installed without conflicts. The ``ar`` command
3275still works regardless of which packages are installed or subsequently
3276removed. The class renames the conflicting binary in each package and
3277symlinks the highest priority binary during installation or removal of
3278packages.
3279
3280To use this class, you need to define a number of variables:
3281
3282- :term:`ALTERNATIVE`
3283
3284- :term:`ALTERNATIVE_LINK_NAME`
3285
3286- :term:`ALTERNATIVE_TARGET`
3287
3288- :term:`ALTERNATIVE_PRIORITY`
3289
3290These variables list alternative commands needed by a package, provide
3291pathnames for links, default links for targets, and so forth. For
3292details on how to use this class, see the comments in the
Patrick Williams975a06f2022-10-21 14:42:47 -05003293:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003294file.
3295
3296.. note::
3297
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003298 You can use the ``update-alternatives`` command directly in your recipes.
3299 However, this class simplifies things in most cases.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003300
3301.. _ref-classes-update-rc.d:
3302
Andrew Geissler517393d2023-01-13 08:55:19 -06003303``update-rc.d``
3304===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003305
Andrew Geissler517393d2023-01-13 08:55:19 -06003306The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003307initialization script on behalf of the package. The OpenEmbedded build
3308system takes care of details such as making sure the script is stopped
3309before a package is removed and started when the package is installed.
3310
Andrew Geissler09036742021-06-25 14:25:14 -05003311Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
3312:term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003313for details.
3314
3315.. _ref-classes-useradd:
3316
Andrew Geissler517393d2023-01-13 08:55:19 -06003317``useradd*``
3318============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003319
Patrick Williams2390b1b2022-11-03 13:47:49 -05003320The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003321usage by the package on the target. For example, if you have packages
3322that contain system services that should be run under their own user or
3323group, you can use these classes to enable creation of the user or
Andrew Geissler595f6302022-01-24 19:11:47 +00003324group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
3325</openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003326recipe in the :term:`Source Directory` provides a simple
3327example that shows how to add three users and groups to two packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003328
Patrick Williams2390b1b2022-11-03 13:47:49 -05003329The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003330groups settings.
3331
Patrick Williams2390b1b2022-11-03 13:47:49 -05003332The :ref:`useradd* <ref-classes-useradd>` classes support the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003333:term:`USERADD_PACKAGES`,
3334:term:`USERADD_PARAM`,
3335:term:`GROUPADD_PARAM`, and
3336:term:`GROUPMEMS_PARAM` variables.
3337
Patrick Williams2390b1b2022-11-03 13:47:49 -05003338The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003339that have static user identification (``uid``) and group identification
3340(``gid``) values.
3341
3342The default behavior of the OpenEmbedded build system for assigning
3343``uid`` and ``gid`` values when packages add users and groups during
3344package install time is to add them dynamically. This works fine for
3345programs that do not care what the values of the resulting users and
3346groups become. In these cases, the order of the installation determines
3347the final ``uid`` and ``gid`` values. However, if non-deterministic
3348``uid`` and ``gid`` values are a problem, you can override the default,
3349dynamic application of these values by setting static values. When you
3350set static values, the OpenEmbedded build system looks in
3351:term:`BBPATH` for ``files/passwd`` and ``files/group``
3352files for the values.
3353
Andrew Geissler517393d2023-01-13 08:55:19 -06003354To use static ``uid`` and ``gid`` values, you need to set some variables. See
3355the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`,
3356:term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables.
3357You can also see the :ref:`ref-classes-useradd` class for additional
3358information.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003359
3360.. note::
3361
Patrick Williams2390b1b2022-11-03 13:47:49 -05003362 You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable
Andrew Geissler09036742021-06-25 14:25:14 -05003363 or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003364 enable or disable the class in a configured system, :term:`TMPDIR` might
Andrew Geissler09036742021-06-25 14:25:14 -05003365 contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003366 directory will correct this condition.
3367
3368.. _ref-classes-utility-tasks:
3369
Andrew Geissler517393d2023-01-13 08:55:19 -06003370``utility-tasks``
3371=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003372
Andrew Geissler517393d2023-01-13 08:55:19 -06003373The :ref:`ref-classes-utility-tasks` class provides support for various
3374"utility" type tasks that are applicable to all recipes, such as
3375:ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003376
3377This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003378:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003379
3380.. _ref-classes-utils:
3381
Andrew Geissler517393d2023-01-13 08:55:19 -06003382``utils``
3383=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003384
Andrew Geissler517393d2023-01-13 08:55:19 -06003385The :ref:`ref-classes-utils` class provides some useful Python functions that are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003386typically used in inline Python expressions (e.g. ``${@...}``). One
3387example use is for ``bb.utils.contains()``.
3388
3389This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003390:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003391
3392.. _ref-classes-vala:
3393
Andrew Geissler517393d2023-01-13 08:55:19 -06003394``vala``
3395========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003396
Andrew Geissler517393d2023-01-13 08:55:19 -06003397The :ref:`ref-classes-vala` class supports recipes that need to build software written
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003398using the Vala programming language.
3399
3400.. _ref-classes-waf:
3401
Andrew Geissler517393d2023-01-13 08:55:19 -06003402``waf``
3403=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003404
Andrew Geissler517393d2023-01-13 08:55:19 -06003405The :ref:`ref-classes-waf` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003406the Waf build system. You can use the
3407:term:`EXTRA_OECONF` or
3408:term:`PACKAGECONFIG_CONFARGS` variables
3409to specify additional configuration options to be passed on the Waf
3410command line.