blob: 52a50faf67cd823bffa96852545507b892e19539 [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
53 different ``MACHINE`` is built even when the recipe never changes.
54
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
113 additional parameters to ``configure`` through the ``EXTRA_OECONF``
114 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
119 additional arguments through the ``EXTRA_OEMAKE`` variable.
120
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
171 ``S``:
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500172 ::
173
174 SRC_URI = "git://example.com/downloads/somepackage.rpm;subpath=${BP}"
175
176
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500177 See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for
178 more information on supported BitBake Fetchers.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500179
180.. _ref-classes-binconfig:
181
182``binconfig.bbclass``
183=====================
184
185The ``binconfig`` class helps to correct paths in shell scripts.
186
187Before ``pkg-config`` had become widespread, libraries shipped shell
188scripts to give information about the libraries and include paths needed
189to build software (usually named ``LIBNAME-config``). This class assists
190any recipe using such scripts.
191
192During staging, the OpenEmbedded build system installs such scripts into
193the ``sysroots/`` directory. Inheriting this class results in all paths
194in these scripts being changed to point into the ``sysroots/`` directory
195so that all builds that use the script use the correct directories for
196the cross compiling layout. See the
197:term:`BINCONFIG_GLOB` variable for more
198information.
199
200.. _ref-classes-binconfig-disabled:
201
202``binconfig-disabled.bbclass``
203==============================
204
205An alternative version of the :ref:`binconfig <ref-classes-binconfig>`
206class, which disables binary configuration scripts by making them return
207an error in favor of using ``pkg-config`` to query the information. The
208scripts to be disabled should be specified using the
209:term:`BINCONFIG` variable within the recipe inheriting
210the class.
211
212.. _ref-classes-blacklist:
213
214``blacklist.bbclass``
215=====================
216
217The ``blacklist`` class prevents the OpenEmbedded build system from
218building specific recipes (blacklists them). To use this class, inherit
219the class globally and set :term:`PNBLACKLIST` for
220each recipe you wish to blacklist. Specify the :term:`PN`
221value as a variable flag (varflag) and provide a reason, which is
222reported, if the package is requested to be built as the value. For
223example, if you want to blacklist a recipe called "exoticware", you add
224the following to your ``local.conf`` or distribution configuration:
225::
226
227 INHERIT += "blacklist"
228 PNBLACKLIST[exoticware] = "Not supported by our organization."
229
230.. _ref-classes-buildhistory:
231
232``buildhistory.bbclass``
233========================
234
235The ``buildhistory`` class records a history of build output metadata,
236which can be used to detect possible regressions as well as used for
237analysis of the build output. For more information on using Build
238History, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600239":ref:`dev-manual/common-tasks:maintaining build output quality`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500240section in the Yocto Project Development Tasks Manual.
241
242.. _ref-classes-buildstats:
243
244``buildstats.bbclass``
245======================
246
247The ``buildstats`` class records performance statistics about each task
248executed during the build (e.g. elapsed time, CPU usage, and I/O usage).
249
250When you use this class, the output goes into the
251:term:`BUILDSTATS_BASE` directory, which defaults
252to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using
253``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading
254chart of the entire build process and can be useful for highlighting
255bottlenecks.
256
257Collecting build statistics is enabled by default through the
258:term:`USER_CLASSES` variable from your
259``local.conf`` file. Consequently, you do not have to do anything to
260enable the class. However, if you want to disable the class, simply
261remove "buildstats" from the ``USER_CLASSES`` list.
262
263.. _ref-classes-buildstats-summary:
264
265``buildstats-summary.bbclass``
266==============================
267
268When inherited globally, prints statistics at the end of the build on
269sstate re-use. In order to function, this class requires the
270:ref:`buildstats <ref-classes-buildstats>` class be enabled.
271
272.. _ref-classes-ccache:
273
274``ccache.bbclass``
275==================
276
277The ``ccache`` class enables the C/C++ Compiler Cache for the build.
278This class is used to give a minor performance boost during the build.
279However, using the class can lead to unexpected side-effects. Thus, it
280is recommended that you do not use this class. See
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600281https://ccache.samba.org/ for information on the C/C++ Compiler
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500282Cache.
283
284.. _ref-classes-chrpath:
285
286``chrpath.bbclass``
287===================
288
289The ``chrpath`` class is a wrapper around the "chrpath" utility, which
290is used during the build process for ``nativesdk``, ``cross``, and
291``cross-canadian`` recipes to change ``RPATH`` records within binaries
292in order to make them relocatable.
293
294.. _ref-classes-clutter:
295
296``clutter.bbclass``
297===================
298
299The ``clutter`` class consolidates the major and minor version naming
300and other common items used by Clutter and related recipes.
301
302.. note::
303
304 Unlike some other classes related to specific libraries, recipes
305 building other software that uses Clutter do not need to inherit this
306 class unless they use the same recipe versioning scheme that the
307 Clutter and related recipes do.
308
309.. _ref-classes-cmake:
310
311``cmake.bbclass``
312=================
313
314The ``cmake`` class allows for recipes that need to build software using
315the `CMake <https://cmake.org/overview/>`__ build system. You can use
316the :term:`EXTRA_OECMAKE` variable to specify
317additional configuration options to be passed using the ``cmake``
318command line.
319
320On the occasion that you would be installing custom CMake toolchain
321files supplied by the application being built, you should install them
322to the preferred CMake Module directory: ``${D}${datadir}/cmake/``
323Modules during
324:ref:`ref-tasks-install`.
325
326.. _ref-classes-cml1:
327
328``cml1.bbclass``
329================
330
331The ``cml1`` class provides basic support for the Linux kernel style
332build configuration system.
333
334.. _ref-classes-compress_doc:
335
336``compress_doc.bbclass``
337========================
338
339Enables compression for man pages and info pages. This class is intended
340to be inherited globally. The default compression mechanism is gz (gzip)
341but you can select an alternative mechanism by setting the
342:term:`DOC_COMPRESS` variable.
343
344.. _ref-classes-copyleft_compliance:
345
346``copyleft_compliance.bbclass``
347===============================
348
349The ``copyleft_compliance`` class preserves source code for the purposes
350of license compliance. This class is an alternative to the ``archiver``
351class and is still used by some users even though it has been deprecated
352in favor of the :ref:`archiver <ref-classes-archiver>` class.
353
354.. _ref-classes-copyleft_filter:
355
356``copyleft_filter.bbclass``
357===========================
358
359A class used by the :ref:`archiver <ref-classes-archiver>` and
360:ref:`copyleft_compliance <ref-classes-copyleft_compliance>` classes
361for filtering licenses. The ``copyleft_filter`` class is an internal
362class and is not intended to be used directly.
363
364.. _ref-classes-core-image:
365
366``core-image.bbclass``
367======================
368
369The ``core-image`` class provides common definitions for the
370``core-image-*`` image recipes, such as support for additional
371:term:`IMAGE_FEATURES`.
372
373.. _ref-classes-cpan:
374
375``cpan*.bbclass``
376=================
377
378The ``cpan*`` classes support Perl modules.
379
380Recipes for Perl modules are simple. These recipes usually only need to
381point to the source's archive and then inherit the proper class file.
382Building is split into two methods depending on which method the module
383authors used.
384
385- Modules that use old ``Makefile.PL``-based build system require
386 ``cpan.bbclass`` in their recipes.
387
388- Modules that use ``Build.PL``-based build system require using
389 ``cpan_build.bbclass`` in their recipes.
390
391Both build methods inherit the ``cpan-base`` class for basic Perl
392support.
393
394.. _ref-classes-cross:
395
396``cross.bbclass``
397=================
398
399The ``cross`` class provides support for the recipes that build the
400cross-compilation tools.
401
402.. _ref-classes-cross-canadian:
403
404``cross-canadian.bbclass``
405==========================
406
407The ``cross-canadian`` class provides support for the recipes that build
408the Canadian Cross-compilation tools for SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600409":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500410section in the Yocto Project Overview and Concepts Manual for more
411discussion on these cross-compilation tools.
412
413.. _ref-classes-crosssdk:
414
415``crosssdk.bbclass``
416====================
417
418The ``crosssdk`` class provides support for the recipes that build the
419cross-compilation tools used for building SDKs. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600420":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500421section in the Yocto Project Overview and Concepts Manual for more
422discussion on these cross-compilation tools.
423
424.. _ref-classes-debian:
425
426``debian.bbclass``
427==================
428
429The ``debian`` class renames output packages so that they follow the
430Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and
431``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library
432name and version as part of the package name.
433
434If a recipe creates packages for multiple libraries (shared object files
435of ``.so`` type), use the :term:`LEAD_SONAME`
436variable in the recipe to specify the library on which to apply the
437naming scheme.
438
439.. _ref-classes-deploy:
440
441``deploy.bbclass``
442==================
443
444The ``deploy`` class handles deploying files to the
445:term:`DEPLOY_DIR_IMAGE` directory. The main
446function of this class is to allow the deploy step to be accelerated by
447shared state. Recipes that inherit this class should define their own
448:ref:`ref-tasks-deploy` function to copy the files to be
449deployed to :term:`DEPLOYDIR`, and use ``addtask`` to
450add the task at the appropriate place, which is usually after
451:ref:`ref-tasks-compile` or
452:ref:`ref-tasks-install`. The class then takes care of
453staging the files from ``DEPLOYDIR`` to ``DEPLOY_DIR_IMAGE``.
454
455.. _ref-classes-devshell:
456
457``devshell.bbclass``
458====================
459
460The ``devshell`` class adds the ``do_devshell`` task. Distribution
Andrew Geissler09209ee2020-12-13 08:44:15 -0600461policy dictates whether to include this class. See the ":ref:`dev-manual/common-tasks:using a development shell`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500462section in the Yocto Project Development Tasks Manual for more
463information about using ``devshell``.
464
465.. _ref-classes-devupstream:
466
467``devupstream.bbclass``
468=======================
469
470The ``devupstream`` class uses
471:term:`BBCLASSEXTEND` to add a variant of the
472recipe that fetches from an alternative URI (e.g. Git) instead of a
473tarball. Following is an example:
474::
475
476 BBCLASSEXTEND = "devupstream:target"
477 SRC_URI_class-devupstream = "git://git.example.com/example"
478 SRCREV_class-devupstream = "abcd1234"
479
480Adding the above statements to your recipe creates a variant that has
481:term:`DEFAULT_PREFERENCE` set to "-1".
482Consequently, you need to select the variant of the recipe to use it.
483Any development-specific adjustments can be done by using the
484``class-devupstream`` override. Here is an example:
485::
486
487 DEPENDS_append_class-devupstream = " gperf-native"
488 do_configure_prepend_class-devupstream() {
489 touch ${S}/README
490 }
491
492The class
493currently only supports creating a development variant of the target
494recipe, not ``native`` or ``nativesdk`` variants.
495
496The ``BBCLASSEXTEND`` syntax (i.e. ``devupstream:target``) provides
497support for ``native`` and ``nativesdk`` variants. Consequently, this
498functionality can be added in a future release.
499
500Support for other version control systems such as Subversion is limited
501due to BitBake's automatic fetch dependencies (e.g.
502``subversion-native``).
503
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500504.. _ref-classes-distutils3:
505
506``distutils3*.bbclass``
507=======================
508
509The ``distutils3*`` classes support recipes for Python version 3.x
510extensions, which are simple. These recipes usually only need to point
511to the source's archive and then inherit the proper class. Building is
512split into three methods depending on which method the module authors
513used.
514
515- Extensions that use an Autotools-based build system require Autotools
516 and ``distutils``-based classes in their recipes.
517
518- Extensions that use ``distutils``-based build systems require the
519 ``distutils`` class in their recipes.
520
521- Extensions that use build systems based on ``setuptools3`` require
Andrew Geissler3b8a17c2021-04-15 15:55:55 -0500522 the :ref:`setuptools3 <ref-classes-setuptools3>` class in their
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500523 recipes.
524
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500525.. _ref-classes-externalsrc:
526
527``externalsrc.bbclass``
528=======================
529
530The ``externalsrc`` class supports building software from source code
531that is external to the OpenEmbedded build system. Building software
532from an external source tree means that the build system's normal fetch,
533unpack, and patch process is not used.
534
535By default, the OpenEmbedded build system uses the :term:`S`
536and :term:`B` variables to locate unpacked recipe source code
537and to build it, respectively. When your recipe inherits the
538``externalsrc`` class, you use the
539:term:`EXTERNALSRC` and
540:term:`EXTERNALSRC_BUILD` variables to
541ultimately define ``S`` and ``B``.
542
543By default, this class expects the source code to support recipe builds
544that use the :term:`B` variable to point to the directory in
545which the OpenEmbedded build system places the generated objects built
546from the recipes. By default, the ``B`` directory is set to the
547following, which is separate from the source directory (``S``):
548::
549
550 ${WORKDIR}/${BPN}/{PV}/
551
552See these variables for more information:
553:term:`WORKDIR`, :term:`BPN`, and
554:term:`PV`,
555
556For more information on the ``externalsrc`` class, see the comments in
557``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`.
558For information on how to use the
559``externalsrc`` class, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600560":ref:`dev-manual/common-tasks:building software from an external source`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500561section in the Yocto Project Development Tasks Manual.
562
563.. _ref-classes-extrausers:
564
565``extrausers.bbclass``
566======================
567
568The ``extrausers`` class allows additional user and group configuration
569to be applied at the image level. Inheriting this class either globally
570or from an image recipe allows additional user and group operations to
571be performed using the
572:term:`EXTRA_USERS_PARAMS` variable.
573
574.. note::
575
576 The user and group operations added using the
577 extrausers
578 class are not tied to a specific recipe outside of the recipe for the
579 image. Thus, the operations can be performed across the image as a
580 whole. Use the
581 useradd
582 class to add user and group configuration to a specific recipe.
583
584Here is an example that uses this class in an image recipe:
585::
586
587 inherit extrausers
588 EXTRA_USERS_PARAMS = "\
589 useradd -p '' tester; \
590 groupadd developers; \
591 userdel nobody; \
592 groupdel -g video; \
593 groupmod -g 1020 developers; \
594 usermod -s /bin/sh tester; \
595 "
596
597Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns
598passwords:
599::
600
601 inherit extrausers
602 EXTRA_USERS_PARAMS = "\
603 useradd -P tester01 tester-jim; \
604 useradd -P tester01 tester-sue; \
605 "
606
607Finally, here is an example that sets the root password to "1876*18":
608::
609
610 inherit extrausers
611 EXTRA_USERS_PARAMS = "\
612 usermod -P 1876*18 root; \
613 "
614
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600615.. _ref-classes-features_check:
616
617``features_check.bbclass``
618=================================
619
620The ``features_check`` class allows individual recipes to check
621for required and conflicting
622:term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES` or :term:`COMBINED_FEATURES`.
623
624This class provides support for the following variables:
625
626- :term:`REQUIRED_DISTRO_FEATURES`
627- :term:`CONFLICT_DISTRO_FEATURES`
628- :term:`ANY_OF_DISTRO_FEATURES`
629- ``REQUIRED_MACHINE_FEATURES``
630- ``CONFLICT_MACHINE_FEATURES``
631- ``ANY_OF_MACHINE_FEATURES``
632- ``REQUIRED_COMBINED_FEATURES``
633- ``CONFLICT_COMBINED_FEATURES``
634- ``ANY_OF_COMBINED_FEATURES``
635
636If any conditions specified in the recipe using the above
637variables are not met, the recipe will be skipped, and if the
638build system attempts to build the recipe then an error will be
639triggered.
640
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500641.. _ref-classes-fontcache:
642
643``fontcache.bbclass``
644=====================
645
646The ``fontcache`` class generates the proper post-install and
647post-remove (postinst and postrm) scriptlets for font packages. These
648scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts
649to the font information cache. Since the cache files are
650architecture-specific, ``fc-cache`` runs using QEMU if the postinst
651scriptlets need to be run on the build host during image creation.
652
653If the fonts being installed are in packages other than the main
654package, set :term:`FONT_PACKAGES` to specify the
655packages containing the fonts.
656
657.. _ref-classes-fs-uuid:
658
659``fs-uuid.bbclass``
660===================
661
662The ``fs-uuid`` class extracts UUID from
663``${``\ :term:`ROOTFS`\ ``}``, which must have been built
664by the time that this function gets called. The ``fs-uuid`` class only
665works on ``ext`` file systems and depends on ``tune2fs``.
666
667.. _ref-classes-gconf:
668
669``gconf.bbclass``
670=================
671
672The ``gconf`` class provides common functionality for recipes that need
673to install GConf schemas. The schemas will be put into a separate
674package (``${``\ :term:`PN`\ ``}-gconf``) that is created
675automatically when this class is inherited. This package uses the
676appropriate post-install and post-remove (postinst/postrm) scriptlets to
677register and unregister the schemas in the target image.
678
679.. _ref-classes-gettext:
680
681``gettext.bbclass``
682===================
683
684The ``gettext`` class provides support for building software that uses
685the GNU ``gettext`` internationalization and localization system. All
686recipes building software that use ``gettext`` should inherit this
687class.
688
689.. _ref-classes-gnomebase:
690
691``gnomebase.bbclass``
692=====================
693
694The ``gnomebase`` class is the base class for recipes that build
695software from the GNOME stack. This class sets
696:term:`SRC_URI` to download the source from the GNOME
697mirrors as well as extending :term:`FILES` with the typical
698GNOME installation paths.
699
700.. _ref-classes-gobject-introspection:
701
702``gobject-introspection.bbclass``
703=================================
704
705Provides support for recipes building software that supports GObject
706introspection. This functionality is only enabled if the
707"gobject-introspection-data" feature is in
708:term:`DISTRO_FEATURES` as well as
709"qemu-usermode" being in
710:term:`MACHINE_FEATURES`.
711
712.. note::
713
714 This functionality is backfilled by default and, if not applicable,
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500715 should be disabled through ``DISTRO_FEATURES_BACKFILL_CONSIDERED`` or
716 ``MACHINE_FEATURES_BACKFILL_CONSIDERED``, respectively.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500717
718.. _ref-classes-grub-efi:
719
720``grub-efi.bbclass``
721====================
722
723The ``grub-efi`` class provides ``grub-efi``-specific functions for
724building bootable images.
725
726This class supports several variables:
727
728- :term:`INITRD`: Indicates list of filesystem images to
729 concatenate and use as an initial RAM disk (initrd) (optional).
730
731- :term:`ROOTFS`: Indicates a filesystem image to include
732 as the root filesystem (optional).
733
734- :term:`GRUB_GFXSERIAL`: Set this to "1" to have
735 graphics and serial in the boot menu.
736
737- :term:`LABELS`: A list of targets for the automatic
738 configuration.
739
740- :term:`APPEND`: An override list of append strings for
741 each ``LABEL``.
742
743- :term:`GRUB_OPTS`: Additional options to add to the
744 configuration (optional). Options are delimited using semi-colon
745 characters (``;``).
746
747- :term:`GRUB_TIMEOUT`: Timeout before executing
748 the default ``LABEL`` (optional).
749
750.. _ref-classes-gsettings:
751
752``gsettings.bbclass``
753=====================
754
755The ``gsettings`` class provides common functionality for recipes that
756need to install GSettings (glib) schemas. The schemas are assumed to be
757part of the main package. Appropriate post-install and post-remove
758(postinst/postrm) scriptlets are added to register and unregister the
759schemas in the target image.
760
761.. _ref-classes-gtk-doc:
762
763``gtk-doc.bbclass``
764===================
765
766The ``gtk-doc`` class is a helper class to pull in the appropriate
767``gtk-doc`` dependencies and disable ``gtk-doc``.
768
769.. _ref-classes-gtk-icon-cache:
770
771``gtk-icon-cache.bbclass``
772==========================
773
774The ``gtk-icon-cache`` class generates the proper post-install and
775post-remove (postinst/postrm) scriptlets for packages that use GTK+ and
776install icons. These scriptlets call ``gtk-update-icon-cache`` to add
777the fonts to GTK+'s icon cache. Since the cache files are
778architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if
779the postinst scriptlets need to be run on the build host during image
780creation.
781
782.. _ref-classes-gtk-immodules-cache:
783
784``gtk-immodules-cache.bbclass``
785===============================
786
787The ``gtk-immodules-cache`` class generates the proper post-install and
788post-remove (postinst/postrm) scriptlets for packages that install GTK+
789input method modules for virtual keyboards. These scriptlets call
790``gtk-update-icon-cache`` to add the input method modules to the cache.
791Since the cache files are architecture-specific,
792``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets
793need to be run on the build host during image creation.
794
795If the input method modules being installed are in packages other than
796the main package, set
797:term:`GTKIMMODULES_PACKAGES` to specify
798the packages containing the modules.
799
800.. _ref-classes-gzipnative:
801
802``gzipnative.bbclass``
803======================
804
805The ``gzipnative`` class enables the use of different native versions of
806``gzip`` and ``pigz`` rather than the versions of these tools from the
807build host.
808
809.. _ref-classes-icecc:
810
811``icecc.bbclass``
812=================
813
814The ``icecc`` class supports
815`Icecream <https://github.com/icecc/icecream>`__, which facilitates
816taking compile jobs and distributing them among remote machines.
817
818The class stages directories with symlinks from ``gcc`` and ``g++`` to
819``icecc``, for both native and cross compilers. Depending on each
820configure or compile, the OpenEmbedded build system adds the directories
821at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and
822``ICEC_CC`` variables, which are the paths to the ``g++`` and ``gcc``
823compilers, respectively.
824
825For the cross compiler, the class creates a ``tar.gz`` file that
826contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which
827is the version of the cross-compiler used in the cross-development
828toolchain, accordingly.
829
830The class handles all three different compile stages (i.e native
831,cross-kernel and target) and creates the necessary environment
832``tar.gz`` file to be used by the remote machines. The class also
833supports SDK generation.
834
835If :term:`ICECC_PATH` is not set in your
836``local.conf`` file, then the class tries to locate the ``icecc`` binary
837using ``which``. If :term:`ICECC_ENV_EXEC` is set
838in your ``local.conf`` file, the variable should point to the
839``icecc-create-env`` script provided by the user. If you do not point to
840a user-provided script, the build system uses the default script
841provided by the recipe ``icecc-create-env-native.bb``.
842
843.. note::
844
845 This script is a modified version and not the one that comes with
846 icecc.
847
848If you do not want the Icecream distributed compile support to apply to
849specific recipes or classes, you can effectively "blacklist" them by
850listing the recipes and classes using the
851:term:`ICECC_USER_PACKAGE_BL` and
852:term:`ICECC_USER_CLASS_BL`, variables,
853respectively, in your ``local.conf`` file. Doing so causes the
854OpenEmbedded build system to handle these compilations locally.
855
856Additionally, you can list recipes using the
857:term:`ICECC_USER_PACKAGE_WL` variable in
858your ``local.conf`` file to force ``icecc`` to be enabled for recipes
859using an empty :term:`PARALLEL_MAKE` variable.
860
861Inheriting the ``icecc`` class changes all sstate signatures.
862Consequently, if a development team has a dedicated build system that
863populates :term:`SSTATE_MIRRORS` and they want to
864reuse sstate from ``SSTATE_MIRRORS``, then all developers and the build
865system need to either inherit the ``icecc`` class or nobody should.
866
867At the distribution level, you can inherit the ``icecc`` class to be
868sure that all builders start with the same sstate signatures. After
869inheriting the class, you can then disable the feature by setting the
870:term:`ICECC_DISABLED` variable to "1" as follows:
871::
872
873 INHERIT_DISTRO_append = " icecc"
874 ICECC_DISABLED ??= "1"
875
876This practice
877makes sure everyone is using the same signatures but also requires
878individuals that do want to use Icecream to enable the feature
879individually as follows in your ``local.conf`` file:
880::
881
882 ICECC_DISABLED = ""
883
884.. _ref-classes-image:
885
886``image.bbclass``
887=================
888
889The ``image`` class helps support creating images in different formats.
890First, the root filesystem is created from packages using one of the
891``rootfs*.bbclass`` files (depending on the package format used) and
892then one or more image files are created.
893
894- The ``IMAGE_FSTYPES`` variable controls the types of images to
895 generate.
896
897- The ``IMAGE_INSTALL`` variable controls the list of packages to
898 install into the image.
899
900For information on customizing images, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600901":ref:`dev-manual/common-tasks:customizing images`" section
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500902in the Yocto Project Development Tasks Manual. For information on how
903images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600904":ref:`overview-manual/concepts:images`" section in the
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600905Yocto Project Overview and Concepts Manual.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500906
907.. _ref-classes-image-buildinfo:
908
909``image-buildinfo.bbclass``
910===========================
911
912The ``image-buildinfo`` class writes information to the target
913filesystem on ``/etc/build``.
914
915.. _ref-classes-image_types:
916
917``image_types.bbclass``
918=======================
919
920The ``image_types`` class defines all of the standard image output types
921that you can enable through the
922:term:`IMAGE_FSTYPES` variable. You can use this
923class as a reference on how to add support for custom image output
924types.
925
926By default, the :ref:`image <ref-classes-image>` class automatically
927enables the ``image_types`` class. The ``image`` class uses the
928``IMGCLASSES`` variable as follows:
929::
930
931 IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}"
932 IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}"
933 IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}"
934 IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}"
935 IMGCLASSES += "image_types_wic"
936 IMGCLASSES += "rootfs-postcommands"
937 IMGCLASSES += "image-postinst-intercepts"
938 inherit ${IMGCLASSES}
939
940The ``image_types`` class also handles conversion and compression of images.
941
942.. note::
943
944 To build a VMware VMDK image, you need to add "wic.vmdk" to
Andrew Geissler4c19ea12020-10-27 13:52:24 -0500945 ``IMAGE_FSTYPES``. This would also be similar for Virtual Box Virtual Disk
946 Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500947
948.. _ref-classes-image-live:
949
950``image-live.bbclass``
951======================
952
953This class controls building "live" (i.e. HDDIMG and ISO) images. Live
954images contain syslinux for legacy booting, as well as the bootloader
955specified by :term:`EFI_PROVIDER` if
956:term:`MACHINE_FEATURES` contains "efi".
957
958Normally, you do not use this class directly. Instead, you add "live" to
959:term:`IMAGE_FSTYPES`.
960
961.. _ref-classes-image-mklibs:
962
963``image-mklibs.bbclass``
964========================
965
966The ``image-mklibs`` class enables the use of the ``mklibs`` utility
967during the :ref:`ref-tasks-rootfs` task, which optimizes
968the size of libraries contained in the image.
969
970By default, the class is enabled in the ``local.conf.template`` using
971the :term:`USER_CLASSES` variable as follows:
972::
973
974 USER_CLASSES ?= "buildstats image-mklibs image-prelink"
975
976.. _ref-classes-image-prelink:
977
978``image-prelink.bbclass``
979=========================
980
981The ``image-prelink`` class enables the use of the ``prelink`` utility
982during the :ref:`ref-tasks-rootfs` task, which optimizes
983the dynamic linking of shared libraries to reduce executable startup
984time.
985
986By default, the class is enabled in the ``local.conf.template`` using
987the :term:`USER_CLASSES` variable as follows:
988::
989
990 USER_CLASSES ?= "buildstats image-mklibs image-prelink"
991
992.. _ref-classes-insane:
993
994``insane.bbclass``
995==================
996
997The ``insane`` class adds a step to the package generation process so
998that output quality assurance checks are generated by the OpenEmbedded
999build system. A range of checks are performed that check the build's
1000output for common problems that show up during runtime. Distribution
1001policy usually dictates whether to include this class.
1002
1003You can configure the sanity checks so that specific test failures
1004either raise a warning or an error message. Typically, failures for new
1005tests generate a warning. Subsequent failures for the same test would
1006then generate an error message once the metadata is in a known and good
Andrew Geissler09209ee2020-12-13 08:44:15 -06001007condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001008and error messages you might encounter using a default configuration.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001009
1010Use the :term:`WARN_QA` and
1011:term:`ERROR_QA` variables to control the behavior of
1012these checks at the global level (i.e. in your custom distro
1013configuration). However, to skip one or more checks in recipes, you
1014should use :term:`INSANE_SKIP`. For example, to skip
1015the check for symbolic link ``.so`` files in the main package of a
1016recipe, add the following to the recipe. You need to realize that the
1017package name override, in this example ``${PN}``, must be used:
1018::
1019
1020 INSANE_SKIP_${PN} += "dev-so"
1021
1022Please keep in mind that the QA checks
1023exist in order to detect real or potential problems in the packaged
1024output. So exercise caution when disabling these checks.
1025
1026The following list shows the tests you can list with the ``WARN_QA`` and
1027``ERROR_QA`` variables:
1028
1029- ``already-stripped:`` Checks that produced binaries have not
1030 already been stripped prior to the build system extracting debug
1031 symbols. It is common for upstream software projects to default to
1032 stripping debug symbols for output binaries. In order for debugging
1033 to work on the target using ``-dbg`` packages, this stripping must be
1034 disabled.
1035
1036- ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit
1037 size, and endianness of any binaries to ensure they match the target
1038 architecture. This test fails if any binaries do not match the type
1039 since there would be an incompatibility. The test could indicate that
1040 the wrong compiler or compiler options have been used. Sometimes
1041 software, like bootloaders, might need to bypass this check.
1042
1043- ``buildpaths:`` Checks for paths to locations on the build host
1044 inside the output files. Currently, this test triggers too many false
1045 positives and thus is not normally enabled.
1046
1047- ``build-deps:`` Determines if a build-time dependency that is
1048 specified through :term:`DEPENDS`, explicit
1049 :term:`RDEPENDS`, or task-level dependencies exists
1050 to match any runtime dependency. This determination is particularly
1051 useful to discover where runtime dependencies are detected and added
1052 during packaging. If no explicit dependency has been specified within
1053 the metadata, at the packaging stage it is too late to ensure that
1054 the dependency is built, and thus you can end up with an error when
1055 the package is installed into the image during the
1056 :ref:`ref-tasks-rootfs` task because the auto-detected
1057 dependency was not satisfied. An example of this would be where the
1058 :ref:`update-rc.d <ref-classes-update-rc.d>` class automatically
1059 adds a dependency on the ``initscripts-functions`` package to
1060 packages that install an initscript that refers to
1061 ``/etc/init.d/functions``. The recipe should really have an explicit
1062 ``RDEPENDS`` for the package in question on ``initscripts-functions``
1063 so that the OpenEmbedded build system is able to ensure that the
1064 ``initscripts`` recipe is actually built and thus the
1065 ``initscripts-functions`` package is made available.
1066
1067- ``compile-host-path:`` Checks the
1068 :ref:`ref-tasks-compile` log for indications that
1069 paths to locations on the build host were used. Using such paths
1070 might result in host contamination of the build output.
1071
1072- ``debug-deps:`` Checks that all packages except ``-dbg`` packages
1073 do not depend on ``-dbg`` packages, which would cause a packaging
1074 bug.
1075
1076- ``debug-files:`` Checks for ``.debug`` directories in anything but
1077 the ``-dbg`` package. The debug files should all be in the ``-dbg``
1078 package. Thus, anything packaged elsewhere is incorrect packaging.
1079
1080- ``dep-cmp:`` Checks for invalid version comparison statements in
1081 runtime dependency relationships between packages (i.e. in
1082 :term:`RDEPENDS`,
1083 :term:`RRECOMMENDS`,
1084 :term:`RSUGGESTS`,
1085 :term:`RPROVIDES`,
1086 :term:`RREPLACES`, and
1087 :term:`RCONFLICTS` variable values). Any invalid
1088 comparisons might trigger failures or undesirable behavior when
1089 passed to the package manager.
1090
1091- ``desktop:`` Runs the ``desktop-file-validate`` program against any
1092 ``.desktop`` files to validate their contents against the
1093 specification for ``.desktop`` files.
1094
1095- ``dev-deps:`` Checks that all packages except ``-dev`` or
1096 ``-staticdev`` packages do not depend on ``-dev`` packages, which
1097 would be a packaging bug.
1098
1099- ``dev-so:`` Checks that the ``.so`` symbolic links are in the
1100 ``-dev`` package and not in any of the other packages. In general,
1101 these symlinks are only useful for development purposes. Thus, the
1102 ``-dev`` package is the correct location for them. Some very rare
1103 cases do exist for dynamically loaded modules where these symlinks
1104 are needed instead in the main package.
1105
1106- ``file-rdeps:`` Checks that file-level dependencies identified by
1107 the OpenEmbedded build system at packaging time are satisfied. For
1108 example, a shell script might start with the line ``#!/bin/bash``.
1109 This line would translate to a file dependency on ``/bin/bash``. Of
1110 the three package managers that the OpenEmbedded build system
1111 supports, only RPM directly handles file-level dependencies,
1112 resolving them automatically to packages providing the files.
1113 However, the lack of that functionality in the other two package
1114 managers does not mean the dependencies do not still need resolving.
1115 This QA check attempts to ensure that explicitly declared
1116 :term:`RDEPENDS` exist to handle any file-level
1117 dependency detected in packaged files.
1118
1119- ``files-invalid:`` Checks for :term:`FILES` variable
1120 values that contain "//", which is invalid.
1121
1122- ``host-user-contaminated:`` Checks that no package produced by the
1123 recipe contains any files outside of ``/home`` with a user or group
1124 ID that matches the user running BitBake. A match usually indicates
1125 that the files are being installed with an incorrect UID/GID, since
1126 target IDs are independent from host IDs. For additional information,
1127 see the section describing the
1128 :ref:`ref-tasks-install` task.
1129
1130- ``incompatible-license:`` Report when packages are excluded from
1131 being created due to being marked with a license that is in
1132 :term:`INCOMPATIBLE_LICENSE`.
1133
1134- ``install-host-path:`` Checks the
1135 :ref:`ref-tasks-install` log for indications that
1136 paths to locations on the build host were used. Using such paths
1137 might result in host contamination of the build output.
1138
1139- ``installed-vs-shipped:`` Reports when files have been installed
1140 within ``do_install`` but have not been included in any package by
1141 way of the :term:`FILES` variable. Files that do not
1142 appear in any package cannot be present in an image later on in the
1143 build process. Ideally, all installed files should be packaged or not
1144 installed at all. These files can be deleted at the end of
1145 ``do_install`` if the files are not needed in any package.
1146
1147- ``invalid-chars:`` Checks that the recipe metadata variables
1148 :term:`DESCRIPTION`,
1149 :term:`SUMMARY`, :term:`LICENSE`, and
1150 :term:`SECTION` do not contain non-UTF-8 characters.
1151 Some package managers do not support such characters.
1152
1153- ``invalid-packageconfig:`` Checks that no undefined features are
1154 being added to :term:`PACKAGECONFIG`. For
1155 example, any name "foo" for which the following form does not exist:
1156 ::
1157
1158 PACKAGECONFIG[foo] = "..."
1159
1160- ``la:`` Checks ``.la`` files for any ``TMPDIR`` paths. Any ``.la``
1161 file containing these paths is incorrect since ``libtool`` adds the
1162 correct sysroot prefix when using the files automatically itself.
1163
1164- ``ldflags:`` Ensures that the binaries were linked with the
1165 :term:`LDFLAGS` options provided by the build system.
1166 If this test fails, check that the ``LDFLAGS`` variable is being
1167 passed to the linker command.
1168
1169- ``libdir:`` Checks for libraries being installed into incorrect
1170 (possibly hardcoded) installation paths. For example, this test will
1171 catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is
1172 "lib32". Another example is when recipes install
1173 ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib".
1174
1175- ``libexec:`` Checks if a package contains files in
1176 ``/usr/libexec``. This check is not performed if the ``libexecdir``
1177 variable has been set explicitly to ``/usr/libexec``.
1178
1179- ``packages-list:`` Checks for the same package being listed
1180 multiple times through the :term:`PACKAGES` variable
1181 value. Installing the package in this manner can cause errors during
1182 packaging.
1183
1184- ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an
1185 invalid format.
1186
1187- ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an
1188 invalid format.
1189
1190- ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify
1191 'link' where the specified target already exists.
1192
1193- ``perms:`` Currently, this check is unused but reserved.
1194
1195- ``pkgconfig:`` Checks ``.pc`` files for any
1196 :term:`TMPDIR`/:term:`WORKDIR` paths.
1197 Any ``.pc`` file containing these paths is incorrect since
1198 ``pkg-config`` itself adds the correct sysroot prefix when the files
1199 are accessed.
1200
1201- ``pkgname:`` Checks that all packages in
1202 :term:`PACKAGES` have names that do not contain
1203 invalid characters (i.e. characters other than 0-9, a-z, ., +, and
1204 -).
1205
1206- ``pkgv-undefined:`` Checks to see if the ``PKGV`` variable is
1207 undefined during :ref:`ref-tasks-package`.
1208
1209- ``pkgvarcheck:`` Checks through the variables
1210 :term:`RDEPENDS`,
1211 :term:`RRECOMMENDS`,
1212 :term:`RSUGGESTS`,
1213 :term:`RCONFLICTS`,
1214 :term:`RPROVIDES`,
1215 :term:`RREPLACES`, :term:`FILES`,
1216 :term:`ALLOW_EMPTY`, ``pkg_preinst``,
1217 ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if
1218 there are variable sets that are not package-specific. Using these
1219 variables without a package suffix is bad practice, and might
1220 unnecessarily complicate dependencies of other packages within the
1221 same recipe or have other unintended consequences.
1222
1223- ``pn-overrides:`` Checks that a recipe does not have a name
1224 (:term:`PN`) value that appears in
1225 :term:`OVERRIDES`. If a recipe is named such that
1226 its ``PN`` value matches something already in ``OVERRIDES`` (e.g.
1227 ``PN`` happens to be the same as :term:`MACHINE` or
1228 :term:`DISTRO`), it can have unexpected consequences.
1229 For example, assignments such as ``FILES_${PN} = "xyz"`` effectively
1230 turn into ``FILES = "xyz"``.
1231
1232- ``rpaths:`` Checks for rpaths in the binaries that contain build
1233 system paths such as ``TMPDIR``. If this test fails, bad ``-rpath``
1234 options are being passed to the linker commands and your binaries
1235 have potential security issues.
1236
1237- ``split-strip:`` Reports that splitting or stripping debug symbols
1238 from binaries has failed.
1239
1240- ``staticdev:`` Checks for static library files (``*.a``) in
1241 non-``staticdev`` packages.
1242
1243- ``symlink-to-sysroot:`` Checks for symlinks in packages that point
1244 into :term:`TMPDIR` on the host. Such symlinks will
1245 work on the host, but are clearly invalid when running on the target.
1246
1247- ``textrel:`` Checks for ELF binaries that contain relocations in
1248 their ``.text`` sections, which can result in a performance impact at
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001249 runtime. See the explanation for the ``ELF binary`` message in
Andrew Geissler09209ee2020-12-13 08:44:15 -06001250 ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001251 issues.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001252
1253- ``unlisted-pkg-lics:`` Checks that all declared licenses applying
1254 for a package are also declared on the recipe level (i.e. any license
1255 in ``LICENSE_*`` should appear in :term:`LICENSE`).
1256
1257- ``useless-rpaths:`` Checks for dynamic library load paths (rpaths)
1258 in the binaries that by default on a standard system are searched by
1259 the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will
1260 not cause any breakage, they do waste space and are unnecessary.
1261
1262- ``var-undefined:`` Reports when variables fundamental to packaging
1263 (i.e. :term:`WORKDIR`,
1264 :term:`DEPLOY_DIR`, :term:`D`,
1265 :term:`PN`, and :term:`PKGD`) are undefined
1266 during :ref:`ref-tasks-package`.
1267
1268- ``version-going-backwards:`` If Build History is enabled, reports
1269 when a package being written out has a lower version than the
1270 previously written package under the same name. If you are placing
1271 output packages into a feed and upgrading packages on a target system
1272 using that feed, the version of a package going backwards can result
1273 in the target system not correctly upgrading to the "new" version of
1274 the package.
1275
1276 .. note::
1277
1278 If you are not using runtime package management on your target
1279 system, then you do not need to worry about this situation.
1280
1281- ``xorg-driver-abi:`` Checks that all packages containing Xorg
1282 drivers have ABI dependencies. The ``xserver-xorg`` recipe provides
1283 driver ABI names. All drivers should depend on the ABI versions that
1284 they have been built against. Driver recipes that include
1285 ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will
1286 automatically get these versions. Consequently, you should only need
1287 to explicitly add dependencies to binary driver recipes.
1288
1289.. _ref-classes-insserv:
1290
1291``insserv.bbclass``
1292===================
1293
1294The ``insserv`` class uses the ``insserv`` utility to update the order
1295of symbolic links in ``/etc/rc?.d/`` within an image based on
1296dependencies specified by LSB headers in the ``init.d`` scripts
1297themselves.
1298
1299.. _ref-classes-kernel:
1300
1301``kernel.bbclass``
1302==================
1303
1304The ``kernel`` class handles building Linux kernels. The class contains
1305code to build all kernel trees. All needed headers are staged into the
1306``STAGING_KERNEL_DIR`` directory to allow out-of-tree module builds
1307using the :ref:`module <ref-classes-module>` class.
1308
1309This means that each built kernel module is packaged separately and
1310inter-module dependencies are created by parsing the ``modinfo`` output.
1311If all modules are required, then installing the ``kernel-modules``
1312package installs all packages with modules and various other kernel
1313packages such as ``kernel-vmlinux``.
1314
1315The ``kernel`` class contains logic that allows you to embed an initial
1316RAM filesystem (initramfs) image when you build the kernel image. For
1317information on how to build an initramfs, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001318":ref:`dev-manual/common-tasks:building an initial ram filesystem (initramfs) image`" section in
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001319the Yocto Project Development Tasks Manual.
1320
1321Various other classes are used by the ``kernel`` and ``module`` classes
1322internally including the :ref:`kernel-arch <ref-classes-kernel-arch>`,
1323:ref:`module-base <ref-classes-module-base>`, and
1324:ref:`linux-kernel-base <ref-classes-linux-kernel-base>` classes.
1325
1326.. _ref-classes-kernel-arch:
1327
1328``kernel-arch.bbclass``
1329=======================
1330
1331The ``kernel-arch`` class sets the ``ARCH`` environment variable for
1332Linux kernel compilation (including modules).
1333
1334.. _ref-classes-kernel-devicetree:
1335
1336``kernel-devicetree.bbclass``
1337=============================
1338
1339The ``kernel-devicetree`` class, which is inherited by the
1340:ref:`kernel <ref-classes-kernel>` class, supports device tree
1341generation.
1342
1343.. _ref-classes-kernel-fitimage:
1344
1345``kernel-fitimage.bbclass``
1346===========================
1347
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001348The ``kernel-fitimage`` class provides support to pack a kernel image,
1349device trees, a U-boot script, a Initramfs bundle and a RAM disk
1350into a single FIT image. In theory, a FIT image can support any number
1351of kernels, U-boot scripts, Initramfs bundles, RAM disks and device-trees.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001352However, ``kernel-fitimage`` currently only supports
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001353limited usescases: just one kernel image, an optional U-boot script,
1354an optional Initramfs bundle, an optional RAM disk, and any number of
1355device tree.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001356
1357To create a FIT image, it is required that :term:`KERNEL_CLASSES`
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001358is set to include "kernel-fitimage" and :term:`KERNEL_IMAGETYPE`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001359is set to "fitImage".
1360
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001361The options for the device tree compiler passed to ``mkimage -D``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001362when creating the FIT image are specified using the
1363:term:`UBOOT_MKIMAGE_DTCOPTS` variable.
1364
1365Only a single kernel can be added to the FIT image created by
1366``kernel-fitimage`` and the kernel image in FIT is mandatory. The
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001367address where the kernel image is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001368specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by
1369:term:`UBOOT_ENTRYPOINT`.
1370
1371Multiple device trees can be added to the FIT image created by
1372``kernel-fitimage`` and the device tree is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001373The address where the device tree is to be loaded by U-Boot is
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001374specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001375and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001376
1377Only a single RAM disk can be added to the FIT image created by
1378``kernel-fitimage`` and the RAM disk in FIT is optional.
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001379The address where the RAM disk image is to be loaded by U-Boot
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001380is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by
1381:term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to FIT image when
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001382:term:`INITRAMFS_IMAGE` is specified and that :term:`INITRAMFS_IMAGE_BUNDLE`
1383is set to 0.
1384
1385Only a single Initramfs bundle can be added to the FIT image created by
1386``kernel-fitimage`` and the Initramfs bundle in FIT is optional.
1387In case of Initramfs, the kernel is configured to be bundled with the rootfs
1388in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin).
1389When the kernel is copied to RAM and executed, it unpacks the Initramfs rootfs.
1390The Initramfs bundle can be enabled when :term:`INITRAMFS_IMAGE`
1391is specified and that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1.
1392The address where the Initramfs bundle is to be loaded by U-boot is specified
1393by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`.
1394
1395Only a single U-boot boot script can be added to the FIT image created by
1396``kernel-fitimage`` and the boot script is optional.
1397The boot script is specified in the ITS file as a text file containing
1398U-boot commands. When using a boot script the user should configure the
1399U-boot ``do_install`` task to copy the script to sysroot.
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05001400So the script can be included in the FIT image by the ``kernel-fitimage``
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001401class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to
1402load the boot script from the FIT image and executes it.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001403
1404The FIT image generated by ``kernel-fitimage`` class is signed when the
1405variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`,
1406:term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set
1407appropriately. The default values used for :term:`FIT_HASH_ALG` and
1408:term:`FIT_SIGN_ALG` in ``kernel-fitimage`` are "sha256" and
Andrew Geisslerc3d88e42020-10-02 09:45:00 -05001409"rsa2048" respectively. The keys for signing fitImage can be generated using
1410the ``kernel-fitimage`` class when both :term:`FIT_GENERATE_KEYS` and
1411:term:`UBOOT_SIGN_ENABLE` are set to "1".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001412
1413
1414.. _ref-classes-kernel-grub:
1415
1416``kernel-grub.bbclass``
1417=======================
1418
1419The ``kernel-grub`` class updates the boot area and the boot menu with
1420the kernel as the priority boot mechanism while installing a RPM to
1421update the kernel on a deployed target.
1422
1423.. _ref-classes-kernel-module-split:
1424
1425``kernel-module-split.bbclass``
1426===============================
1427
1428The ``kernel-module-split`` class provides common functionality for
1429splitting Linux kernel modules into separate packages.
1430
1431.. _ref-classes-kernel-uboot:
1432
1433``kernel-uboot.bbclass``
1434========================
1435
1436The ``kernel-uboot`` class provides support for building from
1437vmlinux-style kernel sources.
1438
1439.. _ref-classes-kernel-uimage:
1440
1441``kernel-uimage.bbclass``
1442=========================
1443
1444The ``kernel-uimage`` class provides support to pack uImage.
1445
1446.. _ref-classes-kernel-yocto:
1447
1448``kernel-yocto.bbclass``
1449========================
1450
1451The ``kernel-yocto`` class provides common functionality for building
1452from linux-yocto style kernel source repositories.
1453
1454.. _ref-classes-kernelsrc:
1455
1456``kernelsrc.bbclass``
1457=====================
1458
1459The ``kernelsrc`` class sets the Linux kernel source and version.
1460
1461.. _ref-classes-lib_package:
1462
1463``lib_package.bbclass``
1464=======================
1465
1466The ``lib_package`` class supports recipes that build libraries and
1467produce executable binaries, where those binaries should not be
1468installed by default along with the library. Instead, the binaries are
1469added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to
1470make their installation optional.
1471
1472.. _ref-classes-libc*:
1473
1474``libc*.bbclass``
1475=================
1476
1477The ``libc*`` classes support recipes that build packages with ``libc``:
1478
1479- The ``libc-common`` class provides common support for building with
1480 ``libc``.
1481
1482- The ``libc-package`` class supports packaging up ``glibc`` and
1483 ``eglibc``.
1484
1485.. _ref-classes-license:
1486
1487``license.bbclass``
1488===================
1489
1490The ``license`` class provides license manifest creation and license
1491exclusion. This class is enabled by default using the default value for
1492the :term:`INHERIT_DISTRO` variable.
1493
1494.. _ref-classes-linux-kernel-base:
1495
1496``linux-kernel-base.bbclass``
1497=============================
1498
1499The ``linux-kernel-base`` class provides common functionality for
1500recipes that build out of the Linux kernel source tree. These builds
1501goes beyond the kernel itself. For example, the Perf recipe also
1502inherits this class.
1503
1504.. _ref-classes-linuxloader:
1505
1506``linuxloader.bbclass``
1507=======================
1508
1509Provides the function ``linuxloader()``, which gives the value of the
1510dynamic loader/linker provided on the platform. This value is used by a
1511number of other classes.
1512
1513.. _ref-classes-logging:
1514
1515``logging.bbclass``
1516===================
1517
1518The ``logging`` class provides the standard shell functions used to log
1519messages for various BitBake severity levels (i.e. ``bbplain``,
1520``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``).
1521
1522This class is enabled by default since it is inherited by the ``base``
1523class.
1524
1525.. _ref-classes-meta:
1526
1527``meta.bbclass``
1528================
1529
1530The ``meta`` class is inherited by recipes that do not build any output
1531packages themselves, but act as a "meta" target for building other
1532recipes.
1533
1534.. _ref-classes-metadata_scm:
1535
1536``metadata_scm.bbclass``
1537========================
1538
1539The ``metadata_scm`` class provides functionality for querying the
1540branch and revision of a Source Code Manager (SCM) repository.
1541
1542The :ref:`base <ref-classes-base>` class uses this class to print the
1543revisions of each layer before starting every build. The
1544``metadata_scm`` class is enabled by default because it is inherited by
1545the ``base`` class.
1546
1547.. _ref-classes-migrate_localcount:
1548
1549``migrate_localcount.bbclass``
1550==============================
1551
1552The ``migrate_localcount`` class verifies a recipe's localcount data and
1553increments it appropriately.
1554
1555.. _ref-classes-mime:
1556
1557``mime.bbclass``
1558================
1559
1560The ``mime`` class generates the proper post-install and post-remove
1561(postinst/postrm) scriptlets for packages that install MIME type files.
1562These scriptlets call ``update-mime-database`` to add the MIME types to
1563the shared database.
1564
1565.. _ref-classes-mirrors:
1566
1567``mirrors.bbclass``
1568===================
1569
1570The ``mirrors`` class sets up some standard
1571:term:`MIRRORS` entries for source code mirrors. These
1572mirrors provide a fall-back path in case the upstream source specified
1573in :term:`SRC_URI` within recipes is unavailable.
1574
1575This class is enabled by default since it is inherited by the
1576:ref:`base <ref-classes-base>` class.
1577
1578.. _ref-classes-module:
1579
1580``module.bbclass``
1581==================
1582
1583The ``module`` class provides support for building out-of-tree Linux
1584kernel modules. The class inherits the
1585:ref:`module-base <ref-classes-module-base>` and
1586:ref:`kernel-module-split <ref-classes-kernel-module-split>` classes,
1587and implements the :ref:`ref-tasks-compile` and
1588:ref:`ref-tasks-install` tasks. The class provides
1589everything needed to build and package a kernel module.
1590
1591For general information on out-of-tree Linux kernel modules, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001592":ref:`kernel-dev/common:incorporating out-of-tree modules`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001593section in the Yocto Project Linux Kernel Development Manual.
1594
1595.. _ref-classes-module-base:
1596
1597``module-base.bbclass``
1598=======================
1599
1600The ``module-base`` class provides the base functionality for building
1601Linux kernel modules. Typically, a recipe that builds software that
1602includes one or more kernel modules and has its own means of building
1603the module inherits this class as opposed to inheriting the
1604:ref:`module <ref-classes-module>` class.
1605
1606.. _ref-classes-multilib*:
1607
1608``multilib*.bbclass``
1609=====================
1610
1611The ``multilib*`` classes provide support for building libraries with
1612different target optimizations or target architectures and installing
1613them side-by-side in the same image.
1614
1615For more information on using the Multilib feature, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001616":ref:`dev-manual/common-tasks:combining multiple versions of library files into one image`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001617section in the Yocto Project Development Tasks Manual.
1618
1619.. _ref-classes-native:
1620
1621``native.bbclass``
1622==================
1623
1624The ``native`` class provides common functionality for recipes that
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001625build tools to run on the :term:`Build Host` (i.e. tools that use the compiler
1626or other tools from the build host).
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001627
1628You can create a recipe that builds tools that run natively on the host
1629a couple different ways:
1630
1631- Create a myrecipe\ ``-native.bb`` recipe that inherits the ``native``
1632 class. If you use this method, you must order the inherit statement
1633 in the recipe after all other inherit statements so that the
1634 ``native`` class is inherited last.
1635
1636 .. note::
1637
1638 When creating a recipe this way, the recipe name must follow this
1639 naming convention:
1640 ::
1641
1642 myrecipe-native.bb
1643
1644
1645 Not using this naming convention can lead to subtle problems
1646 caused by existing code that depends on that naming convention.
1647
1648- Create or modify a target recipe that contains the following:
1649 ::
1650
1651 BBCLASSEXTEND = "native"
1652
1653 Inside the
1654 recipe, use ``_class-native`` and ``_class-target`` overrides to
1655 specify any functionality specific to the respective native or target
1656 case.
1657
1658Although applied differently, the ``native`` class is used with both
1659methods. The advantage of the second method is that you do not need to
1660have two separate recipes (assuming you need both) for native and
1661target. All common parts of the recipe are automatically shared.
1662
1663.. _ref-classes-nativesdk:
1664
1665``nativesdk.bbclass``
1666=====================
1667
1668The ``nativesdk`` class provides common functionality for recipes that
1669wish to build tools to run as part of an SDK (i.e. tools that run on
1670:term:`SDKMACHINE`).
1671
1672You can create a recipe that builds tools that run on the SDK machine a
1673couple different ways:
1674
1675- Create a ``nativesdk-``\ myrecipe\ ``.bb`` recipe that inherits the
1676 ``nativesdk`` class. If you use this method, you must order the
1677 inherit statement in the recipe after all other inherit statements so
1678 that the ``nativesdk`` class is inherited last.
1679
1680- Create a ``nativesdk`` variant of any recipe by adding the following:
1681 ::
1682
1683 BBCLASSEXTEND = "nativesdk"
1684
1685 Inside the
1686 recipe, use ``_class-nativesdk`` and ``_class-target`` overrides to
1687 specify any functionality specific to the respective SDK machine or
1688 target case.
1689
1690.. note::
1691
1692 When creating a recipe, you must follow this naming convention:
1693 ::
1694
1695 nativesdk-myrecipe.bb
1696
1697
1698 Not doing so can lead to subtle problems because code exists that
1699 depends on the naming convention.
1700
1701Although applied differently, the ``nativesdk`` class is used with both
1702methods. The advantage of the second method is that you do not need to
1703have two separate recipes (assuming you need both) for the SDK machine
1704and the target. All common parts of the recipe are automatically shared.
1705
1706.. _ref-classes-nopackages:
1707
1708``nopackages.bbclass``
1709======================
1710
1711Disables packaging tasks for those recipes and classes where packaging
1712is not needed.
1713
1714.. _ref-classes-npm:
1715
1716``npm.bbclass``
1717===============
1718
1719Provides support for building Node.js software fetched using the `node
1720package manager (NPM) <https://en.wikipedia.org/wiki/Npm_(software)>`__.
1721
1722.. note::
1723
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001724 Currently, recipes inheriting this class must use the ``npm://``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001725 fetcher to have dependencies fetched and packaged automatically.
1726
1727For information on how to create NPM packages, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001728":ref:`dev-manual/common-tasks:creating node package manager (npm) packages`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001729section in the Yocto Project Development Tasks Manual.
1730
1731.. _ref-classes-oelint:
1732
1733``oelint.bbclass``
1734==================
1735
1736The ``oelint`` class is an obsolete lint checking tool that exists in
1737``meta/classes`` in the :term:`Source Directory`.
1738
1739A number of classes exist that could be generally useful in OE-Core but
1740are never actually used within OE-Core itself. The ``oelint`` class is
1741one such example. However, being aware of this class can reduce the
1742proliferation of different versions of similar classes across multiple
1743layers.
1744
1745.. _ref-classes-own-mirrors:
1746
1747``own-mirrors.bbclass``
1748=======================
1749
1750The ``own-mirrors`` class makes it easier to set up your own
1751:term:`PREMIRRORS` from which to first fetch source
1752before attempting to fetch it from the upstream specified in
1753:term:`SRC_URI` within each recipe.
1754
1755To use this class, inherit it globally and specify
1756:term:`SOURCE_MIRROR_URL`. Here is an example:
1757::
1758
1759 INHERIT += "own-mirrors"
1760 SOURCE_MIRROR_URL = "http://example.com/my-source-mirror"
1761
1762You can specify only a single URL
1763in ``SOURCE_MIRROR_URL``.
1764
1765.. _ref-classes-package:
1766
1767``package.bbclass``
1768===================
1769
1770The ``package`` class supports generating packages from a build's
1771output. The core generic functionality is in ``package.bbclass``. The
1772code specific to particular package types resides in these
1773package-specific classes:
1774:ref:`package_deb <ref-classes-package_deb>`,
1775:ref:`package_rpm <ref-classes-package_rpm>`,
1776:ref:`package_ipk <ref-classes-package_ipk>`, and
1777:ref:`package_tar <ref-classes-package_tar>`.
1778
1779.. note::
1780
1781 The
1782 package_tar
1783 class is broken and not supported. It is recommended that you do not
1784 use this class.
1785
1786You can control the list of resulting package formats by using the
1787``PACKAGE_CLASSES`` variable defined in your ``conf/local.conf``
1788configuration file, which is located in the :term:`Build Directory`.
1789When defining the variable, you can
1790specify one or more package types. Since images are generated from
1791packages, a packaging class is needed to enable image generation. The
1792first class listed in this variable is used for image generation.
1793
1794If you take the optional step to set up a repository (package feed) on
1795the development host that can be used by DNF, you can install packages
1796from the feed while you are running the image on the target (i.e.
1797runtime installation of packages). For more information, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001798":ref:`dev-manual/common-tasks:using runtime package management`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001799section in the Yocto Project Development Tasks Manual.
1800
1801The package-specific class you choose can affect build-time performance
1802and has space ramifications. In general, building a package with IPK
1803takes about thirty percent less time as compared to using RPM to build
1804the same or similar package. This comparison takes into account a
1805complete build of the package with all dependencies previously built.
1806The reason for this discrepancy is because the RPM package manager
1807creates and processes more :term:`Metadata` than the IPK package
1808manager. Consequently, you might consider setting ``PACKAGE_CLASSES`` to
1809"package_ipk" if you are building smaller systems.
1810
1811Before making your package manager decision, however, you should
1812consider some further things about using RPM:
1813
1814- RPM starts to provide more abilities than IPK due to the fact that it
1815 processes more Metadata. For example, this information includes
1816 individual file types, file checksum generation and evaluation on
1817 install, sparse file support, conflict detection and resolution for
1818 Multilib systems, ACID style upgrade, and repackaging abilities for
1819 rollbacks.
1820
1821- For smaller systems, the extra space used for the Berkeley Database
1822 and the amount of metadata when using RPM can affect your ability to
1823 perform on-device upgrades.
1824
1825You can find additional information on the effects of the package class
1826at these two Yocto Project mailing list links:
1827
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001828- :yocto_lists:`/pipermail/poky/2011-May/006362.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001829
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001830- :yocto_lists:`/pipermail/poky/2011-May/006363.html`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001831
1832.. _ref-classes-package_deb:
1833
1834``package_deb.bbclass``
1835=======================
1836
1837The ``package_deb`` class provides support for creating packages that
1838use the Debian (i.e. ``.deb``) file format. The class ensures the
1839packages are written out in a ``.deb`` file format to the
1840``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory.
1841
1842This class inherits the :ref:`package <ref-classes-package>` class and
1843is enabled through the :term:`PACKAGE_CLASSES`
1844variable in the ``local.conf`` file.
1845
1846.. _ref-classes-package_ipk:
1847
1848``package_ipk.bbclass``
1849=======================
1850
1851The ``package_ipk`` class provides support for creating packages that
1852use the IPK (i.e. ``.ipk``) file format. The class ensures the packages
1853are written out in a ``.ipk`` file format to the
1854``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory.
1855
1856This class inherits the :ref:`package <ref-classes-package>` class and
1857is enabled through the :term:`PACKAGE_CLASSES`
1858variable in the ``local.conf`` file.
1859
1860.. _ref-classes-package_rpm:
1861
1862``package_rpm.bbclass``
1863=======================
1864
1865The ``package_rpm`` class provides support for creating packages that
1866use the RPM (i.e. ``.rpm``) file format. The class ensures the packages
1867are written out in a ``.rpm`` file format to the
1868``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory.
1869
1870This class inherits the :ref:`package <ref-classes-package>` class and
1871is enabled through the :term:`PACKAGE_CLASSES`
1872variable in the ``local.conf`` file.
1873
1874.. _ref-classes-package_tar:
1875
1876``package_tar.bbclass``
1877=======================
1878
1879The ``package_tar`` class provides support for creating tarballs. The
1880class ensures the packages are written out in a tarball format to the
1881``${``\ :term:`DEPLOY_DIR_TAR`\ ``}`` 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.. note::
1888
Andrew Geissler4c19ea12020-10-27 13:52:24 -05001889 You cannot specify the ``package_tar`` class first using the
1890 ``PACKAGE_CLASSES`` variable. You must use ``.deb``, ``.ipk``, or ``.rpm``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001891 file formats for your image or SDK.
1892
1893.. _ref-classes-packagedata:
1894
1895``packagedata.bbclass``
1896=======================
1897
1898The ``packagedata`` class provides common functionality for reading
1899``pkgdata`` files found in :term:`PKGDATA_DIR`. These
1900files contain information about each output package produced by the
1901OpenEmbedded build system.
1902
1903This class is enabled by default because it is inherited by the
1904:ref:`package <ref-classes-package>` class.
1905
1906.. _ref-classes-packagegroup:
1907
1908``packagegroup.bbclass``
1909========================
1910
1911The ``packagegroup`` class sets default values appropriate for package
1912group recipes (e.g. ``PACKAGES``, ``PACKAGE_ARCH``, ``ALLOW_EMPTY``, and
1913so forth). It is highly recommended that all package group recipes
1914inherit this class.
1915
1916For information on how to use this class, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06001917":ref:`dev-manual/common-tasks:customizing images using custom package groups`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001918section in the Yocto Project Development Tasks Manual.
1919
1920Previously, this class was called the ``task`` class.
1921
1922.. _ref-classes-patch:
1923
1924``patch.bbclass``
1925=================
1926
1927The ``patch`` class provides all functionality for applying patches
1928during the :ref:`ref-tasks-patch` task.
1929
1930This class is enabled by default because it is inherited by the
1931:ref:`base <ref-classes-base>` class.
1932
1933.. _ref-classes-perlnative:
1934
1935``perlnative.bbclass``
1936======================
1937
1938When inherited by a recipe, the ``perlnative`` class supports using the
1939native version of Perl built by the build system rather than using the
1940version provided by the build host.
1941
1942.. _ref-classes-pixbufcache:
1943
1944``pixbufcache.bbclass``
1945=======================
1946
1947The ``pixbufcache`` class generates the proper post-install and
1948post-remove (postinst/postrm) scriptlets for packages that install
1949pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets
1950call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache.
1951Since the cache files are architecture-specific, ``update_pixbuf_cache``
1952is run using QEMU if the postinst scriptlets need to be run on the build
1953host during image creation.
1954
1955If the pixbuf loaders being installed are in packages other than the
1956recipe's main package, set
1957:term:`PIXBUF_PACKAGES` to specify the packages
1958containing the loaders.
1959
1960.. _ref-classes-pkgconfig:
1961
1962``pkgconfig.bbclass``
1963=====================
1964
1965The ``pkgconfig`` class provides a standard way to get header and
1966library information by using ``pkg-config``. This class aims to smooth
1967integration of ``pkg-config`` into libraries that use it.
1968
1969During staging, BitBake installs ``pkg-config`` data into the
1970``sysroots/`` directory. By making use of sysroot functionality within
1971``pkg-config``, the ``pkgconfig`` class no longer has to manipulate the
1972files.
1973
1974.. _ref-classes-populate-sdk:
1975
1976``populate_sdk.bbclass``
1977========================
1978
1979The ``populate_sdk`` class provides support for SDK-only recipes. For
1980information on advantages gained when building a cross-development
1981toolchain using the :ref:`ref-tasks-populate_sdk`
Andrew Geissler09209ee2020-12-13 08:44:15 -06001982task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001983section in the Yocto Project Application Development and the Extensible
1984Software Development Kit (eSDK) manual.
1985
1986.. _ref-classes-populate-sdk-*:
1987
1988``populate_sdk_*.bbclass``
1989==========================
1990
1991The ``populate_sdk_*`` classes support SDK creation and consist of the
1992following classes:
1993
1994- ``populate_sdk_base``: The base class supporting SDK creation under
1995 all package managers (i.e. DEB, RPM, and opkg).
1996
1997- ``populate_sdk_deb``: Supports creation of the SDK given the Debian
1998 package manager.
1999
2000- ``populate_sdk_rpm``: Supports creation of the SDK given the RPM
2001 package manager.
2002
2003- ``populate_sdk_ipk``: Supports creation of the SDK given the opkg
2004 (IPK format) package manager.
2005
2006- ``populate_sdk_ext``: Supports extensible SDK creation under all
2007 package managers.
2008
2009The ``populate_sdk_base`` class inherits the appropriate
2010``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on
2011:term:`IMAGE_PKGTYPE`.
2012
2013The base class ensures all source and destination directories are
2014established and then populates the SDK. After populating the SDK, the
2015``populate_sdk_base`` class constructs two sysroots:
2016``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which
2017contains the cross-compiler and associated tooling, and the target,
2018which contains a target root filesystem that is configured for the SDK
2019usage. These two images reside in :term:`SDK_OUTPUT`,
2020which consists of the following:
2021::
2022
2023 ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs
2024 ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs
2025
2026Finally, the base populate SDK class creates the toolchain environment
2027setup script, the tarball of the SDK, and the installer.
2028
2029The respective ``populate_sdk_deb``, ``populate_sdk_rpm``, and
2030``populate_sdk_ipk`` classes each support the specific type of SDK.
2031These classes are inherited by and used with the ``populate_sdk_base``
2032class.
2033
2034For more information on the cross-development toolchain generation, see
Andrew Geissler09209ee2020-12-13 08:44:15 -06002035the ":ref:`overview-manual/concepts:cross-development toolchain generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002036section in the Yocto Project Overview and Concepts Manual. For
2037information on advantages gained when building a cross-development
2038toolchain using the :ref:`ref-tasks-populate_sdk`
2039task, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002040":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002041section in the Yocto Project Application Development and the Extensible
2042Software Development Kit (eSDK) manual.
2043
2044.. _ref-classes-prexport:
2045
2046``prexport.bbclass``
2047====================
2048
2049The ``prexport`` class provides functionality for exporting
2050:term:`PR` values.
2051
2052.. note::
2053
2054 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002055 when using "``bitbake-prserv-tool export``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002056
2057.. _ref-classes-primport:
2058
2059``primport.bbclass``
2060====================
2061
2062The ``primport`` class provides functionality for importing
2063:term:`PR` values.
2064
2065.. note::
2066
2067 This class is not intended to be used directly. Rather, it is enabled
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002068 when using "``bitbake-prserv-tool import``".
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002069
2070.. _ref-classes-prserv:
2071
2072``prserv.bbclass``
2073==================
2074
2075The ``prserv`` class provides functionality for using a :ref:`PR
Andrew Geissler09209ee2020-12-13 08:44:15 -06002076service <dev-manual/common-tasks:working with a pr service>` in order to
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002077automatically manage the incrementing of the :term:`PR`
2078variable for each recipe.
2079
2080This class is enabled by default because it is inherited by the
2081:ref:`package <ref-classes-package>` class. However, the OpenEmbedded
2082build system will not enable the functionality of this class unless
2083:term:`PRSERV_HOST` has been set.
2084
2085.. _ref-classes-ptest:
2086
2087``ptest.bbclass``
2088=================
2089
2090The ``ptest`` class provides functionality for packaging and installing
2091runtime tests for recipes that build software that provides these tests.
2092
2093This class is intended to be inherited by individual recipes. However,
2094the class' functionality is largely disabled unless "ptest" appears in
2095:term:`DISTRO_FEATURES`. See the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002096":ref:`dev-manual/common-tasks:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002097section in the Yocto Project Development Tasks Manual for more information
2098on ptest.
2099
2100.. _ref-classes-ptest-gnome:
2101
2102``ptest-gnome.bbclass``
2103=======================
2104
2105Enables package tests (ptests) specifically for GNOME packages, which
2106have tests intended to be executed with ``gnome-desktop-testing``.
2107
2108For information on setting up and running ptests, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002109":ref:`dev-manual/common-tasks:testing packages with ptest`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002110section in the Yocto Project Development Tasks Manual.
2111
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002112.. _ref-classes-python3-dir:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002113
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002114``python3-dir.bbclass``
2115=======================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002116
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002117The ``python3-dir`` class provides the base version, location, and site
2118package location for Python 3.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002119
2120.. _ref-classes-python3native:
2121
2122``python3native.bbclass``
2123=========================
2124
2125The ``python3native`` class supports using the native version of Python
21263 built by the build system rather than support of the version provided
2127by the build host.
2128
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002129.. _ref-classes-python3targetconfig:
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002130
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002131``python3targetconfig.bbclass``
2132===============================
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002133
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002134The ``python3targetconfig`` class supports using the native version of Python
21353 built by the build system rather than support of the version provided
2136by the build host, except that the configuration for the target machine
2137is accessible (such as correct installation directories). This also adds a
2138dependency on target ``python3``, so should only be used where appropriate
2139in order to avoid unnecessarily lengthening builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002140
2141.. _ref-classes-qemu:
2142
2143``qemu.bbclass``
2144================
2145
2146The ``qemu`` class provides functionality for recipes that either need
2147QEMU or test for the existence of QEMU. Typically, this class is used to
2148run programs for a target system on the build host using QEMU's
2149application emulation mode.
2150
2151.. _ref-classes-recipe_sanity:
2152
2153``recipe_sanity.bbclass``
2154=========================
2155
2156The ``recipe_sanity`` class checks for the presence of any host system
2157recipe prerequisites that might affect the build (e.g. variables that
2158are set or software that is present).
2159
2160.. _ref-classes-relocatable:
2161
2162``relocatable.bbclass``
2163=======================
2164
2165The ``relocatable`` class enables relocation of binaries when they are
2166installed into the sysroot.
2167
2168This class makes use of the :ref:`chrpath <ref-classes-chrpath>` class
2169and is used by both the :ref:`cross <ref-classes-cross>` and
2170:ref:`native <ref-classes-native>` classes.
2171
2172.. _ref-classes-remove-libtool:
2173
2174``remove-libtool.bbclass``
2175==========================
2176
2177The ``remove-libtool`` class adds a post function to the
2178:ref:`ref-tasks-install` task to remove all ``.la`` files
2179installed by ``libtool``. Removing these files results in them being
2180absent from both the sysroot and target packages.
2181
2182If a recipe needs the ``.la`` files to be installed, then the recipe can
2183override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows:
2184::
2185
2186 REMOVE_LIBTOOL_LA = "0"
2187
2188.. note::
2189
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002190 The ``remove-libtool`` class is not enabled by default.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002191
2192.. _ref-classes-report-error:
2193
2194``report-error.bbclass``
2195========================
2196
2197The ``report-error`` class supports enabling the :ref:`error reporting
Andrew Geissler09209ee2020-12-13 08:44:15 -06002198tool <dev-manual/common-tasks:using the error reporting tool>`",
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002199which allows you to submit build error information to a central database.
2200
2201The class collects debug information for recipe, recipe version, task,
2202machine, distro, build system, target system, host distro, branch,
2203commit, and log. From the information, report files using a JSON format
2204are created and stored in
2205``${``\ :term:`LOG_DIR`\ ``}/error-report``.
2206
2207.. _ref-classes-rm-work:
2208
2209``rm_work.bbclass``
2210===================
2211
2212The ``rm_work`` class supports deletion of temporary workspace, which
2213can ease your hard drive demands during builds.
2214
2215The OpenEmbedded build system can use a substantial amount of disk space
2216during the build process. A portion of this space is the work files
2217under the ``${TMPDIR}/work`` directory for each recipe. Once the build
2218system generates the packages for a recipe, the work files for that
2219recipe are no longer needed. However, by default, the build system
2220preserves these files for inspection and possible debugging purposes. If
2221you would rather have these files deleted to save disk space as the
2222build progresses, you can enable ``rm_work`` by adding the following to
2223your ``local.conf`` file, which is found in the :term:`Build Directory`.
2224::
2225
2226 INHERIT += "rm_work"
2227
2228If you are
2229modifying and building source code out of the work directory for a
2230recipe, enabling ``rm_work`` will potentially result in your changes to
2231the source being lost. To exclude some recipes from having their work
2232directories deleted by ``rm_work``, you can add the names of the recipe
2233or recipes you are working on to the ``RM_WORK_EXCLUDE`` variable, which
2234can also be set in your ``local.conf`` file. Here is an example:
2235::
2236
2237 RM_WORK_EXCLUDE += "busybox glibc"
2238
2239.. _ref-classes-rootfs*:
2240
2241``rootfs*.bbclass``
2242===================
2243
2244The ``rootfs*`` classes support creating the root filesystem for an
2245image and consist of the following classes:
2246
2247- The ``rootfs-postcommands`` class, which defines filesystem
2248 post-processing functions for image recipes.
2249
2250- The ``rootfs_deb`` class, which supports creation of root filesystems
2251 for images built using ``.deb`` packages.
2252
2253- The ``rootfs_rpm`` class, which supports creation of root filesystems
2254 for images built using ``.rpm`` packages.
2255
2256- The ``rootfs_ipk`` class, which supports creation of root filesystems
2257 for images built using ``.ipk`` packages.
2258
2259- The ``rootfsdebugfiles`` class, which installs additional files found
2260 on the build host directly into the root filesystem.
2261
2262The root filesystem is created from packages using one of the
2263``rootfs*.bbclass`` files as determined by the
2264:term:`PACKAGE_CLASSES` variable.
2265
2266For information on how root filesystem images are created, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002267":ref:`overview-manual/concepts:image generation`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002268section in the Yocto Project Overview and Concepts Manual.
2269
2270.. _ref-classes-sanity:
2271
2272``sanity.bbclass``
2273==================
2274
2275The ``sanity`` class checks to see if prerequisite software is present
2276on the host system so that users can be notified of potential problems
2277that might affect their build. The class also performs basic user
2278configuration checks from the ``local.conf`` configuration file to
2279prevent common mistakes that cause build failures. Distribution policy
2280usually determines whether to include this class.
2281
2282.. _ref-classes-scons:
2283
2284``scons.bbclass``
2285=================
2286
2287The ``scons`` class supports recipes that need to build software that
2288uses the SCons build system. You can use the
2289:term:`EXTRA_OESCONS` variable to specify
2290additional configuration options you want to pass SCons command line.
2291
2292.. _ref-classes-sdl:
2293
2294``sdl.bbclass``
2295===============
2296
2297The ``sdl`` class supports recipes that need to build software that uses
2298the Simple DirectMedia Layer (SDL) library.
2299
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002300.. _ref-classes-setuptools3:
2301
2302``setuptools3.bbclass``
2303=======================
2304
2305The ``setuptools3`` class supports Python version 3.x extensions that
Andrew Geissler3b8a17c2021-04-15 15:55:55 -05002306use build systems based on ``setuptools``. If your recipe uses these
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002307build systems, the recipe needs to inherit the ``setuptools3`` class.
2308
2309.. _ref-classes-sign_rpm:
2310
2311``sign_rpm.bbclass``
2312====================
2313
2314The ``sign_rpm`` class supports generating signed RPM packages.
2315
2316.. _ref-classes-sip:
2317
2318``sip.bbclass``
2319===============
2320
2321The ``sip`` class supports recipes that build or package SIP-based
2322Python bindings.
2323
2324.. _ref-classes-siteconfig:
2325
2326``siteconfig.bbclass``
2327======================
2328
2329The ``siteconfig`` class provides functionality for handling site
2330configuration. The class is used by the
2331:ref:`autotools <ref-classes-autotools>` class to accelerate the
2332:ref:`ref-tasks-configure` task.
2333
2334.. _ref-classes-siteinfo:
2335
2336``siteinfo.bbclass``
2337====================
2338
2339The ``siteinfo`` class provides information about the targets that might
2340be needed by other classes or recipes.
2341
2342As an example, consider Autotools, which can require tests that must
2343execute on the target hardware. Since this is not possible in general
2344when cross compiling, site information is used to provide cached test
2345results so these tests can be skipped over but still make the correct
2346values available. The ``meta/site directory`` contains test results
2347sorted into different categories such as architecture, endianness, and
2348the ``libc`` used. Site information provides a list of files containing
2349data relevant to the current build in the ``CONFIG_SITE`` variable that
2350Autotools automatically picks up.
2351
2352The class also provides variables like ``SITEINFO_ENDIANNESS`` and
2353``SITEINFO_BITS`` that can be used elsewhere in the metadata.
2354
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002355.. _ref-classes-sstate:
2356
2357``sstate.bbclass``
2358==================
2359
2360The ``sstate`` class provides support for Shared State (sstate). By
2361default, the class is enabled through the
2362:term:`INHERIT_DISTRO` variable's default value.
2363
2364For more information on sstate, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002365":ref:`overview-manual/concepts:shared state cache`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002366section in the Yocto Project Overview and Concepts Manual.
2367
2368.. _ref-classes-staging:
2369
2370``staging.bbclass``
2371===================
2372
2373The ``staging`` class installs files into individual recipe work
2374directories for sysroots. The class contains the following key tasks:
2375
2376- The :ref:`ref-tasks-populate_sysroot` task,
2377 which is responsible for handing the files that end up in the recipe
2378 sysroots.
2379
2380- The
2381 :ref:`ref-tasks-prepare_recipe_sysroot`
2382 task (a "partner" task to the ``populate_sysroot`` task), which
2383 installs the files into the individual recipe work directories (i.e.
2384 :term:`WORKDIR`).
2385
2386The code in the ``staging`` class is complex and basically works in two
2387stages:
2388
2389- *Stage One:* The first stage addresses recipes that have files they
2390 want to share with other recipes that have dependencies on the
2391 originating recipe. Normally these dependencies are installed through
2392 the :ref:`ref-tasks-install` task into
2393 ``${``\ :term:`D`\ ``}``. The ``do_populate_sysroot`` task
2394 copies a subset of these files into ``${SYSROOT_DESTDIR}``. This
2395 subset of files is controlled by the
2396 :term:`SYSROOT_DIRS`,
2397 :term:`SYSROOT_DIRS_NATIVE`, and
2398 :term:`SYSROOT_DIRS_BLACKLIST`
2399 variables.
2400
2401 .. note::
2402
2403 Additionally, a recipe can customize the files further by
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002404 declaring a processing function in the ``SYSROOT_PREPROCESS_FUNCS``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002405 variable.
2406
2407 A shared state (sstate) object is built from these files and the
2408 files are placed into a subdirectory of
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002409 :ref:`structure-build-tmp-sysroots-components`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002410 The files are scanned for hardcoded paths to the original
2411 installation location. If the location is found in text files, the
2412 hardcoded locations are replaced by tokens and a list of the files
2413 needing such replacements is created. These adjustments are referred
2414 to as "FIXMEs". The list of files that are scanned for paths is
2415 controlled by the :term:`SSTATE_SCAN_FILES`
2416 variable.
2417
2418- *Stage Two:* The second stage addresses recipes that want to use
2419 something from another recipe and declare a dependency on that recipe
2420 through the :term:`DEPENDS` variable. The recipe will
2421 have a
2422 :ref:`ref-tasks-prepare_recipe_sysroot`
2423 task and when this task executes, it creates the ``recipe-sysroot``
2424 and ``recipe-sysroot-native`` in the recipe work directory (i.e.
2425 :term:`WORKDIR`). The OpenEmbedded build system
2426 creates hard links to copies of the relevant files from
2427 ``sysroots-components`` into the recipe work directory.
2428
2429 .. note::
2430
2431 If hard links are not possible, the build system uses actual
2432 copies.
2433
2434 The build system then addresses any "FIXMEs" to paths as defined from
2435 the list created in the first stage.
2436
2437 Finally, any files in ``${bindir}`` within the sysroot that have the
2438 prefix "``postinst-``" are executed.
2439
2440 .. note::
2441
2442 Although such sysroot post installation scripts are not
2443 recommended for general use, the files do allow some issues such
2444 as user creation and module indexes to be addressed.
2445
2446 Because recipes can have other dependencies outside of ``DEPENDS``
2447 (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``),
2448 the sysroot creation function ``extend_recipe_sysroot`` is also added
2449 as a pre-function for those tasks whose dependencies are not through
2450 ``DEPENDS`` but operate similarly.
2451
2452 When installing dependencies into the sysroot, the code traverses the
2453 dependency graph and processes dependencies in exactly the same way
2454 as the dependencies would or would not be when installed from sstate.
2455 This processing means, for example, a native tool would have its
2456 native dependencies added but a target library would not have its
2457 dependencies traversed or installed. The same sstate dependency code
2458 is used so that builds should be identical regardless of whether
2459 sstate was used or not. For a closer look, see the
2460 ``setscene_depvalid()`` function in the
2461 :ref:`sstate <ref-classes-sstate>` class.
2462
2463 The build system is careful to maintain manifests of the files it
2464 installs so that any given dependency can be installed as needed. The
2465 sstate hash of the installed item is also stored so that if it
2466 changes, the build system can reinstall it.
2467
2468.. _ref-classes-syslinux:
2469
2470``syslinux.bbclass``
2471====================
2472
2473The ``syslinux`` class provides syslinux-specific functions for building
2474bootable images.
2475
2476The class supports the following variables:
2477
2478- :term:`INITRD`: Indicates list of filesystem images to
2479 concatenate and use as an initial RAM disk (initrd). This variable is
2480 optional.
2481
2482- :term:`ROOTFS`: Indicates a filesystem image to include
2483 as the root filesystem. This variable is optional.
2484
2485- :term:`AUTO_SYSLINUXMENU`: Enables creating
2486 an automatic menu when set to "1".
2487
2488- :term:`LABELS`: Lists targets for automatic
2489 configuration.
2490
2491- :term:`APPEND`: Lists append string overrides for each
2492 label.
2493
2494- :term:`SYSLINUX_OPTS`: Lists additional options
2495 to add to the syslinux file. Semicolon characters separate multiple
2496 options.
2497
2498- :term:`SYSLINUX_SPLASH`: Lists a background
2499 for the VGA boot menu when you are using the boot menu.
2500
2501- :term:`SYSLINUX_DEFAULT_CONSOLE`: Set
2502 to "console=ttyX" to change kernel boot default console.
2503
2504- :term:`SYSLINUX_SERIAL`: Sets an alternate
2505 serial port. Or, turns off serial when the variable is set with an
2506 empty string.
2507
2508- :term:`SYSLINUX_SERIAL_TTY`: Sets an
2509 alternate "console=tty..." kernel boot argument.
2510
2511.. _ref-classes-systemd:
2512
2513``systemd.bbclass``
2514===================
2515
2516The ``systemd`` class provides support for recipes that install systemd
2517unit files.
2518
2519The functionality for this class is disabled unless you have "systemd"
2520in :term:`DISTRO_FEATURES`.
2521
2522Under this class, the recipe or Makefile (i.e. whatever the recipe is
2523calling during the :ref:`ref-tasks-install` task)
2524installs unit files into
2525``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit
2526files being installed go into packages other than the main package, you
2527need to set :term:`SYSTEMD_PACKAGES` in your
2528recipe to identify the packages in which the files will be installed.
2529
2530You should set :term:`SYSTEMD_SERVICE` to the
2531name of the service file. You should also use a package name override to
2532indicate the package to which the value applies. If the value applies to
2533the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here
2534is an example from the connman recipe:
2535::
2536
2537 SYSTEMD_SERVICE_${PN} = "connman.service"
2538
2539Services are set up to start on boot automatically
2540unless you have set
2541:term:`SYSTEMD_AUTO_ENABLE` to "disable".
2542
2543For more information on ``systemd``, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002544":ref:`dev-manual/common-tasks:selecting an initialization manager`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002545section in the Yocto Project Development Tasks Manual.
2546
2547.. _ref-classes-systemd-boot:
2548
2549``systemd-boot.bbclass``
2550========================
2551
2552The ``systemd-boot`` class provides functions specific to the
2553systemd-boot bootloader for building bootable images. This is an
2554internal class and is not intended to be used directly.
2555
2556.. note::
2557
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002558 The ``systemd-boot`` class is a result from merging the ``gummiboot`` class
2559 used in previous Yocto Project releases with the ``systemd`` project.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002560
2561Set the :term:`EFI_PROVIDER` variable to
2562"systemd-boot" to use this class. Doing so creates a standalone EFI
2563bootloader that is not dependent on systemd.
2564
2565For information on more variables used and supported in this class, see
2566the :term:`SYSTEMD_BOOT_CFG`,
2567:term:`SYSTEMD_BOOT_ENTRIES`, and
2568:term:`SYSTEMD_BOOT_TIMEOUT` variables.
2569
2570You can also see the `Systemd-boot
Andrew Geisslerd1e89492021-02-12 15:35:20 -06002571documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002572for more information.
2573
2574.. _ref-classes-terminal:
2575
2576``terminal.bbclass``
2577====================
2578
2579The ``terminal`` class provides support for starting a terminal session.
2580The :term:`OE_TERMINAL` variable controls which
2581terminal emulator is used for the session.
2582
2583Other classes use the ``terminal`` class anywhere a separate terminal
2584session needs to be started. For example, the
2585:ref:`patch <ref-classes-patch>` class assuming
2586:term:`PATCHRESOLVE` is set to "user", the
2587:ref:`cml1 <ref-classes-cml1>` class, and the
2588:ref:`devshell <ref-classes-devshell>` class all use the ``terminal``
2589class.
2590
2591.. _ref-classes-testimage*:
2592
2593``testimage*.bbclass``
2594======================
2595
2596The ``testimage*`` classes support running automated tests against
2597images using QEMU and on actual hardware. The classes handle loading the
2598tests and starting the image. To use the classes, you need to perform
2599steps to set up the environment.
2600
2601.. note::
2602
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002603 Best practices include using :term:`IMAGE_CLASSES` rather than
2604 :term:`INHERIT` to inherit the ``testimage`` class for automated image
2605 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002606
2607The tests are commands that run on the target system over ``ssh``. Each
2608test is written in Python and makes use of the ``unittest`` module.
2609
2610The ``testimage.bbclass`` runs tests on an image when called using the
2611following:
2612::
2613
2614 $ bitbake -c testimage image
2615
2616The ``testimage-auto`` class
2617runs tests on an image after the image is constructed (i.e.
2618:term:`TESTIMAGE_AUTO` must be set to "1").
2619
2620For information on how to enable, run, and create new tests, see the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002621":ref:`dev-manual/common-tasks:performing automated runtime testing`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002622section in the Yocto Project Development Tasks Manual.
2623
2624.. _ref-classes-testsdk:
2625
2626``testsdk.bbclass``
2627===================
2628
2629This class supports running automated tests against software development
2630kits (SDKs). The ``testsdk`` class runs tests on an SDK when called
2631using the following:
2632::
2633
2634 $ bitbake -c testsdk image
2635
2636.. note::
2637
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002638 Best practices include using :term:`IMAGE_CLASSES` rather than
2639 :term:`INHERIT` to inherit the ``testsdk`` class for automated SDK
2640 testing.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002641
2642.. _ref-classes-texinfo:
2643
2644``texinfo.bbclass``
2645===================
2646
2647This class should be inherited by recipes whose upstream packages invoke
2648the ``texinfo`` utilities at build-time. Native and cross recipes are
2649made to use the dummy scripts provided by ``texinfo-dummy-native``, for
2650improved performance. Target architecture recipes use the genuine
2651Texinfo utilities. By default, they use the Texinfo utilities on the
2652host system.
2653
2654.. note::
2655
2656 If you want to use the Texinfo recipe shipped with the build system,
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002657 you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo
2658 from :term:`SANITY_REQUIRED_UTILITIES`.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002659
2660.. _ref-classes-toaster:
2661
2662``toaster.bbclass``
2663===================
2664
2665The ``toaster`` class collects information about packages and images and
2666sends them as events that the BitBake user interface can receive. The
2667class is enabled when the Toaster user interface is running.
2668
2669This class is not intended to be used directly.
2670
2671.. _ref-classes-toolchain-scripts:
2672
2673``toolchain-scripts.bbclass``
2674=============================
2675
2676The ``toolchain-scripts`` class provides the scripts used for setting up
2677the environment for installed SDKs.
2678
2679.. _ref-classes-typecheck:
2680
2681``typecheck.bbclass``
2682=====================
2683
2684The ``typecheck`` class provides support for validating the values of
2685variables set at the configuration level against their defined types.
2686The OpenEmbedded build system allows you to define the type of a
2687variable using the "type" varflag. Here is an example:
2688::
2689
2690 IMAGE_FEATURES[type] = "list"
2691
2692.. _ref-classes-uboot-config:
2693
2694``uboot-config.bbclass``
2695========================
2696
2697The ``uboot-config`` class provides support for U-Boot configuration for
2698a machine. Specify the machine in your recipe as follows:
2699::
2700
2701 UBOOT_CONFIG ??= <default>
2702 UBOOT_CONFIG[foo] = "config,images"
2703
2704You can also specify the machine using this method:
2705::
2706
2707 UBOOT_MACHINE = "config"
2708
2709See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional
2710information.
2711
2712.. _ref-classes-uninative:
2713
2714``uninative.bbclass``
2715=====================
2716
2717Attempts to isolate the build system from the host distribution's C
2718library in order to make re-use of native shared state artifacts across
2719different host distributions practical. With this class enabled, a
2720tarball containing a pre-built C library is downloaded at the start of
2721the build. In the Poky reference distribution this is enabled by default
2722through ``meta/conf/distro/include/yocto-uninative.inc``. Other
2723distributions that do not derive from poky can also
2724"``require conf/distro/include/yocto-uninative.inc``" to use this.
2725Alternatively if you prefer, you can build the uninative-tarball recipe
2726yourself, publish the resulting tarball (e.g. via HTTP) and set
2727``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an
2728example, see the ``meta/conf/distro/include/yocto-uninative.inc``.
2729
2730The ``uninative`` class is also used unconditionally by the extensible
2731SDK. When building the extensible SDK, ``uninative-tarball`` is built
2732and the resulting tarball is included within the SDK.
2733
2734.. _ref-classes-update-alternatives:
2735
2736``update-alternatives.bbclass``
2737===============================
2738
2739The ``update-alternatives`` class helps the alternatives system when
2740multiple sources provide the same command. This situation occurs when
2741several programs that have the same or similar function are installed
2742with the same name. For example, the ``ar`` command is available from
2743the ``busybox``, ``binutils`` and ``elfutils`` packages. The
2744``update-alternatives`` class handles renaming the binaries so that
2745multiple packages can be installed without conflicts. The ``ar`` command
2746still works regardless of which packages are installed or subsequently
2747removed. The class renames the conflicting binary in each package and
2748symlinks the highest priority binary during installation or removal of
2749packages.
2750
2751To use this class, you need to define a number of variables:
2752
2753- :term:`ALTERNATIVE`
2754
2755- :term:`ALTERNATIVE_LINK_NAME`
2756
2757- :term:`ALTERNATIVE_TARGET`
2758
2759- :term:`ALTERNATIVE_PRIORITY`
2760
2761These variables list alternative commands needed by a package, provide
2762pathnames for links, default links for targets, and so forth. For
2763details on how to use this class, see the comments in the
Andrew Geissler09209ee2020-12-13 08:44:15 -06002764:yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes/update-alternatives.bbclass>`
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002765file.
2766
2767.. note::
2768
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002769 You can use the ``update-alternatives`` command directly in your recipes.
2770 However, this class simplifies things in most cases.
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002771
2772.. _ref-classes-update-rc.d:
2773
2774``update-rc.d.bbclass``
2775=======================
2776
2777The ``update-rc.d`` class uses ``update-rc.d`` to safely install an
2778initialization script on behalf of the package. The OpenEmbedded build
2779system takes care of details such as making sure the script is stopped
2780before a package is removed and started when the package is installed.
2781
2782Three variables control this class: ``INITSCRIPT_PACKAGES``,
2783``INITSCRIPT_NAME`` and ``INITSCRIPT_PARAMS``. See the variable links
2784for details.
2785
2786.. _ref-classes-useradd:
2787
2788``useradd*.bbclass``
2789====================
2790
2791The ``useradd*`` classes support the addition of users or groups for
2792usage by the package on the target. For example, if you have packages
2793that contain system services that should be run under their own user or
2794group, you can use these classes to enable creation of the user or
2795group. The ``meta-skeleton/recipes-skeleton/useradd/useradd-example.bb``
2796recipe in the :term:`Source Directory` provides a simple
2797example that shows how to add three users and groups to two packages.
2798See the ``useradd-example.bb`` recipe for more information on how to use
2799these classes.
2800
2801The ``useradd_base`` class provides basic functionality for user or
2802groups settings.
2803
2804The ``useradd*`` classes support the
2805:term:`USERADD_PACKAGES`,
2806:term:`USERADD_PARAM`,
2807:term:`GROUPADD_PARAM`, and
2808:term:`GROUPMEMS_PARAM` variables.
2809
2810The ``useradd-staticids`` class supports the addition of users or groups
2811that have static user identification (``uid``) and group identification
2812(``gid``) values.
2813
2814The default behavior of the OpenEmbedded build system for assigning
2815``uid`` and ``gid`` values when packages add users and groups during
2816package install time is to add them dynamically. This works fine for
2817programs that do not care what the values of the resulting users and
2818groups become. In these cases, the order of the installation determines
2819the final ``uid`` and ``gid`` values. However, if non-deterministic
2820``uid`` and ``gid`` values are a problem, you can override the default,
2821dynamic application of these values by setting static values. When you
2822set static values, the OpenEmbedded build system looks in
2823:term:`BBPATH` for ``files/passwd`` and ``files/group``
2824files for the values.
2825
2826To use static ``uid`` and ``gid`` values, you need to set some
2827variables. See the :term:`USERADDEXTENSION`,
2828:term:`USERADD_UID_TABLES`,
2829:term:`USERADD_GID_TABLES`, and
2830:term:`USERADD_ERROR_DYNAMIC` variables.
2831You can also see the :ref:`useradd <ref-classes-useradd>` class for
2832additional information.
2833
2834.. note::
2835
Andrew Geissler4c19ea12020-10-27 13:52:24 -05002836 You do not use the ``useradd-staticids`` class directly. You either enable
2837 or disable the class by setting the ``USERADDEXTENSION`` variable. If you
2838 enable or disable the class in a configured system, :term:`TMPDIR` might
2839 contain incorrect ``uid`` and ``gid`` values. Deleting the ``TMPDIR``
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002840 directory will correct this condition.
2841
2842.. _ref-classes-utility-tasks:
2843
2844``utility-tasks.bbclass``
2845=========================
2846
2847The ``utility-tasks`` class provides support for various "utility" type
2848tasks that are applicable to all recipes, such as
2849:ref:`ref-tasks-clean` and
2850:ref:`ref-tasks-listtasks`.
2851
2852This class is enabled by default because it is inherited by the
2853:ref:`base <ref-classes-base>` class.
2854
2855.. _ref-classes-utils:
2856
2857``utils.bbclass``
2858=================
2859
2860The ``utils`` class provides some useful Python functions that are
2861typically used in inline Python expressions (e.g. ``${@...}``). One
2862example use is for ``bb.utils.contains()``.
2863
2864This class is enabled by default because it is inherited by the
2865:ref:`base <ref-classes-base>` class.
2866
2867.. _ref-classes-vala:
2868
2869``vala.bbclass``
2870================
2871
2872The ``vala`` class supports recipes that need to build software written
2873using the Vala programming language.
2874
2875.. _ref-classes-waf:
2876
2877``waf.bbclass``
2878===============
2879
2880The ``waf`` class supports recipes that need to build software that uses
2881the Waf build system. You can use the
2882:term:`EXTRA_OECONF` or
2883:term:`PACKAGECONFIG_CONFARGS` variables
2884to specify additional configuration options to be passed on the Waf
2885command line.