blob: 9b1ead66b37339b3b53a9da0002ce180cb44aace [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
16``.bbclass`` and are usually placed in a ``classes/`` directory beneath
17the ``meta*/`` directory found in the :term:`Source Directory`.
18Class files can also be pointed to by
19:term:`BUILDDIR` (e.g. ``build/``) in the same way as
20``.conf`` files in the ``conf`` directory. Class files are searched for
21in :term:`BBPATH` using the same method by which ``.conf``
22files are searched.
23
24This chapter discusses only the most useful and important classes. Other
25classes do exist within the ``meta/classes`` directory in the Source
26Directory. You can reference the ``.bbclass`` files directly for more
27information.
28
29.. _ref-classes-allarch:
30
31``allarch.bbclass``
32===================
33
34The ``allarch`` class is inherited by recipes that do not produce
35architecture-specific output. The class disables functionality that is
36normally needed for recipes that produce executable binaries (such as
37building the cross-compiler and a C library as pre-requisites, and
38splitting out of debug symbols during packaging).
39
40.. note::
41
42 Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that
43 produce packages that depend on tunings through use of the
44 :term:`RDEPENDS` and
45 :term:`TUNE_PKGARCH` variables, should never be
46 configured for all architectures using ``allarch``. This is the case
47 even if the recipes do not produce architecture-specific output.
48
49 Configuring such recipes for all architectures causes the
Andrew Geissler4c19ea12020-10-27 13:52:24 -050050 ``do_package_write_*`` tasks to
Andrew Geisslerc9f78652020-09-18 14:11:35 -050051 have different signatures for the machines with different tunings.
52 Additionally, unnecessary rebuilds occur every time an image for a
Andrew Geissler09036742021-06-25 14:25:14 -050053 different :term:`MACHINE` is built even when the recipe never changes.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050054
55By default, all recipes inherit the :ref:`base <ref-classes-base>` and
56:ref:`package <ref-classes-package>` classes, which enable
57functionality needed for recipes that produce executable output. If your
58recipe, for example, only produces packages that contain configuration
59files, media files, or scripts (e.g. Python and Perl), then it should
60inherit the ``allarch`` class.
61
62.. _ref-classes-archiver:
63
64``archiver.bbclass``
65====================
66
67The ``archiver`` class supports releasing source code and other
68materials with the binaries.
69
70For more details on the source archiver, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -060071":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -050072section in the Yocto Project Development Tasks Manual. You can also see
73the :term:`ARCHIVER_MODE` variable for information
74about the variable flags (varflags) that help control archive creation.
75
76.. _ref-classes-autotools:
77
78``autotools*.bbclass``
79======================
80
81The ``autotools*`` classes support Autotooled packages.
82
83The ``autoconf``, ``automake``, and ``libtool`` packages bring
84standardization. This class defines a set of tasks (e.g. ``configure``,
85``compile`` and so forth) that work for all Autotooled packages. It
86should usually be enough to define a few standard variables and then
87simply ``inherit autotools``. These classes can also work with software
88that emulates Autotools. For more information, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -060089":ref:`dev-manual/common-tasks:autotooled package`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -050090in the Yocto Project Development Tasks Manual.
91
92By default, the ``autotools*`` classes use out-of-tree builds (i.e.
93``autotools.bbclass`` building with ``B != S``).
94
95If the software being built by a recipe does not support using
96out-of-tree builds, you should have the recipe inherit the
97``autotools-brokensep`` class. The ``autotools-brokensep`` class behaves
98the same as the ``autotools`` class but builds with :term:`B`
99== :term:`S`. This method is useful when out-of-tree build
100support is either not present or is broken.
101
102.. note::
103
104 It is recommended that out-of-tree support be fixed and used if at
105 all possible.
106
107It's useful to have some idea of how the tasks defined by the
108``autotools*`` classes work and what they do behind the scenes.
109
110- :ref:`ref-tasks-configure` - Regenerates the
111 configure script (using ``autoreconf``) and then launches it with a
112 standard set of arguments used during cross-compilation. You can pass
Andrew Geissler09036742021-06-25 14:25:14 -0500113 additional parameters to ``configure`` through the :term:`EXTRA_OECONF`
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500114 or :term:`PACKAGECONFIG_CONFARGS`
115 variables.
116
117- :ref:`ref-tasks-compile` - Runs ``make`` with
118 arguments that specify the compiler and linker. You can pass
Andrew Geissler5f350902021-07-23 13:09:54 -0400119 additional arguments through the :term:`EXTRA_OEMAKE` variable.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500120
121- :ref:`ref-tasks-install` - Runs ``make install`` and
122 passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``.
123
124.. _ref-classes-base:
125
126``base.bbclass``
127================
128
129The ``base`` class is special in that every ``.bb`` file implicitly
130inherits the class. This class contains definitions for standard basic
131tasks such as fetching, unpacking, configuring (empty by default),
132compiling (runs any ``Makefile`` present), installing (empty by default)
133and packaging (empty by default). These classes are often overridden or
134extended by other classes such as the
135:ref:`autotools <ref-classes-autotools>` class or the
136:ref:`package <ref-classes-package>` class.
137
138The class also contains some commonly used functions such as
139``oe_runmake``, which runs ``make`` with the arguments specified in
140:term:`EXTRA_OEMAKE` variable as well as the
141arguments passed directly to ``oe_runmake``.
142
143.. _ref-classes-bash-completion:
144
145``bash-completion.bbclass``
146===========================
147
148Sets up packaging and dependencies appropriate for recipes that build
149software that includes bash-completion data.
150
151.. _ref-classes-bin-package:
152
153``bin_package.bbclass``
154=======================
155
156The ``bin_package`` class is a helper class for recipes that extract the
157contents of a binary package (e.g. an RPM) and install those contents
158rather than building the binary from source. The binary package is
159extracted and new packages in the configured output package format are
160created. Extraction and installation of proprietary binaries is a good
161example use for this class.
162
163.. note::
164
165 For RPMs and other packages that do not contain a subdirectory, you
166 should specify an appropriate fetcher parameter to point to the
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500167 subdirectory. For example, if BitBake is using the Git fetcher (``git://``),
168 the "subpath" parameter limits the checkout to a specific subpath
169 of the tree. Here is an example where ``${BP}`` is used so that the files
170 are extracted into the subdirectory expected by the default value of
Andrew Geissler09036742021-06-25 14:25:14 -0500171 :term:`S`::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500172
173 SRC_URI = "git://example.com/downloads/somepackage.rpm;subpath=${BP}"
174
175
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500176 See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for
177 more information on supported BitBake Fetchers.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500178
179.. _ref-classes-binconfig:
180
181``binconfig.bbclass``
182=====================
183
184The ``binconfig`` class helps to correct paths in shell scripts.
185
186Before ``pkg-config`` had become widespread, libraries shipped shell
187scripts to give information about the libraries and include paths needed
188to build software (usually named ``LIBNAME-config``). This class assists
189any recipe using such scripts.
190
191During staging, the OpenEmbedded build system installs such scripts into
192the ``sysroots/`` directory. Inheriting this class results in all paths
193in these scripts being changed to point into the ``sysroots/`` directory
194so that all builds that use the script use the correct directories for
195the cross compiling layout. See the
196:term:`BINCONFIG_GLOB` variable for more
197information.
198
199.. _ref-classes-binconfig-disabled:
200
201``binconfig-disabled.bbclass``
202==============================
203
204An alternative version of the :ref:`binconfig <ref-classes-binconfig>`
205class, which disables binary configuration scripts by making them return
206an error in favor of using ``pkg-config`` to query the information. The
207scripts to be disabled should be specified using the
208:term:`BINCONFIG` variable within the recipe inheriting
209the class.
210
211.. _ref-classes-blacklist:
212
213``blacklist.bbclass``
214=====================
215
216The ``blacklist`` class prevents the OpenEmbedded build system from
217building specific recipes (blacklists them). To use this class, inherit
218the class globally and set :term:`PNBLACKLIST` for
219each recipe you wish to blacklist. Specify the :term:`PN`
220value as a variable flag (varflag) and provide a reason, which is
221reported, if the package is requested to be built as the value. For
222example, if you want to blacklist a recipe called "exoticware", you add
Andrew Geisslerc926e172021-05-07 16:11:35 -0500223the following to your ``local.conf`` or distribution configuration::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500224
225 INHERIT += "blacklist"
226 PNBLACKLIST[exoticware] = "Not supported by our organization."
227
228.. _ref-classes-buildhistory:
229
230``buildhistory.bbclass``
231========================
232
233The ``buildhistory`` class records a history of build output metadata,
234which can be used to detect possible regressions as well as used for
235analysis of the build output. For more information on using Build
236History, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600237":ref:`dev-manual/common-tasks:maintaining build output quality`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500238section in the Yocto Project Development Tasks Manual.
239
240.. _ref-classes-buildstats:
241
242``buildstats.bbclass``
243======================
244
245The ``buildstats`` class records performance statistics about each task
246executed during the build (e.g. elapsed time, CPU usage, and I/O usage).
247
248When you use this class, the output goes into the
249:term:`BUILDSTATS_BASE` directory, which defaults
250to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using
251``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading
252chart of the entire build process and can be useful for highlighting
253bottlenecks.
254
255Collecting build statistics is enabled by default through the
256:term:`USER_CLASSES` variable from your
257``local.conf`` file. Consequently, you do not have to do anything to
258enable the class. However, if you want to disable the class, simply
Andrew Geissler09036742021-06-25 14:25:14 -0500259remove "buildstats" from the :term:`USER_CLASSES` list.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500260
261.. _ref-classes-buildstats-summary:
262
263``buildstats-summary.bbclass``
264==============================
265
266When inherited globally, prints statistics at the end of the build on
267sstate re-use. In order to function, this class requires the
268:ref:`buildstats <ref-classes-buildstats>` class be enabled.
269
270.. _ref-classes-ccache:
271
272``ccache.bbclass``
273==================
274
275The ``ccache`` class enables the C/C++ Compiler Cache for the build.
276This class is used to give a minor performance boost during the build.
277However, using the class can lead to unexpected side-effects. Thus, it
278is recommended that you do not use this class. See
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600279https://ccache.samba.org/ for information on the C/C++ Compiler
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500280Cache.
281
282.. _ref-classes-chrpath:
283
284``chrpath.bbclass``
285===================
286
287The ``chrpath`` class is a wrapper around the "chrpath" utility, which
288is used during the build process for ``nativesdk``, ``cross``, and
289``cross-canadian`` recipes to change ``RPATH`` records within binaries
290in order to make them relocatable.
291
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500292.. _ref-classes-cmake:
293
294``cmake.bbclass``
295=================
296
297The ``cmake`` class allows for recipes that need to build software using
298the `CMake <https://cmake.org/overview/>`__ build system. You can use
299the :term:`EXTRA_OECMAKE` variable to specify
300additional configuration options to be passed using the ``cmake``
301command line.
302
303On the occasion that you would be installing custom CMake toolchain
304files supplied by the application being built, you should install them
305to the preferred CMake Module directory: ``${D}${datadir}/cmake/``
306Modules during
307:ref:`ref-tasks-install`.
308
309.. _ref-classes-cml1:
310
311``cml1.bbclass``
312================
313
314The ``cml1`` class provides basic support for the Linux kernel style
315build configuration system.
316
317.. _ref-classes-compress_doc:
318
319``compress_doc.bbclass``
320========================
321
322Enables compression for man pages and info pages. This class is intended
323to be inherited globally. The default compression mechanism is gz (gzip)
324but you can select an alternative mechanism by setting the
325:term:`DOC_COMPRESS` variable.
326
327.. _ref-classes-copyleft_compliance:
328
329``copyleft_compliance.bbclass``
330===============================
331
332The ``copyleft_compliance`` class preserves source code for the purposes
333of license compliance. This class is an alternative to the ``archiver``
334class and is still used by some users even though it has been deprecated
335in favor of the :ref:`archiver <ref-classes-archiver>` class.
336
337.. _ref-classes-copyleft_filter:
338
339``copyleft_filter.bbclass``
340===========================
341
342A class used by the :ref:`archiver <ref-classes-archiver>` and
343:ref:`copyleft_compliance <ref-classes-copyleft_compliance>` classes
344for filtering licenses. The ``copyleft_filter`` class is an internal
345class and is not intended to be used directly.
346
347.. _ref-classes-core-image:
348
349``core-image.bbclass``
350======================
351
352The ``core-image`` class provides common definitions for the
353``core-image-*`` image recipes, such as support for additional
354:term:`IMAGE_FEATURES`.
355
356.. _ref-classes-cpan:
357
358``cpan*.bbclass``
359=================
360
361The ``cpan*`` classes support Perl modules.
362
363Recipes for Perl modules are simple. These recipes usually only need to
364point to the source's archive and then inherit the proper class file.
365Building is split into two methods depending on which method the module
366authors used.
367
368- Modules that use old ``Makefile.PL``-based build system require
369 ``cpan.bbclass`` in their recipes.
370
371- Modules that use ``Build.PL``-based build system require using
372 ``cpan_build.bbclass`` in their recipes.
373
374Both build methods inherit the ``cpan-base`` class for basic Perl
375support.
376
377.. _ref-classes-cross:
378
379``cross.bbclass``
380=================
381
382The ``cross`` class provides support for the recipes that build the
383cross-compilation tools.
384
385.. _ref-classes-cross-canadian:
386
387``cross-canadian.bbclass``
388==========================
389
390The ``cross-canadian`` class provides support for the recipes that build
391the Canadian Cross-compilation tools for SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600392":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500393section in the Yocto Project Overview and Concepts Manual for more
394discussion on these cross-compilation tools.
395
396.. _ref-classes-crosssdk:
397
398``crosssdk.bbclass``
399====================
400
401The ``crosssdk`` class provides support for the recipes that build the
402cross-compilation tools used for building SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600403":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500404section in the Yocto Project Overview and Concepts Manual for more
405discussion on these cross-compilation tools.
406
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500407.. _ref-classes-cve-check:
408
409``cve-check.bbclass``
410=====================
411
412The ``cve-check`` class looks for known CVEs (Common Vulnerabilities
413and Exposures) while building an image. This class is meant to be
414inherited globally from a configuration file::
415
416 INHERIT += "cve-check"
417
418You can also look for vulnerabilities in specific packages by passing
419``-c cve_check`` to BitBake. You will find details in the
420":ref:`dev-manual/common-tasks:checking for vulnerabilities`"
421section in the Development Tasks Manual.
422
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500423.. _ref-classes-debian:
424
425``debian.bbclass``
426==================
427
428The ``debian`` class renames output packages so that they follow the
429Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
430``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
431name and version as part of the package name.
432
433If a recipe creates packages for multiple libraries (shared object files
434of ``.so`` type), use the :term:`LEAD_SONAME`
435variable in the recipe to specify the library on which to apply the
436naming scheme.
437
438.. _ref-classes-deploy:
439
440``deploy.bbclass``
441==================
442
443The ``deploy`` class handles deploying files to the
444:term:`DEPLOY_DIR_IMAGE` directory. The main
445function of this class is to allow the deploy step to be accelerated by
446shared state. Recipes that inherit this class should define their own
447:ref:`ref-tasks-deploy` function to copy the files to be
448deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
449add the task at the appropriate place, which is usually after
450:ref:`ref-tasks-compile` or
451:ref:`ref-tasks-install`. The class then takes care of
Andrew Geissler09036742021-06-25 14:25:14 -0500452staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500453
454.. _ref-classes-devshell:
455
456``devshell.bbclass``
457====================
458
459The ``devshell`` class adds the ``do_devshell`` task. Distribution
Andrew Geissler09209ee2020-12-13 08:44:15 -0600460policy dictates whether to include this class. See the ":ref:`dev-manual/common-tasks:using a development shell`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500461section in the Yocto Project Development Tasks Manual for more
462information about using ``devshell``.
463
464.. _ref-classes-devupstream:
465
466``devupstream.bbclass``
467=======================
468
469The ``devupstream`` class uses
470:term:`BBCLASSEXTEND` to add a variant of the
471recipe that fetches from an alternative URI (e.g. Git) instead of a
Andrew Geisslerc926e172021-05-07 16:11:35 -0500472tarball. Following is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500473
474 BBCLASSEXTEND = "devupstream:target"
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500475 SRC_URI:class-devupstream = "git://git.example.com/example"
476 SRCREV:class-devupstream = "abcd1234"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500477
478Adding the above statements to your recipe creates a variant that has
479:term:`DEFAULT_PREFERENCE` set to "-1".
480Consequently, you need to select the variant of the recipe to use it.
481Any development-specific adjustments can be done by using the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500482``class-devupstream`` override. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500483
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500484 DEPENDS:append:class-devupstream = " gperf-native"
485 do_configure:prepend:class-devupstream() {
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500486 touch ${S}/README
487 }
488
489The class
490currently only supports creating a development variant of the target
491recipe, not ``native`` or ``nativesdk`` variants.
492
Andrew Geissler09036742021-06-25 14:25:14 -0500493The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500494support for ``native`` and ``nativesdk`` variants. Consequently, this
495functionality can be added in a future release.
496
497Support for other version control systems such as Subversion is limited
498due to BitBake's automatic fetch dependencies (e.g.
499``subversion-native``).
500
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500501.. _ref-classes-distutils3:
502
503``distutils3*.bbclass``
504=======================
505
506The ``distutils3*`` classes support recipes for Python version 3.x
507extensions, which are simple. These recipes usually only need to point
508to the source's archive and then inherit the proper class. Building is
509split into three methods depending on which method the module authors
510used.
511
512- Extensions that use an Autotools-based build system require Autotools
513 and ``distutils``-based classes in their recipes.
514
515- Extensions that use ``distutils``-based build systems require the
516 ``distutils`` class in their recipes.
517
518- Extensions that use build systems based on ``setuptools3`` require
Andrew Geissler3b8a17c2021-04-15 15:55:55 -0500519 the :ref:`setuptools3 <ref-classes-setuptools3>` class in their
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500520 recipes.
521
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500522.. _ref-classes-externalsrc:
523
524``externalsrc.bbclass``
525=======================
526
527The ``externalsrc`` class supports building software from source code
528that is external to the OpenEmbedded build system. Building software
529from an external source tree means that the build system's normal fetch,
530unpack, and patch process is not used.
531
532By default, the OpenEmbedded build system uses the :term:`S`
533and :term:`B` variables to locate unpacked recipe source code
534and to build it, respectively. When your recipe inherits the
535``externalsrc`` class, you use the
536:term:`EXTERNALSRC` and
537:term:`EXTERNALSRC_BUILD` variables to
Andrew Geissler09036742021-06-25 14:25:14 -0500538ultimately define :term:`S` and :term:`B`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500539
540By default, this class expects the source code to support recipe builds
541that use the :term:`B` variable to point to the directory in
542which the OpenEmbedded build system places the generated objects built
Andrew Geissler09036742021-06-25 14:25:14 -0500543from the recipes. By default, the :term:`B` directory is set to the
544following, which is separate from the source directory (:term:`S`)::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500545
Andrew Geissler5199d832021-09-24 16:47:35 -0500546 ${WORKDIR}/${BPN}-{PV}/
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500547
548See these variables for more information:
549:term:`WORKDIR`, :term:`BPN`, and
550:term:`PV`,
551
552For more information on the ``externalsrc`` class, see the comments in
553``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
554For information on how to use the
555``externalsrc`` class, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600556":ref:`dev-manual/common-tasks:building software from an external source`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500557section in the Yocto Project Development Tasks Manual.
558
559.. _ref-classes-extrausers:
560
561``extrausers.bbclass``
562======================
563
564The ``extrausers`` class allows additional user and group configuration
565to be applied at the image level. Inheriting this class either globally
566or from an image recipe allows additional user and group operations to
567be performed using the
568:term:`EXTRA_USERS_PARAMS` variable.
569
570.. note::
571
572 The user and group operations added using the
573 extrausers
574 class are not tied to a specific recipe outside of the recipe for the
575 image. Thus, the operations can be performed across the image as a
576 whole. Use the
577 useradd
578 class to add user and group configuration to a specific recipe.
579
Andrew Geisslerc926e172021-05-07 16:11:35 -0500580Here is an example that uses this class in an image recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500581
582 inherit extrausers
583 EXTRA_USERS_PARAMS = "\
584 useradd -p '' tester; \
585 groupadd developers; \
586 userdel nobody; \
587 groupdel -g video; \
588 groupmod -g 1020 developers; \
589 usermod -s /bin/sh tester; \
590 "
591
592Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
Andrew Geisslereff27472021-10-29 15:35:00 -0500593passwords. First on host, create the password hash::
594
595 mkpasswd -m sha256crypt tester01
596
597The resulting hash is set to a variable and used in ``useradd`` command parameters.
598Remember to escape the character ``$``::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500599
600 inherit extrausers
Andrew Geisslereff27472021-10-29 15:35:00 -0500601 PASSWD = "\$X\$ABC123\$A-Long-Hash"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500602 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500603 useradd -p '${PASSWD}' tester-jim; \
604 useradd -p '${PASSWD}' tester-sue; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500605 "
606
Andrew Geisslereff27472021-10-29 15:35:00 -0500607Finally, here is an example that sets the root password::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500608
609 inherit extrausers
610 EXTRA_USERS_PARAMS = "\
Andrew Geisslereff27472021-10-29 15:35:00 -0500611 usermod -p '${PASSWD}' root; \
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500612 "
613
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600614.. _ref-classes-features_check:
615
616``features_check.bbclass``
617=================================
618
619The ``features_check`` class allows individual recipes to check
620for required and conflicting
621:term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES` or :term:`COMBINED_FEATURES`.
622
623This class provides support for the following variables:
624
625- :term:`REQUIRED_DISTRO_FEATURES`
626- :term:`CONFLICT_DISTRO_FEATURES`
627- :term:`ANY_OF_DISTRO_FEATURES`
628- ``REQUIRED_MACHINE_FEATURES``
629- ``CONFLICT_MACHINE_FEATURES``
630- ``ANY_OF_MACHINE_FEATURES``
631- ``REQUIRED_COMBINED_FEATURES``
632- ``CONFLICT_COMBINED_FEATURES``
633- ``ANY_OF_COMBINED_FEATURES``
634
635If any conditions specified in the recipe using the above
636variables are not met, the recipe will be skipped, and if the
637build system attempts to build the recipe then an error will be
638triggered.
639
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500640.. _ref-classes-fontcache:
641
642``fontcache.bbclass``
643=====================
644
645The ``fontcache`` class generates the proper post-install and
646post-remove (postinst and postrm) scriptlets for font packages. These
647scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
648to the font information cache. Since the cache files are
649architecture-specific, ``fc-cache`` runs using QEMU if the postinst
650scriptlets need to be run on the build host during image creation.
651
652If the fonts being installed are in packages other than the main
653package, set :term:`FONT_PACKAGES` to specify the
654packages containing the fonts.
655
656.. _ref-classes-fs-uuid:
657
658``fs-uuid.bbclass``
659===================
660
661The ``fs-uuid`` class extracts UUID from
662``${``\ :term:`ROOTFS`\ ``}``, which must have been built
663by the time that this function gets called. The ``fs-uuid`` class only
664works on ``ext`` file systems and depends on ``tune2fs``.
665
666.. _ref-classes-gconf:
667
668``gconf.bbclass``
669=================
670
671The ``gconf`` class provides common functionality for recipes that need
672to install GConf schemas. The schemas will be put into a separate
673package (``${``\ :term:`PN`\ ``}-gconf``) that is created
674automatically when this class is inherited. This package uses the
675appropriate post-install and post-remove (postinst/postrm) scriptlets to
676register and unregister the schemas in the target image.
677
678.. _ref-classes-gettext:
679
680``gettext.bbclass``
681===================
682
683The ``gettext`` class provides support for building software that uses
684the GNU ``gettext`` internationalization and localization system. All
685recipes building software that use ``gettext`` should inherit this
686class.
687
688.. _ref-classes-gnomebase:
689
690``gnomebase.bbclass``
691=====================
692
693The ``gnomebase`` class is the base class for recipes that build
694software from the GNOME stack. This class sets
695:term:`SRC_URI` to download the source from the GNOME
696mirrors as well as extending :term:`FILES` with the typical
697GNOME installation paths.
698
699.. _ref-classes-gobject-introspection:
700
701``gobject-introspection.bbclass``
702=================================
703
704Provides support for recipes building software that supports GObject
705introspection. This functionality is only enabled if the
706"gobject-introspection-data" feature is in
707:term:`DISTRO_FEATURES` as well as
708"qemu-usermode" being in
709:term:`MACHINE_FEATURES`.
710
711.. note::
712
713 This functionality is backfilled by default and, if not applicable,
Andrew Geissler09036742021-06-25 14:25:14 -0500714 should be disabled through :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or
715 :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500716
717.. _ref-classes-grub-efi:
718
719``grub-efi.bbclass``
720====================
721
722The ``grub-efi`` class provides ``grub-efi``-specific functions for
723building bootable images.
724
725This class supports several variables:
726
727- :term:`INITRD`: Indicates list of filesystem images to
728 concatenate and use as an initial RAM disk (initrd) (optional).
729
730- :term:`ROOTFS`: Indicates a filesystem image to include
731 as the root filesystem (optional).
732
733- :term:`GRUB_GFXSERIAL`: Set this to "1" to have
734 graphics and serial in the boot menu.
735
736- :term:`LABELS`: A list of targets for the automatic
737 configuration.
738
739- :term:`APPEND`: An override list of append strings for
740 each ``LABEL``.
741
742- :term:`GRUB_OPTS`: Additional options to add to the
743 configuration (optional). Options are delimited using semi-colon
744 characters (``;``).
745
746- :term:`GRUB_TIMEOUT`: Timeout before executing
747 the default ``LABEL`` (optional).
748
749.. _ref-classes-gsettings:
750
751``gsettings.bbclass``
752=====================
753
754The ``gsettings`` class provides common functionality for recipes that
755need to install GSettings (glib) schemas. The schemas are assumed to be
756part of the main package. Appropriate post-install and post-remove
757(postinst/postrm) scriptlets are added to register and unregister the
758schemas in the target image.
759
760.. _ref-classes-gtk-doc:
761
762``gtk-doc.bbclass``
763===================
764
765The ``gtk-doc`` class is a helper class to pull in the appropriate
766``gtk-doc`` dependencies and disable ``gtk-doc``.
767
768.. _ref-classes-gtk-icon-cache:
769
770``gtk-icon-cache.bbclass``
771==========================
772
773The ``gtk-icon-cache`` class generates the proper post-install and
774post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
775install icons. These scriptlets call ``gtk-update-icon-cache`` to add
776the fonts to GTK+'s icon cache. Since the cache files are
777architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
778the postinst scriptlets need to be run on the build host during image
779creation.
780
781.. _ref-classes-gtk-immodules-cache:
782
783``gtk-immodules-cache.bbclass``
784===============================
785
786The ``gtk-immodules-cache`` class generates the proper post-install and
787post-remove (postinst/postrm) scriptlets for packages that install GTK+
788input method modules for virtual keyboards. These scriptlets call
789``gtk-update-icon-cache`` to add the input method modules to the cache.
790Since the cache files are architecture-specific,
791``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
792need to be run on the build host during image creation.
793
794If the input method modules being installed are in packages other than
795the main package, set
796:term:`GTKIMMODULES_PACKAGES` to specify
797the packages containing the modules.
798
799.. _ref-classes-gzipnative:
800
801``gzipnative.bbclass``
802======================
803
804The ``gzipnative`` class enables the use of different native versions of
805``gzip`` and ``pigz`` rather than the versions of these tools from the
806build host.
807
808.. _ref-classes-icecc:
809
810``icecc.bbclass``
811=================
812
813The ``icecc`` class supports
814`Icecream <https://github.com/icecc/icecream>`__, which facilitates
815taking compile jobs and distributing them among remote machines.
816
817The class stages directories with symlinks from ``gcc`` and ``g++`` to
818``icecc``, for both native and cross compilers. Depending on each
819configure or compile, the OpenEmbedded build system adds the directories
820at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
821``ICEC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
822compilers, respectively.
823
824For the cross compiler, the class creates a ``tar.gz`` file that
825contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
826is the version of the cross-compiler used in the cross-development
827toolchain, accordingly.
828
829The class handles all three different compile stages (i.e native
830,cross-kernel and target) and creates the necessary environment
831``tar.gz`` file to be used by the remote machines. The class also
832supports SDK generation.
833
834If :term:`ICECC_PATH` is not set in your
835``local.conf`` file, then the class tries to locate the ``icecc`` binary
836using ``which``. If :term:`ICECC_ENV_EXEC` is set
837in your ``local.conf`` file, the variable should point to the
838``icecc-create-env`` script provided by the user. If you do not point to
839a user-provided script, the build system uses the default script
840provided by the recipe ``icecc-create-env-native.bb``.
841
842.. note::
843
844 This script is a modified version and not the one that comes with
845 icecc.
846
847If you do not want the Icecream distributed compile support to apply to
848specific recipes or classes, you can effectively "blacklist" them by
849listing the recipes and classes using the
850:term:`ICECC_USER_PACKAGE_BL` and
851:term:`ICECC_USER_CLASS_BL`, variables,
852respectively, in your ``local.conf`` file. Doing so causes the
853OpenEmbedded build system to handle these compilations locally.
854
855Additionally, you can list recipes using the
856:term:`ICECC_USER_PACKAGE_WL` variable in
857your ``local.conf`` file to force ``icecc`` to be enabled for recipes
858using an empty :term:`PARALLEL_MAKE` variable.
859
860Inheriting the ``icecc`` class changes all sstate signatures.
861Consequently, if a development team has a dedicated build system that
862populates :term:`SSTATE_MIRRORS` and they want to
Andrew Geissler09036742021-06-25 14:25:14 -0500863reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500864system need to either inherit the ``icecc`` class or nobody should.
865
866At the distribution level, you can inherit the ``icecc`` class to be
867sure that all builders start with the same sstate signatures. After
868inheriting the class, you can then disable the feature by setting the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500869:term:`ICECC_DISABLED` variable to "1" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500870
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500871 INHERIT_DISTRO:append = " icecc"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500872 ICECC_DISABLED ??= "1"
873
874This practice
875makes sure everyone is using the same signatures but also requires
876individuals that do want to use Icecream to enable the feature
Andrew Geisslerc926e172021-05-07 16:11:35 -0500877individually as follows in your ``local.conf`` file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500878
879 ICECC_DISABLED = ""
880
881.. _ref-classes-image:
882
883``image.bbclass``
884=================
885
886The ``image`` class helps support creating images in different formats.
887First, the root filesystem is created from packages using one of the
888``rootfs*.bbclass`` files (depending on the package format used) and
889then one or more image files are created.
890
Andrew Geissler09036742021-06-25 14:25:14 -0500891- The :term:`IMAGE_FSTYPES` variable controls the types of images to
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500892 generate.
893
Andrew Geissler09036742021-06-25 14:25:14 -0500894- The :term:`IMAGE_INSTALL` variable controls the list of packages to
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500895 install into the image.
896
897For information on customizing images, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600898":ref:`dev-manual/common-tasks:customizing images`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500899in the Yocto Project Development Tasks Manual. For information on how
900images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600901":ref:`overview-manual/concepts:images`" section in the
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600902Yocto Project Overview and Concepts Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500903
904.. _ref-classes-image-buildinfo:
905
906``image-buildinfo.bbclass``
907===========================
908
909The ``image-buildinfo`` class writes information to the target
910filesystem on ``/etc/build``.
911
912.. _ref-classes-image_types:
913
914``image_types.bbclass``
915=======================
916
917The ``image_types`` class defines all of the standard image output types
918that you can enable through the
919:term:`IMAGE_FSTYPES` variable. You can use this
920class as a reference on how to add support for custom image output
921types.
922
923By default, the :ref:`image <ref-classes-image>` class automatically
924enables the ``image_types`` class. The ``image`` class uses the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500925``IMGCLASSES`` variable as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500926
927 IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
928 IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
929 IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
930 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
931 IMGCLASSES += "image_types_wic"
932 IMGCLASSES += "rootfs-postcommands"
933 IMGCLASSES += "image-postinst-intercepts"
934 inherit ${IMGCLASSES}
935
936The ``image_types`` class also handles conversion and compression of images.
937
938.. note::
939
940 To build a VMware VMDK image, you need to add "wic.vmdk" to
Andrew Geissler09036742021-06-25 14:25:14 -0500941 :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500942 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500943
944.. _ref-classes-image-live:
945
946``image-live.bbclass``
947======================
948
949This class controls building "live" (i.e. HDDIMG and ISO) images. Live
950images contain syslinux for legacy booting, as well as the bootloader
951specified by :term:`EFI_PROVIDER` if
952:term:`MACHINE_FEATURES` contains "efi".
953
954Normally, you do not use this class directly. Instead, you add "live" to
955:term:`IMAGE_FSTYPES`.
956
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500957.. _ref-classes-image-prelink:
958
959``image-prelink.bbclass``
960=========================
961
962The ``image-prelink`` class enables the use of the ``prelink`` utility
963during the :ref:`ref-tasks-rootfs` task, which optimizes
964the dynamic linking of shared libraries to reduce executable startup
965time.
966
967By default, the class is enabled in the ``local.conf.template`` using
Andrew Geisslerc926e172021-05-07 16:11:35 -0500968the :term:`USER_CLASSES` variable as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500969
Andrew Geissler5f350902021-07-23 13:09:54 -0400970 USER_CLASSES ?= "buildstats image-prelink"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500971
972.. _ref-classes-insane:
973
974``insane.bbclass``
975==================
976
977The ``insane`` class adds a step to the package generation process so
978that output quality assurance checks are generated by the OpenEmbedded
979build system. A range of checks are performed that check the build's
980output for common problems that show up during runtime. Distribution
981policy usually dictates whether to include this class.
982
983You can configure the sanity checks so that specific test failures
984either raise a warning or an error message. Typically, failures for new
985tests generate a warning. Subsequent failures for the same test would
986then generate an error message once the metadata is in a known and good
Andrew Geissler09209ee2020-12-13 08:44:15 -0600987condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500988and error messages you might encounter using a default configuration.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500989
990Use the :term:`WARN_QA` and
991:term:`ERROR_QA` variables to control the behavior of
992these checks at the global level (i.e. in your custom distro
993configuration). However, to skip one or more checks in recipes, you
994should use :term:`INSANE_SKIP`. For example, to skip
995the check for symbolic link ``.so`` files in the main package of a
996recipe, add the following to the recipe. You need to realize that the
Andrew Geisslerc926e172021-05-07 16:11:35 -0500997package name override, in this example ``${PN}``, must be used::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500998
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500999 INSANE_SKIP:${PN} += "dev-so"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001000
1001Please keep in mind that the QA checks
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001002are meant to detect real or potential problems in the packaged
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001003output. So exercise caution when disabling these checks.
1004
Andrew Geissler09036742021-06-25 14:25:14 -05001005Here are the tests you can list with the :term:`WARN_QA` and
Andrew Geissler5f350902021-07-23 13:09:54 -04001006:term:`ERROR_QA` variables:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001007
1008- ``already-stripped:`` Checks that produced binaries have not
1009 already been stripped prior to the build system extracting debug
1010 symbols. It is common for upstream software projects to default to
1011 stripping debug symbols for output binaries. In order for debugging
1012 to work on the target using ``-dbg`` packages, this stripping must be
1013 disabled.
1014
1015- ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1016 size, and endianness of any binaries to ensure they match the target
1017 architecture. This test fails if any binaries do not match the type
1018 since there would be an incompatibility. The test could indicate that
1019 the wrong compiler or compiler options have been used. Sometimes
1020 software, like bootloaders, might need to bypass this check.
1021
1022- ``buildpaths:`` Checks for paths to locations on the build host
1023 inside the output files. Currently, this test triggers too many false
1024 positives and thus is not normally enabled.
1025
1026- ``build-deps:`` Determines if a build-time dependency that is
1027 specified through :term:`DEPENDS`, explicit
1028 :term:`RDEPENDS`, or task-level dependencies exists
1029 to match any runtime dependency. This determination is particularly
1030 useful to discover where runtime dependencies are detected and added
1031 during packaging. If no explicit dependency has been specified within
1032 the metadata, at the packaging stage it is too late to ensure that
1033 the dependency is built, and thus you can end up with an error when
1034 the package is installed into the image during the
1035 :ref:`ref-tasks-rootfs` task because the auto-detected
1036 dependency was not satisfied. An example of this would be where the
1037 :ref:`update-rc.d <ref-classes-update-rc.d>` class automatically
1038 adds a dependency on the ``initscripts-functions`` package to
1039 packages that install an initscript that refers to
1040 ``/etc/init.d/functions``. The recipe should really have an explicit
Andrew Geissler5f350902021-07-23 13:09:54 -04001041 :term:`RDEPENDS` for the package in question on ``initscripts-functions``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001042 so that the OpenEmbedded build system is able to ensure that the
1043 ``initscripts`` recipe is actually built and thus the
1044 ``initscripts-functions`` package is made available.
1045
1046- ``compile-host-path:`` Checks the
1047 :ref:`ref-tasks-compile` log for indications that
1048 paths to locations on the build host were used. Using such paths
1049 might result in host contamination of the build output.
1050
1051- ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1052 do not depend on ``-dbg`` packages, which would cause a packaging
1053 bug.
1054
1055- ``debug-files:`` Checks for ``.debug`` directories in anything but
1056 the ``-dbg`` package. The debug files should all be in the ``-dbg``
1057 package. Thus, anything packaged elsewhere is incorrect packaging.
1058
1059- ``dep-cmp:`` Checks for invalid version comparison statements in
1060 runtime dependency relationships between packages (i.e. in
1061 :term:`RDEPENDS`,
1062 :term:`RRECOMMENDS`,
1063 :term:`RSUGGESTS`,
1064 :term:`RPROVIDES`,
1065 :term:`RREPLACES`, and
1066 :term:`RCONFLICTS` variable values). Any invalid
1067 comparisons might trigger failures or undesirable behavior when
1068 passed to the package manager.
1069
1070- ``desktop:`` Runs the ``desktop-file-validate`` program against any
1071 ``.desktop`` files to validate their contents against the
1072 specification for ``.desktop`` files.
1073
1074- ``dev-deps:`` Checks that all packages except ``-dev`` or
1075 ``-staticdev`` packages do not depend on ``-dev`` packages, which
1076 would be a packaging bug.
1077
1078- ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1079 ``-dev`` package and not in any of the other packages. In general,
1080 these symlinks are only useful for development purposes. Thus, the
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001081 ``-dev`` package is the correct location for them. In very rare
1082 cases, such as dynamically loaded modules, these symlinks
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001083 are needed instead in the main package.
1084
1085- ``file-rdeps:`` Checks that file-level dependencies identified by
1086 the OpenEmbedded build system at packaging time are satisfied. For
1087 example, a shell script might start with the line ``#!/bin/bash``.
1088 This line would translate to a file dependency on ``/bin/bash``. Of
1089 the three package managers that the OpenEmbedded build system
1090 supports, only RPM directly handles file-level dependencies,
1091 resolving them automatically to packages providing the files.
1092 However, the lack of that functionality in the other two package
1093 managers does not mean the dependencies do not still need resolving.
1094 This QA check attempts to ensure that explicitly declared
1095 :term:`RDEPENDS` exist to handle any file-level
1096 dependency detected in packaged files.
1097
1098- ``files-invalid:`` Checks for :term:`FILES` variable
1099 values that contain "//", which is invalid.
1100
1101- ``host-user-contaminated:`` Checks that no package produced by the
1102 recipe contains any files outside of ``/home`` with a user or group
1103 ID that matches the user running BitBake. A match usually indicates
1104 that the files are being installed with an incorrect UID/GID, since
1105 target IDs are independent from host IDs. For additional information,
1106 see the section describing the
1107 :ref:`ref-tasks-install` task.
1108
1109- ``incompatible-license:`` Report when packages are excluded from
1110 being created due to being marked with a license that is in
1111 :term:`INCOMPATIBLE_LICENSE`.
1112
1113- ``install-host-path:`` Checks the
1114 :ref:`ref-tasks-install` log for indications that
1115 paths to locations on the build host were used. Using such paths
1116 might result in host contamination of the build output.
1117
1118- ``installed-vs-shipped:`` Reports when files have been installed
1119 within ``do_install`` but have not been included in any package by
1120 way of the :term:`FILES` variable. Files that do not
1121 appear in any package cannot be present in an image later on in the
1122 build process. Ideally, all installed files should be packaged or not
1123 installed at all. These files can be deleted at the end of
1124 ``do_install`` if the files are not needed in any package.
1125
1126- ``invalid-chars:`` Checks that the recipe metadata variables
1127 :term:`DESCRIPTION`,
1128 :term:`SUMMARY`, :term:`LICENSE`, and
1129 :term:`SECTION` do not contain non-UTF-8 characters.
1130 Some package managers do not support such characters.
1131
1132- ``invalid-packageconfig:`` Checks that no undefined features are
1133 being added to :term:`PACKAGECONFIG`. For
Andrew Geisslerc926e172021-05-07 16:11:35 -05001134 example, any name "foo" for which the following form does not exist::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001135
1136 PACKAGECONFIG[foo] = "..."
1137
Andrew Geissler09036742021-06-25 14:25:14 -05001138- ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001139 file containing these paths is incorrect since ``libtool`` adds the
1140 correct sysroot prefix when using the files automatically itself.
1141
1142- ``ldflags:`` Ensures that the binaries were linked with the
1143 :term:`LDFLAGS` options provided by the build system.
Andrew Geissler09036742021-06-25 14:25:14 -05001144 If this test fails, check that the :term:`LDFLAGS` variable is being
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001145 passed to the linker command.
1146
1147- ``libdir:`` Checks for libraries being installed into incorrect
1148 (possibly hardcoded) installation paths. For example, this test will
1149 catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1150 "lib32". Another example is when recipes install
1151 ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1152
1153- ``libexec:`` Checks if a package contains files in
1154 ``/usr/libexec``. This check is not performed if the ``libexecdir``
1155 variable has been set explicitly to ``/usr/libexec``.
1156
1157- ``packages-list:`` Checks for the same package being listed
1158 multiple times through the :term:`PACKAGES` variable
1159 value. Installing the package in this manner can cause errors during
1160 packaging.
1161
1162- ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1163 invalid format.
1164
1165- ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1166 invalid format.
1167
1168- ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1169 'link' where the specified target already exists.
1170
1171- ``perms:`` Currently, this check is unused but reserved.
1172
1173- ``pkgconfig:`` Checks ``.pc`` files for any
1174 :term:`TMPDIR`/:term:`WORKDIR` paths.
1175 Any ``.pc`` file containing these paths is incorrect since
1176 ``pkg-config`` itself adds the correct sysroot prefix when the files
1177 are accessed.
1178
1179- ``pkgname:`` Checks that all packages in
1180 :term:`PACKAGES` have names that do not contain
1181 invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1182 -).
1183
Andrew Geissler09036742021-06-25 14:25:14 -05001184- ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001185 undefined during :ref:`ref-tasks-package`.
1186
1187- ``pkgvarcheck:`` Checks through the variables
1188 :term:`RDEPENDS`,
1189 :term:`RRECOMMENDS`,
1190 :term:`RSUGGESTS`,
1191 :term:`RCONFLICTS`,
1192 :term:`RPROVIDES`,
1193 :term:`RREPLACES`, :term:`FILES`,
1194 :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1195 ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1196 there are variable sets that are not package-specific. Using these
1197 variables without a package suffix is bad practice, and might
1198 unnecessarily complicate dependencies of other packages within the
1199 same recipe or have other unintended consequences.
1200
1201- ``pn-overrides:`` Checks that a recipe does not have a name
1202 (:term:`PN`) value that appears in
1203 :term:`OVERRIDES`. If a recipe is named such that
Andrew Geissler09036742021-06-25 14:25:14 -05001204 its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g.
1205 :term:`PN` happens to be the same as :term:`MACHINE` or
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001206 :term:`DISTRO`), it can have unexpected consequences.
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001207 For example, assignments such as ``FILES:${PN} = "xyz"`` effectively
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001208 turn into ``FILES = "xyz"``.
1209
1210- ``rpaths:`` Checks for rpaths in the binaries that contain build
Andrew Geissler5f350902021-07-23 13:09:54 -04001211 system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001212 options are being passed to the linker commands and your binaries
1213 have potential security issues.
1214
1215- ``split-strip:`` Reports that splitting or stripping debug symbols
1216 from binaries has failed.
1217
1218- ``staticdev:`` Checks for static library files (``*.a``) in
1219 non-``staticdev`` packages.
1220
1221- ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1222 into :term:`TMPDIR` on the host. Such symlinks will
1223 work on the host, but are clearly invalid when running on the target.
1224
1225- ``textrel:`` Checks for ELF binaries that contain relocations in
1226 their ``.text`` sections, which can result in a performance impact at
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001227 runtime. See the explanation for the ``ELF binary`` message in
Andrew Geissler09209ee2020-12-13 08:44:15 -06001228 ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001229 issues.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001230
1231- ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1232 for a package are also declared on the recipe level (i.e. any license
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001233 in ``LICENSE:*`` should appear in :term:`LICENSE`).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001234
1235- ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1236 in the binaries that by default on a standard system are searched by
1237 the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1238 not cause any breakage, they do waste space and are unnecessary.
1239
1240- ``var-undefined:`` Reports when variables fundamental to packaging
1241 (i.e. :term:`WORKDIR`,
1242 :term:`DEPLOY_DIR`, :term:`D`,
1243 :term:`PN`, and :term:`PKGD`) are undefined
1244 during :ref:`ref-tasks-package`.
1245
1246- ``version-going-backwards:`` If Build History is enabled, reports
1247 when a package being written out has a lower version than the
1248 previously written package under the same name. If you are placing
1249 output packages into a feed and upgrading packages on a target system
1250 using that feed, the version of a package going backwards can result
1251 in the target system not correctly upgrading to the "new" version of
1252 the package.
1253
1254 .. note::
1255
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001256 This is only relevant when you are using runtime package management
1257 on your target system.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001258
1259- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1260 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1261 driver ABI names. All drivers should depend on the ABI versions that
1262 they have been built against. Driver recipes that include
1263 ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1264 automatically get these versions. Consequently, you should only need
1265 to explicitly add dependencies to binary driver recipes.
1266
1267.. _ref-classes-insserv:
1268
1269``insserv.bbclass``
1270===================
1271
1272The ``insserv`` class uses the ``insserv`` utility to update the order
1273of symbolic links in ``/etc/rc?.d/`` within an image based on
1274dependencies specified by LSB headers in the ``init.d`` scripts
1275themselves.
1276
1277.. _ref-classes-kernel:
1278
1279``kernel.bbclass``
1280==================
1281
1282The ``kernel`` class handles building Linux kernels. The class contains
1283code to build all kernel trees. All needed headers are staged into the
Andrew Geissler5f350902021-07-23 13:09:54 -04001284:term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001285using the :ref:`module <ref-classes-module>` class.
1286
1287This means that each built kernel module is packaged separately and
1288inter-module dependencies are created by parsing the ``modinfo`` output.
1289If all modules are required, then installing the ``kernel-modules``
1290package installs all packages with modules and various other kernel
1291packages such as ``kernel-vmlinux``.
1292
1293The ``kernel`` class contains logic that allows you to embed an initial
1294RAM filesystem (initramfs) image when you build the kernel image. For
1295information on how to build an initramfs, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001296":ref:`dev-manual/common-tasks:building an initial ram filesystem (initramfs) image`" section in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001297the Yocto Project Development Tasks Manual.
1298
1299Various other classes are used by the ``kernel`` and ``module`` classes
1300internally including the :ref:`kernel-arch <ref-classes-kernel-arch>`,
1301:ref:`module-base <ref-classes-module-base>`, and
1302:ref:`linux-kernel-base <ref-classes-linux-kernel-base>` classes.
1303
1304.. _ref-classes-kernel-arch:
1305
1306``kernel-arch.bbclass``
1307=======================
1308
1309The ``kernel-arch`` class sets the ``ARCH`` environment variable for
1310Linux kernel compilation (including modules).
1311
1312.. _ref-classes-kernel-devicetree:
1313
1314``kernel-devicetree.bbclass``
1315=============================
1316
1317The ``kernel-devicetree`` class, which is inherited by the
1318:ref:`kernel <ref-classes-kernel>` class, supports device tree
1319generation.
1320
1321.. _ref-classes-kernel-fitimage:
1322
1323``kernel-fitimage.bbclass``
1324===========================
1325
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001326The ``kernel-fitimage`` class provides support to pack a kernel image,
1327device trees, a U-boot script, a Initramfs bundle and a RAM disk
1328into a single FIT image. In theory, a FIT image can support any number
1329of kernels, U-boot scripts, Initramfs bundles, RAM disks and device-trees.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001330However, ``kernel-fitimage`` currently only supports
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001331limited usescases: just one kernel image, an optional U-boot script,
1332an optional Initramfs bundle, an optional RAM disk, and any number of
1333device tree.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001334
1335To create a FIT image, it is required that :term:`KERNEL_CLASSES`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001336is set to include "kernel-fitimage" and :term:`KERNEL_IMAGETYPE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001337is set to "fitImage".
1338
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001339The options for the device tree compiler passed to ``mkimage -D``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001340when creating the FIT image are specified using the
1341:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1342
1343Only a single kernel can be added to the FIT image created by
1344``kernel-fitimage`` and the kernel image in FIT is mandatory. The
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001345address where the kernel image is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001346specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
1347:term:`UBOOT_ENTRYPOINT`.
1348
1349Multiple device trees can be added to the FIT image created by
1350``kernel-fitimage`` and the device tree is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001351The address where the device tree is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001352specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001353and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001354
1355Only a single RAM disk can be added to the FIT image created by
1356``kernel-fitimage`` and the RAM disk in FIT is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001357The address where the RAM disk image is to be loaded by U-Boot
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001358is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
1359:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to FIT image when
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001360:term:`INITRAMFS_IMAGE` is specified and that :term:`INITRAMFS_IMAGE_BUNDLE`
1361is set to 0.
1362
1363Only a single Initramfs bundle can be added to the FIT image created by
1364``kernel-fitimage`` and the Initramfs bundle in FIT is optional.
1365In case of Initramfs, the kernel is configured to be bundled with the rootfs
1366in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
1367When the kernel is copied to RAM and executed, it unpacks the Initramfs rootfs.
1368The Initramfs bundle can be enabled when :term:`INITRAMFS_IMAGE`
1369is specified and that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
1370The address where the Initramfs bundle is to be loaded by U-boot is specified
1371by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1372
1373Only a single U-boot boot script can be added to the FIT image created by
1374``kernel-fitimage`` and the boot script is optional.
1375The boot script is specified in the ITS file as a text file containing
1376U-boot commands. When using a boot script the user should configure the
1377U-boot ``do_install`` task to copy the script to sysroot.
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05001378So the script can be included in the FIT image by the ``kernel-fitimage``
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001379class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
1380load the boot script from the FIT image and executes it.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001381
1382The FIT image generated by ``kernel-fitimage`` class is signed when the
1383variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1384:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1385appropriately. The default values used for :term:`FIT_HASH_ALG` and
1386:term:`FIT_SIGN_ALG` in ``kernel-fitimage`` are "sha256" and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001387"rsa2048" respectively. The keys for signing fitImage can be generated using
1388the ``kernel-fitimage`` class when both :term:`FIT_GENERATE_KEYS` and
1389:term:`UBOOT_SIGN_ENABLE` are set to "1".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001390
1391
1392.. _ref-classes-kernel-grub:
1393
1394``kernel-grub.bbclass``
1395=======================
1396
1397The ``kernel-grub`` class updates the boot area and the boot menu with
1398the kernel as the priority boot mechanism while installing a RPM to
1399update the kernel on a deployed target.
1400
1401.. _ref-classes-kernel-module-split:
1402
1403``kernel-module-split.bbclass``
1404===============================
1405
1406The ``kernel-module-split`` class provides common functionality for
1407splitting Linux kernel modules into separate packages.
1408
1409.. _ref-classes-kernel-uboot:
1410
1411``kernel-uboot.bbclass``
1412========================
1413
1414The ``kernel-uboot`` class provides support for building from
1415vmlinux-style kernel sources.
1416
1417.. _ref-classes-kernel-uimage:
1418
1419``kernel-uimage.bbclass``
1420=========================
1421
1422The ``kernel-uimage`` class provides support to pack uImage.
1423
1424.. _ref-classes-kernel-yocto:
1425
1426``kernel-yocto.bbclass``
1427========================
1428
1429The ``kernel-yocto`` class provides common functionality for building
1430from linux-yocto style kernel source repositories.
1431
1432.. _ref-classes-kernelsrc:
1433
1434``kernelsrc.bbclass``
1435=====================
1436
1437The ``kernelsrc`` class sets the Linux kernel source and version.
1438
1439.. _ref-classes-lib_package:
1440
1441``lib_package.bbclass``
1442=======================
1443
1444The ``lib_package`` class supports recipes that build libraries and
1445produce executable binaries, where those binaries should not be
1446installed by default along with the library. Instead, the binaries are
1447added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1448make their installation optional.
1449
1450.. _ref-classes-libc*:
1451
1452``libc*.bbclass``
1453=================
1454
1455The ``libc*`` classes support recipes that build packages with ``libc``:
1456
1457- The ``libc-common`` class provides common support for building with
1458 ``libc``.
1459
1460- The ``libc-package`` class supports packaging up ``glibc`` and
1461 ``eglibc``.
1462
1463.. _ref-classes-license:
1464
1465``license.bbclass``
1466===================
1467
1468The ``license`` class provides license manifest creation and license
1469exclusion. This class is enabled by default using the default value for
1470the :term:`INHERIT_DISTRO` variable.
1471
1472.. _ref-classes-linux-kernel-base:
1473
1474``linux-kernel-base.bbclass``
1475=============================
1476
1477The ``linux-kernel-base`` class provides common functionality for
1478recipes that build out of the Linux kernel source tree. These builds
1479goes beyond the kernel itself. For example, the Perf recipe also
1480inherits this class.
1481
1482.. _ref-classes-linuxloader:
1483
1484``linuxloader.bbclass``
1485=======================
1486
1487Provides the function ``linuxloader()``, which gives the value of the
1488dynamic loader/linker provided on the platform. This value is used by a
1489number of other classes.
1490
1491.. _ref-classes-logging:
1492
1493``logging.bbclass``
1494===================
1495
1496The ``logging`` class provides the standard shell functions used to log
1497messages for various BitBake severity levels (i.e. ``bbplain``,
1498``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1499
1500This class is enabled by default since it is inherited by the ``base``
1501class.
1502
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001503.. _ref-classes-metadata_scm:
1504
1505``metadata_scm.bbclass``
1506========================
1507
1508The ``metadata_scm`` class provides functionality for querying the
1509branch and revision of a Source Code Manager (SCM) repository.
1510
1511The :ref:`base <ref-classes-base>` class uses this class to print the
1512revisions of each layer before starting every build. The
1513``metadata_scm`` class is enabled by default because it is inherited by
1514the ``base`` class.
1515
1516.. _ref-classes-migrate_localcount:
1517
1518``migrate_localcount.bbclass``
1519==============================
1520
1521The ``migrate_localcount`` class verifies a recipe's localcount data and
1522increments it appropriately.
1523
1524.. _ref-classes-mime:
1525
1526``mime.bbclass``
1527================
1528
1529The ``mime`` class generates the proper post-install and post-remove
1530(postinst/postrm) scriptlets for packages that install MIME type files.
1531These scriptlets call ``update-mime-database`` to add the MIME types to
1532the shared database.
1533
1534.. _ref-classes-mirrors:
1535
1536``mirrors.bbclass``
1537===================
1538
1539The ``mirrors`` class sets up some standard
1540:term:`MIRRORS` entries for source code mirrors. These
1541mirrors provide a fall-back path in case the upstream source specified
1542in :term:`SRC_URI` within recipes is unavailable.
1543
1544This class is enabled by default since it is inherited by the
1545:ref:`base <ref-classes-base>` class.
1546
1547.. _ref-classes-module:
1548
1549``module.bbclass``
1550==================
1551
1552The ``module`` class provides support for building out-of-tree Linux
1553kernel modules. The class inherits the
1554:ref:`module-base <ref-classes-module-base>` and
1555:ref:`kernel-module-split <ref-classes-kernel-module-split>` classes,
1556and implements the :ref:`ref-tasks-compile` and
1557:ref:`ref-tasks-install` tasks. The class provides
1558everything needed to build and package a kernel module.
1559
1560For general information on out-of-tree Linux kernel modules, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001561":ref:`kernel-dev/common:incorporating out-of-tree modules`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001562section in the Yocto Project Linux Kernel Development Manual.
1563
1564.. _ref-classes-module-base:
1565
1566``module-base.bbclass``
1567=======================
1568
1569The ``module-base`` class provides the base functionality for building
1570Linux kernel modules. Typically, a recipe that builds software that
1571includes one or more kernel modules and has its own means of building
1572the module inherits this class as opposed to inheriting the
1573:ref:`module <ref-classes-module>` class.
1574
1575.. _ref-classes-multilib*:
1576
1577``multilib*.bbclass``
1578=====================
1579
1580The ``multilib*`` classes provide support for building libraries with
1581different target optimizations or target architectures and installing
1582them side-by-side in the same image.
1583
1584For more information on using the Multilib feature, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001585":ref:`dev-manual/common-tasks:combining multiple versions of library files into one image`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001586section in the Yocto Project Development Tasks Manual.
1587
1588.. _ref-classes-native:
1589
1590``native.bbclass``
1591==================
1592
1593The ``native`` class provides common functionality for recipes that
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001594build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
1595or other tools from the build host).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001596
1597You can create a recipe that builds tools that run natively on the host
1598a couple different ways:
1599
Andrew Geisslereff27472021-10-29 15:35:00 -05001600- Create a ``myrecipe-native.bb`` recipe that inherits the ``native``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001601 class. If you use this method, you must order the inherit statement
1602 in the recipe after all other inherit statements so that the
1603 ``native`` class is inherited last.
1604
1605 .. note::
1606
1607 When creating a recipe this way, the recipe name must follow this
Andrew Geisslerc926e172021-05-07 16:11:35 -05001608 naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001609
1610 myrecipe-native.bb
1611
1612
1613 Not using this naming convention can lead to subtle problems
1614 caused by existing code that depends on that naming convention.
1615
Andrew Geisslerc926e172021-05-07 16:11:35 -05001616- Create or modify a target recipe that contains the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001617
1618 BBCLASSEXTEND = "native"
1619
1620 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001621 recipe, use ``:class-native`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001622 specify any functionality specific to the respective native or target
1623 case.
1624
1625Although applied differently, the ``native`` class is used with both
1626methods. The advantage of the second method is that you do not need to
1627have two separate recipes (assuming you need both) for native and
1628target. All common parts of the recipe are automatically shared.
1629
1630.. _ref-classes-nativesdk:
1631
1632``nativesdk.bbclass``
1633=====================
1634
1635The ``nativesdk`` class provides common functionality for recipes that
1636wish to build tools to run as part of an SDK (i.e. tools that run on
1637:term:`SDKMACHINE`).
1638
1639You can create a recipe that builds tools that run on the SDK machine a
1640couple different ways:
1641
Andrew Geisslereff27472021-10-29 15:35:00 -05001642- Create a ``nativesdk-myrecipe.bb`` recipe that inherits the
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001643 ``nativesdk`` class. If you use this method, you must order the
1644 inherit statement in the recipe after all other inherit statements so
1645 that the ``nativesdk`` class is inherited last.
1646
Andrew Geisslerc926e172021-05-07 16:11:35 -05001647- Create a ``nativesdk`` variant of any recipe by adding the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001648
1649 BBCLASSEXTEND = "nativesdk"
1650
1651 Inside the
Patrick Williams0ca19cc2021-08-16 14:03:13 -05001652 recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001653 specify any functionality specific to the respective SDK machine or
1654 target case.
1655
1656.. note::
1657
Andrew Geisslerc926e172021-05-07 16:11:35 -05001658 When creating a recipe, you must follow this naming convention::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001659
1660 nativesdk-myrecipe.bb
1661
1662
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001663 Not doing so can lead to subtle problems because there is code that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001664 depends on the naming convention.
1665
1666Although applied differently, the ``nativesdk`` class is used with both
1667methods. The advantage of the second method is that you do not need to
1668have two separate recipes (assuming you need both) for the SDK machine
1669and the target. All common parts of the recipe are automatically shared.
1670
1671.. _ref-classes-nopackages:
1672
1673``nopackages.bbclass``
1674======================
1675
1676Disables packaging tasks for those recipes and classes where packaging
1677is not needed.
1678
1679.. _ref-classes-npm:
1680
1681``npm.bbclass``
1682===============
1683
1684Provides support for building Node.js software fetched using the `node
1685package manager (NPM) <https://en.wikipedia.org/wiki/Npm_(software)>`__.
1686
1687.. note::
1688
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001689 Currently, recipes inheriting this class must use the ``npm://``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001690 fetcher to have dependencies fetched and packaged automatically.
1691
1692For information on how to create NPM packages, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001693":ref:`dev-manual/common-tasks:creating node package manager (npm) packages`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001694section in the Yocto Project Development Tasks Manual.
1695
1696.. _ref-classes-oelint:
1697
1698``oelint.bbclass``
1699==================
1700
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001701The ``oelint`` class is an obsolete lint checking tool available in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001702``meta/classes`` in the :term:`Source Directory`.
1703
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001704There are some classes that could be generally useful in OE-Core but
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001705are never actually used within OE-Core itself. The ``oelint`` class is
1706one such example. However, being aware of this class can reduce the
1707proliferation of different versions of similar classes across multiple
1708layers.
1709
Andrew Geissler5199d832021-09-24 16:47:35 -05001710.. _ref-classes-overlayfs:
1711
1712``overlayfs.bbclass``
1713=======================
1714
1715It's often desired in Embedded System design to have a read-only rootfs.
1716But a lot of different applications might want to have read-write access to
1717some parts of a filesystem. It can be especially useful when your update mechanism
1718overwrites the whole rootfs, but you may want your application data to be preserved
1719between updates. The :ref:`overlayfs <ref-classes-overlayfs>` class provides a way
1720to achieve that by means of ``overlayfs`` and at the same time keeping the base
1721rootfs read-only.
1722
1723To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper
1724layer in your machine configuration. The underlying file system can be anything that
1725is supported by ``overlayfs``. This has to be done in your machine configuration::
1726
1727 OVERLAYFS_MOUNT_POINT[data] = "/data"
1728
1729.. note::
1730
1731 * QA checks fail to catch file existence if you redefine this variable in your recipe!
1732 * Only the existence of the systemd mount unit file is checked, not its contents.
1733 * To get more details on ``overlayfs``, its internals and supported operations, please refer
1734 to the official documentation of the `Linux kernel <https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html>`_.
1735
1736The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP
1737(e.g. in ``systemd-machine-units`` recipe) and it's installed into the image.
1738
1739Then you can specify writable directories on a recipe basis (e.g. in my-application.bb)::
1740
1741 OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application"
1742
1743To support several mount points you can use a different variable flag. Assuming we
1744want to have a writable location on the file system, but do not need that the data
1745survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs`` file system.
1746
1747In your machine configuration::
1748
1749 OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
1750
1751and then in your recipe::
1752
1753 OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application"
1754
1755.. note::
1756
1757 The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it.
1758
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001759.. _ref-classes-own-mirrors:
1760
1761``own-mirrors.bbclass``
1762=======================
1763
1764The ``own-mirrors`` class makes it easier to set up your own
1765:term:`PREMIRRORS` from which to first fetch source
1766before attempting to fetch it from the upstream specified in
1767:term:`SRC_URI` within each recipe.
1768
1769To use this class, inherit it globally and specify
Andrew Geisslerc926e172021-05-07 16:11:35 -05001770:term:`SOURCE_MIRROR_URL`. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001771
1772 INHERIT += "own-mirrors"
1773 SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
1774
1775You can specify only a single URL
Andrew Geissler09036742021-06-25 14:25:14 -05001776in :term:`SOURCE_MIRROR_URL`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001777
1778.. _ref-classes-package:
1779
1780``package.bbclass``
1781===================
1782
1783The ``package`` class supports generating packages from a build's
1784output. The core generic functionality is in ``package.bbclass``. The
1785code specific to particular package types resides in these
1786package-specific classes:
1787:ref:`package_deb <ref-classes-package_deb>`,
1788:ref:`package_rpm <ref-classes-package_rpm>`,
1789:ref:`package_ipk <ref-classes-package_ipk>`, and
1790:ref:`package_tar <ref-classes-package_tar>`.
1791
1792.. note::
1793
1794 The
1795 package_tar
1796 class is broken and not supported. It is recommended that you do not
1797 use this class.
1798
1799You can control the list of resulting package formats by using the
Andrew Geissler09036742021-06-25 14:25:14 -05001800:term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001801configuration file, which is located in the :term:`Build Directory`.
1802When defining the variable, you can
1803specify one or more package types. Since images are generated from
1804packages, a packaging class is needed to enable image generation. The
1805first class listed in this variable is used for image generation.
1806
1807If you take the optional step to set up a repository (package feed) on
1808the development host that can be used by DNF, you can install packages
1809from the feed while you are running the image on the target (i.e.
1810runtime installation of packages). For more information, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001811":ref:`dev-manual/common-tasks:using runtime package management`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001812section in the Yocto Project Development Tasks Manual.
1813
1814The package-specific class you choose can affect build-time performance
1815and has space ramifications. In general, building a package with IPK
1816takes about thirty percent less time as compared to using RPM to build
1817the same or similar package. This comparison takes into account a
1818complete build of the package with all dependencies previously built.
1819The reason for this discrepancy is because the RPM package manager
1820creates and processes more :term:`Metadata` than the IPK package
Andrew Geissler09036742021-06-25 14:25:14 -05001821manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001822"package_ipk" if you are building smaller systems.
1823
1824Before making your package manager decision, however, you should
1825consider some further things about using RPM:
1826
1827- RPM starts to provide more abilities than IPK due to the fact that it
1828 processes more Metadata. For example, this information includes
1829 individual file types, file checksum generation and evaluation on
1830 install, sparse file support, conflict detection and resolution for
1831 Multilib systems, ACID style upgrade, and repackaging abilities for
1832 rollbacks.
1833
1834- For smaller systems, the extra space used for the Berkeley Database
1835 and the amount of metadata when using RPM can affect your ability to
1836 perform on-device upgrades.
1837
1838You can find additional information on the effects of the package class
1839at these two Yocto Project mailing list links:
1840
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001841- :yocto_lists:`/pipermail/poky/2011-May/006362.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001842
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001843- :yocto_lists:`/pipermail/poky/2011-May/006363.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001844
1845.. _ref-classes-package_deb:
1846
1847``package_deb.bbclass``
1848=======================
1849
1850The ``package_deb`` class provides support for creating packages that
1851use the Debian (i.e. ``.deb``) file format. The class ensures the
1852packages are written out in a ``.deb`` file format to the
1853``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
1854
1855This class inherits the :ref:`package <ref-classes-package>` class and
1856is enabled through the :term:`PACKAGE_CLASSES`
1857variable in the ``local.conf`` file.
1858
1859.. _ref-classes-package_ipk:
1860
1861``package_ipk.bbclass``
1862=======================
1863
1864The ``package_ipk`` class provides support for creating packages that
1865use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
1866are written out in a ``.ipk`` file format to the
1867``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
1868
1869This class inherits the :ref:`package <ref-classes-package>` class and
1870is enabled through the :term:`PACKAGE_CLASSES`
1871variable in the ``local.conf`` file.
1872
1873.. _ref-classes-package_rpm:
1874
1875``package_rpm.bbclass``
1876=======================
1877
1878The ``package_rpm`` class provides support for creating packages that
1879use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
1880are written out in a ``.rpm`` file format to the
1881``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
1882
1883This class inherits the :ref:`package <ref-classes-package>` class and
1884is enabled through the :term:`PACKAGE_CLASSES`
1885variable in the ``local.conf`` file.
1886
1887.. _ref-classes-package_tar:
1888
1889``package_tar.bbclass``
1890=======================
1891
1892The ``package_tar`` class provides support for creating tarballs. The
1893class ensures the packages are written out in a tarball format to the
1894``${``\ :term:`DEPLOY_DIR_TAR`\ ``}`` directory.
1895
1896This class inherits the :ref:`package <ref-classes-package>` class and
1897is enabled through the :term:`PACKAGE_CLASSES`
1898variable in the ``local.conf`` file.
1899
1900.. note::
1901
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001902 You cannot specify the ``package_tar`` class first using the
Andrew Geissler09036742021-06-25 14:25:14 -05001903 :term:`PACKAGE_CLASSES` variable. You must use ``.deb``, ``.ipk``, or ``.rpm``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001904 file formats for your image or SDK.
1905
1906.. _ref-classes-packagedata:
1907
1908``packagedata.bbclass``
1909=======================
1910
1911The ``packagedata`` class provides common functionality for reading
1912``pkgdata`` files found in :term:`PKGDATA_DIR`. These
1913files contain information about each output package produced by the
1914OpenEmbedded build system.
1915
1916This class is enabled by default because it is inherited by the
1917:ref:`package <ref-classes-package>` class.
1918
1919.. _ref-classes-packagegroup:
1920
1921``packagegroup.bbclass``
1922========================
1923
1924The ``packagegroup`` class sets default values appropriate for package
Andrew Geissler09036742021-06-25 14:25:14 -05001925group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001926so forth). It is highly recommended that all package group recipes
1927inherit this class.
1928
1929For information on how to use this class, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001930":ref:`dev-manual/common-tasks:customizing images using custom package groups`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001931section in the Yocto Project Development Tasks Manual.
1932
1933Previously, this class was called the ``task`` class.
1934
1935.. _ref-classes-patch:
1936
1937``patch.bbclass``
1938=================
1939
1940The ``patch`` class provides all functionality for applying patches
1941during the :ref:`ref-tasks-patch` task.
1942
1943This class is enabled by default because it is inherited by the
1944:ref:`base <ref-classes-base>` class.
1945
1946.. _ref-classes-perlnative:
1947
1948``perlnative.bbclass``
1949======================
1950
1951When inherited by a recipe, the ``perlnative`` class supports using the
1952native version of Perl built by the build system rather than using the
1953version provided by the build host.
1954
1955.. _ref-classes-pixbufcache:
1956
1957``pixbufcache.bbclass``
1958=======================
1959
1960The ``pixbufcache`` class generates the proper post-install and
1961post-remove (postinst/postrm) scriptlets for packages that install
1962pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
1963call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
1964Since the cache files are architecture-specific, ``update_pixbuf_cache``
1965is run using QEMU if the postinst scriptlets need to be run on the build
1966host during image creation.
1967
1968If the pixbuf loaders being installed are in packages other than the
1969recipe's main package, set
1970:term:`PIXBUF_PACKAGES` to specify the packages
1971containing the loaders.
1972
1973.. _ref-classes-pkgconfig:
1974
1975``pkgconfig.bbclass``
1976=====================
1977
1978The ``pkgconfig`` class provides a standard way to get header and
1979library information by using ``pkg-config``. This class aims to smooth
1980integration of ``pkg-config`` into libraries that use it.
1981
1982During staging, BitBake installs ``pkg-config`` data into the
1983``sysroots/`` directory. By making use of sysroot functionality within
1984``pkg-config``, the ``pkgconfig`` class no longer has to manipulate the
1985files.
1986
1987.. _ref-classes-populate-sdk:
1988
1989``populate_sdk.bbclass``
1990========================
1991
1992The ``populate_sdk`` class provides support for SDK-only recipes. For
1993information on advantages gained when building a cross-development
1994toolchain using the :ref:`ref-tasks-populate_sdk`
Andrew Geissler09209ee2020-12-13 08:44:15 -06001995task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001996section in the Yocto Project Application Development and the Extensible
1997Software Development Kit (eSDK) manual.
1998
1999.. _ref-classes-populate-sdk-*:
2000
2001``populate_sdk_*.bbclass``
2002==========================
2003
2004The ``populate_sdk_*`` classes support SDK creation and consist of the
2005following classes:
2006
2007- ``populate_sdk_base``: The base class supporting SDK creation under
2008 all package managers (i.e. DEB, RPM, and opkg).
2009
2010- ``populate_sdk_deb``: Supports creation of the SDK given the Debian
2011 package manager.
2012
2013- ``populate_sdk_rpm``: Supports creation of the SDK given the RPM
2014 package manager.
2015
2016- ``populate_sdk_ipk``: Supports creation of the SDK given the opkg
2017 (IPK format) package manager.
2018
2019- ``populate_sdk_ext``: Supports extensible SDK creation under all
2020 package managers.
2021
2022The ``populate_sdk_base`` class inherits the appropriate
2023``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2024:term:`IMAGE_PKGTYPE`.
2025
2026The base class ensures all source and destination directories are
2027established and then populates the SDK. After populating the SDK, the
2028``populate_sdk_base`` class constructs two sysroots:
2029``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2030contains the cross-compiler and associated tooling, and the target,
2031which contains a target root filesystem that is configured for the SDK
2032usage. These two images reside in :term:`SDK_OUTPUT`,
Andrew Geisslerc926e172021-05-07 16:11:35 -05002033which consists of the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002034
2035 ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2036 ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2037
2038Finally, the base populate SDK class creates the toolchain environment
2039setup script, the tarball of the SDK, and the installer.
2040
2041The respective ``populate_sdk_deb``, ``populate_sdk_rpm``, and
2042``populate_sdk_ipk`` classes each support the specific type of SDK.
2043These classes are inherited by and used with the ``populate_sdk_base``
2044class.
2045
2046For more information on the cross-development toolchain generation, see
Andrew Geissler09209ee2020-12-13 08:44:15 -06002047the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002048section in the Yocto Project Overview and Concepts Manual. For
2049information on advantages gained when building a cross-development
2050toolchain using the :ref:`ref-tasks-populate_sdk`
2051task, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002052":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002053section in the Yocto Project Application Development and the Extensible
2054Software Development Kit (eSDK) manual.
2055
2056.. _ref-classes-prexport:
2057
2058``prexport.bbclass``
2059====================
2060
2061The ``prexport`` class provides functionality for exporting
2062:term:`PR` values.
2063
2064.. note::
2065
2066 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002067 when using "``bitbake-prserv-tool export``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002068
2069.. _ref-classes-primport:
2070
2071``primport.bbclass``
2072====================
2073
2074The ``primport`` class provides functionality for importing
2075:term:`PR` values.
2076
2077.. note::
2078
2079 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002080 when using "``bitbake-prserv-tool import``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002081
2082.. _ref-classes-prserv:
2083
2084``prserv.bbclass``
2085==================
2086
2087The ``prserv`` class provides functionality for using a :ref:`PR
Andrew Geissler09209ee2020-12-13 08:44:15 -06002088service <dev-manual/common-tasks:working with a pr service>` in order to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002089automatically manage the incrementing of the :term:`PR`
2090variable for each recipe.
2091
2092This class is enabled by default because it is inherited by the
2093:ref:`package <ref-classes-package>` class. However, the OpenEmbedded
2094build system will not enable the functionality of this class unless
2095:term:`PRSERV_HOST` has been set.
2096
2097.. _ref-classes-ptest:
2098
2099``ptest.bbclass``
2100=================
2101
2102The ``ptest`` class provides functionality for packaging and installing
2103runtime tests for recipes that build software that provides these tests.
2104
2105This class is intended to be inherited by individual recipes. However,
2106the class' functionality is largely disabled unless "ptest" appears in
2107:term:`DISTRO_FEATURES`. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002108":ref:`dev-manual/common-tasks:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002109section in the Yocto Project Development Tasks Manual for more information
2110on ptest.
2111
2112.. _ref-classes-ptest-gnome:
2113
2114``ptest-gnome.bbclass``
2115=======================
2116
2117Enables package tests (ptests) specifically for GNOME packages, which
2118have tests intended to be executed with ``gnome-desktop-testing``.
2119
2120For information on setting up and running ptests, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002121":ref:`dev-manual/common-tasks:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002122section in the Yocto Project Development Tasks Manual.
2123
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002124.. _ref-classes-python3-dir:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002125
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002126``python3-dir.bbclass``
2127=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002128
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002129The ``python3-dir`` class provides the base version, location, and site
2130package location for Python 3.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002131
2132.. _ref-classes-python3native:
2133
2134``python3native.bbclass``
2135=========================
2136
2137The ``python3native`` class supports using the native version of Python
21383 built by the build system rather than support of the version provided
2139by the build host.
2140
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002141.. _ref-classes-python3targetconfig:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002142
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002143``python3targetconfig.bbclass``
2144===============================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002145
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002146The ``python3targetconfig`` class supports using the native version of Python
21473 built by the build system rather than support of the version provided
2148by the build host, except that the configuration for the target machine
2149is accessible (such as correct installation directories). This also adds a
2150dependency on target ``python3``, so should only be used where appropriate
2151in order to avoid unnecessarily lengthening builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002152
2153.. _ref-classes-qemu:
2154
2155``qemu.bbclass``
2156================
2157
2158The ``qemu`` class provides functionality for recipes that either need
2159QEMU or test for the existence of QEMU. Typically, this class is used to
2160run programs for a target system on the build host using QEMU's
2161application emulation mode.
2162
2163.. _ref-classes-recipe_sanity:
2164
2165``recipe_sanity.bbclass``
2166=========================
2167
2168The ``recipe_sanity`` class checks for the presence of any host system
2169recipe prerequisites that might affect the build (e.g. variables that
2170are set or software that is present).
2171
2172.. _ref-classes-relocatable:
2173
2174``relocatable.bbclass``
2175=======================
2176
2177The ``relocatable`` class enables relocation of binaries when they are
2178installed into the sysroot.
2179
2180This class makes use of the :ref:`chrpath <ref-classes-chrpath>` class
2181and is used by both the :ref:`cross <ref-classes-cross>` and
2182:ref:`native <ref-classes-native>` classes.
2183
2184.. _ref-classes-remove-libtool:
2185
2186``remove-libtool.bbclass``
2187==========================
2188
2189The ``remove-libtool`` class adds a post function to the
2190:ref:`ref-tasks-install` task to remove all ``.la`` files
2191installed by ``libtool``. Removing these files results in them being
2192absent from both the sysroot and target packages.
2193
2194If a recipe needs the ``.la`` files to be installed, then the recipe can
Andrew Geisslerc926e172021-05-07 16:11:35 -05002195override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002196
2197 REMOVE_LIBTOOL_LA = "0"
2198
2199.. note::
2200
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002201 The ``remove-libtool`` class is not enabled by default.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002202
2203.. _ref-classes-report-error:
2204
2205``report-error.bbclass``
2206========================
2207
2208The ``report-error`` class supports enabling the :ref:`error reporting
Andrew Geissler09209ee2020-12-13 08:44:15 -06002209tool <dev-manual/common-tasks:using the error reporting tool>`",
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002210which allows you to submit build error information to a central database.
2211
2212The class collects debug information for recipe, recipe version, task,
2213machine, distro, build system, target system, host distro, branch,
2214commit, and log. From the information, report files using a JSON format
2215are created and stored in
2216``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2217
2218.. _ref-classes-rm-work:
2219
2220``rm_work.bbclass``
2221===================
2222
2223The ``rm_work`` class supports deletion of temporary workspace, which
2224can ease your hard drive demands during builds.
2225
2226The OpenEmbedded build system can use a substantial amount of disk space
2227during the build process. A portion of this space is the work files
2228under the ``${TMPDIR}/work`` directory for each recipe. Once the build
2229system generates the packages for a recipe, the work files for that
2230recipe are no longer needed. However, by default, the build system
2231preserves these files for inspection and possible debugging purposes. If
2232you would rather have these files deleted to save disk space as the
2233build progresses, you can enable ``rm_work`` by adding the following to
2234your ``local.conf`` file, which is found in the :term:`Build Directory`.
2235::
2236
2237 INHERIT += "rm_work"
2238
2239If you are
2240modifying and building source code out of the work directory for a
2241recipe, enabling ``rm_work`` will potentially result in your changes to
2242the source being lost. To exclude some recipes from having their work
2243directories deleted by ``rm_work``, you can add the names of the recipe
Andrew Geissler09036742021-06-25 14:25:14 -05002244or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable, which
Andrew Geisslerc926e172021-05-07 16:11:35 -05002245can also be set in your ``local.conf`` file. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002246
2247 RM_WORK_EXCLUDE += "busybox glibc"
2248
2249.. _ref-classes-rootfs*:
2250
2251``rootfs*.bbclass``
2252===================
2253
2254The ``rootfs*`` classes support creating the root filesystem for an
2255image and consist of the following classes:
2256
2257- The ``rootfs-postcommands`` class, which defines filesystem
2258 post-processing functions for image recipes.
2259
2260- The ``rootfs_deb`` class, which supports creation of root filesystems
2261 for images built using ``.deb`` packages.
2262
2263- The ``rootfs_rpm`` class, which supports creation of root filesystems
2264 for images built using ``.rpm`` packages.
2265
2266- The ``rootfs_ipk`` class, which supports creation of root filesystems
2267 for images built using ``.ipk`` packages.
2268
2269- The ``rootfsdebugfiles`` class, which installs additional files found
2270 on the build host directly into the root filesystem.
2271
2272The root filesystem is created from packages using one of the
2273``rootfs*.bbclass`` files as determined by the
2274:term:`PACKAGE_CLASSES` variable.
2275
2276For information on how root filesystem images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002277":ref:`overview-manual/concepts:image generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002278section in the Yocto Project Overview and Concepts Manual.
2279
2280.. _ref-classes-sanity:
2281
2282``sanity.bbclass``
2283==================
2284
2285The ``sanity`` class checks to see if prerequisite software is present
2286on the host system so that users can be notified of potential problems
2287that might affect their build. The class also performs basic user
2288configuration checks from the ``local.conf`` configuration file to
2289prevent common mistakes that cause build failures. Distribution policy
2290usually determines whether to include this class.
2291
2292.. _ref-classes-scons:
2293
2294``scons.bbclass``
2295=================
2296
2297The ``scons`` class supports recipes that need to build software that
2298uses the SCons build system. You can use the
2299:term:`EXTRA_OESCONS` variable to specify
2300additional configuration options you want to pass SCons command line.
2301
2302.. _ref-classes-sdl:
2303
2304``sdl.bbclass``
2305===============
2306
2307The ``sdl`` class supports recipes that need to build software that uses
2308the Simple DirectMedia Layer (SDL) library.
2309
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002310.. _ref-classes-setuptools3:
2311
2312``setuptools3.bbclass``
2313=======================
2314
2315The ``setuptools3`` class supports Python version 3.x extensions that
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002316use build systems based on ``setuptools``. If your recipe uses these
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002317build systems, the recipe needs to inherit the ``setuptools3`` class.
2318
2319.. _ref-classes-sign_rpm:
2320
2321``sign_rpm.bbclass``
2322====================
2323
2324The ``sign_rpm`` class supports generating signed RPM packages.
2325
2326.. _ref-classes-sip:
2327
2328``sip.bbclass``
2329===============
2330
2331The ``sip`` class supports recipes that build or package SIP-based
2332Python bindings.
2333
2334.. _ref-classes-siteconfig:
2335
2336``siteconfig.bbclass``
2337======================
2338
2339The ``siteconfig`` class provides functionality for handling site
2340configuration. The class is used by the
2341:ref:`autotools <ref-classes-autotools>` class to accelerate the
2342:ref:`ref-tasks-configure` task.
2343
2344.. _ref-classes-siteinfo:
2345
2346``siteinfo.bbclass``
2347====================
2348
2349The ``siteinfo`` class provides information about the targets that might
2350be needed by other classes or recipes.
2351
2352As an example, consider Autotools, which can require tests that must
2353execute on the target hardware. Since this is not possible in general
2354when cross compiling, site information is used to provide cached test
2355results so these tests can be skipped over but still make the correct
2356values available. The ``meta/site directory`` contains test results
2357sorted into different categories such as architecture, endianness, and
2358the ``libc`` used. Site information provides a list of files containing
Andrew Geissler09036742021-06-25 14:25:14 -05002359data relevant to the current build in the :term:`CONFIG_SITE` variable that
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002360Autotools automatically picks up.
2361
Andrew Geissler09036742021-06-25 14:25:14 -05002362The class also provides variables like :term:`SITEINFO_ENDIANNESS` and
2363:term:`SITEINFO_BITS` that can be used elsewhere in the metadata.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002364
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002365.. _ref-classes-sstate:
2366
2367``sstate.bbclass``
2368==================
2369
2370The ``sstate`` class provides support for Shared State (sstate). By
2371default, the class is enabled through the
2372:term:`INHERIT_DISTRO` variable's default value.
2373
2374For more information on sstate, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002375":ref:`overview-manual/concepts:shared state cache`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002376section in the Yocto Project Overview and Concepts Manual.
2377
2378.. _ref-classes-staging:
2379
2380``staging.bbclass``
2381===================
2382
2383The ``staging`` class installs files into individual recipe work
2384directories for sysroots. The class contains the following key tasks:
2385
2386- The :ref:`ref-tasks-populate_sysroot` task,
2387 which is responsible for handing the files that end up in the recipe
2388 sysroots.
2389
2390- The
2391 :ref:`ref-tasks-prepare_recipe_sysroot`
2392 task (a "partner" task to the ``populate_sysroot`` task), which
2393 installs the files into the individual recipe work directories (i.e.
2394 :term:`WORKDIR`).
2395
2396The code in the ``staging`` class is complex and basically works in two
2397stages:
2398
2399- *Stage One:* The first stage addresses recipes that have files they
2400 want to share with other recipes that have dependencies on the
2401 originating recipe. Normally these dependencies are installed through
2402 the :ref:`ref-tasks-install` task into
2403 ``${``\ :term:`D`\ ``}``. The ``do_populate_sysroot`` task
2404 copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
2405 subset of files is controlled by the
2406 :term:`SYSROOT_DIRS`,
2407 :term:`SYSROOT_DIRS_NATIVE`, and
2408 :term:`SYSROOT_DIRS_BLACKLIST`
2409 variables.
2410
2411 .. note::
2412
2413 Additionally, a recipe can customize the files further by
Andrew Geissler09036742021-06-25 14:25:14 -05002414 declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002415 variable.
2416
2417 A shared state (sstate) object is built from these files and the
2418 files are placed into a subdirectory of
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002419 :ref:`structure-build-tmp-sysroots-components`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002420 The files are scanned for hardcoded paths to the original
2421 installation location. If the location is found in text files, the
2422 hardcoded locations are replaced by tokens and a list of the files
2423 needing such replacements is created. These adjustments are referred
2424 to as "FIXMEs". The list of files that are scanned for paths is
2425 controlled by the :term:`SSTATE_SCAN_FILES`
2426 variable.
2427
2428- *Stage Two:* The second stage addresses recipes that want to use
2429 something from another recipe and declare a dependency on that recipe
2430 through the :term:`DEPENDS` variable. The recipe will
2431 have a
2432 :ref:`ref-tasks-prepare_recipe_sysroot`
2433 task and when this task executes, it creates the ``recipe-sysroot``
2434 and ``recipe-sysroot-native`` in the recipe work directory (i.e.
2435 :term:`WORKDIR`). The OpenEmbedded build system
2436 creates hard links to copies of the relevant files from
2437 ``sysroots-components`` into the recipe work directory.
2438
2439 .. note::
2440
2441 If hard links are not possible, the build system uses actual
2442 copies.
2443
2444 The build system then addresses any "FIXMEs" to paths as defined from
2445 the list created in the first stage.
2446
2447 Finally, any files in ``${bindir}`` within the sysroot that have the
2448 prefix "``postinst-``" are executed.
2449
2450 .. note::
2451
2452 Although such sysroot post installation scripts are not
2453 recommended for general use, the files do allow some issues such
2454 as user creation and module indexes to be addressed.
2455
Andrew Geissler09036742021-06-25 14:25:14 -05002456 Because recipes can have other dependencies outside of :term:`DEPENDS`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002457 (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
2458 the sysroot creation function ``extend_recipe_sysroot`` is also added
2459 as a pre-function for those tasks whose dependencies are not through
Andrew Geissler09036742021-06-25 14:25:14 -05002460 :term:`DEPENDS` but operate similarly.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002461
2462 When installing dependencies into the sysroot, the code traverses the
2463 dependency graph and processes dependencies in exactly the same way
2464 as the dependencies would or would not be when installed from sstate.
2465 This processing means, for example, a native tool would have its
2466 native dependencies added but a target library would not have its
2467 dependencies traversed or installed. The same sstate dependency code
2468 is used so that builds should be identical regardless of whether
2469 sstate was used or not. For a closer look, see the
2470 ``setscene_depvalid()`` function in the
2471 :ref:`sstate <ref-classes-sstate>` class.
2472
2473 The build system is careful to maintain manifests of the files it
2474 installs so that any given dependency can be installed as needed. The
2475 sstate hash of the installed item is also stored so that if it
2476 changes, the build system can reinstall it.
2477
2478.. _ref-classes-syslinux:
2479
2480``syslinux.bbclass``
2481====================
2482
2483The ``syslinux`` class provides syslinux-specific functions for building
2484bootable images.
2485
2486The class supports the following variables:
2487
2488- :term:`INITRD`: Indicates list of filesystem images to
2489 concatenate and use as an initial RAM disk (initrd). This variable is
2490 optional.
2491
2492- :term:`ROOTFS`: Indicates a filesystem image to include
2493 as the root filesystem. This variable is optional.
2494
2495- :term:`AUTO_SYSLINUXMENU`: Enables creating
2496 an automatic menu when set to "1".
2497
2498- :term:`LABELS`: Lists targets for automatic
2499 configuration.
2500
2501- :term:`APPEND`: Lists append string overrides for each
2502 label.
2503
2504- :term:`SYSLINUX_OPTS`: Lists additional options
2505 to add to the syslinux file. Semicolon characters separate multiple
2506 options.
2507
2508- :term:`SYSLINUX_SPLASH`: Lists a background
2509 for the VGA boot menu when you are using the boot menu.
2510
2511- :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
2512 to "console=ttyX" to change kernel boot default console.
2513
2514- :term:`SYSLINUX_SERIAL`: Sets an alternate
2515 serial port. Or, turns off serial when the variable is set with an
2516 empty string.
2517
2518- :term:`SYSLINUX_SERIAL_TTY`: Sets an
2519 alternate "console=tty..." kernel boot argument.
2520
2521.. _ref-classes-systemd:
2522
2523``systemd.bbclass``
2524===================
2525
2526The ``systemd`` class provides support for recipes that install systemd
2527unit files.
2528
2529The functionality for this class is disabled unless you have "systemd"
2530in :term:`DISTRO_FEATURES`.
2531
2532Under this class, the recipe or Makefile (i.e. whatever the recipe is
2533calling during the :ref:`ref-tasks-install` task)
2534installs unit files into
2535``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
2536files being installed go into packages other than the main package, you
2537need to set :term:`SYSTEMD_PACKAGES` in your
2538recipe to identify the packages in which the files will be installed.
2539
2540You should set :term:`SYSTEMD_SERVICE` to the
2541name of the service file. You should also use a package name override to
2542indicate the package to which the value applies. If the value applies to
2543the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
Andrew Geisslerc926e172021-05-07 16:11:35 -05002544is an example from the connman recipe::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002545
Patrick Williams0ca19cc2021-08-16 14:03:13 -05002546 SYSTEMD_SERVICE:${PN} = "connman.service"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002547
2548Services are set up to start on boot automatically
2549unless you have set
2550:term:`SYSTEMD_AUTO_ENABLE` to "disable".
2551
2552For more information on ``systemd``, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002553":ref:`dev-manual/common-tasks:selecting an initialization manager`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002554section in the Yocto Project Development Tasks Manual.
2555
2556.. _ref-classes-systemd-boot:
2557
2558``systemd-boot.bbclass``
2559========================
2560
2561The ``systemd-boot`` class provides functions specific to the
2562systemd-boot bootloader for building bootable images. This is an
2563internal class and is not intended to be used directly.
2564
2565.. note::
2566
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002567 The ``systemd-boot`` class is a result from merging the ``gummiboot`` class
2568 used in previous Yocto Project releases with the ``systemd`` project.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002569
2570Set the :term:`EFI_PROVIDER` variable to
2571"systemd-boot" to use this class. Doing so creates a standalone EFI
2572bootloader that is not dependent on systemd.
2573
2574For information on more variables used and supported in this class, see
2575the :term:`SYSTEMD_BOOT_CFG`,
2576:term:`SYSTEMD_BOOT_ENTRIES`, and
2577:term:`SYSTEMD_BOOT_TIMEOUT` variables.
2578
2579You can also see the `Systemd-boot
Andrew Geisslerd1e89492021-02-12 15:35:20 -06002580documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002581for more information.
2582
2583.. _ref-classes-terminal:
2584
2585``terminal.bbclass``
2586====================
2587
2588The ``terminal`` class provides support for starting a terminal session.
2589The :term:`OE_TERMINAL` variable controls which
2590terminal emulator is used for the session.
2591
2592Other classes use the ``terminal`` class anywhere a separate terminal
2593session needs to be started. For example, the
2594:ref:`patch <ref-classes-patch>` class assuming
2595:term:`PATCHRESOLVE` is set to "user", the
2596:ref:`cml1 <ref-classes-cml1>` class, and the
2597:ref:`devshell <ref-classes-devshell>` class all use the ``terminal``
2598class.
2599
2600.. _ref-classes-testimage*:
2601
2602``testimage*.bbclass``
2603======================
2604
2605The ``testimage*`` classes support running automated tests against
2606images using QEMU and on actual hardware. The classes handle loading the
2607tests and starting the image. To use the classes, you need to perform
2608steps to set up the environment.
2609
2610.. note::
2611
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002612 Best practices include using :term:`IMAGE_CLASSES` rather than
2613 :term:`INHERIT` to inherit the ``testimage`` class for automated image
2614 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002615
2616The tests are commands that run on the target system over ``ssh``. Each
2617test is written in Python and makes use of the ``unittest`` module.
2618
2619The ``testimage.bbclass`` runs tests on an image when called using the
Andrew Geisslerc926e172021-05-07 16:11:35 -05002620following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002621
2622 $ bitbake -c testimage image
2623
2624The ``testimage-auto`` class
2625runs tests on an image after the image is constructed (i.e.
2626:term:`TESTIMAGE_AUTO` must be set to "1").
2627
2628For information on how to enable, run, and create new tests, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002629":ref:`dev-manual/common-tasks:performing automated runtime testing`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002630section in the Yocto Project Development Tasks Manual.
2631
2632.. _ref-classes-testsdk:
2633
2634``testsdk.bbclass``
2635===================
2636
2637This class supports running automated tests against software development
2638kits (SDKs). The ``testsdk`` class runs tests on an SDK when called
Andrew Geisslerc926e172021-05-07 16:11:35 -05002639using the following::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002640
2641 $ bitbake -c testsdk image
2642
2643.. note::
2644
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002645 Best practices include using :term:`IMAGE_CLASSES` rather than
2646 :term:`INHERIT` to inherit the ``testsdk`` class for automated SDK
2647 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002648
2649.. _ref-classes-texinfo:
2650
2651``texinfo.bbclass``
2652===================
2653
2654This class should be inherited by recipes whose upstream packages invoke
2655the ``texinfo`` utilities at build-time. Native and cross recipes are
2656made to use the dummy scripts provided by ``texinfo-dummy-native``, for
2657improved performance. Target architecture recipes use the genuine
2658Texinfo utilities. By default, they use the Texinfo utilities on the
2659host system.
2660
2661.. note::
2662
2663 If you want to use the Texinfo recipe shipped with the build system,
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002664 you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
2665 from :term:`SANITY_REQUIRED_UTILITIES`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002666
2667.. _ref-classes-toaster:
2668
2669``toaster.bbclass``
2670===================
2671
2672The ``toaster`` class collects information about packages and images and
2673sends them as events that the BitBake user interface can receive. The
2674class is enabled when the Toaster user interface is running.
2675
2676This class is not intended to be used directly.
2677
2678.. _ref-classes-toolchain-scripts:
2679
2680``toolchain-scripts.bbclass``
2681=============================
2682
2683The ``toolchain-scripts`` class provides the scripts used for setting up
2684the environment for installed SDKs.
2685
2686.. _ref-classes-typecheck:
2687
2688``typecheck.bbclass``
2689=====================
2690
2691The ``typecheck`` class provides support for validating the values of
2692variables set at the configuration level against their defined types.
2693The OpenEmbedded build system allows you to define the type of a
Andrew Geisslerc926e172021-05-07 16:11:35 -05002694variable using the "type" varflag. Here is an example::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002695
2696 IMAGE_FEATURES[type] = "list"
2697
2698.. _ref-classes-uboot-config:
2699
2700``uboot-config.bbclass``
2701========================
2702
2703The ``uboot-config`` class provides support for U-Boot configuration for
Andrew Geisslerc926e172021-05-07 16:11:35 -05002704a machine. Specify the machine in your recipe as follows::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002705
2706 UBOOT_CONFIG ??= <default>
2707 UBOOT_CONFIG[foo] = "config,images"
2708
Andrew Geisslerc926e172021-05-07 16:11:35 -05002709You can also specify the machine using this method::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002710
2711 UBOOT_MACHINE = "config"
2712
2713See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
2714information.
2715
2716.. _ref-classes-uninative:
2717
2718``uninative.bbclass``
2719=====================
2720
2721Attempts to isolate the build system from the host distribution's C
2722library in order to make re-use of native shared state artifacts across
2723different host distributions practical. With this class enabled, a
2724tarball containing a pre-built C library is downloaded at the start of
2725the build. In the Poky reference distribution this is enabled by default
2726through ``meta/conf/distro/include/yocto-uninative.inc``. Other
2727distributions that do not derive from poky can also
2728"``require conf/distro/include/yocto-uninative.inc``" to use this.
2729Alternatively if you prefer, you can build the uninative-tarball recipe
2730yourself, publish the resulting tarball (e.g. via HTTP) and set
2731``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
2732example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
2733
2734The ``uninative`` class is also used unconditionally by the extensible
2735SDK. When building the extensible SDK, ``uninative-tarball`` is built
2736and the resulting tarball is included within the SDK.
2737
2738.. _ref-classes-update-alternatives:
2739
2740``update-alternatives.bbclass``
2741===============================
2742
2743The ``update-alternatives`` class helps the alternatives system when
2744multiple sources provide the same command. This situation occurs when
2745several programs that have the same or similar function are installed
2746with the same name. For example, the ``ar`` command is available from
2747the ``busybox``, ``binutils`` and ``elfutils`` packages. The
2748``update-alternatives`` class handles renaming the binaries so that
2749multiple packages can be installed without conflicts. The ``ar`` command
2750still works regardless of which packages are installed or subsequently
2751removed. The class renames the conflicting binary in each package and
2752symlinks the highest priority binary during installation or removal of
2753packages.
2754
2755To use this class, you need to define a number of variables:
2756
2757- :term:`ALTERNATIVE`
2758
2759- :term:`ALTERNATIVE_LINK_NAME`
2760
2761- :term:`ALTERNATIVE_TARGET`
2762
2763- :term:`ALTERNATIVE_PRIORITY`
2764
2765These variables list alternative commands needed by a package, provide
2766pathnames for links, default links for targets, and so forth. For
2767details on how to use this class, see the comments in the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002768:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes/update-alternatives.bbclass>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002769file.
2770
2771.. note::
2772
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002773 You can use the ``update-alternatives`` command directly in your recipes.
2774 However, this class simplifies things in most cases.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002775
2776.. _ref-classes-update-rc.d:
2777
2778``update-rc.d.bbclass``
2779=======================
2780
2781The ``update-rc.d`` class uses ``update-rc.d`` to safely install an
2782initialization script on behalf of the package. The OpenEmbedded build
2783system takes care of details such as making sure the script is stopped
2784before a package is removed and started when the package is installed.
2785
Andrew Geissler09036742021-06-25 14:25:14 -05002786Three variables control this class: :term:`INITSCRIPT_PACKAGES`,
2787:term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002788for details.
2789
2790.. _ref-classes-useradd:
2791
2792``useradd*.bbclass``
2793====================
2794
2795The ``useradd*`` classes support the addition of users or groups for
2796usage by the package on the target. For example, if you have packages
2797that contain system services that should be run under their own user or
2798group, you can use these classes to enable creation of the user or
2799group. The ``meta-skeleton/recipes-skeleton/useradd/useradd-example.bb``
2800recipe in the :term:`Source Directory` provides a simple
2801example that shows how to add three users and groups to two packages.
2802See the ``useradd-example.bb`` recipe for more information on how to use
2803these classes.
2804
2805The ``useradd_base`` class provides basic functionality for user or
2806groups settings.
2807
2808The ``useradd*`` classes support the
2809:term:`USERADD_PACKAGES`,
2810:term:`USERADD_PARAM`,
2811:term:`GROUPADD_PARAM`, and
2812:term:`GROUPMEMS_PARAM` variables.
2813
2814The ``useradd-staticids`` class supports the addition of users or groups
2815that have static user identification (``uid``) and group identification
2816(``gid``) values.
2817
2818The default behavior of the OpenEmbedded build system for assigning
2819``uid`` and ``gid`` values when packages add users and groups during
2820package install time is to add them dynamically. This works fine for
2821programs that do not care what the values of the resulting users and
2822groups become. In these cases, the order of the installation determines
2823the final ``uid`` and ``gid`` values. However, if non-deterministic
2824``uid`` and ``gid`` values are a problem, you can override the default,
2825dynamic application of these values by setting static values. When you
2826set static values, the OpenEmbedded build system looks in
2827:term:`BBPATH` for ``files/passwd`` and ``files/group``
2828files for the values.
2829
2830To use static ``uid`` and ``gid`` values, you need to set some
2831variables. See the :term:`USERADDEXTENSION`,
2832:term:`USERADD_UID_TABLES`,
2833:term:`USERADD_GID_TABLES`, and
2834:term:`USERADD_ERROR_DYNAMIC` variables.
2835You can also see the :ref:`useradd <ref-classes-useradd>` class for
2836additional information.
2837
2838.. note::
2839
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002840 You do not use the ``useradd-staticids`` class directly. You either enable
Andrew Geissler09036742021-06-25 14:25:14 -05002841 or disable the class by setting the :term:`USERADDEXTENSION` variable. If you
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002842 enable or disable the class in a configured system, :term:`TMPDIR` might
Andrew Geissler09036742021-06-25 14:25:14 -05002843 contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002844 directory will correct this condition.
2845
2846.. _ref-classes-utility-tasks:
2847
2848``utility-tasks.bbclass``
2849=========================
2850
2851The ``utility-tasks`` class provides support for various "utility" type
2852tasks that are applicable to all recipes, such as
2853:ref:`ref-tasks-clean` and
2854:ref:`ref-tasks-listtasks`.
2855
2856This class is enabled by default because it is inherited by the
2857:ref:`base <ref-classes-base>` class.
2858
2859.. _ref-classes-utils:
2860
2861``utils.bbclass``
2862=================
2863
2864The ``utils`` class provides some useful Python functions that are
2865typically used in inline Python expressions (e.g. ``${@...}``). One
2866example use is for ``bb.utils.contains()``.
2867
2868This class is enabled by default because it is inherited by the
2869:ref:`base <ref-classes-base>` class.
2870
2871.. _ref-classes-vala:
2872
2873``vala.bbclass``
2874================
2875
2876The ``vala`` class supports recipes that need to build software written
2877using the Vala programming language.
2878
2879.. _ref-classes-waf:
2880
2881``waf.bbclass``
2882===============
2883
2884The ``waf`` class supports recipes that need to build software that uses
2885the Waf build system. You can use the
2886:term:`EXTRA_OECONF` or
2887:term:`PACKAGECONFIG_CONFARGS` variables
2888to specify additional configuration options to be passed on the Waf
2889command line.