blob: 0cb507b500a7e43c320320ec0577a11ab3e7e875 [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 Geissler517393d2023-01-13 08:55:19 -060096":ref:`dev-manual/new-recipe: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)
140and packaging (empty by default). These classes 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
257.. _ref-classes-ccache:
258
Andrew Geissler517393d2023-01-13 08:55:19 -0600259``ccache``
260==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500261
Andrew Geissler517393d2023-01-13 08:55:19 -0600262The :ref:`ref-classes-ccache` class enables the C/C++ Compiler Cache for the build.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500263This class is used to give a minor performance boost during the build.
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000264
265See https://ccache.samba.org/ for information on the C/C++ Compiler
266Cache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>`
267file for details about how to enable this mechanism in your configuration
268file, how to disable it for specific recipes, and how to share ``ccache``
269files between builds.
270
271However, using the class can lead to unexpected side-effects. Thus, using
272this class is not recommended.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500273
274.. _ref-classes-chrpath:
275
Andrew Geissler517393d2023-01-13 08:55:19 -0600276``chrpath``
277===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500278
Andrew Geissler517393d2023-01-13 08:55:19 -0600279The :ref:`ref-classes-chrpath` class is a wrapper around the "chrpath" utility, which
280is used during the build process for :ref:`ref-classes-nativesdk`, :ref:`ref-classes-cross`, and
281:ref:`ref-classes-cross-canadian` recipes to change ``RPATH`` records within binaries
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500282in order to make them relocatable.
283
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500284.. _ref-classes-cmake:
285
Andrew Geissler517393d2023-01-13 08:55:19 -0600286``cmake``
287=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500288
Andrew Geissler517393d2023-01-13 08:55:19 -0600289The ref:`ref-classes-cmake` class allows for recipes that need to build software using
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500290the `CMake <https://cmake.org/overview/>`__ build system. You can use
291the :term:`EXTRA_OECMAKE` variable to specify
292additional configuration options to be passed using the ``cmake``
293command line.
294
295On the occasion that you would be installing custom CMake toolchain
296files supplied by the application being built, you should install them
297to the preferred CMake Module directory: ``${D}${datadir}/cmake/``
298Modules during
299:ref:`ref-tasks-install`.
300
301.. _ref-classes-cml1:
302
Andrew Geissler517393d2023-01-13 08:55:19 -0600303``cml1``
304========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500305
Andrew Geissler517393d2023-01-13 08:55:19 -0600306The :ref:`ref-classes-cml1` class provides basic support for the Linux kernel style
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500307build configuration system.
308
309.. _ref-classes-compress_doc:
310
Andrew Geissler517393d2023-01-13 08:55:19 -0600311``compress_doc``
312================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500313
314Enables compression for man pages and info pages. This class is intended
315to be inherited globally. The default compression mechanism is gz (gzip)
316but you can select an alternative mechanism by setting the
317:term:`DOC_COMPRESS` variable.
318
319.. _ref-classes-copyleft_compliance:
320
Andrew Geissler517393d2023-01-13 08:55:19 -0600321``copyleft_compliance``
322=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500323
Andrew Geissler517393d2023-01-13 08:55:19 -0600324The :ref:`ref-classes-copyleft_compliance` class preserves source code for the purposes
325of license compliance. This class is an alternative to the :ref:`ref-classes-archiver`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500326class and is still used by some users even though it has been deprecated
Andrew Geissler517393d2023-01-13 08:55:19 -0600327in favor of the :ref:`ref-classes-archiver` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500328
329.. _ref-classes-copyleft_filter:
330
Andrew Geissler517393d2023-01-13 08:55:19 -0600331``copyleft_filter``
332===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500333
Andrew Geissler517393d2023-01-13 08:55:19 -0600334A class used by the :ref:`ref-classes-archiver` and
335:ref:`ref-classes-copyleft_compliance` classes
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500336for filtering licenses. The ``copyleft_filter`` class is an internal
337class and is not intended to be used directly.
338
339.. _ref-classes-core-image:
340
Andrew Geissler517393d2023-01-13 08:55:19 -0600341``core-image``
342==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500343
Andrew Geissler517393d2023-01-13 08:55:19 -0600344The :ref:`ref-classes-core-image` class provides common definitions for the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500345``core-image-*`` image recipes, such as support for additional
346:term:`IMAGE_FEATURES`.
347
348.. _ref-classes-cpan:
349
Andrew Geissler517393d2023-01-13 08:55:19 -0600350``cpan*``
351=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500352
Patrick Williams2390b1b2022-11-03 13:47:49 -0500353The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500354
355Recipes for Perl modules are simple. These recipes usually only need to
356point to the source's archive and then inherit the proper class file.
357Building is split into two methods depending on which method the module
358authors used.
359
360- Modules that use old ``Makefile.PL``-based build system require
361 ``cpan.bbclass`` in their recipes.
362
363- Modules that use ``Build.PL``-based build system require using
364 ``cpan_build.bbclass`` in their recipes.
365
Patrick Williams2390b1b2022-11-03 13:47:49 -0500366Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500367support.
368
Patrick Williams975a06f2022-10-21 14:42:47 -0500369.. _ref-classes-create-spdx:
370
Andrew Geissler517393d2023-01-13 08:55:19 -0600371``create-spdx``
372===============
Patrick Williams975a06f2022-10-21 14:42:47 -0500373
Andrew Geissler517393d2023-01-13 08:55:19 -0600374The :ref:`ref-classes-create-spdx` class provides support for
Patrick Williams7784c422022-11-17 07:29:11 -0600375automatically creating :term:`SPDX` :term:`SBOM` documents based upon image
376and SDK contents.
377
378This class is meant to be inherited globally from a configuration file::
379
380 INHERIT += "create-spdx"
381
382The toplevel :term:`SPDX` output file is generated in JSON format as a
383``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the
384:term:`Build Directory`. There are other related files in the same directory,
385as well as in ``tmp/deploy/spdx``.
386
387The exact behaviour of this class, and the amount of output can be controlled
388by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`,
389:term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables.
390
391See the description of these variables and the
Andrew Geissler517393d2023-01-13 08:55:19 -0600392":ref:`dev-manual/sbom:creating a software bill of materials`"
Patrick Williams7784c422022-11-17 07:29:11 -0600393section in the Yocto Project Development Manual for more details.
Patrick Williams975a06f2022-10-21 14:42:47 -0500394
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500395.. _ref-classes-cross:
396
Andrew Geissler517393d2023-01-13 08:55:19 -0600397``cross``
398=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500399
Andrew Geissler517393d2023-01-13 08:55:19 -0600400The :ref:`ref-classes-cross` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500401cross-compilation tools.
402
403.. _ref-classes-cross-canadian:
404
Andrew Geissler517393d2023-01-13 08:55:19 -0600405``cross-canadian``
406==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500407
Andrew Geissler517393d2023-01-13 08:55:19 -0600408The :ref:`ref-classes-cross-canadian` class provides support for the recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500409the Canadian Cross-compilation tools for SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600410":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500411section in the Yocto Project Overview and Concepts Manual for more
412discussion on these cross-compilation tools.
413
414.. _ref-classes-crosssdk:
415
Andrew Geissler517393d2023-01-13 08:55:19 -0600416``crosssdk``
417============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500418
Andrew Geissler517393d2023-01-13 08:55:19 -0600419The :ref:`ref-classes-crosssdk` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500420cross-compilation tools used for building SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600421":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500422section in the Yocto Project Overview and Concepts Manual for more
423discussion on these cross-compilation tools.
424
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500425.. _ref-classes-cve-check:
426
Andrew Geissler517393d2023-01-13 08:55:19 -0600427``cve-check``
428=============
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500429
Andrew Geissler517393d2023-01-13 08:55:19 -0600430The :ref:`ref-classes-cve-check` class looks for known CVEs (Common Vulnerabilities
Patrick Williams2390b1b2022-11-03 13:47:49 -0500431and Exposures) while building with BitBake. This class is meant to be
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500432inherited globally from a configuration file::
433
434 INHERIT += "cve-check"
435
Patrick Williams2390b1b2022-11-03 13:47:49 -0500436To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
437add following line to the build configuration file::
438
439 include cve-extra-exclusions.inc
440
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500441You can also look for vulnerabilities in specific packages by passing
Patrick Williams2390b1b2022-11-03 13:47:49 -0500442``-c cve_check`` to BitBake.
443
444After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
445and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files.
446
447When building, the CVE checker will emit build time warnings for any detected
448issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
449and version being compiled and no patches to address the issue are applied. Other states
450for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
451applied, and ``Ignored`` meaning that the issue can be ignored.
452
453The ``Patched`` state of a CVE issue is detected from patch files with the format
454``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
455CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
456
457If the recipe lists the ``CVE-ID`` in :term:`CVE_CHECK_IGNORE` variable, then the CVE state is reported
458as ``Ignored``. Multiple CVEs can be listed separated by spaces. Example::
459
460 CVE_CHECK_IGNORE += "CVE-2020-29509 CVE-2020-29511"
461
462If CVE check reports that a recipe contains false positives or false negatives, these may be
463fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables.
464:term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE
465database vendor and product pairs using the syntax::
466
467 CVE_PRODUCT = "flex_project:flex"
468
469where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
470if the default recipe version :term:`PV` does not match the version numbers of the software component
471in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
472CVE database compatible version number, for example::
473
474 CVE_VERSION = "2.39"
475
476Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
477via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
478
479Users should note that security is a process, not a product, and thus also CVE checking, analyzing results,
480patching and updating the software should be done as a regular process. The data and assumptions
481required for CVE checker to reliably detect issues are frequently broken in various ways.
482These can only be detected by reviewing the details of the issues and iterating over the generated reports,
483and following what happens in other Linux distributions and in the greater open source community.
484
485You will find some more details in the
Andrew Geissler517393d2023-01-13 08:55:19 -0600486":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500487section in the Development Tasks Manual.
488
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500489.. _ref-classes-debian:
490
Andrew Geissler517393d2023-01-13 08:55:19 -0600491``debian``
492==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500493
Andrew Geissler517393d2023-01-13 08:55:19 -0600494The :ref:`ref-classes-debian` class renames output packages so that they follow the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500495Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
496``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
497name and version as part of the package name.
498
499If a recipe creates packages for multiple libraries (shared object files
500of ``.so`` type), use the :term:`LEAD_SONAME`
501variable in the recipe to specify the library on which to apply the
502naming scheme.
503
504.. _ref-classes-deploy:
505
Andrew Geissler517393d2023-01-13 08:55:19 -0600506``deploy``
507==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500508
Andrew Geissler517393d2023-01-13 08:55:19 -0600509The :ref:`ref-classes-deploy` class handles deploying files to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500510:term:`DEPLOY_DIR_IMAGE` directory. The main
511function of this class is to allow the deploy step to be accelerated by
512shared state. Recipes that inherit this class should define their own
513:ref:`ref-tasks-deploy` function to copy the files to be
514deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
515add the task at the appropriate place, which is usually after
516:ref:`ref-tasks-compile` or
517:ref:`ref-tasks-install`. The class then takes care of
Andrew Geissler09036742021-06-25 14:25:14 -0500518staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500519
520.. _ref-classes-devshell:
521
Andrew Geissler517393d2023-01-13 08:55:19 -0600522``devshell``
523============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500524
Andrew Geissler517393d2023-01-13 08:55:19 -0600525The :ref:`ref-classes-devshell` class adds the :ref:`ref-tasks-devshell` task. Distribution
526policy dictates whether to include this class. See the ":ref:`dev-manual/development-shell:using a development shell`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500527section in the Yocto Project Development Tasks Manual for more
Andrew Geissler517393d2023-01-13 08:55:19 -0600528information about using :ref:`ref-classes-devshell`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500529
530.. _ref-classes-devupstream:
531
Andrew Geissler517393d2023-01-13 08:55:19 -0600532``devupstream``
533===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500534
Andrew Geissler517393d2023-01-13 08:55:19 -0600535The :ref:`ref-classes-devupstream` class uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500536:term:`BBCLASSEXTEND` to add a variant of the
537recipe that fetches from an alternative URI (e.g. Git) instead of a
Andrew Geisslerc926e172021-05-07 16:11:35 -0500538tarball. Following is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500539
540 BBCLASSEXTEND = "devupstream:target"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000541 SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500542 SRCREV:class-devupstream = "abcd1234"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500543
544Adding the above statements to your recipe creates a variant that has
545:term:`DEFAULT_PREFERENCE` set to "-1".
546Consequently, you need to select the variant of the recipe to use it.
547Any development-specific adjustments can be done by using the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500548``class-devupstream`` override. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500549
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500550 DEPENDS:append:class-devupstream = " gperf-native"
551 do_configure:prepend:class-devupstream() {
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500552 touch ${S}/README
553 }
554
555The class
556currently only supports creating a development variant of the target
Andrew Geissler517393d2023-01-13 08:55:19 -0600557recipe, not :ref:`ref-classes-native` or :ref:`ref-classes-nativesdk` variants.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500558
Andrew Geissler09036742021-06-25 14:25:14 -0500559The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
Andrew Geissler517393d2023-01-13 08:55:19 -0600560support for :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` variants. Consequently, this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500561functionality can be added in a future release.
562
563Support for other version control systems such as Subversion is limited
564due to BitBake's automatic fetch dependencies (e.g.
565``subversion-native``).
566
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500567.. _ref-classes-externalsrc:
568
Andrew Geissler517393d2023-01-13 08:55:19 -0600569``externalsrc``
570===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500571
Andrew Geissler517393d2023-01-13 08:55:19 -0600572The :ref:`ref-classes-externalsrc` class supports building software from source code
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500573that is external to the OpenEmbedded build system. Building software
574from an external source tree means that the build system's normal fetch,
575unpack, and patch process is not used.
576
577By default, the OpenEmbedded build system uses the :term:`S`
578and :term:`B` variables to locate unpacked recipe source code
579and to build it, respectively. When your recipe inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -0600580:ref:`ref-classes-externalsrc` class, you use the
581:term:`EXTERNALSRC` and :term:`EXTERNALSRC_BUILD` variables to
Andrew Geissler09036742021-06-25 14:25:14 -0500582ultimately define :term:`S` and :term:`B`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500583
584By default, this class expects the source code to support recipe builds
585that use the :term:`B` variable to point to the directory in
586which the OpenEmbedded build system places the generated objects built
Andrew Geissler09036742021-06-25 14:25:14 -0500587from the recipes. By default, the :term:`B` directory is set to the
588following, which is separate from the source directory (:term:`S`)::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500589
Andrew Geissler5199d832021-09-24 16:47:35 -0500590 ${WORKDIR}/${BPN}-{PV}/
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500591
592See these variables for more information:
593:term:`WORKDIR`, :term:`BPN`, and
594:term:`PV`,
595
Andrew Geissler517393d2023-01-13 08:55:19 -0600596For more information on the :ref:`ref-classes-externalsrc` class, see the comments in
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500597``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
Andrew Geissler517393d2023-01-13 08:55:19 -0600598For information on how to use the :ref:`ref-classes-externalsrc` class, see the
599":ref:`dev-manual/building:building software from an external source`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500600section in the Yocto Project Development Tasks Manual.
601
602.. _ref-classes-extrausers:
603
Andrew Geissler517393d2023-01-13 08:55:19 -0600604``extrausers``
605==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500606
Andrew Geissler517393d2023-01-13 08:55:19 -0600607The :ref:`ref-classes-extrausers` class allows additional user and group configuration
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500608to be applied at the image level. Inheriting this class either globally
609or from an image recipe allows additional user and group operations to
610be performed using the
611:term:`EXTRA_USERS_PARAMS` variable.
612
613.. note::
614
Andrew Geissler517393d2023-01-13 08:55:19 -0600615 The user and group operations added using the :ref:`ref-classes-extrausers`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500616 class are not tied to a specific recipe outside of the recipe for the
617 image. Thus, the operations can be performed across the image as a
Andrew Geissler517393d2023-01-13 08:55:19 -0600618 whole. Use the :ref:`ref-classes-useradd` class to add user and group
619 configuration to a specific recipe.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500620
Andrew Geisslerc926e172021-05-07 16:11:35 -0500621Here is an example that uses this class in an image recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500622
623 inherit extrausers
624 EXTRA_USERS_PARAMS = "\
625 useradd -p '' tester; \
626 groupadd developers; \
627 userdel nobody; \
628 groupdel -g video; \
629 groupmod -g 1020 developers; \
630 usermod -s /bin/sh tester; \
631 "
632
633Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
Andrew Geissler9aee5002022-03-30 16:27:02 +0000634passwords. First on host, create the (escaped) password hash::
Andrew Geisslereff27472021-10-29 15:35:00 -0500635
Andrew Geissler9aee5002022-03-30 16:27:02 +0000636 printf "%q" $(mkpasswd -m sha256crypt tester01)
Andrew Geisslereff27472021-10-29 15:35:00 -0500637
Andrew Geissler9aee5002022-03-30 16:27:02 +0000638The resulting hash is set to a variable and used in ``useradd`` command parameters::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500639
640 inherit extrausers
Andrew Geisslereff27472021-10-29 15:35:00 -0500641 PASSWD = "\$X\$ABC123\$A-Long-Hash"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500642 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500643 useradd -p '${PASSWD}' tester-jim; \
644 useradd -p '${PASSWD}' tester-sue; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500645 "
646
Andrew Geisslereff27472021-10-29 15:35:00 -0500647Finally, here is an example that sets the root password::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500648
649 inherit extrausers
650 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500651 usermod -p '${PASSWD}' root; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500652 "
653
Patrick Williams03907ee2022-05-01 06:28:52 -0500654.. note::
655
656 From a security perspective, hardcoding a default password is not
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500657 generally a good idea or even legal in some jurisdictions. It is
658 recommended that you do not do this if you are building a production
Patrick Williams03907ee2022-05-01 06:28:52 -0500659 image.
660
661
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600662.. _ref-classes-features_check:
663
Andrew Geissler517393d2023-01-13 08:55:19 -0600664``features_check``
665==================
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600666
Andrew Geissler517393d2023-01-13 08:55:19 -0600667The :ref:`ref-classes-features_check` class allows individual recipes to check
668for required and conflicting :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES`
669or :term:`COMBINED_FEATURES`.
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600670
671This class provides support for the following variables:
672
673- :term:`REQUIRED_DISTRO_FEATURES`
674- :term:`CONFLICT_DISTRO_FEATURES`
675- :term:`ANY_OF_DISTRO_FEATURES`
676- ``REQUIRED_MACHINE_FEATURES``
677- ``CONFLICT_MACHINE_FEATURES``
678- ``ANY_OF_MACHINE_FEATURES``
679- ``REQUIRED_COMBINED_FEATURES``
680- ``CONFLICT_COMBINED_FEATURES``
681- ``ANY_OF_COMBINED_FEATURES``
682
683If any conditions specified in the recipe using the above
684variables are not met, the recipe will be skipped, and if the
685build system attempts to build the recipe then an error will be
686triggered.
687
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500688.. _ref-classes-fontcache:
689
Andrew Geissler517393d2023-01-13 08:55:19 -0600690``fontcache``
691=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500692
Andrew Geissler517393d2023-01-13 08:55:19 -0600693The :ref:`ref-classes-fontcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500694post-remove (postinst and postrm) scriptlets for font packages. These
695scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
696to the font information cache. Since the cache files are
697architecture-specific, ``fc-cache`` runs using QEMU if the postinst
698scriptlets need to be run on the build host during image creation.
699
700If the fonts being installed are in packages other than the main
701package, set :term:`FONT_PACKAGES` to specify the
702packages containing the fonts.
703
704.. _ref-classes-fs-uuid:
705
Andrew Geissler517393d2023-01-13 08:55:19 -0600706``fs-uuid``
707===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500708
Andrew Geissler517393d2023-01-13 08:55:19 -0600709The :ref:`ref-classes-fs-uuid` class extracts UUID from
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500710``${``\ :term:`ROOTFS`\ ``}``, which must have been built
Andrew Geissler517393d2023-01-13 08:55:19 -0600711by the time that this function gets called. The :ref:`ref-classes-fs-uuid` class only
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500712works on ``ext`` file systems and depends on ``tune2fs``.
713
714.. _ref-classes-gconf:
715
Andrew Geissler517393d2023-01-13 08:55:19 -0600716``gconf``
717=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500718
Andrew Geissler517393d2023-01-13 08:55:19 -0600719The :ref:`ref-classes-gconf` class provides common functionality for recipes that need
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500720to install GConf schemas. The schemas will be put into a separate
721package (``${``\ :term:`PN`\ ``}-gconf``) that is created
722automatically when this class is inherited. This package uses the
723appropriate post-install and post-remove (postinst/postrm) scriptlets to
724register and unregister the schemas in the target image.
725
726.. _ref-classes-gettext:
727
Andrew Geissler517393d2023-01-13 08:55:19 -0600728``gettext``
729===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500730
Andrew Geissler517393d2023-01-13 08:55:19 -0600731The :ref:`ref-classes-gettext` class provides support for building
732software that uses the GNU ``gettext`` internationalization and localization
733system. All recipes building software that use ``gettext`` should inherit this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500734class.
735
Patrick Williams975a06f2022-10-21 14:42:47 -0500736.. _ref-classes-github-releases:
737
Andrew Geissler517393d2023-01-13 08:55:19 -0600738``github-releases``
739===================
Patrick Williams975a06f2022-10-21 14:42:47 -0500740
Andrew Geissler517393d2023-01-13 08:55:19 -0600741For recipes that fetch release tarballs from github, the :ref:`ref-classes-github-releases`
Patrick Williams975a06f2022-10-21 14:42:47 -0500742class sets up a standard way for checking available upstream versions
743(to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)).
744
Andrew Geissler517393d2023-01-13 08:55:19 -0600745To use it, add ":ref:`ref-classes-github-releases`" to the inherit line in the recipe,
Patrick Williams975a06f2022-10-21 14:42:47 -0500746and if the default value of :term:`GITHUB_BASE_URI` is not suitable,
747then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}``
748in the value you set for :term:`SRC_URI` within the recipe.
749
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500750.. _ref-classes-gnomebase:
751
Andrew Geissler517393d2023-01-13 08:55:19 -0600752``gnomebase``
753=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500754
Andrew Geissler517393d2023-01-13 08:55:19 -0600755The :ref:`ref-classes-gnomebase` class is the base class for recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500756software from the GNOME stack. This class sets
757:term:`SRC_URI` to download the source from the GNOME
758mirrors as well as extending :term:`FILES` with the typical
759GNOME installation paths.
760
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600761.. _ref-classes-go:
762
763``go``
764======
765
766The :ref:`ref-classes-go` class supports building Go programs. The behavior of
767this class is controlled by the mandatory :term:`GO_IMPORT` variable, and
768by the optional :term:`GO_INSTALL` and :term:`GO_INSTALL_FILTEROUT` ones.
769
770To build a Go program with the Yocto Project, you can use the
771:yocto_git:`go-helloworld_0.1.bb </poky/tree/meta/recipes-extended/go-examples/go-helloworld_0.1.bb>`
772recipe as an example.
773
774.. _ref-classes-go-mod:
775
776``go-mod``
777==========
778
779The :ref:`ref-classes-go-mod` class allows to use Go modules, and inherits the
780:ref:`ref-classes-go` class.
781
782See the associated :term:`GO_WORKDIR` variable.
783
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500784.. _ref-classes-gobject-introspection:
785
Andrew Geissler517393d2023-01-13 08:55:19 -0600786``gobject-introspection``
787=========================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500788
789Provides support for recipes building software that supports GObject
790introspection. This functionality is only enabled if the
791"gobject-introspection-data" feature is in
792:term:`DISTRO_FEATURES` as well as
793"qemu-usermode" being in
794:term:`MACHINE_FEATURES`.
795
796.. note::
797
798 This functionality is backfilled by default and, if not applicable,
Andrew Geissler09036742021-06-25 14:25:14 -0500799 should be disabled through :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
800 :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500801
802.. _ref-classes-grub-efi:
803
Andrew Geissler517393d2023-01-13 08:55:19 -0600804``grub-efi``
805============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500806
Andrew Geissler517393d2023-01-13 08:55:19 -0600807The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500808building bootable images.
809
810This class supports several variables:
811
812- :term:`INITRD`: Indicates list of filesystem images to
813 concatenate and use as an initial RAM disk (initrd) (optional).
814
815- :term:`ROOTFS`: Indicates a filesystem image to include
816 as the root filesystem (optional).
817
818- :term:`GRUB_GFXSERIAL`: Set this to "1" to have
819 graphics and serial in the boot menu.
820
821- :term:`LABELS`: A list of targets for the automatic
822 configuration.
823
824- :term:`APPEND`: An override list of append strings for
825 each ``LABEL``.
826
827- :term:`GRUB_OPTS`: Additional options to add to the
828 configuration (optional). Options are delimited using semi-colon
829 characters (``;``).
830
831- :term:`GRUB_TIMEOUT`: Timeout before executing
832 the default ``LABEL`` (optional).
833
834.. _ref-classes-gsettings:
835
Andrew Geissler517393d2023-01-13 08:55:19 -0600836``gsettings``
837=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500838
Andrew Geissler517393d2023-01-13 08:55:19 -0600839The :ref:`ref-classes-gsettings` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500840need to install GSettings (glib) schemas. The schemas are assumed to be
841part of the main package. Appropriate post-install and post-remove
842(postinst/postrm) scriptlets are added to register and unregister the
843schemas in the target image.
844
845.. _ref-classes-gtk-doc:
846
Andrew Geissler517393d2023-01-13 08:55:19 -0600847``gtk-doc``
848===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500849
Andrew Geissler517393d2023-01-13 08:55:19 -0600850The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500851``gtk-doc`` dependencies and disable ``gtk-doc``.
852
853.. _ref-classes-gtk-icon-cache:
854
Andrew Geissler517393d2023-01-13 08:55:19 -0600855``gtk-icon-cache``
856==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500857
Andrew Geissler517393d2023-01-13 08:55:19 -0600858The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500859post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
860install icons. These scriptlets call ``gtk-update-icon-cache`` to add
861the fonts to GTK+'s icon cache. Since the cache files are
862architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
863the postinst scriptlets need to be run on the build host during image
864creation.
865
866.. _ref-classes-gtk-immodules-cache:
867
Andrew Geissler517393d2023-01-13 08:55:19 -0600868``gtk-immodules-cache``
869=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500870
Andrew Geissler517393d2023-01-13 08:55:19 -0600871The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500872post-remove (postinst/postrm) scriptlets for packages that install GTK+
873input method modules for virtual keyboards. These scriptlets call
874``gtk-update-icon-cache`` to add the input method modules to the cache.
875Since the cache files are architecture-specific,
876``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
877need to be run on the build host during image creation.
878
879If the input method modules being installed are in packages other than
880the main package, set
881:term:`GTKIMMODULES_PACKAGES` to specify
882the packages containing the modules.
883
884.. _ref-classes-gzipnative:
885
Andrew Geissler517393d2023-01-13 08:55:19 -0600886``gzipnative``
887==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500888
Andrew Geissler517393d2023-01-13 08:55:19 -0600889The :ref:`ref-classes-gzipnative` class enables the use of different native versions of
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500890``gzip`` and ``pigz`` rather than the versions of these tools from the
891build host.
892
893.. _ref-classes-icecc:
894
Andrew Geissler517393d2023-01-13 08:55:19 -0600895``icecc``
896=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500897
Andrew Geissler517393d2023-01-13 08:55:19 -0600898The :ref:`ref-classes-icecc` class supports
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500899`Icecream <https://github.com/icecc/icecream>`__, which facilitates
900taking compile jobs and distributing them among remote machines.
901
902The class stages directories with symlinks from ``gcc`` and ``g++`` to
903``icecc``, for both native and cross compilers. Depending on each
904configure or compile, the OpenEmbedded build system adds the directories
905at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500906``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500907compilers, respectively.
908
909For the cross compiler, the class creates a ``tar.gz`` file that
910contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
911is the version of the cross-compiler used in the cross-development
912toolchain, accordingly.
913
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500914The class handles all three different compile stages (i.e native,
915cross-kernel and target) and creates the necessary environment
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500916``tar.gz`` file to be used by the remote machines. The class also
917supports SDK generation.
918
919If :term:`ICECC_PATH` is not set in your
920``local.conf`` file, then the class tries to locate the ``icecc`` binary
921using ``which``. If :term:`ICECC_ENV_EXEC` is set
922in your ``local.conf`` file, the variable should point to the
923``icecc-create-env`` script provided by the user. If you do not point to
924a user-provided script, the build system uses the default script
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500925provided by the recipe :oe_git:`icecc-create-env_0.1.bb
926</openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500927
928.. note::
929
930 This script is a modified version and not the one that comes with
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500931 ``icecream``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500932
933If you do not want the Icecream distributed compile support to apply to
Andrew Geissler595f6302022-01-24 19:11:47 +0000934specific recipes or classes, you can ask them to be ignored by Icecream
935by listing the recipes and classes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +0000936:term:`ICECC_RECIPE_DISABLE` and
937:term:`ICECC_CLASS_DISABLE` variables,
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500938respectively, in your ``local.conf`` file. Doing so causes the
939OpenEmbedded build system to handle these compilations locally.
940
941Additionally, you can list recipes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +0000942:term:`ICECC_RECIPE_ENABLE` variable in
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500943your ``local.conf`` file to force ``icecc`` to be enabled for recipes
944using an empty :term:`PARALLEL_MAKE` variable.
945
Andrew Geissler517393d2023-01-13 08:55:19 -0600946Inheriting the :ref:`ref-classes-icecc` class changes all sstate signatures.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500947Consequently, if a development team has a dedicated build system that
948populates :term:`SSTATE_MIRRORS` and they want to
Andrew Geissler09036742021-06-25 14:25:14 -0500949reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
Andrew Geissler517393d2023-01-13 08:55:19 -0600950system need to either inherit the :ref:`ref-classes-icecc` class or nobody should.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500951
Andrew Geissler517393d2023-01-13 08:55:19 -0600952At the distribution level, you can inherit the :ref:`ref-classes-icecc` class to be
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500953sure that all builders start with the same sstate signatures. After
954inheriting the class, you can then disable the feature by setting the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500955:term:`ICECC_DISABLED` variable to "1" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500956
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500957 INHERIT_DISTRO:append = " icecc"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500958 ICECC_DISABLED ??= "1"
959
960This practice
961makes sure everyone is using the same signatures but also requires
962individuals that do want to use Icecream to enable the feature
Andrew Geisslerc926e172021-05-07 16:11:35 -0500963individually as follows in your ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500964
965 ICECC_DISABLED = ""
966
967.. _ref-classes-image:
968
Andrew Geissler517393d2023-01-13 08:55:19 -0600969``image``
970=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500971
Andrew Geissler517393d2023-01-13 08:55:19 -0600972The :ref:`ref-classes-image` class helps support creating images in different formats.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500973First, the root filesystem is created from packages using one of the
974``rootfs*.bbclass`` files (depending on the package format used) and
975then one or more image files are created.
976
Andrew Geissler09036742021-06-25 14:25:14 -0500977- The :term:`IMAGE_FSTYPES` variable controls the types of images to
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500978 generate.
979
Andrew Geissler09036742021-06-25 14:25:14 -0500980- The :term:`IMAGE_INSTALL` variable controls the list of packages to
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500981 install into the image.
982
983For information on customizing images, see the
Andrew Geissler517393d2023-01-13 08:55:19 -0600984":ref:`dev-manual/customizing-images:customizing images`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500985in the Yocto Project Development Tasks Manual. For information on how
986images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600987":ref:`overview-manual/concepts:images`" section in the
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600988Yocto Project Overview and Concepts Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500989
990.. _ref-classes-image-buildinfo:
991
Andrew Geissler517393d2023-01-13 08:55:19 -0600992``image-buildinfo``
993===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500994
Andrew Geissler517393d2023-01-13 08:55:19 -0600995The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing
Patrick Williams975a06f2022-10-21 14:42:47 -0500996build information to the target filesystem at ``${sysconfdir}/buildinfo``
Patrick Williams7784c422022-11-17 07:29:11 -0600997by default (as specified by :term:`IMAGE_BUILDINFO_FILE`).
Patrick Williams975a06f2022-10-21 14:42:47 -0500998This can be useful for manually determining the origin of any given
999image. It writes out two sections:
1000
Andrew Geissler517393d2023-01-13 08:55:19 -06001001#. `Build Configuration`: a list of variables and their values (specified
Patrick Williams975a06f2022-10-21 14:42:47 -05001002 by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and
1003 :term:`DISTRO_VERSION`)
1004
Andrew Geissler517393d2023-01-13 08:55:19 -06001005#. `Layer Revisions`: the revisions of all of the layers used in the
Patrick Williams975a06f2022-10-21 14:42:47 -05001006 build.
1007
1008Additionally, when building an SDK it will write the same contents
1009to ``/buildinfo`` by default (as specified by
1010:term:`SDK_BUILDINFO_FILE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001011
1012.. _ref-classes-image_types:
1013
Andrew Geissler517393d2023-01-13 08:55:19 -06001014``image_types``
1015===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001016
Andrew Geissler517393d2023-01-13 08:55:19 -06001017The :ref:`ref-classes-image_types` class defines all of the standard image output types
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001018that you can enable through the
1019:term:`IMAGE_FSTYPES` variable. You can use this
1020class as a reference on how to add support for custom image output
1021types.
1022
Andrew Geissler517393d2023-01-13 08:55:19 -06001023By default, the :ref:`ref-classes-image` class automatically
1024enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001025``IMGCLASSES`` variable as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001026
1027 IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
1028 IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
1029 IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
1030 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
1031 IMGCLASSES += "image_types_wic"
1032 IMGCLASSES += "rootfs-postcommands"
1033 IMGCLASSES += "image-postinst-intercepts"
1034 inherit ${IMGCLASSES}
1035
Andrew Geissler517393d2023-01-13 08:55:19 -06001036The :ref:`ref-classes-image_types` class also handles conversion and compression of images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001037
1038.. note::
1039
1040 To build a VMware VMDK image, you need to add "wic.vmdk" to
Andrew Geissler09036742021-06-25 14:25:14 -05001041 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001042 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001043
1044.. _ref-classes-image-live:
1045
Andrew Geissler517393d2023-01-13 08:55:19 -06001046``image-live``
1047==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001048
1049This class controls building "live" (i.e. HDDIMG and ISO) images. Live
1050images contain syslinux for legacy booting, as well as the bootloader
1051specified by :term:`EFI_PROVIDER` if
1052:term:`MACHINE_FEATURES` contains "efi".
1053
1054Normally, you do not use this class directly. Instead, you add "live" to
1055:term:`IMAGE_FSTYPES`.
1056
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001057.. _ref-classes-insane:
1058
Andrew Geissler517393d2023-01-13 08:55:19 -06001059``insane``
1060==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001061
Andrew Geissler517393d2023-01-13 08:55:19 -06001062The :ref:`ref-classes-insane` class adds a step to the package generation process so
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001063that output quality assurance checks are generated by the OpenEmbedded
1064build system. A range of checks are performed that check the build's
1065output for common problems that show up during runtime. Distribution
1066policy usually dictates whether to include this class.
1067
1068You can configure the sanity checks so that specific test failures
1069either raise a warning or an error message. Typically, failures for new
1070tests generate a warning. Subsequent failures for the same test would
1071then generate an error message once the metadata is in a known and good
Andrew Geissler09209ee2020-12-13 08:44:15 -06001072condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001073and error messages you might encounter using a default configuration.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001074
1075Use the :term:`WARN_QA` and
1076:term:`ERROR_QA` variables to control the behavior of
1077these checks at the global level (i.e. in your custom distro
1078configuration). However, to skip one or more checks in recipes, you
1079should use :term:`INSANE_SKIP`. For example, to skip
1080the check for symbolic link ``.so`` files in the main package of a
1081recipe, add the following to the recipe. You need to realize that the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001082package name override, in this example ``${PN}``, must be used::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001083
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001084 INSANE_SKIP:${PN} += "dev-so"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001085
1086Please keep in mind that the QA checks
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001087are meant to detect real or potential problems in the packaged
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001088output. So exercise caution when disabling these checks.
1089
Andrew Geissler09036742021-06-25 14:25:14 -05001090Here are the tests you can list with the :term:`WARN_QA` and
Andrew Geissler5f350902021-07-23 13:09:54 -04001091:term:`ERROR_QA` variables:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001092
1093- ``already-stripped:`` Checks that produced binaries have not
1094 already been stripped prior to the build system extracting debug
1095 symbols. It is common for upstream software projects to default to
1096 stripping debug symbols for output binaries. In order for debugging
1097 to work on the target using ``-dbg`` packages, this stripping must be
1098 disabled.
1099
1100- ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1101 size, and endianness of any binaries to ensure they match the target
1102 architecture. This test fails if any binaries do not match the type
1103 since there would be an incompatibility. The test could indicate that
1104 the wrong compiler or compiler options have been used. Sometimes
1105 software, like bootloaders, might need to bypass this check.
1106
1107- ``buildpaths:`` Checks for paths to locations on the build host
Patrick Williams975a06f2022-10-21 14:42:47 -05001108 inside the output files. Not only can these leak information about
1109 the build environment, they also hinder binary reproducibility.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001110
1111- ``build-deps:`` Determines if a build-time dependency that is
1112 specified through :term:`DEPENDS`, explicit
1113 :term:`RDEPENDS`, or task-level dependencies exists
1114 to match any runtime dependency. This determination is particularly
1115 useful to discover where runtime dependencies are detected and added
1116 during packaging. If no explicit dependency has been specified within
1117 the metadata, at the packaging stage it is too late to ensure that
1118 the dependency is built, and thus you can end up with an error when
1119 the package is installed into the image during the
1120 :ref:`ref-tasks-rootfs` task because the auto-detected
1121 dependency was not satisfied. An example of this would be where the
Andrew Geissler517393d2023-01-13 08:55:19 -06001122 :ref:`ref-classes-update-rc.d` class automatically
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001123 adds a dependency on the ``initscripts-functions`` package to
1124 packages that install an initscript that refers to
1125 ``/etc/init.d/functions``. The recipe should really have an explicit
Andrew Geissler5f350902021-07-23 13:09:54 -04001126 :term:`RDEPENDS` for the package in question on ``initscripts-functions``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001127 so that the OpenEmbedded build system is able to ensure that the
1128 ``initscripts`` recipe is actually built and thus the
1129 ``initscripts-functions`` package is made available.
1130
1131- ``compile-host-path:`` Checks the
1132 :ref:`ref-tasks-compile` log for indications that
1133 paths to locations on the build host were used. Using such paths
1134 might result in host contamination of the build output.
1135
1136- ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1137 do not depend on ``-dbg`` packages, which would cause a packaging
1138 bug.
1139
1140- ``debug-files:`` Checks for ``.debug`` directories in anything but
1141 the ``-dbg`` package. The debug files should all be in the ``-dbg``
1142 package. Thus, anything packaged elsewhere is incorrect packaging.
1143
1144- ``dep-cmp:`` Checks for invalid version comparison statements in
1145 runtime dependency relationships between packages (i.e. in
1146 :term:`RDEPENDS`,
1147 :term:`RRECOMMENDS`,
1148 :term:`RSUGGESTS`,
1149 :term:`RPROVIDES`,
1150 :term:`RREPLACES`, and
1151 :term:`RCONFLICTS` variable values). Any invalid
1152 comparisons might trigger failures or undesirable behavior when
1153 passed to the package manager.
1154
1155- ``desktop:`` Runs the ``desktop-file-validate`` program against any
1156 ``.desktop`` files to validate their contents against the
1157 specification for ``.desktop`` files.
1158
1159- ``dev-deps:`` Checks that all packages except ``-dev`` or
1160 ``-staticdev`` packages do not depend on ``-dev`` packages, which
1161 would be a packaging bug.
1162
1163- ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1164 ``-dev`` package and not in any of the other packages. In general,
1165 these symlinks are only useful for development purposes. Thus, the
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001166 ``-dev`` package is the correct location for them. In very rare
1167 cases, such as dynamically loaded modules, these symlinks
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001168 are needed instead in the main package.
1169
Patrick Williams03907ee2022-05-01 06:28:52 -05001170- ``empty-dirs:`` Checks that packages are not installing files to
1171 directories that are normally expected to be empty (such as ``/tmp``)
1172 The list of directories that are checked is specified by the
1173 :term:`QA_EMPTY_DIRS` variable.
1174
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001175- ``file-rdeps:`` Checks that file-level dependencies identified by
1176 the OpenEmbedded build system at packaging time are satisfied. For
1177 example, a shell script might start with the line ``#!/bin/bash``.
1178 This line would translate to a file dependency on ``/bin/bash``. Of
1179 the three package managers that the OpenEmbedded build system
1180 supports, only RPM directly handles file-level dependencies,
1181 resolving them automatically to packages providing the files.
1182 However, the lack of that functionality in the other two package
1183 managers does not mean the dependencies do not still need resolving.
1184 This QA check attempts to ensure that explicitly declared
1185 :term:`RDEPENDS` exist to handle any file-level
1186 dependency detected in packaged files.
1187
1188- ``files-invalid:`` Checks for :term:`FILES` variable
1189 values that contain "//", which is invalid.
1190
1191- ``host-user-contaminated:`` Checks that no package produced by the
1192 recipe contains any files outside of ``/home`` with a user or group
1193 ID that matches the user running BitBake. A match usually indicates
1194 that the files are being installed with an incorrect UID/GID, since
1195 target IDs are independent from host IDs. For additional information,
1196 see the section describing the
1197 :ref:`ref-tasks-install` task.
1198
1199- ``incompatible-license:`` Report when packages are excluded from
1200 being created due to being marked with a license that is in
1201 :term:`INCOMPATIBLE_LICENSE`.
1202
1203- ``install-host-path:`` Checks the
1204 :ref:`ref-tasks-install` log for indications that
1205 paths to locations on the build host were used. Using such paths
1206 might result in host contamination of the build output.
1207
1208- ``installed-vs-shipped:`` Reports when files have been installed
Patrick Williams2194f502022-10-16 14:26:09 -05001209 within :ref:`ref-tasks-install` but have not been included in any package by
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001210 way of the :term:`FILES` variable. Files that do not
1211 appear in any package cannot be present in an image later on in the
1212 build process. Ideally, all installed files should be packaged or not
1213 installed at all. These files can be deleted at the end of
Patrick Williams2194f502022-10-16 14:26:09 -05001214 :ref:`ref-tasks-install` if the files are not needed in any package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001215
1216- ``invalid-chars:`` Checks that the recipe metadata variables
1217 :term:`DESCRIPTION`,
1218 :term:`SUMMARY`, :term:`LICENSE`, and
1219 :term:`SECTION` do not contain non-UTF-8 characters.
1220 Some package managers do not support such characters.
1221
1222- ``invalid-packageconfig:`` Checks that no undefined features are
1223 being added to :term:`PACKAGECONFIG`. For
Andrew Geisslerc926e172021-05-07 16:11:35 -05001224 example, any name "foo" for which the following form does not exist::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001225
1226 PACKAGECONFIG[foo] = "..."
1227
Andrew Geissler09036742021-06-25 14:25:14 -05001228- ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001229 file containing these paths is incorrect since ``libtool`` adds the
1230 correct sysroot prefix when using the files automatically itself.
1231
1232- ``ldflags:`` Ensures that the binaries were linked with the
1233 :term:`LDFLAGS` options provided by the build system.
Andrew Geissler09036742021-06-25 14:25:14 -05001234 If this test fails, check that the :term:`LDFLAGS` variable is being
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001235 passed to the linker command.
1236
1237- ``libdir:`` Checks for libraries being installed into incorrect
1238 (possibly hardcoded) installation paths. For example, this test will
1239 catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1240 "lib32". Another example is when recipes install
1241 ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1242
1243- ``libexec:`` Checks if a package contains files in
1244 ``/usr/libexec``. This check is not performed if the ``libexecdir``
1245 variable has been set explicitly to ``/usr/libexec``.
1246
1247- ``packages-list:`` Checks for the same package being listed
1248 multiple times through the :term:`PACKAGES` variable
1249 value. Installing the package in this manner can cause errors during
1250 packaging.
1251
1252- ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1253 invalid format.
1254
1255- ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1256 invalid format.
1257
1258- ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1259 'link' where the specified target already exists.
1260
1261- ``perms:`` Currently, this check is unused but reserved.
1262
1263- ``pkgconfig:`` Checks ``.pc`` files for any
1264 :term:`TMPDIR`/:term:`WORKDIR` paths.
1265 Any ``.pc`` file containing these paths is incorrect since
1266 ``pkg-config`` itself adds the correct sysroot prefix when the files
1267 are accessed.
1268
1269- ``pkgname:`` Checks that all packages in
1270 :term:`PACKAGES` have names that do not contain
1271 invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1272 -).
1273
Andrew Geissler09036742021-06-25 14:25:14 -05001274- ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001275 undefined during :ref:`ref-tasks-package`.
1276
1277- ``pkgvarcheck:`` Checks through the variables
1278 :term:`RDEPENDS`,
1279 :term:`RRECOMMENDS`,
1280 :term:`RSUGGESTS`,
1281 :term:`RCONFLICTS`,
1282 :term:`RPROVIDES`,
1283 :term:`RREPLACES`, :term:`FILES`,
1284 :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1285 ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1286 there are variable sets that are not package-specific. Using these
1287 variables without a package suffix is bad practice, and might
1288 unnecessarily complicate dependencies of other packages within the
1289 same recipe or have other unintended consequences.
1290
1291- ``pn-overrides:`` Checks that a recipe does not have a name
1292 (:term:`PN`) value that appears in
1293 :term:`OVERRIDES`. If a recipe is named such that
Andrew Geissler09036742021-06-25 14:25:14 -05001294 its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
1295 :term:`PN` happens to be the same as :term:`MACHINE` or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001296 :term:`DISTRO`), it can have unexpected consequences.
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001297 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001298 turn into ``FILES = "xyz"``.
1299
1300- ``rpaths:`` Checks for rpaths in the binaries that contain build
Andrew Geissler5f350902021-07-23 13:09:54 -04001301 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001302 options are being passed to the linker commands and your binaries
1303 have potential security issues.
1304
1305- ``split-strip:`` Reports that splitting or stripping debug symbols
1306 from binaries has failed.
1307
1308- ``staticdev:`` Checks for static library files (``*.a``) in
1309 non-``staticdev`` packages.
1310
1311- ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1312 into :term:`TMPDIR` on the host. Such symlinks will
1313 work on the host, but are clearly invalid when running on the target.
1314
1315- ``textrel:`` Checks for ELF binaries that contain relocations in
1316 their ``.text`` sections, which can result in a performance impact at
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001317 runtime. See the explanation for the ``ELF binary`` message in
Andrew Geissler09209ee2020-12-13 08:44:15 -06001318 ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001319 issues.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001320
1321- ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1322 for a package are also declared on the recipe level (i.e. any license
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001323 in ``LICENSE:*`` should appear in :term:`LICENSE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001324
1325- ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1326 in the binaries that by default on a standard system are searched by
1327 the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1328 not cause any breakage, they do waste space and are unnecessary.
1329
1330- ``var-undefined:`` Reports when variables fundamental to packaging
1331 (i.e. :term:`WORKDIR`,
1332 :term:`DEPLOY_DIR`, :term:`D`,
1333 :term:`PN`, and :term:`PKGD`) are undefined
1334 during :ref:`ref-tasks-package`.
1335
1336- ``version-going-backwards:`` If Build History is enabled, reports
1337 when a package being written out has a lower version than the
1338 previously written package under the same name. If you are placing
1339 output packages into a feed and upgrading packages on a target system
1340 using that feed, the version of a package going backwards can result
1341 in the target system not correctly upgrading to the "new" version of
1342 the package.
1343
1344 .. note::
1345
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001346 This is only relevant when you are using runtime package management
1347 on your target system.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001348
1349- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1350 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1351 driver ABI names. All drivers should depend on the ABI versions that
1352 they have been built against. Driver recipes that include
1353 ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1354 automatically get these versions. Consequently, you should only need
1355 to explicitly add dependencies to binary driver recipes.
1356
1357.. _ref-classes-insserv:
1358
Andrew Geissler517393d2023-01-13 08:55:19 -06001359``insserv``
1360===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001361
Andrew Geissler517393d2023-01-13 08:55:19 -06001362The :ref:`ref-classes-insserv` class uses the ``insserv`` utility to update the order
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001363of symbolic links in ``/etc/rc?.d/`` within an image based on
1364dependencies specified by LSB headers in the ``init.d`` scripts
1365themselves.
1366
1367.. _ref-classes-kernel:
1368
Andrew Geissler517393d2023-01-13 08:55:19 -06001369``kernel``
1370==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001371
Andrew Geissler517393d2023-01-13 08:55:19 -06001372The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001373code to build all kernel trees. All needed headers are staged into the
Andrew Geissler5f350902021-07-23 13:09:54 -04001374:term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
Andrew Geissler517393d2023-01-13 08:55:19 -06001375using the :ref:`ref-classes-module` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001376
1377This means that each built kernel module is packaged separately and
1378inter-module dependencies are created by parsing the ``modinfo`` output.
1379If all modules are required, then installing the ``kernel-modules``
1380package installs all packages with modules and various other kernel
1381packages such as ``kernel-vmlinux``.
1382
Andrew Geissler517393d2023-01-13 08:55:19 -06001383The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial
Patrick Williams2194f502022-10-16 14:26:09 -05001384RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
1385information on how to build an :term:`Initramfs`, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001386":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001387the Yocto Project Development Tasks Manual.
1388
Andrew Geissler517393d2023-01-13 08:55:19 -06001389Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes
1390internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and
1391:ref:`ref-classes-linux-kernel-base` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001392
1393.. _ref-classes-kernel-arch:
1394
Andrew Geissler517393d2023-01-13 08:55:19 -06001395``kernel-arch``
1396===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001397
Andrew Geissler517393d2023-01-13 08:55:19 -06001398The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001399Linux kernel compilation (including modules).
1400
1401.. _ref-classes-kernel-devicetree:
1402
Andrew Geissler517393d2023-01-13 08:55:19 -06001403``kernel-devicetree``
1404=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001405
Andrew Geissler517393d2023-01-13 08:55:19 -06001406The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the
1407:ref:`ref-classes-kernel` class, supports device tree generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001408
1409.. _ref-classes-kernel-fitimage:
1410
Andrew Geissler517393d2023-01-13 08:55:19 -06001411``kernel-fitimage``
1412===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001413
Andrew Geissler517393d2023-01-13 08:55:19 -06001414The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image,
1415device trees, a U-boot script, a :term:`Initramfs` bundle and a RAM disk
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001416into a single FIT image. In theory, a FIT image can support any number
Andrew Geissler517393d2023-01-13 08:55:19 -06001417of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees.
1418However, :ref:`ref-classes-kernel-fitimage` currently only supports
Patrick Williams975a06f2022-10-21 14:42:47 -05001419limited usecases: just one kernel image, an optional U-boot script,
Andrew Geissler517393d2023-01-13 08:55:19 -06001420an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001421device tree.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001422
1423To create a FIT image, it is required that :term:`KERNEL_CLASSES`
Andrew Geissler517393d2023-01-13 08:55:19 -06001424is set to include ":ref:`ref-classes-kernel-fitimage`" and :term:`KERNEL_IMAGETYPE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001425is set to "fitImage".
1426
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001427The options for the device tree compiler passed to ``mkimage -D``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001428when creating the FIT image are specified using the
1429:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1430
1431Only a single kernel can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001432:ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001433address where the kernel image is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001434specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
1435:term:`UBOOT_ENTRYPOINT`.
1436
1437Multiple device trees can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001438:ref:`ref-classes-kernel-fitimage` and the device tree is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001439The address where the device tree is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001440specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001441and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001442
1443Only a single RAM disk can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001444:ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001445The address where the RAM disk image is to be loaded by U-Boot
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001446is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
1447:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to FIT image when
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001448:term:`INITRAMFS_IMAGE` is specified and that :term:`INITRAMFS_IMAGE_BUNDLE`
1449is set to 0.
1450
Andrew Geissler517393d2023-01-13 08:55:19 -06001451Only a single :term:`Initramfs` bundle can be added to the FIT image created by
1452:ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional.
1453In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001454in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
Andrew Geissler517393d2023-01-13 08:55:19 -06001455When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem.
1456The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001457is specified and that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
Andrew Geissler517393d2023-01-13 08:55:19 -06001458The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001459by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1460
1461Only a single U-boot boot script can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001462:ref:`ref-classes-kernel-fitimage` and the boot script is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001463The boot script is specified in the ITS file as a text file containing
1464U-boot commands. When using a boot script the user should configure the
Patrick Williams2194f502022-10-16 14:26:09 -05001465U-boot :ref:`ref-tasks-install` task to copy the script to sysroot.
Andrew Geissler517393d2023-01-13 08:55:19 -06001466So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001467class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
1468load the boot script from the FIT image and executes it.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001469
Andrew Geissler517393d2023-01-13 08:55:19 -06001470The FIT image generated by :ref:`ref-classes-kernel-fitimage` class is signed when the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001471variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1472:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1473appropriately. The default values used for :term:`FIT_HASH_ALG` and
Andrew Geissler517393d2023-01-13 08:55:19 -06001474:term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001475"rsa2048" respectively. The keys for signing fitImage can be generated using
Andrew Geissler517393d2023-01-13 08:55:19 -06001476the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001477:term:`UBOOT_SIGN_ENABLE` are set to "1".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001478
1479
1480.. _ref-classes-kernel-grub:
1481
Andrew Geissler517393d2023-01-13 08:55:19 -06001482``kernel-grub``
1483===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001484
Andrew Geissler517393d2023-01-13 08:55:19 -06001485The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001486the kernel as the priority boot mechanism while installing a RPM to
1487update the kernel on a deployed target.
1488
1489.. _ref-classes-kernel-module-split:
1490
Andrew Geissler517393d2023-01-13 08:55:19 -06001491``kernel-module-split``
1492=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001493
Andrew Geissler517393d2023-01-13 08:55:19 -06001494The :ref:`ref-classes-kernel-module-split` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001495splitting Linux kernel modules into separate packages.
1496
1497.. _ref-classes-kernel-uboot:
1498
Andrew Geissler517393d2023-01-13 08:55:19 -06001499``kernel-uboot``
1500================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001501
Andrew Geissler517393d2023-01-13 08:55:19 -06001502The :ref:`ref-classes-kernel-uboot` class provides support for building from
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001503vmlinux-style kernel sources.
1504
1505.. _ref-classes-kernel-uimage:
1506
Andrew Geissler517393d2023-01-13 08:55:19 -06001507``kernel-uimage``
1508=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001509
Andrew Geissler517393d2023-01-13 08:55:19 -06001510The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001511
1512.. _ref-classes-kernel-yocto:
1513
Andrew Geissler517393d2023-01-13 08:55:19 -06001514``kernel-yocto``
1515================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001516
Andrew Geissler517393d2023-01-13 08:55:19 -06001517The :ref:`ref-classes-kernel-yocto` class provides common functionality for building
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001518from linux-yocto style kernel source repositories.
1519
1520.. _ref-classes-kernelsrc:
1521
Andrew Geissler517393d2023-01-13 08:55:19 -06001522``kernelsrc``
1523=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001524
Andrew Geissler517393d2023-01-13 08:55:19 -06001525The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001526
1527.. _ref-classes-lib_package:
1528
Andrew Geissler517393d2023-01-13 08:55:19 -06001529``lib_package``
1530===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001531
Andrew Geissler517393d2023-01-13 08:55:19 -06001532The :ref:`ref-classes-lib_package` class supports recipes that build libraries and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001533produce executable binaries, where those binaries should not be
1534installed by default along with the library. Instead, the binaries are
1535added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1536make their installation optional.
1537
1538.. _ref-classes-libc*:
1539
Andrew Geissler517393d2023-01-13 08:55:19 -06001540``libc*``
1541=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001542
Andrew Geissler517393d2023-01-13 08:55:19 -06001543The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001544
Patrick Williams2390b1b2022-11-03 13:47:49 -05001545- The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001546 ``libc``.
1547
Patrick Williams2390b1b2022-11-03 13:47:49 -05001548- The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001549 ``eglibc``.
1550
1551.. _ref-classes-license:
1552
Andrew Geissler517393d2023-01-13 08:55:19 -06001553``license``
1554===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001555
Andrew Geissler517393d2023-01-13 08:55:19 -06001556The :ref:`ref-classes-license` class provides license manifest creation and license
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001557exclusion. This class is enabled by default using the default value for
1558the :term:`INHERIT_DISTRO` variable.
1559
1560.. _ref-classes-linux-kernel-base:
1561
Andrew Geissler517393d2023-01-13 08:55:19 -06001562``linux-kernel-base``
1563=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001564
Andrew Geissler517393d2023-01-13 08:55:19 -06001565The :ref:`ref-classes-linux-kernel-base` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001566recipes that build out of the Linux kernel source tree. These builds
1567goes beyond the kernel itself. For example, the Perf recipe also
1568inherits this class.
1569
1570.. _ref-classes-linuxloader:
1571
Andrew Geissler517393d2023-01-13 08:55:19 -06001572``linuxloader``
1573===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001574
1575Provides the function ``linuxloader()``, which gives the value of the
1576dynamic loader/linker provided on the platform. This value is used by a
1577number of other classes.
1578
1579.. _ref-classes-logging:
1580
Andrew Geissler517393d2023-01-13 08:55:19 -06001581``logging``
1582===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001583
Andrew Geissler517393d2023-01-13 08:55:19 -06001584The :ref:`ref-classes-logging` class provides the standard shell functions used to log
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001585messages for various BitBake severity levels (i.e. ``bbplain``,
1586``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1587
Andrew Geissler517393d2023-01-13 08:55:19 -06001588This class is enabled by default since it is inherited by the :ref:`ref-classes-base`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001589class.
1590
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001591.. _ref-classes-metadata_scm:
1592
Andrew Geissler517393d2023-01-13 08:55:19 -06001593``metadata_scm``
1594================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001595
Andrew Geissler517393d2023-01-13 08:55:19 -06001596The :ref:`ref-classes-metadata_scm` class provides functionality for querying the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001597branch and revision of a Source Code Manager (SCM) repository.
1598
Andrew Geissler517393d2023-01-13 08:55:19 -06001599The :ref:`ref-classes-base` class uses this class to print the revisions of
1600each layer before starting every build. The :ref:`ref-classes-metadata_scm`
1601class is enabled by default because it is inherited by the
1602:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001603
1604.. _ref-classes-migrate_localcount:
1605
Andrew Geissler517393d2023-01-13 08:55:19 -06001606``migrate_localcount``
1607======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001608
Andrew Geissler517393d2023-01-13 08:55:19 -06001609The :ref:`ref-classes-migrate_localcount` class verifies a recipe's localcount data and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001610increments it appropriately.
1611
1612.. _ref-classes-mime:
1613
Andrew Geissler517393d2023-01-13 08:55:19 -06001614``mime``
1615========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001616
Andrew Geissler517393d2023-01-13 08:55:19 -06001617The :ref:`ref-classes-mime` class generates the proper post-install and post-remove
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001618(postinst/postrm) scriptlets for packages that install MIME type files.
1619These scriptlets call ``update-mime-database`` to add the MIME types to
1620the shared database.
1621
Patrick Williams7784c422022-11-17 07:29:11 -06001622.. _ref-classes-mime-xdg:
1623
Andrew Geissler517393d2023-01-13 08:55:19 -06001624``mime-xdg``
1625============
Patrick Williams7784c422022-11-17 07:29:11 -06001626
Andrew Geissler517393d2023-01-13 08:55:19 -06001627The :ref:`ref-classes-mime-xdg` class generates the proper
Patrick Williams7784c422022-11-17 07:29:11 -06001628post-install and post-remove (postinst/postrm) scriptlets for packages
1629that install ``.desktop`` files containing ``MimeType`` entries.
1630These scriptlets call ``update-desktop-database`` to add the MIME types
1631to the database of MIME types handled by desktop files.
1632
1633Thanks to this class, when users open a file through a file browser
1634on recently created images, they don't have to choose the application
1635to open the file from the pool of all known applications, even the ones
1636that cannot open the selected file.
1637
1638If you have recipes installing their ``.desktop`` files as absolute
1639symbolic links, the detection of such files cannot be done by the current
1640implementation of this class. In this case, you have to add the corresponding
1641package names to the :term:`MIME_XDG_PACKAGES` variable.
1642
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001643.. _ref-classes-mirrors:
1644
Andrew Geissler517393d2023-01-13 08:55:19 -06001645``mirrors``
1646===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001647
Andrew Geissler517393d2023-01-13 08:55:19 -06001648The :ref:`ref-classes-mirrors` class sets up some standard
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001649:term:`MIRRORS` entries for source code mirrors. These
1650mirrors provide a fall-back path in case the upstream source specified
1651in :term:`SRC_URI` within recipes is unavailable.
1652
1653This class is enabled by default since it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06001654:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001655
1656.. _ref-classes-module:
1657
Andrew Geissler517393d2023-01-13 08:55:19 -06001658``module``
1659==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001660
Andrew Geissler517393d2023-01-13 08:55:19 -06001661The :ref:`ref-classes-module` class provides support for building out-of-tree Linux
1662kernel modules. The class inherits the :ref:`ref-classes-module-base` and
1663:ref:`ref-classes-kernel-module-split` classes, and implements the
1664:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001665everything needed to build and package a kernel module.
1666
1667For general information on out-of-tree Linux kernel modules, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001668":ref:`kernel-dev/common:incorporating out-of-tree modules`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001669section in the Yocto Project Linux Kernel Development Manual.
1670
1671.. _ref-classes-module-base:
1672
Andrew Geissler517393d2023-01-13 08:55:19 -06001673``module-base``
1674===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001675
Andrew Geissler517393d2023-01-13 08:55:19 -06001676The :ref:`ref-classes-module-base` class provides the base functionality for
1677building Linux kernel modules. Typically, a recipe that builds software that
1678includes one or more kernel modules and has its own means of building the module
1679inherits this class as opposed to inheriting the :ref:`ref-classes-module`
1680class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001681
1682.. _ref-classes-multilib*:
1683
Andrew Geissler517393d2023-01-13 08:55:19 -06001684``multilib*``
1685=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001686
Andrew Geissler517393d2023-01-13 08:55:19 -06001687The :ref:`ref-classes-multilib*` classes provide support for building libraries with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001688different target optimizations or target architectures and installing
1689them side-by-side in the same image.
1690
1691For more information on using the Multilib feature, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001692":ref:`dev-manual/libraries:combining multiple versions of library files into one image`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001693section in the Yocto Project Development Tasks Manual.
1694
1695.. _ref-classes-native:
1696
Andrew Geissler517393d2023-01-13 08:55:19 -06001697``native``
1698==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001699
Andrew Geissler517393d2023-01-13 08:55:19 -06001700The :ref:`ref-classes-native` class provides common functionality for recipes that
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001701build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
1702or other tools from the build host).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001703
1704You can create a recipe that builds tools that run natively on the host
1705a couple different ways:
1706
Andrew Geissler517393d2023-01-13 08:55:19 -06001707- Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001708 class. If you use this method, you must order the inherit statement
1709 in the recipe after all other inherit statements so that the
Andrew Geissler517393d2023-01-13 08:55:19 -06001710 :ref:`ref-classes-native` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001711
1712 .. note::
1713
1714 When creating a recipe this way, the recipe name must follow this
Andrew Geisslerc926e172021-05-07 16:11:35 -05001715 naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001716
1717 myrecipe-native.bb
1718
1719
1720 Not using this naming convention can lead to subtle problems
1721 caused by existing code that depends on that naming convention.
1722
Andrew Geisslerc926e172021-05-07 16:11:35 -05001723- Create or modify a target recipe that contains the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001724
1725 BBCLASSEXTEND = "native"
1726
1727 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001728 recipe, use ``:class-native`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001729 specify any functionality specific to the respective native or target
1730 case.
1731
Andrew Geissler517393d2023-01-13 08:55:19 -06001732Although applied differently, the :ref:`ref-classes-native` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001733methods. The advantage of the second method is that you do not need to
1734have two separate recipes (assuming you need both) for native and
1735target. All common parts of the recipe are automatically shared.
1736
1737.. _ref-classes-nativesdk:
1738
Andrew Geissler517393d2023-01-13 08:55:19 -06001739``nativesdk``
1740=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001741
Andrew Geissler517393d2023-01-13 08:55:19 -06001742The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001743wish to build tools to run as part of an SDK (i.e. tools that run on
1744:term:`SDKMACHINE`).
1745
1746You can create a recipe that builds tools that run on the SDK machine a
1747couple different ways:
1748
Andrew Geisslereff27472021-10-29 15:35:00 -05001749- Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -06001750 :ref:`ref-classes-nativesdk` class. If you use this method, you must order the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001751 inherit statement in the recipe after all other inherit statements so
Andrew Geissler517393d2023-01-13 08:55:19 -06001752 that the :ref:`ref-classes-nativesdk` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001753
Andrew Geissler517393d2023-01-13 08:55:19 -06001754- Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001755
1756 BBCLASSEXTEND = "nativesdk"
1757
1758 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001759 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001760 specify any functionality specific to the respective SDK machine or
1761 target case.
1762
1763.. note::
1764
Andrew Geisslerc926e172021-05-07 16:11:35 -05001765 When creating a recipe, you must follow this naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001766
1767 nativesdk-myrecipe.bb
1768
1769
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001770 Not doing so can lead to subtle problems because there is code that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001771 depends on the naming convention.
1772
Andrew Geissler517393d2023-01-13 08:55:19 -06001773Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001774methods. The advantage of the second method is that you do not need to
1775have two separate recipes (assuming you need both) for the SDK machine
1776and the target. All common parts of the recipe are automatically shared.
1777
1778.. _ref-classes-nopackages:
1779
Andrew Geissler517393d2023-01-13 08:55:19 -06001780``nopackages``
1781==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001782
1783Disables packaging tasks for those recipes and classes where packaging
1784is not needed.
1785
1786.. _ref-classes-npm:
1787
Andrew Geissler517393d2023-01-13 08:55:19 -06001788``npm``
1789=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001790
Patrick Williams7784c422022-11-17 07:29:11 -06001791Provides support for building Node.js software fetched using the
1792:wikipedia:`node package manager (NPM) <Npm_(software)>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001793
1794.. note::
1795
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001796 Currently, recipes inheriting this class must use the ``npm://``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001797 fetcher to have dependencies fetched and packaged automatically.
1798
1799For information on how to create NPM packages, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001800":ref:`dev-manual/packages:creating node package manager (npm) packages`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001801section in the Yocto Project Development Tasks Manual.
1802
1803.. _ref-classes-oelint:
1804
Andrew Geissler517393d2023-01-13 08:55:19 -06001805``oelint``
1806==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001807
Andrew Geissler517393d2023-01-13 08:55:19 -06001808The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001809``meta/classes`` in the :term:`Source Directory`.
1810
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001811There are some classes that could be generally useful in OE-Core but
Andrew Geissler517393d2023-01-13 08:55:19 -06001812are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001813one such example. However, being aware of this class can reduce the
1814proliferation of different versions of similar classes across multiple
1815layers.
1816
Andrew Geissler5199d832021-09-24 16:47:35 -05001817.. _ref-classes-overlayfs:
1818
Andrew Geissler517393d2023-01-13 08:55:19 -06001819``overlayfs``
1820=============
Andrew Geissler5199d832021-09-24 16:47:35 -05001821
Andrew Geissler595f6302022-01-24 19:11:47 +00001822It's often desired in Embedded System design to have a read-only root filesystem.
Andrew Geissler5199d832021-09-24 16:47:35 -05001823But a lot of different applications might want to have read-write access to
1824some parts of a filesystem. It can be especially useful when your update mechanism
Andrew Geissler595f6302022-01-24 19:11:47 +00001825overwrites the whole root filesystem, but you may want your application data to be preserved
Andrew Geissler517393d2023-01-13 08:55:19 -06001826between updates. The :ref:`ref-classes-overlayfs` class provides a way
Andrew Geissler5199d832021-09-24 16:47:35 -05001827to achieve that by means of ``overlayfs`` and at the same time keeping the base
Andrew Geissler595f6302022-01-24 19:11:47 +00001828root filesystem read-only.
Andrew Geissler5199d832021-09-24 16:47:35 -05001829
1830To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
1831layer in your machine configuration. The underlying file system can be anything that
1832is supported by ``overlayfs``. This has to be done in your machine configuration::
1833
1834 OVERLAYFS_MOUNT_POINT[data] = "/data"
1835
1836.. note::
1837
1838 * QA checks fail to catch file existence if you redefine this variable in your recipe!
1839 * Only the existence of the systemd mount unit file is checked, not its contents.
1840 * To get more details on ``overlayfs``, its internals and supported operations, please refer
Patrick Williams2390b1b2022-11-03 13:47:49 -05001841 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 -05001842
1843The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
1844(e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
1845
1846Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
1847
1848 OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
1849
1850To support several mount points you can use a different variable flag. Assuming we
1851want to have a writable location on the file system, but do not need that the data
Andrew Geissler595f6302022-01-24 19:11:47 +00001852survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
1853file system.
Andrew Geissler5199d832021-09-24 16:47:35 -05001854
1855In your machine configuration::
1856
1857 OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
1858
1859and then in your recipe::
1860
1861 OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
1862
Andrew Geissler595f6302022-01-24 19:11:47 +00001863On a practical note, your application recipe might require multiple
1864overlays to be mounted before running to avoid writing to the underlying
1865file system (which can be forbidden in case of read-only file system)
Andrew Geissler517393d2023-01-13 08:55:19 -06001866To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd``
Andrew Geissler595f6302022-01-24 19:11:47 +00001867helper service for mounting overlays. This helper service is named
1868``${PN}-overlays.service`` and can be depended on in your application recipe
1869(named ``application`` in the following example) ``systemd`` unit by adding
1870to the unit the following::
1871
1872 [Unit]
1873 After=application-overlays.service
1874 Requires=application-overlays.service
1875
Andrew Geissler5199d832021-09-24 16:47:35 -05001876.. note::
1877
1878 The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
Andrew Geissler517393d2023-01-13 08:55:19 -06001879 In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`.
Andrew Geissler595f6302022-01-24 19:11:47 +00001880
1881.. _ref-classes-overlayfs-etc:
1882
Andrew Geissler517393d2023-01-13 08:55:19 -06001883``overlayfs-etc``
1884=================
Andrew Geissler595f6302022-01-24 19:11:47 +00001885
1886In order to have the ``/etc`` directory in overlayfs a special handling at early
1887boot stage is required. The idea is to supply a custom init script that mounts
1888``/etc`` before launching the actual init program, because the latter already
1889requires ``/etc`` to be mounted.
1890
1891Example usage in image recipe::
1892
1893 IMAGE_FEATURES += "overlayfs-etc"
1894
1895.. note::
1896
1897 This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
1898
1899Your machine configuration should define at least the device, mount point, and file system type
1900you are going to use for ``overlayfs``::
1901
1902 OVERLAYFS_ETC_MOUNT_POINT = "/data"
1903 OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
1904 OVERLAYFS_ETC_FSTYPE ?= "ext4"
1905
1906To control more mount options you should consider setting mount options
1907(``defaults`` is used by default)::
1908
1909 OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
1910
1911The class provides two options for ``/sbin/init`` generation:
1912
1913- The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
1914 and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
1915 that you won't need to change any kernel parameters in order to make it work,
1916 but it poses a restriction that package-management can't be used, because updating
1917 the init manager would remove the generated script.
1918
1919- If you wish to keep original init as is, you can set::
1920
1921 OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
1922
1923 Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
1924 kernel parameters manually in your bootloader configuration.
Andrew Geissler5199d832021-09-24 16:47:35 -05001925
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001926.. _ref-classes-own-mirrors:
1927
Andrew Geissler517393d2023-01-13 08:55:19 -06001928``own-mirrors``
1929===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001930
Andrew Geissler517393d2023-01-13 08:55:19 -06001931The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001932:term:`PREMIRRORS` from which to first fetch source
1933before attempting to fetch it from the upstream specified in
1934:term:`SRC_URI` within each recipe.
1935
1936To use this class, inherit it globally and specify
Andrew Geisslerc926e172021-05-07 16:11:35 -05001937:term:`SOURCE_MIRROR_URL`. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001938
1939 INHERIT += "own-mirrors"
1940 SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
1941
1942You can specify only a single URL
Andrew Geissler09036742021-06-25 14:25:14 -05001943in :term:`SOURCE_MIRROR_URL`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001944
1945.. _ref-classes-package:
1946
Andrew Geissler517393d2023-01-13 08:55:19 -06001947``package``
1948===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001949
Andrew Geissler517393d2023-01-13 08:55:19 -06001950The :ref:`ref-classes-package` class supports generating packages from a build's
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001951output. The core generic functionality is in ``package.bbclass``. The
1952code specific to particular package types resides in these
Andrew Geissler517393d2023-01-13 08:55:19 -06001953package-specific classes: :ref:`ref-classes-package_deb`,
1954:ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`, and
1955:ref:`ref-classes-package_tar`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001956
1957.. note::
1958
Andrew Geissler517393d2023-01-13 08:55:19 -06001959 The :ref:`ref-classes-package_tar` class is broken and
Patrick Williams2390b1b2022-11-03 13:47:49 -05001960 not supported. It is recommended that you do not use this class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001961
1962You can control the list of resulting package formats by using the
Andrew Geissler09036742021-06-25 14:25:14 -05001963:term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001964configuration file, which is located in the :term:`Build Directory`.
Patrick Williams2390b1b2022-11-03 13:47:49 -05001965When defining the variable, you can specify one or more package types.
1966Since images are generated from packages, a packaging class is needed
1967to enable image generation. The first class listed in this variable is
1968used for image generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001969
1970If you take the optional step to set up a repository (package feed) on
1971the development host that can be used by DNF, you can install packages
1972from the feed while you are running the image on the target (i.e.
1973runtime installation of packages). For more information, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001974":ref:`dev-manual/packages:using runtime package management`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001975section in the Yocto Project Development Tasks Manual.
1976
1977The package-specific class you choose can affect build-time performance
1978and has space ramifications. In general, building a package with IPK
1979takes about thirty percent less time as compared to using RPM to build
1980the same or similar package. This comparison takes into account a
1981complete build of the package with all dependencies previously built.
1982The reason for this discrepancy is because the RPM package manager
1983creates and processes more :term:`Metadata` than the IPK package
Andrew Geissler09036742021-06-25 14:25:14 -05001984manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
Andrew Geissler517393d2023-01-13 08:55:19 -06001985":ref:`ref-classes-package_ipk`" if you are building smaller systems.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001986
1987Before making your package manager decision, however, you should
1988consider some further things about using RPM:
1989
1990- RPM starts to provide more abilities than IPK due to the fact that it
1991 processes more Metadata. For example, this information includes
1992 individual file types, file checksum generation and evaluation on
1993 install, sparse file support, conflict detection and resolution for
1994 Multilib systems, ACID style upgrade, and repackaging abilities for
1995 rollbacks.
1996
1997- For smaller systems, the extra space used for the Berkeley Database
1998 and the amount of metadata when using RPM can affect your ability to
1999 perform on-device upgrades.
2000
2001You can find additional information on the effects of the package class
2002at these two Yocto Project mailing list links:
2003
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002004- :yocto_lists:`/pipermail/poky/2011-May/006362.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002005
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002006- :yocto_lists:`/pipermail/poky/2011-May/006363.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002007
2008.. _ref-classes-package_deb:
2009
Andrew Geissler517393d2023-01-13 08:55:19 -06002010``package_deb``
2011===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002012
Andrew Geissler517393d2023-01-13 08:55:19 -06002013The :ref:`ref-classes-package_deb` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002014use the Debian (i.e. ``.deb``) file format. The class ensures the
2015packages are written out in a ``.deb`` file format to the
2016``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
2017
Andrew Geissler517393d2023-01-13 08:55:19 -06002018This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002019is enabled through the :term:`PACKAGE_CLASSES`
2020variable in the ``local.conf`` file.
2021
2022.. _ref-classes-package_ipk:
2023
Andrew Geissler517393d2023-01-13 08:55:19 -06002024``package_ipk``
2025===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002026
Andrew Geissler517393d2023-01-13 08:55:19 -06002027The :ref:`ref-classes-package_ipk` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002028use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
2029are written out in a ``.ipk`` file format to the
2030``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
2031
Andrew Geissler517393d2023-01-13 08:55:19 -06002032This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002033is enabled through the :term:`PACKAGE_CLASSES`
2034variable in the ``local.conf`` file.
2035
2036.. _ref-classes-package_rpm:
2037
Andrew Geissler517393d2023-01-13 08:55:19 -06002038``package_rpm``
2039===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002040
Andrew Geissler517393d2023-01-13 08:55:19 -06002041The :ref:`ref-classes-package_rpm` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002042use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
2043are written out in a ``.rpm`` file format to the
2044``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
2045
Andrew Geissler517393d2023-01-13 08:55:19 -06002046This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002047is enabled through the :term:`PACKAGE_CLASSES`
2048variable in the ``local.conf`` file.
2049
2050.. _ref-classes-package_tar:
2051
Andrew Geissler517393d2023-01-13 08:55:19 -06002052``package_tar``
2053===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002054
Andrew Geissler517393d2023-01-13 08:55:19 -06002055The :ref:`ref-classes-package_tar` class provides support for creating tarballs. The
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002056class ensures the packages are written out in a tarball format to the
2057``${``\ :term:`DEPLOY_DIR_TAR`\ ``}`` directory.
2058
Andrew Geissler517393d2023-01-13 08:55:19 -06002059This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002060is enabled through the :term:`PACKAGE_CLASSES`
2061variable in the ``local.conf`` file.
2062
2063.. note::
2064
Andrew Geissler517393d2023-01-13 08:55:19 -06002065 You cannot specify the :ref:`ref-classes-package_tar` class first using the
Andrew Geissler09036742021-06-25 14:25:14 -05002066 :term:`PACKAGE_CLASSES` variable. You must use ``.deb``, ``.ipk``, or ``.rpm``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002067 file formats for your image or SDK.
2068
2069.. _ref-classes-packagedata:
2070
Andrew Geissler517393d2023-01-13 08:55:19 -06002071``packagedata``
2072===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002073
Andrew Geissler517393d2023-01-13 08:55:19 -06002074The :ref:`ref-classes-packagedata` class provides common functionality for reading
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002075``pkgdata`` files found in :term:`PKGDATA_DIR`. These
2076files contain information about each output package produced by the
2077OpenEmbedded build system.
2078
2079This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002080:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002081
2082.. _ref-classes-packagegroup:
2083
Andrew Geissler517393d2023-01-13 08:55:19 -06002084``packagegroup``
2085================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002086
Andrew Geissler517393d2023-01-13 08:55:19 -06002087The :ref:`ref-classes-packagegroup` class sets default values appropriate for package
Andrew Geissler09036742021-06-25 14:25:14 -05002088group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002089so forth). It is highly recommended that all package group recipes
2090inherit this class.
2091
2092For information on how to use this class, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002093":ref:`dev-manual/customizing-images:customizing images using custom package groups`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002094section in the Yocto Project Development Tasks Manual.
2095
2096Previously, this class was called the ``task`` class.
2097
2098.. _ref-classes-patch:
2099
Andrew Geissler517393d2023-01-13 08:55:19 -06002100``patch``
2101=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002102
Andrew Geissler517393d2023-01-13 08:55:19 -06002103The :ref:`ref-classes-patch` class provides all functionality for applying patches
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002104during the :ref:`ref-tasks-patch` task.
2105
2106This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002107:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002108
2109.. _ref-classes-perlnative:
2110
Andrew Geissler517393d2023-01-13 08:55:19 -06002111``perlnative``
2112==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002113
Andrew Geissler517393d2023-01-13 08:55:19 -06002114When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002115native version of Perl built by the build system rather than using the
2116version provided by the build host.
2117
Patrick Williams975a06f2022-10-21 14:42:47 -05002118.. _ref-classes-pypi:
2119
Andrew Geissler517393d2023-01-13 08:55:19 -06002120``pypi``
2121========
Patrick Williams975a06f2022-10-21 14:42:47 -05002122
Andrew Geissler517393d2023-01-13 08:55:19 -06002123The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build
Patrick Williams975a06f2022-10-21 14:42:47 -05002124Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
2125By default it determines the PyPI package name based upon :term:`BPN`
2126(stripping the "python-" or "python3-" prefix off if present), however in
2127some cases you may need to set it manually in the recipe by setting
2128:term:`PYPI_PACKAGE`.
2129
Andrew Geissler517393d2023-01-13 08:55:19 -06002130Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`,
Patrick Williams975a06f2022-10-21 14:42:47 -05002131:term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
2132and :term:`CVE_PRODUCT`.
2133
Patrick Williams45852732022-04-02 08:58:32 -05002134.. _ref-classes-python_flit_core:
2135
Andrew Geissler517393d2023-01-13 08:55:19 -06002136``python_flit_core``
2137====================
Patrick Williams45852732022-04-02 08:58:32 -05002138
Andrew Geissler517393d2023-01-13 08:55:19 -06002139The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare
Patrick Williams45852732022-04-02 08:58:32 -05002140the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2141``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
2142section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2143
2144Python modules built with ``flit_core.buildapi`` are pure Python (no
2145``C`` or ``Rust`` extensions).
2146
Andrew Geissler517393d2023-01-13 08:55:19 -06002147Internally this uses the :ref:`ref-classes-python_pep517` class.
Patrick Williams45852732022-04-02 08:58:32 -05002148
Andrew Geissler9aee5002022-03-30 16:27:02 +00002149.. _ref-classes-python_pep517:
2150
Andrew Geissler517393d2023-01-13 08:55:19 -06002151``python_pep517``
2152=================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002153
Andrew Geissler517393d2023-01-13 08:55:19 -06002154The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary
Patrick Williams45852732022-04-02 08:58:32 -05002155archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
Andrew Geissler9aee5002022-03-30 16:27:02 +00002156
Patrick Williams45852732022-04-02 08:58:32 -05002157Recipes wouldn't inherit this directly, instead typically another class will
Andrew Geissler615f2f12022-07-15 14:00:58 -05002158inherit this and add the relevant native dependencies.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002159
Andrew Geissler517393d2023-01-13 08:55:19 -06002160Examples of classes which do this are :ref:`ref-classes-python_flit_core`,
2161:ref:`ref-classes-python_setuptools_build_meta`, and
2162:ref:`ref-classes-python_poetry_core`.
Patrick Williams45852732022-04-02 08:58:32 -05002163
2164.. _ref-classes-python_poetry_core:
2165
Andrew Geissler517393d2023-01-13 08:55:19 -06002166``python_poetry_core``
2167======================
Patrick Williams45852732022-04-02 08:58:32 -05002168
Andrew Geissler517393d2023-01-13 08:55:19 -06002169The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the
Patrick Williams45852732022-04-02 08:58:32 -05002170`Poetry Core <https://python-poetry.org>`__ build system.
2171
Andrew Geissler517393d2023-01-13 08:55:19 -06002172Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002173
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002174.. _ref-classes-pixbufcache:
2175
Andrew Geissler517393d2023-01-13 08:55:19 -06002176``pixbufcache``
2177===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002178
Andrew Geissler517393d2023-01-13 08:55:19 -06002179The :ref:`ref-classes-pixbufcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002180post-remove (postinst/postrm) scriptlets for packages that install
2181pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
2182call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
2183Since the cache files are architecture-specific, ``update_pixbuf_cache``
2184is run using QEMU if the postinst scriptlets need to be run on the build
2185host during image creation.
2186
2187If the pixbuf loaders being installed are in packages other than the
2188recipe's main package, set
2189:term:`PIXBUF_PACKAGES` to specify the packages
2190containing the loaders.
2191
2192.. _ref-classes-pkgconfig:
2193
Andrew Geissler517393d2023-01-13 08:55:19 -06002194``pkgconfig``
2195=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002196
Andrew Geissler517393d2023-01-13 08:55:19 -06002197The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002198library information by using ``pkg-config``. This class aims to smooth
2199integration of ``pkg-config`` into libraries that use it.
2200
2201During staging, BitBake installs ``pkg-config`` data into the
2202``sysroots/`` directory. By making use of sysroot functionality within
Andrew Geissler517393d2023-01-13 08:55:19 -06002203``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002204files.
2205
2206.. _ref-classes-populate-sdk:
2207
Andrew Geissler517393d2023-01-13 08:55:19 -06002208``populate_sdk``
2209================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002210
Andrew Geissler517393d2023-01-13 08:55:19 -06002211The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002212information on advantages gained when building a cross-development
2213toolchain using the :ref:`ref-tasks-populate_sdk`
Andrew Geissler09209ee2020-12-13 08:44:15 -06002214task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002215section in the Yocto Project Application Development and the Extensible
2216Software Development Kit (eSDK) manual.
2217
2218.. _ref-classes-populate-sdk-*:
2219
Andrew Geissler517393d2023-01-13 08:55:19 -06002220``populate_sdk_*``
2221==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002222
Andrew Geissler517393d2023-01-13 08:55:19 -06002223The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002224following classes:
2225
Patrick Williams2390b1b2022-11-03 13:47:49 -05002226- :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002227 all package managers (i.e. DEB, RPM, and opkg).
2228
Patrick Williams2390b1b2022-11-03 13:47:49 -05002229- :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002230 package manager.
2231
Patrick Williams2390b1b2022-11-03 13:47:49 -05002232- :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002233 package manager.
2234
Patrick Williams2390b1b2022-11-03 13:47:49 -05002235- :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002236 (IPK format) package manager.
2237
Patrick Williams2390b1b2022-11-03 13:47:49 -05002238- :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002239 package managers.
2240
Patrick Williams2390b1b2022-11-03 13:47:49 -05002241The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002242``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2243:term:`IMAGE_PKGTYPE`.
2244
2245The base class ensures all source and destination directories are
2246established and then populates the SDK. After populating the SDK, the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002247:ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002248``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2249contains the cross-compiler and associated tooling, and the target,
2250which contains a target root filesystem that is configured for the SDK
2251usage. These two images reside in :term:`SDK_OUTPUT`,
Andrew Geisslerc926e172021-05-07 16:11:35 -05002252which consists of the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002253
2254 ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2255 ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2256
2257Finally, the base populate SDK class creates the toolchain environment
2258setup script, the tarball of the SDK, and the installer.
2259
Patrick Williams2390b1b2022-11-03 13:47:49 -05002260The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and
2261:ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK.
2262These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002263class.
2264
2265For more information on the cross-development toolchain generation, see
Andrew Geissler09209ee2020-12-13 08:44:15 -06002266the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002267section in the Yocto Project Overview and Concepts Manual. For
2268information on advantages gained when building a cross-development
2269toolchain using the :ref:`ref-tasks-populate_sdk`
2270task, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002271":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002272section in the Yocto Project Application Development and the Extensible
2273Software Development Kit (eSDK) manual.
2274
2275.. _ref-classes-prexport:
2276
Andrew Geissler517393d2023-01-13 08:55:19 -06002277``prexport``
2278============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002279
Andrew Geissler517393d2023-01-13 08:55:19 -06002280The :ref:`ref-classes-prexport` class provides functionality for exporting
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002281:term:`PR` values.
2282
2283.. note::
2284
2285 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002286 when using "``bitbake-prserv-tool export``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002287
2288.. _ref-classes-primport:
2289
Andrew Geissler517393d2023-01-13 08:55:19 -06002290``primport``
2291============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002292
Andrew Geissler517393d2023-01-13 08:55:19 -06002293The :ref:`ref-classes-primport` class provides functionality for importing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002294:term:`PR` values.
2295
2296.. note::
2297
2298 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002299 when using "``bitbake-prserv-tool import``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002300
2301.. _ref-classes-prserv:
2302
Andrew Geissler517393d2023-01-13 08:55:19 -06002303``prserv``
2304==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002305
Andrew Geissler517393d2023-01-13 08:55:19 -06002306The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR
2307service <dev-manual/packages:working with a pr service>` in order to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002308automatically manage the incrementing of the :term:`PR`
2309variable for each recipe.
2310
2311This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002312:ref:`ref-classes-package` class. However, the OpenEmbedded
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002313build system will not enable the functionality of this class unless
2314:term:`PRSERV_HOST` has been set.
2315
2316.. _ref-classes-ptest:
2317
Andrew Geissler517393d2023-01-13 08:55:19 -06002318``ptest``
2319=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002320
Andrew Geissler517393d2023-01-13 08:55:19 -06002321The :ref:`ref-classes-ptest` class provides functionality for packaging and installing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002322runtime tests for recipes that build software that provides these tests.
2323
2324This class is intended to be inherited by individual recipes. However,
2325the class' functionality is largely disabled unless "ptest" appears in
2326:term:`DISTRO_FEATURES`. See the
Andrew Geissler517393d2023-01-13 08:55:19 -06002327":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002328section in the Yocto Project Development Tasks Manual for more information
2329on ptest.
2330
2331.. _ref-classes-ptest-gnome:
2332
Andrew Geissler517393d2023-01-13 08:55:19 -06002333``ptest-gnome``
2334===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002335
2336Enables package tests (ptests) specifically for GNOME packages, which
2337have tests intended to be executed with ``gnome-desktop-testing``.
2338
2339For information on setting up and running ptests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002340":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002341section in the Yocto Project Development Tasks Manual.
2342
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002343.. _ref-classes-python3-dir:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002344
Andrew Geissler517393d2023-01-13 08:55:19 -06002345``python3-dir``
2346===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002347
Andrew Geissler517393d2023-01-13 08:55:19 -06002348The :ref:`ref-classes-python3-dir` class provides the base version, location, and site
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002349package location for Python 3.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002350
2351.. _ref-classes-python3native:
2352
Andrew Geissler517393d2023-01-13 08:55:19 -06002353``python3native``
2354=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002355
Andrew Geissler517393d2023-01-13 08:55:19 -06002356The :ref:`ref-classes-python3native` class supports using the native version of Python
Andrew Geisslerc9f78652020-09-18 14:11:35 -050023573 built by the build system rather than support of the version provided
2358by the build host.
2359
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002360.. _ref-classes-python3targetconfig:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002361
Andrew Geissler517393d2023-01-13 08:55:19 -06002362``python3targetconfig``
2363=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002364
Andrew Geissler517393d2023-01-13 08:55:19 -06002365The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050023663 built by the build system rather than support of the version provided
2367by the build host, except that the configuration for the target machine
2368is accessible (such as correct installation directories). This also adds a
2369dependency on target ``python3``, so should only be used where appropriate
2370in order to avoid unnecessarily lengthening builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002371
2372.. _ref-classes-qemu:
2373
Andrew Geissler517393d2023-01-13 08:55:19 -06002374``qemu``
2375========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002376
Andrew Geissler517393d2023-01-13 08:55:19 -06002377The :ref:`ref-classes-qemu` class provides functionality for recipes that either need
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002378QEMU or test for the existence of QEMU. Typically, this class is used to
2379run programs for a target system on the build host using QEMU's
2380application emulation mode.
2381
2382.. _ref-classes-recipe_sanity:
2383
Andrew Geissler517393d2023-01-13 08:55:19 -06002384``recipe_sanity``
2385=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002386
Andrew Geissler517393d2023-01-13 08:55:19 -06002387The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002388recipe prerequisites that might affect the build (e.g. variables that
2389are set or software that is present).
2390
2391.. _ref-classes-relocatable:
2392
Andrew Geissler517393d2023-01-13 08:55:19 -06002393``relocatable``
2394===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002395
Andrew Geissler517393d2023-01-13 08:55:19 -06002396The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002397installed into the sysroot.
2398
Andrew Geissler517393d2023-01-13 08:55:19 -06002399This class makes use of the :ref:`ref-classes-chrpath` class and is used by
2400both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002401
2402.. _ref-classes-remove-libtool:
2403
Andrew Geissler517393d2023-01-13 08:55:19 -06002404``remove-libtool``
2405==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002406
Andrew Geissler517393d2023-01-13 08:55:19 -06002407The :ref:`ref-classes-remove-libtool` class adds a post function to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002408:ref:`ref-tasks-install` task to remove all ``.la`` files
2409installed by ``libtool``. Removing these files results in them being
2410absent from both the sysroot and target packages.
2411
2412If a recipe needs the ``.la`` files to be installed, then the recipe can
Andrew Geisslerc926e172021-05-07 16:11:35 -05002413override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002414
2415 REMOVE_LIBTOOL_LA = "0"
2416
2417.. note::
2418
Andrew Geissler517393d2023-01-13 08:55:19 -06002419 The :ref:`ref-classes-remove-libtool` class is not enabled by default.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002420
2421.. _ref-classes-report-error:
2422
Andrew Geissler517393d2023-01-13 08:55:19 -06002423``report-error``
2424================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002425
Andrew Geissler517393d2023-01-13 08:55:19 -06002426The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting
2427tool <dev-manual/error-reporting-tool:using the error reporting tool>`",
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002428which allows you to submit build error information to a central database.
2429
2430The class collects debug information for recipe, recipe version, task,
2431machine, distro, build system, target system, host distro, branch,
2432commit, and log. From the information, report files using a JSON format
2433are created and stored in
2434``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2435
2436.. _ref-classes-rm-work:
2437
Andrew Geissler517393d2023-01-13 08:55:19 -06002438``rm_work``
2439===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002440
Andrew Geissler517393d2023-01-13 08:55:19 -06002441The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002442can ease your hard drive demands during builds.
2443
2444The OpenEmbedded build system can use a substantial amount of disk space
2445during the build process. A portion of this space is the work files
2446under the ``${TMPDIR}/work`` directory for each recipe. Once the build
2447system generates the packages for a recipe, the work files for that
2448recipe are no longer needed. However, by default, the build system
2449preserves these files for inspection and possible debugging purposes. If
Andrew Geissler517393d2023-01-13 08:55:19 -06002450you would rather have these files deleted to save disk space as the build
2451progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to
Patrick Williams2390b1b2022-11-03 13:47:49 -05002452your ``local.conf`` file, which is found in the :term:`Build Directory`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002453
2454 INHERIT += "rm_work"
2455
Andrew Geissler517393d2023-01-13 08:55:19 -06002456If you are modifying and building source code out of the work directory for a
2457recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your
2458changes to the source being lost. To exclude some recipes from having their work
2459directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the
2460recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable,
2461which can also be set in your ``local.conf`` file. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002462
2463 RM_WORK_EXCLUDE += "busybox glibc"
2464
2465.. _ref-classes-rootfs*:
2466
Andrew Geissler517393d2023-01-13 08:55:19 -06002467``rootfs*``
2468===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002469
Andrew Geissler517393d2023-01-13 08:55:19 -06002470The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002471image and consist of the following classes:
2472
Patrick Williams2390b1b2022-11-03 13:47:49 -05002473- The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002474 post-processing functions for image recipes.
2475
Patrick Williams2390b1b2022-11-03 13:47:49 -05002476- The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002477 for images built using ``.deb`` packages.
2478
Patrick Williams2390b1b2022-11-03 13:47:49 -05002479- The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002480 for images built using ``.rpm`` packages.
2481
Patrick Williams2390b1b2022-11-03 13:47:49 -05002482- The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002483 for images built using ``.ipk`` packages.
2484
Patrick Williams2390b1b2022-11-03 13:47:49 -05002485- The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002486 on the build host directly into the root filesystem.
2487
2488The root filesystem is created from packages using one of the
Andrew Geissler517393d2023-01-13 08:55:19 -06002489:ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES`
2490variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002491
2492For information on how root filesystem images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002493":ref:`overview-manual/concepts:image generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002494section in the Yocto Project Overview and Concepts Manual.
2495
2496.. _ref-classes-sanity:
2497
Andrew Geissler517393d2023-01-13 08:55:19 -06002498``sanity``
2499==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002500
Andrew Geissler517393d2023-01-13 08:55:19 -06002501The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002502on the host system so that users can be notified of potential problems
2503that might affect their build. The class also performs basic user
2504configuration checks from the ``local.conf`` configuration file to
2505prevent common mistakes that cause build failures. Distribution policy
2506usually determines whether to include this class.
2507
2508.. _ref-classes-scons:
2509
Andrew Geissler517393d2023-01-13 08:55:19 -06002510``scons``
2511=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002512
Andrew Geissler517393d2023-01-13 08:55:19 -06002513The :ref:`ref-classes-scons` class supports recipes that need to build software
2514that uses the SCons build system. You can use the :term:`EXTRA_OESCONS`
2515variable to specify additional configuration options you want to pass SCons
2516command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002517
2518.. _ref-classes-sdl:
2519
Andrew Geissler517393d2023-01-13 08:55:19 -06002520``sdl``
2521=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002522
Andrew Geissler517393d2023-01-13 08:55:19 -06002523The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002524the Simple DirectMedia Layer (SDL) library.
2525
Patrick Williams45852732022-04-02 08:58:32 -05002526.. _ref-classes-python_setuptools_build_meta:
Andrew Geissler9aee5002022-03-30 16:27:02 +00002527
Andrew Geissler517393d2023-01-13 08:55:19 -06002528``python_setuptools_build_meta``
2529================================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002530
Andrew Geissler517393d2023-01-13 08:55:19 -06002531The :ref:`ref-classes-python_setuptools_build_meta` class enables building
2532Python modules which declare the
Andrew Geissler9aee5002022-03-30 16:27:02 +00002533`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2534``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
2535section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2536
2537Python modules built with ``setuptools.build_meta`` can be pure Python or
2538include ``C`` or ``Rust`` extensions).
2539
Andrew Geissler517393d2023-01-13 08:55:19 -06002540Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002541
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002542.. _ref-classes-setuptools3:
2543
Andrew Geissler517393d2023-01-13 08:55:19 -06002544``setuptools3``
2545===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002546
Andrew Geissler517393d2023-01-13 08:55:19 -06002547The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions
2548that use build systems based on ``setuptools`` (e.g. only have a ``setup.py``
2549and have not migrated to the official ``pyproject.toml`` format). If your recipe
2550uses these build systems, the recipe needs to inherit the
2551:ref:`ref-classes-setuptools3` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002552
2553 .. note::
2554
Andrew Geissler517393d2023-01-13 08:55:19 -06002555 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls
Andrew Geissler9aee5002022-03-30 16:27:02 +00002556 ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
2557 (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
2558
2559 A consequence of this is that legacy software still using deprecated
2560 ``distutils`` from the Python standard library cannot be packaged as
2561 ``wheels``. A common solution is the replace
2562 ``from distutils.core import setup`` with ``from setuptools import setup``.
2563
2564 .. note::
2565
Andrew Geissler517393d2023-01-13 08:55:19 -06002566 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now
2567 installs the ``wheel`` binary archive. In current versions of
2568 ``setuptools`` the legacy ``setup.py install`` method is deprecated. If
2569 the ``setup.py`` cannot be used with wheels, for example it creates files
2570 outside of the Python module or standard entry points, then
2571 :ref:`ref-classes-setuptools3_legacy` should be used.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002572
2573.. _ref-classes-setuptools3_legacy:
2574
Andrew Geissler517393d2023-01-13 08:55:19 -06002575``setuptools3_legacy``
2576======================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002577
Andrew Geissler517393d2023-01-13 08:55:19 -06002578The :ref:`ref-classes-setuptools3_legacy` class supports
2579Python version 3.x extensions that use build systems based on ``setuptools``
2580(e.g. only have a ``setup.py`` and have not migrated to the official
2581``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`,
2582this uses the traditional ``setup.py`` ``build`` and ``install`` commands and
2583not wheels. This use of ``setuptools`` like this is
Patrick Williams2390b1b2022-11-03 13:47:49 -05002584`deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__
Andrew Geissler9aee5002022-03-30 16:27:02 +00002585but still relatively common.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002586
Andrew Geissler595f6302022-01-24 19:11:47 +00002587.. _ref-classes-setuptools3-base:
2588
Andrew Geissler517393d2023-01-13 08:55:19 -06002589``setuptools3-base``
2590====================
Andrew Geissler595f6302022-01-24 19:11:47 +00002591
Andrew Geissler517393d2023-01-13 08:55:19 -06002592The :ref:`ref-classes-setuptools3-base` class provides a reusable base for
2593other classes that support building Python version 3.x extensions. If you need
2594functionality that is not provided by the :ref:`ref-classes-setuptools3` class,
2595you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks
2596in the :ref:`ref-classes-setuptools3` class and inherit this class instead.
Andrew Geissler595f6302022-01-24 19:11:47 +00002597
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002598.. _ref-classes-sign_rpm:
2599
Andrew Geissler517393d2023-01-13 08:55:19 -06002600``sign_rpm``
2601============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002602
Andrew Geissler517393d2023-01-13 08:55:19 -06002603The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002604
2605.. _ref-classes-siteconfig:
2606
Andrew Geissler517393d2023-01-13 08:55:19 -06002607``siteconfig``
2608==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002609
Andrew Geissler517393d2023-01-13 08:55:19 -06002610The :ref:`ref-classes-siteconfig` class provides functionality for handling site
2611configuration. The class is used by the :ref:`ref-classes-autotools` class to
2612accelerate the :ref:`ref-tasks-configure` task.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002613
2614.. _ref-classes-siteinfo:
2615
Andrew Geissler517393d2023-01-13 08:55:19 -06002616``siteinfo``
2617============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002618
Andrew Geissler517393d2023-01-13 08:55:19 -06002619The :ref:`ref-classes-siteinfo` class provides information about the targets
2620that might be needed by other classes or recipes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002621
2622As an example, consider Autotools, which can require tests that must
2623execute on the target hardware. Since this is not possible in general
2624when cross compiling, site information is used to provide cached test
2625results so these tests can be skipped over but still make the correct
2626values available. The ``meta/site directory`` contains test results
2627sorted into different categories such as architecture, endianness, and
2628the ``libc`` used. Site information provides a list of files containing
Andrew Geissler09036742021-06-25 14:25:14 -05002629data relevant to the current build in the :term:`CONFIG_SITE` variable that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002630Autotools automatically picks up.
2631
Andrew Geissler09036742021-06-25 14:25:14 -05002632The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
2633:term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002634
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002635.. _ref-classes-sstate:
2636
Andrew Geissler517393d2023-01-13 08:55:19 -06002637``sstate``
2638==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002639
Andrew Geissler517393d2023-01-13 08:55:19 -06002640The :ref:`ref-classes-sstate` class provides support for Shared State (sstate).
2641By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's
2642default value.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002643
2644For more information on sstate, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002645":ref:`overview-manual/concepts:shared state cache`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002646section in the Yocto Project Overview and Concepts Manual.
2647
2648.. _ref-classes-staging:
2649
Andrew Geissler517393d2023-01-13 08:55:19 -06002650``staging``
2651===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002652
Andrew Geissler517393d2023-01-13 08:55:19 -06002653The :ref:`ref-classes-staging` class installs files into individual recipe work
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002654directories for sysroots. The class contains the following key tasks:
2655
2656- The :ref:`ref-tasks-populate_sysroot` task,
2657 which is responsible for handing the files that end up in the recipe
2658 sysroots.
2659
2660- The
2661 :ref:`ref-tasks-prepare_recipe_sysroot`
2662 task (a "partner" task to the ``populate_sysroot`` task), which
2663 installs the files into the individual recipe work directories (i.e.
2664 :term:`WORKDIR`).
2665
Andrew Geissler517393d2023-01-13 08:55:19 -06002666The code in the :ref:`ref-classes-staging` class is complex and basically works
2667in two stages:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002668
2669- *Stage One:* The first stage addresses recipes that have files they
2670 want to share with other recipes that have dependencies on the
2671 originating recipe. Normally these dependencies are installed through
2672 the :ref:`ref-tasks-install` task into
Patrick Williams2194f502022-10-16 14:26:09 -05002673 ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002674 copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
2675 subset of files is controlled by the
2676 :term:`SYSROOT_DIRS`,
2677 :term:`SYSROOT_DIRS_NATIVE`, and
Andrew Geissler9aee5002022-03-30 16:27:02 +00002678 :term:`SYSROOT_DIRS_IGNORE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002679 variables.
2680
2681 .. note::
2682
2683 Additionally, a recipe can customize the files further by
Andrew Geissler09036742021-06-25 14:25:14 -05002684 declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002685 variable.
2686
2687 A shared state (sstate) object is built from these files and the
2688 files are placed into a subdirectory of
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002689 :ref:`structure-build-tmp-sysroots-components`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002690 The files are scanned for hardcoded paths to the original
2691 installation location. If the location is found in text files, the
2692 hardcoded locations are replaced by tokens and a list of the files
2693 needing such replacements is created. These adjustments are referred
2694 to as "FIXMEs". The list of files that are scanned for paths is
2695 controlled by the :term:`SSTATE_SCAN_FILES`
2696 variable.
2697
2698- *Stage Two:* The second stage addresses recipes that want to use
2699 something from another recipe and declare a dependency on that recipe
2700 through the :term:`DEPENDS` variable. The recipe will
2701 have a
2702 :ref:`ref-tasks-prepare_recipe_sysroot`
2703 task and when this task executes, it creates the ``recipe-sysroot``
2704 and ``recipe-sysroot-native`` in the recipe work directory (i.e.
2705 :term:`WORKDIR`). The OpenEmbedded build system
2706 creates hard links to copies of the relevant files from
2707 ``sysroots-components`` into the recipe work directory.
2708
2709 .. note::
2710
2711 If hard links are not possible, the build system uses actual
2712 copies.
2713
2714 The build system then addresses any "FIXMEs" to paths as defined from
2715 the list created in the first stage.
2716
2717 Finally, any files in ``${bindir}`` within the sysroot that have the
2718 prefix "``postinst-``" are executed.
2719
2720 .. note::
2721
2722 Although such sysroot post installation scripts are not
2723 recommended for general use, the files do allow some issues such
2724 as user creation and module indexes to be addressed.
2725
Andrew Geissler09036742021-06-25 14:25:14 -05002726 Because recipes can have other dependencies outside of :term:`DEPENDS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002727 (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
2728 the sysroot creation function ``extend_recipe_sysroot`` is also added
2729 as a pre-function for those tasks whose dependencies are not through
Andrew Geissler09036742021-06-25 14:25:14 -05002730 :term:`DEPENDS` but operate similarly.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002731
2732 When installing dependencies into the sysroot, the code traverses the
2733 dependency graph and processes dependencies in exactly the same way
2734 as the dependencies would or would not be when installed from sstate.
2735 This processing means, for example, a native tool would have its
2736 native dependencies added but a target library would not have its
2737 dependencies traversed or installed. The same sstate dependency code
2738 is used so that builds should be identical regardless of whether
2739 sstate was used or not. For a closer look, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002740 ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002741
2742 The build system is careful to maintain manifests of the files it
2743 installs so that any given dependency can be installed as needed. The
2744 sstate hash of the installed item is also stored so that if it
2745 changes, the build system can reinstall it.
2746
2747.. _ref-classes-syslinux:
2748
Andrew Geissler517393d2023-01-13 08:55:19 -06002749``syslinux``
2750============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002751
Andrew Geissler517393d2023-01-13 08:55:19 -06002752The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for
2753building bootable images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002754
2755The class supports the following variables:
2756
2757- :term:`INITRD`: Indicates list of filesystem images to
2758 concatenate and use as an initial RAM disk (initrd). This variable is
2759 optional.
2760
2761- :term:`ROOTFS`: Indicates a filesystem image to include
2762 as the root filesystem. This variable is optional.
2763
2764- :term:`AUTO_SYSLINUXMENU`: Enables creating
2765 an automatic menu when set to "1".
2766
2767- :term:`LABELS`: Lists targets for automatic
2768 configuration.
2769
2770- :term:`APPEND`: Lists append string overrides for each
2771 label.
2772
2773- :term:`SYSLINUX_OPTS`: Lists additional options
2774 to add to the syslinux file. Semicolon characters separate multiple
2775 options.
2776
2777- :term:`SYSLINUX_SPLASH`: Lists a background
2778 for the VGA boot menu when you are using the boot menu.
2779
2780- :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
2781 to "console=ttyX" to change kernel boot default console.
2782
2783- :term:`SYSLINUX_SERIAL`: Sets an alternate
2784 serial port. Or, turns off serial when the variable is set with an
2785 empty string.
2786
2787- :term:`SYSLINUX_SERIAL_TTY`: Sets an
2788 alternate "console=tty..." kernel boot argument.
2789
2790.. _ref-classes-systemd:
2791
Andrew Geissler517393d2023-01-13 08:55:19 -06002792``systemd``
2793===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002794
Andrew Geissler517393d2023-01-13 08:55:19 -06002795The :ref:`ref-classes-systemd` class provides support for recipes that install
2796systemd unit files.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002797
2798The functionality for this class is disabled unless you have "systemd"
2799in :term:`DISTRO_FEATURES`.
2800
2801Under this class, the recipe or Makefile (i.e. whatever the recipe is
2802calling during the :ref:`ref-tasks-install` task)
2803installs unit files into
2804``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
2805files being installed go into packages other than the main package, you
2806need to set :term:`SYSTEMD_PACKAGES` in your
2807recipe to identify the packages in which the files will be installed.
2808
2809You should set :term:`SYSTEMD_SERVICE` to the
2810name of the service file. You should also use a package name override to
2811indicate the package to which the value applies. If the value applies to
2812the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
Andrew Geisslerc926e172021-05-07 16:11:35 -05002813is an example from the connman recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002814
Patrick Williams0ca19cc2021-08-16 14:03:13 -05002815 SYSTEMD_SERVICE:${PN} = "connman.service"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002816
2817Services are set up to start on boot automatically
2818unless you have set
2819:term:`SYSTEMD_AUTO_ENABLE` to "disable".
2820
Andrew Geissler517393d2023-01-13 08:55:19 -06002821For more information on :ref:`ref-classes-systemd`, see the
2822":ref:`dev-manual/init-manager:selecting an initialization manager`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002823section in the Yocto Project Development Tasks Manual.
2824
2825.. _ref-classes-systemd-boot:
2826
Andrew Geissler517393d2023-01-13 08:55:19 -06002827``systemd-boot``
2828================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002829
Andrew Geissler517393d2023-01-13 08:55:19 -06002830The :ref:`ref-classes-systemd-boot` class provides functions specific to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002831systemd-boot bootloader for building bootable images. This is an
2832internal class and is not intended to be used directly.
2833
2834.. note::
2835
Andrew Geissler517393d2023-01-13 08:55:19 -06002836 The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002837 used in previous Yocto Project releases with the ``systemd`` project.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002838
Andrew Geissler517393d2023-01-13 08:55:19 -06002839Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to
2840use this class. Doing so creates a standalone EFI bootloader that is not
2841dependent on systemd.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002842
2843For information on more variables used and supported in this class, see
2844the :term:`SYSTEMD_BOOT_CFG`,
2845:term:`SYSTEMD_BOOT_ENTRIES`, and
2846:term:`SYSTEMD_BOOT_TIMEOUT` variables.
2847
2848You can also see the `Systemd-boot
Andrew Geisslerd1e89492021-02-12 15:35:20 -06002849documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002850for more information.
2851
2852.. _ref-classes-terminal:
2853
Andrew Geissler517393d2023-01-13 08:55:19 -06002854``terminal``
2855============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002856
Andrew Geissler517393d2023-01-13 08:55:19 -06002857The :ref:`ref-classes-terminal` class provides support for starting a terminal
2858session. The :term:`OE_TERMINAL` variable controls which terminal emulator is
2859used for the session.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002860
Andrew Geissler517393d2023-01-13 08:55:19 -06002861Other classes use the :ref:`ref-classes-terminal` class anywhere a separate
2862terminal session needs to be started. For example, the :ref:`ref-classes-patch`
2863class assuming :term:`PATCHRESOLVE` is set to "user", the
2864:ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all
2865use the :ref:`ref-classes-terminal` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002866
Patrick Williams975a06f2022-10-21 14:42:47 -05002867.. _ref-classes-testimage:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002868
Andrew Geissler517393d2023-01-13 08:55:19 -06002869``testimage``
2870=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002871
Andrew Geissler517393d2023-01-13 08:55:19 -06002872The :ref:`ref-classes-testimage` class supports running automated tests against
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002873images using QEMU and on actual hardware. The classes handle loading the
2874tests and starting the image. To use the classes, you need to perform
2875steps to set up the environment.
2876
Patrick Williams975a06f2022-10-21 14:42:47 -05002877To enable this class, add the following to your configuration::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002878
Patrick Williams975a06f2022-10-21 14:42:47 -05002879 IMAGE_CLASSES += "testimage"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002880
2881The tests are commands that run on the target system over ``ssh``. Each
2882test is written in Python and makes use of the ``unittest`` module.
2883
Andrew Geissler517393d2023-01-13 08:55:19 -06002884The :ref:`ref-classes-testimage` class runs tests on an image when called using the
Andrew Geisslerc926e172021-05-07 16:11:35 -05002885following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002886
2887 $ bitbake -c testimage image
2888
Patrick Williams975a06f2022-10-21 14:42:47 -05002889Alternatively, if you wish to have tests automatically run for each image
2890after it is built, you can set :term:`TESTIMAGE_AUTO`::
2891
2892 TESTIMAGE_AUTO = "1"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002893
2894For information on how to enable, run, and create new tests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002895":ref:`dev-manual/runtime-testing:performing automated runtime testing`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002896section in the Yocto Project Development Tasks Manual.
2897
2898.. _ref-classes-testsdk:
2899
Andrew Geissler517393d2023-01-13 08:55:19 -06002900``testsdk``
2901===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002902
2903This class supports running automated tests against software development
Andrew Geissler517393d2023-01-13 08:55:19 -06002904kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called
Andrew Geisslerc926e172021-05-07 16:11:35 -05002905using the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002906
2907 $ bitbake -c testsdk image
2908
2909.. note::
2910
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002911 Best practices include using :term:`IMAGE_CLASSES` rather than
Andrew Geissler517393d2023-01-13 08:55:19 -06002912 :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002913 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002914
2915.. _ref-classes-texinfo:
2916
Andrew Geissler517393d2023-01-13 08:55:19 -06002917``texinfo``
2918===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002919
2920This class should be inherited by recipes whose upstream packages invoke
2921the ``texinfo`` utilities at build-time. Native and cross recipes are
2922made to use the dummy scripts provided by ``texinfo-dummy-native``, for
2923improved performance. Target architecture recipes use the genuine
2924Texinfo utilities. By default, they use the Texinfo utilities on the
2925host system.
2926
2927.. note::
2928
2929 If you want to use the Texinfo recipe shipped with the build system,
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002930 you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
2931 from :term:`SANITY_REQUIRED_UTILITIES`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002932
2933.. _ref-classes-toaster:
2934
Andrew Geissler517393d2023-01-13 08:55:19 -06002935``toaster``
2936===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002937
Andrew Geissler517393d2023-01-13 08:55:19 -06002938The :ref:`ref-classes-toaster` class collects information about packages and images and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002939sends them as events that the BitBake user interface can receive. The
2940class is enabled when the Toaster user interface is running.
2941
2942This class is not intended to be used directly.
2943
2944.. _ref-classes-toolchain-scripts:
2945
Andrew Geissler517393d2023-01-13 08:55:19 -06002946``toolchain-scripts``
2947=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002948
Andrew Geissler517393d2023-01-13 08:55:19 -06002949The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002950the environment for installed SDKs.
2951
2952.. _ref-classes-typecheck:
2953
Andrew Geissler517393d2023-01-13 08:55:19 -06002954``typecheck``
2955=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002956
Andrew Geissler517393d2023-01-13 08:55:19 -06002957The :ref:`ref-classes-typecheck` class provides support for validating the values of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002958variables set at the configuration level against their defined types.
2959The OpenEmbedded build system allows you to define the type of a
Andrew Geisslerc926e172021-05-07 16:11:35 -05002960variable using the "type" varflag. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002961
2962 IMAGE_FEATURES[type] = "list"
2963
2964.. _ref-classes-uboot-config:
2965
Andrew Geissler517393d2023-01-13 08:55:19 -06002966``uboot-config``
2967================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002968
Andrew Geissler517393d2023-01-13 08:55:19 -06002969The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for
Andrew Geisslerc926e172021-05-07 16:11:35 -05002970a machine. Specify the machine in your recipe as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002971
2972 UBOOT_CONFIG ??= <default>
2973 UBOOT_CONFIG[foo] = "config,images"
2974
Andrew Geisslerc926e172021-05-07 16:11:35 -05002975You can also specify the machine using this method::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002976
2977 UBOOT_MACHINE = "config"
2978
2979See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
2980information.
2981
2982.. _ref-classes-uninative:
2983
Andrew Geissler517393d2023-01-13 08:55:19 -06002984``uninative``
2985=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002986
2987Attempts to isolate the build system from the host distribution's C
2988library in order to make re-use of native shared state artifacts across
2989different host distributions practical. With this class enabled, a
2990tarball containing a pre-built C library is downloaded at the start of
2991the build. In the Poky reference distribution this is enabled by default
2992through ``meta/conf/distro/include/yocto-uninative.inc``. Other
2993distributions that do not derive from poky can also
2994"``require conf/distro/include/yocto-uninative.inc``" to use this.
2995Alternatively if you prefer, you can build the uninative-tarball recipe
2996yourself, publish the resulting tarball (e.g. via HTTP) and set
2997``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
2998example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
2999
Andrew Geissler517393d2023-01-13 08:55:19 -06003000The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003001SDK. When building the extensible SDK, ``uninative-tarball`` is built
3002and the resulting tarball is included within the SDK.
3003
3004.. _ref-classes-update-alternatives:
3005
Andrew Geissler517393d2023-01-13 08:55:19 -06003006``update-alternatives``
3007=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003008
Andrew Geissler517393d2023-01-13 08:55:19 -06003009The :ref:`ref-classes-update-alternatives` class helps the alternatives system when
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003010multiple sources provide the same command. This situation occurs when
3011several programs that have the same or similar function are installed
3012with the same name. For example, the ``ar`` command is available from
3013the ``busybox``, ``binutils`` and ``elfutils`` packages. The
Andrew Geissler517393d2023-01-13 08:55:19 -06003014:ref:`ref-classes-update-alternatives` class handles renaming the binaries so that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003015multiple packages can be installed without conflicts. The ``ar`` command
3016still works regardless of which packages are installed or subsequently
3017removed. The class renames the conflicting binary in each package and
3018symlinks the highest priority binary during installation or removal of
3019packages.
3020
3021To use this class, you need to define a number of variables:
3022
3023- :term:`ALTERNATIVE`
3024
3025- :term:`ALTERNATIVE_LINK_NAME`
3026
3027- :term:`ALTERNATIVE_TARGET`
3028
3029- :term:`ALTERNATIVE_PRIORITY`
3030
3031These variables list alternative commands needed by a package, provide
3032pathnames for links, default links for targets, and so forth. For
3033details on how to use this class, see the comments in the
Patrick Williams975a06f2022-10-21 14:42:47 -05003034:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003035file.
3036
3037.. note::
3038
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003039 You can use the ``update-alternatives`` command directly in your recipes.
3040 However, this class simplifies things in most cases.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003041
3042.. _ref-classes-update-rc.d:
3043
Andrew Geissler517393d2023-01-13 08:55:19 -06003044``update-rc.d``
3045===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003046
Andrew Geissler517393d2023-01-13 08:55:19 -06003047The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003048initialization script on behalf of the package. The OpenEmbedded build
3049system takes care of details such as making sure the script is stopped
3050before a package is removed and started when the package is installed.
3051
Andrew Geissler09036742021-06-25 14:25:14 -05003052Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
3053:term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003054for details.
3055
3056.. _ref-classes-useradd:
3057
Andrew Geissler517393d2023-01-13 08:55:19 -06003058``useradd*``
3059============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003060
Patrick Williams2390b1b2022-11-03 13:47:49 -05003061The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003062usage by the package on the target. For example, if you have packages
3063that contain system services that should be run under their own user or
3064group, you can use these classes to enable creation of the user or
Andrew Geissler595f6302022-01-24 19:11:47 +00003065group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
3066</openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003067recipe in the :term:`Source Directory` provides a simple
3068example that shows how to add three users and groups to two packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003069
Patrick Williams2390b1b2022-11-03 13:47:49 -05003070The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003071groups settings.
3072
Patrick Williams2390b1b2022-11-03 13:47:49 -05003073The :ref:`useradd* <ref-classes-useradd>` classes support the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003074:term:`USERADD_PACKAGES`,
3075:term:`USERADD_PARAM`,
3076:term:`GROUPADD_PARAM`, and
3077:term:`GROUPMEMS_PARAM` variables.
3078
Patrick Williams2390b1b2022-11-03 13:47:49 -05003079The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003080that have static user identification (``uid``) and group identification
3081(``gid``) values.
3082
3083The default behavior of the OpenEmbedded build system for assigning
3084``uid`` and ``gid`` values when packages add users and groups during
3085package install time is to add them dynamically. This works fine for
3086programs that do not care what the values of the resulting users and
3087groups become. In these cases, the order of the installation determines
3088the final ``uid`` and ``gid`` values. However, if non-deterministic
3089``uid`` and ``gid`` values are a problem, you can override the default,
3090dynamic application of these values by setting static values. When you
3091set static values, the OpenEmbedded build system looks in
3092:term:`BBPATH` for ``files/passwd`` and ``files/group``
3093files for the values.
3094
Andrew Geissler517393d2023-01-13 08:55:19 -06003095To use static ``uid`` and ``gid`` values, you need to set some variables. See
3096the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`,
3097:term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables.
3098You can also see the :ref:`ref-classes-useradd` class for additional
3099information.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003100
3101.. note::
3102
Patrick Williams2390b1b2022-11-03 13:47:49 -05003103 You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable
Andrew Geissler09036742021-06-25 14:25:14 -05003104 or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003105 enable or disable the class in a configured system, :term:`TMPDIR` might
Andrew Geissler09036742021-06-25 14:25:14 -05003106 contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003107 directory will correct this condition.
3108
3109.. _ref-classes-utility-tasks:
3110
Andrew Geissler517393d2023-01-13 08:55:19 -06003111``utility-tasks``
3112=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003113
Andrew Geissler517393d2023-01-13 08:55:19 -06003114The :ref:`ref-classes-utility-tasks` class provides support for various
3115"utility" type tasks that are applicable to all recipes, such as
3116:ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003117
3118This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003119:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003120
3121.. _ref-classes-utils:
3122
Andrew Geissler517393d2023-01-13 08:55:19 -06003123``utils``
3124=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003125
Andrew Geissler517393d2023-01-13 08:55:19 -06003126The :ref:`ref-classes-utils` class provides some useful Python functions that are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003127typically used in inline Python expressions (e.g. ``${@...}``). One
3128example use is for ``bb.utils.contains()``.
3129
3130This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003131:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003132
3133.. _ref-classes-vala:
3134
Andrew Geissler517393d2023-01-13 08:55:19 -06003135``vala``
3136========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003137
Andrew Geissler517393d2023-01-13 08:55:19 -06003138The :ref:`ref-classes-vala` class supports recipes that need to build software written
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003139using the Vala programming language.
3140
3141.. _ref-classes-waf:
3142
Andrew Geissler517393d2023-01-13 08:55:19 -06003143``waf``
3144=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003145
Andrew Geissler517393d2023-01-13 08:55:19 -06003146The :ref:`ref-classes-waf` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003147the Waf build system. You can use the
3148:term:`EXTRA_OECONF` or
3149:term:`PACKAGECONFIG_CONFARGS` variables
3150to specify additional configuration options to be passed on the Waf
3151command line.