blob: a78368b380f607708b09e46f23f56a60d0758a9f [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
269``cargo new`` command, containing a ``Cargo.toml`` file and a ``src``
270subdirectory.
271
272You will find a simple example in the
273:oe_git:`rust-hello-world_git.bb </openembedded-core/tree/meta/recipes-extended/rust-example/rust-hello-world_git.bb>`
274recipe. A more complex example, with package dependencies, is the
275:oe_git:`uutils-coreutils </meta-openembedded/tree/meta-oe/recipes-core/uutils-coreutils>`
276recipe, which was generated by the `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__
277tool.
278
279This class inherits the :ref:`ref-classes-cargo_common` class.
280
281.. _ref-classes-cargo_common:
282
283``cargo_common``
284================
285
286The :ref:`ref-classes-cargo_common` class is an internal class
287that is not intended to be used directly.
288
289An exception is the "rust" recipe, to build the Rust compiler and runtime
290library, which is built by Cargo but cannot use the :ref:`ref-classes-cargo`
291class. This is why this class was introduced.
292
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500293.. _ref-classes-ccache:
294
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600295.. _ref-classes-cargo-update-recipe-crates:
296
297``cargo-update-recipe-crates``
298===============================
299
300The :ref:`ref-classes-cargo-update-recipe-crates` class allows
301recipe developers to update the list of Cargo crates in :term:`SRC_URI`
302by reading the ``Cargo.lock`` file in the source tree.
303
304To do so, create a recipe for your program, for example using
305:doc:`devtool </ref-manual/devtool-reference>`,
306make it inherit the :ref:`ref-classes-cargo` and
307:ref:`ref-classes-cargo-update-recipe-crates` and run::
308
309 bitbake -c update_crates recipe
310
311This creates a ``recipe-crates.inc`` file that you can include in your
312recipe::
313
314 require ${BPN}-crates.inc
315
316That's also something you can achieve by using the
317`cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__ tool.
318
Andrew Geissler517393d2023-01-13 08:55:19 -0600319``ccache``
320==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500321
Andrew Geissler517393d2023-01-13 08:55:19 -0600322The :ref:`ref-classes-ccache` class enables the C/C++ Compiler Cache for the build.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500323This class is used to give a minor performance boost during the build.
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000324
325See https://ccache.samba.org/ for information on the C/C++ Compiler
326Cache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>`
327file for details about how to enable this mechanism in your configuration
328file, how to disable it for specific recipes, and how to share ``ccache``
329files between builds.
330
331However, using the class can lead to unexpected side-effects. Thus, using
332this class is not recommended.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500333
334.. _ref-classes-chrpath:
335
Andrew Geissler517393d2023-01-13 08:55:19 -0600336``chrpath``
337===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500338
Andrew Geissler517393d2023-01-13 08:55:19 -0600339The :ref:`ref-classes-chrpath` class is a wrapper around the "chrpath" utility, which
340is used during the build process for :ref:`ref-classes-nativesdk`, :ref:`ref-classes-cross`, and
341:ref:`ref-classes-cross-canadian` recipes to change ``RPATH`` records within binaries
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500342in order to make them relocatable.
343
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500344.. _ref-classes-cmake:
345
Andrew Geissler517393d2023-01-13 08:55:19 -0600346``cmake``
347=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500348
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600349The :ref:`ref-classes-cmake` class allows recipes to build software using the
350`CMake <https://cmake.org/overview/>`__ build system. You can use the
351:term:`EXTRA_OECMAKE` variable to specify additional configuration options to
352pass to the ``cmake`` command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500353
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600354By default, the :ref:`ref-classes-cmake` class uses
355`Ninja <https://ninja-build.org/>`__ instead of GNU make for building, which
356offers better build performance. If a recipe is broken with Ninja, then the
357recipe can set the :term:`OECMAKE_GENERATOR` variable to ``Unix Makefiles`` to
358use GNU make instead.
359
360If you need to install custom CMake toolchain files supplied by the application
361being built, you should install them (during :ref:`ref-tasks-install`) to the
362preferred CMake Module directory: ``${D}${datadir}/cmake/modules/``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500363
364.. _ref-classes-cml1:
365
Andrew Geissler517393d2023-01-13 08:55:19 -0600366``cml1``
367========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500368
Andrew Geissler517393d2023-01-13 08:55:19 -0600369The :ref:`ref-classes-cml1` class provides basic support for the Linux kernel style
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500370build configuration system.
371
372.. _ref-classes-compress_doc:
373
Andrew Geissler517393d2023-01-13 08:55:19 -0600374``compress_doc``
375================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500376
377Enables compression for man pages and info pages. This class is intended
378to be inherited globally. The default compression mechanism is gz (gzip)
379but you can select an alternative mechanism by setting the
380:term:`DOC_COMPRESS` variable.
381
382.. _ref-classes-copyleft_compliance:
383
Andrew Geissler517393d2023-01-13 08:55:19 -0600384``copyleft_compliance``
385=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500386
Andrew Geissler517393d2023-01-13 08:55:19 -0600387The :ref:`ref-classes-copyleft_compliance` class preserves source code for the purposes
388of license compliance. This class is an alternative to the :ref:`ref-classes-archiver`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500389class and is still used by some users even though it has been deprecated
Andrew Geissler517393d2023-01-13 08:55:19 -0600390in favor of the :ref:`ref-classes-archiver` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500391
392.. _ref-classes-copyleft_filter:
393
Andrew Geissler517393d2023-01-13 08:55:19 -0600394``copyleft_filter``
395===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500396
Andrew Geissler517393d2023-01-13 08:55:19 -0600397A class used by the :ref:`ref-classes-archiver` and
398:ref:`ref-classes-copyleft_compliance` classes
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500399for filtering licenses. The ``copyleft_filter`` class is an internal
400class and is not intended to be used directly.
401
402.. _ref-classes-core-image:
403
Andrew Geissler517393d2023-01-13 08:55:19 -0600404``core-image``
405==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500406
Andrew Geissler517393d2023-01-13 08:55:19 -0600407The :ref:`ref-classes-core-image` class provides common definitions for the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500408``core-image-*`` image recipes, such as support for additional
409:term:`IMAGE_FEATURES`.
410
411.. _ref-classes-cpan:
412
Andrew Geissler517393d2023-01-13 08:55:19 -0600413``cpan*``
414=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500415
Patrick Williams2390b1b2022-11-03 13:47:49 -0500416The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500417
418Recipes for Perl modules are simple. These recipes usually only need to
419point to the source's archive and then inherit the proper class file.
420Building is split into two methods depending on which method the module
421authors used.
422
423- Modules that use old ``Makefile.PL``-based build system require
424 ``cpan.bbclass`` in their recipes.
425
426- Modules that use ``Build.PL``-based build system require using
427 ``cpan_build.bbclass`` in their recipes.
428
Patrick Williams2390b1b2022-11-03 13:47:49 -0500429Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500430support.
431
Patrick Williams975a06f2022-10-21 14:42:47 -0500432.. _ref-classes-create-spdx:
433
Andrew Geissler517393d2023-01-13 08:55:19 -0600434``create-spdx``
435===============
Patrick Williams975a06f2022-10-21 14:42:47 -0500436
Andrew Geissler517393d2023-01-13 08:55:19 -0600437The :ref:`ref-classes-create-spdx` class provides support for
Patrick Williams7784c422022-11-17 07:29:11 -0600438automatically creating :term:`SPDX` :term:`SBOM` documents based upon image
439and SDK contents.
440
441This class is meant to be inherited globally from a configuration file::
442
443 INHERIT += "create-spdx"
444
445The toplevel :term:`SPDX` output file is generated in JSON format as a
446``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the
447:term:`Build Directory`. There are other related files in the same directory,
448as well as in ``tmp/deploy/spdx``.
449
450The exact behaviour of this class, and the amount of output can be controlled
451by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`,
452:term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables.
453
454See the description of these variables and the
Andrew Geissler517393d2023-01-13 08:55:19 -0600455":ref:`dev-manual/sbom:creating a software bill of materials`"
Patrick Williams7784c422022-11-17 07:29:11 -0600456section in the Yocto Project Development Manual for more details.
Patrick Williams975a06f2022-10-21 14:42:47 -0500457
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500458.. _ref-classes-cross:
459
Andrew Geissler517393d2023-01-13 08:55:19 -0600460``cross``
461=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500462
Andrew Geissler517393d2023-01-13 08:55:19 -0600463The :ref:`ref-classes-cross` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500464cross-compilation tools.
465
466.. _ref-classes-cross-canadian:
467
Andrew Geissler517393d2023-01-13 08:55:19 -0600468``cross-canadian``
469==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500470
Andrew Geissler517393d2023-01-13 08:55:19 -0600471The :ref:`ref-classes-cross-canadian` class provides support for the recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500472the Canadian Cross-compilation tools for SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600473":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500474section in the Yocto Project Overview and Concepts Manual for more
475discussion on these cross-compilation tools.
476
477.. _ref-classes-crosssdk:
478
Andrew Geissler517393d2023-01-13 08:55:19 -0600479``crosssdk``
480============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500481
Andrew Geissler517393d2023-01-13 08:55:19 -0600482The :ref:`ref-classes-crosssdk` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500483cross-compilation tools used for building SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600484":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500485section in the Yocto Project Overview and Concepts Manual for more
486discussion on these cross-compilation tools.
487
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500488.. _ref-classes-cve-check:
489
Andrew Geissler517393d2023-01-13 08:55:19 -0600490``cve-check``
491=============
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500492
Andrew Geissler517393d2023-01-13 08:55:19 -0600493The :ref:`ref-classes-cve-check` class looks for known CVEs (Common Vulnerabilities
Patrick Williams2390b1b2022-11-03 13:47:49 -0500494and Exposures) while building with BitBake. This class is meant to be
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500495inherited globally from a configuration file::
496
497 INHERIT += "cve-check"
498
Patrick Williams2390b1b2022-11-03 13:47:49 -0500499To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
500add following line to the build configuration file::
501
502 include cve-extra-exclusions.inc
503
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500504You can also look for vulnerabilities in specific packages by passing
Patrick Williams2390b1b2022-11-03 13:47:49 -0500505``-c cve_check`` to BitBake.
506
507After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
508and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files.
509
510When building, the CVE checker will emit build time warnings for any detected
511issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
512and version being compiled and no patches to address the issue are applied. Other states
513for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
514applied, and ``Ignored`` meaning that the issue can be ignored.
515
516The ``Patched`` state of a CVE issue is detected from patch files with the format
517``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
518CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
519
520If the recipe lists the ``CVE-ID`` in :term:`CVE_CHECK_IGNORE` variable, then the CVE state is reported
521as ``Ignored``. Multiple CVEs can be listed separated by spaces. Example::
522
523 CVE_CHECK_IGNORE += "CVE-2020-29509 CVE-2020-29511"
524
525If CVE check reports that a recipe contains false positives or false negatives, these may be
526fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables.
527:term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE
528database vendor and product pairs using the syntax::
529
530 CVE_PRODUCT = "flex_project:flex"
531
532where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
533if the default recipe version :term:`PV` does not match the version numbers of the software component
534in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
535CVE database compatible version number, for example::
536
537 CVE_VERSION = "2.39"
538
539Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
540via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
541
542Users should note that security is a process, not a product, and thus also CVE checking, analyzing results,
543patching and updating the software should be done as a regular process. The data and assumptions
544required for CVE checker to reliably detect issues are frequently broken in various ways.
545These can only be detected by reviewing the details of the issues and iterating over the generated reports,
546and following what happens in other Linux distributions and in the greater open source community.
547
548You will find some more details in the
Andrew Geissler517393d2023-01-13 08:55:19 -0600549":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500550section in the Development Tasks Manual.
551
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500552.. _ref-classes-debian:
553
Andrew Geissler517393d2023-01-13 08:55:19 -0600554``debian``
555==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500556
Andrew Geissler517393d2023-01-13 08:55:19 -0600557The :ref:`ref-classes-debian` class renames output packages so that they follow the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500558Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
559``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
560name and version as part of the package name.
561
562If a recipe creates packages for multiple libraries (shared object files
563of ``.so`` type), use the :term:`LEAD_SONAME`
564variable in the recipe to specify the library on which to apply the
565naming scheme.
566
567.. _ref-classes-deploy:
568
Andrew Geissler517393d2023-01-13 08:55:19 -0600569``deploy``
570==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500571
Andrew Geissler517393d2023-01-13 08:55:19 -0600572The :ref:`ref-classes-deploy` class handles deploying files to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500573:term:`DEPLOY_DIR_IMAGE` directory. The main
574function of this class is to allow the deploy step to be accelerated by
575shared state. Recipes that inherit this class should define their own
576:ref:`ref-tasks-deploy` function to copy the files to be
577deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
578add the task at the appropriate place, which is usually after
579:ref:`ref-tasks-compile` or
580:ref:`ref-tasks-install`. The class then takes care of
Andrew Geissler09036742021-06-25 14:25:14 -0500581staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500582
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500583.. _ref-classes-devicetree:
584
585``devicetree``
586==============
587
588The :ref:`ref-classes-devicetree` class allows to build a recipe that compiles
589device tree source files that are not in the kernel tree.
590
591The compilation of out-of-tree device tree sources is the same as the kernel
592in-tree device tree compilation process. This includes the ability to include
593sources from the kernel such as SoC ``dtsi`` files as well as C header files,
594such as ``gpio.h``.
595
596The :ref:`ref-tasks-compile` task will compile two kinds of files:
597
598- Regular device tree sources with a ``.dts`` extension.
599
600- Device tree overlays, detected from the presence of the ``/plugin/;``
601 string in the file contents.
602
603This class behaves in a similar way as the :ref:`ref-classes-kernel-devicetree`
604class, also deploying output files into ``/boot/devicetree``. However, this
605class stores the deployed device tree binaries into the ``devicetree``
606subdirectory. This avoids clashes with the :ref:`ref-classes-kernel-devicetree`
607output. Additionally, the device trees are populated into the sysroot for
608access via the sysroot from within other recipes.
609
610An extra padding is appended to non-overlay device trees binaries. This
611can typically be used as extra space for adding extra properties at boot time.
612The padding size can be modified by setting ``DT_PADDING_SIZE`` to the desired
613size, in bytes.
614
615See :oe_git:`devicetree.bbclass sources
616</openembedded-core/tree/meta/classes-recipe/devicetree.bbclass>`
617for further variables controlling this class.
618
619Here is an excerpt of an example ``recipes-kernel/linux/devicetree-acme.bb``
620recipe inheriting this class::
621
622 inherit devicetree
623 COMPATIBLE_MACHINE = "^mymachine$"
624 SRC_URI:mymachine = "file://mymachine.dts"
625
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500626.. _ref-classes-devshell:
627
Andrew Geissler517393d2023-01-13 08:55:19 -0600628``devshell``
629============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500630
Andrew Geissler517393d2023-01-13 08:55:19 -0600631The :ref:`ref-classes-devshell` class adds the :ref:`ref-tasks-devshell` task. Distribution
632policy dictates whether to include this class. See the ":ref:`dev-manual/development-shell:using a development shell`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500633section in the Yocto Project Development Tasks Manual for more
Andrew Geissler517393d2023-01-13 08:55:19 -0600634information about using :ref:`ref-classes-devshell`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500635
636.. _ref-classes-devupstream:
637
Andrew Geissler517393d2023-01-13 08:55:19 -0600638``devupstream``
639===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500640
Andrew Geissler517393d2023-01-13 08:55:19 -0600641The :ref:`ref-classes-devupstream` class uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500642:term:`BBCLASSEXTEND` to add a variant of the
643recipe that fetches from an alternative URI (e.g. Git) instead of a
Andrew Geisslerc926e172021-05-07 16:11:35 -0500644tarball. Following is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500645
646 BBCLASSEXTEND = "devupstream:target"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000647 SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500648 SRCREV:class-devupstream = "abcd1234"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500649
650Adding the above statements to your recipe creates a variant that has
651:term:`DEFAULT_PREFERENCE` set to "-1".
652Consequently, you need to select the variant of the recipe to use it.
653Any development-specific adjustments can be done by using the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500654``class-devupstream`` override. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500655
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500656 DEPENDS:append:class-devupstream = " gperf-native"
657 do_configure:prepend:class-devupstream() {
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500658 touch ${S}/README
659 }
660
661The class
662currently only supports creating a development variant of the target
Andrew Geissler517393d2023-01-13 08:55:19 -0600663recipe, not :ref:`ref-classes-native` or :ref:`ref-classes-nativesdk` variants.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500664
Andrew Geissler09036742021-06-25 14:25:14 -0500665The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
Andrew Geissler517393d2023-01-13 08:55:19 -0600666support for :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` variants. Consequently, this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500667functionality can be added in a future release.
668
669Support for other version control systems such as Subversion is limited
670due to BitBake's automatic fetch dependencies (e.g.
671``subversion-native``).
672
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500673.. _ref-classes-externalsrc:
674
Andrew Geissler517393d2023-01-13 08:55:19 -0600675``externalsrc``
676===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500677
Andrew Geissler517393d2023-01-13 08:55:19 -0600678The :ref:`ref-classes-externalsrc` class supports building software from source code
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500679that is external to the OpenEmbedded build system. Building software
680from an external source tree means that the build system's normal fetch,
681unpack, and patch process is not used.
682
683By default, the OpenEmbedded build system uses the :term:`S`
684and :term:`B` variables to locate unpacked recipe source code
685and to build it, respectively. When your recipe inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -0600686:ref:`ref-classes-externalsrc` class, you use the
687:term:`EXTERNALSRC` and :term:`EXTERNALSRC_BUILD` variables to
Andrew Geissler09036742021-06-25 14:25:14 -0500688ultimately define :term:`S` and :term:`B`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500689
690By default, this class expects the source code to support recipe builds
691that use the :term:`B` variable to point to the directory in
692which the OpenEmbedded build system places the generated objects built
Andrew Geissler09036742021-06-25 14:25:14 -0500693from the recipes. By default, the :term:`B` directory is set to the
694following, which is separate from the source directory (:term:`S`)::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500695
Andrew Geissler5199d832021-09-24 16:47:35 -0500696 ${WORKDIR}/${BPN}-{PV}/
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500697
698See these variables for more information:
699:term:`WORKDIR`, :term:`BPN`, and
700:term:`PV`,
701
Andrew Geissler517393d2023-01-13 08:55:19 -0600702For more information on the :ref:`ref-classes-externalsrc` class, see the comments in
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500703``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
Andrew Geissler517393d2023-01-13 08:55:19 -0600704For information on how to use the :ref:`ref-classes-externalsrc` class, see the
705":ref:`dev-manual/building:building software from an external source`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500706section in the Yocto Project Development Tasks Manual.
707
708.. _ref-classes-extrausers:
709
Andrew Geissler517393d2023-01-13 08:55:19 -0600710``extrausers``
711==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500712
Andrew Geissler517393d2023-01-13 08:55:19 -0600713The :ref:`ref-classes-extrausers` class allows additional user and group configuration
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500714to be applied at the image level. Inheriting this class either globally
715or from an image recipe allows additional user and group operations to
716be performed using the
717:term:`EXTRA_USERS_PARAMS` variable.
718
719.. note::
720
Andrew Geissler517393d2023-01-13 08:55:19 -0600721 The user and group operations added using the :ref:`ref-classes-extrausers`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500722 class are not tied to a specific recipe outside of the recipe for the
723 image. Thus, the operations can be performed across the image as a
Andrew Geissler517393d2023-01-13 08:55:19 -0600724 whole. Use the :ref:`ref-classes-useradd` class to add user and group
725 configuration to a specific recipe.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500726
Andrew Geisslerc926e172021-05-07 16:11:35 -0500727Here is an example that uses this class in an image recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500728
729 inherit extrausers
730 EXTRA_USERS_PARAMS = "\
731 useradd -p '' tester; \
732 groupadd developers; \
733 userdel nobody; \
734 groupdel -g video; \
735 groupmod -g 1020 developers; \
736 usermod -s /bin/sh tester; \
737 "
738
739Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
Andrew Geissler9aee5002022-03-30 16:27:02 +0000740passwords. First on host, create the (escaped) password hash::
Andrew Geisslereff27472021-10-29 15:35:00 -0500741
Andrew Geissler9aee5002022-03-30 16:27:02 +0000742 printf "%q" $(mkpasswd -m sha256crypt tester01)
Andrew Geisslereff27472021-10-29 15:35:00 -0500743
Andrew Geissler9aee5002022-03-30 16:27:02 +0000744The resulting hash is set to a variable and used in ``useradd`` command parameters::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500745
746 inherit extrausers
Andrew Geisslereff27472021-10-29 15:35:00 -0500747 PASSWD = "\$X\$ABC123\$A-Long-Hash"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500748 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500749 useradd -p '${PASSWD}' tester-jim; \
750 useradd -p '${PASSWD}' tester-sue; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500751 "
752
Andrew Geisslereff27472021-10-29 15:35:00 -0500753Finally, here is an example that sets the root password::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500754
755 inherit extrausers
756 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500757 usermod -p '${PASSWD}' root; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500758 "
759
Patrick Williams03907ee2022-05-01 06:28:52 -0500760.. note::
761
762 From a security perspective, hardcoding a default password is not
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500763 generally a good idea or even legal in some jurisdictions. It is
764 recommended that you do not do this if you are building a production
Patrick Williams03907ee2022-05-01 06:28:52 -0500765 image.
766
767
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600768.. _ref-classes-features_check:
769
Andrew Geissler517393d2023-01-13 08:55:19 -0600770``features_check``
771==================
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600772
Andrew Geissler517393d2023-01-13 08:55:19 -0600773The :ref:`ref-classes-features_check` class allows individual recipes to check
774for required and conflicting :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES`
775or :term:`COMBINED_FEATURES`.
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600776
777This class provides support for the following variables:
778
779- :term:`REQUIRED_DISTRO_FEATURES`
780- :term:`CONFLICT_DISTRO_FEATURES`
781- :term:`ANY_OF_DISTRO_FEATURES`
782- ``REQUIRED_MACHINE_FEATURES``
783- ``CONFLICT_MACHINE_FEATURES``
784- ``ANY_OF_MACHINE_FEATURES``
785- ``REQUIRED_COMBINED_FEATURES``
786- ``CONFLICT_COMBINED_FEATURES``
787- ``ANY_OF_COMBINED_FEATURES``
788
789If any conditions specified in the recipe using the above
790variables are not met, the recipe will be skipped, and if the
791build system attempts to build the recipe then an error will be
792triggered.
793
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500794.. _ref-classes-fontcache:
795
Andrew Geissler517393d2023-01-13 08:55:19 -0600796``fontcache``
797=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500798
Andrew Geissler517393d2023-01-13 08:55:19 -0600799The :ref:`ref-classes-fontcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500800post-remove (postinst and postrm) scriptlets for font packages. These
801scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
802to the font information cache. Since the cache files are
803architecture-specific, ``fc-cache`` runs using QEMU if the postinst
804scriptlets need to be run on the build host during image creation.
805
806If the fonts being installed are in packages other than the main
807package, set :term:`FONT_PACKAGES` to specify the
808packages containing the fonts.
809
810.. _ref-classes-fs-uuid:
811
Andrew Geissler517393d2023-01-13 08:55:19 -0600812``fs-uuid``
813===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500814
Andrew Geissler517393d2023-01-13 08:55:19 -0600815The :ref:`ref-classes-fs-uuid` class extracts UUID from
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500816``${``\ :term:`ROOTFS`\ ``}``, which must have been built
Andrew Geissler517393d2023-01-13 08:55:19 -0600817by the time that this function gets called. The :ref:`ref-classes-fs-uuid` class only
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500818works on ``ext`` file systems and depends on ``tune2fs``.
819
820.. _ref-classes-gconf:
821
Andrew Geissler517393d2023-01-13 08:55:19 -0600822``gconf``
823=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500824
Andrew Geissler517393d2023-01-13 08:55:19 -0600825The :ref:`ref-classes-gconf` class provides common functionality for recipes that need
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500826to install GConf schemas. The schemas will be put into a separate
827package (``${``\ :term:`PN`\ ``}-gconf``) that is created
828automatically when this class is inherited. This package uses the
829appropriate post-install and post-remove (postinst/postrm) scriptlets to
830register and unregister the schemas in the target image.
831
832.. _ref-classes-gettext:
833
Andrew Geissler517393d2023-01-13 08:55:19 -0600834``gettext``
835===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500836
Andrew Geissler517393d2023-01-13 08:55:19 -0600837The :ref:`ref-classes-gettext` class provides support for building
838software that uses the GNU ``gettext`` internationalization and localization
839system. All recipes building software that use ``gettext`` should inherit this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500840class.
841
Patrick Williams975a06f2022-10-21 14:42:47 -0500842.. _ref-classes-github-releases:
843
Andrew Geissler517393d2023-01-13 08:55:19 -0600844``github-releases``
845===================
Patrick Williams975a06f2022-10-21 14:42:47 -0500846
Andrew Geissler517393d2023-01-13 08:55:19 -0600847For recipes that fetch release tarballs from github, the :ref:`ref-classes-github-releases`
Patrick Williams975a06f2022-10-21 14:42:47 -0500848class sets up a standard way for checking available upstream versions
849(to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)).
850
Andrew Geissler517393d2023-01-13 08:55:19 -0600851To use it, add ":ref:`ref-classes-github-releases`" to the inherit line in the recipe,
Patrick Williams975a06f2022-10-21 14:42:47 -0500852and if the default value of :term:`GITHUB_BASE_URI` is not suitable,
853then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}``
854in the value you set for :term:`SRC_URI` within the recipe.
855
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500856.. _ref-classes-gnomebase:
857
Andrew Geissler517393d2023-01-13 08:55:19 -0600858``gnomebase``
859=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500860
Andrew Geissler517393d2023-01-13 08:55:19 -0600861The :ref:`ref-classes-gnomebase` class is the base class for recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500862software from the GNOME stack. This class sets
863:term:`SRC_URI` to download the source from the GNOME
864mirrors as well as extending :term:`FILES` with the typical
865GNOME installation paths.
866
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600867.. _ref-classes-go:
868
869``go``
870======
871
872The :ref:`ref-classes-go` class supports building Go programs. The behavior of
873this class is controlled by the mandatory :term:`GO_IMPORT` variable, and
874by the optional :term:`GO_INSTALL` and :term:`GO_INSTALL_FILTEROUT` ones.
875
876To build a Go program with the Yocto Project, you can use the
877:yocto_git:`go-helloworld_0.1.bb </poky/tree/meta/recipes-extended/go-examples/go-helloworld_0.1.bb>`
878recipe as an example.
879
880.. _ref-classes-go-mod:
881
882``go-mod``
883==========
884
885The :ref:`ref-classes-go-mod` class allows to use Go modules, and inherits the
886:ref:`ref-classes-go` class.
887
888See the associated :term:`GO_WORKDIR` variable.
889
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500890.. _ref-classes-gobject-introspection:
891
Andrew Geissler517393d2023-01-13 08:55:19 -0600892``gobject-introspection``
893=========================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500894
895Provides support for recipes building software that supports GObject
896introspection. This functionality is only enabled if the
897"gobject-introspection-data" feature is in
898:term:`DISTRO_FEATURES` as well as
899"qemu-usermode" being in
900:term:`MACHINE_FEATURES`.
901
902.. note::
903
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500904 This functionality is :ref:`backfilled <ref-features-backfill>` by default
905 and, if not applicable, should be disabled through
906 :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
Andrew Geissler09036742021-06-25 14:25:14 -0500907 :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500908
909.. _ref-classes-grub-efi:
910
Andrew Geissler517393d2023-01-13 08:55:19 -0600911``grub-efi``
912============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500913
Andrew Geissler517393d2023-01-13 08:55:19 -0600914The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500915building bootable images.
916
917This class supports several variables:
918
919- :term:`INITRD`: Indicates list of filesystem images to
920 concatenate and use as an initial RAM disk (initrd) (optional).
921
922- :term:`ROOTFS`: Indicates a filesystem image to include
923 as the root filesystem (optional).
924
925- :term:`GRUB_GFXSERIAL`: Set this to "1" to have
926 graphics and serial in the boot menu.
927
928- :term:`LABELS`: A list of targets for the automatic
929 configuration.
930
931- :term:`APPEND`: An override list of append strings for
932 each ``LABEL``.
933
934- :term:`GRUB_OPTS`: Additional options to add to the
935 configuration (optional). Options are delimited using semi-colon
936 characters (``;``).
937
938- :term:`GRUB_TIMEOUT`: Timeout before executing
939 the default ``LABEL`` (optional).
940
941.. _ref-classes-gsettings:
942
Andrew Geissler517393d2023-01-13 08:55:19 -0600943``gsettings``
944=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500945
Andrew Geissler517393d2023-01-13 08:55:19 -0600946The :ref:`ref-classes-gsettings` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500947need to install GSettings (glib) schemas. The schemas are assumed to be
948part of the main package. Appropriate post-install and post-remove
949(postinst/postrm) scriptlets are added to register and unregister the
950schemas in the target image.
951
952.. _ref-classes-gtk-doc:
953
Andrew Geissler517393d2023-01-13 08:55:19 -0600954``gtk-doc``
955===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500956
Andrew Geissler517393d2023-01-13 08:55:19 -0600957The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500958``gtk-doc`` dependencies and disable ``gtk-doc``.
959
960.. _ref-classes-gtk-icon-cache:
961
Andrew Geissler517393d2023-01-13 08:55:19 -0600962``gtk-icon-cache``
963==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500964
Andrew Geissler517393d2023-01-13 08:55:19 -0600965The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500966post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
967install icons. These scriptlets call ``gtk-update-icon-cache`` to add
968the fonts to GTK+'s icon cache. Since the cache files are
969architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
970the postinst scriptlets need to be run on the build host during image
971creation.
972
973.. _ref-classes-gtk-immodules-cache:
974
Andrew Geissler517393d2023-01-13 08:55:19 -0600975``gtk-immodules-cache``
976=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500977
Andrew Geissler517393d2023-01-13 08:55:19 -0600978The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500979post-remove (postinst/postrm) scriptlets for packages that install GTK+
980input method modules for virtual keyboards. These scriptlets call
981``gtk-update-icon-cache`` to add the input method modules to the cache.
982Since the cache files are architecture-specific,
983``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
984need to be run on the build host during image creation.
985
986If the input method modules being installed are in packages other than
987the main package, set
988:term:`GTKIMMODULES_PACKAGES` to specify
989the packages containing the modules.
990
991.. _ref-classes-gzipnative:
992
Andrew Geissler517393d2023-01-13 08:55:19 -0600993``gzipnative``
994==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500995
Andrew Geissler517393d2023-01-13 08:55:19 -0600996The :ref:`ref-classes-gzipnative` class enables the use of different native versions of
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500997``gzip`` and ``pigz`` rather than the versions of these tools from the
998build host.
999
1000.. _ref-classes-icecc:
1001
Andrew Geissler517393d2023-01-13 08:55:19 -06001002``icecc``
1003=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001004
Andrew Geissler517393d2023-01-13 08:55:19 -06001005The :ref:`ref-classes-icecc` class supports
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001006`Icecream <https://github.com/icecc/icecream>`__, which facilitates
1007taking compile jobs and distributing them among remote machines.
1008
1009The class stages directories with symlinks from ``gcc`` and ``g++`` to
1010``icecc``, for both native and cross compilers. Depending on each
1011configure or compile, the OpenEmbedded build system adds the directories
1012at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001013``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001014compilers, respectively.
1015
1016For the cross compiler, the class creates a ``tar.gz`` file that
1017contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
1018is the version of the cross-compiler used in the cross-development
1019toolchain, accordingly.
1020
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001021The class handles all three different compile stages (i.e native,
1022cross-kernel and target) and creates the necessary environment
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001023``tar.gz`` file to be used by the remote machines. The class also
1024supports SDK generation.
1025
1026If :term:`ICECC_PATH` is not set in your
1027``local.conf`` file, then the class tries to locate the ``icecc`` binary
1028using ``which``. If :term:`ICECC_ENV_EXEC` is set
1029in your ``local.conf`` file, the variable should point to the
1030``icecc-create-env`` script provided by the user. If you do not point to
1031a user-provided script, the build system uses the default script
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001032provided by the recipe :oe_git:`icecc-create-env_0.1.bb
1033</openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001034
1035.. note::
1036
1037 This script is a modified version and not the one that comes with
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001038 ``icecream``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001039
1040If you do not want the Icecream distributed compile support to apply to
Andrew Geissler595f6302022-01-24 19:11:47 +00001041specific recipes or classes, you can ask them to be ignored by Icecream
1042by listing the recipes and classes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001043:term:`ICECC_RECIPE_DISABLE` and
1044:term:`ICECC_CLASS_DISABLE` variables,
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001045respectively, in your ``local.conf`` file. Doing so causes the
1046OpenEmbedded build system to handle these compilations locally.
1047
1048Additionally, you can list recipes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001049:term:`ICECC_RECIPE_ENABLE` variable in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001050your ``local.conf`` file to force ``icecc`` to be enabled for recipes
1051using an empty :term:`PARALLEL_MAKE` variable.
1052
Andrew Geissler517393d2023-01-13 08:55:19 -06001053Inheriting the :ref:`ref-classes-icecc` class changes all sstate signatures.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001054Consequently, if a development team has a dedicated build system that
1055populates :term:`SSTATE_MIRRORS` and they want to
Andrew Geissler09036742021-06-25 14:25:14 -05001056reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
Andrew Geissler517393d2023-01-13 08:55:19 -06001057system need to either inherit the :ref:`ref-classes-icecc` class or nobody should.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001058
Andrew Geissler517393d2023-01-13 08:55:19 -06001059At the distribution level, you can inherit the :ref:`ref-classes-icecc` class to be
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001060sure that all builders start with the same sstate signatures. After
1061inheriting the class, you can then disable the feature by setting the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001062:term:`ICECC_DISABLED` variable to "1" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001063
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001064 INHERIT_DISTRO:append = " icecc"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001065 ICECC_DISABLED ??= "1"
1066
1067This practice
1068makes sure everyone is using the same signatures but also requires
1069individuals that do want to use Icecream to enable the feature
Andrew Geisslerc926e172021-05-07 16:11:35 -05001070individually as follows in your ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001071
1072 ICECC_DISABLED = ""
1073
1074.. _ref-classes-image:
1075
Andrew Geissler517393d2023-01-13 08:55:19 -06001076``image``
1077=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001078
Andrew Geissler517393d2023-01-13 08:55:19 -06001079The :ref:`ref-classes-image` class helps support creating images in different formats.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001080First, the root filesystem is created from packages using one of the
1081``rootfs*.bbclass`` files (depending on the package format used) and
1082then one or more image files are created.
1083
Andrew Geissler09036742021-06-25 14:25:14 -05001084- The :term:`IMAGE_FSTYPES` variable controls the types of images to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001085 generate.
1086
Andrew Geissler09036742021-06-25 14:25:14 -05001087- The :term:`IMAGE_INSTALL` variable controls the list of packages to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001088 install into the image.
1089
1090For information on customizing images, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001091":ref:`dev-manual/customizing-images:customizing images`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001092in the Yocto Project Development Tasks Manual. For information on how
1093images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001094":ref:`overview-manual/concepts:images`" section in the
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001095Yocto Project Overview and Concepts Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001096
1097.. _ref-classes-image-buildinfo:
1098
Andrew Geissler517393d2023-01-13 08:55:19 -06001099``image-buildinfo``
1100===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001101
Andrew Geissler517393d2023-01-13 08:55:19 -06001102The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing
Patrick Williams975a06f2022-10-21 14:42:47 -05001103build information to the target filesystem at ``${sysconfdir}/buildinfo``
Patrick Williams7784c422022-11-17 07:29:11 -06001104by default (as specified by :term:`IMAGE_BUILDINFO_FILE`).
Patrick Williams975a06f2022-10-21 14:42:47 -05001105This can be useful for manually determining the origin of any given
1106image. It writes out two sections:
1107
Andrew Geissler517393d2023-01-13 08:55:19 -06001108#. `Build Configuration`: a list of variables and their values (specified
Patrick Williams975a06f2022-10-21 14:42:47 -05001109 by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and
1110 :term:`DISTRO_VERSION`)
1111
Andrew Geissler517393d2023-01-13 08:55:19 -06001112#. `Layer Revisions`: the revisions of all of the layers used in the
Patrick Williams975a06f2022-10-21 14:42:47 -05001113 build.
1114
1115Additionally, when building an SDK it will write the same contents
1116to ``/buildinfo`` by default (as specified by
1117:term:`SDK_BUILDINFO_FILE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001118
1119.. _ref-classes-image_types:
1120
Andrew Geissler517393d2023-01-13 08:55:19 -06001121``image_types``
1122===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001123
Andrew Geissler517393d2023-01-13 08:55:19 -06001124The :ref:`ref-classes-image_types` class defines all of the standard image output types
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001125that you can enable through the
1126:term:`IMAGE_FSTYPES` variable. You can use this
1127class as a reference on how to add support for custom image output
1128types.
1129
Andrew Geissler517393d2023-01-13 08:55:19 -06001130By default, the :ref:`ref-classes-image` class automatically
1131enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001132``IMGCLASSES`` variable as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001133
1134 IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
1135 IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
1136 IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
1137 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
1138 IMGCLASSES += "image_types_wic"
1139 IMGCLASSES += "rootfs-postcommands"
1140 IMGCLASSES += "image-postinst-intercepts"
1141 inherit ${IMGCLASSES}
1142
Andrew Geissler517393d2023-01-13 08:55:19 -06001143The :ref:`ref-classes-image_types` class also handles conversion and compression of images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001144
1145.. note::
1146
1147 To build a VMware VMDK image, you need to add "wic.vmdk" to
Andrew Geissler09036742021-06-25 14:25:14 -05001148 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001149 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001150
1151.. _ref-classes-image-live:
1152
Andrew Geissler517393d2023-01-13 08:55:19 -06001153``image-live``
1154==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001155
1156This class controls building "live" (i.e. HDDIMG and ISO) images. Live
1157images contain syslinux for legacy booting, as well as the bootloader
1158specified by :term:`EFI_PROVIDER` if
1159:term:`MACHINE_FEATURES` contains "efi".
1160
1161Normally, you do not use this class directly. Instead, you add "live" to
1162:term:`IMAGE_FSTYPES`.
1163
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001164.. _ref-classes-insane:
1165
Andrew Geissler517393d2023-01-13 08:55:19 -06001166``insane``
1167==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001168
Andrew Geissler517393d2023-01-13 08:55:19 -06001169The :ref:`ref-classes-insane` class adds a step to the package generation process so
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001170that output quality assurance checks are generated by the OpenEmbedded
1171build system. A range of checks are performed that check the build's
1172output for common problems that show up during runtime. Distribution
1173policy usually dictates whether to include this class.
1174
1175You can configure the sanity checks so that specific test failures
1176either raise a warning or an error message. Typically, failures for new
1177tests generate a warning. Subsequent failures for the same test would
1178then generate an error message once the metadata is in a known and good
Andrew Geissler09209ee2020-12-13 08:44:15 -06001179condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001180and error messages you might encounter using a default configuration.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001181
1182Use the :term:`WARN_QA` and
1183:term:`ERROR_QA` variables to control the behavior of
1184these checks at the global level (i.e. in your custom distro
1185configuration). However, to skip one or more checks in recipes, you
1186should use :term:`INSANE_SKIP`. For example, to skip
1187the check for symbolic link ``.so`` files in the main package of a
1188recipe, add the following to the recipe. You need to realize that the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001189package name override, in this example ``${PN}``, must be used::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001190
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001191 INSANE_SKIP:${PN} += "dev-so"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001192
1193Please keep in mind that the QA checks
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001194are meant to detect real or potential problems in the packaged
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001195output. So exercise caution when disabling these checks.
1196
Andrew Geissler09036742021-06-25 14:25:14 -05001197Here are the tests you can list with the :term:`WARN_QA` and
Andrew Geissler5f350902021-07-23 13:09:54 -04001198:term:`ERROR_QA` variables:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001199
1200- ``already-stripped:`` Checks that produced binaries have not
1201 already been stripped prior to the build system extracting debug
1202 symbols. It is common for upstream software projects to default to
1203 stripping debug symbols for output binaries. In order for debugging
1204 to work on the target using ``-dbg`` packages, this stripping must be
1205 disabled.
1206
1207- ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1208 size, and endianness of any binaries to ensure they match the target
1209 architecture. This test fails if any binaries do not match the type
1210 since there would be an incompatibility. The test could indicate that
1211 the wrong compiler or compiler options have been used. Sometimes
1212 software, like bootloaders, might need to bypass this check.
1213
1214- ``buildpaths:`` Checks for paths to locations on the build host
Patrick Williams975a06f2022-10-21 14:42:47 -05001215 inside the output files. Not only can these leak information about
1216 the build environment, they also hinder binary reproducibility.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001217
1218- ``build-deps:`` Determines if a build-time dependency that is
1219 specified through :term:`DEPENDS`, explicit
1220 :term:`RDEPENDS`, or task-level dependencies exists
1221 to match any runtime dependency. This determination is particularly
1222 useful to discover where runtime dependencies are detected and added
1223 during packaging. If no explicit dependency has been specified within
1224 the metadata, at the packaging stage it is too late to ensure that
1225 the dependency is built, and thus you can end up with an error when
1226 the package is installed into the image during the
1227 :ref:`ref-tasks-rootfs` task because the auto-detected
1228 dependency was not satisfied. An example of this would be where the
Andrew Geissler517393d2023-01-13 08:55:19 -06001229 :ref:`ref-classes-update-rc.d` class automatically
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001230 adds a dependency on the ``initscripts-functions`` package to
1231 packages that install an initscript that refers to
1232 ``/etc/init.d/functions``. The recipe should really have an explicit
Andrew Geissler5f350902021-07-23 13:09:54 -04001233 :term:`RDEPENDS` for the package in question on ``initscripts-functions``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001234 so that the OpenEmbedded build system is able to ensure that the
1235 ``initscripts`` recipe is actually built and thus the
1236 ``initscripts-functions`` package is made available.
1237
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001238- ``configure-gettext:`` Checks that if a recipe is building something
1239 that uses automake and the automake files contain an ``AM_GNU_GETTEXT``
1240 directive, that the recipe also inherits the :ref:`ref-classes-gettext`
1241 class to ensure that gettext is available during the build.
1242
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001243- ``compile-host-path:`` Checks the
1244 :ref:`ref-tasks-compile` log for indications that
1245 paths to locations on the build host were used. Using such paths
1246 might result in host contamination of the build output.
1247
1248- ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1249 do not depend on ``-dbg`` packages, which would cause a packaging
1250 bug.
1251
1252- ``debug-files:`` Checks for ``.debug`` directories in anything but
1253 the ``-dbg`` package. The debug files should all be in the ``-dbg``
1254 package. Thus, anything packaged elsewhere is incorrect packaging.
1255
1256- ``dep-cmp:`` Checks for invalid version comparison statements in
1257 runtime dependency relationships between packages (i.e. in
1258 :term:`RDEPENDS`,
1259 :term:`RRECOMMENDS`,
1260 :term:`RSUGGESTS`,
1261 :term:`RPROVIDES`,
1262 :term:`RREPLACES`, and
1263 :term:`RCONFLICTS` variable values). Any invalid
1264 comparisons might trigger failures or undesirable behavior when
1265 passed to the package manager.
1266
1267- ``desktop:`` Runs the ``desktop-file-validate`` program against any
1268 ``.desktop`` files to validate their contents against the
1269 specification for ``.desktop`` files.
1270
1271- ``dev-deps:`` Checks that all packages except ``-dev`` or
1272 ``-staticdev`` packages do not depend on ``-dev`` packages, which
1273 would be a packaging bug.
1274
1275- ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1276 ``-dev`` package and not in any of the other packages. In general,
1277 these symlinks are only useful for development purposes. Thus, the
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001278 ``-dev`` package is the correct location for them. In very rare
1279 cases, such as dynamically loaded modules, these symlinks
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001280 are needed instead in the main package.
1281
Patrick Williams03907ee2022-05-01 06:28:52 -05001282- ``empty-dirs:`` Checks that packages are not installing files to
1283 directories that are normally expected to be empty (such as ``/tmp``)
1284 The list of directories that are checked is specified by the
1285 :term:`QA_EMPTY_DIRS` variable.
1286
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001287- ``file-rdeps:`` Checks that file-level dependencies identified by
1288 the OpenEmbedded build system at packaging time are satisfied. For
1289 example, a shell script might start with the line ``#!/bin/bash``.
1290 This line would translate to a file dependency on ``/bin/bash``. Of
1291 the three package managers that the OpenEmbedded build system
1292 supports, only RPM directly handles file-level dependencies,
1293 resolving them automatically to packages providing the files.
1294 However, the lack of that functionality in the other two package
1295 managers does not mean the dependencies do not still need resolving.
1296 This QA check attempts to ensure that explicitly declared
1297 :term:`RDEPENDS` exist to handle any file-level
1298 dependency detected in packaged files.
1299
1300- ``files-invalid:`` Checks for :term:`FILES` variable
1301 values that contain "//", which is invalid.
1302
1303- ``host-user-contaminated:`` Checks that no package produced by the
1304 recipe contains any files outside of ``/home`` with a user or group
1305 ID that matches the user running BitBake. A match usually indicates
1306 that the files are being installed with an incorrect UID/GID, since
1307 target IDs are independent from host IDs. For additional information,
1308 see the section describing the
1309 :ref:`ref-tasks-install` task.
1310
1311- ``incompatible-license:`` Report when packages are excluded from
1312 being created due to being marked with a license that is in
1313 :term:`INCOMPATIBLE_LICENSE`.
1314
1315- ``install-host-path:`` Checks the
1316 :ref:`ref-tasks-install` log for indications that
1317 paths to locations on the build host were used. Using such paths
1318 might result in host contamination of the build output.
1319
1320- ``installed-vs-shipped:`` Reports when files have been installed
Patrick Williams2194f502022-10-16 14:26:09 -05001321 within :ref:`ref-tasks-install` but have not been included in any package by
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001322 way of the :term:`FILES` variable. Files that do not
1323 appear in any package cannot be present in an image later on in the
1324 build process. Ideally, all installed files should be packaged or not
1325 installed at all. These files can be deleted at the end of
Patrick Williams2194f502022-10-16 14:26:09 -05001326 :ref:`ref-tasks-install` if the files are not needed in any package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001327
1328- ``invalid-chars:`` Checks that the recipe metadata variables
1329 :term:`DESCRIPTION`,
1330 :term:`SUMMARY`, :term:`LICENSE`, and
1331 :term:`SECTION` do not contain non-UTF-8 characters.
1332 Some package managers do not support such characters.
1333
1334- ``invalid-packageconfig:`` Checks that no undefined features are
1335 being added to :term:`PACKAGECONFIG`. For
Andrew Geisslerc926e172021-05-07 16:11:35 -05001336 example, any name "foo" for which the following form does not exist::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001337
1338 PACKAGECONFIG[foo] = "..."
1339
Andrew Geissler09036742021-06-25 14:25:14 -05001340- ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001341 file containing these paths is incorrect since ``libtool`` adds the
1342 correct sysroot prefix when using the files automatically itself.
1343
1344- ``ldflags:`` Ensures that the binaries were linked with the
1345 :term:`LDFLAGS` options provided by the build system.
Andrew Geissler09036742021-06-25 14:25:14 -05001346 If this test fails, check that the :term:`LDFLAGS` variable is being
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001347 passed to the linker command.
1348
1349- ``libdir:`` Checks for libraries being installed into incorrect
1350 (possibly hardcoded) installation paths. For example, this test will
1351 catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1352 "lib32". Another example is when recipes install
1353 ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1354
1355- ``libexec:`` Checks if a package contains files in
1356 ``/usr/libexec``. This check is not performed if the ``libexecdir``
1357 variable has been set explicitly to ``/usr/libexec``.
1358
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001359- ``mime:`` Check that if a package contains mime type files (``.xml``
1360 files in ``${datadir}/mime/packages``) that the recipe also inherits
1361 the :ref:`ref-classes-mime` class in order to ensure that these get
1362 properly installed.
1363
1364- ``mime-xdg:`` Checks that if a package contains a .desktop file with a
1365 'MimeType' key present, that the recipe inherits the
1366 :ref:`ref-classes-mime-xdg` class that is required in order for that
1367 to be activated.
1368
1369- ``missing-update-alternatives:`` Check that if a recipe sets the
1370 :term:`ALTERNATIVE` variable that the recipe also inherits
1371 :ref:`ref-classes-update-alternatives` such that the alternative will
1372 be correctly set up.
1373
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001374- ``packages-list:`` Checks for the same package being listed
1375 multiple times through the :term:`PACKAGES` variable
1376 value. Installing the package in this manner can cause errors during
1377 packaging.
1378
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001379- ``patch-fuzz:`` Checks for fuzz in patch files that may allow
1380 them to apply incorrectly if the underlying code changes.
1381
1382- ``patch-status-core:`` Checks that the Upstream-Status is specified
1383 and valid in the headers of patches for recipes in the OE-Core layer.
1384
1385- ``patch-status-noncore:`` Checks that the Upstream-Status is specified
1386 and valid in the headers of patches for recipes in layers other than
1387 OE-Core.
1388
1389- ``perllocalpod:`` Checks for ``perllocal.pod`` being erroneously
1390 installed and packaged by a recipe.
1391
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001392- ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1393 invalid format.
1394
1395- ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1396 invalid format.
1397
1398- ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1399 'link' where the specified target already exists.
1400
1401- ``perms:`` Currently, this check is unused but reserved.
1402
1403- ``pkgconfig:`` Checks ``.pc`` files for any
1404 :term:`TMPDIR`/:term:`WORKDIR` paths.
1405 Any ``.pc`` file containing these paths is incorrect since
1406 ``pkg-config`` itself adds the correct sysroot prefix when the files
1407 are accessed.
1408
1409- ``pkgname:`` Checks that all packages in
1410 :term:`PACKAGES` have names that do not contain
1411 invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1412 -).
1413
Andrew Geissler09036742021-06-25 14:25:14 -05001414- ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001415 undefined during :ref:`ref-tasks-package`.
1416
1417- ``pkgvarcheck:`` Checks through the variables
1418 :term:`RDEPENDS`,
1419 :term:`RRECOMMENDS`,
1420 :term:`RSUGGESTS`,
1421 :term:`RCONFLICTS`,
1422 :term:`RPROVIDES`,
1423 :term:`RREPLACES`, :term:`FILES`,
1424 :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1425 ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1426 there are variable sets that are not package-specific. Using these
1427 variables without a package suffix is bad practice, and might
1428 unnecessarily complicate dependencies of other packages within the
1429 same recipe or have other unintended consequences.
1430
1431- ``pn-overrides:`` Checks that a recipe does not have a name
1432 (:term:`PN`) value that appears in
1433 :term:`OVERRIDES`. If a recipe is named such that
Andrew Geissler09036742021-06-25 14:25:14 -05001434 its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
1435 :term:`PN` happens to be the same as :term:`MACHINE` or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001436 :term:`DISTRO`), it can have unexpected consequences.
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001437 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001438 turn into ``FILES = "xyz"``.
1439
1440- ``rpaths:`` Checks for rpaths in the binaries that contain build
Andrew Geissler5f350902021-07-23 13:09:54 -04001441 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001442 options are being passed to the linker commands and your binaries
1443 have potential security issues.
1444
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001445- ``shebang-size:`` Check that the shebang line (``#!`` in the first line)
1446 in a packaged script is not longer than 128 characters, which can cause
1447 an error at runtime depending on the operating system.
1448
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001449- ``split-strip:`` Reports that splitting or stripping debug symbols
1450 from binaries has failed.
1451
1452- ``staticdev:`` Checks for static library files (``*.a``) in
1453 non-``staticdev`` packages.
1454
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001455- ``src-uri-bad:`` Checks that the :term:`SRC_URI` value set by a recipe
1456 does not contain a reference to ``${PN}`` (instead of the correct
1457 ``${BPN}``) nor refers to unstable Github archive tarballs.
1458
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001459- ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1460 into :term:`TMPDIR` on the host. Such symlinks will
1461 work on the host, but are clearly invalid when running on the target.
1462
1463- ``textrel:`` Checks for ELF binaries that contain relocations in
1464 their ``.text`` sections, which can result in a performance impact at
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001465 runtime. See the explanation for the ``ELF binary`` message in
Andrew Geissler09209ee2020-12-13 08:44:15 -06001466 ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001467 issues.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001468
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001469- ``unhandled-features-check:`` check that if one of the variables that
1470 the :ref:`ref-classes-features_check` class supports (e.g.
1471 :term:`REQUIRED_DISTRO_FEATURES`) is set by a recupe, then the recipe
1472 also inherits :ref:`ref-classes-features_check` in order for the
1473 requirement to actually work.
1474
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001475- ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1476 for a package are also declared on the recipe level (i.e. any license
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001477 in ``LICENSE:*`` should appear in :term:`LICENSE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001478
1479- ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1480 in the binaries that by default on a standard system are searched by
1481 the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1482 not cause any breakage, they do waste space and are unnecessary.
1483
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001484- ``usrmerge:`` If ``usrmerge`` is in :term:`DISTRO_FEATURES`, this
1485 check will ensure that no package installs files to root (``/bin``,
1486 ``/sbin``, ``/lib``, ``/lib64``) directories.
1487
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001488- ``var-undefined:`` Reports when variables fundamental to packaging
1489 (i.e. :term:`WORKDIR`,
1490 :term:`DEPLOY_DIR`, :term:`D`,
1491 :term:`PN`, and :term:`PKGD`) are undefined
1492 during :ref:`ref-tasks-package`.
1493
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001494- ``version-going-backwards:`` If the :ref:`ref-classes-buildhistory`
1495 class is enabled, reports when a package being written out has a lower
1496 version than the previously written package under the same name. If
1497 you are placing output packages into a feed and upgrading packages on
1498 a target system using that feed, the version of a package going
1499 backwards can result in the target system not correctly upgrading to
1500 the "new" version of the package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001501
1502 .. note::
1503
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001504 This is only relevant when you are using runtime package management
1505 on your target system.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001506
1507- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1508 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1509 driver ABI names. All drivers should depend on the ABI versions that
1510 they have been built against. Driver recipes that include
1511 ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1512 automatically get these versions. Consequently, you should only need
1513 to explicitly add dependencies to binary driver recipes.
1514
1515.. _ref-classes-insserv:
1516
Andrew Geissler517393d2023-01-13 08:55:19 -06001517``insserv``
1518===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001519
Andrew Geissler517393d2023-01-13 08:55:19 -06001520The :ref:`ref-classes-insserv` class uses the ``insserv`` utility to update the order
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001521of symbolic links in ``/etc/rc?.d/`` within an image based on
1522dependencies specified by LSB headers in the ``init.d`` scripts
1523themselves.
1524
1525.. _ref-classes-kernel:
1526
Andrew Geissler517393d2023-01-13 08:55:19 -06001527``kernel``
1528==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001529
Andrew Geissler517393d2023-01-13 08:55:19 -06001530The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001531code to build all kernel trees. All needed headers are staged into the
Andrew Geissler5f350902021-07-23 13:09:54 -04001532:term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
Andrew Geissler517393d2023-01-13 08:55:19 -06001533using the :ref:`ref-classes-module` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001534
1535This means that each built kernel module is packaged separately and
1536inter-module dependencies are created by parsing the ``modinfo`` output.
1537If all modules are required, then installing the ``kernel-modules``
1538package installs all packages with modules and various other kernel
1539packages such as ``kernel-vmlinux``.
1540
Andrew Geissler517393d2023-01-13 08:55:19 -06001541The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial
Patrick Williams2194f502022-10-16 14:26:09 -05001542RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
1543information on how to build an :term:`Initramfs`, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001544":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001545the Yocto Project Development Tasks Manual.
1546
Andrew Geissler517393d2023-01-13 08:55:19 -06001547Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes
1548internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and
1549:ref:`ref-classes-linux-kernel-base` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001550
1551.. _ref-classes-kernel-arch:
1552
Andrew Geissler517393d2023-01-13 08:55:19 -06001553``kernel-arch``
1554===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001555
Andrew Geissler517393d2023-01-13 08:55:19 -06001556The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001557Linux kernel compilation (including modules).
1558
1559.. _ref-classes-kernel-devicetree:
1560
Andrew Geissler517393d2023-01-13 08:55:19 -06001561``kernel-devicetree``
1562=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001563
Andrew Geissler517393d2023-01-13 08:55:19 -06001564The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the
1565:ref:`ref-classes-kernel` class, supports device tree generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001566
1567.. _ref-classes-kernel-fitimage:
1568
Andrew Geissler517393d2023-01-13 08:55:19 -06001569``kernel-fitimage``
1570===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001571
Andrew Geissler517393d2023-01-13 08:55:19 -06001572The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image,
1573device trees, a U-boot script, a :term:`Initramfs` bundle and a RAM disk
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001574into a single FIT image. In theory, a FIT image can support any number
Andrew Geissler517393d2023-01-13 08:55:19 -06001575of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees.
1576However, :ref:`ref-classes-kernel-fitimage` currently only supports
Patrick Williams975a06f2022-10-21 14:42:47 -05001577limited usecases: just one kernel image, an optional U-boot script,
Andrew Geissler517393d2023-01-13 08:55:19 -06001578an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001579device tree.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001580
1581To create a FIT image, it is required that :term:`KERNEL_CLASSES`
Andrew Geissler517393d2023-01-13 08:55:19 -06001582is set to include ":ref:`ref-classes-kernel-fitimage`" and :term:`KERNEL_IMAGETYPE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001583is set to "fitImage".
1584
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001585The options for the device tree compiler passed to ``mkimage -D``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001586when creating the FIT image are specified using the
1587:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1588
1589Only a single kernel can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001590:ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001591address where the kernel image is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001592specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
1593:term:`UBOOT_ENTRYPOINT`.
1594
1595Multiple device trees can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001596:ref:`ref-classes-kernel-fitimage` and the device tree is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001597The address where the device tree is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001598specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001599and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001600
1601Only a single RAM disk can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001602:ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001603The address where the RAM disk image is to be loaded by U-Boot
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001604is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
1605:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to FIT image when
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001606:term:`INITRAMFS_IMAGE` is specified and that :term:`INITRAMFS_IMAGE_BUNDLE`
1607is set to 0.
1608
Andrew Geissler517393d2023-01-13 08:55:19 -06001609Only a single :term:`Initramfs` bundle can be added to the FIT image created by
1610:ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional.
1611In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001612in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
Andrew Geissler517393d2023-01-13 08:55:19 -06001613When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem.
1614The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001615is specified and that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
Andrew Geissler517393d2023-01-13 08:55:19 -06001616The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001617by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1618
1619Only a single U-boot boot script can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001620:ref:`ref-classes-kernel-fitimage` and the boot script is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001621The boot script is specified in the ITS file as a text file containing
1622U-boot commands. When using a boot script the user should configure the
Patrick Williams2194f502022-10-16 14:26:09 -05001623U-boot :ref:`ref-tasks-install` task to copy the script to sysroot.
Andrew Geissler517393d2023-01-13 08:55:19 -06001624So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001625class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
1626load the boot script from the FIT image and executes it.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001627
Andrew Geissler517393d2023-01-13 08:55:19 -06001628The FIT image generated by :ref:`ref-classes-kernel-fitimage` class is signed when the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001629variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1630:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1631appropriately. The default values used for :term:`FIT_HASH_ALG` and
Andrew Geissler517393d2023-01-13 08:55:19 -06001632:term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001633"rsa2048" respectively. The keys for signing fitImage can be generated using
Andrew Geissler517393d2023-01-13 08:55:19 -06001634the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001635:term:`UBOOT_SIGN_ENABLE` are set to "1".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001636
1637
1638.. _ref-classes-kernel-grub:
1639
Andrew Geissler517393d2023-01-13 08:55:19 -06001640``kernel-grub``
1641===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001642
Andrew Geissler517393d2023-01-13 08:55:19 -06001643The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001644the kernel as the priority boot mechanism while installing a RPM to
1645update the kernel on a deployed target.
1646
1647.. _ref-classes-kernel-module-split:
1648
Andrew Geissler517393d2023-01-13 08:55:19 -06001649``kernel-module-split``
1650=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001651
Andrew Geissler517393d2023-01-13 08:55:19 -06001652The :ref:`ref-classes-kernel-module-split` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001653splitting Linux kernel modules into separate packages.
1654
1655.. _ref-classes-kernel-uboot:
1656
Andrew Geissler517393d2023-01-13 08:55:19 -06001657``kernel-uboot``
1658================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001659
Andrew Geissler517393d2023-01-13 08:55:19 -06001660The :ref:`ref-classes-kernel-uboot` class provides support for building from
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001661vmlinux-style kernel sources.
1662
1663.. _ref-classes-kernel-uimage:
1664
Andrew Geissler517393d2023-01-13 08:55:19 -06001665``kernel-uimage``
1666=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001667
Andrew Geissler517393d2023-01-13 08:55:19 -06001668The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001669
1670.. _ref-classes-kernel-yocto:
1671
Andrew Geissler517393d2023-01-13 08:55:19 -06001672``kernel-yocto``
1673================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001674
Andrew Geissler517393d2023-01-13 08:55:19 -06001675The :ref:`ref-classes-kernel-yocto` class provides common functionality for building
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001676from linux-yocto style kernel source repositories.
1677
1678.. _ref-classes-kernelsrc:
1679
Andrew Geissler517393d2023-01-13 08:55:19 -06001680``kernelsrc``
1681=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001682
Andrew Geissler517393d2023-01-13 08:55:19 -06001683The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001684
1685.. _ref-classes-lib_package:
1686
Andrew Geissler517393d2023-01-13 08:55:19 -06001687``lib_package``
1688===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001689
Andrew Geissler517393d2023-01-13 08:55:19 -06001690The :ref:`ref-classes-lib_package` class supports recipes that build libraries and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001691produce executable binaries, where those binaries should not be
1692installed by default along with the library. Instead, the binaries are
1693added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1694make their installation optional.
1695
1696.. _ref-classes-libc*:
1697
Andrew Geissler517393d2023-01-13 08:55:19 -06001698``libc*``
1699=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001700
Andrew Geissler517393d2023-01-13 08:55:19 -06001701The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001702
Patrick Williams2390b1b2022-11-03 13:47:49 -05001703- The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001704 ``libc``.
1705
Patrick Williams2390b1b2022-11-03 13:47:49 -05001706- The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001707 ``eglibc``.
1708
1709.. _ref-classes-license:
1710
Andrew Geissler517393d2023-01-13 08:55:19 -06001711``license``
1712===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001713
Andrew Geissler517393d2023-01-13 08:55:19 -06001714The :ref:`ref-classes-license` class provides license manifest creation and license
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001715exclusion. This class is enabled by default using the default value for
1716the :term:`INHERIT_DISTRO` variable.
1717
1718.. _ref-classes-linux-kernel-base:
1719
Andrew Geissler517393d2023-01-13 08:55:19 -06001720``linux-kernel-base``
1721=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001722
Andrew Geissler517393d2023-01-13 08:55:19 -06001723The :ref:`ref-classes-linux-kernel-base` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001724recipes that build out of the Linux kernel source tree. These builds
1725goes beyond the kernel itself. For example, the Perf recipe also
1726inherits this class.
1727
1728.. _ref-classes-linuxloader:
1729
Andrew Geissler517393d2023-01-13 08:55:19 -06001730``linuxloader``
1731===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001732
1733Provides the function ``linuxloader()``, which gives the value of the
1734dynamic loader/linker provided on the platform. This value is used by a
1735number of other classes.
1736
1737.. _ref-classes-logging:
1738
Andrew Geissler517393d2023-01-13 08:55:19 -06001739``logging``
1740===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001741
Andrew Geissler517393d2023-01-13 08:55:19 -06001742The :ref:`ref-classes-logging` class provides the standard shell functions used to log
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001743messages for various BitBake severity levels (i.e. ``bbplain``,
1744``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1745
Andrew Geissler517393d2023-01-13 08:55:19 -06001746This class is enabled by default since it is inherited by the :ref:`ref-classes-base`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001747class.
1748
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001749.. _ref-classes-meson:
1750
1751``meson``
1752=========
1753
1754The :ref:`ref-classes-meson` class allows to create recipes that build software
1755using the `Meson <https://mesonbuild.com/>`__ build system. You can use
1756the :term:`MESON_BUILDTYPE` and :term:`EXTRA_OEMESON` variables to specify
1757additional configuration options to be passed using the ``meson`` command line.
1758
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001759.. _ref-classes-metadata_scm:
1760
Andrew Geissler517393d2023-01-13 08:55:19 -06001761``metadata_scm``
1762================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001763
Andrew Geissler517393d2023-01-13 08:55:19 -06001764The :ref:`ref-classes-metadata_scm` class provides functionality for querying the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001765branch and revision of a Source Code Manager (SCM) repository.
1766
Andrew Geissler517393d2023-01-13 08:55:19 -06001767The :ref:`ref-classes-base` class uses this class to print the revisions of
1768each layer before starting every build. The :ref:`ref-classes-metadata_scm`
1769class is enabled by default because it is inherited by the
1770:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001771
1772.. _ref-classes-migrate_localcount:
1773
Andrew Geissler517393d2023-01-13 08:55:19 -06001774``migrate_localcount``
1775======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001776
Andrew Geissler517393d2023-01-13 08:55:19 -06001777The :ref:`ref-classes-migrate_localcount` class verifies a recipe's localcount data and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001778increments it appropriately.
1779
1780.. _ref-classes-mime:
1781
Andrew Geissler517393d2023-01-13 08:55:19 -06001782``mime``
1783========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001784
Andrew Geissler517393d2023-01-13 08:55:19 -06001785The :ref:`ref-classes-mime` class generates the proper post-install and post-remove
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001786(postinst/postrm) scriptlets for packages that install MIME type files.
1787These scriptlets call ``update-mime-database`` to add the MIME types to
1788the shared database.
1789
Patrick Williams7784c422022-11-17 07:29:11 -06001790.. _ref-classes-mime-xdg:
1791
Andrew Geissler517393d2023-01-13 08:55:19 -06001792``mime-xdg``
1793============
Patrick Williams7784c422022-11-17 07:29:11 -06001794
Andrew Geissler517393d2023-01-13 08:55:19 -06001795The :ref:`ref-classes-mime-xdg` class generates the proper
Patrick Williams7784c422022-11-17 07:29:11 -06001796post-install and post-remove (postinst/postrm) scriptlets for packages
1797that install ``.desktop`` files containing ``MimeType`` entries.
1798These scriptlets call ``update-desktop-database`` to add the MIME types
1799to the database of MIME types handled by desktop files.
1800
1801Thanks to this class, when users open a file through a file browser
1802on recently created images, they don't have to choose the application
1803to open the file from the pool of all known applications, even the ones
1804that cannot open the selected file.
1805
1806If you have recipes installing their ``.desktop`` files as absolute
1807symbolic links, the detection of such files cannot be done by the current
1808implementation of this class. In this case, you have to add the corresponding
1809package names to the :term:`MIME_XDG_PACKAGES` variable.
1810
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001811.. _ref-classes-mirrors:
1812
Andrew Geissler517393d2023-01-13 08:55:19 -06001813``mirrors``
1814===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001815
Andrew Geissler517393d2023-01-13 08:55:19 -06001816The :ref:`ref-classes-mirrors` class sets up some standard
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001817:term:`MIRRORS` entries for source code mirrors. These
1818mirrors provide a fall-back path in case the upstream source specified
1819in :term:`SRC_URI` within recipes is unavailable.
1820
1821This class is enabled by default since it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06001822:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001823
1824.. _ref-classes-module:
1825
Andrew Geissler517393d2023-01-13 08:55:19 -06001826``module``
1827==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001828
Andrew Geissler517393d2023-01-13 08:55:19 -06001829The :ref:`ref-classes-module` class provides support for building out-of-tree Linux
1830kernel modules. The class inherits the :ref:`ref-classes-module-base` and
1831:ref:`ref-classes-kernel-module-split` classes, and implements the
1832:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001833everything needed to build and package a kernel module.
1834
1835For general information on out-of-tree Linux kernel modules, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001836":ref:`kernel-dev/common:incorporating out-of-tree modules`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001837section in the Yocto Project Linux Kernel Development Manual.
1838
1839.. _ref-classes-module-base:
1840
Andrew Geissler517393d2023-01-13 08:55:19 -06001841``module-base``
1842===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001843
Andrew Geissler517393d2023-01-13 08:55:19 -06001844The :ref:`ref-classes-module-base` class provides the base functionality for
1845building Linux kernel modules. Typically, a recipe that builds software that
1846includes one or more kernel modules and has its own means of building the module
1847inherits this class as opposed to inheriting the :ref:`ref-classes-module`
1848class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001849
1850.. _ref-classes-multilib*:
1851
Andrew Geissler517393d2023-01-13 08:55:19 -06001852``multilib*``
1853=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001854
Andrew Geissler517393d2023-01-13 08:55:19 -06001855The :ref:`ref-classes-multilib*` classes provide support for building libraries with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001856different target optimizations or target architectures and installing
1857them side-by-side in the same image.
1858
1859For more information on using the Multilib feature, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001860":ref:`dev-manual/libraries:combining multiple versions of library files into one image`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001861section in the Yocto Project Development Tasks Manual.
1862
1863.. _ref-classes-native:
1864
Andrew Geissler517393d2023-01-13 08:55:19 -06001865``native``
1866==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001867
Andrew Geissler517393d2023-01-13 08:55:19 -06001868The :ref:`ref-classes-native` class provides common functionality for recipes that
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001869build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
1870or other tools from the build host).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001871
1872You can create a recipe that builds tools that run natively on the host
1873a couple different ways:
1874
Andrew Geissler517393d2023-01-13 08:55:19 -06001875- Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001876 class. If you use this method, you must order the inherit statement
1877 in the recipe after all other inherit statements so that the
Andrew Geissler517393d2023-01-13 08:55:19 -06001878 :ref:`ref-classes-native` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001879
1880 .. note::
1881
1882 When creating a recipe this way, the recipe name must follow this
Andrew Geisslerc926e172021-05-07 16:11:35 -05001883 naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001884
1885 myrecipe-native.bb
1886
1887
1888 Not using this naming convention can lead to subtle problems
1889 caused by existing code that depends on that naming convention.
1890
Andrew Geisslerc926e172021-05-07 16:11:35 -05001891- Create or modify a target recipe that contains the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001892
1893 BBCLASSEXTEND = "native"
1894
1895 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001896 recipe, use ``:class-native`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001897 specify any functionality specific to the respective native or target
1898 case.
1899
Andrew Geissler517393d2023-01-13 08:55:19 -06001900Although applied differently, the :ref:`ref-classes-native` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001901methods. The advantage of the second method is that you do not need to
1902have two separate recipes (assuming you need both) for native and
1903target. All common parts of the recipe are automatically shared.
1904
1905.. _ref-classes-nativesdk:
1906
Andrew Geissler517393d2023-01-13 08:55:19 -06001907``nativesdk``
1908=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001909
Andrew Geissler517393d2023-01-13 08:55:19 -06001910The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001911wish to build tools to run as part of an SDK (i.e. tools that run on
1912:term:`SDKMACHINE`).
1913
1914You can create a recipe that builds tools that run on the SDK machine a
1915couple different ways:
1916
Andrew Geisslereff27472021-10-29 15:35:00 -05001917- Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -06001918 :ref:`ref-classes-nativesdk` class. If you use this method, you must order the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001919 inherit statement in the recipe after all other inherit statements so
Andrew Geissler517393d2023-01-13 08:55:19 -06001920 that the :ref:`ref-classes-nativesdk` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001921
Andrew Geissler517393d2023-01-13 08:55:19 -06001922- Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001923
1924 BBCLASSEXTEND = "nativesdk"
1925
1926 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001927 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001928 specify any functionality specific to the respective SDK machine or
1929 target case.
1930
1931.. note::
1932
Andrew Geisslerc926e172021-05-07 16:11:35 -05001933 When creating a recipe, you must follow this naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001934
1935 nativesdk-myrecipe.bb
1936
1937
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001938 Not doing so can lead to subtle problems because there is code that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001939 depends on the naming convention.
1940
Andrew Geissler517393d2023-01-13 08:55:19 -06001941Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001942methods. The advantage of the second method is that you do not need to
1943have two separate recipes (assuming you need both) for the SDK machine
1944and the target. All common parts of the recipe are automatically shared.
1945
1946.. _ref-classes-nopackages:
1947
Andrew Geissler517393d2023-01-13 08:55:19 -06001948``nopackages``
1949==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001950
1951Disables packaging tasks for those recipes and classes where packaging
1952is not needed.
1953
1954.. _ref-classes-npm:
1955
Andrew Geissler517393d2023-01-13 08:55:19 -06001956``npm``
1957=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001958
Patrick Williams7784c422022-11-17 07:29:11 -06001959Provides support for building Node.js software fetched using the
1960:wikipedia:`node package manager (NPM) <Npm_(software)>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001961
1962.. note::
1963
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001964 Currently, recipes inheriting this class must use the ``npm://``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001965 fetcher to have dependencies fetched and packaged automatically.
1966
1967For information on how to create NPM packages, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001968":ref:`dev-manual/packages:creating node package manager (npm) packages`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001969section in the Yocto Project Development Tasks Manual.
1970
1971.. _ref-classes-oelint:
1972
Andrew Geissler517393d2023-01-13 08:55:19 -06001973``oelint``
1974==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001975
Andrew Geissler517393d2023-01-13 08:55:19 -06001976The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001977``meta/classes`` in the :term:`Source Directory`.
1978
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001979There are some classes that could be generally useful in OE-Core but
Andrew Geissler517393d2023-01-13 08:55:19 -06001980are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001981one such example. However, being aware of this class can reduce the
1982proliferation of different versions of similar classes across multiple
1983layers.
1984
Andrew Geissler5199d832021-09-24 16:47:35 -05001985.. _ref-classes-overlayfs:
1986
Andrew Geissler517393d2023-01-13 08:55:19 -06001987``overlayfs``
1988=============
Andrew Geissler5199d832021-09-24 16:47:35 -05001989
Andrew Geissler595f6302022-01-24 19:11:47 +00001990It's often desired in Embedded System design to have a read-only root filesystem.
Andrew Geissler5199d832021-09-24 16:47:35 -05001991But a lot of different applications might want to have read-write access to
1992some parts of a filesystem. It can be especially useful when your update mechanism
Andrew Geissler595f6302022-01-24 19:11:47 +00001993overwrites the whole root filesystem, but you may want your application data to be preserved
Andrew Geissler517393d2023-01-13 08:55:19 -06001994between updates. The :ref:`ref-classes-overlayfs` class provides a way
Andrew Geissler5199d832021-09-24 16:47:35 -05001995to achieve that by means of ``overlayfs`` and at the same time keeping the base
Andrew Geissler595f6302022-01-24 19:11:47 +00001996root filesystem read-only.
Andrew Geissler5199d832021-09-24 16:47:35 -05001997
1998To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
1999layer in your machine configuration. The underlying file system can be anything that
2000is supported by ``overlayfs``. This has to be done in your machine configuration::
2001
2002 OVERLAYFS_MOUNT_POINT[data] = "/data"
2003
2004.. note::
2005
2006 * QA checks fail to catch file existence if you redefine this variable in your recipe!
2007 * Only the existence of the systemd mount unit file is checked, not its contents.
2008 * To get more details on ``overlayfs``, its internals and supported operations, please refer
Patrick Williams2390b1b2022-11-03 13:47:49 -05002009 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 -05002010
2011The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
2012(e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
2013
2014Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
2015
2016 OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
2017
2018To support several mount points you can use a different variable flag. Assuming we
2019want to have a writable location on the file system, but do not need that the data
Andrew Geissler595f6302022-01-24 19:11:47 +00002020survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
2021file system.
Andrew Geissler5199d832021-09-24 16:47:35 -05002022
2023In your machine configuration::
2024
2025 OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
2026
2027and then in your recipe::
2028
2029 OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
2030
Andrew Geissler595f6302022-01-24 19:11:47 +00002031On a practical note, your application recipe might require multiple
2032overlays to be mounted before running to avoid writing to the underlying
2033file system (which can be forbidden in case of read-only file system)
Andrew Geissler517393d2023-01-13 08:55:19 -06002034To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd``
Andrew Geissler595f6302022-01-24 19:11:47 +00002035helper service for mounting overlays. This helper service is named
2036``${PN}-overlays.service`` and can be depended on in your application recipe
2037(named ``application`` in the following example) ``systemd`` unit by adding
2038to the unit the following::
2039
2040 [Unit]
2041 After=application-overlays.service
2042 Requires=application-overlays.service
2043
Andrew Geissler5199d832021-09-24 16:47:35 -05002044.. note::
2045
2046 The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
Andrew Geissler517393d2023-01-13 08:55:19 -06002047 In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`.
Andrew Geissler595f6302022-01-24 19:11:47 +00002048
2049.. _ref-classes-overlayfs-etc:
2050
Andrew Geissler517393d2023-01-13 08:55:19 -06002051``overlayfs-etc``
2052=================
Andrew Geissler595f6302022-01-24 19:11:47 +00002053
2054In order to have the ``/etc`` directory in overlayfs a special handling at early
2055boot stage is required. The idea is to supply a custom init script that mounts
2056``/etc`` before launching the actual init program, because the latter already
2057requires ``/etc`` to be mounted.
2058
2059Example usage in image recipe::
2060
2061 IMAGE_FEATURES += "overlayfs-etc"
2062
2063.. note::
2064
2065 This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
2066
2067Your machine configuration should define at least the device, mount point, and file system type
2068you are going to use for ``overlayfs``::
2069
2070 OVERLAYFS_ETC_MOUNT_POINT = "/data"
2071 OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
2072 OVERLAYFS_ETC_FSTYPE ?= "ext4"
2073
2074To control more mount options you should consider setting mount options
2075(``defaults`` is used by default)::
2076
2077 OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
2078
2079The class provides two options for ``/sbin/init`` generation:
2080
2081- The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
2082 and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
2083 that you won't need to change any kernel parameters in order to make it work,
2084 but it poses a restriction that package-management can't be used, because updating
2085 the init manager would remove the generated script.
2086
2087- If you wish to keep original init as is, you can set::
2088
2089 OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
2090
2091 Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
2092 kernel parameters manually in your bootloader configuration.
Andrew Geissler5199d832021-09-24 16:47:35 -05002093
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002094.. _ref-classes-own-mirrors:
2095
Andrew Geissler517393d2023-01-13 08:55:19 -06002096``own-mirrors``
2097===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002098
Andrew Geissler517393d2023-01-13 08:55:19 -06002099The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002100:term:`PREMIRRORS` from which to first fetch source
2101before attempting to fetch it from the upstream specified in
2102:term:`SRC_URI` within each recipe.
2103
2104To use this class, inherit it globally and specify
Andrew Geisslerc926e172021-05-07 16:11:35 -05002105:term:`SOURCE_MIRROR_URL`. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002106
2107 INHERIT += "own-mirrors"
2108 SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
2109
2110You can specify only a single URL
Andrew Geissler09036742021-06-25 14:25:14 -05002111in :term:`SOURCE_MIRROR_URL`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002112
2113.. _ref-classes-package:
2114
Andrew Geissler517393d2023-01-13 08:55:19 -06002115``package``
2116===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002117
Andrew Geissler517393d2023-01-13 08:55:19 -06002118The :ref:`ref-classes-package` class supports generating packages from a build's
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002119output. The core generic functionality is in ``package.bbclass``. The
2120code specific to particular package types resides in these
Andrew Geissler517393d2023-01-13 08:55:19 -06002121package-specific classes: :ref:`ref-classes-package_deb`,
Patrick Williams8e7b46e2023-05-01 14:19:06 -05002122:ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002123
2124You can control the list of resulting package formats by using the
Andrew Geissler09036742021-06-25 14:25:14 -05002125:term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002126configuration file, which is located in the :term:`Build Directory`.
Patrick Williams2390b1b2022-11-03 13:47:49 -05002127When defining the variable, you can specify one or more package types.
2128Since images are generated from packages, a packaging class is needed
2129to enable image generation. The first class listed in this variable is
2130used for image generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002131
2132If you take the optional step to set up a repository (package feed) on
2133the development host that can be used by DNF, you can install packages
2134from the feed while you are running the image on the target (i.e.
2135runtime installation of packages). For more information, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002136":ref:`dev-manual/packages:using runtime package management`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002137section in the Yocto Project Development Tasks Manual.
2138
2139The package-specific class you choose can affect build-time performance
2140and has space ramifications. In general, building a package with IPK
2141takes about thirty percent less time as compared to using RPM to build
2142the same or similar package. This comparison takes into account a
2143complete build of the package with all dependencies previously built.
2144The reason for this discrepancy is because the RPM package manager
2145creates and processes more :term:`Metadata` than the IPK package
Andrew Geissler09036742021-06-25 14:25:14 -05002146manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
Andrew Geissler517393d2023-01-13 08:55:19 -06002147":ref:`ref-classes-package_ipk`" if you are building smaller systems.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002148
2149Before making your package manager decision, however, you should
2150consider some further things about using RPM:
2151
2152- RPM starts to provide more abilities than IPK due to the fact that it
2153 processes more Metadata. For example, this information includes
2154 individual file types, file checksum generation and evaluation on
2155 install, sparse file support, conflict detection and resolution for
2156 Multilib systems, ACID style upgrade, and repackaging abilities for
2157 rollbacks.
2158
2159- For smaller systems, the extra space used for the Berkeley Database
2160 and the amount of metadata when using RPM can affect your ability to
2161 perform on-device upgrades.
2162
2163You can find additional information on the effects of the package class
2164at these two Yocto Project mailing list links:
2165
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002166- :yocto_lists:`/pipermail/poky/2011-May/006362.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002167
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002168- :yocto_lists:`/pipermail/poky/2011-May/006363.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002169
2170.. _ref-classes-package_deb:
2171
Andrew Geissler517393d2023-01-13 08:55:19 -06002172``package_deb``
2173===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002174
Andrew Geissler517393d2023-01-13 08:55:19 -06002175The :ref:`ref-classes-package_deb` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002176use the Debian (i.e. ``.deb``) file format. The class ensures the
2177packages are written out in a ``.deb`` file format to the
2178``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
2179
Andrew Geissler517393d2023-01-13 08:55:19 -06002180This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002181is enabled through the :term:`PACKAGE_CLASSES`
2182variable in the ``local.conf`` file.
2183
2184.. _ref-classes-package_ipk:
2185
Andrew Geissler517393d2023-01-13 08:55:19 -06002186``package_ipk``
2187===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002188
Andrew Geissler517393d2023-01-13 08:55:19 -06002189The :ref:`ref-classes-package_ipk` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002190use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
2191are written out in a ``.ipk`` file format to the
2192``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
2193
Andrew Geissler517393d2023-01-13 08:55:19 -06002194This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002195is enabled through the :term:`PACKAGE_CLASSES`
2196variable in the ``local.conf`` file.
2197
2198.. _ref-classes-package_rpm:
2199
Andrew Geissler517393d2023-01-13 08:55:19 -06002200``package_rpm``
2201===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002202
Andrew Geissler517393d2023-01-13 08:55:19 -06002203The :ref:`ref-classes-package_rpm` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002204use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
2205are written out in a ``.rpm`` file format to the
2206``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
2207
Andrew Geissler517393d2023-01-13 08:55:19 -06002208This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002209is enabled through the :term:`PACKAGE_CLASSES`
2210variable in the ``local.conf`` file.
2211
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002212.. _ref-classes-packagedata:
2213
Andrew Geissler517393d2023-01-13 08:55:19 -06002214``packagedata``
2215===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002216
Andrew Geissler517393d2023-01-13 08:55:19 -06002217The :ref:`ref-classes-packagedata` class provides common functionality for reading
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002218``pkgdata`` files found in :term:`PKGDATA_DIR`. These
2219files contain information about each output package produced by the
2220OpenEmbedded build system.
2221
2222This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002223:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002224
2225.. _ref-classes-packagegroup:
2226
Andrew Geissler517393d2023-01-13 08:55:19 -06002227``packagegroup``
2228================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002229
Andrew Geissler517393d2023-01-13 08:55:19 -06002230The :ref:`ref-classes-packagegroup` class sets default values appropriate for package
Andrew Geissler09036742021-06-25 14:25:14 -05002231group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002232so forth). It is highly recommended that all package group recipes
2233inherit this class.
2234
2235For information on how to use this class, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002236":ref:`dev-manual/customizing-images:customizing images using custom package groups`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002237section in the Yocto Project Development Tasks Manual.
2238
2239Previously, this class was called the ``task`` class.
2240
2241.. _ref-classes-patch:
2242
Andrew Geissler517393d2023-01-13 08:55:19 -06002243``patch``
2244=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002245
Andrew Geissler517393d2023-01-13 08:55:19 -06002246The :ref:`ref-classes-patch` class provides all functionality for applying patches
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002247during the :ref:`ref-tasks-patch` task.
2248
2249This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002250:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002251
2252.. _ref-classes-perlnative:
2253
Andrew Geissler517393d2023-01-13 08:55:19 -06002254``perlnative``
2255==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002256
Andrew Geissler517393d2023-01-13 08:55:19 -06002257When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002258native version of Perl built by the build system rather than using the
2259version provided by the build host.
2260
Patrick Williams975a06f2022-10-21 14:42:47 -05002261.. _ref-classes-pypi:
2262
Andrew Geissler517393d2023-01-13 08:55:19 -06002263``pypi``
2264========
Patrick Williams975a06f2022-10-21 14:42:47 -05002265
Andrew Geissler517393d2023-01-13 08:55:19 -06002266The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build
Patrick Williams975a06f2022-10-21 14:42:47 -05002267Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
2268By default it determines the PyPI package name based upon :term:`BPN`
2269(stripping the "python-" or "python3-" prefix off if present), however in
2270some cases you may need to set it manually in the recipe by setting
2271:term:`PYPI_PACKAGE`.
2272
Andrew Geissler517393d2023-01-13 08:55:19 -06002273Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`,
Patrick Williams975a06f2022-10-21 14:42:47 -05002274:term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
2275and :term:`CVE_PRODUCT`.
2276
Patrick Williams45852732022-04-02 08:58:32 -05002277.. _ref-classes-python_flit_core:
2278
Andrew Geissler517393d2023-01-13 08:55:19 -06002279``python_flit_core``
2280====================
Patrick Williams45852732022-04-02 08:58:32 -05002281
Andrew Geissler517393d2023-01-13 08:55:19 -06002282The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare
Patrick Williams45852732022-04-02 08:58:32 -05002283the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2284``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
2285section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2286
2287Python modules built with ``flit_core.buildapi`` are pure Python (no
2288``C`` or ``Rust`` extensions).
2289
Andrew Geissler517393d2023-01-13 08:55:19 -06002290Internally this uses the :ref:`ref-classes-python_pep517` class.
Patrick Williams45852732022-04-02 08:58:32 -05002291
Andrew Geissler9aee5002022-03-30 16:27:02 +00002292.. _ref-classes-python_pep517:
2293
Andrew Geissler517393d2023-01-13 08:55:19 -06002294``python_pep517``
2295=================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002296
Andrew Geissler517393d2023-01-13 08:55:19 -06002297The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary
Patrick Williams45852732022-04-02 08:58:32 -05002298archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
Andrew Geissler9aee5002022-03-30 16:27:02 +00002299
Patrick Williams45852732022-04-02 08:58:32 -05002300Recipes wouldn't inherit this directly, instead typically another class will
Andrew Geissler615f2f12022-07-15 14:00:58 -05002301inherit this and add the relevant native dependencies.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002302
Andrew Geissler517393d2023-01-13 08:55:19 -06002303Examples of classes which do this are :ref:`ref-classes-python_flit_core`,
2304:ref:`ref-classes-python_setuptools_build_meta`, and
2305:ref:`ref-classes-python_poetry_core`.
Patrick Williams45852732022-04-02 08:58:32 -05002306
2307.. _ref-classes-python_poetry_core:
2308
Andrew Geissler517393d2023-01-13 08:55:19 -06002309``python_poetry_core``
2310======================
Patrick Williams45852732022-04-02 08:58:32 -05002311
Andrew Geissler517393d2023-01-13 08:55:19 -06002312The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the
Patrick Williams45852732022-04-02 08:58:32 -05002313`Poetry Core <https://python-poetry.org>`__ build system.
2314
Andrew Geissler517393d2023-01-13 08:55:19 -06002315Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002316
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002317.. _ref-classes-python_pyo3:
2318
2319``python_pyo3``
2320===============
2321
2322The :ref:`ref-classes-python_pyo3` class helps make sure that Python extensions
2323written in Rust and built with `PyO3 <https://pyo3.rs/>`__, properly set up the
2324environment for cross compilation.
2325
2326This class is internal to the :ref:`ref-classes-python-setuptools3_rust` class
2327and is not meant to be used directly in recipes.
2328
2329.. _ref-classes-python-setuptools3_rust:
2330
2331``python-setuptools3_rust``
2332===========================
2333
2334The :ref:`ref-classes-python-setuptools3_rust` class enables building Python
2335extensions implemented in Rust with `PyO3 <https://pyo3.rs/>`__, which allows
2336to compile and distribute Python extensions written in Rust as easily
2337as if they were written in C.
2338
2339This class inherits the :ref:`ref-classes-setuptools3` and
2340:ref:`ref-classes-python_pyo3` classes.
2341
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002342.. _ref-classes-pixbufcache:
2343
Andrew Geissler517393d2023-01-13 08:55:19 -06002344``pixbufcache``
2345===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002346
Andrew Geissler517393d2023-01-13 08:55:19 -06002347The :ref:`ref-classes-pixbufcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002348post-remove (postinst/postrm) scriptlets for packages that install
2349pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
2350call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
2351Since the cache files are architecture-specific, ``update_pixbuf_cache``
2352is run using QEMU if the postinst scriptlets need to be run on the build
2353host during image creation.
2354
2355If the pixbuf loaders being installed are in packages other than the
2356recipe's main package, set
2357:term:`PIXBUF_PACKAGES` to specify the packages
2358containing the loaders.
2359
2360.. _ref-classes-pkgconfig:
2361
Andrew Geissler517393d2023-01-13 08:55:19 -06002362``pkgconfig``
2363=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002364
Andrew Geissler517393d2023-01-13 08:55:19 -06002365The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002366library information by using ``pkg-config``. This class aims to smooth
2367integration of ``pkg-config`` into libraries that use it.
2368
2369During staging, BitBake installs ``pkg-config`` data into the
2370``sysroots/`` directory. By making use of sysroot functionality within
Andrew Geissler517393d2023-01-13 08:55:19 -06002371``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002372files.
2373
2374.. _ref-classes-populate-sdk:
2375
Andrew Geissler517393d2023-01-13 08:55:19 -06002376``populate_sdk``
2377================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002378
Andrew Geissler517393d2023-01-13 08:55:19 -06002379The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002380information on advantages gained when building a cross-development
2381toolchain using the :ref:`ref-tasks-populate_sdk`
Andrew Geissler09209ee2020-12-13 08:44:15 -06002382task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002383section in the Yocto Project Application Development and the Extensible
2384Software Development Kit (eSDK) manual.
2385
2386.. _ref-classes-populate-sdk-*:
2387
Andrew Geissler517393d2023-01-13 08:55:19 -06002388``populate_sdk_*``
2389==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002390
Andrew Geissler517393d2023-01-13 08:55:19 -06002391The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002392following classes:
2393
Patrick Williams2390b1b2022-11-03 13:47:49 -05002394- :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002395 all package managers (i.e. DEB, RPM, and opkg).
2396
Patrick Williams2390b1b2022-11-03 13:47:49 -05002397- :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002398 package manager.
2399
Patrick Williams2390b1b2022-11-03 13:47:49 -05002400- :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002401 package manager.
2402
Patrick Williams2390b1b2022-11-03 13:47:49 -05002403- :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002404 (IPK format) package manager.
2405
Patrick Williams2390b1b2022-11-03 13:47:49 -05002406- :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002407 package managers.
2408
Patrick Williams2390b1b2022-11-03 13:47:49 -05002409The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002410``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2411:term:`IMAGE_PKGTYPE`.
2412
2413The base class ensures all source and destination directories are
2414established and then populates the SDK. After populating the SDK, the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002415:ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002416``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2417contains the cross-compiler and associated tooling, and the target,
2418which contains a target root filesystem that is configured for the SDK
2419usage. These two images reside in :term:`SDK_OUTPUT`,
Andrew Geisslerc926e172021-05-07 16:11:35 -05002420which consists of the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002421
2422 ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2423 ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2424
2425Finally, the base populate SDK class creates the toolchain environment
2426setup script, the tarball of the SDK, and the installer.
2427
Patrick Williams2390b1b2022-11-03 13:47:49 -05002428The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and
2429:ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK.
2430These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002431class.
2432
2433For more information on the cross-development toolchain generation, see
Andrew Geissler09209ee2020-12-13 08:44:15 -06002434the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002435section in the Yocto Project Overview and Concepts Manual. For
2436information on advantages gained when building a cross-development
2437toolchain using the :ref:`ref-tasks-populate_sdk`
2438task, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002439":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002440section in the Yocto Project Application Development and the Extensible
2441Software Development Kit (eSDK) manual.
2442
2443.. _ref-classes-prexport:
2444
Andrew Geissler517393d2023-01-13 08:55:19 -06002445``prexport``
2446============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002447
Andrew Geissler517393d2023-01-13 08:55:19 -06002448The :ref:`ref-classes-prexport` class provides functionality for exporting
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002449:term:`PR` values.
2450
2451.. note::
2452
2453 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002454 when using "``bitbake-prserv-tool export``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002455
2456.. _ref-classes-primport:
2457
Andrew Geissler517393d2023-01-13 08:55:19 -06002458``primport``
2459============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002460
Andrew Geissler517393d2023-01-13 08:55:19 -06002461The :ref:`ref-classes-primport` class provides functionality for importing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002462:term:`PR` values.
2463
2464.. note::
2465
2466 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002467 when using "``bitbake-prserv-tool import``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002468
2469.. _ref-classes-prserv:
2470
Andrew Geissler517393d2023-01-13 08:55:19 -06002471``prserv``
2472==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002473
Andrew Geissler517393d2023-01-13 08:55:19 -06002474The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR
2475service <dev-manual/packages:working with a pr service>` in order to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002476automatically manage the incrementing of the :term:`PR`
2477variable for each recipe.
2478
2479This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002480:ref:`ref-classes-package` class. However, the OpenEmbedded
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002481build system will not enable the functionality of this class unless
2482:term:`PRSERV_HOST` has been set.
2483
2484.. _ref-classes-ptest:
2485
Andrew Geissler517393d2023-01-13 08:55:19 -06002486``ptest``
2487=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002488
Andrew Geissler517393d2023-01-13 08:55:19 -06002489The :ref:`ref-classes-ptest` class provides functionality for packaging and installing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002490runtime tests for recipes that build software that provides these tests.
2491
2492This class is intended to be inherited by individual recipes. However,
2493the class' functionality is largely disabled unless "ptest" appears in
2494:term:`DISTRO_FEATURES`. See the
Andrew Geissler517393d2023-01-13 08:55:19 -06002495":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002496section in the Yocto Project Development Tasks Manual for more information
2497on ptest.
2498
2499.. _ref-classes-ptest-gnome:
2500
Andrew Geissler517393d2023-01-13 08:55:19 -06002501``ptest-gnome``
2502===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002503
2504Enables package tests (ptests) specifically for GNOME packages, which
2505have tests intended to be executed with ``gnome-desktop-testing``.
2506
2507For information on setting up and running ptests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002508":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002509section in the Yocto Project Development Tasks Manual.
2510
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002511.. _ref-classes-python3-dir:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002512
Andrew Geissler517393d2023-01-13 08:55:19 -06002513``python3-dir``
2514===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002515
Andrew Geissler517393d2023-01-13 08:55:19 -06002516The :ref:`ref-classes-python3-dir` class provides the base version, location, and site
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002517package location for Python 3.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002518
2519.. _ref-classes-python3native:
2520
Andrew Geissler517393d2023-01-13 08:55:19 -06002521``python3native``
2522=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002523
Andrew Geissler517393d2023-01-13 08:55:19 -06002524The :ref:`ref-classes-python3native` class supports using the native version of Python
Andrew Geisslerc9f78652020-09-18 14:11:35 -050025253 built by the build system rather than support of the version provided
2526by the build host.
2527
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002528.. _ref-classes-python3targetconfig:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002529
Andrew Geissler517393d2023-01-13 08:55:19 -06002530``python3targetconfig``
2531=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002532
Andrew Geissler517393d2023-01-13 08:55:19 -06002533The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050025343 built by the build system rather than support of the version provided
2535by the build host, except that the configuration for the target machine
2536is accessible (such as correct installation directories). This also adds a
2537dependency on target ``python3``, so should only be used where appropriate
2538in order to avoid unnecessarily lengthening builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002539
2540.. _ref-classes-qemu:
2541
Andrew Geissler517393d2023-01-13 08:55:19 -06002542``qemu``
2543========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002544
Andrew Geissler517393d2023-01-13 08:55:19 -06002545The :ref:`ref-classes-qemu` class provides functionality for recipes that either need
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002546QEMU or test for the existence of QEMU. Typically, this class is used to
2547run programs for a target system on the build host using QEMU's
2548application emulation mode.
2549
2550.. _ref-classes-recipe_sanity:
2551
Andrew Geissler517393d2023-01-13 08:55:19 -06002552``recipe_sanity``
2553=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002554
Andrew Geissler517393d2023-01-13 08:55:19 -06002555The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002556recipe prerequisites that might affect the build (e.g. variables that
2557are set or software that is present).
2558
2559.. _ref-classes-relocatable:
2560
Andrew Geissler517393d2023-01-13 08:55:19 -06002561``relocatable``
2562===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002563
Andrew Geissler517393d2023-01-13 08:55:19 -06002564The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002565installed into the sysroot.
2566
Andrew Geissler517393d2023-01-13 08:55:19 -06002567This class makes use of the :ref:`ref-classes-chrpath` class and is used by
2568both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002569
2570.. _ref-classes-remove-libtool:
2571
Andrew Geissler517393d2023-01-13 08:55:19 -06002572``remove-libtool``
2573==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002574
Andrew Geissler517393d2023-01-13 08:55:19 -06002575The :ref:`ref-classes-remove-libtool` class adds a post function to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002576:ref:`ref-tasks-install` task to remove all ``.la`` files
2577installed by ``libtool``. Removing these files results in them being
2578absent from both the sysroot and target packages.
2579
2580If a recipe needs the ``.la`` files to be installed, then the recipe can
Andrew Geisslerc926e172021-05-07 16:11:35 -05002581override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002582
2583 REMOVE_LIBTOOL_LA = "0"
2584
2585.. note::
2586
Andrew Geissler517393d2023-01-13 08:55:19 -06002587 The :ref:`ref-classes-remove-libtool` class is not enabled by default.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002588
2589.. _ref-classes-report-error:
2590
Andrew Geissler517393d2023-01-13 08:55:19 -06002591``report-error``
2592================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002593
Andrew Geissler517393d2023-01-13 08:55:19 -06002594The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting
2595tool <dev-manual/error-reporting-tool:using the error reporting tool>`",
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002596which allows you to submit build error information to a central database.
2597
2598The class collects debug information for recipe, recipe version, task,
2599machine, distro, build system, target system, host distro, branch,
2600commit, and log. From the information, report files using a JSON format
2601are created and stored in
2602``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2603
2604.. _ref-classes-rm-work:
2605
Andrew Geissler517393d2023-01-13 08:55:19 -06002606``rm_work``
2607===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002608
Andrew Geissler517393d2023-01-13 08:55:19 -06002609The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002610can ease your hard drive demands during builds.
2611
2612The OpenEmbedded build system can use a substantial amount of disk space
2613during the build process. A portion of this space is the work files
2614under the ``${TMPDIR}/work`` directory for each recipe. Once the build
2615system generates the packages for a recipe, the work files for that
2616recipe are no longer needed. However, by default, the build system
2617preserves these files for inspection and possible debugging purposes. If
Andrew Geissler517393d2023-01-13 08:55:19 -06002618you would rather have these files deleted to save disk space as the build
2619progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to
Patrick Williams2390b1b2022-11-03 13:47:49 -05002620your ``local.conf`` file, which is found in the :term:`Build Directory`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002621
2622 INHERIT += "rm_work"
2623
Andrew Geissler517393d2023-01-13 08:55:19 -06002624If you are modifying and building source code out of the work directory for a
2625recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your
2626changes to the source being lost. To exclude some recipes from having their work
2627directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the
2628recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable,
2629which can also be set in your ``local.conf`` file. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002630
2631 RM_WORK_EXCLUDE += "busybox glibc"
2632
2633.. _ref-classes-rootfs*:
2634
Andrew Geissler517393d2023-01-13 08:55:19 -06002635``rootfs*``
2636===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002637
Andrew Geissler517393d2023-01-13 08:55:19 -06002638The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002639image and consist of the following classes:
2640
Patrick Williams2390b1b2022-11-03 13:47:49 -05002641- The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002642 post-processing functions for image recipes.
2643
Patrick Williams2390b1b2022-11-03 13:47:49 -05002644- The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002645 for images built using ``.deb`` packages.
2646
Patrick Williams2390b1b2022-11-03 13:47:49 -05002647- The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002648 for images built using ``.rpm`` packages.
2649
Patrick Williams2390b1b2022-11-03 13:47:49 -05002650- The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002651 for images built using ``.ipk`` packages.
2652
Patrick Williams2390b1b2022-11-03 13:47:49 -05002653- The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002654 on the build host directly into the root filesystem.
2655
2656The root filesystem is created from packages using one of the
Andrew Geissler517393d2023-01-13 08:55:19 -06002657:ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES`
2658variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002659
2660For information on how root filesystem images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002661":ref:`overview-manual/concepts:image generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002662section in the Yocto Project Overview and Concepts Manual.
2663
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002664.. _ref-classes-rust:
2665
2666``rust``
2667========
2668
2669The :ref:`ref-classes-rust` class is an internal class which is just used
2670in the "rust" recipe, to build the Rust compiler and runtime
2671library. Except for this recipe, it is not intended to be used directly.
2672
2673.. _ref-classes-rust-common:
2674
2675``rust-common``
2676===============
2677
2678The :ref:`ref-classes-rust-common` class is an internal class to the
2679:ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not
2680intended to be used directly.
2681
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002682.. _ref-classes-sanity:
2683
Andrew Geissler517393d2023-01-13 08:55:19 -06002684``sanity``
2685==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002686
Andrew Geissler517393d2023-01-13 08:55:19 -06002687The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002688on the host system so that users can be notified of potential problems
2689that might affect their build. The class also performs basic user
2690configuration checks from the ``local.conf`` configuration file to
2691prevent common mistakes that cause build failures. Distribution policy
2692usually determines whether to include this class.
2693
2694.. _ref-classes-scons:
2695
Andrew Geissler517393d2023-01-13 08:55:19 -06002696``scons``
2697=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002698
Andrew Geissler517393d2023-01-13 08:55:19 -06002699The :ref:`ref-classes-scons` class supports recipes that need to build software
2700that uses the SCons build system. You can use the :term:`EXTRA_OESCONS`
2701variable to specify additional configuration options you want to pass SCons
2702command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002703
2704.. _ref-classes-sdl:
2705
Andrew Geissler517393d2023-01-13 08:55:19 -06002706``sdl``
2707=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002708
Andrew Geissler517393d2023-01-13 08:55:19 -06002709The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002710the Simple DirectMedia Layer (SDL) library.
2711
Patrick Williams45852732022-04-02 08:58:32 -05002712.. _ref-classes-python_setuptools_build_meta:
Andrew Geissler9aee5002022-03-30 16:27:02 +00002713
Andrew Geissler517393d2023-01-13 08:55:19 -06002714``python_setuptools_build_meta``
2715================================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002716
Andrew Geissler517393d2023-01-13 08:55:19 -06002717The :ref:`ref-classes-python_setuptools_build_meta` class enables building
2718Python modules which declare the
Andrew Geissler9aee5002022-03-30 16:27:02 +00002719`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2720``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
2721section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2722
2723Python modules built with ``setuptools.build_meta`` can be pure Python or
2724include ``C`` or ``Rust`` extensions).
2725
Andrew Geissler517393d2023-01-13 08:55:19 -06002726Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002727
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002728.. _ref-classes-setuptools3:
2729
Andrew Geissler517393d2023-01-13 08:55:19 -06002730``setuptools3``
2731===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002732
Andrew Geissler517393d2023-01-13 08:55:19 -06002733The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions
2734that use build systems based on ``setuptools`` (e.g. only have a ``setup.py``
2735and have not migrated to the official ``pyproject.toml`` format). If your recipe
2736uses these build systems, the recipe needs to inherit the
2737:ref:`ref-classes-setuptools3` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002738
2739 .. note::
2740
Andrew Geissler517393d2023-01-13 08:55:19 -06002741 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls
Andrew Geissler9aee5002022-03-30 16:27:02 +00002742 ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
2743 (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
2744
2745 A consequence of this is that legacy software still using deprecated
2746 ``distutils`` from the Python standard library cannot be packaged as
2747 ``wheels``. A common solution is the replace
2748 ``from distutils.core import setup`` with ``from setuptools import setup``.
2749
2750 .. note::
2751
Andrew Geissler517393d2023-01-13 08:55:19 -06002752 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now
2753 installs the ``wheel`` binary archive. In current versions of
2754 ``setuptools`` the legacy ``setup.py install`` method is deprecated. If
2755 the ``setup.py`` cannot be used with wheels, for example it creates files
2756 outside of the Python module or standard entry points, then
2757 :ref:`ref-classes-setuptools3_legacy` should be used.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002758
2759.. _ref-classes-setuptools3_legacy:
2760
Andrew Geissler517393d2023-01-13 08:55:19 -06002761``setuptools3_legacy``
2762======================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002763
Andrew Geissler517393d2023-01-13 08:55:19 -06002764The :ref:`ref-classes-setuptools3_legacy` class supports
2765Python version 3.x extensions that use build systems based on ``setuptools``
2766(e.g. only have a ``setup.py`` and have not migrated to the official
2767``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`,
2768this uses the traditional ``setup.py`` ``build`` and ``install`` commands and
2769not wheels. This use of ``setuptools`` like this is
Patrick Williams2390b1b2022-11-03 13:47:49 -05002770`deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__
Andrew Geissler9aee5002022-03-30 16:27:02 +00002771but still relatively common.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002772
Andrew Geissler595f6302022-01-24 19:11:47 +00002773.. _ref-classes-setuptools3-base:
2774
Andrew Geissler517393d2023-01-13 08:55:19 -06002775``setuptools3-base``
2776====================
Andrew Geissler595f6302022-01-24 19:11:47 +00002777
Andrew Geissler517393d2023-01-13 08:55:19 -06002778The :ref:`ref-classes-setuptools3-base` class provides a reusable base for
2779other classes that support building Python version 3.x extensions. If you need
2780functionality that is not provided by the :ref:`ref-classes-setuptools3` class,
2781you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks
2782in the :ref:`ref-classes-setuptools3` class and inherit this class instead.
Andrew Geissler595f6302022-01-24 19:11:47 +00002783
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002784.. _ref-classes-sign_rpm:
2785
Andrew Geissler517393d2023-01-13 08:55:19 -06002786``sign_rpm``
2787============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002788
Andrew Geissler517393d2023-01-13 08:55:19 -06002789The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002790
2791.. _ref-classes-siteconfig:
2792
Andrew Geissler517393d2023-01-13 08:55:19 -06002793``siteconfig``
2794==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002795
Andrew Geissler517393d2023-01-13 08:55:19 -06002796The :ref:`ref-classes-siteconfig` class provides functionality for handling site
2797configuration. The class is used by the :ref:`ref-classes-autotools` class to
2798accelerate the :ref:`ref-tasks-configure` task.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002799
2800.. _ref-classes-siteinfo:
2801
Andrew Geissler517393d2023-01-13 08:55:19 -06002802``siteinfo``
2803============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002804
Andrew Geissler517393d2023-01-13 08:55:19 -06002805The :ref:`ref-classes-siteinfo` class provides information about the targets
2806that might be needed by other classes or recipes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002807
2808As an example, consider Autotools, which can require tests that must
2809execute on the target hardware. Since this is not possible in general
2810when cross compiling, site information is used to provide cached test
2811results so these tests can be skipped over but still make the correct
2812values available. The ``meta/site directory`` contains test results
2813sorted into different categories such as architecture, endianness, and
2814the ``libc`` used. Site information provides a list of files containing
Andrew Geissler09036742021-06-25 14:25:14 -05002815data relevant to the current build in the :term:`CONFIG_SITE` variable that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002816Autotools automatically picks up.
2817
Andrew Geissler09036742021-06-25 14:25:14 -05002818The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
2819:term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002820
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002821.. _ref-classes-sstate:
2822
Andrew Geissler517393d2023-01-13 08:55:19 -06002823``sstate``
2824==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002825
Andrew Geissler517393d2023-01-13 08:55:19 -06002826The :ref:`ref-classes-sstate` class provides support for Shared State (sstate).
2827By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's
2828default value.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002829
2830For more information on sstate, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002831":ref:`overview-manual/concepts:shared state cache`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002832section in the Yocto Project Overview and Concepts Manual.
2833
2834.. _ref-classes-staging:
2835
Andrew Geissler517393d2023-01-13 08:55:19 -06002836``staging``
2837===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002838
Andrew Geissler517393d2023-01-13 08:55:19 -06002839The :ref:`ref-classes-staging` class installs files into individual recipe work
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002840directories for sysroots. The class contains the following key tasks:
2841
2842- The :ref:`ref-tasks-populate_sysroot` task,
2843 which is responsible for handing the files that end up in the recipe
2844 sysroots.
2845
2846- The
2847 :ref:`ref-tasks-prepare_recipe_sysroot`
2848 task (a "partner" task to the ``populate_sysroot`` task), which
2849 installs the files into the individual recipe work directories (i.e.
2850 :term:`WORKDIR`).
2851
Andrew Geissler517393d2023-01-13 08:55:19 -06002852The code in the :ref:`ref-classes-staging` class is complex and basically works
2853in two stages:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002854
2855- *Stage One:* The first stage addresses recipes that have files they
2856 want to share with other recipes that have dependencies on the
2857 originating recipe. Normally these dependencies are installed through
2858 the :ref:`ref-tasks-install` task into
Patrick Williams2194f502022-10-16 14:26:09 -05002859 ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002860 copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
2861 subset of files is controlled by the
2862 :term:`SYSROOT_DIRS`,
2863 :term:`SYSROOT_DIRS_NATIVE`, and
Andrew Geissler9aee5002022-03-30 16:27:02 +00002864 :term:`SYSROOT_DIRS_IGNORE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002865 variables.
2866
2867 .. note::
2868
2869 Additionally, a recipe can customize the files further by
Andrew Geissler09036742021-06-25 14:25:14 -05002870 declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002871 variable.
2872
2873 A shared state (sstate) object is built from these files and the
2874 files are placed into a subdirectory of
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002875 :ref:`structure-build-tmp-sysroots-components`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002876 The files are scanned for hardcoded paths to the original
2877 installation location. If the location is found in text files, the
2878 hardcoded locations are replaced by tokens and a list of the files
2879 needing such replacements is created. These adjustments are referred
2880 to as "FIXMEs". The list of files that are scanned for paths is
2881 controlled by the :term:`SSTATE_SCAN_FILES`
2882 variable.
2883
2884- *Stage Two:* The second stage addresses recipes that want to use
2885 something from another recipe and declare a dependency on that recipe
2886 through the :term:`DEPENDS` variable. The recipe will
2887 have a
2888 :ref:`ref-tasks-prepare_recipe_sysroot`
2889 task and when this task executes, it creates the ``recipe-sysroot``
2890 and ``recipe-sysroot-native`` in the recipe work directory (i.e.
2891 :term:`WORKDIR`). The OpenEmbedded build system
2892 creates hard links to copies of the relevant files from
2893 ``sysroots-components`` into the recipe work directory.
2894
2895 .. note::
2896
2897 If hard links are not possible, the build system uses actual
2898 copies.
2899
2900 The build system then addresses any "FIXMEs" to paths as defined from
2901 the list created in the first stage.
2902
2903 Finally, any files in ``${bindir}`` within the sysroot that have the
2904 prefix "``postinst-``" are executed.
2905
2906 .. note::
2907
2908 Although such sysroot post installation scripts are not
2909 recommended for general use, the files do allow some issues such
2910 as user creation and module indexes to be addressed.
2911
Andrew Geissler09036742021-06-25 14:25:14 -05002912 Because recipes can have other dependencies outside of :term:`DEPENDS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002913 (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
2914 the sysroot creation function ``extend_recipe_sysroot`` is also added
2915 as a pre-function for those tasks whose dependencies are not through
Andrew Geissler09036742021-06-25 14:25:14 -05002916 :term:`DEPENDS` but operate similarly.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002917
2918 When installing dependencies into the sysroot, the code traverses the
2919 dependency graph and processes dependencies in exactly the same way
2920 as the dependencies would or would not be when installed from sstate.
2921 This processing means, for example, a native tool would have its
2922 native dependencies added but a target library would not have its
2923 dependencies traversed or installed. The same sstate dependency code
2924 is used so that builds should be identical regardless of whether
2925 sstate was used or not. For a closer look, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002926 ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002927
2928 The build system is careful to maintain manifests of the files it
2929 installs so that any given dependency can be installed as needed. The
2930 sstate hash of the installed item is also stored so that if it
2931 changes, the build system can reinstall it.
2932
2933.. _ref-classes-syslinux:
2934
Andrew Geissler517393d2023-01-13 08:55:19 -06002935``syslinux``
2936============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002937
Andrew Geissler517393d2023-01-13 08:55:19 -06002938The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for
2939building bootable images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002940
2941The class supports the following variables:
2942
2943- :term:`INITRD`: Indicates list of filesystem images to
2944 concatenate and use as an initial RAM disk (initrd). This variable is
2945 optional.
2946
2947- :term:`ROOTFS`: Indicates a filesystem image to include
2948 as the root filesystem. This variable is optional.
2949
2950- :term:`AUTO_SYSLINUXMENU`: Enables creating
2951 an automatic menu when set to "1".
2952
2953- :term:`LABELS`: Lists targets for automatic
2954 configuration.
2955
2956- :term:`APPEND`: Lists append string overrides for each
2957 label.
2958
2959- :term:`SYSLINUX_OPTS`: Lists additional options
2960 to add to the syslinux file. Semicolon characters separate multiple
2961 options.
2962
2963- :term:`SYSLINUX_SPLASH`: Lists a background
2964 for the VGA boot menu when you are using the boot menu.
2965
2966- :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
2967 to "console=ttyX" to change kernel boot default console.
2968
2969- :term:`SYSLINUX_SERIAL`: Sets an alternate
2970 serial port. Or, turns off serial when the variable is set with an
2971 empty string.
2972
2973- :term:`SYSLINUX_SERIAL_TTY`: Sets an
2974 alternate "console=tty..." kernel boot argument.
2975
2976.. _ref-classes-systemd:
2977
Andrew Geissler517393d2023-01-13 08:55:19 -06002978``systemd``
2979===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002980
Andrew Geissler517393d2023-01-13 08:55:19 -06002981The :ref:`ref-classes-systemd` class provides support for recipes that install
2982systemd unit files.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002983
2984The functionality for this class is disabled unless you have "systemd"
2985in :term:`DISTRO_FEATURES`.
2986
2987Under this class, the recipe or Makefile (i.e. whatever the recipe is
2988calling during the :ref:`ref-tasks-install` task)
2989installs unit files into
2990``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
2991files being installed go into packages other than the main package, you
2992need to set :term:`SYSTEMD_PACKAGES` in your
2993recipe to identify the packages in which the files will be installed.
2994
2995You should set :term:`SYSTEMD_SERVICE` to the
2996name of the service file. You should also use a package name override to
2997indicate the package to which the value applies. If the value applies to
2998the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
Andrew Geisslerc926e172021-05-07 16:11:35 -05002999is an example from the connman recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003000
Patrick Williams0ca19cc2021-08-16 14:03:13 -05003001 SYSTEMD_SERVICE:${PN} = "connman.service"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003002
3003Services are set up to start on boot automatically
3004unless you have set
3005:term:`SYSTEMD_AUTO_ENABLE` to "disable".
3006
Andrew Geissler517393d2023-01-13 08:55:19 -06003007For more information on :ref:`ref-classes-systemd`, see the
3008":ref:`dev-manual/init-manager:selecting an initialization manager`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003009section in the Yocto Project Development Tasks Manual.
3010
3011.. _ref-classes-systemd-boot:
3012
Andrew Geissler517393d2023-01-13 08:55:19 -06003013``systemd-boot``
3014================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003015
Andrew Geissler517393d2023-01-13 08:55:19 -06003016The :ref:`ref-classes-systemd-boot` class provides functions specific to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003017systemd-boot bootloader for building bootable images. This is an
3018internal class and is not intended to be used directly.
3019
3020.. note::
3021
Andrew Geissler517393d2023-01-13 08:55:19 -06003022 The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003023 used in previous Yocto Project releases with the ``systemd`` project.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003024
Andrew Geissler517393d2023-01-13 08:55:19 -06003025Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to
3026use this class. Doing so creates a standalone EFI bootloader that is not
3027dependent on systemd.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003028
3029For information on more variables used and supported in this class, see
3030the :term:`SYSTEMD_BOOT_CFG`,
3031:term:`SYSTEMD_BOOT_ENTRIES`, and
3032:term:`SYSTEMD_BOOT_TIMEOUT` variables.
3033
3034You can also see the `Systemd-boot
Andrew Geisslerd1e89492021-02-12 15:35:20 -06003035documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003036for more information.
3037
3038.. _ref-classes-terminal:
3039
Andrew Geissler517393d2023-01-13 08:55:19 -06003040``terminal``
3041============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003042
Andrew Geissler517393d2023-01-13 08:55:19 -06003043The :ref:`ref-classes-terminal` class provides support for starting a terminal
3044session. The :term:`OE_TERMINAL` variable controls which terminal emulator is
3045used for the session.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003046
Andrew Geissler517393d2023-01-13 08:55:19 -06003047Other classes use the :ref:`ref-classes-terminal` class anywhere a separate
3048terminal session needs to be started. For example, the :ref:`ref-classes-patch`
3049class assuming :term:`PATCHRESOLVE` is set to "user", the
3050:ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all
3051use the :ref:`ref-classes-terminal` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003052
Patrick Williams975a06f2022-10-21 14:42:47 -05003053.. _ref-classes-testimage:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003054
Andrew Geissler517393d2023-01-13 08:55:19 -06003055``testimage``
3056=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003057
Andrew Geissler517393d2023-01-13 08:55:19 -06003058The :ref:`ref-classes-testimage` class supports running automated tests against
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003059images using QEMU and on actual hardware. The classes handle loading the
3060tests and starting the image. To use the classes, you need to perform
3061steps to set up the environment.
3062
Patrick Williams975a06f2022-10-21 14:42:47 -05003063To enable this class, add the following to your configuration::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003064
Patrick Williams975a06f2022-10-21 14:42:47 -05003065 IMAGE_CLASSES += "testimage"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003066
3067The tests are commands that run on the target system over ``ssh``. Each
3068test is written in Python and makes use of the ``unittest`` module.
3069
Andrew Geissler517393d2023-01-13 08:55:19 -06003070The :ref:`ref-classes-testimage` class runs tests on an image when called using the
Andrew Geisslerc926e172021-05-07 16:11:35 -05003071following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003072
3073 $ bitbake -c testimage image
3074
Patrick Williams975a06f2022-10-21 14:42:47 -05003075Alternatively, if you wish to have tests automatically run for each image
3076after it is built, you can set :term:`TESTIMAGE_AUTO`::
3077
3078 TESTIMAGE_AUTO = "1"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003079
3080For information on how to enable, run, and create new tests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06003081":ref:`dev-manual/runtime-testing:performing automated runtime testing`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003082section in the Yocto Project Development Tasks Manual.
3083
3084.. _ref-classes-testsdk:
3085
Andrew Geissler517393d2023-01-13 08:55:19 -06003086``testsdk``
3087===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003088
3089This class supports running automated tests against software development
Andrew Geissler517393d2023-01-13 08:55:19 -06003090kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called
Andrew Geisslerc926e172021-05-07 16:11:35 -05003091using the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003092
3093 $ bitbake -c testsdk image
3094
3095.. note::
3096
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003097 Best practices include using :term:`IMAGE_CLASSES` rather than
Andrew Geissler517393d2023-01-13 08:55:19 -06003098 :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003099 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003100
3101.. _ref-classes-texinfo:
3102
Andrew Geissler517393d2023-01-13 08:55:19 -06003103``texinfo``
3104===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003105
3106This class should be inherited by recipes whose upstream packages invoke
3107the ``texinfo`` utilities at build-time. Native and cross recipes are
3108made to use the dummy scripts provided by ``texinfo-dummy-native``, for
3109improved performance. Target architecture recipes use the genuine
3110Texinfo utilities. By default, they use the Texinfo utilities on the
3111host system.
3112
3113.. note::
3114
3115 If you want to use the Texinfo recipe shipped with the build system,
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003116 you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
3117 from :term:`SANITY_REQUIRED_UTILITIES`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003118
3119.. _ref-classes-toaster:
3120
Andrew Geissler517393d2023-01-13 08:55:19 -06003121``toaster``
3122===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003123
Andrew Geissler517393d2023-01-13 08:55:19 -06003124The :ref:`ref-classes-toaster` class collects information about packages and images and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003125sends them as events that the BitBake user interface can receive. The
3126class is enabled when the Toaster user interface is running.
3127
3128This class is not intended to be used directly.
3129
3130.. _ref-classes-toolchain-scripts:
3131
Andrew Geissler517393d2023-01-13 08:55:19 -06003132``toolchain-scripts``
3133=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003134
Andrew Geissler517393d2023-01-13 08:55:19 -06003135The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003136the environment for installed SDKs.
3137
3138.. _ref-classes-typecheck:
3139
Andrew Geissler517393d2023-01-13 08:55:19 -06003140``typecheck``
3141=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003142
Andrew Geissler517393d2023-01-13 08:55:19 -06003143The :ref:`ref-classes-typecheck` class provides support for validating the values of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003144variables set at the configuration level against their defined types.
3145The OpenEmbedded build system allows you to define the type of a
Andrew Geisslerc926e172021-05-07 16:11:35 -05003146variable using the "type" varflag. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003147
3148 IMAGE_FEATURES[type] = "list"
3149
3150.. _ref-classes-uboot-config:
3151
Andrew Geissler517393d2023-01-13 08:55:19 -06003152``uboot-config``
3153================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003154
Andrew Geissler517393d2023-01-13 08:55:19 -06003155The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for
Andrew Geisslerc926e172021-05-07 16:11:35 -05003156a machine. Specify the machine in your recipe as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003157
3158 UBOOT_CONFIG ??= <default>
3159 UBOOT_CONFIG[foo] = "config,images"
3160
Andrew Geisslerc926e172021-05-07 16:11:35 -05003161You can also specify the machine using this method::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003162
3163 UBOOT_MACHINE = "config"
3164
3165See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
3166information.
3167
3168.. _ref-classes-uninative:
3169
Andrew Geissler517393d2023-01-13 08:55:19 -06003170``uninative``
3171=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003172
3173Attempts to isolate the build system from the host distribution's C
3174library in order to make re-use of native shared state artifacts across
3175different host distributions practical. With this class enabled, a
3176tarball containing a pre-built C library is downloaded at the start of
3177the build. In the Poky reference distribution this is enabled by default
3178through ``meta/conf/distro/include/yocto-uninative.inc``. Other
3179distributions that do not derive from poky can also
3180"``require conf/distro/include/yocto-uninative.inc``" to use this.
3181Alternatively if you prefer, you can build the uninative-tarball recipe
3182yourself, publish the resulting tarball (e.g. via HTTP) and set
3183``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
3184example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
3185
Andrew Geissler517393d2023-01-13 08:55:19 -06003186The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003187SDK. When building the extensible SDK, ``uninative-tarball`` is built
3188and the resulting tarball is included within the SDK.
3189
3190.. _ref-classes-update-alternatives:
3191
Andrew Geissler517393d2023-01-13 08:55:19 -06003192``update-alternatives``
3193=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003194
Andrew Geissler517393d2023-01-13 08:55:19 -06003195The :ref:`ref-classes-update-alternatives` class helps the alternatives system when
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003196multiple sources provide the same command. This situation occurs when
3197several programs that have the same or similar function are installed
3198with the same name. For example, the ``ar`` command is available from
3199the ``busybox``, ``binutils`` and ``elfutils`` packages. The
Andrew Geissler517393d2023-01-13 08:55:19 -06003200:ref:`ref-classes-update-alternatives` class handles renaming the binaries so that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003201multiple packages can be installed without conflicts. The ``ar`` command
3202still works regardless of which packages are installed or subsequently
3203removed. The class renames the conflicting binary in each package and
3204symlinks the highest priority binary during installation or removal of
3205packages.
3206
3207To use this class, you need to define a number of variables:
3208
3209- :term:`ALTERNATIVE`
3210
3211- :term:`ALTERNATIVE_LINK_NAME`
3212
3213- :term:`ALTERNATIVE_TARGET`
3214
3215- :term:`ALTERNATIVE_PRIORITY`
3216
3217These variables list alternative commands needed by a package, provide
3218pathnames for links, default links for targets, and so forth. For
3219details on how to use this class, see the comments in the
Patrick Williams975a06f2022-10-21 14:42:47 -05003220:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003221file.
3222
3223.. note::
3224
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003225 You can use the ``update-alternatives`` command directly in your recipes.
3226 However, this class simplifies things in most cases.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003227
3228.. _ref-classes-update-rc.d:
3229
Andrew Geissler517393d2023-01-13 08:55:19 -06003230``update-rc.d``
3231===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003232
Andrew Geissler517393d2023-01-13 08:55:19 -06003233The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003234initialization script on behalf of the package. The OpenEmbedded build
3235system takes care of details such as making sure the script is stopped
3236before a package is removed and started when the package is installed.
3237
Andrew Geissler09036742021-06-25 14:25:14 -05003238Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
3239:term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003240for details.
3241
3242.. _ref-classes-useradd:
3243
Andrew Geissler517393d2023-01-13 08:55:19 -06003244``useradd*``
3245============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003246
Patrick Williams2390b1b2022-11-03 13:47:49 -05003247The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003248usage by the package on the target. For example, if you have packages
3249that contain system services that should be run under their own user or
3250group, you can use these classes to enable creation of the user or
Andrew Geissler595f6302022-01-24 19:11:47 +00003251group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
3252</openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003253recipe in the :term:`Source Directory` provides a simple
3254example that shows how to add three users and groups to two packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003255
Patrick Williams2390b1b2022-11-03 13:47:49 -05003256The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003257groups settings.
3258
Patrick Williams2390b1b2022-11-03 13:47:49 -05003259The :ref:`useradd* <ref-classes-useradd>` classes support the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003260:term:`USERADD_PACKAGES`,
3261:term:`USERADD_PARAM`,
3262:term:`GROUPADD_PARAM`, and
3263:term:`GROUPMEMS_PARAM` variables.
3264
Patrick Williams2390b1b2022-11-03 13:47:49 -05003265The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003266that have static user identification (``uid``) and group identification
3267(``gid``) values.
3268
3269The default behavior of the OpenEmbedded build system for assigning
3270``uid`` and ``gid`` values when packages add users and groups during
3271package install time is to add them dynamically. This works fine for
3272programs that do not care what the values of the resulting users and
3273groups become. In these cases, the order of the installation determines
3274the final ``uid`` and ``gid`` values. However, if non-deterministic
3275``uid`` and ``gid`` values are a problem, you can override the default,
3276dynamic application of these values by setting static values. When you
3277set static values, the OpenEmbedded build system looks in
3278:term:`BBPATH` for ``files/passwd`` and ``files/group``
3279files for the values.
3280
Andrew Geissler517393d2023-01-13 08:55:19 -06003281To use static ``uid`` and ``gid`` values, you need to set some variables. See
3282the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`,
3283:term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables.
3284You can also see the :ref:`ref-classes-useradd` class for additional
3285information.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003286
3287.. note::
3288
Patrick Williams2390b1b2022-11-03 13:47:49 -05003289 You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable
Andrew Geissler09036742021-06-25 14:25:14 -05003290 or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003291 enable or disable the class in a configured system, :term:`TMPDIR` might
Andrew Geissler09036742021-06-25 14:25:14 -05003292 contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003293 directory will correct this condition.
3294
3295.. _ref-classes-utility-tasks:
3296
Andrew Geissler517393d2023-01-13 08:55:19 -06003297``utility-tasks``
3298=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003299
Andrew Geissler517393d2023-01-13 08:55:19 -06003300The :ref:`ref-classes-utility-tasks` class provides support for various
3301"utility" type tasks that are applicable to all recipes, such as
3302:ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003303
3304This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003305:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003306
3307.. _ref-classes-utils:
3308
Andrew Geissler517393d2023-01-13 08:55:19 -06003309``utils``
3310=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003311
Andrew Geissler517393d2023-01-13 08:55:19 -06003312The :ref:`ref-classes-utils` class provides some useful Python functions that are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003313typically used in inline Python expressions (e.g. ``${@...}``). One
3314example use is for ``bb.utils.contains()``.
3315
3316This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003317:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003318
3319.. _ref-classes-vala:
3320
Andrew Geissler517393d2023-01-13 08:55:19 -06003321``vala``
3322========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003323
Andrew Geissler517393d2023-01-13 08:55:19 -06003324The :ref:`ref-classes-vala` class supports recipes that need to build software written
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003325using the Vala programming language.
3326
3327.. _ref-classes-waf:
3328
Andrew Geissler517393d2023-01-13 08:55:19 -06003329``waf``
3330=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003331
Andrew Geissler517393d2023-01-13 08:55:19 -06003332The :ref:`ref-classes-waf` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003333the Waf build system. You can use the
3334:term:`EXTRA_OECONF` or
3335:term:`PACKAGECONFIG_CONFARGS` variables
3336to specify additional configuration options to be passed on the Waf
3337command line.