blob: ffa3e50ab62dbd7e66edb6f3b4b042f46bb4eeda [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
37``allarch.bbclass``
38===================
39
Patrick Williams2390b1b2022-11-03 13:47:49 -050040The :ref:`allarch <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
Patrick Williams2390b1b2022-11-03 13:47:49 -050052 configured for all architectures using :ref:`allarch <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
61By default, all recipes inherit the :ref:`base <ref-classes-base>` and
62:ref:`package <ref-classes-package>` classes, which enable
63functionality 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
Patrick Williams2390b1b2022-11-03 13:47:49 -050066inherit the :ref:`allarch <ref-classes-allarch>` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050067
68.. _ref-classes-archiver:
69
70``archiver.bbclass``
71====================
72
Patrick Williams2390b1b2022-11-03 13:47:49 -050073The :ref:`archiver <ref-classes-archiver>` class supports releasing source code and other
Andrew Geisslerc9f78652020-09-18 14:11:35 -050074materials with the binaries.
75
Patrick Williams2390b1b2022-11-03 13:47:49 -050076For more details on the source :ref:`archiver <ref-classes-archiver>`, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -060077":ref:`dev-manual/common-tasks: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
84``autotools*.bbclass``
85======================
86
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 Geissler09209ee2020-12-13 08:44:15 -060096":ref:`dev-manual/common-tasks: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
105the same as the :ref:`autotools <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
133``base.bbclass``
134================
135
Patrick Williams2390b1b2022-11-03 13:47:49 -0500136The :ref:`base <ref-classes-base>` class is special in that every ``.bb`` file implicitly
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500137inherits the class. This class contains definitions for standard basic
138tasks such as fetching, unpacking, configuring (empty by default),
139compiling (runs any ``Makefile`` present), installing (empty by default)
140and packaging (empty by default). These classes are often overridden or
141extended by other classes such as the
142:ref:`autotools <ref-classes-autotools>` class or the
143:ref:`package <ref-classes-package>` class.
144
145The class also contains some commonly used functions such as
146``oe_runmake``, which runs ``make`` with the arguments specified in
147:term:`EXTRA_OEMAKE` variable as well as the
148arguments passed directly to ``oe_runmake``.
149
150.. _ref-classes-bash-completion:
151
152``bash-completion.bbclass``
153===========================
154
155Sets up packaging and dependencies appropriate for recipes that build
156software that includes bash-completion data.
157
158.. _ref-classes-bin-package:
159
160``bin_package.bbclass``
161=======================
162
Patrick Williams2390b1b2022-11-03 13:47:49 -0500163The :ref:`bin_package <ref-classes-bin-package>` class is a helper class for recipes that extract the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500164contents of a binary package (e.g. an RPM) and install those contents
165rather than building the binary from source. The binary package is
166extracted and new packages in the configured output package format are
167created. Extraction and installation of proprietary binaries is a good
168example use for this class.
169
170.. note::
171
172 For RPMs and other packages that do not contain a subdirectory, you
173 should specify an appropriate fetcher parameter to point to the
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500174 subdirectory. For example, if BitBake is using the Git fetcher (``git://``),
175 the "subpath" parameter limits the checkout to a specific subpath
176 of the tree. Here is an example where ``${BP}`` is used so that the files
177 are extracted into the subdirectory expected by the default value of
Andrew Geissler09036742021-06-25 14:25:14 -0500178 :term:`S`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500179
Andrew Geissler9aee5002022-03-30 16:27:02 +0000180 SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=main;subpath=${BP}"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500181
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500182 See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for
183 more information on supported BitBake Fetchers.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500184
185.. _ref-classes-binconfig:
186
187``binconfig.bbclass``
188=====================
189
Patrick Williams2390b1b2022-11-03 13:47:49 -0500190The :ref:`binconfig <ref-classes-binconfig>` class helps to correct paths in shell scripts.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500191
192Before ``pkg-config`` had become widespread, libraries shipped shell
193scripts to give information about the libraries and include paths needed
194to build software (usually named ``LIBNAME-config``). This class assists
195any recipe using such scripts.
196
197During staging, the OpenEmbedded build system installs such scripts into
198the ``sysroots/`` directory. Inheriting this class results in all paths
199in these scripts being changed to point into the ``sysroots/`` directory
200so that all builds that use the script use the correct directories for
201the cross compiling layout. See the
202:term:`BINCONFIG_GLOB` variable for more
203information.
204
205.. _ref-classes-binconfig-disabled:
206
207``binconfig-disabled.bbclass``
208==============================
209
210An alternative version of the :ref:`binconfig <ref-classes-binconfig>`
211class, which disables binary configuration scripts by making them return
212an error in favor of using ``pkg-config`` to query the information. The
213scripts to be disabled should be specified using the
214:term:`BINCONFIG` variable within the recipe inheriting
215the class.
216
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500217.. _ref-classes-buildhistory:
218
219``buildhistory.bbclass``
220========================
221
Patrick Williams2390b1b2022-11-03 13:47:49 -0500222The :ref:`buildhistory <ref-classes-buildhistory>` class records a history of build output metadata,
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500223which can be used to detect possible regressions as well as used for
224analysis of the build output. For more information on using Build
225History, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600226":ref:`dev-manual/common-tasks:maintaining build output quality`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500227section in the Yocto Project Development Tasks Manual.
228
229.. _ref-classes-buildstats:
230
231``buildstats.bbclass``
232======================
233
Patrick Williams2390b1b2022-11-03 13:47:49 -0500234The :ref:`buildstats <ref-classes-buildstats>` class records performance statistics about each task
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500235executed during the build (e.g. elapsed time, CPU usage, and I/O usage).
236
237When you use this class, the output goes into the
238:term:`BUILDSTATS_BASE` directory, which defaults
239to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using
240``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading
241chart of the entire build process and can be useful for highlighting
242bottlenecks.
243
244Collecting build statistics is enabled by default through the
245:term:`USER_CLASSES` variable from your
246``local.conf`` file. Consequently, you do not have to do anything to
247enable the class. However, if you want to disable the class, simply
Patrick Williams2390b1b2022-11-03 13:47:49 -0500248remove ":ref:`buildstats <ref-classes-buildstats>`" from the :term:`USER_CLASSES` list.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500249
250.. _ref-classes-buildstats-summary:
251
252``buildstats-summary.bbclass``
253==============================
254
255When inherited globally, prints statistics at the end of the build on
256sstate re-use. In order to function, this class requires the
257:ref:`buildstats <ref-classes-buildstats>` class be enabled.
258
259.. _ref-classes-ccache:
260
261``ccache.bbclass``
262==================
263
Patrick Williams2390b1b2022-11-03 13:47:49 -0500264The :ref:`ccache <ref-classes-ccache>` class enables the C/C++ Compiler Cache for the build.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500265This class is used to give a minor performance boost during the build.
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000266
267See https://ccache.samba.org/ for information on the C/C++ Compiler
268Cache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>`
269file for details about how to enable this mechanism in your configuration
270file, how to disable it for specific recipes, and how to share ``ccache``
271files between builds.
272
273However, using the class can lead to unexpected side-effects. Thus, using
274this class is not recommended.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500275
276.. _ref-classes-chrpath:
277
278``chrpath.bbclass``
279===================
280
Patrick Williams2390b1b2022-11-03 13:47:49 -0500281The :ref:`chrpath <ref-classes-chrpath>` class is a wrapper around the "chrpath" utility, which
282is used during the build process for :ref:`nativesdk <ref-classes-nativesdk>`, :ref:`cross <ref-classes-cross>`, and
283:ref:`cross-canadian <ref-classes-cross-canadian>` recipes to change ``RPATH`` records within binaries
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500284in order to make them relocatable.
285
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500286.. _ref-classes-cmake:
287
288``cmake.bbclass``
289=================
290
Patrick Williams2390b1b2022-11-03 13:47:49 -0500291The ref:`cmake <ref-classes-cmake>` class allows for recipes that need to build software using
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500292the `CMake <https://cmake.org/overview/>`__ build system. You can use
293the :term:`EXTRA_OECMAKE` variable to specify
294additional configuration options to be passed using the ``cmake``
295command line.
296
297On the occasion that you would be installing custom CMake toolchain
298files supplied by the application being built, you should install them
299to the preferred CMake Module directory: ``${D}${datadir}/cmake/``
300Modules during
301:ref:`ref-tasks-install`.
302
303.. _ref-classes-cml1:
304
305``cml1.bbclass``
306================
307
Patrick Williams2390b1b2022-11-03 13:47:49 -0500308The :ref:`cml1 <ref-classes-cml1>` class provides basic support for the Linux kernel style
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500309build configuration system.
310
311.. _ref-classes-compress_doc:
312
313``compress_doc.bbclass``
314========================
315
316Enables compression for man pages and info pages. This class is intended
317to be inherited globally. The default compression mechanism is gz (gzip)
318but you can select an alternative mechanism by setting the
319:term:`DOC_COMPRESS` variable.
320
321.. _ref-classes-copyleft_compliance:
322
323``copyleft_compliance.bbclass``
324===============================
325
Patrick Williams2390b1b2022-11-03 13:47:49 -0500326The :ref:`copyleft_compliance <ref-classes-copyleft_compliance>` class preserves source code for the purposes
327of license compliance. This class is an alternative to the :ref:`archiver <ref-classes-archiver>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500328class and is still used by some users even though it has been deprecated
329in favor of the :ref:`archiver <ref-classes-archiver>` class.
330
331.. _ref-classes-copyleft_filter:
332
333``copyleft_filter.bbclass``
334===========================
335
336A class used by the :ref:`archiver <ref-classes-archiver>` and
337:ref:`copyleft_compliance <ref-classes-copyleft_compliance>` classes
338for filtering licenses. The ``copyleft_filter`` class is an internal
339class and is not intended to be used directly.
340
341.. _ref-classes-core-image:
342
343``core-image.bbclass``
344======================
345
Patrick Williams2390b1b2022-11-03 13:47:49 -0500346The :ref:`core-image <ref-classes-core-image>` class provides common definitions for the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500347``core-image-*`` image recipes, such as support for additional
348:term:`IMAGE_FEATURES`.
349
350.. _ref-classes-cpan:
351
352``cpan*.bbclass``
353=================
354
Patrick Williams2390b1b2022-11-03 13:47:49 -0500355The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500356
357Recipes for Perl modules are simple. These recipes usually only need to
358point to the source's archive and then inherit the proper class file.
359Building is split into two methods depending on which method the module
360authors used.
361
362- Modules that use old ``Makefile.PL``-based build system require
363 ``cpan.bbclass`` in their recipes.
364
365- Modules that use ``Build.PL``-based build system require using
366 ``cpan_build.bbclass`` in their recipes.
367
Patrick Williams2390b1b2022-11-03 13:47:49 -0500368Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500369support.
370
Patrick Williams975a06f2022-10-21 14:42:47 -0500371.. _ref-classes-create-spdx:
372
373``create-spdx.bbclass``
374=======================
375
Patrick Williams7784c422022-11-17 07:29:11 -0600376The :ref:`create-spdx <ref-classes-create-spdx>` class provides support for
377automatically creating :term:`SPDX` :term:`SBOM` documents based upon image
378and SDK contents.
379
380This class is meant to be inherited globally from a configuration file::
381
382 INHERIT += "create-spdx"
383
384The toplevel :term:`SPDX` output file is generated in JSON format as a
385``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the
386:term:`Build Directory`. There are other related files in the same directory,
387as well as in ``tmp/deploy/spdx``.
388
389The exact behaviour of this class, and the amount of output can be controlled
390by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`,
391:term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables.
392
393See the description of these variables and the
394":ref:`dev-manual/common-tasks:creating a software bill of materials`"
395section in the Yocto Project Development Manual for more details.
Patrick Williams975a06f2022-10-21 14:42:47 -0500396
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500397.. _ref-classes-cross:
398
399``cross.bbclass``
400=================
401
Patrick Williams2390b1b2022-11-03 13:47:49 -0500402The :ref:`cross <ref-classes-cross>` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500403cross-compilation tools.
404
405.. _ref-classes-cross-canadian:
406
407``cross-canadian.bbclass``
408==========================
409
Patrick Williams2390b1b2022-11-03 13:47:49 -0500410The :ref:`cross-canadian <ref-classes-cross-canadian>` class provides support for the recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500411the Canadian Cross-compilation tools for SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600412":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500413section in the Yocto Project Overview and Concepts Manual for more
414discussion on these cross-compilation tools.
415
416.. _ref-classes-crosssdk:
417
418``crosssdk.bbclass``
419====================
420
Patrick Williams2390b1b2022-11-03 13:47:49 -0500421The :ref:`crosssdk <ref-classes-crosssdk>` class provides support for the recipes that build the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500422cross-compilation tools used for building SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600423":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500424section in the Yocto Project Overview and Concepts Manual for more
425discussion on these cross-compilation tools.
426
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500427.. _ref-classes-cve-check:
428
429``cve-check.bbclass``
430=====================
431
Patrick Williams2390b1b2022-11-03 13:47:49 -0500432The :ref:`cve-check <ref-classes-cve-check>` class looks for known CVEs (Common Vulnerabilities
433and Exposures) while building with BitBake. This class is meant to be
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500434inherited globally from a configuration file::
435
436 INHERIT += "cve-check"
437
Patrick Williams2390b1b2022-11-03 13:47:49 -0500438To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
439add following line to the build configuration file::
440
441 include cve-extra-exclusions.inc
442
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500443You can also look for vulnerabilities in specific packages by passing
Patrick Williams2390b1b2022-11-03 13:47:49 -0500444``-c cve_check`` to BitBake.
445
446After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
447and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files.
448
449When building, the CVE checker will emit build time warnings for any detected
450issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
451and version being compiled and no patches to address the issue are applied. Other states
452for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
453applied, and ``Ignored`` meaning that the issue can be ignored.
454
455The ``Patched`` state of a CVE issue is detected from patch files with the format
456``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
457CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
458
459If the recipe lists the ``CVE-ID`` in :term:`CVE_CHECK_IGNORE` variable, then the CVE state is reported
460as ``Ignored``. Multiple CVEs can be listed separated by spaces. Example::
461
462 CVE_CHECK_IGNORE += "CVE-2020-29509 CVE-2020-29511"
463
464If CVE check reports that a recipe contains false positives or false negatives, these may be
465fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables.
466:term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE
467database vendor and product pairs using the syntax::
468
469 CVE_PRODUCT = "flex_project:flex"
470
471where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
472if the default recipe version :term:`PV` does not match the version numbers of the software component
473in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
474CVE database compatible version number, for example::
475
476 CVE_VERSION = "2.39"
477
478Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
479via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
480
481Users should note that security is a process, not a product, and thus also CVE checking, analyzing results,
482patching and updating the software should be done as a regular process. The data and assumptions
483required for CVE checker to reliably detect issues are frequently broken in various ways.
484These can only be detected by reviewing the details of the issues and iterating over the generated reports,
485and following what happens in other Linux distributions and in the greater open source community.
486
487You will find some more details in the
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500488":ref:`dev-manual/common-tasks:checking for vulnerabilities`"
489section in the Development Tasks Manual.
490
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500491.. _ref-classes-debian:
492
493``debian.bbclass``
494==================
495
Patrick Williams2390b1b2022-11-03 13:47:49 -0500496The :ref:`debian <ref-classes-debian>` class renames output packages so that they follow the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500497Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
498``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
499name and version as part of the package name.
500
501If a recipe creates packages for multiple libraries (shared object files
502of ``.so`` type), use the :term:`LEAD_SONAME`
503variable in the recipe to specify the library on which to apply the
504naming scheme.
505
506.. _ref-classes-deploy:
507
508``deploy.bbclass``
509==================
510
Patrick Williams2390b1b2022-11-03 13:47:49 -0500511The :ref:`deploy <ref-classes-deploy>` class handles deploying files to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500512:term:`DEPLOY_DIR_IMAGE` directory. The main
513function of this class is to allow the deploy step to be accelerated by
514shared state. Recipes that inherit this class should define their own
515:ref:`ref-tasks-deploy` function to copy the files to be
516deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
517add the task at the appropriate place, which is usually after
518:ref:`ref-tasks-compile` or
519:ref:`ref-tasks-install`. The class then takes care of
Andrew Geissler09036742021-06-25 14:25:14 -0500520staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500521
522.. _ref-classes-devshell:
523
524``devshell.bbclass``
525====================
526
Patrick Williams2390b1b2022-11-03 13:47:49 -0500527The :ref:`devshell <ref-classes-devshell>` class adds the :ref:`ref-tasks-devshell` task. Distribution
Andrew Geissler09209ee2020-12-13 08:44:15 -0600528policy dictates whether to include this class. See the ":ref:`dev-manual/common-tasks:using a development shell`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500529section in the Yocto Project Development Tasks Manual for more
Patrick Williams2390b1b2022-11-03 13:47:49 -0500530information about using :ref:`devshell <ref-classes-devshell>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500531
532.. _ref-classes-devupstream:
533
534``devupstream.bbclass``
535=======================
536
Patrick Williams2390b1b2022-11-03 13:47:49 -0500537The :ref:`devupstream <ref-classes-devupstream>` class uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500538:term:`BBCLASSEXTEND` to add a variant of the
539recipe that fetches from an alternative URI (e.g. Git) instead of a
Andrew Geisslerc926e172021-05-07 16:11:35 -0500540tarball. Following is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500541
542 BBCLASSEXTEND = "devupstream:target"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000543 SRC_URI:class-devupstream = "git://git.example.com/example;branch=main"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500544 SRCREV:class-devupstream = "abcd1234"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500545
546Adding the above statements to your recipe creates a variant that has
547:term:`DEFAULT_PREFERENCE` set to "-1".
548Consequently, you need to select the variant of the recipe to use it.
549Any development-specific adjustments can be done by using the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500550``class-devupstream`` override. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500551
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500552 DEPENDS:append:class-devupstream = " gperf-native"
553 do_configure:prepend:class-devupstream() {
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500554 touch ${S}/README
555 }
556
557The class
558currently only supports creating a development variant of the target
Patrick Williams2390b1b2022-11-03 13:47:49 -0500559recipe, not :ref:`native <ref-classes-native>` or :ref:`nativesdk <ref-classes-nativesdk>` variants.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500560
Andrew Geissler09036742021-06-25 14:25:14 -0500561The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
Patrick Williams2390b1b2022-11-03 13:47:49 -0500562support for :ref:`native <ref-classes-native>` and :ref:`nativesdk <ref-classes-nativesdk>` variants. Consequently, this
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500563functionality can be added in a future release.
564
565Support for other version control systems such as Subversion is limited
566due to BitBake's automatic fetch dependencies (e.g.
567``subversion-native``).
568
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500569.. _ref-classes-externalsrc:
570
571``externalsrc.bbclass``
572=======================
573
Patrick Williams2390b1b2022-11-03 13:47:49 -0500574The :ref:`externalsrc <ref-classes-externalsrc>` class supports building software from source code
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500575that is external to the OpenEmbedded build system. Building software
576from an external source tree means that the build system's normal fetch,
577unpack, and patch process is not used.
578
579By default, the OpenEmbedded build system uses the :term:`S`
580and :term:`B` variables to locate unpacked recipe source code
581and to build it, respectively. When your recipe inherits the
Patrick Williams2390b1b2022-11-03 13:47:49 -0500582:ref:`externalsrc <ref-classes-externalsrc>` class, you use the
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500583:term:`EXTERNALSRC` and
584:term:`EXTERNALSRC_BUILD` variables to
Andrew Geissler09036742021-06-25 14:25:14 -0500585ultimately define :term:`S` and :term:`B`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500586
587By default, this class expects the source code to support recipe builds
588that use the :term:`B` variable to point to the directory in
589which the OpenEmbedded build system places the generated objects built
Andrew Geissler09036742021-06-25 14:25:14 -0500590from the recipes. By default, the :term:`B` directory is set to the
591following, which is separate from the source directory (:term:`S`)::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500592
Andrew Geissler5199d832021-09-24 16:47:35 -0500593 ${WORKDIR}/${BPN}-{PV}/
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500594
595See these variables for more information:
596:term:`WORKDIR`, :term:`BPN`, and
597:term:`PV`,
598
Patrick Williams2390b1b2022-11-03 13:47:49 -0500599For more information on the :ref:`externalsrc <ref-classes-externalsrc>` class, see the comments in
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500600``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
601For information on how to use the
Patrick Williams2390b1b2022-11-03 13:47:49 -0500602:ref:`externalsrc <ref-classes-externalsrc>` class, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600603":ref:`dev-manual/common-tasks:building software from an external source`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500604section in the Yocto Project Development Tasks Manual.
605
606.. _ref-classes-extrausers:
607
608``extrausers.bbclass``
609======================
610
Patrick Williams2390b1b2022-11-03 13:47:49 -0500611The :ref:`extrausers <ref-classes-extrausers>` class allows additional user and group configuration
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500612to be applied at the image level. Inheriting this class either globally
613or from an image recipe allows additional user and group operations to
614be performed using the
615:term:`EXTRA_USERS_PARAMS` variable.
616
617.. note::
618
619 The user and group operations added using the
Andrew Geissler595f6302022-01-24 19:11:47 +0000620 :ref:`extrausers <ref-classes-extrausers>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500621 class are not tied to a specific recipe outside of the recipe for the
622 image. Thus, the operations can be performed across the image as a
623 whole. Use the
Andrew Geissler595f6302022-01-24 19:11:47 +0000624 :ref:`useradd <ref-classes-useradd>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500625 class to add user and group configuration to a specific recipe.
626
Andrew Geisslerc926e172021-05-07 16:11:35 -0500627Here is an example that uses this class in an image recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500628
629 inherit extrausers
630 EXTRA_USERS_PARAMS = "\
631 useradd -p '' tester; \
632 groupadd developers; \
633 userdel nobody; \
634 groupdel -g video; \
635 groupmod -g 1020 developers; \
636 usermod -s /bin/sh tester; \
637 "
638
639Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
Andrew Geissler9aee5002022-03-30 16:27:02 +0000640passwords. First on host, create the (escaped) password hash::
Andrew Geisslereff27472021-10-29 15:35:00 -0500641
Andrew Geissler9aee5002022-03-30 16:27:02 +0000642 printf "%q" $(mkpasswd -m sha256crypt tester01)
Andrew Geisslereff27472021-10-29 15:35:00 -0500643
Andrew Geissler9aee5002022-03-30 16:27:02 +0000644The resulting hash is set to a variable and used in ``useradd`` command parameters::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500645
646 inherit extrausers
Andrew Geisslereff27472021-10-29 15:35:00 -0500647 PASSWD = "\$X\$ABC123\$A-Long-Hash"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500648 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500649 useradd -p '${PASSWD}' tester-jim; \
650 useradd -p '${PASSWD}' tester-sue; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500651 "
652
Andrew Geisslereff27472021-10-29 15:35:00 -0500653Finally, here is an example that sets the root password::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500654
655 inherit extrausers
656 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500657 usermod -p '${PASSWD}' root; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500658 "
659
Patrick Williams03907ee2022-05-01 06:28:52 -0500660.. note::
661
662 From a security perspective, hardcoding a default password is not
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500663 generally a good idea or even legal in some jurisdictions. It is
664 recommended that you do not do this if you are building a production
Patrick Williams03907ee2022-05-01 06:28:52 -0500665 image.
666
667
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600668.. _ref-classes-features_check:
669
670``features_check.bbclass``
671=================================
672
Patrick Williams2390b1b2022-11-03 13:47:49 -0500673The :ref:`features_check <ref-classes-features_check>` class allows individual recipes to check
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600674for required and conflicting
675:term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES` or :term:`COMBINED_FEATURES`.
676
677This class provides support for the following variables:
678
679- :term:`REQUIRED_DISTRO_FEATURES`
680- :term:`CONFLICT_DISTRO_FEATURES`
681- :term:`ANY_OF_DISTRO_FEATURES`
682- ``REQUIRED_MACHINE_FEATURES``
683- ``CONFLICT_MACHINE_FEATURES``
684- ``ANY_OF_MACHINE_FEATURES``
685- ``REQUIRED_COMBINED_FEATURES``
686- ``CONFLICT_COMBINED_FEATURES``
687- ``ANY_OF_COMBINED_FEATURES``
688
689If any conditions specified in the recipe using the above
690variables are not met, the recipe will be skipped, and if the
691build system attempts to build the recipe then an error will be
692triggered.
693
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500694.. _ref-classes-fontcache:
695
696``fontcache.bbclass``
697=====================
698
Patrick Williams2390b1b2022-11-03 13:47:49 -0500699The :ref:`fontcache <ref-classes-fontcache>` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500700post-remove (postinst and postrm) scriptlets for font packages. These
701scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
702to the font information cache. Since the cache files are
703architecture-specific, ``fc-cache`` runs using QEMU if the postinst
704scriptlets need to be run on the build host during image creation.
705
706If the fonts being installed are in packages other than the main
707package, set :term:`FONT_PACKAGES` to specify the
708packages containing the fonts.
709
710.. _ref-classes-fs-uuid:
711
712``fs-uuid.bbclass``
713===================
714
Patrick Williams2390b1b2022-11-03 13:47:49 -0500715The :ref:`fs-uuid <ref-classes-fs-uuid>` class extracts UUID from
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500716``${``\ :term:`ROOTFS`\ ``}``, which must have been built
Patrick Williams2390b1b2022-11-03 13:47:49 -0500717by the time that this function gets called. The :ref:`fs-uuid <ref-classes-fs-uuid>` class only
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500718works on ``ext`` file systems and depends on ``tune2fs``.
719
720.. _ref-classes-gconf:
721
722``gconf.bbclass``
723=================
724
Patrick Williams2390b1b2022-11-03 13:47:49 -0500725The :ref:`gconf <ref-classes-gconf>` class provides common functionality for recipes that need
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500726to install GConf schemas. The schemas will be put into a separate
727package (``${``\ :term:`PN`\ ``}-gconf``) that is created
728automatically when this class is inherited. This package uses the
729appropriate post-install and post-remove (postinst/postrm) scriptlets to
730register and unregister the schemas in the target image.
731
732.. _ref-classes-gettext:
733
734``gettext.bbclass``
735===================
736
Patrick Williams2390b1b2022-11-03 13:47:49 -0500737The :ref:`gettext <ref-classes-gettext>` class provides support for building software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500738the GNU ``gettext`` internationalization and localization system. All
739recipes building software that use ``gettext`` should inherit this
740class.
741
Patrick Williams975a06f2022-10-21 14:42:47 -0500742.. _ref-classes-github-releases:
743
Patrick Williams7784c422022-11-17 07:29:11 -0600744``github-releases.bbclass``
745===========================
Patrick Williams975a06f2022-10-21 14:42:47 -0500746
Patrick Williams2390b1b2022-11-03 13:47:49 -0500747For recipes that fetch release tarballs from github, the :ref:`github-releases <ref-classes-github-releases>`
Patrick Williams975a06f2022-10-21 14:42:47 -0500748class sets up a standard way for checking available upstream versions
749(to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)).
750
Patrick Williams2390b1b2022-11-03 13:47:49 -0500751To use it, add ":ref:`github-releases <ref-classes-github-releases>`" to the inherit line in the recipe,
Patrick Williams975a06f2022-10-21 14:42:47 -0500752and if the default value of :term:`GITHUB_BASE_URI` is not suitable,
753then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}``
754in the value you set for :term:`SRC_URI` within the recipe.
755
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500756.. _ref-classes-gnomebase:
757
758``gnomebase.bbclass``
759=====================
760
Patrick Williams2390b1b2022-11-03 13:47:49 -0500761The :ref:`gnomebase <ref-classes-gnomebase>` class is the base class for recipes that build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500762software from the GNOME stack. This class sets
763:term:`SRC_URI` to download the source from the GNOME
764mirrors as well as extending :term:`FILES` with the typical
765GNOME installation paths.
766
767.. _ref-classes-gobject-introspection:
768
769``gobject-introspection.bbclass``
770=================================
771
772Provides support for recipes building software that supports GObject
773introspection. This functionality is only enabled if the
774"gobject-introspection-data" feature is in
775:term:`DISTRO_FEATURES` as well as
776"qemu-usermode" being in
777:term:`MACHINE_FEATURES`.
778
779.. note::
780
781 This functionality is backfilled by default and, if not applicable,
Andrew Geissler09036742021-06-25 14:25:14 -0500782 should be disabled through :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
783 :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500784
785.. _ref-classes-grub-efi:
786
787``grub-efi.bbclass``
788====================
789
Patrick Williams2390b1b2022-11-03 13:47:49 -0500790The :ref:`grub-efi <ref-classes-grub-efi>` class provides ``grub-efi``-specific functions for
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500791building bootable images.
792
793This class supports several variables:
794
795- :term:`INITRD`: Indicates list of filesystem images to
796 concatenate and use as an initial RAM disk (initrd) (optional).
797
798- :term:`ROOTFS`: Indicates a filesystem image to include
799 as the root filesystem (optional).
800
801- :term:`GRUB_GFXSERIAL`: Set this to "1" to have
802 graphics and serial in the boot menu.
803
804- :term:`LABELS`: A list of targets for the automatic
805 configuration.
806
807- :term:`APPEND`: An override list of append strings for
808 each ``LABEL``.
809
810- :term:`GRUB_OPTS`: Additional options to add to the
811 configuration (optional). Options are delimited using semi-colon
812 characters (``;``).
813
814- :term:`GRUB_TIMEOUT`: Timeout before executing
815 the default ``LABEL`` (optional).
816
817.. _ref-classes-gsettings:
818
819``gsettings.bbclass``
820=====================
821
Patrick Williams2390b1b2022-11-03 13:47:49 -0500822The :ref:`gsettings <ref-classes-gsettings>` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500823need to install GSettings (glib) schemas. The schemas are assumed to be
824part of the main package. Appropriate post-install and post-remove
825(postinst/postrm) scriptlets are added to register and unregister the
826schemas in the target image.
827
828.. _ref-classes-gtk-doc:
829
830``gtk-doc.bbclass``
831===================
832
Patrick Williams2390b1b2022-11-03 13:47:49 -0500833The :ref:`gtk-doc <ref-classes-gtk-doc>` class is a helper class to pull in the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500834``gtk-doc`` dependencies and disable ``gtk-doc``.
835
836.. _ref-classes-gtk-icon-cache:
837
838``gtk-icon-cache.bbclass``
839==========================
840
Patrick Williams2390b1b2022-11-03 13:47:49 -0500841The :ref:`gtk-icon-cache <ref-classes-gtk-icon-cache>` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500842post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
843install icons. These scriptlets call ``gtk-update-icon-cache`` to add
844the fonts to GTK+'s icon cache. Since the cache files are
845architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
846the postinst scriptlets need to be run on the build host during image
847creation.
848
849.. _ref-classes-gtk-immodules-cache:
850
851``gtk-immodules-cache.bbclass``
852===============================
853
Patrick Williams2390b1b2022-11-03 13:47:49 -0500854The :ref:`gtk-immodules-cache <ref-classes-gtk-immodules-cache>` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500855post-remove (postinst/postrm) scriptlets for packages that install GTK+
856input method modules for virtual keyboards. These scriptlets call
857``gtk-update-icon-cache`` to add the input method modules to the cache.
858Since the cache files are architecture-specific,
859``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
860need to be run on the build host during image creation.
861
862If the input method modules being installed are in packages other than
863the main package, set
864:term:`GTKIMMODULES_PACKAGES` to specify
865the packages containing the modules.
866
867.. _ref-classes-gzipnative:
868
869``gzipnative.bbclass``
870======================
871
Patrick Williams2390b1b2022-11-03 13:47:49 -0500872The :ref:`gzipnative <ref-classes-gzipnative>` class enables the use of different native versions of
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500873``gzip`` and ``pigz`` rather than the versions of these tools from the
874build host.
875
876.. _ref-classes-icecc:
877
878``icecc.bbclass``
879=================
880
Patrick Williams2390b1b2022-11-03 13:47:49 -0500881The :ref:`icecc <ref-classes-icecc>` class supports
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500882`Icecream <https://github.com/icecc/icecream>`__, which facilitates
883taking compile jobs and distributing them among remote machines.
884
885The class stages directories with symlinks from ``gcc`` and ``g++`` to
886``icecc``, for both native and cross compilers. Depending on each
887configure or compile, the OpenEmbedded build system adds the directories
888at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500889``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500890compilers, respectively.
891
892For the cross compiler, the class creates a ``tar.gz`` file that
893contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
894is the version of the cross-compiler used in the cross-development
895toolchain, accordingly.
896
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500897The class handles all three different compile stages (i.e native,
898cross-kernel and target) and creates the necessary environment
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500899``tar.gz`` file to be used by the remote machines. The class also
900supports SDK generation.
901
902If :term:`ICECC_PATH` is not set in your
903``local.conf`` file, then the class tries to locate the ``icecc`` binary
904using ``which``. If :term:`ICECC_ENV_EXEC` is set
905in your ``local.conf`` file, the variable should point to the
906``icecc-create-env`` script provided by the user. If you do not point to
907a user-provided script, the build system uses the default script
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500908provided by the recipe :oe_git:`icecc-create-env_0.1.bb
909</openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500910
911.. note::
912
913 This script is a modified version and not the one that comes with
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500914 ``icecream``.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500915
916If you do not want the Icecream distributed compile support to apply to
Andrew Geissler595f6302022-01-24 19:11:47 +0000917specific recipes or classes, you can ask them to be ignored by Icecream
918by listing the recipes and classes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +0000919:term:`ICECC_RECIPE_DISABLE` and
920:term:`ICECC_CLASS_DISABLE` variables,
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500921respectively, in your ``local.conf`` file. Doing so causes the
922OpenEmbedded build system to handle these compilations locally.
923
924Additionally, you can list recipes using the
Andrew Geissler9aee5002022-03-30 16:27:02 +0000925:term:`ICECC_RECIPE_ENABLE` variable in
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500926your ``local.conf`` file to force ``icecc`` to be enabled for recipes
927using an empty :term:`PARALLEL_MAKE` variable.
928
Patrick Williams2390b1b2022-11-03 13:47:49 -0500929Inheriting the :ref:`icecc <ref-classes-icecc>` class changes all sstate signatures.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500930Consequently, if a development team has a dedicated build system that
931populates :term:`SSTATE_MIRRORS` and they want to
Andrew Geissler09036742021-06-25 14:25:14 -0500932reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
Patrick Williams2390b1b2022-11-03 13:47:49 -0500933system need to either inherit the :ref:`icecc <ref-classes-icecc>` class or nobody should.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500934
Patrick Williams2390b1b2022-11-03 13:47:49 -0500935At the distribution level, you can inherit the :ref:`icecc <ref-classes-icecc>` class to be
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500936sure that all builders start with the same sstate signatures. After
937inheriting the class, you can then disable the feature by setting the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500938:term:`ICECC_DISABLED` variable to "1" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500939
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500940 INHERIT_DISTRO:append = " icecc"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500941 ICECC_DISABLED ??= "1"
942
943This practice
944makes sure everyone is using the same signatures but also requires
945individuals that do want to use Icecream to enable the feature
Andrew Geisslerc926e172021-05-07 16:11:35 -0500946individually as follows in your ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500947
948 ICECC_DISABLED = ""
949
950.. _ref-classes-image:
951
952``image.bbclass``
953=================
954
Patrick Williams2390b1b2022-11-03 13:47:49 -0500955The :ref:`image <ref-classes-image>` class helps support creating images in different formats.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500956First, the root filesystem is created from packages using one of the
957``rootfs*.bbclass`` files (depending on the package format used) and
958then one or more image files are created.
959
Andrew Geissler09036742021-06-25 14:25:14 -0500960- The :term:`IMAGE_FSTYPES` variable controls the types of images to
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500961 generate.
962
Andrew Geissler09036742021-06-25 14:25:14 -0500963- The :term:`IMAGE_INSTALL` variable controls the list of packages to
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500964 install into the image.
965
966For information on customizing images, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600967":ref:`dev-manual/common-tasks:customizing images`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500968in the Yocto Project Development Tasks Manual. For information on how
969images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600970":ref:`overview-manual/concepts:images`" section in the
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600971Yocto Project Overview and Concepts Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500972
973.. _ref-classes-image-buildinfo:
974
975``image-buildinfo.bbclass``
976===========================
977
Patrick Williams2390b1b2022-11-03 13:47:49 -0500978The :ref:`image-buildinfo <ref-classes-image-buildinfo>` class writes a plain text file containing
Patrick Williams975a06f2022-10-21 14:42:47 -0500979build information to the target filesystem at ``${sysconfdir}/buildinfo``
Patrick Williams7784c422022-11-17 07:29:11 -0600980by default (as specified by :term:`IMAGE_BUILDINFO_FILE`).
Patrick Williams975a06f2022-10-21 14:42:47 -0500981This can be useful for manually determining the origin of any given
982image. It writes out two sections:
983
9841. `Build Configuration`: a list of variables and their values (specified
985 by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and
986 :term:`DISTRO_VERSION`)
987
9882. `Layer Revisions`: the revisions of all of the layers used in the
989 build.
990
991Additionally, when building an SDK it will write the same contents
992to ``/buildinfo`` by default (as specified by
993:term:`SDK_BUILDINFO_FILE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500994
995.. _ref-classes-image_types:
996
997``image_types.bbclass``
998=======================
999
Patrick Williams2390b1b2022-11-03 13:47:49 -05001000The :ref:`image_types <ref-classes-image_types>` class defines all of the standard image output types
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001001that you can enable through the
1002:term:`IMAGE_FSTYPES` variable. You can use this
1003class as a reference on how to add support for custom image output
1004types.
1005
1006By default, the :ref:`image <ref-classes-image>` class automatically
Patrick Williams2390b1b2022-11-03 13:47:49 -05001007enables the :ref:`image_types <ref-classes-image_types>` class. The :ref:`image <ref-classes-image>` class uses the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001008``IMGCLASSES`` variable as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001009
1010 IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
1011 IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
1012 IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
1013 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
1014 IMGCLASSES += "image_types_wic"
1015 IMGCLASSES += "rootfs-postcommands"
1016 IMGCLASSES += "image-postinst-intercepts"
1017 inherit ${IMGCLASSES}
1018
Patrick Williams2390b1b2022-11-03 13:47:49 -05001019The :ref:`image_types <ref-classes-image_types>` class also handles conversion and compression of images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001020
1021.. note::
1022
1023 To build a VMware VMDK image, you need to add "wic.vmdk" to
Andrew Geissler09036742021-06-25 14:25:14 -05001024 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001025 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001026
1027.. _ref-classes-image-live:
1028
1029``image-live.bbclass``
1030======================
1031
1032This class controls building "live" (i.e. HDDIMG and ISO) images. Live
1033images contain syslinux for legacy booting, as well as the bootloader
1034specified by :term:`EFI_PROVIDER` if
1035:term:`MACHINE_FEATURES` contains "efi".
1036
1037Normally, you do not use this class directly. Instead, you add "live" to
1038:term:`IMAGE_FSTYPES`.
1039
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001040.. _ref-classes-insane:
1041
1042``insane.bbclass``
1043==================
1044
Patrick Williams2390b1b2022-11-03 13:47:49 -05001045The :ref:`insane <ref-classes-insane>` class adds a step to the package generation process so
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001046that output quality assurance checks are generated by the OpenEmbedded
1047build system. A range of checks are performed that check the build's
1048output for common problems that show up during runtime. Distribution
1049policy usually dictates whether to include this class.
1050
1051You can configure the sanity checks so that specific test failures
1052either raise a warning or an error message. Typically, failures for new
1053tests generate a warning. Subsequent failures for the same test would
1054then generate an error message once the metadata is in a known and good
Andrew Geissler09209ee2020-12-13 08:44:15 -06001055condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001056and error messages you might encounter using a default configuration.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001057
1058Use the :term:`WARN_QA` and
1059:term:`ERROR_QA` variables to control the behavior of
1060these checks at the global level (i.e. in your custom distro
1061configuration). However, to skip one or more checks in recipes, you
1062should use :term:`INSANE_SKIP`. For example, to skip
1063the check for symbolic link ``.so`` files in the main package of a
1064recipe, add the following to the recipe. You need to realize that the
Andrew Geisslerc926e172021-05-07 16:11:35 -05001065package name override, in this example ``${PN}``, must be used::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001066
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001067 INSANE_SKIP:${PN} += "dev-so"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001068
1069Please keep in mind that the QA checks
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001070are meant to detect real or potential problems in the packaged
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001071output. So exercise caution when disabling these checks.
1072
Andrew Geissler09036742021-06-25 14:25:14 -05001073Here are the tests you can list with the :term:`WARN_QA` and
Andrew Geissler5f350902021-07-23 13:09:54 -04001074:term:`ERROR_QA` variables:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001075
1076- ``already-stripped:`` Checks that produced binaries have not
1077 already been stripped prior to the build system extracting debug
1078 symbols. It is common for upstream software projects to default to
1079 stripping debug symbols for output binaries. In order for debugging
1080 to work on the target using ``-dbg`` packages, this stripping must be
1081 disabled.
1082
1083- ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1084 size, and endianness of any binaries to ensure they match the target
1085 architecture. This test fails if any binaries do not match the type
1086 since there would be an incompatibility. The test could indicate that
1087 the wrong compiler or compiler options have been used. Sometimes
1088 software, like bootloaders, might need to bypass this check.
1089
1090- ``buildpaths:`` Checks for paths to locations on the build host
Patrick Williams975a06f2022-10-21 14:42:47 -05001091 inside the output files. Not only can these leak information about
1092 the build environment, they also hinder binary reproducibility.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001093
1094- ``build-deps:`` Determines if a build-time dependency that is
1095 specified through :term:`DEPENDS`, explicit
1096 :term:`RDEPENDS`, or task-level dependencies exists
1097 to match any runtime dependency. This determination is particularly
1098 useful to discover where runtime dependencies are detected and added
1099 during packaging. If no explicit dependency has been specified within
1100 the metadata, at the packaging stage it is too late to ensure that
1101 the dependency is built, and thus you can end up with an error when
1102 the package is installed into the image during the
1103 :ref:`ref-tasks-rootfs` task because the auto-detected
1104 dependency was not satisfied. An example of this would be where the
1105 :ref:`update-rc.d <ref-classes-update-rc.d>` class automatically
1106 adds a dependency on the ``initscripts-functions`` package to
1107 packages that install an initscript that refers to
1108 ``/etc/init.d/functions``. The recipe should really have an explicit
Andrew Geissler5f350902021-07-23 13:09:54 -04001109 :term:`RDEPENDS` for the package in question on ``initscripts-functions``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001110 so that the OpenEmbedded build system is able to ensure that the
1111 ``initscripts`` recipe is actually built and thus the
1112 ``initscripts-functions`` package is made available.
1113
1114- ``compile-host-path:`` Checks the
1115 :ref:`ref-tasks-compile` log for indications that
1116 paths to locations on the build host were used. Using such paths
1117 might result in host contamination of the build output.
1118
1119- ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1120 do not depend on ``-dbg`` packages, which would cause a packaging
1121 bug.
1122
1123- ``debug-files:`` Checks for ``.debug`` directories in anything but
1124 the ``-dbg`` package. The debug files should all be in the ``-dbg``
1125 package. Thus, anything packaged elsewhere is incorrect packaging.
1126
1127- ``dep-cmp:`` Checks for invalid version comparison statements in
1128 runtime dependency relationships between packages (i.e. in
1129 :term:`RDEPENDS`,
1130 :term:`RRECOMMENDS`,
1131 :term:`RSUGGESTS`,
1132 :term:`RPROVIDES`,
1133 :term:`RREPLACES`, and
1134 :term:`RCONFLICTS` variable values). Any invalid
1135 comparisons might trigger failures or undesirable behavior when
1136 passed to the package manager.
1137
1138- ``desktop:`` Runs the ``desktop-file-validate`` program against any
1139 ``.desktop`` files to validate their contents against the
1140 specification for ``.desktop`` files.
1141
1142- ``dev-deps:`` Checks that all packages except ``-dev`` or
1143 ``-staticdev`` packages do not depend on ``-dev`` packages, which
1144 would be a packaging bug.
1145
1146- ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1147 ``-dev`` package and not in any of the other packages. In general,
1148 these symlinks are only useful for development purposes. Thus, the
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001149 ``-dev`` package is the correct location for them. In very rare
1150 cases, such as dynamically loaded modules, these symlinks
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001151 are needed instead in the main package.
1152
Patrick Williams03907ee2022-05-01 06:28:52 -05001153- ``empty-dirs:`` Checks that packages are not installing files to
1154 directories that are normally expected to be empty (such as ``/tmp``)
1155 The list of directories that are checked is specified by the
1156 :term:`QA_EMPTY_DIRS` variable.
1157
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001158- ``file-rdeps:`` Checks that file-level dependencies identified by
1159 the OpenEmbedded build system at packaging time are satisfied. For
1160 example, a shell script might start with the line ``#!/bin/bash``.
1161 This line would translate to a file dependency on ``/bin/bash``. Of
1162 the three package managers that the OpenEmbedded build system
1163 supports, only RPM directly handles file-level dependencies,
1164 resolving them automatically to packages providing the files.
1165 However, the lack of that functionality in the other two package
1166 managers does not mean the dependencies do not still need resolving.
1167 This QA check attempts to ensure that explicitly declared
1168 :term:`RDEPENDS` exist to handle any file-level
1169 dependency detected in packaged files.
1170
1171- ``files-invalid:`` Checks for :term:`FILES` variable
1172 values that contain "//", which is invalid.
1173
1174- ``host-user-contaminated:`` Checks that no package produced by the
1175 recipe contains any files outside of ``/home`` with a user or group
1176 ID that matches the user running BitBake. A match usually indicates
1177 that the files are being installed with an incorrect UID/GID, since
1178 target IDs are independent from host IDs. For additional information,
1179 see the section describing the
1180 :ref:`ref-tasks-install` task.
1181
1182- ``incompatible-license:`` Report when packages are excluded from
1183 being created due to being marked with a license that is in
1184 :term:`INCOMPATIBLE_LICENSE`.
1185
1186- ``install-host-path:`` Checks the
1187 :ref:`ref-tasks-install` log for indications that
1188 paths to locations on the build host were used. Using such paths
1189 might result in host contamination of the build output.
1190
1191- ``installed-vs-shipped:`` Reports when files have been installed
Patrick Williams2194f502022-10-16 14:26:09 -05001192 within :ref:`ref-tasks-install` but have not been included in any package by
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001193 way of the :term:`FILES` variable. Files that do not
1194 appear in any package cannot be present in an image later on in the
1195 build process. Ideally, all installed files should be packaged or not
1196 installed at all. These files can be deleted at the end of
Patrick Williams2194f502022-10-16 14:26:09 -05001197 :ref:`ref-tasks-install` if the files are not needed in any package.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001198
1199- ``invalid-chars:`` Checks that the recipe metadata variables
1200 :term:`DESCRIPTION`,
1201 :term:`SUMMARY`, :term:`LICENSE`, and
1202 :term:`SECTION` do not contain non-UTF-8 characters.
1203 Some package managers do not support such characters.
1204
1205- ``invalid-packageconfig:`` Checks that no undefined features are
1206 being added to :term:`PACKAGECONFIG`. For
Andrew Geisslerc926e172021-05-07 16:11:35 -05001207 example, any name "foo" for which the following form does not exist::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001208
1209 PACKAGECONFIG[foo] = "..."
1210
Andrew Geissler09036742021-06-25 14:25:14 -05001211- ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001212 file containing these paths is incorrect since ``libtool`` adds the
1213 correct sysroot prefix when using the files automatically itself.
1214
1215- ``ldflags:`` Ensures that the binaries were linked with the
1216 :term:`LDFLAGS` options provided by the build system.
Andrew Geissler09036742021-06-25 14:25:14 -05001217 If this test fails, check that the :term:`LDFLAGS` variable is being
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001218 passed to the linker command.
1219
1220- ``libdir:`` Checks for libraries being installed into incorrect
1221 (possibly hardcoded) installation paths. For example, this test will
1222 catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1223 "lib32". Another example is when recipes install
1224 ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1225
1226- ``libexec:`` Checks if a package contains files in
1227 ``/usr/libexec``. This check is not performed if the ``libexecdir``
1228 variable has been set explicitly to ``/usr/libexec``.
1229
1230- ``packages-list:`` Checks for the same package being listed
1231 multiple times through the :term:`PACKAGES` variable
1232 value. Installing the package in this manner can cause errors during
1233 packaging.
1234
1235- ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1236 invalid format.
1237
1238- ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1239 invalid format.
1240
1241- ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1242 'link' where the specified target already exists.
1243
1244- ``perms:`` Currently, this check is unused but reserved.
1245
1246- ``pkgconfig:`` Checks ``.pc`` files for any
1247 :term:`TMPDIR`/:term:`WORKDIR` paths.
1248 Any ``.pc`` file containing these paths is incorrect since
1249 ``pkg-config`` itself adds the correct sysroot prefix when the files
1250 are accessed.
1251
1252- ``pkgname:`` Checks that all packages in
1253 :term:`PACKAGES` have names that do not contain
1254 invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1255 -).
1256
Andrew Geissler09036742021-06-25 14:25:14 -05001257- ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001258 undefined during :ref:`ref-tasks-package`.
1259
1260- ``pkgvarcheck:`` Checks through the variables
1261 :term:`RDEPENDS`,
1262 :term:`RRECOMMENDS`,
1263 :term:`RSUGGESTS`,
1264 :term:`RCONFLICTS`,
1265 :term:`RPROVIDES`,
1266 :term:`RREPLACES`, :term:`FILES`,
1267 :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1268 ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1269 there are variable sets that are not package-specific. Using these
1270 variables without a package suffix is bad practice, and might
1271 unnecessarily complicate dependencies of other packages within the
1272 same recipe or have other unintended consequences.
1273
1274- ``pn-overrides:`` Checks that a recipe does not have a name
1275 (:term:`PN`) value that appears in
1276 :term:`OVERRIDES`. If a recipe is named such that
Andrew Geissler09036742021-06-25 14:25:14 -05001277 its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
1278 :term:`PN` happens to be the same as :term:`MACHINE` or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001279 :term:`DISTRO`), it can have unexpected consequences.
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001280 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001281 turn into ``FILES = "xyz"``.
1282
1283- ``rpaths:`` Checks for rpaths in the binaries that contain build
Andrew Geissler5f350902021-07-23 13:09:54 -04001284 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001285 options are being passed to the linker commands and your binaries
1286 have potential security issues.
1287
1288- ``split-strip:`` Reports that splitting or stripping debug symbols
1289 from binaries has failed.
1290
1291- ``staticdev:`` Checks for static library files (``*.a``) in
1292 non-``staticdev`` packages.
1293
1294- ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1295 into :term:`TMPDIR` on the host. Such symlinks will
1296 work on the host, but are clearly invalid when running on the target.
1297
1298- ``textrel:`` Checks for ELF binaries that contain relocations in
1299 their ``.text`` sections, which can result in a performance impact at
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001300 runtime. See the explanation for the ``ELF binary`` message in
Andrew Geissler09209ee2020-12-13 08:44:15 -06001301 ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001302 issues.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001303
1304- ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1305 for a package are also declared on the recipe level (i.e. any license
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001306 in ``LICENSE:*`` should appear in :term:`LICENSE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001307
1308- ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1309 in the binaries that by default on a standard system are searched by
1310 the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1311 not cause any breakage, they do waste space and are unnecessary.
1312
1313- ``var-undefined:`` Reports when variables fundamental to packaging
1314 (i.e. :term:`WORKDIR`,
1315 :term:`DEPLOY_DIR`, :term:`D`,
1316 :term:`PN`, and :term:`PKGD`) are undefined
1317 during :ref:`ref-tasks-package`.
1318
1319- ``version-going-backwards:`` If Build History is enabled, reports
1320 when a package being written out has a lower version than the
1321 previously written package under the same name. If you are placing
1322 output packages into a feed and upgrading packages on a target system
1323 using that feed, the version of a package going backwards can result
1324 in the target system not correctly upgrading to the "new" version of
1325 the package.
1326
1327 .. note::
1328
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001329 This is only relevant when you are using runtime package management
1330 on your target system.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001331
1332- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1333 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1334 driver ABI names. All drivers should depend on the ABI versions that
1335 they have been built against. Driver recipes that include
1336 ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1337 automatically get these versions. Consequently, you should only need
1338 to explicitly add dependencies to binary driver recipes.
1339
1340.. _ref-classes-insserv:
1341
1342``insserv.bbclass``
1343===================
1344
Patrick Williams2390b1b2022-11-03 13:47:49 -05001345The :ref:`insserv <ref-classes-insserv>` class uses the ``insserv`` utility to update the order
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001346of symbolic links in ``/etc/rc?.d/`` within an image based on
1347dependencies specified by LSB headers in the ``init.d`` scripts
1348themselves.
1349
1350.. _ref-classes-kernel:
1351
1352``kernel.bbclass``
1353==================
1354
Patrick Williams2390b1b2022-11-03 13:47:49 -05001355The :ref:`kernel <ref-classes-kernel>` class handles building Linux kernels. The class contains
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001356code to build all kernel trees. All needed headers are staged into the
Andrew Geissler5f350902021-07-23 13:09:54 -04001357:term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001358using the :ref:`module <ref-classes-module>` class.
1359
1360This means that each built kernel module is packaged separately and
1361inter-module dependencies are created by parsing the ``modinfo`` output.
1362If all modules are required, then installing the ``kernel-modules``
1363package installs all packages with modules and various other kernel
1364packages such as ``kernel-vmlinux``.
1365
Patrick Williams2390b1b2022-11-03 13:47:49 -05001366The :ref:`kernel <ref-classes-kernel>` class contains logic that allows you to embed an initial
Patrick Williams2194f502022-10-16 14:26:09 -05001367RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For
1368information on how to build an :term:`Initramfs`, see the
1369":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001370the Yocto Project Development Tasks Manual.
1371
Patrick Williams2390b1b2022-11-03 13:47:49 -05001372Various other classes are used by the :ref:`kernel <ref-classes-kernel>` and :ref:`module <ref-classes-module>` classes
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001373internally including the :ref:`kernel-arch <ref-classes-kernel-arch>`,
1374:ref:`module-base <ref-classes-module-base>`, and
1375:ref:`linux-kernel-base <ref-classes-linux-kernel-base>` classes.
1376
1377.. _ref-classes-kernel-arch:
1378
1379``kernel-arch.bbclass``
1380=======================
1381
Patrick Williams2390b1b2022-11-03 13:47:49 -05001382The :ref:`kernel-arch <ref-classes-kernel-arch>` class sets the ``ARCH`` environment variable for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001383Linux kernel compilation (including modules).
1384
1385.. _ref-classes-kernel-devicetree:
1386
1387``kernel-devicetree.bbclass``
1388=============================
1389
Patrick Williams2390b1b2022-11-03 13:47:49 -05001390The :ref:`kernel-devicetree <ref-classes-kernel-devicetree>` class, which is inherited by the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001391:ref:`kernel <ref-classes-kernel>` class, supports device tree
1392generation.
1393
1394.. _ref-classes-kernel-fitimage:
1395
1396``kernel-fitimage.bbclass``
1397===========================
1398
Patrick Williams2390b1b2022-11-03 13:47:49 -05001399The :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` class provides support to pack a kernel image,
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001400device trees, a U-boot script, a Initramfs bundle and a RAM disk
1401into a single FIT image. In theory, a FIT image can support any number
1402of kernels, U-boot scripts, Initramfs bundles, RAM disks and device-trees.
Patrick Williams2390b1b2022-11-03 13:47:49 -05001403However, :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` currently only supports
Patrick Williams975a06f2022-10-21 14:42:47 -05001404limited usecases: just one kernel image, an optional U-boot script,
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001405an optional Initramfs bundle, an optional RAM disk, and any number of
1406device tree.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001407
1408To create a FIT image, it is required that :term:`KERNEL_CLASSES`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001409is set to include "kernel-fitimage" and :term:`KERNEL_IMAGETYPE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001410is set to "fitImage".
1411
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001412The options for the device tree compiler passed to ``mkimage -D``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001413when creating the FIT image are specified using the
1414:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1415
1416Only a single kernel can be added to the FIT image created by
Patrick Williams2390b1b2022-11-03 13:47:49 -05001417:ref:`kernel-fitimage <ref-classes-kernel-fitimage>` and the kernel image in FIT is mandatory. The
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001418address where the kernel image is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001419specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
1420:term:`UBOOT_ENTRYPOINT`.
1421
1422Multiple device trees can be added to the FIT image created by
Patrick Williams2390b1b2022-11-03 13:47:49 -05001423:ref:`kernel-fitimage <ref-classes-kernel-fitimage>` and the device tree is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001424The address where the device tree is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001425specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001426and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001427
1428Only a single RAM disk can be added to the FIT image created by
Patrick Williams2390b1b2022-11-03 13:47:49 -05001429:ref:`kernel-fitimage <ref-classes-kernel-fitimage>` and the RAM disk in FIT is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001430The address where the RAM disk image is to be loaded by U-Boot
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001431is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
1432:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to FIT image when
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001433:term:`INITRAMFS_IMAGE` is specified and that :term:`INITRAMFS_IMAGE_BUNDLE`
1434is set to 0.
1435
1436Only a single Initramfs bundle can be added to the FIT image created by
Patrick Williams2390b1b2022-11-03 13:47:49 -05001437:ref:`kernel-fitimage <ref-classes-kernel-fitimage>` and the Initramfs bundle in FIT is optional.
Andrew Geissler595f6302022-01-24 19:11:47 +00001438In case of Initramfs, the kernel is configured to be bundled with the root filesystem
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001439in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
Andrew Geissler595f6302022-01-24 19:11:47 +00001440When the kernel is copied to RAM and executed, it unpacks the Initramfs root filesystem.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001441The Initramfs bundle can be enabled when :term:`INITRAMFS_IMAGE`
1442is specified and that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
1443The address where the Initramfs bundle is to be loaded by U-boot is specified
1444by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1445
1446Only a single U-boot boot script can be added to the FIT image created by
Patrick Williams2390b1b2022-11-03 13:47:49 -05001447:ref:`kernel-fitimage <ref-classes-kernel-fitimage>` and the boot script is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001448The boot script is specified in the ITS file as a text file containing
1449U-boot commands. When using a boot script the user should configure the
Patrick Williams2194f502022-10-16 14:26:09 -05001450U-boot :ref:`ref-tasks-install` task to copy the script to sysroot.
Patrick Williams2390b1b2022-11-03 13:47:49 -05001451So the script can be included in the FIT image by the :ref:`kernel-fitimage <ref-classes-kernel-fitimage>`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001452class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
1453load the boot script from the FIT image and executes it.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001454
Patrick Williams2390b1b2022-11-03 13:47:49 -05001455The FIT image generated by :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` class is signed when the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001456variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1457:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1458appropriately. The default values used for :term:`FIT_HASH_ALG` and
Patrick Williams2390b1b2022-11-03 13:47:49 -05001459:term:`FIT_SIGN_ALG` in :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` are "sha256" and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001460"rsa2048" respectively. The keys for signing fitImage can be generated using
Patrick Williams2390b1b2022-11-03 13:47:49 -05001461the :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` class when both :term:`FIT_GENERATE_KEYS` and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001462:term:`UBOOT_SIGN_ENABLE` are set to "1".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001463
1464
1465.. _ref-classes-kernel-grub:
1466
1467``kernel-grub.bbclass``
1468=======================
1469
Patrick Williams2390b1b2022-11-03 13:47:49 -05001470The :ref:`kernel-grub <ref-classes-kernel-grub>` class updates the boot area and the boot menu with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001471the kernel as the priority boot mechanism while installing a RPM to
1472update the kernel on a deployed target.
1473
1474.. _ref-classes-kernel-module-split:
1475
1476``kernel-module-split.bbclass``
1477===============================
1478
Patrick Williams2390b1b2022-11-03 13:47:49 -05001479The :ref:`kernel-module-split <ref-classes-kernel-module-split>` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001480splitting Linux kernel modules into separate packages.
1481
1482.. _ref-classes-kernel-uboot:
1483
1484``kernel-uboot.bbclass``
1485========================
1486
Patrick Williams2390b1b2022-11-03 13:47:49 -05001487The :ref:`kernel-uboot <ref-classes-kernel-uboot>` class provides support for building from
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001488vmlinux-style kernel sources.
1489
1490.. _ref-classes-kernel-uimage:
1491
1492``kernel-uimage.bbclass``
1493=========================
1494
Patrick Williams2390b1b2022-11-03 13:47:49 -05001495The :ref:`kernel-uimage <ref-classes-kernel-uimage>` class provides support to pack uImage.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001496
1497.. _ref-classes-kernel-yocto:
1498
1499``kernel-yocto.bbclass``
1500========================
1501
Patrick Williams2390b1b2022-11-03 13:47:49 -05001502The :ref:`kernel-yocto <ref-classes-kernel-yocto>` class provides common functionality for building
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001503from linux-yocto style kernel source repositories.
1504
1505.. _ref-classes-kernelsrc:
1506
1507``kernelsrc.bbclass``
1508=====================
1509
Patrick Williams2390b1b2022-11-03 13:47:49 -05001510The :ref:`kernelsrc <ref-classes-kernelsrc>` class sets the Linux kernel source and version.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001511
1512.. _ref-classes-lib_package:
1513
1514``lib_package.bbclass``
1515=======================
1516
Patrick Williams2390b1b2022-11-03 13:47:49 -05001517The :ref:`lib_package <ref-classes-lib_package>` class supports recipes that build libraries and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001518produce executable binaries, where those binaries should not be
1519installed by default along with the library. Instead, the binaries are
1520added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1521make their installation optional.
1522
1523.. _ref-classes-libc*:
1524
1525``libc*.bbclass``
1526=================
1527
Patrick Williams2390b1b2022-11-03 13:47:49 -05001528The :ref:`libc* <ref-classes-libc*>` classes support recipes that build packages with ``libc``:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001529
Patrick Williams2390b1b2022-11-03 13:47:49 -05001530- The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001531 ``libc``.
1532
Patrick Williams2390b1b2022-11-03 13:47:49 -05001533- The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001534 ``eglibc``.
1535
1536.. _ref-classes-license:
1537
1538``license.bbclass``
1539===================
1540
Patrick Williams2390b1b2022-11-03 13:47:49 -05001541The :ref:`license <ref-classes-license>` class provides license manifest creation and license
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001542exclusion. This class is enabled by default using the default value for
1543the :term:`INHERIT_DISTRO` variable.
1544
1545.. _ref-classes-linux-kernel-base:
1546
1547``linux-kernel-base.bbclass``
1548=============================
1549
Patrick Williams2390b1b2022-11-03 13:47:49 -05001550The :ref:`linux-kernel-base <ref-classes-linux-kernel-base>` class provides common functionality for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001551recipes that build out of the Linux kernel source tree. These builds
1552goes beyond the kernel itself. For example, the Perf recipe also
1553inherits this class.
1554
1555.. _ref-classes-linuxloader:
1556
1557``linuxloader.bbclass``
1558=======================
1559
1560Provides the function ``linuxloader()``, which gives the value of the
1561dynamic loader/linker provided on the platform. This value is used by a
1562number of other classes.
1563
1564.. _ref-classes-logging:
1565
1566``logging.bbclass``
1567===================
1568
Patrick Williams2390b1b2022-11-03 13:47:49 -05001569The :ref:`logging <ref-classes-logging>` class provides the standard shell functions used to log
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001570messages for various BitBake severity levels (i.e. ``bbplain``,
1571``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1572
Patrick Williams2390b1b2022-11-03 13:47:49 -05001573This class is enabled by default since it is inherited by the :ref:`base <ref-classes-base>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001574class.
1575
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001576.. _ref-classes-metadata_scm:
1577
1578``metadata_scm.bbclass``
1579========================
1580
Patrick Williams2390b1b2022-11-03 13:47:49 -05001581The :ref:`metadata_scm <ref-classes-metadata_scm>` class provides functionality for querying the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001582branch and revision of a Source Code Manager (SCM) repository.
1583
1584The :ref:`base <ref-classes-base>` class uses this class to print the
1585revisions of each layer before starting every build. The
Patrick Williams2390b1b2022-11-03 13:47:49 -05001586:ref:`metadata_scm <ref-classes-metadata_scm>` class is enabled by default because it is inherited by
1587the :ref:`base <ref-classes-base>` class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001588
1589.. _ref-classes-migrate_localcount:
1590
1591``migrate_localcount.bbclass``
1592==============================
1593
Patrick Williams2390b1b2022-11-03 13:47:49 -05001594The :ref:`migrate_localcount <ref-classes-migrate_localcount>` class verifies a recipe's localcount data and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001595increments it appropriately.
1596
1597.. _ref-classes-mime:
1598
1599``mime.bbclass``
1600================
1601
Patrick Williams2390b1b2022-11-03 13:47:49 -05001602The :ref:`mime <ref-classes-mime>` class generates the proper post-install and post-remove
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001603(postinst/postrm) scriptlets for packages that install MIME type files.
1604These scriptlets call ``update-mime-database`` to add the MIME types to
1605the shared database.
1606
Patrick Williams7784c422022-11-17 07:29:11 -06001607.. _ref-classes-mime-xdg:
1608
1609``mime-xdg.bbclass``
1610====================
1611
1612The :ref:`mime-xdg <ref-classes-mime-xdg>` class generates the proper
1613post-install and post-remove (postinst/postrm) scriptlets for packages
1614that install ``.desktop`` files containing ``MimeType`` entries.
1615These scriptlets call ``update-desktop-database`` to add the MIME types
1616to the database of MIME types handled by desktop files.
1617
1618Thanks to this class, when users open a file through a file browser
1619on recently created images, they don't have to choose the application
1620to open the file from the pool of all known applications, even the ones
1621that cannot open the selected file.
1622
1623If you have recipes installing their ``.desktop`` files as absolute
1624symbolic links, the detection of such files cannot be done by the current
1625implementation of this class. In this case, you have to add the corresponding
1626package names to the :term:`MIME_XDG_PACKAGES` variable.
1627
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001628.. _ref-classes-mirrors:
1629
1630``mirrors.bbclass``
1631===================
1632
Patrick Williams2390b1b2022-11-03 13:47:49 -05001633The :ref:`mirrors <ref-classes-mirrors>` class sets up some standard
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001634:term:`MIRRORS` entries for source code mirrors. These
1635mirrors provide a fall-back path in case the upstream source specified
1636in :term:`SRC_URI` within recipes is unavailable.
1637
1638This class is enabled by default since it is inherited by the
1639:ref:`base <ref-classes-base>` class.
1640
1641.. _ref-classes-module:
1642
1643``module.bbclass``
1644==================
1645
Patrick Williams2390b1b2022-11-03 13:47:49 -05001646The :ref:`module <ref-classes-module>` class provides support for building out-of-tree Linux
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001647kernel modules. The class inherits the
1648:ref:`module-base <ref-classes-module-base>` and
1649:ref:`kernel-module-split <ref-classes-kernel-module-split>` classes,
1650and implements the :ref:`ref-tasks-compile` and
1651:ref:`ref-tasks-install` tasks. The class provides
1652everything needed to build and package a kernel module.
1653
1654For general information on out-of-tree Linux kernel modules, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001655":ref:`kernel-dev/common:incorporating out-of-tree modules`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001656section in the Yocto Project Linux Kernel Development Manual.
1657
1658.. _ref-classes-module-base:
1659
1660``module-base.bbclass``
1661=======================
1662
Patrick Williams2390b1b2022-11-03 13:47:49 -05001663The :ref:`module-base <ref-classes-module-base>` class provides the base functionality for building
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001664Linux kernel modules. Typically, a recipe that builds software that
1665includes one or more kernel modules and has its own means of building
1666the module inherits this class as opposed to inheriting the
1667:ref:`module <ref-classes-module>` class.
1668
1669.. _ref-classes-multilib*:
1670
1671``multilib*.bbclass``
1672=====================
1673
Patrick Williams2390b1b2022-11-03 13:47:49 -05001674The :ref:`multilib* <ref-classes-multilib*>` classes provide support for building libraries with
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001675different target optimizations or target architectures and installing
1676them side-by-side in the same image.
1677
1678For more information on using the Multilib feature, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001679":ref:`dev-manual/common-tasks:combining multiple versions of library files into one image`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001680section in the Yocto Project Development Tasks Manual.
1681
1682.. _ref-classes-native:
1683
1684``native.bbclass``
1685==================
1686
Patrick Williams2390b1b2022-11-03 13:47:49 -05001687The :ref:`native <ref-classes-native>` class provides common functionality for recipes that
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001688build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
1689or other tools from the build host).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001690
1691You can create a recipe that builds tools that run natively on the host
1692a couple different ways:
1693
Patrick Williams2390b1b2022-11-03 13:47:49 -05001694- Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`native <ref-classes-native>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001695 class. If you use this method, you must order the inherit statement
1696 in the recipe after all other inherit statements so that the
Patrick Williams2390b1b2022-11-03 13:47:49 -05001697 :ref:`native <ref-classes-native>` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001698
1699 .. note::
1700
1701 When creating a recipe this way, the recipe name must follow this
Andrew Geisslerc926e172021-05-07 16:11:35 -05001702 naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001703
1704 myrecipe-native.bb
1705
1706
1707 Not using this naming convention can lead to subtle problems
1708 caused by existing code that depends on that naming convention.
1709
Andrew Geisslerc926e172021-05-07 16:11:35 -05001710- Create or modify a target recipe that contains the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001711
1712 BBCLASSEXTEND = "native"
1713
1714 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001715 recipe, use ``:class-native`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001716 specify any functionality specific to the respective native or target
1717 case.
1718
Patrick Williams2390b1b2022-11-03 13:47:49 -05001719Although applied differently, the :ref:`native <ref-classes-native>` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001720methods. The advantage of the second method is that you do not need to
1721have two separate recipes (assuming you need both) for native and
1722target. All common parts of the recipe are automatically shared.
1723
1724.. _ref-classes-nativesdk:
1725
1726``nativesdk.bbclass``
1727=====================
1728
Patrick Williams2390b1b2022-11-03 13:47:49 -05001729The :ref:`nativesdk <ref-classes-nativesdk>` class provides common functionality for recipes that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001730wish to build tools to run as part of an SDK (i.e. tools that run on
1731:term:`SDKMACHINE`).
1732
1733You can create a recipe that builds tools that run on the SDK machine a
1734couple different ways:
1735
Andrew Geisslereff27472021-10-29 15:35:00 -05001736- Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
Patrick Williams2390b1b2022-11-03 13:47:49 -05001737 :ref:`nativesdk <ref-classes-nativesdk>` class. If you use this method, you must order the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001738 inherit statement in the recipe after all other inherit statements so
Patrick Williams2390b1b2022-11-03 13:47:49 -05001739 that the :ref:`nativesdk <ref-classes-nativesdk>` class is inherited last.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001740
Patrick Williams2390b1b2022-11-03 13:47:49 -05001741- Create a :ref:`nativesdk <ref-classes-nativesdk>` variant of any recipe by adding the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001742
1743 BBCLASSEXTEND = "nativesdk"
1744
1745 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001746 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001747 specify any functionality specific to the respective SDK machine or
1748 target case.
1749
1750.. note::
1751
Andrew Geisslerc926e172021-05-07 16:11:35 -05001752 When creating a recipe, you must follow this naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001753
1754 nativesdk-myrecipe.bb
1755
1756
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001757 Not doing so can lead to subtle problems because there is code that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001758 depends on the naming convention.
1759
Patrick Williams2390b1b2022-11-03 13:47:49 -05001760Although applied differently, the :ref:`nativesdk <ref-classes-nativesdk>` class is used with both
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001761methods. The advantage of the second method is that you do not need to
1762have two separate recipes (assuming you need both) for the SDK machine
1763and the target. All common parts of the recipe are automatically shared.
1764
1765.. _ref-classes-nopackages:
1766
1767``nopackages.bbclass``
1768======================
1769
1770Disables packaging tasks for those recipes and classes where packaging
1771is not needed.
1772
1773.. _ref-classes-npm:
1774
1775``npm.bbclass``
1776===============
1777
Patrick Williams7784c422022-11-17 07:29:11 -06001778Provides support for building Node.js software fetched using the
1779:wikipedia:`node package manager (NPM) <Npm_(software)>`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001780
1781.. note::
1782
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001783 Currently, recipes inheriting this class must use the ``npm://``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001784 fetcher to have dependencies fetched and packaged automatically.
1785
1786For information on how to create NPM packages, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001787":ref:`dev-manual/common-tasks:creating node package manager (npm) packages`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001788section in the Yocto Project Development Tasks Manual.
1789
1790.. _ref-classes-oelint:
1791
1792``oelint.bbclass``
1793==================
1794
Patrick Williams2390b1b2022-11-03 13:47:49 -05001795The :ref:`oelint <ref-classes-oelint>` class is an obsolete lint checking tool available in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001796``meta/classes`` in the :term:`Source Directory`.
1797
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001798There are some classes that could be generally useful in OE-Core but
Patrick Williams2390b1b2022-11-03 13:47:49 -05001799are never actually used within OE-Core itself. The :ref:`oelint <ref-classes-oelint>` class is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001800one such example. However, being aware of this class can reduce the
1801proliferation of different versions of similar classes across multiple
1802layers.
1803
Andrew Geissler5199d832021-09-24 16:47:35 -05001804.. _ref-classes-overlayfs:
1805
1806``overlayfs.bbclass``
1807=======================
1808
Andrew Geissler595f6302022-01-24 19:11:47 +00001809It's often desired in Embedded System design to have a read-only root filesystem.
Andrew Geissler5199d832021-09-24 16:47:35 -05001810But a lot of different applications might want to have read-write access to
1811some parts of a filesystem. It can be especially useful when your update mechanism
Andrew Geissler595f6302022-01-24 19:11:47 +00001812overwrites the whole root filesystem, but you may want your application data to be preserved
Andrew Geissler5199d832021-09-24 16:47:35 -05001813between updates. The :ref:`overlayfs <ref-classes-overlayfs>` class provides a way
1814to achieve that by means of ``overlayfs`` and at the same time keeping the base
Andrew Geissler595f6302022-01-24 19:11:47 +00001815root filesystem read-only.
Andrew Geissler5199d832021-09-24 16:47:35 -05001816
1817To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
1818layer in your machine configuration. The underlying file system can be anything that
1819is supported by ``overlayfs``. This has to be done in your machine configuration::
1820
1821 OVERLAYFS_MOUNT_POINT[data] = "/data"
1822
1823.. note::
1824
1825 * QA checks fail to catch file existence if you redefine this variable in your recipe!
1826 * Only the existence of the systemd mount unit file is checked, not its contents.
1827 * To get more details on ``overlayfs``, its internals and supported operations, please refer
Patrick Williams2390b1b2022-11-03 13:47:49 -05001828 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 -05001829
1830The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
1831(e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
1832
1833Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
1834
1835 OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
1836
1837To support several mount points you can use a different variable flag. Assuming we
1838want to have a writable location on the file system, but do not need that the data
Andrew Geissler595f6302022-01-24 19:11:47 +00001839survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs``
1840file system.
Andrew Geissler5199d832021-09-24 16:47:35 -05001841
1842In your machine configuration::
1843
1844 OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
1845
1846and then in your recipe::
1847
1848 OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
1849
Andrew Geissler595f6302022-01-24 19:11:47 +00001850On a practical note, your application recipe might require multiple
1851overlays to be mounted before running to avoid writing to the underlying
1852file system (which can be forbidden in case of read-only file system)
1853To achieve that :ref:`overlayfs <ref-classes-overlayfs>` provides a ``systemd``
1854helper service for mounting overlays. This helper service is named
1855``${PN}-overlays.service`` and can be depended on in your application recipe
1856(named ``application`` in the following example) ``systemd`` unit by adding
1857to the unit the following::
1858
1859 [Unit]
1860 After=application-overlays.service
1861 Requires=application-overlays.service
1862
Andrew Geissler5199d832021-09-24 16:47:35 -05001863.. note::
1864
1865 The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
Andrew Geissler595f6302022-01-24 19:11:47 +00001866 In order to get ``/etc`` in overlayfs, see :ref:`overlayfs-etc <ref-classes-overlayfs-etc>`.
1867
1868.. _ref-classes-overlayfs-etc:
1869
1870``overlayfs-etc.bbclass``
1871=========================
1872
1873In order to have the ``/etc`` directory in overlayfs a special handling at early
1874boot stage is required. The idea is to supply a custom init script that mounts
1875``/etc`` before launching the actual init program, because the latter already
1876requires ``/etc`` to be mounted.
1877
1878Example usage in image recipe::
1879
1880 IMAGE_FEATURES += "overlayfs-etc"
1881
1882.. note::
1883
1884 This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES`
1885
1886Your machine configuration should define at least the device, mount point, and file system type
1887you are going to use for ``overlayfs``::
1888
1889 OVERLAYFS_ETC_MOUNT_POINT = "/data"
1890 OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2"
1891 OVERLAYFS_ETC_FSTYPE ?= "ext4"
1892
1893To control more mount options you should consider setting mount options
1894(``defaults`` is used by default)::
1895
1896 OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync"
1897
1898The class provides two options for ``/sbin/init`` generation:
1899
1900- The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig``
1901 and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage
1902 that you won't need to change any kernel parameters in order to make it work,
1903 but it poses a restriction that package-management can't be used, because updating
1904 the init manager would remove the generated script.
1905
1906- If you wish to keep original init as is, you can set::
1907
1908 OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0"
1909
1910 Then the generated init will be named ``/sbin/preinit`` and you would need to extend your
1911 kernel parameters manually in your bootloader configuration.
Andrew Geissler5199d832021-09-24 16:47:35 -05001912
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001913.. _ref-classes-own-mirrors:
1914
1915``own-mirrors.bbclass``
1916=======================
1917
Patrick Williams2390b1b2022-11-03 13:47:49 -05001918The :ref:`own-mirrors <ref-classes-own-mirrors>` class makes it easier to set up your own
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001919:term:`PREMIRRORS` from which to first fetch source
1920before attempting to fetch it from the upstream specified in
1921:term:`SRC_URI` within each recipe.
1922
1923To use this class, inherit it globally and specify
Andrew Geisslerc926e172021-05-07 16:11:35 -05001924:term:`SOURCE_MIRROR_URL`. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001925
1926 INHERIT += "own-mirrors"
1927 SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
1928
1929You can specify only a single URL
Andrew Geissler09036742021-06-25 14:25:14 -05001930in :term:`SOURCE_MIRROR_URL`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001931
1932.. _ref-classes-package:
1933
1934``package.bbclass``
1935===================
1936
Patrick Williams2390b1b2022-11-03 13:47:49 -05001937The :ref:`package <ref-classes-package>` class supports generating packages from a build's
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001938output. The core generic functionality is in ``package.bbclass``. The
1939code specific to particular package types resides in these
1940package-specific classes:
1941:ref:`package_deb <ref-classes-package_deb>`,
1942:ref:`package_rpm <ref-classes-package_rpm>`,
1943:ref:`package_ipk <ref-classes-package_ipk>`, and
1944:ref:`package_tar <ref-classes-package_tar>`.
1945
1946.. note::
1947
Patrick Williams2390b1b2022-11-03 13:47:49 -05001948 The :ref:`package_tar <ref-classes-package_tar>` class is broken and
1949 not supported. It is recommended that you do not use this class.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001950
1951You can control the list of resulting package formats by using the
Andrew Geissler09036742021-06-25 14:25:14 -05001952:term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001953configuration file, which is located in the :term:`Build Directory`.
Patrick Williams2390b1b2022-11-03 13:47:49 -05001954When defining the variable, you can specify one or more package types.
1955Since images are generated from packages, a packaging class is needed
1956to enable image generation. The first class listed in this variable is
1957used for image generation.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001958
1959If you take the optional step to set up a repository (package feed) on
1960the development host that can be used by DNF, you can install packages
1961from the feed while you are running the image on the target (i.e.
1962runtime installation of packages). For more information, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001963":ref:`dev-manual/common-tasks:using runtime package management`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001964section in the Yocto Project Development Tasks Manual.
1965
1966The package-specific class you choose can affect build-time performance
1967and has space ramifications. In general, building a package with IPK
1968takes about thirty percent less time as compared to using RPM to build
1969the same or similar package. This comparison takes into account a
1970complete build of the package with all dependencies previously built.
1971The reason for this discrepancy is because the RPM package manager
1972creates and processes more :term:`Metadata` than the IPK package
Andrew Geissler09036742021-06-25 14:25:14 -05001973manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
Patrick Williams2390b1b2022-11-03 13:47:49 -05001974":ref:`package_ipk <ref-classes-package_ipk>`" if you are building smaller systems.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001975
1976Before making your package manager decision, however, you should
1977consider some further things about using RPM:
1978
1979- RPM starts to provide more abilities than IPK due to the fact that it
1980 processes more Metadata. For example, this information includes
1981 individual file types, file checksum generation and evaluation on
1982 install, sparse file support, conflict detection and resolution for
1983 Multilib systems, ACID style upgrade, and repackaging abilities for
1984 rollbacks.
1985
1986- For smaller systems, the extra space used for the Berkeley Database
1987 and the amount of metadata when using RPM can affect your ability to
1988 perform on-device upgrades.
1989
1990You can find additional information on the effects of the package class
1991at these two Yocto Project mailing list links:
1992
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001993- :yocto_lists:`/pipermail/poky/2011-May/006362.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001994
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001995- :yocto_lists:`/pipermail/poky/2011-May/006363.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001996
1997.. _ref-classes-package_deb:
1998
1999``package_deb.bbclass``
2000=======================
2001
Patrick Williams2390b1b2022-11-03 13:47:49 -05002002The :ref:`package_deb <ref-classes-package_deb>` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002003use the Debian (i.e. ``.deb``) file format. The class ensures the
2004packages are written out in a ``.deb`` file format to the
2005``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
2006
2007This class inherits the :ref:`package <ref-classes-package>` class and
2008is enabled through the :term:`PACKAGE_CLASSES`
2009variable in the ``local.conf`` file.
2010
2011.. _ref-classes-package_ipk:
2012
2013``package_ipk.bbclass``
2014=======================
2015
Patrick Williams2390b1b2022-11-03 13:47:49 -05002016The :ref:`package_ipk <ref-classes-package_ipk>` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002017use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
2018are written out in a ``.ipk`` file format to the
2019``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
2020
2021This class inherits the :ref:`package <ref-classes-package>` class and
2022is enabled through the :term:`PACKAGE_CLASSES`
2023variable in the ``local.conf`` file.
2024
2025.. _ref-classes-package_rpm:
2026
2027``package_rpm.bbclass``
2028=======================
2029
Patrick Williams2390b1b2022-11-03 13:47:49 -05002030The :ref:`package_rpm <ref-classes-package_rpm>` class provides support for creating packages that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002031use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
2032are written out in a ``.rpm`` file format to the
2033``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
2034
2035This class inherits the :ref:`package <ref-classes-package>` class and
2036is enabled through the :term:`PACKAGE_CLASSES`
2037variable in the ``local.conf`` file.
2038
2039.. _ref-classes-package_tar:
2040
2041``package_tar.bbclass``
2042=======================
2043
Patrick Williams2390b1b2022-11-03 13:47:49 -05002044The :ref:`package_tar <ref-classes-package_tar>` class provides support for creating tarballs. The
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002045class ensures the packages are written out in a tarball format to the
2046``${``\ :term:`DEPLOY_DIR_TAR`\ ``}`` directory.
2047
2048This class inherits the :ref:`package <ref-classes-package>` class and
2049is enabled through the :term:`PACKAGE_CLASSES`
2050variable in the ``local.conf`` file.
2051
2052.. note::
2053
Patrick Williams2390b1b2022-11-03 13:47:49 -05002054 You cannot specify the :ref:`package_tar <ref-classes-package_tar>` class first using the
Andrew Geissler09036742021-06-25 14:25:14 -05002055 :term:`PACKAGE_CLASSES` variable. You must use ``.deb``, ``.ipk``, or ``.rpm``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002056 file formats for your image or SDK.
2057
2058.. _ref-classes-packagedata:
2059
2060``packagedata.bbclass``
2061=======================
2062
Patrick Williams2390b1b2022-11-03 13:47:49 -05002063The :ref:`packagedata <ref-classes-packagedata>` class provides common functionality for reading
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002064``pkgdata`` files found in :term:`PKGDATA_DIR`. These
2065files contain information about each output package produced by the
2066OpenEmbedded build system.
2067
2068This class is enabled by default because it is inherited by the
2069:ref:`package <ref-classes-package>` class.
2070
2071.. _ref-classes-packagegroup:
2072
2073``packagegroup.bbclass``
2074========================
2075
Patrick Williams2390b1b2022-11-03 13:47:49 -05002076The :ref:`packagegroup <ref-classes-packagegroup>` class sets default values appropriate for package
Andrew Geissler09036742021-06-25 14:25:14 -05002077group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002078so forth). It is highly recommended that all package group recipes
2079inherit this class.
2080
2081For information on how to use this class, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002082":ref:`dev-manual/common-tasks:customizing images using custom package groups`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002083section in the Yocto Project Development Tasks Manual.
2084
2085Previously, this class was called the ``task`` class.
2086
2087.. _ref-classes-patch:
2088
2089``patch.bbclass``
2090=================
2091
Patrick Williams2390b1b2022-11-03 13:47:49 -05002092The :ref:`patch <ref-classes-patch>` class provides all functionality for applying patches
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002093during the :ref:`ref-tasks-patch` task.
2094
2095This class is enabled by default because it is inherited by the
2096:ref:`base <ref-classes-base>` class.
2097
2098.. _ref-classes-perlnative:
2099
2100``perlnative.bbclass``
2101======================
2102
Patrick Williams2390b1b2022-11-03 13:47:49 -05002103When inherited by a recipe, the :ref:`perlnative <ref-classes-perlnative>` class supports using the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002104native version of Perl built by the build system rather than using the
2105version provided by the build host.
2106
Patrick Williams975a06f2022-10-21 14:42:47 -05002107.. _ref-classes-pypi:
2108
2109``pypi.bbclass``
2110================
2111
Patrick Williams2390b1b2022-11-03 13:47:49 -05002112The :ref:`pypi <ref-classes-pypi>` class sets variables appropriately for recipes that build
Patrick Williams975a06f2022-10-21 14:42:47 -05002113Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
2114By default it determines the PyPI package name based upon :term:`BPN`
2115(stripping the "python-" or "python3-" prefix off if present), however in
2116some cases you may need to set it manually in the recipe by setting
2117:term:`PYPI_PACKAGE`.
2118
Patrick Williams2390b1b2022-11-03 13:47:49 -05002119Variables set by the :ref:`pypi <ref-classes-pypi>` class include :term:`SRC_URI`, :term:`SECTION`,
Patrick Williams975a06f2022-10-21 14:42:47 -05002120:term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
2121and :term:`CVE_PRODUCT`.
2122
Patrick Williams45852732022-04-02 08:58:32 -05002123.. _ref-classes-python_flit_core:
2124
2125``python_flit_core.bbclass``
2126============================
2127
Patrick Williams2390b1b2022-11-03 13:47:49 -05002128The :ref:`python_flit_core <ref-classes-python_flit_core>` class enables building Python modules which declare
Patrick Williams45852732022-04-02 08:58:32 -05002129the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2130``flit_core.buildapi`` ``build-backend`` in the ``[build-system]``
2131section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2132
2133Python modules built with ``flit_core.buildapi`` are pure Python (no
2134``C`` or ``Rust`` extensions).
2135
2136Internally this uses the :ref:`python_pep517 <ref-classes-python_pep517>` class.
2137
Andrew Geissler9aee5002022-03-30 16:27:02 +00002138.. _ref-classes-python_pep517:
2139
2140``python_pep517.bbclass``
Patrick Williams45852732022-04-02 08:58:32 -05002141=========================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002142
Patrick Williams2390b1b2022-11-03 13:47:49 -05002143The :ref:`python_pep517 <ref-classes-python_pep517>` class builds and installs a Python ``wheel`` binary
Patrick Williams45852732022-04-02 08:58:32 -05002144archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__).
Andrew Geissler9aee5002022-03-30 16:27:02 +00002145
Patrick Williams45852732022-04-02 08:58:32 -05002146Recipes wouldn't inherit this directly, instead typically another class will
Andrew Geissler615f2f12022-07-15 14:00:58 -05002147inherit this and add the relevant native dependencies.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002148
Patrick Williams45852732022-04-02 08:58:32 -05002149Examples of classes which do this are :ref:`python_flit_core
2150<ref-classes-python_flit_core>`, :ref:`python_setuptools_build_meta
2151<ref-classes-python_setuptools_build_meta>`, and :ref:`python_poetry_core
2152<ref-classes-python_poetry_core>`.
2153
2154.. _ref-classes-python_poetry_core:
2155
2156``python_poetry_core.bbclass``
2157==============================
2158
Patrick Williams2390b1b2022-11-03 13:47:49 -05002159The :ref:`python_poetry_core <ref-classes-python_poetry_core>` class enables building Python modules which use the
Patrick Williams45852732022-04-02 08:58:32 -05002160`Poetry Core <https://python-poetry.org>`__ build system.
2161
2162Internally this uses the :ref:`python_pep517 <ref-classes-python_pep517>` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002163
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002164.. _ref-classes-pixbufcache:
2165
2166``pixbufcache.bbclass``
2167=======================
2168
Patrick Williams2390b1b2022-11-03 13:47:49 -05002169The :ref:`pixbufcache <ref-classes-pixbufcache>` class generates the proper post-install and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002170post-remove (postinst/postrm) scriptlets for packages that install
2171pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
2172call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
2173Since the cache files are architecture-specific, ``update_pixbuf_cache``
2174is run using QEMU if the postinst scriptlets need to be run on the build
2175host during image creation.
2176
2177If the pixbuf loaders being installed are in packages other than the
2178recipe's main package, set
2179:term:`PIXBUF_PACKAGES` to specify the packages
2180containing the loaders.
2181
2182.. _ref-classes-pkgconfig:
2183
2184``pkgconfig.bbclass``
2185=====================
2186
Patrick Williams2390b1b2022-11-03 13:47:49 -05002187The :ref:`pkgconfig <ref-classes-pkgconfig>` class provides a standard way to get header and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002188library information by using ``pkg-config``. This class aims to smooth
2189integration of ``pkg-config`` into libraries that use it.
2190
2191During staging, BitBake installs ``pkg-config`` data into the
2192``sysroots/`` directory. By making use of sysroot functionality within
Patrick Williams2390b1b2022-11-03 13:47:49 -05002193``pkg-config``, the :ref:`pkgconfig <ref-classes-pkgconfig>` class no longer has to manipulate the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002194files.
2195
2196.. _ref-classes-populate-sdk:
2197
2198``populate_sdk.bbclass``
2199========================
2200
Patrick Williams2390b1b2022-11-03 13:47:49 -05002201The :ref:`populate_sdk <ref-classes-populate-sdk>` class provides support for SDK-only recipes. For
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002202information on advantages gained when building a cross-development
2203toolchain using the :ref:`ref-tasks-populate_sdk`
Andrew Geissler09209ee2020-12-13 08:44:15 -06002204task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002205section in the Yocto Project Application Development and the Extensible
2206Software Development Kit (eSDK) manual.
2207
2208.. _ref-classes-populate-sdk-*:
2209
2210``populate_sdk_*.bbclass``
2211==========================
2212
Patrick Williams2390b1b2022-11-03 13:47:49 -05002213The :ref:`populate_sdk_* <ref-classes-populate-sdk-*>` classes support SDK creation and consist of the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002214following classes:
2215
Patrick Williams2390b1b2022-11-03 13:47:49 -05002216- :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002217 all package managers (i.e. DEB, RPM, and opkg).
2218
Patrick Williams2390b1b2022-11-03 13:47:49 -05002219- :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002220 package manager.
2221
Patrick Williams2390b1b2022-11-03 13:47:49 -05002222- :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002223 package manager.
2224
Patrick Williams2390b1b2022-11-03 13:47:49 -05002225- :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002226 (IPK format) package manager.
2227
Patrick Williams2390b1b2022-11-03 13:47:49 -05002228- :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002229 package managers.
2230
Patrick Williams2390b1b2022-11-03 13:47:49 -05002231The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002232``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2233:term:`IMAGE_PKGTYPE`.
2234
2235The base class ensures all source and destination directories are
2236established and then populates the SDK. After populating the SDK, the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002237:ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002238``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2239contains the cross-compiler and associated tooling, and the target,
2240which contains a target root filesystem that is configured for the SDK
2241usage. These two images reside in :term:`SDK_OUTPUT`,
Andrew Geisslerc926e172021-05-07 16:11:35 -05002242which consists of the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002243
2244 ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2245 ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2246
2247Finally, the base populate SDK class creates the toolchain environment
2248setup script, the tarball of the SDK, and the installer.
2249
Patrick Williams2390b1b2022-11-03 13:47:49 -05002250The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and
2251:ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK.
2252These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002253class.
2254
2255For more information on the cross-development toolchain generation, see
Andrew Geissler09209ee2020-12-13 08:44:15 -06002256the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002257section in the Yocto Project Overview and Concepts Manual. For
2258information on advantages gained when building a cross-development
2259toolchain using the :ref:`ref-tasks-populate_sdk`
2260task, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002261":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002262section in the Yocto Project Application Development and the Extensible
2263Software Development Kit (eSDK) manual.
2264
2265.. _ref-classes-prexport:
2266
2267``prexport.bbclass``
2268====================
2269
Patrick Williams2390b1b2022-11-03 13:47:49 -05002270The :ref:`prexport <ref-classes-prexport>` class provides functionality for exporting
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002271:term:`PR` values.
2272
2273.. note::
2274
2275 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002276 when using "``bitbake-prserv-tool export``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002277
2278.. _ref-classes-primport:
2279
2280``primport.bbclass``
2281====================
2282
Patrick Williams2390b1b2022-11-03 13:47:49 -05002283The :ref:`primport <ref-classes-primport>` class provides functionality for importing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002284:term:`PR` values.
2285
2286.. note::
2287
2288 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002289 when using "``bitbake-prserv-tool import``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002290
2291.. _ref-classes-prserv:
2292
2293``prserv.bbclass``
2294==================
2295
Patrick Williams2390b1b2022-11-03 13:47:49 -05002296The :ref:`prserv <ref-classes-prserv>` class provides functionality for using a :ref:`PR
Andrew Geissler09209ee2020-12-13 08:44:15 -06002297service <dev-manual/common-tasks:working with a pr service>` in order to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002298automatically manage the incrementing of the :term:`PR`
2299variable for each recipe.
2300
2301This class is enabled by default because it is inherited by the
2302:ref:`package <ref-classes-package>` class. However, the OpenEmbedded
2303build system will not enable the functionality of this class unless
2304:term:`PRSERV_HOST` has been set.
2305
2306.. _ref-classes-ptest:
2307
2308``ptest.bbclass``
2309=================
2310
Patrick Williams2390b1b2022-11-03 13:47:49 -05002311The :ref:`ptest <ref-classes-ptest>` class provides functionality for packaging and installing
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002312runtime tests for recipes that build software that provides these tests.
2313
2314This class is intended to be inherited by individual recipes. However,
2315the class' functionality is largely disabled unless "ptest" appears in
2316:term:`DISTRO_FEATURES`. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002317":ref:`dev-manual/common-tasks:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002318section in the Yocto Project Development Tasks Manual for more information
2319on ptest.
2320
2321.. _ref-classes-ptest-gnome:
2322
2323``ptest-gnome.bbclass``
2324=======================
2325
2326Enables package tests (ptests) specifically for GNOME packages, which
2327have tests intended to be executed with ``gnome-desktop-testing``.
2328
2329For information on setting up and running ptests, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002330":ref:`dev-manual/common-tasks:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002331section in the Yocto Project Development Tasks Manual.
2332
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002333.. _ref-classes-python3-dir:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002334
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002335``python3-dir.bbclass``
2336=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002337
Patrick Williams2390b1b2022-11-03 13:47:49 -05002338The :ref:`python3-dir <ref-classes-python3-dir>` class provides the base version, location, and site
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002339package location for Python 3.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002340
2341.. _ref-classes-python3native:
2342
2343``python3native.bbclass``
2344=========================
2345
Patrick Williams2390b1b2022-11-03 13:47:49 -05002346The :ref:`python3native <ref-classes-python3native>` class supports using the native version of Python
Andrew Geisslerc9f78652020-09-18 14:11:35 -050023473 built by the build system rather than support of the version provided
2348by the build host.
2349
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002350.. _ref-classes-python3targetconfig:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002351
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002352``python3targetconfig.bbclass``
2353===============================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002354
Patrick Williams2390b1b2022-11-03 13:47:49 -05002355The :ref:`python3targetconfig <ref-classes-python3targetconfig>` class supports using the native version of Python
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050023563 built by the build system rather than support of the version provided
2357by the build host, except that the configuration for the target machine
2358is accessible (such as correct installation directories). This also adds a
2359dependency on target ``python3``, so should only be used where appropriate
2360in order to avoid unnecessarily lengthening builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002361
2362.. _ref-classes-qemu:
2363
2364``qemu.bbclass``
2365================
2366
Patrick Williams2390b1b2022-11-03 13:47:49 -05002367The :ref:`qemu <ref-classes-qemu>` class provides functionality for recipes that either need
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002368QEMU or test for the existence of QEMU. Typically, this class is used to
2369run programs for a target system on the build host using QEMU's
2370application emulation mode.
2371
2372.. _ref-classes-recipe_sanity:
2373
2374``recipe_sanity.bbclass``
2375=========================
2376
Patrick Williams2390b1b2022-11-03 13:47:49 -05002377The :ref:`recipe_sanity <ref-classes-recipe_sanity>` class checks for the presence of any host system
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002378recipe prerequisites that might affect the build (e.g. variables that
2379are set or software that is present).
2380
2381.. _ref-classes-relocatable:
2382
2383``relocatable.bbclass``
2384=======================
2385
Patrick Williams2390b1b2022-11-03 13:47:49 -05002386The :ref:`relocatable <ref-classes-relocatable>` class enables relocation of binaries when they are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002387installed into the sysroot.
2388
2389This class makes use of the :ref:`chrpath <ref-classes-chrpath>` class
2390and is used by both the :ref:`cross <ref-classes-cross>` and
2391:ref:`native <ref-classes-native>` classes.
2392
2393.. _ref-classes-remove-libtool:
2394
2395``remove-libtool.bbclass``
2396==========================
2397
Patrick Williams2390b1b2022-11-03 13:47:49 -05002398The :ref:`remove-libtool <ref-classes-remove-libtool>` class adds a post function to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002399:ref:`ref-tasks-install` task to remove all ``.la`` files
2400installed by ``libtool``. Removing these files results in them being
2401absent from both the sysroot and target packages.
2402
2403If a recipe needs the ``.la`` files to be installed, then the recipe can
Andrew Geisslerc926e172021-05-07 16:11:35 -05002404override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002405
2406 REMOVE_LIBTOOL_LA = "0"
2407
2408.. note::
2409
Patrick Williams2390b1b2022-11-03 13:47:49 -05002410 The :ref:`remove-libtool <ref-classes-remove-libtool>` class is not enabled by default.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002411
2412.. _ref-classes-report-error:
2413
2414``report-error.bbclass``
2415========================
2416
Patrick Williams2390b1b2022-11-03 13:47:49 -05002417The :ref:`report-error <ref-classes-report-error>` class supports enabling the :ref:`error reporting
Andrew Geissler09209ee2020-12-13 08:44:15 -06002418tool <dev-manual/common-tasks:using the error reporting tool>`",
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002419which allows you to submit build error information to a central database.
2420
2421The class collects debug information for recipe, recipe version, task,
2422machine, distro, build system, target system, host distro, branch,
2423commit, and log. From the information, report files using a JSON format
2424are created and stored in
2425``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2426
2427.. _ref-classes-rm-work:
2428
2429``rm_work.bbclass``
2430===================
2431
Patrick Williams2390b1b2022-11-03 13:47:49 -05002432The :ref:`rm_work <ref-classes-rm-work>` class supports deletion of temporary workspace, which
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002433can ease your hard drive demands during builds.
2434
2435The OpenEmbedded build system can use a substantial amount of disk space
2436during the build process. A portion of this space is the work files
2437under the ``${TMPDIR}/work`` directory for each recipe. Once the build
2438system generates the packages for a recipe, the work files for that
2439recipe are no longer needed. However, by default, the build system
2440preserves these files for inspection and possible debugging purposes. If
2441you would rather have these files deleted to save disk space as the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002442build progresses, you can enable :ref:`rm_work <ref-classes-rm-work>` by adding the following to
2443your ``local.conf`` file, which is found in the :term:`Build Directory`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002444
2445 INHERIT += "rm_work"
2446
2447If you are
2448modifying and building source code out of the work directory for a
Patrick Williams2390b1b2022-11-03 13:47:49 -05002449recipe, enabling :ref:`rm_work <ref-classes-rm-work>` will potentially result in your changes to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002450the source being lost. To exclude some recipes from having their work
Patrick Williams2390b1b2022-11-03 13:47:49 -05002451directories deleted by :ref:`rm_work <ref-classes-rm-work>`, you can add the names of the recipe
Andrew Geissler09036742021-06-25 14:25:14 -05002452or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable, which
Andrew Geisslerc926e172021-05-07 16:11:35 -05002453can also be set in your ``local.conf`` file. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002454
2455 RM_WORK_EXCLUDE += "busybox glibc"
2456
2457.. _ref-classes-rootfs*:
2458
2459``rootfs*.bbclass``
2460===================
2461
Patrick Williams2390b1b2022-11-03 13:47:49 -05002462The :ref:`rootfs* <ref-classes-rootfs*>` classes support creating the root filesystem for an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002463image and consist of the following classes:
2464
Patrick Williams2390b1b2022-11-03 13:47:49 -05002465- The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002466 post-processing functions for image recipes.
2467
Patrick Williams2390b1b2022-11-03 13:47:49 -05002468- The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002469 for images built using ``.deb`` packages.
2470
Patrick Williams2390b1b2022-11-03 13:47:49 -05002471- The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002472 for images built using ``.rpm`` packages.
2473
Patrick Williams2390b1b2022-11-03 13:47:49 -05002474- The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002475 for images built using ``.ipk`` packages.
2476
Patrick Williams2390b1b2022-11-03 13:47:49 -05002477- The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002478 on the build host directly into the root filesystem.
2479
2480The root filesystem is created from packages using one of the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002481:ref:`rootfs*.bbclass <ref-classes-rootfs*>` files as determined by the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002482:term:`PACKAGE_CLASSES` variable.
2483
2484For information on how root filesystem images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002485":ref:`overview-manual/concepts:image generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002486section in the Yocto Project Overview and Concepts Manual.
2487
2488.. _ref-classes-sanity:
2489
2490``sanity.bbclass``
2491==================
2492
Patrick Williams2390b1b2022-11-03 13:47:49 -05002493The :ref:`sanity <ref-classes-sanity>` class checks to see if prerequisite software is present
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002494on the host system so that users can be notified of potential problems
2495that might affect their build. The class also performs basic user
2496configuration checks from the ``local.conf`` configuration file to
2497prevent common mistakes that cause build failures. Distribution policy
2498usually determines whether to include this class.
2499
2500.. _ref-classes-scons:
2501
2502``scons.bbclass``
2503=================
2504
Patrick Williams2390b1b2022-11-03 13:47:49 -05002505The :ref:`scons <ref-classes-scons>` class supports recipes that need to build software that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002506uses the SCons build system. You can use the
2507:term:`EXTRA_OESCONS` variable to specify
2508additional configuration options you want to pass SCons command line.
2509
2510.. _ref-classes-sdl:
2511
2512``sdl.bbclass``
2513===============
2514
Patrick Williams2390b1b2022-11-03 13:47:49 -05002515The :ref:`sdl <ref-classes-sdl>` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002516the Simple DirectMedia Layer (SDL) library.
2517
Patrick Williams45852732022-04-02 08:58:32 -05002518.. _ref-classes-python_setuptools_build_meta:
Andrew Geissler9aee5002022-03-30 16:27:02 +00002519
Patrick Williams45852732022-04-02 08:58:32 -05002520``python_setuptools_build_meta.bbclass``
2521========================================
Andrew Geissler9aee5002022-03-30 16:27:02 +00002522
Patrick Williams2390b1b2022-11-03 13:47:49 -05002523The :ref:`python_setuptools_build_meta <ref-classes-python_setuptools_build_meta>` class enables building Python modules which
Andrew Geissler9aee5002022-03-30 16:27:02 +00002524declare the
2525`PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant
2526``setuptools.build_meta`` ``build-backend`` in the ``[build-system]``
2527section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__).
2528
2529Python modules built with ``setuptools.build_meta`` can be pure Python or
2530include ``C`` or ``Rust`` extensions).
2531
Patrick Williams45852732022-04-02 08:58:32 -05002532Internally this uses the :ref:`python_pep517 <ref-classes-python_pep517>` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002533
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002534.. _ref-classes-setuptools3:
2535
2536``setuptools3.bbclass``
2537=======================
2538
Patrick Williams2390b1b2022-11-03 13:47:49 -05002539The :ref:`setuptools3 <ref-classes-setuptools3>` class supports Python version 3.x extensions that
Andrew Geissler9aee5002022-03-30 16:27:02 +00002540use build systems based on ``setuptools`` (e.g. only have a ``setup.py`` and
2541have not migrated to the official ``pyproject.toml`` format). If your recipe
Patrick Williams2390b1b2022-11-03 13:47:49 -05002542uses these build systems, the recipe needs to inherit the :ref:`setuptools3 <ref-classes-setuptools3>` class.
Andrew Geissler9aee5002022-03-30 16:27:02 +00002543
2544 .. note::
2545
Patrick Williams2390b1b2022-11-03 13:47:49 -05002546 The :ref:`setuptools3 <ref-classes-setuptools3>` class :ref:`ref-tasks-compile` task now calls
Andrew Geissler9aee5002022-03-30 16:27:02 +00002547 ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format
2548 (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__).
2549
2550 A consequence of this is that legacy software still using deprecated
2551 ``distutils`` from the Python standard library cannot be packaged as
2552 ``wheels``. A common solution is the replace
2553 ``from distutils.core import setup`` with ``from setuptools import setup``.
2554
2555 .. note::
2556
Patrick Williams2390b1b2022-11-03 13:47:49 -05002557 The :ref:`setuptools3 <ref-classes-setuptools3>` class :ref:`ref-tasks-install` task now installs the ``wheel``
Andrew Geissler9aee5002022-03-30 16:27:02 +00002558 binary archive. In current versions of ``setuptools`` the legacy ``setup.py
2559 install`` method is deprecated. If the ``setup.py`` cannot be used with
2560 wheels, for example it creates files outside of the Python module or
2561 standard entry points, then :ref:`setuptools3_legacy
2562 <ref-classes-setuptools3_legacy>` should be used.
2563
2564.. _ref-classes-setuptools3_legacy:
2565
2566``setuptools3_legacy.bbclass``
2567==============================
2568
Patrick Williams2390b1b2022-11-03 13:47:49 -05002569The :ref:`setuptools3_legacy <ref-classes-setuptools3_legacy>` class supports Python version 3.x extensions that use
Andrew Geissler9aee5002022-03-30 16:27:02 +00002570build systems based on ``setuptools`` (e.g. only have a ``setup.py`` and have
2571not migrated to the official ``pyproject.toml`` format). Unlike
2572``setuptools3.bbclass``, this uses the traditional ``setup.py`` ``build`` and
2573``install`` commands and not wheels. This use of ``setuptools`` like this is
Patrick Williams2390b1b2022-11-03 13:47:49 -05002574`deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__
Andrew Geissler9aee5002022-03-30 16:27:02 +00002575but still relatively common.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002576
Andrew Geissler595f6302022-01-24 19:11:47 +00002577.. _ref-classes-setuptools3-base:
2578
2579``setuptools3-base.bbclass``
2580============================
2581
Patrick Williams2390b1b2022-11-03 13:47:49 -05002582The :ref:`setuptools3-base <ref-classes-setuptools3-base>` class provides a reusable base for other classes
Andrew Geissler595f6302022-01-24 19:11:47 +00002583that support building Python version 3.x extensions. If you need
2584functionality that is not provided by the :ref:`setuptools3 <ref-classes-setuptools3>` class, you may
2585want to ``inherit setuptools3-base``. Some recipes do not need the tasks
2586in the :ref:`setuptools3 <ref-classes-setuptools3>` class and inherit this class instead.
2587
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002588.. _ref-classes-sign_rpm:
2589
2590``sign_rpm.bbclass``
2591====================
2592
Patrick Williams2390b1b2022-11-03 13:47:49 -05002593The :ref:`sign_rpm <ref-classes-sign_rpm>` class supports generating signed RPM packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002594
2595.. _ref-classes-sip:
2596
2597``sip.bbclass``
2598===============
2599
Patrick Williams2390b1b2022-11-03 13:47:49 -05002600The :ref:`sip <ref-classes-sip>` class supports recipes that build or package SIP-based
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002601Python bindings.
2602
2603.. _ref-classes-siteconfig:
2604
2605``siteconfig.bbclass``
2606======================
2607
Patrick Williams2390b1b2022-11-03 13:47:49 -05002608The :ref:`siteconfig <ref-classes-siteconfig>` class provides functionality for handling site
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002609configuration. The class is used by the
2610:ref:`autotools <ref-classes-autotools>` class to accelerate the
2611:ref:`ref-tasks-configure` task.
2612
2613.. _ref-classes-siteinfo:
2614
2615``siteinfo.bbclass``
2616====================
2617
Patrick Williams2390b1b2022-11-03 13:47:49 -05002618The :ref:`siteinfo <ref-classes-siteinfo>` class provides information about the targets that might
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002619be needed by other classes or recipes.
2620
2621As an example, consider Autotools, which can require tests that must
2622execute on the target hardware. Since this is not possible in general
2623when cross compiling, site information is used to provide cached test
2624results so these tests can be skipped over but still make the correct
2625values available. The ``meta/site directory`` contains test results
2626sorted into different categories such as architecture, endianness, and
2627the ``libc`` used. Site information provides a list of files containing
Andrew Geissler09036742021-06-25 14:25:14 -05002628data relevant to the current build in the :term:`CONFIG_SITE` variable that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002629Autotools automatically picks up.
2630
Andrew Geissler09036742021-06-25 14:25:14 -05002631The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
2632:term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002633
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002634.. _ref-classes-sstate:
2635
2636``sstate.bbclass``
2637==================
2638
Patrick Williams2390b1b2022-11-03 13:47:49 -05002639The :ref:`sstate <ref-classes-sstate>` class provides support for Shared State (sstate). By
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002640default, the class is enabled through the
2641:term:`INHERIT_DISTRO` variable's default value.
2642
2643For more information on sstate, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002644":ref:`overview-manual/concepts:shared state cache`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002645section in the Yocto Project Overview and Concepts Manual.
2646
2647.. _ref-classes-staging:
2648
2649``staging.bbclass``
2650===================
2651
Patrick Williams2390b1b2022-11-03 13:47:49 -05002652The :ref:`staging <ref-classes-staging>` class installs files into individual recipe work
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002653directories for sysroots. The class contains the following key tasks:
2654
2655- The :ref:`ref-tasks-populate_sysroot` task,
2656 which is responsible for handing the files that end up in the recipe
2657 sysroots.
2658
2659- The
2660 :ref:`ref-tasks-prepare_recipe_sysroot`
2661 task (a "partner" task to the ``populate_sysroot`` task), which
2662 installs the files into the individual recipe work directories (i.e.
2663 :term:`WORKDIR`).
2664
Patrick Williams2390b1b2022-11-03 13:47:49 -05002665The code in the :ref:`staging <ref-classes-staging>` class is complex and basically works in two
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002666stages:
2667
2668- *Stage One:* The first stage addresses recipes that have files they
2669 want to share with other recipes that have dependencies on the
2670 originating recipe. Normally these dependencies are installed through
2671 the :ref:`ref-tasks-install` task into
Patrick Williams2194f502022-10-16 14:26:09 -05002672 ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002673 copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
2674 subset of files is controlled by the
2675 :term:`SYSROOT_DIRS`,
2676 :term:`SYSROOT_DIRS_NATIVE`, and
Andrew Geissler9aee5002022-03-30 16:27:02 +00002677 :term:`SYSROOT_DIRS_IGNORE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002678 variables.
2679
2680 .. note::
2681
2682 Additionally, a recipe can customize the files further by
Andrew Geissler09036742021-06-25 14:25:14 -05002683 declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002684 variable.
2685
2686 A shared state (sstate) object is built from these files and the
2687 files are placed into a subdirectory of
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002688 :ref:`structure-build-tmp-sysroots-components`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002689 The files are scanned for hardcoded paths to the original
2690 installation location. If the location is found in text files, the
2691 hardcoded locations are replaced by tokens and a list of the files
2692 needing such replacements is created. These adjustments are referred
2693 to as "FIXMEs". The list of files that are scanned for paths is
2694 controlled by the :term:`SSTATE_SCAN_FILES`
2695 variable.
2696
2697- *Stage Two:* The second stage addresses recipes that want to use
2698 something from another recipe and declare a dependency on that recipe
2699 through the :term:`DEPENDS` variable. The recipe will
2700 have a
2701 :ref:`ref-tasks-prepare_recipe_sysroot`
2702 task and when this task executes, it creates the ``recipe-sysroot``
2703 and ``recipe-sysroot-native`` in the recipe work directory (i.e.
2704 :term:`WORKDIR`). The OpenEmbedded build system
2705 creates hard links to copies of the relevant files from
2706 ``sysroots-components`` into the recipe work directory.
2707
2708 .. note::
2709
2710 If hard links are not possible, the build system uses actual
2711 copies.
2712
2713 The build system then addresses any "FIXMEs" to paths as defined from
2714 the list created in the first stage.
2715
2716 Finally, any files in ``${bindir}`` within the sysroot that have the
2717 prefix "``postinst-``" are executed.
2718
2719 .. note::
2720
2721 Although such sysroot post installation scripts are not
2722 recommended for general use, the files do allow some issues such
2723 as user creation and module indexes to be addressed.
2724
Andrew Geissler09036742021-06-25 14:25:14 -05002725 Because recipes can have other dependencies outside of :term:`DEPENDS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002726 (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
2727 the sysroot creation function ``extend_recipe_sysroot`` is also added
2728 as a pre-function for those tasks whose dependencies are not through
Andrew Geissler09036742021-06-25 14:25:14 -05002729 :term:`DEPENDS` but operate similarly.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002730
2731 When installing dependencies into the sysroot, the code traverses the
2732 dependency graph and processes dependencies in exactly the same way
2733 as the dependencies would or would not be when installed from sstate.
2734 This processing means, for example, a native tool would have its
2735 native dependencies added but a target library would not have its
2736 dependencies traversed or installed. The same sstate dependency code
2737 is used so that builds should be identical regardless of whether
2738 sstate was used or not. For a closer look, see the
2739 ``setscene_depvalid()`` function in the
2740 :ref:`sstate <ref-classes-sstate>` class.
2741
2742 The build system is careful to maintain manifests of the files it
2743 installs so that any given dependency can be installed as needed. The
2744 sstate hash of the installed item is also stored so that if it
2745 changes, the build system can reinstall it.
2746
2747.. _ref-classes-syslinux:
2748
2749``syslinux.bbclass``
2750====================
2751
Patrick Williams2390b1b2022-11-03 13:47:49 -05002752The :ref:`syslinux <ref-classes-syslinux>` class provides syslinux-specific functions for building
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002753bootable images.
2754
2755The class supports the following variables:
2756
2757- :term:`INITRD`: Indicates list of filesystem images to
2758 concatenate and use as an initial RAM disk (initrd). This variable is
2759 optional.
2760
2761- :term:`ROOTFS`: Indicates a filesystem image to include
2762 as the root filesystem. This variable is optional.
2763
2764- :term:`AUTO_SYSLINUXMENU`: Enables creating
2765 an automatic menu when set to "1".
2766
2767- :term:`LABELS`: Lists targets for automatic
2768 configuration.
2769
2770- :term:`APPEND`: Lists append string overrides for each
2771 label.
2772
2773- :term:`SYSLINUX_OPTS`: Lists additional options
2774 to add to the syslinux file. Semicolon characters separate multiple
2775 options.
2776
2777- :term:`SYSLINUX_SPLASH`: Lists a background
2778 for the VGA boot menu when you are using the boot menu.
2779
2780- :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
2781 to "console=ttyX" to change kernel boot default console.
2782
2783- :term:`SYSLINUX_SERIAL`: Sets an alternate
2784 serial port. Or, turns off serial when the variable is set with an
2785 empty string.
2786
2787- :term:`SYSLINUX_SERIAL_TTY`: Sets an
2788 alternate "console=tty..." kernel boot argument.
2789
2790.. _ref-classes-systemd:
2791
2792``systemd.bbclass``
2793===================
2794
Patrick Williams2390b1b2022-11-03 13:47:49 -05002795The :ref:`systemd <ref-classes-systemd>` class provides support for recipes that install systemd
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002796unit files.
2797
2798The functionality for this class is disabled unless you have "systemd"
2799in :term:`DISTRO_FEATURES`.
2800
2801Under this class, the recipe or Makefile (i.e. whatever the recipe is
2802calling during the :ref:`ref-tasks-install` task)
2803installs unit files into
2804``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
2805files being installed go into packages other than the main package, you
2806need to set :term:`SYSTEMD_PACKAGES` in your
2807recipe to identify the packages in which the files will be installed.
2808
2809You should set :term:`SYSTEMD_SERVICE` to the
2810name of the service file. You should also use a package name override to
2811indicate the package to which the value applies. If the value applies to
2812the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
Andrew Geisslerc926e172021-05-07 16:11:35 -05002813is an example from the connman recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002814
Patrick Williams0ca19cc2021-08-16 14:03:13 -05002815 SYSTEMD_SERVICE:${PN} = "connman.service"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002816
2817Services are set up to start on boot automatically
2818unless you have set
2819:term:`SYSTEMD_AUTO_ENABLE` to "disable".
2820
Patrick Williams2390b1b2022-11-03 13:47:49 -05002821For more information on :ref:`systemd <ref-classes-systemd>`, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002822":ref:`dev-manual/common-tasks:selecting an initialization manager`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002823section in the Yocto Project Development Tasks Manual.
2824
2825.. _ref-classes-systemd-boot:
2826
2827``systemd-boot.bbclass``
2828========================
2829
Patrick Williams2390b1b2022-11-03 13:47:49 -05002830The :ref:`systemd-boot <ref-classes-systemd-boot>` class provides functions specific to the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002831systemd-boot bootloader for building bootable images. This is an
2832internal class and is not intended to be used directly.
2833
2834.. note::
2835
Patrick Williams2390b1b2022-11-03 13:47:49 -05002836 The :ref:`systemd-boot <ref-classes-systemd-boot>` class is a result from merging the ``gummiboot`` class
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002837 used in previous Yocto Project releases with the ``systemd`` project.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002838
2839Set the :term:`EFI_PROVIDER` variable to
Patrick Williams2390b1b2022-11-03 13:47:49 -05002840":ref:`systemd-boot <ref-classes-systemd-boot>`" to use this class. Doing so creates a standalone EFI
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002841bootloader that is not dependent on systemd.
2842
2843For information on more variables used and supported in this class, see
2844the :term:`SYSTEMD_BOOT_CFG`,
2845:term:`SYSTEMD_BOOT_ENTRIES`, and
2846:term:`SYSTEMD_BOOT_TIMEOUT` variables.
2847
2848You can also see the `Systemd-boot
Andrew Geisslerd1e89492021-02-12 15:35:20 -06002849documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002850for more information.
2851
2852.. _ref-classes-terminal:
2853
2854``terminal.bbclass``
2855====================
2856
Patrick Williams2390b1b2022-11-03 13:47:49 -05002857The :ref:`terminal <ref-classes-terminal>` class provides support for starting a terminal session.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002858The :term:`OE_TERMINAL` variable controls which
2859terminal emulator is used for the session.
2860
Patrick Williams2390b1b2022-11-03 13:47:49 -05002861Other classes use the :ref:`terminal <ref-classes-terminal>` class anywhere a separate terminal
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002862session needs to be started. For example, the
2863:ref:`patch <ref-classes-patch>` class assuming
2864:term:`PATCHRESOLVE` is set to "user", the
2865:ref:`cml1 <ref-classes-cml1>` class, and the
Patrick Williams2390b1b2022-11-03 13:47:49 -05002866:ref:`devshell <ref-classes-devshell>` class all use the :ref:`terminal <ref-classes-terminal>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002867class.
2868
Patrick Williams975a06f2022-10-21 14:42:47 -05002869.. _ref-classes-testimage:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002870
Patrick Williams975a06f2022-10-21 14:42:47 -05002871``testimage.bbclass``
2872=====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002873
Patrick Williams2390b1b2022-11-03 13:47:49 -05002874The :ref:`testimage <ref-classes-testimage>` class supports running automated tests against
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002875images using QEMU and on actual hardware. The classes handle loading the
2876tests and starting the image. To use the classes, you need to perform
2877steps to set up the environment.
2878
Patrick Williams975a06f2022-10-21 14:42:47 -05002879To enable this class, add the following to your configuration::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002880
Patrick Williams975a06f2022-10-21 14:42:47 -05002881 IMAGE_CLASSES += "testimage"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002882
2883The tests are commands that run on the target system over ``ssh``. Each
2884test is written in Python and makes use of the ``unittest`` module.
2885
Patrick Williams2390b1b2022-11-03 13:47:49 -05002886The :ref:`testimage <ref-classes-testimage>` class runs tests on an image when called using the
Andrew Geisslerc926e172021-05-07 16:11:35 -05002887following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002888
2889 $ bitbake -c testimage image
2890
Patrick Williams975a06f2022-10-21 14:42:47 -05002891Alternatively, if you wish to have tests automatically run for each image
2892after it is built, you can set :term:`TESTIMAGE_AUTO`::
2893
2894 TESTIMAGE_AUTO = "1"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002895
2896For information on how to enable, run, and create new tests, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002897":ref:`dev-manual/common-tasks:performing automated runtime testing`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002898section in the Yocto Project Development Tasks Manual.
2899
2900.. _ref-classes-testsdk:
2901
2902``testsdk.bbclass``
2903===================
2904
2905This class supports running automated tests against software development
Patrick Williams2390b1b2022-11-03 13:47:49 -05002906kits (SDKs). The :ref:`testsdk <ref-classes-testsdk>` class runs tests on an SDK when called
Andrew Geisslerc926e172021-05-07 16:11:35 -05002907using the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002908
2909 $ bitbake -c testsdk image
2910
2911.. note::
2912
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002913 Best practices include using :term:`IMAGE_CLASSES` rather than
Patrick Williams2390b1b2022-11-03 13:47:49 -05002914 :term:`INHERIT` to inherit the :ref:`testsdk <ref-classes-testsdk>` class for automated SDK
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002915 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002916
2917.. _ref-classes-texinfo:
2918
2919``texinfo.bbclass``
2920===================
2921
2922This class should be inherited by recipes whose upstream packages invoke
2923the ``texinfo`` utilities at build-time. Native and cross recipes are
2924made to use the dummy scripts provided by ``texinfo-dummy-native``, for
2925improved performance. Target architecture recipes use the genuine
2926Texinfo utilities. By default, they use the Texinfo utilities on the
2927host system.
2928
2929.. note::
2930
2931 If you want to use the Texinfo recipe shipped with the build system,
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002932 you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
2933 from :term:`SANITY_REQUIRED_UTILITIES`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002934
2935.. _ref-classes-toaster:
2936
2937``toaster.bbclass``
2938===================
2939
Patrick Williams2390b1b2022-11-03 13:47:49 -05002940The :ref:`toaster <ref-classes-toaster>` class collects information about packages and images and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002941sends them as events that the BitBake user interface can receive. The
2942class is enabled when the Toaster user interface is running.
2943
2944This class is not intended to be used directly.
2945
2946.. _ref-classes-toolchain-scripts:
2947
2948``toolchain-scripts.bbclass``
2949=============================
2950
Patrick Williams2390b1b2022-11-03 13:47:49 -05002951The :ref:`toolchain-scripts <ref-classes-toolchain-scripts>` class provides the scripts used for setting up
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002952the environment for installed SDKs.
2953
2954.. _ref-classes-typecheck:
2955
2956``typecheck.bbclass``
2957=====================
2958
Patrick Williams2390b1b2022-11-03 13:47:49 -05002959The :ref:`typecheck <ref-classes-typecheck>` class provides support for validating the values of
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002960variables set at the configuration level against their defined types.
2961The OpenEmbedded build system allows you to define the type of a
Andrew Geisslerc926e172021-05-07 16:11:35 -05002962variable using the "type" varflag. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002963
2964 IMAGE_FEATURES[type] = "list"
2965
2966.. _ref-classes-uboot-config:
2967
2968``uboot-config.bbclass``
2969========================
2970
Patrick Williams2390b1b2022-11-03 13:47:49 -05002971The :ref:`uboot-config <ref-classes-uboot-config>` class provides support for U-Boot configuration for
Andrew Geisslerc926e172021-05-07 16:11:35 -05002972a machine. Specify the machine in your recipe as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002973
2974 UBOOT_CONFIG ??= <default>
2975 UBOOT_CONFIG[foo] = "config,images"
2976
Andrew Geisslerc926e172021-05-07 16:11:35 -05002977You can also specify the machine using this method::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002978
2979 UBOOT_MACHINE = "config"
2980
2981See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
2982information.
2983
2984.. _ref-classes-uninative:
2985
2986``uninative.bbclass``
2987=====================
2988
2989Attempts to isolate the build system from the host distribution's C
2990library in order to make re-use of native shared state artifacts across
2991different host distributions practical. With this class enabled, a
2992tarball containing a pre-built C library is downloaded at the start of
2993the build. In the Poky reference distribution this is enabled by default
2994through ``meta/conf/distro/include/yocto-uninative.inc``. Other
2995distributions that do not derive from poky can also
2996"``require conf/distro/include/yocto-uninative.inc``" to use this.
2997Alternatively if you prefer, you can build the uninative-tarball recipe
2998yourself, publish the resulting tarball (e.g. via HTTP) and set
2999``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
3000example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
3001
Patrick Williams2390b1b2022-11-03 13:47:49 -05003002The :ref:`uninative <ref-classes-uninative>` class is also used unconditionally by the extensible
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003003SDK. When building the extensible SDK, ``uninative-tarball`` is built
3004and the resulting tarball is included within the SDK.
3005
3006.. _ref-classes-update-alternatives:
3007
3008``update-alternatives.bbclass``
3009===============================
3010
Patrick Williams2390b1b2022-11-03 13:47:49 -05003011The :ref:`update-alternatives <ref-classes-update-alternatives>` class helps the alternatives system when
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003012multiple sources provide the same command. This situation occurs when
3013several programs that have the same or similar function are installed
3014with the same name. For example, the ``ar`` command is available from
3015the ``busybox``, ``binutils`` and ``elfutils`` packages. The
Patrick Williams2390b1b2022-11-03 13:47:49 -05003016:ref:`update-alternatives <ref-classes-update-alternatives>` class handles renaming the binaries so that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003017multiple packages can be installed without conflicts. The ``ar`` command
3018still works regardless of which packages are installed or subsequently
3019removed. The class renames the conflicting binary in each package and
3020symlinks the highest priority binary during installation or removal of
3021packages.
3022
3023To use this class, you need to define a number of variables:
3024
3025- :term:`ALTERNATIVE`
3026
3027- :term:`ALTERNATIVE_LINK_NAME`
3028
3029- :term:`ALTERNATIVE_TARGET`
3030
3031- :term:`ALTERNATIVE_PRIORITY`
3032
3033These variables list alternative commands needed by a package, provide
3034pathnames for links, default links for targets, and so forth. For
3035details on how to use this class, see the comments in the
Patrick Williams975a06f2022-10-21 14:42:47 -05003036:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003037file.
3038
3039.. note::
3040
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003041 You can use the ``update-alternatives`` command directly in your recipes.
3042 However, this class simplifies things in most cases.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003043
3044.. _ref-classes-update-rc.d:
3045
3046``update-rc.d.bbclass``
3047=======================
3048
Patrick Williams2390b1b2022-11-03 13:47:49 -05003049The :ref:`update-rc.d <ref-classes-update-rc.d>` class uses ``update-rc.d`` to safely install an
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003050initialization script on behalf of the package. The OpenEmbedded build
3051system takes care of details such as making sure the script is stopped
3052before a package is removed and started when the package is installed.
3053
Andrew Geissler09036742021-06-25 14:25:14 -05003054Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
3055:term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003056for details.
3057
3058.. _ref-classes-useradd:
3059
3060``useradd*.bbclass``
3061====================
3062
Patrick Williams2390b1b2022-11-03 13:47:49 -05003063The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003064usage by the package on the target. For example, if you have packages
3065that contain system services that should be run under their own user or
3066group, you can use these classes to enable creation of the user or
Andrew Geissler595f6302022-01-24 19:11:47 +00003067group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
3068</openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003069recipe in the :term:`Source Directory` provides a simple
3070example that shows how to add three users and groups to two packages.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003071
Patrick Williams2390b1b2022-11-03 13:47:49 -05003072The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003073groups settings.
3074
Patrick Williams2390b1b2022-11-03 13:47:49 -05003075The :ref:`useradd* <ref-classes-useradd>` classes support the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003076:term:`USERADD_PACKAGES`,
3077:term:`USERADD_PARAM`,
3078:term:`GROUPADD_PARAM`, and
3079:term:`GROUPMEMS_PARAM` variables.
3080
Patrick Williams2390b1b2022-11-03 13:47:49 -05003081The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003082that have static user identification (``uid``) and group identification
3083(``gid``) values.
3084
3085The default behavior of the OpenEmbedded build system for assigning
3086``uid`` and ``gid`` values when packages add users and groups during
3087package install time is to add them dynamically. This works fine for
3088programs that do not care what the values of the resulting users and
3089groups become. In these cases, the order of the installation determines
3090the final ``uid`` and ``gid`` values. However, if non-deterministic
3091``uid`` and ``gid`` values are a problem, you can override the default,
3092dynamic application of these values by setting static values. When you
3093set static values, the OpenEmbedded build system looks in
3094:term:`BBPATH` for ``files/passwd`` and ``files/group``
3095files for the values.
3096
3097To use static ``uid`` and ``gid`` values, you need to set some
3098variables. See the :term:`USERADDEXTENSION`,
3099:term:`USERADD_UID_TABLES`,
3100:term:`USERADD_GID_TABLES`, and
3101:term:`USERADD_ERROR_DYNAMIC` variables.
3102You can also see the :ref:`useradd <ref-classes-useradd>` class for
3103additional information.
3104
3105.. note::
3106
Patrick Williams2390b1b2022-11-03 13:47:49 -05003107 You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable
Andrew Geissler09036742021-06-25 14:25:14 -05003108 or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
Andrew Geissler4c19ea12020-10-27 13:52:24 -05003109 enable or disable the class in a configured system, :term:`TMPDIR` might
Andrew Geissler09036742021-06-25 14:25:14 -05003110 contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003111 directory will correct this condition.
3112
3113.. _ref-classes-utility-tasks:
3114
3115``utility-tasks.bbclass``
3116=========================
3117
Patrick Williams2390b1b2022-11-03 13:47:49 -05003118The :ref:`utility-tasks <ref-classes-utility-tasks>` class provides support for various "utility" type
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003119tasks that are applicable to all recipes, such as
3120:ref:`ref-tasks-clean` and
3121:ref:`ref-tasks-listtasks`.
3122
3123This class is enabled by default because it is inherited by the
3124:ref:`base <ref-classes-base>` class.
3125
3126.. _ref-classes-utils:
3127
3128``utils.bbclass``
3129=================
3130
Patrick Williams2390b1b2022-11-03 13:47:49 -05003131The :ref:`utils <ref-classes-utils>` class provides some useful Python functions that are
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003132typically used in inline Python expressions (e.g. ``${@...}``). One
3133example use is for ``bb.utils.contains()``.
3134
3135This class is enabled by default because it is inherited by the
3136:ref:`base <ref-classes-base>` class.
3137
3138.. _ref-classes-vala:
3139
3140``vala.bbclass``
3141================
3142
Patrick Williams2390b1b2022-11-03 13:47:49 -05003143The :ref:`vala <ref-classes-vala>` class supports recipes that need to build software written
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003144using the Vala programming language.
3145
3146.. _ref-classes-waf:
3147
3148``waf.bbclass``
3149===============
3150
Patrick Williams2390b1b2022-11-03 13:47:49 -05003151The :ref:`waf <ref-classes-waf>` class supports recipes that need to build software that uses
Andrew Geisslerc9f78652020-09-18 14:11:35 -05003152the Waf build system. You can use the
3153:term:`EXTRA_OECONF` or
3154:term:`PACKAGECONFIG_CONFARGS` variables
3155to specify additional configuration options to be passed on the Waf
3156command line.