blob: a7819d5b6053a793c8af9cace7d24c3b662dd8ab [file] [log] [blame]
Andrew Geisslerf0343792020-11-18 10:42:21 -06001.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002
3*******
4Classes
5*******
6
7Class files are used to abstract common functionality and share it
8amongst multiple recipe (``.bb``) files. To use a class file, you simply
9make sure the recipe inherits the class. In most cases, when a recipe
10inherits a class it is enough to enable its features. There are cases,
11however, where in the recipe you might need to set variables or override
12some default behavior.
13
14Any :term:`Metadata` usually found in a recipe can also be
15placed in a class file. Class files are identified by the extension
Patrick Williams975a06f2022-10-21 14:42:47 -050016``.bbclass`` and are usually placed in one of a set of subdirectories
17beneath the ``meta*/`` directory found in the :term:`Source Directory`:
18
19 - ``classes-recipe/`` - classes intended to be inherited by recipes
20 individually
21 - ``classes-global/`` - classes intended to be inherited globally
22 - ``classes/`` - classes whose usage context is not clearly defined
23
Andrew Geisslerc9f78652020-09-18 14:11:35 -050024Class files can also be pointed to by
25:term:`BUILDDIR` (e.g. ``build/``) in the same way as
26``.conf`` files in the ``conf`` directory. Class files are searched for
27in :term:`BBPATH` using the same method by which ``.conf``
28files are searched.
29
30This chapter discusses only the most useful and important classes. Other
Patrick Williams975a06f2022-10-21 14:42:47 -050031classes do exist within the ``meta/classes*`` directories in the Source
Andrew Geisslerc9f78652020-09-18 14:11:35 -050032Directory. You can reference the ``.bbclass`` files directly for more
33information.
34
35.. _ref-classes-allarch:
36
Andrew Geissler517393d2023-01-13 08:55:19 -060037``allarch``
38===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -050039
Andrew Geissler517393d2023-01-13 08:55:19 -060040The :ref:`ref-classes-allarch` class is inherited by recipes that do not produce
Andrew Geisslerc9f78652020-09-18 14:11:35 -050041architecture-specific output. The class disables functionality that is
42normally needed for recipes that produce executable binaries (such as
43building the cross-compiler and a C library as pre-requisites, and
44splitting out of debug symbols during packaging).
45
46.. note::
47
48 Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that
49 produce packages that depend on tunings through use of the
50 :term:`RDEPENDS` and
51 :term:`TUNE_PKGARCH` variables, should never be
Andrew Geissler517393d2023-01-13 08:55:19 -060052 configured for all architectures using :ref:`ref-classes-allarch`. This is the case
Andrew Geisslerc9f78652020-09-18 14:11:35 -050053 even if the recipes do not produce architecture-specific output.
54
55 Configuring such recipes for all architectures causes the
Patrick Williams2194f502022-10-16 14:26:09 -050056 :ref:`do_package_write_* <ref-tasks-package_write_deb>` tasks to
Andrew Geisslerc9f78652020-09-18 14:11:35 -050057 have different signatures for the machines with different tunings.
58 Additionally, unnecessary rebuilds occur every time an image for a
Andrew Geissler09036742021-06-25 14:25:14 -050059 different :term:`MACHINE` is built even when the recipe never changes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050060
Andrew Geissler517393d2023-01-13 08:55:19 -060061By default, all recipes inherit the :ref:`ref-classes-base` and
62:ref:`ref-classes-package` classes, which enable
Andrew Geisslerc9f78652020-09-18 14:11:35 -050063functionality needed for recipes that produce executable output. If your
64recipe, for example, only produces packages that contain configuration
65files, media files, or scripts (e.g. Python and Perl), then it should
Andrew Geissler517393d2023-01-13 08:55:19 -060066inherit the :ref:`ref-classes-allarch` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050067
68.. _ref-classes-archiver:
69
Andrew Geissler517393d2023-01-13 08:55:19 -060070``archiver``
71============
Andrew Geisslerc9f78652020-09-18 14:11:35 -050072
Andrew Geissler517393d2023-01-13 08:55:19 -060073The :ref:`ref-classes-archiver` class supports releasing source code and other
Andrew Geisslerc9f78652020-09-18 14:11:35 -050074materials with the binaries.
75
Andrew Geissler517393d2023-01-13 08:55:19 -060076For more details on the source :ref:`ref-classes-archiver`, see the
77":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -050078section in the Yocto Project Development Tasks Manual. You can also see
79the :term:`ARCHIVER_MODE` variable for information
80about the variable flags (varflags) that help control archive creation.
81
82.. _ref-classes-autotools:
83
Andrew Geissler517393d2023-01-13 08:55:19 -060084``autotools*``
85==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -050086
Patrick Williams2390b1b2022-11-03 13:47:49 -050087The :ref:`autotools* <ref-classes-autotools>` classes support packages built with the
Patrick Williams7784c422022-11-17 07:29:11 -060088:wikipedia:`GNU Autotools <GNU_Autotools>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050089
90The ``autoconf``, ``automake``, and ``libtool`` packages bring
91standardization. This class defines a set of tasks (e.g. ``configure``,
92``compile`` and so forth) that work for all Autotooled packages. It
93should usually be enough to define a few standard variables and then
94simply ``inherit autotools``. These classes can also work with software
95that emulates Autotools. For more information, see the
Andrew Geissler6aa7eec2023-03-03 12:41:14 -060096":ref:`dev-manual/new-recipe:building an autotooled package`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -050097in the Yocto Project Development Tasks Manual.
98
Patrick Williams2390b1b2022-11-03 13:47:49 -050099By default, the :ref:`autotools* <ref-classes-autotools>` classes use out-of-tree builds (i.e.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500100``autotools.bbclass`` building with ``B != S``).
101
102If the software being built by a recipe does not support using
103out-of-tree builds, you should have the recipe inherit the
Patrick Williams2390b1b2022-11-03 13:47:49 -0500104:ref:`autotools-brokensep <ref-classes-autotools>` class. The :ref:`autotools-brokensep <ref-classes-autotools>` class behaves
Andrew Geissler517393d2023-01-13 08:55:19 -0600105the same as the :ref:`ref-classes-autotools` class but builds with :term:`B`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500106== :term:`S`. This method is useful when out-of-tree build
107support is either not present or is broken.
108
109.. note::
110
111 It is recommended that out-of-tree support be fixed and used if at
112 all possible.
113
114It's useful to have some idea of how the tasks defined by the
Patrick Williams2390b1b2022-11-03 13:47:49 -0500115:ref:`autotools* <ref-classes-autotools>` classes work and what they do behind the scenes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500116
Andrew Geissler615f2f12022-07-15 14:00:58 -0500117- :ref:`ref-tasks-configure` --- regenerates the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500118 configure script (using ``autoreconf``) and then launches it with a
119 standard set of arguments used during cross-compilation. You can pass
Andrew Geissler09036742021-06-25 14:25:14 -0500120 additional parameters to ``configure`` through the :term:`EXTRA_OECONF`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500121 or :term:`PACKAGECONFIG_CONFARGS`
122 variables.
123
Andrew Geissler615f2f12022-07-15 14:00:58 -0500124- :ref:`ref-tasks-compile` --- runs ``make`` with
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500125 arguments that specify the compiler and linker. You can pass
Andrew Geissler5f350902021-07-23 13:09:54 -0400126 additional arguments through the :term:`EXTRA_OEMAKE` variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500127
Andrew Geissler615f2f12022-07-15 14:00:58 -0500128- :ref:`ref-tasks-install` --- runs ``make install`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500129 passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``.
130
131.. _ref-classes-base:
132
Andrew Geissler517393d2023-01-13 08:55:19 -0600133``base``
134========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500135
Andrew Geissler517393d2023-01-13 08:55:19 -0600136The :ref:`ref-classes-base` class is special in that every ``.bb`` file implicitly
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500137inherits the class. This class contains definitions for standard basic
138tasks such as fetching, unpacking, configuring (empty by default),
139compiling (runs any ``Makefile`` present), installing (empty by default)
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500140and packaging (empty by default). These tasks are often overridden or
Andrew Geissler517393d2023-01-13 08:55:19 -0600141extended by other classes such as the :ref:`ref-classes-autotools` class or the
142:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500143
144The class also contains some commonly used functions such as
145``oe_runmake``, which runs ``make`` with the arguments specified in
146:term:`EXTRA_OEMAKE` variable as well as the
147arguments passed directly to ``oe_runmake``.
148
149.. _ref-classes-bash-completion:
150
Andrew Geissler517393d2023-01-13 08:55:19 -0600151``bash-completion``
152===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500153
154Sets up packaging and dependencies appropriate for recipes that build
155software that includes bash-completion data.
156
157.. _ref-classes-bin-package:
158
Andrew Geissler517393d2023-01-13 08:55:19 -0600159``bin_package``
160===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500161
Andrew Geissler517393d2023-01-13 08:55:19 -0600162The :ref:`ref-classes-bin-package` class is a helper class for recipes that extract the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500163contents of a binary package (e.g. an RPM) and install those contents
164rather than building the binary from source. The binary package is
165extracted and new packages in the configured output package format are
166created. Extraction and installation of proprietary binaries is a good
167example use for this class.
168
169.. note::
170
171 For RPMs and other packages that do not contain a subdirectory, you
172 should specify an appropriate fetcher parameter to point to the
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500173 subdirectory. For example, if BitBake is using the Git fetcher (``git://``),
174 the "subpath" parameter limits the checkout to a specific subpath
175 of the tree. Here is an example where ``${BP}`` is used so that the files
176 are extracted into the subdirectory expected by the default value of
Andrew Geissler09036742021-06-25 14:25:14 -0500177 :term:`S`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500178
Andrew Geissler9aee5002022-03-30 16:27:02 +0000179 SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=main;subpath=${BP}"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500180
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500181 See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for
182 more information on supported BitBake Fetchers.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500183
184.. _ref-classes-binconfig:
185
Andrew Geissler517393d2023-01-13 08:55:19 -0600186``binconfig``
187=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500188
Andrew Geissler517393d2023-01-13 08:55:19 -0600189The :ref:`ref-classes-binconfig` class helps to correct paths in shell scripts.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500190
191Before ``pkg-config`` had become widespread, libraries shipped shell
192scripts to give information about the libraries and include paths needed
193to build software (usually named ``LIBNAME-config``). This class assists
194any recipe using such scripts.
195
196During staging, the OpenEmbedded build system installs such scripts into
197the ``sysroots/`` directory. Inheriting this class results in all paths
198in these scripts being changed to point into the ``sysroots/`` directory
199so that all builds that use the script use the correct directories for
200the cross compiling layout. See the
201:term:`BINCONFIG_GLOB` variable for more
202information.
203
204.. _ref-classes-binconfig-disabled:
205
Andrew Geissler517393d2023-01-13 08:55:19 -0600206``binconfig-disabled``
207======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500208
Andrew Geissler517393d2023-01-13 08:55:19 -0600209An alternative version of the :ref:`ref-classes-binconfig`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500210class, which disables binary configuration scripts by making them return
211an error in favor of using ``pkg-config`` to query the information. The
Andrew Geissler517393d2023-01-13 08:55:19 -0600212scripts to be disabled should be specified using the :term:`BINCONFIG`
213variable within the recipe inheriting the class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500214
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500215.. _ref-classes-buildhistory:
216
Andrew Geissler517393d2023-01-13 08:55:19 -0600217``buildhistory``
218================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500219
Andrew Geissler517393d2023-01-13 08:55:19 -0600220The :ref:`ref-classes-buildhistory` class records a history of build output metadata,
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500221which can be used to detect possible regressions as well as used for
222analysis of the build output. For more information on using Build
223History, see the
Andrew Geissler517393d2023-01-13 08:55:19 -0600224":ref:`dev-manual/build-quality:maintaining build output quality`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500225section in the Yocto Project Development Tasks Manual.
226
227.. _ref-classes-buildstats:
228
Andrew Geissler517393d2023-01-13 08:55:19 -0600229``buildstats``
230==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500231
Andrew Geissler517393d2023-01-13 08:55:19 -0600232The :ref:`ref-classes-buildstats` class records performance statistics about each task
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500233executed during the build (e.g. elapsed time, CPU usage, and I/O usage).
234
235When you use this class, the output goes into the
236:term:`BUILDSTATS_BASE` directory, which defaults
237to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using
238``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading
239chart of the entire build process and can be useful for highlighting
240bottlenecks.
241
242Collecting build statistics is enabled by default through the
243:term:`USER_CLASSES` variable from your
244``local.conf`` file. Consequently, you do not have to do anything to
245enable the class. However, if you want to disable the class, simply
Andrew Geissler517393d2023-01-13 08:55:19 -0600246remove ":ref:`ref-classes-buildstats`" from the :term:`USER_CLASSES` list.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500247
248.. _ref-classes-buildstats-summary:
249
Andrew Geissler517393d2023-01-13 08:55:19 -0600250``buildstats-summary``
251======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500252
253When inherited globally, prints statistics at the end of the build on
254sstate re-use. In order to function, this class requires the
Andrew Geissler517393d2023-01-13 08:55:19 -0600255:ref:`ref-classes-buildstats` class be enabled.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500256
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600257.. _ref-classes-cargo:
258
259``cargo``
260=========
261
262The :ref:`ref-classes-cargo` class allows to compile Rust language programs
263using `Cargo <https://doc.rust-lang.org/cargo/>`__. Cargo is Rust's package
264manager, allowing to fetch package dependencies and build your program.
265
266Using this class makes it very easy to build Rust programs. All you need
267is to use the :term:`SRC_URI` variable to point to a source repository
268which can be built by Cargo, typically one that was created by the
269``cargo new`` command, containing a ``Cargo.toml`` file and a ``src``
270subdirectory.
271
272You will find a simple example in the
273:oe_git:`rust-hello-world_git.bb </openembedded-core/tree/meta/recipes-extended/rust-example/rust-hello-world_git.bb>`
274recipe. A more complex example, with package dependencies, is the
275:oe_git:`uutils-coreutils </meta-openembedded/tree/meta-oe/recipes-core/uutils-coreutils>`
276recipe, which was generated by the `cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__
277tool.
278
279This class inherits the :ref:`ref-classes-cargo_common` class.
280
281.. _ref-classes-cargo_common:
282
283``cargo_common``
284================
285
286The :ref:`ref-classes-cargo_common` class is an internal class
287that is not intended to be used directly.
288
289An exception is the "rust" recipe, to build the Rust compiler and runtime
290library, which is built by Cargo but cannot use the :ref:`ref-classes-cargo`
291class. This is why this class was introduced.
292
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500293.. _ref-classes-ccache:
294
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600295.. _ref-classes-cargo-update-recipe-crates:
296
297``cargo-update-recipe-crates``
298===============================
299
300The :ref:`ref-classes-cargo-update-recipe-crates` class allows
301recipe developers to update the list of Cargo crates in :term:`SRC_URI`
302by reading the ``Cargo.lock`` file in the source tree.
303
304To do so, create a recipe for your program, for example using
305:doc:`devtool </ref-manual/devtool-reference>`,
306make it inherit the :ref:`ref-classes-cargo` and
307:ref:`ref-classes-cargo-update-recipe-crates` and run::
308
309 bitbake -c update_crates recipe
310
311This creates a ``recipe-crates.inc`` file that you can include in your
312recipe::
313
314 require ${BPN}-crates.inc
315
316That's also something you can achieve by using the
317`cargo-bitbake <https://crates.io/crates/cargo-bitbake>`__ tool.
318
Andrew Geissler517393d2023-01-13 08:55:19 -0600319``ccache``
320==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500321
Andrew Geissler517393d2023-01-13 08:55:19 -0600322The :ref:`ref-classes-ccache` class enables the C/C++ Compiler Cache for the build.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500323This class is used to give a minor performance boost during the build.
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000324
325See https://ccache.samba.org/ for information on the C/C++ Compiler
326Cache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>`
327file for details about how to enable this mechanism in your configuration
328file, how to disable it for specific recipes, and how to share ``ccache``
329files between builds.
330
331However, using the class can lead to unexpected side-effects. Thus, using
332this class is not recommended.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500333
334.. _ref-classes-chrpath:
335
Andrew Geissler517393d2023-01-13 08:55:19 -0600336``chrpath``
337===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500338
Andrew Geissler517393d2023-01-13 08:55:19 -0600339The :ref:`ref-classes-chrpath` class is a wrapper around the "chrpath" utility, which
340is used during the build process for :ref:`ref-classes-nativesdk`, :ref:`ref-classes-cross`, and
341:ref:`ref-classes-cross-canadian` recipes to change ``RPATH`` records within binaries
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500342in order to make them relocatable.
343
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500344.. _ref-classes-cmake:
345
Andrew Geissler517393d2023-01-13 08:55:19 -0600346``cmake``
347=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500348
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600349The :ref:`ref-classes-cmake` class allows recipes to build software using the
350`CMake <https://cmake.org/overview/>`__ build system. You can use the
351:term:`EXTRA_OECMAKE` variable to specify additional configuration options to
352pass to the ``cmake`` command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500353
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600354By default, the :ref:`ref-classes-cmake` class uses
355`Ninja <https://ninja-build.org/>`__ instead of GNU make for building, which
356offers better build performance. If a recipe is broken with Ninja, then the
357recipe can set the :term:`OECMAKE_GENERATOR` variable to ``Unix Makefiles`` to
358use GNU make instead.
359
360If you need to install custom CMake toolchain files supplied by the application
361being built, you should install them (during :ref:`ref-tasks-install`) to the
362preferred CMake Module directory: ``${D}${datadir}/cmake/modules/``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500363
364.. _ref-classes-cml1:
365
Andrew Geissler517393d2023-01-13 08:55:19 -0600366``cml1``
367========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500368
Andrew Geissler517393d2023-01-13 08:55:19 -0600369The :ref:`ref-classes-cml1` class provides basic support for the Linux kernel style
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500370build configuration system.
371
372.. _ref-classes-compress_doc:
373
Andrew Geissler517393d2023-01-13 08:55:19 -0600374``compress_doc``
375================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500376
377Enables compression for man pages and info pages. This class is intended
378to be inherited globally. The default compression mechanism is gz (gzip)
379but you can select an alternative mechanism by setting the
380:term:`DOC_COMPRESS` variable.
381
382.. _ref-classes-copyleft_compliance:
383
Andrew Geissler517393d2023-01-13 08:55:19 -0600384``copyleft_compliance``
385=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500386
Andrew Geissler517393d2023-01-13 08:55:19 -0600387The :ref:`ref-classes-copyleft_compliance` class preserves source code for the purposes
388of license compliance. This class is an alternative to the :ref:`ref-classes-archiver`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500389class and is still used by some users even though it has been deprecated
Andrew Geissler517393d2023-01-13 08:55:19 -0600390in favor of the :ref:`ref-classes-archiver` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500391
392.. _ref-classes-copyleft_filter:
393
Andrew Geissler517393d2023-01-13 08:55:19 -0600394``copyleft_filter``
395===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500396
Andrew Geissler517393d2023-01-13 08:55:19 -0600397A class used by the :ref:`ref-classes-archiver` and
398:ref:`ref-classes-copyleft_compliance` classes
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500399for filtering licenses. The ``copyleft_filter`` class is an internal
400class and is not intended to be used directly.
401
402.. _ref-classes-core-image:
403
Andrew Geissler517393d2023-01-13 08:55:19 -0600404``core-image``
405==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500406
Andrew Geissler517393d2023-01-13 08:55:19 -0600407The :ref:`ref-classes-core-image` class provides common definitions for the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500408``core-image-*`` image recipes, such as support for additional
409:term:`IMAGE_FEATURES`.
410
411.. _ref-classes-cpan:
412
Andrew Geissler517393d2023-01-13 08:55:19 -0600413``cpan*``
414=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500415
Patrick Williams2390b1b2022-11-03 13:47:49 -0500416The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500417
418Recipes for Perl modules are simple. These recipes usually only need to
419point to the source's archive and then inherit the proper class file.
420Building is split into two methods depending on which method the module
421authors used.
422
423- Modules that use old ``Makefile.PL``-based build system require
424 ``cpan.bbclass`` in their recipes.
425
426- Modules that use ``Build.PL``-based build system require using
427 ``cpan_build.bbclass`` in their recipes.
428
Patrick Williams2390b1b2022-11-03 13:47:49 -0500429Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500430support.
431
Patrick Williams975a06f2022-10-21 14:42:47 -0500432.. _ref-classes-create-spdx:
433
Andrew Geissler517393d2023-01-13 08:55:19 -0600434``create-spdx``
435===============
Patrick Williams975a06f2022-10-21 14:42:47 -0500436
Andrew Geissler517393d2023-01-13 08:55:19 -0600437The :ref:`ref-classes-create-spdx` class provides support for
Patrick Williams7784c422022-11-17 07:29:11 -0600438automatically creating :term:`SPDX` :term:`SBOM` documents based upon image
439and SDK contents.
440
441This class is meant to be inherited globally from a configuration file::
442
443 INHERIT += "create-spdx"
444
445The toplevel :term:`SPDX` output file is generated in JSON format as a
446``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the
447:term:`Build Directory`. There are other related files in the same directory,
448as well as in ``tmp/deploy/spdx``.
449
450The exact behaviour of this class, and the amount of output can be controlled
451by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`,
452:term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables.
453
454See the description of these variables and the
Andrew Geissler517393d2023-01-13 08:55:19 -0600455":ref:`dev-manual/sbom:creating a software bill of materials`"
Patrick Williams7784c422022-11-17 07:29:11 -0600456section in the Yocto Project Development Manual for more details.
Patrick Williams975a06f2022-10-21 14:42:47 -0500457
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500458.. _ref-classes-cross:
459
Andrew Geissler517393d2023-01-13 08:55:19 -0600460``cross``
461=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500462
Andrew Geissler517393d2023-01-13 08:55:19 -0600463The :ref:`ref-classes-cross` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500464cross-compilation tools.
465
466.. _ref-classes-cross-canadian:
467
Andrew Geissler517393d2023-01-13 08:55:19 -0600468``cross-canadian``
469==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500470
Andrew Geissler517393d2023-01-13 08:55:19 -0600471The :ref:`ref-classes-cross-canadian` class provides support for the recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500472the Canadian Cross-compilation tools for SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600473":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500474section in the Yocto Project Overview and Concepts Manual for more
475discussion on these cross-compilation tools.
476
477.. _ref-classes-crosssdk:
478
Andrew Geissler517393d2023-01-13 08:55:19 -0600479``crosssdk``
480============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500481
Andrew Geissler517393d2023-01-13 08:55:19 -0600482The :ref:`ref-classes-crosssdk` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500483cross-compilation tools used for building SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600484":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500485section in the Yocto Project Overview and Concepts Manual for more
486discussion on these cross-compilation tools.
487
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500488.. _ref-classes-cve-check:
489
Andrew Geissler517393d2023-01-13 08:55:19 -0600490``cve-check``
491=============
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500492
Andrew Geissler517393d2023-01-13 08:55:19 -0600493The :ref:`ref-classes-cve-check` class looks for known CVEs (Common Vulnerabilities
Patrick Williams2390b1b2022-11-03 13:47:49 -0500494and Exposures) while building with BitBake. This class is meant to be
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500495inherited globally from a configuration file::
496
497 INHERIT += "cve-check"
498
Patrick Williams2390b1b2022-11-03 13:47:49 -0500499To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
500add following line to the build configuration file::
501
502 include cve-extra-exclusions.inc
503
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500504You can also look for vulnerabilities in specific packages by passing
Patrick Williams2390b1b2022-11-03 13:47:49 -0500505``-c cve_check`` to BitBake.
506
507After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
508and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files.
509
510When building, the CVE checker will emit build time warnings for any detected
511issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
512and version being compiled and no patches to address the issue are applied. Other states
513for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
514applied, and ``Ignored`` meaning that the issue can be ignored.
515
516The ``Patched`` state of a CVE issue is detected from patch files with the format
517``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
518CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
519
Patrick Williams2a254922023-08-11 09:48:11 -0500520If the recipe adds ``CVE-ID`` as flag of the :term:`CVE_STATUS` variable with status
521mapped to ``Ignored``, then the CVE state is reported as ``Ignored``::
Patrick Williams2390b1b2022-11-03 13:47:49 -0500522
Patrick Williams2a254922023-08-11 09:48:11 -0500523 CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows"
Patrick Williams2390b1b2022-11-03 13:47:49 -0500524
525If CVE check reports that a recipe contains false positives or false negatives, these may be
526fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables.
527:term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE
528database vendor and product pairs using the syntax::
529
530 CVE_PRODUCT = "flex_project:flex"
531
532where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
533if the default recipe version :term:`PV` does not match the version numbers of the software component
534in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
535CVE database compatible version number, for example::
536
537 CVE_VERSION = "2.39"
538
539Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
540via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
541
542Users should note that security is a process, not a product, and thus also CVE checking, analyzing results,
543patching and updating the software should be done as a regular process. The data and assumptions
544required for CVE checker to reliably detect issues are frequently broken in various ways.
545These can only be detected by reviewing the details of the issues and iterating over the generated reports,
546and following what happens in other Linux distributions and in the greater open source community.
547
548You will find some more details in the
Andrew Geissler517393d2023-01-13 08:55:19 -0600549":ref:`dev-manual/vulnerabilities:checking for vulnerabilities`"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500550section in the Development Tasks Manual.
551
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500552.. _ref-classes-debian:
553
Andrew Geissler517393d2023-01-13 08:55:19 -0600554``debian``
555==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500556
Andrew Geissler517393d2023-01-13 08:55:19 -0600557The :ref:`ref-classes-debian` class renames output packages so that they follow the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500558Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
559``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
560name and version as part of the package name.
561
562If a recipe creates packages for multiple libraries (shared object files
563of ``.so`` type), use the :term:`LEAD_SONAME`
564variable in the recipe to specify the library on which to apply the
565naming scheme.
566
567.. _ref-classes-deploy:
568
Andrew Geissler517393d2023-01-13 08:55:19 -0600569``deploy``
570==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500571
Andrew Geissler517393d2023-01-13 08:55:19 -0600572The :ref:`ref-classes-deploy` class handles deploying files to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500573:term:`DEPLOY_DIR_IMAGE` directory. The main
574function of this class is to allow the deploy step to be accelerated by
575shared state. Recipes that inherit this class should define their own
576:ref:`ref-tasks-deploy` function to copy the files to be
577deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
578add the task at the appropriate place, which is usually after
579:ref:`ref-tasks-compile` or
580:ref:`ref-tasks-install`. The class then takes care of
Andrew Geissler09036742021-06-25 14:25:14 -0500581staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500582
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500583.. _ref-classes-devicetree:
584
585``devicetree``
586==============
587
588The :ref:`ref-classes-devicetree` class allows to build a recipe that compiles
589device tree source files that are not in the kernel tree.
590
591The compilation of out-of-tree device tree sources is the same as the kernel
592in-tree device tree compilation process. This includes the ability to include
593sources from the kernel such as SoC ``dtsi`` files as well as C header files,
594such as ``gpio.h``.
595
596The :ref:`ref-tasks-compile` task will compile two kinds of files:
597
598- Regular device tree sources with a ``.dts`` extension.
599
600- Device tree overlays, detected from the presence of the ``/plugin/;``
601 string in the file contents.
602
Patrick Williams520786c2023-06-25 16:20:36 -0500603This class deploys the generated device tree binaries into
604``${``\ :term:`DEPLOY_DIR_IMAGE`\ ``}/devicetree/``. This is similar to
605what the :ref:`ref-classes-kernel-devicetree` class does, with the added
606``devicetree`` subdirectory to avoid name clashes. Additionally, the device
607trees are populated into the sysroot for access via the sysroot from within
608other recipes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500609
Patrick Williamsb542dec2023-06-09 01:26:37 -0500610By default, all device tree sources located in :term:`DT_FILES_PATH` directory
611are compiled. To select only particular sources, set :term:`DT_FILES` to
612a space-separated list of files (relative to :term:`DT_FILES_PATH`). For
613convenience, both ``.dts`` and ``.dtb`` extensions can be used.
614
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500615An extra padding is appended to non-overlay device trees binaries. This
616can typically be used as extra space for adding extra properties at boot time.
Patrick Williamsb542dec2023-06-09 01:26:37 -0500617The padding size can be modified by setting :term:`DT_PADDING_SIZE`
618to the desired size, in bytes.
Patrick Williams8e7b46e2023-05-01 14:19:06 -0500619
620See :oe_git:`devicetree.bbclass sources
621</openembedded-core/tree/meta/classes-recipe/devicetree.bbclass>`
622for further variables controlling this class.
623
624Here is an excerpt of an example ``recipes-kernel/linux/devicetree-acme.bb``
625recipe inheriting this class::
626
627 inherit devicetree
628 COMPATIBLE_MACHINE = "^mymachine$"
629 SRC_URI:mymachine = "file://mymachine.dts"
630
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500631.. _ref-classes-devshell:
632
Andrew Geissler517393d2023-01-13 08:55:19 -0600633``devshell``
634============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500635
Andrew Geissler517393d2023-01-13 08:55:19 -0600636The :ref:`ref-classes-devshell` class adds the :ref:`ref-tasks-devshell` task. Distribution
637policy dictates whether to include this class. See the ":ref:`dev-manual/development-shell:using a development shell`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500638section in the Yocto Project Development Tasks Manual for more
Andrew Geissler517393d2023-01-13 08:55:19 -0600639information about using :ref:`ref-classes-devshell`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500640
641.. _ref-classes-devupstream:
642
Andrew Geissler517393d2023-01-13 08:55:19 -0600643``devupstream``
644===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500645
Andrew Geissler517393d2023-01-13 08:55:19 -0600646The :ref:`ref-classes-devupstream` class uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500647:term:`BBCLASSEXTEND` to add a variant of the
648recipe that fetches from an alternative URI (e.g. Git) instead of a
Andrew Geisslerc926e172021-05-07 16:11:35 -0500649tarball. Following is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500650
651 BBCLASSEXTEND = "devupstream:target"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000652 SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500653 SRCREV:class-devupstream = "abcd1234"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500654
655Adding the above statements to your recipe creates a variant that has
656:term:`DEFAULT_PREFERENCE` set to "-1".
657Consequently, you need to select the variant of the recipe to use it.
658Any development-specific adjustments can be done by using the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500659``class-devupstream`` override. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500660
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500661 DEPENDS:append:class-devupstream = " gperf-native"
662 do_configure:prepend:class-devupstream() {
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500663 touch ${S}/README
664 }
665
666The class
667currently only supports creating a development variant of the target
Andrew Geissler517393d2023-01-13 08:55:19 -0600668recipe, not :ref:`ref-classes-native` or :ref:`ref-classes-nativesdk` variants.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500669
Andrew Geissler09036742021-06-25 14:25:14 -0500670The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
Andrew Geissler517393d2023-01-13 08:55:19 -0600671support for :ref:`ref-classes-native` and :ref:`ref-classes-nativesdk` variants. Consequently, this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500672functionality can be added in a future release.
673
674Support for other version control systems such as Subversion is limited
675due to BitBake's automatic fetch dependencies (e.g.
676``subversion-native``).
677
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500678.. _ref-classes-externalsrc:
679
Andrew Geissler517393d2023-01-13 08:55:19 -0600680``externalsrc``
681===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500682
Andrew Geissler517393d2023-01-13 08:55:19 -0600683The :ref:`ref-classes-externalsrc` class supports building software from source code
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500684that is external to the OpenEmbedded build system. Building software
685from an external source tree means that the build system's normal fetch,
686unpack, and patch process is not used.
687
688By default, the OpenEmbedded build system uses the :term:`S`
689and :term:`B` variables to locate unpacked recipe source code
690and to build it, respectively. When your recipe inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -0600691:ref:`ref-classes-externalsrc` class, you use the
692:term:`EXTERNALSRC` and :term:`EXTERNALSRC_BUILD` variables to
Andrew Geissler09036742021-06-25 14:25:14 -0500693ultimately define :term:`S` and :term:`B`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500694
695By default, this class expects the source code to support recipe builds
696that use the :term:`B` variable to point to the directory in
697which the OpenEmbedded build system places the generated objects built
Andrew Geissler09036742021-06-25 14:25:14 -0500698from the recipes. By default, the :term:`B` directory is set to the
699following, which is separate from the source directory (:term:`S`)::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500700
Andrew Geissler5199d832021-09-24 16:47:35 -0500701 ${WORKDIR}/${BPN}-{PV}/
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500702
703See these variables for more information:
704:term:`WORKDIR`, :term:`BPN`, and
705:term:`PV`,
706
Andrew Geissler517393d2023-01-13 08:55:19 -0600707For more information on the :ref:`ref-classes-externalsrc` class, see the comments in
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500708``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
Andrew Geissler517393d2023-01-13 08:55:19 -0600709For information on how to use the :ref:`ref-classes-externalsrc` class, see the
710":ref:`dev-manual/building:building software from an external source`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500711section in the Yocto Project Development Tasks Manual.
712
713.. _ref-classes-extrausers:
714
Andrew Geissler517393d2023-01-13 08:55:19 -0600715``extrausers``
716==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500717
Andrew Geissler517393d2023-01-13 08:55:19 -0600718The :ref:`ref-classes-extrausers` class allows additional user and group configuration
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500719to be applied at the image level. Inheriting this class either globally
720or from an image recipe allows additional user and group operations to
721be performed using the
722:term:`EXTRA_USERS_PARAMS` variable.
723
724.. note::
725
Andrew Geissler517393d2023-01-13 08:55:19 -0600726 The user and group operations added using the :ref:`ref-classes-extrausers`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500727 class are not tied to a specific recipe outside of the recipe for the
728 image. Thus, the operations can be performed across the image as a
Andrew Geissler517393d2023-01-13 08:55:19 -0600729 whole. Use the :ref:`ref-classes-useradd` class to add user and group
730 configuration to a specific recipe.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500731
Andrew Geisslerc926e172021-05-07 16:11:35 -0500732Here is an example that uses this class in an image recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500733
734 inherit extrausers
735 EXTRA_USERS_PARAMS = "\
736 useradd -p '' tester; \
737 groupadd developers; \
738 userdel nobody; \
739 groupdel -g video; \
740 groupmod -g 1020 developers; \
741 usermod -s /bin/sh tester; \
742 "
743
744Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
Andrew Geissler9aee5002022-03-30 16:27:02 +0000745passwords. First on host, create the (escaped) password hash::
Andrew Geisslereff27472021-10-29 15:35:00 -0500746
Andrew Geissler9aee5002022-03-30 16:27:02 +0000747 printf "%q" $(mkpasswd -m sha256crypt tester01)
Andrew Geisslereff27472021-10-29 15:35:00 -0500748
Andrew Geissler9aee5002022-03-30 16:27:02 +0000749The resulting hash is set to a variable and used in ``useradd`` command parameters::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500750
751 inherit extrausers
Andrew Geisslereff27472021-10-29 15:35:00 -0500752 PASSWD = "\$X\$ABC123\$A-Long-Hash"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500753 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500754 useradd -p '${PASSWD}' tester-jim; \
755 useradd -p '${PASSWD}' tester-sue; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500756 "
757
Andrew Geisslereff27472021-10-29 15:35:00 -0500758Finally, here is an example that sets the root password::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500759
760 inherit extrausers
761 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500762 usermod -p '${PASSWD}' root; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500763 "
764
Patrick Williams03907ee2022-05-01 06:28:52 -0500765.. note::
766
767 From a security perspective, hardcoding a default password is not
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500768 generally a good idea or even legal in some jurisdictions. It is
769 recommended that you do not do this if you are building a production
Patrick Williams03907ee2022-05-01 06:28:52 -0500770 image.
771
772
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600773.. _ref-classes-features_check:
774
Andrew Geissler517393d2023-01-13 08:55:19 -0600775``features_check``
776==================
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600777
Andrew Geissler517393d2023-01-13 08:55:19 -0600778The :ref:`ref-classes-features_check` class allows individual recipes to check
779for required and conflicting :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES`
780or :term:`COMBINED_FEATURES`.
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600781
782This class provides support for the following variables:
783
784- :term:`REQUIRED_DISTRO_FEATURES`
785- :term:`CONFLICT_DISTRO_FEATURES`
786- :term:`ANY_OF_DISTRO_FEATURES`
787- ``REQUIRED_MACHINE_FEATURES``
788- ``CONFLICT_MACHINE_FEATURES``
789- ``ANY_OF_MACHINE_FEATURES``
790- ``REQUIRED_COMBINED_FEATURES``
791- ``CONFLICT_COMBINED_FEATURES``
792- ``ANY_OF_COMBINED_FEATURES``
793
794If any conditions specified in the recipe using the above
795variables are not met, the recipe will be skipped, and if the
796build system attempts to build the recipe then an error will be
797triggered.
798
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500799.. _ref-classes-fontcache:
800
Andrew Geissler517393d2023-01-13 08:55:19 -0600801``fontcache``
802=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500803
Andrew Geissler517393d2023-01-13 08:55:19 -0600804The :ref:`ref-classes-fontcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500805post-remove (postinst and postrm) scriptlets for font packages. These
806scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
807to the font information cache. Since the cache files are
808architecture-specific, ``fc-cache`` runs using QEMU if the postinst
809scriptlets need to be run on the build host during image creation.
810
811If the fonts being installed are in packages other than the main
812package, set :term:`FONT_PACKAGES` to specify the
813packages containing the fonts.
814
815.. _ref-classes-fs-uuid:
816
Andrew Geissler517393d2023-01-13 08:55:19 -0600817``fs-uuid``
818===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500819
Andrew Geissler517393d2023-01-13 08:55:19 -0600820The :ref:`ref-classes-fs-uuid` class extracts UUID from
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500821``${``\ :term:`ROOTFS`\ ``}``, which must have been built
Andrew Geissler517393d2023-01-13 08:55:19 -0600822by the time that this function gets called. The :ref:`ref-classes-fs-uuid` class only
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500823works on ``ext`` file systems and depends on ``tune2fs``.
824
825.. _ref-classes-gconf:
826
Andrew Geissler517393d2023-01-13 08:55:19 -0600827``gconf``
828=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500829
Andrew Geissler517393d2023-01-13 08:55:19 -0600830The :ref:`ref-classes-gconf` class provides common functionality for recipes that need
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500831to install GConf schemas. The schemas will be put into a separate
832package (``${``\ :term:`PN`\ ``}-gconf``) that is created
833automatically when this class is inherited. This package uses the
834appropriate post-install and post-remove (postinst/postrm) scriptlets to
835register and unregister the schemas in the target image.
836
837.. _ref-classes-gettext:
838
Andrew Geissler517393d2023-01-13 08:55:19 -0600839``gettext``
840===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500841
Andrew Geissler517393d2023-01-13 08:55:19 -0600842The :ref:`ref-classes-gettext` class provides support for building
843software that uses the GNU ``gettext`` internationalization and localization
844system. All recipes building software that use ``gettext`` should inherit this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500845class.
846
Patrick Williams975a06f2022-10-21 14:42:47 -0500847.. _ref-classes-github-releases:
848
Andrew Geissler517393d2023-01-13 08:55:19 -0600849``github-releases``
850===================
Patrick Williams975a06f2022-10-21 14:42:47 -0500851
Andrew Geissler517393d2023-01-13 08:55:19 -0600852For recipes that fetch release tarballs from github, the :ref:`ref-classes-github-releases`
Patrick Williams975a06f2022-10-21 14:42:47 -0500853class sets up a standard way for checking available upstream versions
854(to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)).
855
Andrew Geissler517393d2023-01-13 08:55:19 -0600856To use it, add ":ref:`ref-classes-github-releases`" to the inherit line in the recipe,
Patrick Williams975a06f2022-10-21 14:42:47 -0500857and if the default value of :term:`GITHUB_BASE_URI` is not suitable,
858then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}``
859in the value you set for :term:`SRC_URI` within the recipe.
860
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500861.. _ref-classes-gnomebase:
862
Andrew Geissler517393d2023-01-13 08:55:19 -0600863``gnomebase``
864=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500865
Andrew Geissler517393d2023-01-13 08:55:19 -0600866The :ref:`ref-classes-gnomebase` class is the base class for recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500867software from the GNOME stack. This class sets
868:term:`SRC_URI` to download the source from the GNOME
869mirrors as well as extending :term:`FILES` with the typical
870GNOME installation paths.
871
Andrew Geisslerc5535c92023-01-27 16:10:19 -0600872.. _ref-classes-go:
873
874``go``
875======
876
877The :ref:`ref-classes-go` class supports building Go programs. The behavior of
878this class is controlled by the mandatory :term:`GO_IMPORT` variable, and
879by the optional :term:`GO_INSTALL` and :term:`GO_INSTALL_FILTEROUT` ones.
880
881To build a Go program with the Yocto Project, you can use the
882:yocto_git:`go-helloworld_0.1.bb </poky/tree/meta/recipes-extended/go-examples/go-helloworld_0.1.bb>`
883recipe as an example.
884
885.. _ref-classes-go-mod:
886
887``go-mod``
888==========
889
890The :ref:`ref-classes-go-mod` class allows to use Go modules, and inherits the
891:ref:`ref-classes-go` class.
892
893See the associated :term:`GO_WORKDIR` variable.
894
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500895.. _ref-classes-gobject-introspection:
896
Andrew Geissler517393d2023-01-13 08:55:19 -0600897``gobject-introspection``
898=========================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500899
900Provides support for recipes building software that supports GObject
901introspection. This functionality is only enabled if the
902"gobject-introspection-data" feature is in
903:term:`DISTRO_FEATURES` as well as
904"qemu-usermode" being in
905:term:`MACHINE_FEATURES`.
906
907.. note::
908
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500909 This functionality is :ref:`backfilled <ref-features-backfill>` by default
910 and, if not applicable, should be disabled through
911 :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
Andrew Geissler09036742021-06-25 14:25:14 -0500912 :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500913
914.. _ref-classes-grub-efi:
915
Andrew Geissler517393d2023-01-13 08:55:19 -0600916``grub-efi``
917============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500918
Andrew Geissler517393d2023-01-13 08:55:19 -0600919The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500920building bootable images.
921
922This class supports several variables:
923
924- :term:`INITRD`: Indicates list of filesystem images to
925 concatenate and use as an initial RAM disk (initrd) (optional).
926
927- :term:`ROOTFS`: Indicates a filesystem image to include
928 as the root filesystem (optional).
929
930- :term:`GRUB_GFXSERIAL`: Set this to "1" to have
931 graphics and serial in the boot menu.
932
933- :term:`LABELS`: A list of targets for the automatic
934 configuration.
935
936- :term:`APPEND`: An override list of append strings for
937 each ``LABEL``.
938
939- :term:`GRUB_OPTS`: Additional options to add to the
940 configuration (optional). Options are delimited using semi-colon
941 characters (``;``).
942
943- :term:`GRUB_TIMEOUT`: Timeout before executing
944 the default ``LABEL`` (optional).
945
946.. _ref-classes-gsettings:
947
Andrew Geissler517393d2023-01-13 08:55:19 -0600948``gsettings``
949=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500950
Andrew Geissler517393d2023-01-13 08:55:19 -0600951The :ref:`ref-classes-gsettings` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500952need to install GSettings (glib) schemas. The schemas are assumed to be
953part of the main package. Appropriate post-install and post-remove
954(postinst/postrm) scriptlets are added to register and unregister the
955schemas in the target image.
956
957.. _ref-classes-gtk-doc:
958
Andrew Geissler517393d2023-01-13 08:55:19 -0600959``gtk-doc``
960===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500961
Andrew Geissler517393d2023-01-13 08:55:19 -0600962The :ref:`ref-classes-gtk-doc` class is a helper class to pull in the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500963``gtk-doc`` dependencies and disable ``gtk-doc``.
964
965.. _ref-classes-gtk-icon-cache:
966
Andrew Geissler517393d2023-01-13 08:55:19 -0600967``gtk-icon-cache``
968==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500969
Andrew Geissler517393d2023-01-13 08:55:19 -0600970The :ref:`ref-classes-gtk-icon-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500971post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
972install icons. These scriptlets call ``gtk-update-icon-cache`` to add
973the fonts to GTK+'s icon cache. Since the cache files are
974architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
975the postinst scriptlets need to be run on the build host during image
976creation.
977
978.. _ref-classes-gtk-immodules-cache:
979
Andrew Geissler517393d2023-01-13 08:55:19 -0600980``gtk-immodules-cache``
981=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500982
Andrew Geissler517393d2023-01-13 08:55:19 -0600983The :ref:`ref-classes-gtk-immodules-cache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500984post-remove (postinst/postrm) scriptlets for packages that install GTK+
985input method modules for virtual keyboards. These scriptlets call
986``gtk-update-icon-cache`` to add the input method modules to the cache.
987Since the cache files are architecture-specific,
988``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
989need to be run on the build host during image creation.
990
991If the input method modules being installed are in packages other than
992the main package, set
993:term:`GTKIMMODULES_PACKAGES` to specify
994the packages containing the modules.
995
996.. _ref-classes-gzipnative:
997
Andrew Geissler517393d2023-01-13 08:55:19 -0600998``gzipnative``
999==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001000
Andrew Geissler517393d2023-01-13 08:55:19 -06001001The :ref:`ref-classes-gzipnative` class enables the use of different native versions of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001002``gzip`` and ``pigz`` rather than the versions of these tools from the
1003build host.
1004
1005.. _ref-classes-icecc:
1006
Andrew Geissler517393d2023-01-13 08:55:19 -06001007``icecc``
1008=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001009
Andrew Geissler517393d2023-01-13 08:55:19 -06001010The :ref:`ref-classes-icecc` class supports
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001011`Icecream <https://github.com/icecc/icecream>`__, which facilitates
1012taking compile jobs and distributing them among remote machines.
1013
1014The class stages directories with symlinks from ``gcc`` and ``g++`` to
1015``icecc``, for both native and cross compilers. Depending on each
1016configure or compile, the OpenEmbedded build system adds the directories
1017at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001018``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001019compilers, respectively.
1020
1021For the cross compiler, the class creates a ``tar.gz`` file that
1022contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
1023is the version of the cross-compiler used in the cross-development
1024toolchain, accordingly.
1025
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001026The class handles all three different compile stages (i.e native,
1027cross-kernel and target) and creates the necessary environment
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001028``tar.gz`` file to be used by the remote machines. The class also
1029supports SDK generation.
1030
1031If :term:`ICECC_PATH` is not set in your
1032``local.conf`` file, then the class tries to locate the ``icecc`` binary
1033using ``which``. If :term:`ICECC_ENV_EXEC` is set
1034in your ``local.conf`` file, the variable should point to the
1035``icecc-create-env`` script provided by the user. If you do not point to
1036a user-provided script, the build system uses the default script
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001037provided by the recipe :oe_git:`icecc-create-env_0.1.bb
1038</openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001039
1040.. note::
1041
1042 This script is a modified version and not the one that comes with
Andrew Geissler87f5cff2022-09-30 13:13:31 -05001043 ``icecream``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001044
1045If you do not want the Icecream distributed compile support to apply to
Andrew Geissler595f6302022-01-24 19:11:47 +00001046specific recipes or classes, you can ask them to be ignored by Icecream
1047by listing the recipes and classes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001048:term:`ICECC_RECIPE_DISABLE` and
1049:term:`ICECC_CLASS_DISABLE` variables,
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001050respectively, in your ``local.conf`` file. Doing so causes the
1051OpenEmbedded build system to handle these compilations locally.
1052
1053Additionally, you can list recipes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +00001054:term:`ICECC_RECIPE_ENABLE` variable in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001055your ``local.conf`` file to force ``icecc`` to be enabled for recipes
1056using an empty :term:`PARALLEL_MAKE` variable.
1057
Andrew Geissler517393d2023-01-13 08:55:19 -06001058Inheriting the :ref:`ref-classes-icecc` class changes all sstate signatures.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001059Consequently, if a development team has a dedicated build system that
1060populates :term:`SSTATE_MIRRORS` and they want to
Andrew Geissler09036742021-06-25 14:25:14 -05001061reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
Andrew Geissler517393d2023-01-13 08:55:19 -06001062system need to either inherit the :ref:`ref-classes-icecc` class or nobody should.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001063
Andrew Geissler517393d2023-01-13 08:55:19 -06001064At the distribution level, you can inherit the :ref:`ref-classes-icecc` class to be
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001065sure that all builders start with the same sstate signatures. After
1066inheriting the class, you can then disable the feature by setting the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001067:term:`ICECC_DISABLED` variable to "1" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001068
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001069 INHERIT_DISTRO:append = " icecc"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001070 ICECC_DISABLED ??= "1"
1071
1072This practice
1073makes sure everyone is using the same signatures but also requires
1074individuals that do want to use Icecream to enable the feature
Andrew Geisslerc926e172021-05-07 16:11:35 -05001075individually as follows in your ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001076
1077 ICECC_DISABLED = ""
1078
1079.. _ref-classes-image:
1080
Andrew Geissler517393d2023-01-13 08:55:19 -06001081``image``
1082=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001083
Andrew Geissler517393d2023-01-13 08:55:19 -06001084The :ref:`ref-classes-image` class helps support creating images in different formats.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001085First, the root filesystem is created from packages using one of the
1086``rootfs*.bbclass`` files (depending on the package format used) and
1087then one or more image files are created.
1088
Andrew Geissler09036742021-06-25 14:25:14 -05001089- The :term:`IMAGE_FSTYPES` variable controls the types of images to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001090 generate.
1091
Andrew Geissler09036742021-06-25 14:25:14 -05001092- The :term:`IMAGE_INSTALL` variable controls the list of packages to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001093 install into the image.
1094
1095For information on customizing images, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001096":ref:`dev-manual/customizing-images:customizing images`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001097in the Yocto Project Development Tasks Manual. For information on how
1098images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001099":ref:`overview-manual/concepts:images`" section in the
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001100Yocto Project Overview and Concepts Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001101
1102.. _ref-classes-image-buildinfo:
1103
Andrew Geissler517393d2023-01-13 08:55:19 -06001104``image-buildinfo``
1105===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001106
Andrew Geissler517393d2023-01-13 08:55:19 -06001107The :ref:`ref-classes-image-buildinfo` class writes a plain text file containing
Patrick Williams975a06f2022-10-21 14:42:47 -05001108build information to the target filesystem at ``${sysconfdir}/buildinfo``
Patrick Williams7784c422022-11-17 07:29:11 -06001109by default (as specified by :term:`IMAGE_BUILDINFO_FILE`).
Patrick Williams975a06f2022-10-21 14:42:47 -05001110This can be useful for manually determining the origin of any given
1111image. It writes out two sections:
1112
Andrew Geissler517393d2023-01-13 08:55:19 -06001113#. `Build Configuration`: a list of variables and their values (specified
Patrick Williams975a06f2022-10-21 14:42:47 -05001114 by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and
1115 :term:`DISTRO_VERSION`)
1116
Andrew Geissler517393d2023-01-13 08:55:19 -06001117#. `Layer Revisions`: the revisions of all of the layers used in the
Patrick Williams975a06f2022-10-21 14:42:47 -05001118 build.
1119
1120Additionally, when building an SDK it will write the same contents
1121to ``/buildinfo`` by default (as specified by
1122:term:`SDK_BUILDINFO_FILE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001123
1124.. _ref-classes-image_types:
1125
Andrew Geissler517393d2023-01-13 08:55:19 -06001126``image_types``
1127===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001128
Andrew Geissler517393d2023-01-13 08:55:19 -06001129The :ref:`ref-classes-image_types` class defines all of the standard image output types
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001130that you can enable through the
1131:term:`IMAGE_FSTYPES` variable. You can use this
1132class as a reference on how to add support for custom image output
1133types.
1134
Andrew Geissler517393d2023-01-13 08:55:19 -06001135By default, the :ref:`ref-classes-image` class automatically
1136enables the :ref:`ref-classes-image_types` class. The :ref:`ref-classes-image` class uses the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001137``IMGCLASSES`` variable as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001138
1139 IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
1140 IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
1141 IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
1142 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
1143 IMGCLASSES += "image_types_wic"
1144 IMGCLASSES += "rootfs-postcommands"
1145 IMGCLASSES += "image-postinst-intercepts"
1146 inherit ${IMGCLASSES}
1147
Andrew Geissler517393d2023-01-13 08:55:19 -06001148The :ref:`ref-classes-image_types` class also handles conversion and compression of images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001149
1150.. note::
1151
1152 To build a VMware VMDK image, you need to add "wic.vmdk" to
Andrew Geissler09036742021-06-25 14:25:14 -05001153 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001154 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001155
1156.. _ref-classes-image-live:
1157
Andrew Geissler517393d2023-01-13 08:55:19 -06001158``image-live``
1159==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001160
1161This class controls building "live" (i.e. HDDIMG and ISO) images. Live
1162images contain syslinux for legacy booting, as well as the bootloader
1163specified by :term:`EFI_PROVIDER` if
1164:term:`MACHINE_FEATURES` contains "efi".
1165
1166Normally, you do not use this class directly. Instead, you add "live" to
1167:term:`IMAGE_FSTYPES`.
1168
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001169.. _ref-classes-insane:
1170
Andrew Geissler517393d2023-01-13 08:55:19 -06001171``insane``
1172==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001173
Andrew Geissler517393d2023-01-13 08:55:19 -06001174The :ref:`ref-classes-insane` class adds a step to the package generation process so
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001175that output quality assurance checks are generated by the OpenEmbedded
1176build system. A range of checks are performed that check the build's
1177output for common problems that show up during runtime. Distribution
1178policy usually dictates whether to include this class.
1179
1180You can configure the sanity checks so that specific test failures
1181either raise a warning or an error message. Typically, failures for new
1182tests generate a warning. Subsequent failures for the same test would
1183then generate an error message once the metadata is in a known and good
Andrew Geissler09209ee2020-12-13 08:44:15 -06001184condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001185and error messages you might encounter using a default configuration.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001186
1187Use the :term:`WARN_QA` and
1188:term:`ERROR_QA` variables to control the behavior of
1189these checks at the global level (i.e. in your custom distro
1190configuration). However, to skip one or more checks in recipes, you
1191should use :term:`INSANE_SKIP`. For example, to skip
1192the check for symbolic link ``.so`` files in the main package of a
1193recipe, add the following to the recipe. You need to realize that the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001194package name override, in this example ``${PN}``, must be used::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001195
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001196 INSANE_SKIP:${PN} += "dev-so"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001197
1198Please keep in mind that the QA checks
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001199are meant to detect real or potential problems in the packaged
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001200output. So exercise caution when disabling these checks.
1201
Andrew Geissler09036742021-06-25 14:25:14 -05001202Here are the tests you can list with the :term:`WARN_QA` and
Andrew Geissler5f350902021-07-23 13:09:54 -04001203:term:`ERROR_QA` variables:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001204
1205- ``already-stripped:`` Checks that produced binaries have not
1206 already been stripped prior to the build system extracting debug
1207 symbols. It is common for upstream software projects to default to
1208 stripping debug symbols for output binaries. In order for debugging
1209 to work on the target using ``-dbg`` packages, this stripping must be
1210 disabled.
1211
1212- ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1213 size, and endianness of any binaries to ensure they match the target
1214 architecture. This test fails if any binaries do not match the type
1215 since there would be an incompatibility. The test could indicate that
1216 the wrong compiler or compiler options have been used. Sometimes
1217 software, like bootloaders, might need to bypass this check.
1218
1219- ``buildpaths:`` Checks for paths to locations on the build host
Patrick Williams975a06f2022-10-21 14:42:47 -05001220 inside the output files. Not only can these leak information about
1221 the build environment, they also hinder binary reproducibility.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001222
1223- ``build-deps:`` Determines if a build-time dependency that is
1224 specified through :term:`DEPENDS`, explicit
1225 :term:`RDEPENDS`, or task-level dependencies exists
1226 to match any runtime dependency. This determination is particularly
1227 useful to discover where runtime dependencies are detected and added
1228 during packaging. If no explicit dependency has been specified within
1229 the metadata, at the packaging stage it is too late to ensure that
1230 the dependency is built, and thus you can end up with an error when
1231 the package is installed into the image during the
1232 :ref:`ref-tasks-rootfs` task because the auto-detected
1233 dependency was not satisfied. An example of this would be where the
Andrew Geissler517393d2023-01-13 08:55:19 -06001234 :ref:`ref-classes-update-rc.d` class automatically
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001235 adds a dependency on the ``initscripts-functions`` package to
1236 packages that install an initscript that refers to
1237 ``/etc/init.d/functions``. The recipe should really have an explicit
Andrew Geissler5f350902021-07-23 13:09:54 -04001238 :term:`RDEPENDS` for the package in question on ``initscripts-functions``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001239 so that the OpenEmbedded build system is able to ensure that the
1240 ``initscripts`` recipe is actually built and thus the
1241 ``initscripts-functions`` package is made available.
1242
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001243- ``configure-gettext:`` Checks that if a recipe is building something
1244 that uses automake and the automake files contain an ``AM_GNU_GETTEXT``
1245 directive, that the recipe also inherits the :ref:`ref-classes-gettext`
1246 class to ensure that gettext is available during the build.
1247
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001248- ``compile-host-path:`` Checks the
1249 :ref:`ref-tasks-compile` log for indications that
1250 paths to locations on the build host were used. Using such paths
1251 might result in host contamination of the build output.
1252
1253- ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1254 do not depend on ``-dbg`` packages, which would cause a packaging
1255 bug.
1256
1257- ``debug-files:`` Checks for ``.debug`` directories in anything but
1258 the ``-dbg`` package. The debug files should all be in the ``-dbg``
1259 package. Thus, anything packaged elsewhere is incorrect packaging.
1260
1261- ``dep-cmp:`` Checks for invalid version comparison statements in
1262 runtime dependency relationships between packages (i.e. in
1263 :term:`RDEPENDS`,
1264 :term:`RRECOMMENDS`,
1265 :term:`RSUGGESTS`,
1266 :term:`RPROVIDES`,
1267 :term:`RREPLACES`, and
1268 :term:`RCONFLICTS` variable values). Any invalid
1269 comparisons might trigger failures or undesirable behavior when
1270 passed to the package manager.
1271
1272- ``desktop:`` Runs the ``desktop-file-validate`` program against any
1273 ``.desktop`` files to validate their contents against the
1274 specification for ``.desktop`` files.
1275
1276- ``dev-deps:`` Checks that all packages except ``-dev`` or
1277 ``-staticdev`` packages do not depend on ``-dev`` packages, which
1278 would be a packaging bug.
1279
1280- ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1281 ``-dev`` package and not in any of the other packages. In general,
1282 these symlinks are only useful for development purposes. Thus, the
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001283 ``-dev`` package is the correct location for them. In very rare
1284 cases, such as dynamically loaded modules, these symlinks
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001285 are needed instead in the main package.
1286
Patrick Williams03907ee2022-05-01 06:28:52 -05001287- ``empty-dirs:`` Checks that packages are not installing files to
1288 directories that are normally expected to be empty (such as ``/tmp``)
1289 The list of directories that are checked is specified by the
1290 :term:`QA_EMPTY_DIRS` variable.
1291
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001292- ``file-rdeps:`` Checks that file-level dependencies identified by
1293 the OpenEmbedded build system at packaging time are satisfied. For
1294 example, a shell script might start with the line ``#!/bin/bash``.
1295 This line would translate to a file dependency on ``/bin/bash``. Of
1296 the three package managers that the OpenEmbedded build system
1297 supports, only RPM directly handles file-level dependencies,
1298 resolving them automatically to packages providing the files.
1299 However, the lack of that functionality in the other two package
1300 managers does not mean the dependencies do not still need resolving.
1301 This QA check attempts to ensure that explicitly declared
1302 :term:`RDEPENDS` exist to handle any file-level
1303 dependency detected in packaged files.
1304
1305- ``files-invalid:`` Checks for :term:`FILES` variable
1306 values that contain "//", which is invalid.
1307
1308- ``host-user-contaminated:`` Checks that no package produced by the
1309 recipe contains any files outside of ``/home`` with a user or group
1310 ID that matches the user running BitBake. A match usually indicates
1311 that the files are being installed with an incorrect UID/GID, since
1312 target IDs are independent from host IDs. For additional information,
1313 see the section describing the
1314 :ref:`ref-tasks-install` task.
1315
1316- ``incompatible-license:`` Report when packages are excluded from
1317 being created due to being marked with a license that is in
1318 :term:`INCOMPATIBLE_LICENSE`.
1319
1320- ``install-host-path:`` Checks the
1321 :ref:`ref-tasks-install` log for indications that
1322 paths to locations on the build host were used. Using such paths
1323 might result in host contamination of the build output.
1324
1325- ``installed-vs-shipped:`` Reports when files have been installed
Patrick Williams2194f502022-10-16 14:26:09 -05001326 within :ref:`ref-tasks-install` but have not been included in any package by
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001327 way of the :term:`FILES` variable. Files that do not
1328 appear in any package cannot be present in an image later on in the
1329 build process. Ideally, all installed files should be packaged or not
1330 installed at all. These files can be deleted at the end of
Patrick Williams2194f502022-10-16 14:26:09 -05001331 :ref:`ref-tasks-install` if the files are not needed in any package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001332
1333- ``invalid-chars:`` Checks that the recipe metadata variables
1334 :term:`DESCRIPTION`,
1335 :term:`SUMMARY`, :term:`LICENSE`, and
1336 :term:`SECTION` do not contain non-UTF-8 characters.
1337 Some package managers do not support such characters.
1338
1339- ``invalid-packageconfig:`` Checks that no undefined features are
1340 being added to :term:`PACKAGECONFIG`. For
Andrew Geisslerc926e172021-05-07 16:11:35 -05001341 example, any name "foo" for which the following form does not exist::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001342
1343 PACKAGECONFIG[foo] = "..."
1344
Andrew Geissler09036742021-06-25 14:25:14 -05001345- ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001346 file containing these paths is incorrect since ``libtool`` adds the
1347 correct sysroot prefix when using the files automatically itself.
1348
1349- ``ldflags:`` Ensures that the binaries were linked with the
1350 :term:`LDFLAGS` options provided by the build system.
Andrew Geissler09036742021-06-25 14:25:14 -05001351 If this test fails, check that the :term:`LDFLAGS` variable is being
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001352 passed to the linker command.
1353
1354- ``libdir:`` Checks for libraries being installed into incorrect
1355 (possibly hardcoded) installation paths. For example, this test will
1356 catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1357 "lib32". Another example is when recipes install
1358 ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1359
1360- ``libexec:`` Checks if a package contains files in
1361 ``/usr/libexec``. This check is not performed if the ``libexecdir``
1362 variable has been set explicitly to ``/usr/libexec``.
1363
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001364- ``mime:`` Check that if a package contains mime type files (``.xml``
1365 files in ``${datadir}/mime/packages``) that the recipe also inherits
1366 the :ref:`ref-classes-mime` class in order to ensure that these get
1367 properly installed.
1368
1369- ``mime-xdg:`` Checks that if a package contains a .desktop file with a
1370 'MimeType' key present, that the recipe inherits the
1371 :ref:`ref-classes-mime-xdg` class that is required in order for that
1372 to be activated.
1373
1374- ``missing-update-alternatives:`` Check that if a recipe sets the
1375 :term:`ALTERNATIVE` variable that the recipe also inherits
1376 :ref:`ref-classes-update-alternatives` such that the alternative will
1377 be correctly set up.
1378
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001379- ``packages-list:`` Checks for the same package being listed
1380 multiple times through the :term:`PACKAGES` variable
1381 value. Installing the package in this manner can cause errors during
1382 packaging.
1383
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001384- ``patch-fuzz:`` Checks for fuzz in patch files that may allow
1385 them to apply incorrectly if the underlying code changes.
1386
1387- ``patch-status-core:`` Checks that the Upstream-Status is specified
1388 and valid in the headers of patches for recipes in the OE-Core layer.
1389
1390- ``patch-status-noncore:`` Checks that the Upstream-Status is specified
1391 and valid in the headers of patches for recipes in layers other than
1392 OE-Core.
1393
1394- ``perllocalpod:`` Checks for ``perllocal.pod`` being erroneously
1395 installed and packaged by a recipe.
1396
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001397- ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1398 invalid format.
1399
1400- ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1401 invalid format.
1402
1403- ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1404 'link' where the specified target already exists.
1405
1406- ``perms:`` Currently, this check is unused but reserved.
1407
1408- ``pkgconfig:`` Checks ``.pc`` files for any
1409 :term:`TMPDIR`/:term:`WORKDIR` paths.
1410 Any ``.pc`` file containing these paths is incorrect since
1411 ``pkg-config`` itself adds the correct sysroot prefix when the files
1412 are accessed.
1413
1414- ``pkgname:`` Checks that all packages in
1415 :term:`PACKAGES` have names that do not contain
1416 invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1417 -).
1418
Andrew Geissler09036742021-06-25 14:25:14 -05001419- ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001420 undefined during :ref:`ref-tasks-package`.
1421
1422- ``pkgvarcheck:`` Checks through the variables
1423 :term:`RDEPENDS`,
1424 :term:`RRECOMMENDS`,
1425 :term:`RSUGGESTS`,
1426 :term:`RCONFLICTS`,
1427 :term:`RPROVIDES`,
1428 :term:`RREPLACES`, :term:`FILES`,
1429 :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1430 ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1431 there are variable sets that are not package-specific. Using these
1432 variables without a package suffix is bad practice, and might
1433 unnecessarily complicate dependencies of other packages within the
1434 same recipe or have other unintended consequences.
1435
1436- ``pn-overrides:`` Checks that a recipe does not have a name
1437 (:term:`PN`) value that appears in
1438 :term:`OVERRIDES`. If a recipe is named such that
Andrew Geissler09036742021-06-25 14:25:14 -05001439 its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
1440 :term:`PN` happens to be the same as :term:`MACHINE` or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001441 :term:`DISTRO`), it can have unexpected consequences.
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001442 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001443 turn into ``FILES = "xyz"``.
1444
1445- ``rpaths:`` Checks for rpaths in the binaries that contain build
Andrew Geissler5f350902021-07-23 13:09:54 -04001446 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001447 options are being passed to the linker commands and your binaries
1448 have potential security issues.
1449
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001450- ``shebang-size:`` Check that the shebang line (``#!`` in the first line)
1451 in a packaged script is not longer than 128 characters, which can cause
1452 an error at runtime depending on the operating system.
1453
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001454- ``split-strip:`` Reports that splitting or stripping debug symbols
1455 from binaries has failed.
1456
1457- ``staticdev:`` Checks for static library files (``*.a``) in
1458 non-``staticdev`` packages.
1459
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001460- ``src-uri-bad:`` Checks that the :term:`SRC_URI` value set by a recipe
1461 does not contain a reference to ``${PN}`` (instead of the correct
1462 ``${BPN}``) nor refers to unstable Github archive tarballs.
1463
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001464- ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1465 into :term:`TMPDIR` on the host. Such symlinks will
1466 work on the host, but are clearly invalid when running on the target.
1467
1468- ``textrel:`` Checks for ELF binaries that contain relocations in
1469 their ``.text`` sections, which can result in a performance impact at
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001470 runtime. See the explanation for the ``ELF binary`` message in
Andrew Geissler09209ee2020-12-13 08:44:15 -06001471 ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001472 issues.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001473
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001474- ``unhandled-features-check:`` check that if one of the variables that
1475 the :ref:`ref-classes-features_check` class supports (e.g.
Patrick Williamsb542dec2023-06-09 01:26:37 -05001476 :term:`REQUIRED_DISTRO_FEATURES`) is set by a recipe, then the recipe
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001477 also inherits :ref:`ref-classes-features_check` in order for the
1478 requirement to actually work.
1479
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001480- ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1481 for a package are also declared on the recipe level (i.e. any license
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001482 in ``LICENSE:*`` should appear in :term:`LICENSE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001483
1484- ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1485 in the binaries that by default on a standard system are searched by
1486 the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1487 not cause any breakage, they do waste space and are unnecessary.
1488
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001489- ``usrmerge:`` If ``usrmerge`` is in :term:`DISTRO_FEATURES`, this
1490 check will ensure that no package installs files to root (``/bin``,
1491 ``/sbin``, ``/lib``, ``/lib64``) directories.
1492
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001493- ``var-undefined:`` Reports when variables fundamental to packaging
1494 (i.e. :term:`WORKDIR`,
1495 :term:`DEPLOY_DIR`, :term:`D`,
1496 :term:`PN`, and :term:`PKGD`) are undefined
1497 during :ref:`ref-tasks-package`.
1498
Patrick Williams8e7b46e2023-05-01 14:19:06 -05001499- ``version-going-backwards:`` If the :ref:`ref-classes-buildhistory`
1500 class is enabled, reports when a package being written out has a lower
1501 version than the previously written package under the same name. If
1502 you are placing output packages into a feed and upgrading packages on
1503 a target system using that feed, the version of a package going
1504 backwards can result in the target system not correctly upgrading to
1505 the "new" version of the package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001506
1507 .. note::
1508
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001509 This is only relevant when you are using runtime package management
1510 on your target system.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001511
1512- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1513 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1514 driver ABI names. All drivers should depend on the ABI versions that
1515 they have been built against. Driver recipes that include
1516 ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1517 automatically get these versions. Consequently, you should only need
1518 to explicitly add dependencies to binary driver recipes.
1519
1520.. _ref-classes-insserv:
1521
Andrew Geissler517393d2023-01-13 08:55:19 -06001522``insserv``
1523===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001524
Andrew Geissler517393d2023-01-13 08:55:19 -06001525The :ref:`ref-classes-insserv` class uses the ``insserv`` utility to update the order
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001526of symbolic links in ``/etc/rc?.d/`` within an image based on
1527dependencies specified by LSB headers in the ``init.d`` scripts
1528themselves.
1529
1530.. _ref-classes-kernel:
1531
Andrew Geissler517393d2023-01-13 08:55:19 -06001532``kernel``
1533==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001534
Andrew Geissler517393d2023-01-13 08:55:19 -06001535The :ref:`ref-classes-kernel` class handles building Linux kernels. The class contains
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001536code to build all kernel trees. All needed headers are staged into the
Andrew Geissler5f350902021-07-23 13:09:54 -04001537:term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
Andrew Geissler517393d2023-01-13 08:55:19 -06001538using the :ref:`ref-classes-module` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001539
Andrew Geissler3eeda902023-05-19 10:14:02 -05001540If a file named ``defconfig`` is listed in :term:`SRC_URI`, then by default
1541:ref:`ref-tasks-configure` copies it as ``.config`` in the build directory,
1542so it is automatically used as the kernel configuration for the build. This
1543copy is not performed in case ``.config`` already exists there: this allows
1544recipes to produce a configuration by other means in
1545``do_configure:prepend``.
1546
1547Each built kernel module is packaged separately and inter-module
1548dependencies are created by parsing the ``modinfo`` output. If all modules
1549are required, then installing the ``kernel-modules`` package installs all
1550packages with modules and various other kernel packages such as
1551``kernel-vmlinux``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001552
Andrew Geissler517393d2023-01-13 08:55:19 -06001553The :ref:`ref-classes-kernel` class contains logic that allows you to embed an initial
Patrick Williams2194f502022-10-16 14:26:09 -05001554RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
1555information on how to build an :term:`Initramfs`, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001556":ref:`dev-manual/building:building an initial ram filesystem (Initramfs) image`" section in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001557the Yocto Project Development Tasks Manual.
1558
Andrew Geissler517393d2023-01-13 08:55:19 -06001559Various other classes are used by the :ref:`ref-classes-kernel` and :ref:`ref-classes-module` classes
1560internally including the :ref:`ref-classes-kernel-arch`, :ref:`ref-classes-module-base`, and
1561:ref:`ref-classes-linux-kernel-base` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001562
1563.. _ref-classes-kernel-arch:
1564
Andrew Geissler517393d2023-01-13 08:55:19 -06001565``kernel-arch``
1566===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001567
Andrew Geissler517393d2023-01-13 08:55:19 -06001568The :ref:`ref-classes-kernel-arch` class sets the ``ARCH`` environment variable for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001569Linux kernel compilation (including modules).
1570
1571.. _ref-classes-kernel-devicetree:
1572
Andrew Geissler517393d2023-01-13 08:55:19 -06001573``kernel-devicetree``
1574=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001575
Andrew Geissler517393d2023-01-13 08:55:19 -06001576The :ref:`ref-classes-kernel-devicetree` class, which is inherited by the
1577:ref:`ref-classes-kernel` class, supports device tree generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001578
Patrick Williamsb542dec2023-06-09 01:26:37 -05001579Its behavior is mainly controlled by the following variables:
1580
1581- :term:`KERNEL_DEVICETREE_BUNDLE`: whether to bundle the kernel and device tree
1582- :term:`KERNEL_DTBDEST`: directory where to install DTB files
1583- :term:`KERNEL_DTBVENDORED`: whether to keep vendor subdirectories
1584- :term:`KERNEL_DTC_FLAGS`: flags for ``dtc``, the Device Tree Compiler
1585- :term:`KERNEL_PACKAGE_NAME`: base name of the kernel packages
1586
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001587.. _ref-classes-kernel-fitimage:
1588
Andrew Geissler517393d2023-01-13 08:55:19 -06001589``kernel-fitimage``
1590===================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001591
Andrew Geissler517393d2023-01-13 08:55:19 -06001592The :ref:`ref-classes-kernel-fitimage` class provides support to pack a kernel image,
Patrick Williamsb542dec2023-06-09 01:26:37 -05001593device trees, a U-boot script, an :term:`Initramfs` bundle and a RAM disk
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001594into a single FIT image. In theory, a FIT image can support any number
Andrew Geissler517393d2023-01-13 08:55:19 -06001595of kernels, U-boot scripts, :term:`Initramfs` bundles, RAM disks and device-trees.
1596However, :ref:`ref-classes-kernel-fitimage` currently only supports
Patrick Williams975a06f2022-10-21 14:42:47 -05001597limited usecases: just one kernel image, an optional U-boot script,
Andrew Geissler517393d2023-01-13 08:55:19 -06001598an optional :term:`Initramfs` bundle, an optional RAM disk, and any number of
Patrick Williamsb542dec2023-06-09 01:26:37 -05001599device trees.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001600
1601To create a FIT image, it is required that :term:`KERNEL_CLASSES`
Patrick Williams2a254922023-08-11 09:48:11 -05001602is set to include ":ref:`ref-classes-kernel-fitimage`" and one of :term:`KERNEL_IMAGETYPE`,
1603:term:`KERNEL_ALT_IMAGETYPE` or :term:`KERNEL_IMAGETYPES` to include "fitImage".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001604
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001605The options for the device tree compiler passed to ``mkimage -D``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001606when creating the FIT image are specified using the
1607:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1608
1609Only a single kernel can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001610:ref:`ref-classes-kernel-fitimage` and the kernel image in FIT is mandatory. The
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001611address where the kernel image is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001612specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
Andrew Geissler3eeda902023-05-19 10:14:02 -05001613:term:`UBOOT_ENTRYPOINT`. Setting :term:`FIT_ADDRESS_CELLS` to "2"
1614is necessary if such addresses are 64 bit ones.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001615
1616Multiple device trees can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001617:ref:`ref-classes-kernel-fitimage` and the device tree is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001618The address where the device tree is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001619specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001620and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001621
1622Only a single RAM disk can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001623:ref:`ref-classes-kernel-fitimage` and the RAM disk in FIT is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001624The address where the RAM disk image is to be loaded by U-Boot
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001625is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
Patrick Williams2a254922023-08-11 09:48:11 -05001626:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to the FIT image when
1627:term:`INITRAMFS_IMAGE` is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE`
1628is not set to 1.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001629
Andrew Geissler517393d2023-01-13 08:55:19 -06001630Only a single :term:`Initramfs` bundle can be added to the FIT image created by
1631:ref:`ref-classes-kernel-fitimage` and the :term:`Initramfs` bundle in FIT is optional.
1632In case of :term:`Initramfs`, the kernel is configured to be bundled with the root filesystem
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001633in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
Andrew Geissler517393d2023-01-13 08:55:19 -06001634When the kernel is copied to RAM and executed, it unpacks the :term:`Initramfs` root filesystem.
1635The :term:`Initramfs` bundle can be enabled when :term:`INITRAMFS_IMAGE`
Patrick Williams2a254922023-08-11 09:48:11 -05001636is specified and requires that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
Andrew Geissler517393d2023-01-13 08:55:19 -06001637The address where the :term:`Initramfs` bundle is to be loaded by U-boot is specified
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001638by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1639
1640Only a single U-boot boot script can be added to the FIT image created by
Andrew Geissler517393d2023-01-13 08:55:19 -06001641:ref:`ref-classes-kernel-fitimage` and the boot script is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001642The boot script is specified in the ITS file as a text file containing
1643U-boot commands. When using a boot script the user should configure the
Patrick Williams2194f502022-10-16 14:26:09 -05001644U-boot :ref:`ref-tasks-install` task to copy the script to sysroot.
Andrew Geissler517393d2023-01-13 08:55:19 -06001645So the script can be included in the FIT image by the :ref:`ref-classes-kernel-fitimage`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001646class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
Patrick Williams2a254922023-08-11 09:48:11 -05001647load the boot script from the FIT image and execute it.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001648
Patrick Williams2a254922023-08-11 09:48:11 -05001649The FIT image generated by the :ref:`ref-classes-kernel-fitimage` class is signed when the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001650variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1651:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1652appropriately. The default values used for :term:`FIT_HASH_ALG` and
Andrew Geissler517393d2023-01-13 08:55:19 -06001653:term:`FIT_SIGN_ALG` in :ref:`ref-classes-kernel-fitimage` are "sha256" and
Patrick Williams2a254922023-08-11 09:48:11 -05001654"rsa2048" respectively. The keys for signing the FIT image can be generated using
Andrew Geissler517393d2023-01-13 08:55:19 -06001655the :ref:`ref-classes-kernel-fitimage` class when both :term:`FIT_GENERATE_KEYS` and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001656:term:`UBOOT_SIGN_ENABLE` are set to "1".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001657
1658
1659.. _ref-classes-kernel-grub:
1660
Andrew Geissler517393d2023-01-13 08:55:19 -06001661``kernel-grub``
1662===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001663
Andrew Geissler517393d2023-01-13 08:55:19 -06001664The :ref:`ref-classes-kernel-grub` class updates the boot area and the boot menu with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001665the kernel as the priority boot mechanism while installing a RPM to
1666update the kernel on a deployed target.
1667
1668.. _ref-classes-kernel-module-split:
1669
Andrew Geissler517393d2023-01-13 08:55:19 -06001670``kernel-module-split``
1671=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001672
Andrew Geissler517393d2023-01-13 08:55:19 -06001673The :ref:`ref-classes-kernel-module-split` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001674splitting Linux kernel modules into separate packages.
1675
1676.. _ref-classes-kernel-uboot:
1677
Andrew Geissler517393d2023-01-13 08:55:19 -06001678``kernel-uboot``
1679================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001680
Andrew Geissler517393d2023-01-13 08:55:19 -06001681The :ref:`ref-classes-kernel-uboot` class provides support for building from
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001682vmlinux-style kernel sources.
1683
1684.. _ref-classes-kernel-uimage:
1685
Andrew Geissler517393d2023-01-13 08:55:19 -06001686``kernel-uimage``
1687=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001688
Andrew Geissler517393d2023-01-13 08:55:19 -06001689The :ref:`ref-classes-kernel-uimage` class provides support to pack uImage.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001690
1691.. _ref-classes-kernel-yocto:
1692
Andrew Geissler517393d2023-01-13 08:55:19 -06001693``kernel-yocto``
1694================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001695
Andrew Geissler517393d2023-01-13 08:55:19 -06001696The :ref:`ref-classes-kernel-yocto` class provides common functionality for building
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001697from linux-yocto style kernel source repositories.
1698
1699.. _ref-classes-kernelsrc:
1700
Andrew Geissler517393d2023-01-13 08:55:19 -06001701``kernelsrc``
1702=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001703
Andrew Geissler517393d2023-01-13 08:55:19 -06001704The :ref:`ref-classes-kernelsrc` class sets the Linux kernel source and version.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001705
1706.. _ref-classes-lib_package:
1707
Andrew Geissler517393d2023-01-13 08:55:19 -06001708``lib_package``
1709===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001710
Andrew Geissler517393d2023-01-13 08:55:19 -06001711The :ref:`ref-classes-lib_package` class supports recipes that build libraries and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001712produce executable binaries, where those binaries should not be
1713installed by default along with the library. Instead, the binaries are
1714added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1715make their installation optional.
1716
1717.. _ref-classes-libc*:
1718
Andrew Geissler517393d2023-01-13 08:55:19 -06001719``libc*``
1720=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001721
Andrew Geissler517393d2023-01-13 08:55:19 -06001722The :ref:`ref-classes-libc*` classes support recipes that build packages with ``libc``:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001723
Patrick Williams2390b1b2022-11-03 13:47:49 -05001724- The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001725 ``libc``.
1726
Patrick Williams2390b1b2022-11-03 13:47:49 -05001727- The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001728 ``eglibc``.
1729
1730.. _ref-classes-license:
1731
Andrew Geissler517393d2023-01-13 08:55:19 -06001732``license``
1733===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001734
Andrew Geissler517393d2023-01-13 08:55:19 -06001735The :ref:`ref-classes-license` class provides license manifest creation and license
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001736exclusion. This class is enabled by default using the default value for
1737the :term:`INHERIT_DISTRO` variable.
1738
1739.. _ref-classes-linux-kernel-base:
1740
Andrew Geissler517393d2023-01-13 08:55:19 -06001741``linux-kernel-base``
1742=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001743
Andrew Geissler517393d2023-01-13 08:55:19 -06001744The :ref:`ref-classes-linux-kernel-base` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001745recipes that build out of the Linux kernel source tree. These builds
1746goes beyond the kernel itself. For example, the Perf recipe also
1747inherits this class.
1748
1749.. _ref-classes-linuxloader:
1750
Andrew Geissler517393d2023-01-13 08:55:19 -06001751``linuxloader``
1752===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001753
1754Provides the function ``linuxloader()``, which gives the value of the
1755dynamic loader/linker provided on the platform. This value is used by a
1756number of other classes.
1757
1758.. _ref-classes-logging:
1759
Andrew Geissler517393d2023-01-13 08:55:19 -06001760``logging``
1761===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001762
Andrew Geissler517393d2023-01-13 08:55:19 -06001763The :ref:`ref-classes-logging` class provides the standard shell functions used to log
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001764messages for various BitBake severity levels (i.e. ``bbplain``,
1765``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1766
Andrew Geissler517393d2023-01-13 08:55:19 -06001767This class is enabled by default since it is inherited by the :ref:`ref-classes-base`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001768class.
1769
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06001770.. _ref-classes-meson:
1771
1772``meson``
1773=========
1774
1775The :ref:`ref-classes-meson` class allows to create recipes that build software
1776using the `Meson <https://mesonbuild.com/>`__ build system. You can use
1777the :term:`MESON_BUILDTYPE` and :term:`EXTRA_OEMESON` variables to specify
1778additional configuration options to be passed using the ``meson`` command line.
1779
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001780.. _ref-classes-metadata_scm:
1781
Andrew Geissler517393d2023-01-13 08:55:19 -06001782``metadata_scm``
1783================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001784
Andrew Geissler517393d2023-01-13 08:55:19 -06001785The :ref:`ref-classes-metadata_scm` class provides functionality for querying the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001786branch and revision of a Source Code Manager (SCM) repository.
1787
Andrew Geissler517393d2023-01-13 08:55:19 -06001788The :ref:`ref-classes-base` class uses this class to print the revisions of
1789each layer before starting every build. The :ref:`ref-classes-metadata_scm`
1790class is enabled by default because it is inherited by the
1791:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001792
1793.. _ref-classes-migrate_localcount:
1794
Andrew Geissler517393d2023-01-13 08:55:19 -06001795``migrate_localcount``
1796======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001797
Andrew Geissler517393d2023-01-13 08:55:19 -06001798The :ref:`ref-classes-migrate_localcount` class verifies a recipe's localcount data and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001799increments it appropriately.
1800
1801.. _ref-classes-mime:
1802
Andrew Geissler517393d2023-01-13 08:55:19 -06001803``mime``
1804========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001805
Andrew Geissler517393d2023-01-13 08:55:19 -06001806The :ref:`ref-classes-mime` class generates the proper post-install and post-remove
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001807(postinst/postrm) scriptlets for packages that install MIME type files.
1808These scriptlets call ``update-mime-database`` to add the MIME types to
1809the shared database.
1810
Patrick Williams7784c422022-11-17 07:29:11 -06001811.. _ref-classes-mime-xdg:
1812
Andrew Geissler517393d2023-01-13 08:55:19 -06001813``mime-xdg``
1814============
Patrick Williams7784c422022-11-17 07:29:11 -06001815
Andrew Geissler517393d2023-01-13 08:55:19 -06001816The :ref:`ref-classes-mime-xdg` class generates the proper
Patrick Williams7784c422022-11-17 07:29:11 -06001817post-install and post-remove (postinst/postrm) scriptlets for packages
1818that install ``.desktop`` files containing ``MimeType`` entries.
1819These scriptlets call ``update-desktop-database`` to add the MIME types
1820to the database of MIME types handled by desktop files.
1821
1822Thanks to this class, when users open a file through a file browser
1823on recently created images, they don't have to choose the application
1824to open the file from the pool of all known applications, even the ones
1825that cannot open the selected file.
1826
1827If you have recipes installing their ``.desktop`` files as absolute
1828symbolic links, the detection of such files cannot be done by the current
1829implementation of this class. In this case, you have to add the corresponding
1830package names to the :term:`MIME_XDG_PACKAGES` variable.
1831
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001832.. _ref-classes-mirrors:
1833
Andrew Geissler517393d2023-01-13 08:55:19 -06001834``mirrors``
1835===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001836
Andrew Geissler517393d2023-01-13 08:55:19 -06001837The :ref:`ref-classes-mirrors` class sets up some standard
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001838:term:`MIRRORS` entries for source code mirrors. These
1839mirrors provide a fall-back path in case the upstream source specified
1840in :term:`SRC_URI` within recipes is unavailable.
1841
1842This class is enabled by default since it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06001843:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001844
1845.. _ref-classes-module:
1846
Andrew Geissler517393d2023-01-13 08:55:19 -06001847``module``
1848==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001849
Andrew Geissler517393d2023-01-13 08:55:19 -06001850The :ref:`ref-classes-module` class provides support for building out-of-tree Linux
1851kernel modules. The class inherits the :ref:`ref-classes-module-base` and
1852:ref:`ref-classes-kernel-module-split` classes, and implements the
1853:ref:`ref-tasks-compile` and :ref:`ref-tasks-install` tasks. The class provides
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001854everything needed to build and package a kernel module.
1855
1856For general information on out-of-tree Linux kernel modules, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001857":ref:`kernel-dev/common:incorporating out-of-tree modules`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001858section in the Yocto Project Linux Kernel Development Manual.
1859
1860.. _ref-classes-module-base:
1861
Andrew Geissler517393d2023-01-13 08:55:19 -06001862``module-base``
1863===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001864
Andrew Geissler517393d2023-01-13 08:55:19 -06001865The :ref:`ref-classes-module-base` class provides the base functionality for
1866building Linux kernel modules. Typically, a recipe that builds software that
1867includes one or more kernel modules and has its own means of building the module
1868inherits this class as opposed to inheriting the :ref:`ref-classes-module`
1869class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001870
1871.. _ref-classes-multilib*:
1872
Andrew Geissler517393d2023-01-13 08:55:19 -06001873``multilib*``
1874=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001875
Andrew Geissler517393d2023-01-13 08:55:19 -06001876The :ref:`ref-classes-multilib*` classes provide support for building libraries with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001877different target optimizations or target architectures and installing
1878them side-by-side in the same image.
1879
1880For more information on using the Multilib feature, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001881":ref:`dev-manual/libraries:combining multiple versions of library files into one image`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001882section in the Yocto Project Development Tasks Manual.
1883
1884.. _ref-classes-native:
1885
Andrew Geissler517393d2023-01-13 08:55:19 -06001886``native``
1887==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001888
Andrew Geissler517393d2023-01-13 08:55:19 -06001889The :ref:`ref-classes-native` class provides common functionality for recipes that
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001890build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
1891or other tools from the build host).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001892
1893You can create a recipe that builds tools that run natively on the host
1894a couple different ways:
1895
Andrew Geissler517393d2023-01-13 08:55:19 -06001896- Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`ref-classes-native`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001897 class. If you use this method, you must order the inherit statement
1898 in the recipe after all other inherit statements so that the
Andrew Geissler517393d2023-01-13 08:55:19 -06001899 :ref:`ref-classes-native` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001900
1901 .. note::
1902
1903 When creating a recipe this way, the recipe name must follow this
Andrew Geisslerc926e172021-05-07 16:11:35 -05001904 naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001905
1906 myrecipe-native.bb
1907
1908
1909 Not using this naming convention can lead to subtle problems
1910 caused by existing code that depends on that naming convention.
1911
Andrew Geisslerc926e172021-05-07 16:11:35 -05001912- Create or modify a target recipe that contains the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001913
1914 BBCLASSEXTEND = "native"
1915
1916 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001917 recipe, use ``:class-native`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001918 specify any functionality specific to the respective native or target
1919 case.
1920
Andrew Geissler517393d2023-01-13 08:55:19 -06001921Although applied differently, the :ref:`ref-classes-native` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001922methods. The advantage of the second method is that you do not need to
1923have two separate recipes (assuming you need both) for native and
1924target. All common parts of the recipe are automatically shared.
1925
1926.. _ref-classes-nativesdk:
1927
Andrew Geissler517393d2023-01-13 08:55:19 -06001928``nativesdk``
1929=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001930
Andrew Geissler517393d2023-01-13 08:55:19 -06001931The :ref:`ref-classes-nativesdk` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001932wish to build tools to run as part of an SDK (i.e. tools that run on
1933:term:`SDKMACHINE`).
1934
1935You can create a recipe that builds tools that run on the SDK machine a
1936couple different ways:
1937
Andrew Geisslereff27472021-10-29 15:35:00 -05001938- Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
Andrew Geissler517393d2023-01-13 08:55:19 -06001939 :ref:`ref-classes-nativesdk` class. If you use this method, you must order the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001940 inherit statement in the recipe after all other inherit statements so
Andrew Geissler517393d2023-01-13 08:55:19 -06001941 that the :ref:`ref-classes-nativesdk` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001942
Andrew Geissler517393d2023-01-13 08:55:19 -06001943- Create a :ref:`ref-classes-nativesdk` variant of any recipe by adding the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001944
1945 BBCLASSEXTEND = "nativesdk"
1946
1947 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001948 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001949 specify any functionality specific to the respective SDK machine or
1950 target case.
1951
1952.. note::
1953
Andrew Geisslerc926e172021-05-07 16:11:35 -05001954 When creating a recipe, you must follow this naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001955
1956 nativesdk-myrecipe.bb
1957
1958
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001959 Not doing so can lead to subtle problems because there is code that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001960 depends on the naming convention.
1961
Andrew Geissler517393d2023-01-13 08:55:19 -06001962Although applied differently, the :ref:`ref-classes-nativesdk` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001963methods. The advantage of the second method is that you do not need to
1964have two separate recipes (assuming you need both) for the SDK machine
1965and the target. All common parts of the recipe are automatically shared.
1966
1967.. _ref-classes-nopackages:
1968
Andrew Geissler517393d2023-01-13 08:55:19 -06001969``nopackages``
1970==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001971
1972Disables packaging tasks for those recipes and classes where packaging
1973is not needed.
1974
1975.. _ref-classes-npm:
1976
Andrew Geissler517393d2023-01-13 08:55:19 -06001977``npm``
1978=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001979
Patrick Williams7784c422022-11-17 07:29:11 -06001980Provides support for building Node.js software fetched using the
1981:wikipedia:`node package manager (NPM) <Npm_(software)>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001982
1983.. note::
1984
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001985 Currently, recipes inheriting this class must use the ``npm://``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001986 fetcher to have dependencies fetched and packaged automatically.
1987
1988For information on how to create NPM packages, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06001989":ref:`dev-manual/packages:creating node package manager (npm) packages`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001990section in the Yocto Project Development Tasks Manual.
1991
1992.. _ref-classes-oelint:
1993
Andrew Geissler517393d2023-01-13 08:55:19 -06001994``oelint``
1995==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001996
Andrew Geissler517393d2023-01-13 08:55:19 -06001997The :ref:`ref-classes-oelint` class is an obsolete lint checking tool available in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001998``meta/classes`` in the :term:`Source Directory`.
1999
William A. Kennington IIIac69b482021-06-02 12:28:27 -07002000There are some classes that could be generally useful in OE-Core but
Andrew Geissler517393d2023-01-13 08:55:19 -06002001are never actually used within OE-Core itself. The :ref:`ref-classes-oelint` class is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002002one such example. However, being aware of this class can reduce the
2003proliferation of different versions of similar classes across multiple
2004layers.
2005
Andrew Geissler5199d832021-09-24 16:47:35 -05002006.. _ref-classes-overlayfs:
2007
Andrew Geissler517393d2023-01-13 08:55:19 -06002008``overlayfs``
2009=============
Andrew Geissler5199d832021-09-24 16:47:35 -05002010
Andrew Geissler595f6302022-01-24 19:11:47 +00002011It's often desired in Embedded System design to have a read-only root filesystem.
Andrew Geissler5199d832021-09-24 16:47:35 -05002012But a lot of different applications might want to have read-write access to
2013some parts of a filesystem. It can be especially useful when your update mechanism
Andrew Geissler595f6302022-01-24 19:11:47 +00002014overwrites the whole root filesystem, but you may want your application data to be preserved
Andrew Geissler517393d2023-01-13 08:55:19 -06002015between updates. The :ref:`ref-classes-overlayfs` class provides a way
Andrew Geissler5199d832021-09-24 16:47:35 -05002016to achieve that by means of ``overlayfs`` and at the same time keeping the base
Andrew Geissler595f6302022-01-24 19:11:47 +00002017root filesystem read-only.
Andrew Geissler5199d832021-09-24 16:47:35 -05002018
2019To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
2020layer in your machine configuration. The underlying file system can be anything that
2021is supported by ``overlayfs``. This has to be done in your machine configuration::
2022
2023 OVERLAYFS_MOUNT_POINT[data] = "/data"
2024
2025.. note::
2026
2027 * QA checks fail to catch file existence if you redefine this variable in your recipe!
2028 * Only the existence of the systemd mount unit file is checked, not its contents.
2029 * To get more details on ``overlayfs``, its internals and supported operations, please refer
Patrick Williams2390b1b2022-11-03 13:47:49 -05002030 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 -05002031
2032The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
2033(e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
2034
2035Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
2036
2037 OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
2038
2039To support several mount points you can use a different variable flag. Assuming we
2040want to have a writable location on the file system, but do not need that the data
Andrew Geissler595f6302022-01-24 19:11:47 +00002041survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
2042file system.
Andrew Geissler5199d832021-09-24 16:47:35 -05002043
2044In your machine configuration::
2045
2046 OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
2047
2048and then in your recipe::
2049
2050 OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
2051
Andrew Geissler595f6302022-01-24 19:11:47 +00002052On a practical note, your application recipe might require multiple
2053overlays to be mounted before running to avoid writing to the underlying
2054file system (which can be forbidden in case of read-only file system)
Andrew Geissler517393d2023-01-13 08:55:19 -06002055To achieve that :ref:`ref-classes-overlayfs` provides a ``systemd``
Andrew Geissler595f6302022-01-24 19:11:47 +00002056helper service for mounting overlays. This helper service is named
2057``${PN}-overlays.service`` and can be depended on in your application recipe
2058(named ``application`` in the following example) ``systemd`` unit by adding
2059to the unit the following::
2060
2061 [Unit]
2062 After=application-overlays.service
2063 Requires=application-overlays.service
2064
Andrew Geissler5199d832021-09-24 16:47:35 -05002065.. note::
2066
2067 The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
Andrew Geissler517393d2023-01-13 08:55:19 -06002068 In order to get ``/etc`` in overlayfs, see :ref:`ref-classes-overlayfs-etc`.
Andrew Geissler595f6302022-01-24 19:11:47 +00002069
2070.. _ref-classes-overlayfs-etc:
2071
Andrew Geissler517393d2023-01-13 08:55:19 -06002072``overlayfs-etc``
2073=================
Andrew Geissler595f6302022-01-24 19:11:47 +00002074
2075In order to have the ``/etc`` directory in overlayfs a special handling at early
2076boot stage is required. The idea is to supply a custom init script that mounts
2077``/etc`` before launching the actual init program, because the latter already
2078requires ``/etc`` to be mounted.
2079
2080Example usage in image recipe::
2081
2082 IMAGE_FEATURES += "overlayfs-etc"
2083
2084.. note::
2085
2086 This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
2087
2088Your machine configuration should define at least the device, mount point, and file system type
2089you are going to use for ``overlayfs``::
2090
2091 OVERLAYFS_ETC_MOUNT_POINT = "/data"
2092 OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
2093 OVERLAYFS_ETC_FSTYPE ?= "ext4"
2094
2095To control more mount options you should consider setting mount options
2096(``defaults`` is used by default)::
2097
2098 OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
2099
2100The class provides two options for ``/sbin/init`` generation:
2101
2102- The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
2103 and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
2104 that you won't need to change any kernel parameters in order to make it work,
2105 but it poses a restriction that package-management can't be used, because updating
2106 the init manager would remove the generated script.
2107
2108- If you wish to keep original init as is, you can set::
2109
2110 OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
2111
2112 Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
2113 kernel parameters manually in your bootloader configuration.
Andrew Geissler5199d832021-09-24 16:47:35 -05002114
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002115.. _ref-classes-own-mirrors:
2116
Andrew Geissler517393d2023-01-13 08:55:19 -06002117``own-mirrors``
2118===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002119
Andrew Geissler517393d2023-01-13 08:55:19 -06002120The :ref:`ref-classes-own-mirrors` class makes it easier to set up your own
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002121:term:`PREMIRRORS` from which to first fetch source
2122before attempting to fetch it from the upstream specified in
2123:term:`SRC_URI` within each recipe.
2124
2125To use this class, inherit it globally and specify
Andrew Geisslerc926e172021-05-07 16:11:35 -05002126:term:`SOURCE_MIRROR_URL`. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002127
2128 INHERIT += "own-mirrors"
2129 SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
2130
2131You can specify only a single URL
Andrew Geissler09036742021-06-25 14:25:14 -05002132in :term:`SOURCE_MIRROR_URL`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002133
2134.. _ref-classes-package:
2135
Andrew Geissler517393d2023-01-13 08:55:19 -06002136``package``
2137===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002138
Andrew Geissler517393d2023-01-13 08:55:19 -06002139The :ref:`ref-classes-package` class supports generating packages from a build's
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002140output. The core generic functionality is in ``package.bbclass``. The
2141code specific to particular package types resides in these
Andrew Geissler517393d2023-01-13 08:55:19 -06002142package-specific classes: :ref:`ref-classes-package_deb`,
Patrick Williams8e7b46e2023-05-01 14:19:06 -05002143:ref:`ref-classes-package_rpm`, :ref:`ref-classes-package_ipk`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002144
2145You can control the list of resulting package formats by using the
Andrew Geissler09036742021-06-25 14:25:14 -05002146:term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002147configuration file, which is located in the :term:`Build Directory`.
Patrick Williams2390b1b2022-11-03 13:47:49 -05002148When defining the variable, you can specify one or more package types.
2149Since images are generated from packages, a packaging class is needed
2150to enable image generation. The first class listed in this variable is
2151used for image generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002152
2153If you take the optional step to set up a repository (package feed) on
2154the development host that can be used by DNF, you can install packages
2155from the feed while you are running the image on the target (i.e.
2156runtime installation of packages). For more information, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002157":ref:`dev-manual/packages:using runtime package management`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002158section in the Yocto Project Development Tasks Manual.
2159
2160The package-specific class you choose can affect build-time performance
2161and has space ramifications. In general, building a package with IPK
2162takes about thirty percent less time as compared to using RPM to build
2163the same or similar package. This comparison takes into account a
2164complete build of the package with all dependencies previously built.
2165The reason for this discrepancy is because the RPM package manager
2166creates and processes more :term:`Metadata` than the IPK package
Andrew Geissler09036742021-06-25 14:25:14 -05002167manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
Andrew Geissler517393d2023-01-13 08:55:19 -06002168":ref:`ref-classes-package_ipk`" if you are building smaller systems.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002169
2170Before making your package manager decision, however, you should
2171consider some further things about using RPM:
2172
2173- RPM starts to provide more abilities than IPK due to the fact that it
2174 processes more Metadata. For example, this information includes
2175 individual file types, file checksum generation and evaluation on
2176 install, sparse file support, conflict detection and resolution for
2177 Multilib systems, ACID style upgrade, and repackaging abilities for
2178 rollbacks.
2179
2180- For smaller systems, the extra space used for the Berkeley Database
2181 and the amount of metadata when using RPM can affect your ability to
2182 perform on-device upgrades.
2183
2184You can find additional information on the effects of the package class
2185at these two Yocto Project mailing list links:
2186
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002187- :yocto_lists:`/pipermail/poky/2011-May/006362.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002188
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002189- :yocto_lists:`/pipermail/poky/2011-May/006363.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002190
2191.. _ref-classes-package_deb:
2192
Andrew Geissler517393d2023-01-13 08:55:19 -06002193``package_deb``
2194===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002195
Andrew Geissler517393d2023-01-13 08:55:19 -06002196The :ref:`ref-classes-package_deb` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002197use the Debian (i.e. ``.deb``) file format. The class ensures the
2198packages are written out in a ``.deb`` file format to the
2199``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
2200
Andrew Geissler517393d2023-01-13 08:55:19 -06002201This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002202is enabled through the :term:`PACKAGE_CLASSES`
2203variable in the ``local.conf`` file.
2204
2205.. _ref-classes-package_ipk:
2206
Andrew Geissler517393d2023-01-13 08:55:19 -06002207``package_ipk``
2208===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002209
Andrew Geissler517393d2023-01-13 08:55:19 -06002210The :ref:`ref-classes-package_ipk` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002211use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
2212are written out in a ``.ipk`` file format to the
2213``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
2214
Andrew Geissler517393d2023-01-13 08:55:19 -06002215This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002216is enabled through the :term:`PACKAGE_CLASSES`
2217variable in the ``local.conf`` file.
2218
2219.. _ref-classes-package_rpm:
2220
Andrew Geissler517393d2023-01-13 08:55:19 -06002221``package_rpm``
2222===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002223
Andrew Geissler517393d2023-01-13 08:55:19 -06002224The :ref:`ref-classes-package_rpm` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002225use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
2226are written out in a ``.rpm`` file format to the
2227``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
2228
Andrew Geissler517393d2023-01-13 08:55:19 -06002229This class inherits the :ref:`ref-classes-package` class and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002230is enabled through the :term:`PACKAGE_CLASSES`
2231variable in the ``local.conf`` file.
2232
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002233.. _ref-classes-packagedata:
2234
Andrew Geissler517393d2023-01-13 08:55:19 -06002235``packagedata``
2236===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002237
Andrew Geissler517393d2023-01-13 08:55:19 -06002238The :ref:`ref-classes-packagedata` class provides common functionality for reading
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002239``pkgdata`` files found in :term:`PKGDATA_DIR`. These
2240files contain information about each output package produced by the
2241OpenEmbedded build system.
2242
2243This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002244:ref:`ref-classes-package` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002245
2246.. _ref-classes-packagegroup:
2247
Andrew Geissler517393d2023-01-13 08:55:19 -06002248``packagegroup``
2249================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002250
Andrew Geissler517393d2023-01-13 08:55:19 -06002251The :ref:`ref-classes-packagegroup` class sets default values appropriate for package
Andrew Geissler09036742021-06-25 14:25:14 -05002252group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002253so forth). It is highly recommended that all package group recipes
2254inherit this class.
2255
2256For information on how to use this class, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002257":ref:`dev-manual/customizing-images:customizing images using custom package groups`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002258section in the Yocto Project Development Tasks Manual.
2259
2260Previously, this class was called the ``task`` class.
2261
2262.. _ref-classes-patch:
2263
Andrew Geissler517393d2023-01-13 08:55:19 -06002264``patch``
2265=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002266
Andrew Geissler517393d2023-01-13 08:55:19 -06002267The :ref:`ref-classes-patch` class provides all functionality for applying patches
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002268during the :ref:`ref-tasks-patch` task.
2269
2270This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002271:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002272
2273.. _ref-classes-perlnative:
2274
Andrew Geissler517393d2023-01-13 08:55:19 -06002275``perlnative``
2276==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002277
Andrew Geissler517393d2023-01-13 08:55:19 -06002278When inherited by a recipe, the :ref:`ref-classes-perlnative` class supports using the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002279native version of Perl built by the build system rather than using the
2280version provided by the build host.
2281
Patrick Williams975a06f2022-10-21 14:42:47 -05002282.. _ref-classes-pypi:
2283
Andrew Geissler517393d2023-01-13 08:55:19 -06002284``pypi``
2285========
Patrick Williams975a06f2022-10-21 14:42:47 -05002286
Andrew Geissler517393d2023-01-13 08:55:19 -06002287The :ref:`ref-classes-pypi` class sets variables appropriately for recipes that build
Patrick Williams975a06f2022-10-21 14:42:47 -05002288Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
2289By default it determines the PyPI package name based upon :term:`BPN`
2290(stripping the "python-" or "python3-" prefix off if present), however in
2291some cases you may need to set it manually in the recipe by setting
2292:term:`PYPI_PACKAGE`.
2293
Andrew Geissler517393d2023-01-13 08:55:19 -06002294Variables set by the :ref:`ref-classes-pypi` class include :term:`SRC_URI`, :term:`SECTION`,
Patrick Williams975a06f2022-10-21 14:42:47 -05002295:term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
2296and :term:`CVE_PRODUCT`.
2297
Patrick Williams45852732022-04-02 08:58:32 -05002298.. _ref-classes-python_flit_core:
2299
Andrew Geissler517393d2023-01-13 08:55:19 -06002300``python_flit_core``
2301====================
Patrick Williams45852732022-04-02 08:58:32 -05002302
Andrew Geissler517393d2023-01-13 08:55:19 -06002303The :ref:`ref-classes-python_flit_core` class enables building Python modules which declare
Patrick Williams45852732022-04-02 08:58:32 -05002304the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2305``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
2306section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2307
2308Python modules built with ``flit_core.buildapi`` are pure Python (no
2309``C`` or ``Rust`` extensions).
2310
Andrew Geissler517393d2023-01-13 08:55:19 -06002311Internally this uses the :ref:`ref-classes-python_pep517` class.
Patrick Williams45852732022-04-02 08:58:32 -05002312
Andrew Geissler9aee5002022-03-30 16:27:02 +00002313.. _ref-classes-python_pep517:
2314
Andrew Geissler517393d2023-01-13 08:55:19 -06002315``python_pep517``
2316=================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002317
Andrew Geissler517393d2023-01-13 08:55:19 -06002318The :ref:`ref-classes-python_pep517` class builds and installs a Python ``wheel`` binary
Patrick Williams45852732022-04-02 08:58:32 -05002319archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
Andrew Geissler9aee5002022-03-30 16:27:02 +00002320
Patrick Williams45852732022-04-02 08:58:32 -05002321Recipes wouldn't inherit this directly, instead typically another class will
Andrew Geissler615f2f12022-07-15 14:00:58 -05002322inherit this and add the relevant native dependencies.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002323
Andrew Geissler517393d2023-01-13 08:55:19 -06002324Examples of classes which do this are :ref:`ref-classes-python_flit_core`,
2325:ref:`ref-classes-python_setuptools_build_meta`, and
2326:ref:`ref-classes-python_poetry_core`.
Patrick Williams45852732022-04-02 08:58:32 -05002327
2328.. _ref-classes-python_poetry_core:
2329
Andrew Geissler517393d2023-01-13 08:55:19 -06002330``python_poetry_core``
2331======================
Patrick Williams45852732022-04-02 08:58:32 -05002332
Andrew Geissler517393d2023-01-13 08:55:19 -06002333The :ref:`ref-classes-python_poetry_core` class enables building Python modules which use the
Patrick Williams45852732022-04-02 08:58:32 -05002334`Poetry Core <https://python-poetry.org>`__ build system.
2335
Andrew Geissler517393d2023-01-13 08:55:19 -06002336Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002337
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002338.. _ref-classes-python_pyo3:
2339
2340``python_pyo3``
2341===============
2342
2343The :ref:`ref-classes-python_pyo3` class helps make sure that Python extensions
2344written in Rust and built with `PyO3 <https://pyo3.rs/>`__, properly set up the
2345environment for cross compilation.
2346
2347This class is internal to the :ref:`ref-classes-python-setuptools3_rust` class
2348and is not meant to be used directly in recipes.
2349
2350.. _ref-classes-python-setuptools3_rust:
2351
2352``python-setuptools3_rust``
2353===========================
2354
2355The :ref:`ref-classes-python-setuptools3_rust` class enables building Python
2356extensions implemented in Rust with `PyO3 <https://pyo3.rs/>`__, which allows
2357to compile and distribute Python extensions written in Rust as easily
2358as if they were written in C.
2359
2360This class inherits the :ref:`ref-classes-setuptools3` and
2361:ref:`ref-classes-python_pyo3` classes.
2362
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002363.. _ref-classes-pixbufcache:
2364
Andrew Geissler517393d2023-01-13 08:55:19 -06002365``pixbufcache``
2366===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002367
Andrew Geissler517393d2023-01-13 08:55:19 -06002368The :ref:`ref-classes-pixbufcache` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002369post-remove (postinst/postrm) scriptlets for packages that install
2370pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
2371call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
2372Since the cache files are architecture-specific, ``update_pixbuf_cache``
2373is run using QEMU if the postinst scriptlets need to be run on the build
2374host during image creation.
2375
2376If the pixbuf loaders being installed are in packages other than the
2377recipe's main package, set
2378:term:`PIXBUF_PACKAGES` to specify the packages
2379containing the loaders.
2380
2381.. _ref-classes-pkgconfig:
2382
Andrew Geissler517393d2023-01-13 08:55:19 -06002383``pkgconfig``
2384=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002385
Andrew Geissler517393d2023-01-13 08:55:19 -06002386The :ref:`ref-classes-pkgconfig` class provides a standard way to get header and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002387library information by using ``pkg-config``. This class aims to smooth
2388integration of ``pkg-config`` into libraries that use it.
2389
2390During staging, BitBake installs ``pkg-config`` data into the
2391``sysroots/`` directory. By making use of sysroot functionality within
Andrew Geissler517393d2023-01-13 08:55:19 -06002392``pkg-config``, the :ref:`ref-classes-pkgconfig` class no longer has to manipulate the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002393files.
2394
2395.. _ref-classes-populate-sdk:
2396
Andrew Geissler517393d2023-01-13 08:55:19 -06002397``populate_sdk``
2398================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002399
Andrew Geissler517393d2023-01-13 08:55:19 -06002400The :ref:`ref-classes-populate-sdk` class provides support for SDK-only recipes. For
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002401information on advantages gained when building a cross-development
2402toolchain using the :ref:`ref-tasks-populate_sdk`
Andrew Geissler09209ee2020-12-13 08:44:15 -06002403task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002404section in the Yocto Project Application Development and the Extensible
2405Software Development Kit (eSDK) manual.
2406
2407.. _ref-classes-populate-sdk-*:
2408
Andrew Geissler517393d2023-01-13 08:55:19 -06002409``populate_sdk_*``
2410==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002411
Andrew Geissler517393d2023-01-13 08:55:19 -06002412The :ref:`ref-classes-populate-sdk-*` classes support SDK creation and consist of the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002413following classes:
2414
Patrick Williams2390b1b2022-11-03 13:47:49 -05002415- :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002416 all package managers (i.e. DEB, RPM, and opkg).
2417
Patrick Williams2390b1b2022-11-03 13:47:49 -05002418- :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002419 package manager.
2420
Patrick Williams2390b1b2022-11-03 13:47:49 -05002421- :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002422 package manager.
2423
Patrick Williams2390b1b2022-11-03 13:47:49 -05002424- :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002425 (IPK format) package manager.
2426
Patrick Williams2390b1b2022-11-03 13:47:49 -05002427- :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002428 package managers.
2429
Patrick Williams2390b1b2022-11-03 13:47:49 -05002430The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002431``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2432:term:`IMAGE_PKGTYPE`.
2433
2434The base class ensures all source and destination directories are
2435established and then populates the SDK. After populating the SDK, the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002436:ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002437``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2438contains the cross-compiler and associated tooling, and the target,
2439which contains a target root filesystem that is configured for the SDK
2440usage. These two images reside in :term:`SDK_OUTPUT`,
Andrew Geisslerc926e172021-05-07 16:11:35 -05002441which consists of the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002442
2443 ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2444 ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2445
2446Finally, the base populate SDK class creates the toolchain environment
2447setup script, the tarball of the SDK, and the installer.
2448
Patrick Williams2390b1b2022-11-03 13:47:49 -05002449The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and
2450:ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK.
2451These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002452class.
2453
2454For more information on the cross-development toolchain generation, see
Andrew Geissler09209ee2020-12-13 08:44:15 -06002455the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002456section in the Yocto Project Overview and Concepts Manual. For
2457information on advantages gained when building a cross-development
2458toolchain using the :ref:`ref-tasks-populate_sdk`
2459task, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002460":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002461section in the Yocto Project Application Development and the Extensible
2462Software Development Kit (eSDK) manual.
2463
2464.. _ref-classes-prexport:
2465
Andrew Geissler517393d2023-01-13 08:55:19 -06002466``prexport``
2467============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002468
Andrew Geissler517393d2023-01-13 08:55:19 -06002469The :ref:`ref-classes-prexport` class provides functionality for exporting
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002470:term:`PR` values.
2471
2472.. note::
2473
2474 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002475 when using "``bitbake-prserv-tool export``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002476
2477.. _ref-classes-primport:
2478
Andrew Geissler517393d2023-01-13 08:55:19 -06002479``primport``
2480============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002481
Andrew Geissler517393d2023-01-13 08:55:19 -06002482The :ref:`ref-classes-primport` class provides functionality for importing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002483:term:`PR` values.
2484
2485.. note::
2486
2487 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002488 when using "``bitbake-prserv-tool import``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002489
2490.. _ref-classes-prserv:
2491
Andrew Geissler517393d2023-01-13 08:55:19 -06002492``prserv``
2493==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002494
Andrew Geissler517393d2023-01-13 08:55:19 -06002495The :ref:`ref-classes-prserv` class provides functionality for using a :ref:`PR
2496service <dev-manual/packages:working with a pr service>` in order to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002497automatically manage the incrementing of the :term:`PR`
2498variable for each recipe.
2499
2500This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06002501:ref:`ref-classes-package` class. However, the OpenEmbedded
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002502build system will not enable the functionality of this class unless
2503:term:`PRSERV_HOST` has been set.
2504
2505.. _ref-classes-ptest:
2506
Andrew Geissler517393d2023-01-13 08:55:19 -06002507``ptest``
2508=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002509
Andrew Geissler517393d2023-01-13 08:55:19 -06002510The :ref:`ref-classes-ptest` class provides functionality for packaging and installing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002511runtime tests for recipes that build software that provides these tests.
2512
2513This class is intended to be inherited by individual recipes. However,
2514the class' functionality is largely disabled unless "ptest" appears in
2515:term:`DISTRO_FEATURES`. See the
Andrew Geissler517393d2023-01-13 08:55:19 -06002516":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002517section in the Yocto Project Development Tasks Manual for more information
2518on ptest.
2519
2520.. _ref-classes-ptest-gnome:
2521
Andrew Geissler517393d2023-01-13 08:55:19 -06002522``ptest-gnome``
2523===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002524
2525Enables package tests (ptests) specifically for GNOME packages, which
2526have tests intended to be executed with ``gnome-desktop-testing``.
2527
2528For information on setting up and running ptests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002529":ref:`dev-manual/packages:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002530section in the Yocto Project Development Tasks Manual.
2531
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002532.. _ref-classes-python3-dir:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002533
Andrew Geissler517393d2023-01-13 08:55:19 -06002534``python3-dir``
2535===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002536
Andrew Geissler517393d2023-01-13 08:55:19 -06002537The :ref:`ref-classes-python3-dir` class provides the base version, location, and site
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002538package location for Python 3.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002539
2540.. _ref-classes-python3native:
2541
Andrew Geissler517393d2023-01-13 08:55:19 -06002542``python3native``
2543=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002544
Andrew Geissler517393d2023-01-13 08:55:19 -06002545The :ref:`ref-classes-python3native` class supports using the native version of Python
Andrew Geisslerc9f78652020-09-18 14:11:35 -050025463 built by the build system rather than support of the version provided
2547by the build host.
2548
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002549.. _ref-classes-python3targetconfig:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002550
Andrew Geissler517393d2023-01-13 08:55:19 -06002551``python3targetconfig``
2552=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002553
Andrew Geissler517393d2023-01-13 08:55:19 -06002554The :ref:`ref-classes-python3targetconfig` class supports using the native version of Python
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050025553 built by the build system rather than support of the version provided
2556by the build host, except that the configuration for the target machine
2557is accessible (such as correct installation directories). This also adds a
2558dependency on target ``python3``, so should only be used where appropriate
2559in order to avoid unnecessarily lengthening builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002560
2561.. _ref-classes-qemu:
2562
Andrew Geissler517393d2023-01-13 08:55:19 -06002563``qemu``
2564========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002565
Andrew Geissler517393d2023-01-13 08:55:19 -06002566The :ref:`ref-classes-qemu` class provides functionality for recipes that either need
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002567QEMU or test for the existence of QEMU. Typically, this class is used to
2568run programs for a target system on the build host using QEMU's
2569application emulation mode.
2570
2571.. _ref-classes-recipe_sanity:
2572
Andrew Geissler517393d2023-01-13 08:55:19 -06002573``recipe_sanity``
2574=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002575
Andrew Geissler517393d2023-01-13 08:55:19 -06002576The :ref:`ref-classes-recipe_sanity` class checks for the presence of any host system
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002577recipe prerequisites that might affect the build (e.g. variables that
2578are set or software that is present).
2579
2580.. _ref-classes-relocatable:
2581
Andrew Geissler517393d2023-01-13 08:55:19 -06002582``relocatable``
2583===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002584
Andrew Geissler517393d2023-01-13 08:55:19 -06002585The :ref:`ref-classes-relocatable` class enables relocation of binaries when they are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002586installed into the sysroot.
2587
Andrew Geissler517393d2023-01-13 08:55:19 -06002588This class makes use of the :ref:`ref-classes-chrpath` class and is used by
2589both the :ref:`ref-classes-cross` and :ref:`ref-classes-native` classes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002590
2591.. _ref-classes-remove-libtool:
2592
Andrew Geissler517393d2023-01-13 08:55:19 -06002593``remove-libtool``
2594==================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002595
Andrew Geissler517393d2023-01-13 08:55:19 -06002596The :ref:`ref-classes-remove-libtool` class adds a post function to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002597:ref:`ref-tasks-install` task to remove all ``.la`` files
2598installed by ``libtool``. Removing these files results in them being
2599absent from both the sysroot and target packages.
2600
2601If a recipe needs the ``.la`` files to be installed, then the recipe can
Andrew Geisslerc926e172021-05-07 16:11:35 -05002602override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002603
2604 REMOVE_LIBTOOL_LA = "0"
2605
2606.. note::
2607
Andrew Geissler517393d2023-01-13 08:55:19 -06002608 The :ref:`ref-classes-remove-libtool` class is not enabled by default.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002609
2610.. _ref-classes-report-error:
2611
Andrew Geissler517393d2023-01-13 08:55:19 -06002612``report-error``
2613================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002614
Andrew Geissler517393d2023-01-13 08:55:19 -06002615The :ref:`ref-classes-report-error` class supports enabling the :ref:`error reporting
2616tool <dev-manual/error-reporting-tool:using the error reporting tool>`",
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002617which allows you to submit build error information to a central database.
2618
2619The class collects debug information for recipe, recipe version, task,
2620machine, distro, build system, target system, host distro, branch,
2621commit, and log. From the information, report files using a JSON format
2622are created and stored in
2623``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2624
2625.. _ref-classes-rm-work:
2626
Andrew Geissler517393d2023-01-13 08:55:19 -06002627``rm_work``
2628===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002629
Andrew Geissler517393d2023-01-13 08:55:19 -06002630The :ref:`ref-classes-rm-work` class supports deletion of temporary workspace, which
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002631can ease your hard drive demands during builds.
2632
2633The OpenEmbedded build system can use a substantial amount of disk space
2634during the build process. A portion of this space is the work files
2635under the ``${TMPDIR}/work`` directory for each recipe. Once the build
2636system generates the packages for a recipe, the work files for that
2637recipe are no longer needed. However, by default, the build system
2638preserves these files for inspection and possible debugging purposes. If
Andrew Geissler517393d2023-01-13 08:55:19 -06002639you would rather have these files deleted to save disk space as the build
2640progresses, you can enable :ref:`ref-classes-rm-work` by adding the following to
Patrick Williams2390b1b2022-11-03 13:47:49 -05002641your ``local.conf`` file, which is found in the :term:`Build Directory`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002642
2643 INHERIT += "rm_work"
2644
Andrew Geissler517393d2023-01-13 08:55:19 -06002645If you are modifying and building source code out of the work directory for a
2646recipe, enabling :ref:`ref-classes-rm-work` will potentially result in your
2647changes to the source being lost. To exclude some recipes from having their work
2648directories deleted by :ref:`ref-classes-rm-work`, you can add the names of the
2649recipe or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable,
2650which can also be set in your ``local.conf`` file. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002651
2652 RM_WORK_EXCLUDE += "busybox glibc"
2653
2654.. _ref-classes-rootfs*:
2655
Andrew Geissler517393d2023-01-13 08:55:19 -06002656``rootfs*``
2657===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002658
Andrew Geissler517393d2023-01-13 08:55:19 -06002659The :ref:`ref-classes-rootfs*` classes support creating the root filesystem for an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002660image and consist of the following classes:
2661
Patrick Williams2390b1b2022-11-03 13:47:49 -05002662- The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002663 post-processing functions for image recipes.
2664
Patrick Williams2390b1b2022-11-03 13:47:49 -05002665- The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002666 for images built using ``.deb`` packages.
2667
Patrick Williams2390b1b2022-11-03 13:47:49 -05002668- The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002669 for images built using ``.rpm`` packages.
2670
Patrick Williams2390b1b2022-11-03 13:47:49 -05002671- The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002672 for images built using ``.ipk`` packages.
2673
Patrick Williams2390b1b2022-11-03 13:47:49 -05002674- The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002675 on the build host directly into the root filesystem.
2676
2677The root filesystem is created from packages using one of the
Andrew Geissler517393d2023-01-13 08:55:19 -06002678:ref:`ref-classes-rootfs*` files as determined by the :term:`PACKAGE_CLASSES`
2679variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002680
2681For information on how root filesystem images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002682":ref:`overview-manual/concepts:image generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002683section in the Yocto Project Overview and Concepts Manual.
2684
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06002685.. _ref-classes-rust:
2686
2687``rust``
2688========
2689
2690The :ref:`ref-classes-rust` class is an internal class which is just used
2691in the "rust" recipe, to build the Rust compiler and runtime
2692library. Except for this recipe, it is not intended to be used directly.
2693
2694.. _ref-classes-rust-common:
2695
2696``rust-common``
2697===============
2698
2699The :ref:`ref-classes-rust-common` class is an internal class to the
2700:ref:`ref-classes-cargo_common` and :ref:`ref-classes-rust` classes and is not
2701intended to be used directly.
2702
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002703.. _ref-classes-sanity:
2704
Andrew Geissler517393d2023-01-13 08:55:19 -06002705``sanity``
2706==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002707
Andrew Geissler517393d2023-01-13 08:55:19 -06002708The :ref:`ref-classes-sanity` class checks to see if prerequisite software is present
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002709on the host system so that users can be notified of potential problems
2710that might affect their build. The class also performs basic user
2711configuration checks from the ``local.conf`` configuration file to
2712prevent common mistakes that cause build failures. Distribution policy
2713usually determines whether to include this class.
2714
2715.. _ref-classes-scons:
2716
Andrew Geissler517393d2023-01-13 08:55:19 -06002717``scons``
2718=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002719
Andrew Geissler517393d2023-01-13 08:55:19 -06002720The :ref:`ref-classes-scons` class supports recipes that need to build software
2721that uses the SCons build system. You can use the :term:`EXTRA_OESCONS`
2722variable to specify additional configuration options you want to pass SCons
2723command line.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002724
2725.. _ref-classes-sdl:
2726
Andrew Geissler517393d2023-01-13 08:55:19 -06002727``sdl``
2728=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002729
Andrew Geissler517393d2023-01-13 08:55:19 -06002730The :ref:`ref-classes-sdl` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002731the Simple DirectMedia Layer (SDL) library.
2732
Patrick Williams45852732022-04-02 08:58:32 -05002733.. _ref-classes-python_setuptools_build_meta:
Andrew Geissler9aee5002022-03-30 16:27:02 +00002734
Andrew Geissler517393d2023-01-13 08:55:19 -06002735``python_setuptools_build_meta``
2736================================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002737
Andrew Geissler517393d2023-01-13 08:55:19 -06002738The :ref:`ref-classes-python_setuptools_build_meta` class enables building
2739Python modules which declare the
Andrew Geissler9aee5002022-03-30 16:27:02 +00002740`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2741``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
2742section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2743
2744Python modules built with ``setuptools.build_meta`` can be pure Python or
2745include ``C`` or ``Rust`` extensions).
2746
Andrew Geissler517393d2023-01-13 08:55:19 -06002747Internally this uses the :ref:`ref-classes-python_pep517` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002748
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002749.. _ref-classes-setuptools3:
2750
Andrew Geissler517393d2023-01-13 08:55:19 -06002751``setuptools3``
2752===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002753
Andrew Geissler517393d2023-01-13 08:55:19 -06002754The :ref:`ref-classes-setuptools3` class supports Python version 3.x extensions
2755that use build systems based on ``setuptools`` (e.g. only have a ``setup.py``
2756and have not migrated to the official ``pyproject.toml`` format). If your recipe
2757uses these build systems, the recipe needs to inherit the
2758:ref:`ref-classes-setuptools3` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002759
2760 .. note::
2761
Andrew Geissler517393d2023-01-13 08:55:19 -06002762 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-compile` task now calls
Andrew Geissler9aee5002022-03-30 16:27:02 +00002763 ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
2764 (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
2765
2766 A consequence of this is that legacy software still using deprecated
2767 ``distutils`` from the Python standard library cannot be packaged as
2768 ``wheels``. A common solution is the replace
2769 ``from distutils.core import setup`` with ``from setuptools import setup``.
2770
2771 .. note::
2772
Andrew Geissler517393d2023-01-13 08:55:19 -06002773 The :ref:`ref-classes-setuptools3` class :ref:`ref-tasks-install` task now
2774 installs the ``wheel`` binary archive. In current versions of
2775 ``setuptools`` the legacy ``setup.py install`` method is deprecated. If
2776 the ``setup.py`` cannot be used with wheels, for example it creates files
2777 outside of the Python module or standard entry points, then
2778 :ref:`ref-classes-setuptools3_legacy` should be used.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002779
2780.. _ref-classes-setuptools3_legacy:
2781
Andrew Geissler517393d2023-01-13 08:55:19 -06002782``setuptools3_legacy``
2783======================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002784
Andrew Geissler517393d2023-01-13 08:55:19 -06002785The :ref:`ref-classes-setuptools3_legacy` class supports
2786Python version 3.x extensions that use build systems based on ``setuptools``
2787(e.g. only have a ``setup.py`` and have not migrated to the official
2788``pyproject.toml`` format). Unlike :ref:`ref-classes-setuptools3`,
2789this uses the traditional ``setup.py`` ``build`` and ``install`` commands and
2790not wheels. This use of ``setuptools`` like this is
Patrick Williams2390b1b2022-11-03 13:47:49 -05002791`deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__
Andrew Geissler9aee5002022-03-30 16:27:02 +00002792but still relatively common.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002793
Andrew Geissler595f6302022-01-24 19:11:47 +00002794.. _ref-classes-setuptools3-base:
2795
Andrew Geissler517393d2023-01-13 08:55:19 -06002796``setuptools3-base``
2797====================
Andrew Geissler595f6302022-01-24 19:11:47 +00002798
Andrew Geissler517393d2023-01-13 08:55:19 -06002799The :ref:`ref-classes-setuptools3-base` class provides a reusable base for
2800other classes that support building Python version 3.x extensions. If you need
2801functionality that is not provided by the :ref:`ref-classes-setuptools3` class,
2802you may want to ``inherit setuptools3-base``. Some recipes do not need the tasks
2803in the :ref:`ref-classes-setuptools3` class and inherit this class instead.
Andrew Geissler595f6302022-01-24 19:11:47 +00002804
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002805.. _ref-classes-sign_rpm:
2806
Andrew Geissler517393d2023-01-13 08:55:19 -06002807``sign_rpm``
2808============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002809
Andrew Geissler517393d2023-01-13 08:55:19 -06002810The :ref:`ref-classes-sign_rpm` class supports generating signed RPM packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002811
2812.. _ref-classes-siteconfig:
2813
Andrew Geissler517393d2023-01-13 08:55:19 -06002814``siteconfig``
2815==============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002816
Andrew Geissler517393d2023-01-13 08:55:19 -06002817The :ref:`ref-classes-siteconfig` class provides functionality for handling site
2818configuration. The class is used by the :ref:`ref-classes-autotools` class to
2819accelerate the :ref:`ref-tasks-configure` task.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002820
2821.. _ref-classes-siteinfo:
2822
Andrew Geissler517393d2023-01-13 08:55:19 -06002823``siteinfo``
2824============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002825
Andrew Geissler517393d2023-01-13 08:55:19 -06002826The :ref:`ref-classes-siteinfo` class provides information about the targets
2827that might be needed by other classes or recipes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002828
2829As an example, consider Autotools, which can require tests that must
2830execute on the target hardware. Since this is not possible in general
2831when cross compiling, site information is used to provide cached test
2832results so these tests can be skipped over but still make the correct
2833values available. The ``meta/site directory`` contains test results
2834sorted into different categories such as architecture, endianness, and
2835the ``libc`` used. Site information provides a list of files containing
Andrew Geissler09036742021-06-25 14:25:14 -05002836data relevant to the current build in the :term:`CONFIG_SITE` variable that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002837Autotools automatically picks up.
2838
Andrew Geissler09036742021-06-25 14:25:14 -05002839The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
2840:term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002841
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002842.. _ref-classes-sstate:
2843
Andrew Geissler517393d2023-01-13 08:55:19 -06002844``sstate``
2845==========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002846
Andrew Geissler517393d2023-01-13 08:55:19 -06002847The :ref:`ref-classes-sstate` class provides support for Shared State (sstate).
2848By default, the class is enabled through the :term:`INHERIT_DISTRO` variable's
2849default value.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002850
2851For more information on sstate, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002852":ref:`overview-manual/concepts:shared state cache`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002853section in the Yocto Project Overview and Concepts Manual.
2854
2855.. _ref-classes-staging:
2856
Andrew Geissler517393d2023-01-13 08:55:19 -06002857``staging``
2858===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002859
Andrew Geissler517393d2023-01-13 08:55:19 -06002860The :ref:`ref-classes-staging` class installs files into individual recipe work
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002861directories for sysroots. The class contains the following key tasks:
2862
2863- The :ref:`ref-tasks-populate_sysroot` task,
2864 which is responsible for handing the files that end up in the recipe
2865 sysroots.
2866
2867- The
2868 :ref:`ref-tasks-prepare_recipe_sysroot`
2869 task (a "partner" task to the ``populate_sysroot`` task), which
2870 installs the files into the individual recipe work directories (i.e.
2871 :term:`WORKDIR`).
2872
Andrew Geissler517393d2023-01-13 08:55:19 -06002873The code in the :ref:`ref-classes-staging` class is complex and basically works
2874in two stages:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002875
2876- *Stage One:* The first stage addresses recipes that have files they
2877 want to share with other recipes that have dependencies on the
2878 originating recipe. Normally these dependencies are installed through
2879 the :ref:`ref-tasks-install` task into
Patrick Williams2194f502022-10-16 14:26:09 -05002880 ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002881 copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
2882 subset of files is controlled by the
2883 :term:`SYSROOT_DIRS`,
2884 :term:`SYSROOT_DIRS_NATIVE`, and
Andrew Geissler9aee5002022-03-30 16:27:02 +00002885 :term:`SYSROOT_DIRS_IGNORE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002886 variables.
2887
2888 .. note::
2889
2890 Additionally, a recipe can customize the files further by
Andrew Geissler09036742021-06-25 14:25:14 -05002891 declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002892 variable.
2893
2894 A shared state (sstate) object is built from these files and the
2895 files are placed into a subdirectory of
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002896 :ref:`structure-build-tmp-sysroots-components`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002897 The files are scanned for hardcoded paths to the original
2898 installation location. If the location is found in text files, the
2899 hardcoded locations are replaced by tokens and a list of the files
2900 needing such replacements is created. These adjustments are referred
2901 to as "FIXMEs". The list of files that are scanned for paths is
2902 controlled by the :term:`SSTATE_SCAN_FILES`
2903 variable.
2904
2905- *Stage Two:* The second stage addresses recipes that want to use
2906 something from another recipe and declare a dependency on that recipe
2907 through the :term:`DEPENDS` variable. The recipe will
2908 have a
2909 :ref:`ref-tasks-prepare_recipe_sysroot`
2910 task and when this task executes, it creates the ``recipe-sysroot``
2911 and ``recipe-sysroot-native`` in the recipe work directory (i.e.
2912 :term:`WORKDIR`). The OpenEmbedded build system
2913 creates hard links to copies of the relevant files from
2914 ``sysroots-components`` into the recipe work directory.
2915
2916 .. note::
2917
2918 If hard links are not possible, the build system uses actual
2919 copies.
2920
2921 The build system then addresses any "FIXMEs" to paths as defined from
2922 the list created in the first stage.
2923
2924 Finally, any files in ``${bindir}`` within the sysroot that have the
2925 prefix "``postinst-``" are executed.
2926
2927 .. note::
2928
2929 Although such sysroot post installation scripts are not
2930 recommended for general use, the files do allow some issues such
2931 as user creation and module indexes to be addressed.
2932
Andrew Geissler09036742021-06-25 14:25:14 -05002933 Because recipes can have other dependencies outside of :term:`DEPENDS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002934 (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
2935 the sysroot creation function ``extend_recipe_sysroot`` is also added
2936 as a pre-function for those tasks whose dependencies are not through
Andrew Geissler09036742021-06-25 14:25:14 -05002937 :term:`DEPENDS` but operate similarly.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002938
2939 When installing dependencies into the sysroot, the code traverses the
2940 dependency graph and processes dependencies in exactly the same way
2941 as the dependencies would or would not be when installed from sstate.
2942 This processing means, for example, a native tool would have its
2943 native dependencies added but a target library would not have its
2944 dependencies traversed or installed. The same sstate dependency code
2945 is used so that builds should be identical regardless of whether
2946 sstate was used or not. For a closer look, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06002947 ``setscene_depvalid()`` function in the :ref:`ref-classes-sstate` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002948
2949 The build system is careful to maintain manifests of the files it
2950 installs so that any given dependency can be installed as needed. The
2951 sstate hash of the installed item is also stored so that if it
2952 changes, the build system can reinstall it.
2953
2954.. _ref-classes-syslinux:
2955
Andrew Geissler517393d2023-01-13 08:55:19 -06002956``syslinux``
2957============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002958
Andrew Geissler517393d2023-01-13 08:55:19 -06002959The :ref:`ref-classes-syslinux` class provides syslinux-specific functions for
2960building bootable images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002961
2962The class supports the following variables:
2963
2964- :term:`INITRD`: Indicates list of filesystem images to
2965 concatenate and use as an initial RAM disk (initrd). This variable is
2966 optional.
2967
2968- :term:`ROOTFS`: Indicates a filesystem image to include
2969 as the root filesystem. This variable is optional.
2970
2971- :term:`AUTO_SYSLINUXMENU`: Enables creating
2972 an automatic menu when set to "1".
2973
2974- :term:`LABELS`: Lists targets for automatic
2975 configuration.
2976
2977- :term:`APPEND`: Lists append string overrides for each
2978 label.
2979
2980- :term:`SYSLINUX_OPTS`: Lists additional options
2981 to add to the syslinux file. Semicolon characters separate multiple
2982 options.
2983
2984- :term:`SYSLINUX_SPLASH`: Lists a background
2985 for the VGA boot menu when you are using the boot menu.
2986
2987- :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
2988 to "console=ttyX" to change kernel boot default console.
2989
2990- :term:`SYSLINUX_SERIAL`: Sets an alternate
2991 serial port. Or, turns off serial when the variable is set with an
2992 empty string.
2993
2994- :term:`SYSLINUX_SERIAL_TTY`: Sets an
2995 alternate "console=tty..." kernel boot argument.
2996
2997.. _ref-classes-systemd:
2998
Andrew Geissler517393d2023-01-13 08:55:19 -06002999``systemd``
3000===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003001
Andrew Geissler517393d2023-01-13 08:55:19 -06003002The :ref:`ref-classes-systemd` class provides support for recipes that install
3003systemd unit files.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003004
3005The functionality for this class is disabled unless you have "systemd"
3006in :term:`DISTRO_FEATURES`.
3007
3008Under this class, the recipe or Makefile (i.e. whatever the recipe is
3009calling during the :ref:`ref-tasks-install` task)
3010installs unit files into
3011``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
3012files being installed go into packages other than the main package, you
3013need to set :term:`SYSTEMD_PACKAGES` in your
3014recipe to identify the packages in which the files will be installed.
3015
3016You should set :term:`SYSTEMD_SERVICE` to the
3017name of the service file. You should also use a package name override to
3018indicate the package to which the value applies. If the value applies to
3019the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
Andrew Geisslerc926e172021-05-07 16:11:35 -05003020is an example from the connman recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003021
Patrick Williams0ca19cc2021-08-16 14:03:13 -05003022 SYSTEMD_SERVICE:${PN} = "connman.service"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003023
3024Services are set up to start on boot automatically
3025unless you have set
3026:term:`SYSTEMD_AUTO_ENABLE` to "disable".
3027
Andrew Geissler517393d2023-01-13 08:55:19 -06003028For more information on :ref:`ref-classes-systemd`, see the
3029":ref:`dev-manual/init-manager:selecting an initialization manager`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003030section in the Yocto Project Development Tasks Manual.
3031
3032.. _ref-classes-systemd-boot:
3033
Andrew Geissler517393d2023-01-13 08:55:19 -06003034``systemd-boot``
3035================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003036
Andrew Geissler517393d2023-01-13 08:55:19 -06003037The :ref:`ref-classes-systemd-boot` class provides functions specific to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003038systemd-boot bootloader for building bootable images. This is an
3039internal class and is not intended to be used directly.
3040
3041.. note::
3042
Andrew Geissler517393d2023-01-13 08:55:19 -06003043 The :ref:`ref-classes-systemd-boot` class is a result from merging the ``gummiboot`` class
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003044 used in previous Yocto Project releases with the ``systemd`` project.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003045
Andrew Geissler517393d2023-01-13 08:55:19 -06003046Set the :term:`EFI_PROVIDER` variable to ":ref:`ref-classes-systemd-boot`" to
3047use this class. Doing so creates a standalone EFI bootloader that is not
3048dependent on systemd.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003049
3050For information on more variables used and supported in this class, see
3051the :term:`SYSTEMD_BOOT_CFG`,
3052:term:`SYSTEMD_BOOT_ENTRIES`, and
3053:term:`SYSTEMD_BOOT_TIMEOUT` variables.
3054
3055You can also see the `Systemd-boot
Andrew Geisslerd1e89492021-02-12 15:35:20 -06003056documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003057for more information.
3058
3059.. _ref-classes-terminal:
3060
Andrew Geissler517393d2023-01-13 08:55:19 -06003061``terminal``
3062============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003063
Andrew Geissler517393d2023-01-13 08:55:19 -06003064The :ref:`ref-classes-terminal` class provides support for starting a terminal
3065session. The :term:`OE_TERMINAL` variable controls which terminal emulator is
3066used for the session.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003067
Andrew Geissler517393d2023-01-13 08:55:19 -06003068Other classes use the :ref:`ref-classes-terminal` class anywhere a separate
3069terminal session needs to be started. For example, the :ref:`ref-classes-patch`
3070class assuming :term:`PATCHRESOLVE` is set to "user", the
3071:ref:`ref-classes-cml1` class, and the :ref:`ref-classes-devshell` class all
3072use the :ref:`ref-classes-terminal` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003073
Patrick Williams975a06f2022-10-21 14:42:47 -05003074.. _ref-classes-testimage:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003075
Andrew Geissler517393d2023-01-13 08:55:19 -06003076``testimage``
3077=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003078
Andrew Geissler517393d2023-01-13 08:55:19 -06003079The :ref:`ref-classes-testimage` class supports running automated tests against
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003080images using QEMU and on actual hardware. The classes handle loading the
3081tests and starting the image. To use the classes, you need to perform
3082steps to set up the environment.
3083
Patrick Williams975a06f2022-10-21 14:42:47 -05003084To enable this class, add the following to your configuration::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003085
Patrick Williams975a06f2022-10-21 14:42:47 -05003086 IMAGE_CLASSES += "testimage"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003087
3088The tests are commands that run on the target system over ``ssh``. Each
3089test is written in Python and makes use of the ``unittest`` module.
3090
Andrew Geissler517393d2023-01-13 08:55:19 -06003091The :ref:`ref-classes-testimage` class runs tests on an image when called using the
Andrew Geisslerc926e172021-05-07 16:11:35 -05003092following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003093
3094 $ bitbake -c testimage image
3095
Patrick Williams975a06f2022-10-21 14:42:47 -05003096Alternatively, if you wish to have tests automatically run for each image
3097after it is built, you can set :term:`TESTIMAGE_AUTO`::
3098
3099 TESTIMAGE_AUTO = "1"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003100
3101For information on how to enable, run, and create new tests, see the
Andrew Geissler517393d2023-01-13 08:55:19 -06003102":ref:`dev-manual/runtime-testing:performing automated runtime testing`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003103section in the Yocto Project Development Tasks Manual.
3104
3105.. _ref-classes-testsdk:
3106
Andrew Geissler517393d2023-01-13 08:55:19 -06003107``testsdk``
3108===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003109
3110This class supports running automated tests against software development
Andrew Geissler517393d2023-01-13 08:55:19 -06003111kits (SDKs). The :ref:`ref-classes-testsdk` class runs tests on an SDK when called
Andrew Geisslerc926e172021-05-07 16:11:35 -05003112using the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003113
3114 $ bitbake -c testsdk image
3115
3116.. note::
3117
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003118 Best practices include using :term:`IMAGE_CLASSES` rather than
Andrew Geissler517393d2023-01-13 08:55:19 -06003119 :term:`INHERIT` to inherit the :ref:`ref-classes-testsdk` class for automated SDK
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003120 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003121
3122.. _ref-classes-texinfo:
3123
Andrew Geissler517393d2023-01-13 08:55:19 -06003124``texinfo``
3125===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003126
3127This class should be inherited by recipes whose upstream packages invoke
3128the ``texinfo`` utilities at build-time. Native and cross recipes are
3129made to use the dummy scripts provided by ``texinfo-dummy-native``, for
3130improved performance. Target architecture recipes use the genuine
3131Texinfo utilities. By default, they use the Texinfo utilities on the
3132host system.
3133
3134.. note::
3135
3136 If you want to use the Texinfo recipe shipped with the build system,
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003137 you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
3138 from :term:`SANITY_REQUIRED_UTILITIES`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003139
3140.. _ref-classes-toaster:
3141
Andrew Geissler517393d2023-01-13 08:55:19 -06003142``toaster``
3143===========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003144
Andrew Geissler517393d2023-01-13 08:55:19 -06003145The :ref:`ref-classes-toaster` class collects information about packages and images and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003146sends them as events that the BitBake user interface can receive. The
3147class is enabled when the Toaster user interface is running.
3148
3149This class is not intended to be used directly.
3150
3151.. _ref-classes-toolchain-scripts:
3152
Andrew Geissler517393d2023-01-13 08:55:19 -06003153``toolchain-scripts``
3154=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003155
Andrew Geissler517393d2023-01-13 08:55:19 -06003156The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003157the environment for installed SDKs.
3158
3159.. _ref-classes-typecheck:
3160
Andrew Geissler517393d2023-01-13 08:55:19 -06003161``typecheck``
3162=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003163
Andrew Geissler517393d2023-01-13 08:55:19 -06003164The :ref:`ref-classes-typecheck` class provides support for validating the values of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003165variables set at the configuration level against their defined types.
3166The OpenEmbedded build system allows you to define the type of a
Andrew Geisslerc926e172021-05-07 16:11:35 -05003167variable using the "type" varflag. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003168
3169 IMAGE_FEATURES[type] = "list"
3170
3171.. _ref-classes-uboot-config:
3172
Andrew Geissler517393d2023-01-13 08:55:19 -06003173``uboot-config``
3174================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003175
Andrew Geissler517393d2023-01-13 08:55:19 -06003176The :ref:`ref-classes-uboot-config` class provides support for U-Boot configuration for
Andrew Geisslerc926e172021-05-07 16:11:35 -05003177a machine. Specify the machine in your recipe as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003178
3179 UBOOT_CONFIG ??= <default>
3180 UBOOT_CONFIG[foo] = "config,images"
3181
Andrew Geisslerc926e172021-05-07 16:11:35 -05003182You can also specify the machine using this method::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003183
3184 UBOOT_MACHINE = "config"
3185
3186See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
3187information.
3188
Patrick Williamsb542dec2023-06-09 01:26:37 -05003189.. _ref-classes-uboot-sign:
3190
3191``uboot-sign``
3192==============
3193
3194The :ref:`ref-classes-uboot-sign` class provides support for U-Boot verified boot.
3195It is intended to be inherited from U-Boot recipes.
3196
3197Here are variables used by this class:
3198
3199- :term:`SPL_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3200 building the FIT image.
3201- :term:`SPL_SIGN_ENABLE`: enable signing the FIT image.
3202- :term:`SPL_SIGN_KEYDIR`: directory containing the signing keys.
3203- :term:`SPL_SIGN_KEYNAME`: base filename of the signing keys.
3204- :term:`UBOOT_FIT_ADDRESS_CELLS`: ``#address-cells`` value for the FIT image.
3205- :term:`UBOOT_FIT_DESC`: description string encoded into the FIT image.
3206- :term:`UBOOT_FIT_GENERATE_KEYS`: generate the keys if they don't exist yet.
3207- :term:`UBOOT_FIT_HASH_ALG`: hash algorithm for the FIT image.
3208- :term:`UBOOT_FIT_KEY_GENRSA_ARGS`: ``openssl genrsa`` arguments.
3209- :term:`UBOOT_FIT_KEY_REQ_ARGS`: ``openssl req`` arguments.
3210- :term:`UBOOT_FIT_SIGN_ALG`: signature algorithm for the FIT image.
3211- :term:`UBOOT_FIT_SIGN_NUMBITS`: size of the private key for FIT image
3212 signing.
3213- :term:`UBOOT_FIT_KEY_SIGN_PKCS`: algorithm for the public key certificate
3214 for FIT image signing.
3215- :term:`UBOOT_FITIMAGE_ENABLE`: enable the generation of a U-Boot FIT image.
3216- :term:`UBOOT_MKIMAGE_DTCOPTS`: DTC options for U-Boot ``mkimage`` when
3217 rebuilding the FIT image containing the kernel.
3218
3219See U-Boot's documentation for details about `verified boot
3220<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/verified-boot.txt>`__
3221and the `signature process
3222<https://source.denx.de/u-boot/u-boot/-/blob/master/doc/uImage.FIT/signature.txt>`__.
3223
3224See also the description of :ref:`ref-classes-kernel-fitimage` class, which this class
3225imitates.
3226
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003227.. _ref-classes-uninative:
3228
Andrew Geissler517393d2023-01-13 08:55:19 -06003229``uninative``
3230=============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003231
3232Attempts to isolate the build system from the host distribution's C
3233library in order to make re-use of native shared state artifacts across
3234different host distributions practical. With this class enabled, a
3235tarball containing a pre-built C library is downloaded at the start of
3236the build. In the Poky reference distribution this is enabled by default
3237through ``meta/conf/distro/include/yocto-uninative.inc``. Other
3238distributions that do not derive from poky can also
3239"``require conf/distro/include/yocto-uninative.inc``" to use this.
3240Alternatively if you prefer, you can build the uninative-tarball recipe
3241yourself, publish the resulting tarball (e.g. via HTTP) and set
3242``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
3243example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
3244
Andrew Geissler517393d2023-01-13 08:55:19 -06003245The :ref:`ref-classes-uninative` class is also used unconditionally by the extensible
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003246SDK. When building the extensible SDK, ``uninative-tarball`` is built
3247and the resulting tarball is included within the SDK.
3248
3249.. _ref-classes-update-alternatives:
3250
Andrew Geissler517393d2023-01-13 08:55:19 -06003251``update-alternatives``
3252=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003253
Andrew Geissler517393d2023-01-13 08:55:19 -06003254The :ref:`ref-classes-update-alternatives` class helps the alternatives system when
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003255multiple sources provide the same command. This situation occurs when
3256several programs that have the same or similar function are installed
3257with the same name. For example, the ``ar`` command is available from
3258the ``busybox``, ``binutils`` and ``elfutils`` packages. The
Andrew Geissler517393d2023-01-13 08:55:19 -06003259:ref:`ref-classes-update-alternatives` class handles renaming the binaries so that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003260multiple packages can be installed without conflicts. The ``ar`` command
3261still works regardless of which packages are installed or subsequently
3262removed. The class renames the conflicting binary in each package and
3263symlinks the highest priority binary during installation or removal of
3264packages.
3265
3266To use this class, you need to define a number of variables:
3267
3268- :term:`ALTERNATIVE`
3269
3270- :term:`ALTERNATIVE_LINK_NAME`
3271
3272- :term:`ALTERNATIVE_TARGET`
3273
3274- :term:`ALTERNATIVE_PRIORITY`
3275
3276These variables list alternative commands needed by a package, provide
3277pathnames for links, default links for targets, and so forth. For
3278details on how to use this class, see the comments in the
Patrick Williams975a06f2022-10-21 14:42:47 -05003279:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003280file.
3281
3282.. note::
3283
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003284 You can use the ``update-alternatives`` command directly in your recipes.
3285 However, this class simplifies things in most cases.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003286
3287.. _ref-classes-update-rc.d:
3288
Andrew Geissler517393d2023-01-13 08:55:19 -06003289``update-rc.d``
3290===============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003291
Andrew Geissler517393d2023-01-13 08:55:19 -06003292The :ref:`ref-classes-update-rc.d` class uses ``update-rc.d`` to safely install an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003293initialization script on behalf of the package. The OpenEmbedded build
3294system takes care of details such as making sure the script is stopped
3295before a package is removed and started when the package is installed.
3296
Andrew Geissler09036742021-06-25 14:25:14 -05003297Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
3298:term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003299for details.
3300
3301.. _ref-classes-useradd:
3302
Andrew Geissler517393d2023-01-13 08:55:19 -06003303``useradd*``
3304============
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003305
Patrick Williams2390b1b2022-11-03 13:47:49 -05003306The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003307usage by the package on the target. For example, if you have packages
3308that contain system services that should be run under their own user or
3309group, you can use these classes to enable creation of the user or
Andrew Geissler595f6302022-01-24 19:11:47 +00003310group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
3311</openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003312recipe in the :term:`Source Directory` provides a simple
3313example that shows how to add three users and groups to two packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003314
Patrick Williams2390b1b2022-11-03 13:47:49 -05003315The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003316groups settings.
3317
Patrick Williams2390b1b2022-11-03 13:47:49 -05003318The :ref:`useradd* <ref-classes-useradd>` classes support the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003319:term:`USERADD_PACKAGES`,
3320:term:`USERADD_PARAM`,
3321:term:`GROUPADD_PARAM`, and
3322:term:`GROUPMEMS_PARAM` variables.
3323
Patrick Williams2390b1b2022-11-03 13:47:49 -05003324The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003325that have static user identification (``uid``) and group identification
3326(``gid``) values.
3327
3328The default behavior of the OpenEmbedded build system for assigning
3329``uid`` and ``gid`` values when packages add users and groups during
3330package install time is to add them dynamically. This works fine for
3331programs that do not care what the values of the resulting users and
3332groups become. In these cases, the order of the installation determines
3333the final ``uid`` and ``gid`` values. However, if non-deterministic
3334``uid`` and ``gid`` values are a problem, you can override the default,
3335dynamic application of these values by setting static values. When you
3336set static values, the OpenEmbedded build system looks in
3337:term:`BBPATH` for ``files/passwd`` and ``files/group``
3338files for the values.
3339
Andrew Geissler517393d2023-01-13 08:55:19 -06003340To use static ``uid`` and ``gid`` values, you need to set some variables. See
3341the :term:`USERADDEXTENSION`, :term:`USERADD_UID_TABLES`,
3342:term:`USERADD_GID_TABLES`, and :term:`USERADD_ERROR_DYNAMIC` variables.
3343You can also see the :ref:`ref-classes-useradd` class for additional
3344information.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003345
3346.. note::
3347
Patrick Williams2390b1b2022-11-03 13:47:49 -05003348 You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable
Andrew Geissler09036742021-06-25 14:25:14 -05003349 or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003350 enable or disable the class in a configured system, :term:`TMPDIR` might
Andrew Geissler09036742021-06-25 14:25:14 -05003351 contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003352 directory will correct this condition.
3353
3354.. _ref-classes-utility-tasks:
3355
Andrew Geissler517393d2023-01-13 08:55:19 -06003356``utility-tasks``
3357=================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003358
Andrew Geissler517393d2023-01-13 08:55:19 -06003359The :ref:`ref-classes-utility-tasks` class provides support for various
3360"utility" type tasks that are applicable to all recipes, such as
3361:ref:`ref-tasks-clean` and :ref:`ref-tasks-listtasks`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003362
3363This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003364:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003365
3366.. _ref-classes-utils:
3367
Andrew Geissler517393d2023-01-13 08:55:19 -06003368``utils``
3369=========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003370
Andrew Geissler517393d2023-01-13 08:55:19 -06003371The :ref:`ref-classes-utils` class provides some useful Python functions that are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003372typically used in inline Python expressions (e.g. ``${@...}``). One
3373example use is for ``bb.utils.contains()``.
3374
3375This class is enabled by default because it is inherited by the
Andrew Geissler517393d2023-01-13 08:55:19 -06003376:ref:`ref-classes-base` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003377
3378.. _ref-classes-vala:
3379
Andrew Geissler517393d2023-01-13 08:55:19 -06003380``vala``
3381========
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003382
Andrew Geissler517393d2023-01-13 08:55:19 -06003383The :ref:`ref-classes-vala` class supports recipes that need to build software written
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003384using the Vala programming language.
3385
3386.. _ref-classes-waf:
3387
Andrew Geissler517393d2023-01-13 08:55:19 -06003388``waf``
3389=======
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003390
Andrew Geissler517393d2023-01-13 08:55:19 -06003391The :ref:`ref-classes-waf` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003392the Waf build system. You can use the
3393:term:`EXTRA_OECONF` or
3394:term:`PACKAGECONFIG_CONFARGS` variables
3395to specify additional configuration options to be passed on the Waf
3396command line.