Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2 | |
| 3 | ******* |
| 4 | Classes |
| 5 | ******* |
| 6 | |
| 7 | Class files are used to abstract common functionality and share it |
| 8 | amongst multiple recipe (``.bb``) files. To use a class file, you simply |
| 9 | make sure the recipe inherits the class. In most cases, when a recipe |
| 10 | inherits a class it is enough to enable its features. There are cases, |
| 11 | however, where in the recipe you might need to set variables or override |
| 12 | some default behavior. |
| 13 | |
| 14 | Any :term:`Metadata` usually found in a recipe can also be |
| 15 | placed in a class file. Class files are identified by the extension |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 16 | ``.bbclass`` and are usually placed in one of a set of subdirectories |
| 17 | beneath the ``meta*/`` directory found in the :term:`Source Directory`: |
| 18 | |
| 19 | - ``classes-recipe/`` - classes intended to be inherited by recipes |
| 20 | individually |
| 21 | - ``classes-global/`` - classes intended to be inherited globally |
| 22 | - ``classes/`` - classes whose usage context is not clearly defined |
| 23 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 24 | Class files can also be pointed to by |
| 25 | :term:`BUILDDIR` (e.g. ``build/``) in the same way as |
| 26 | ``.conf`` files in the ``conf`` directory. Class files are searched for |
| 27 | in :term:`BBPATH` using the same method by which ``.conf`` |
| 28 | files are searched. |
| 29 | |
| 30 | This chapter discusses only the most useful and important classes. Other |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 31 | classes do exist within the ``meta/classes*`` directories in the Source |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 32 | Directory. You can reference the ``.bbclass`` files directly for more |
| 33 | information. |
| 34 | |
| 35 | .. _ref-classes-allarch: |
| 36 | |
| 37 | ``allarch.bbclass`` |
| 38 | =================== |
| 39 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 40 | The :ref:`allarch <ref-classes-allarch>` class is inherited by recipes that do not produce |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 41 | architecture-specific output. The class disables functionality that is |
| 42 | normally needed for recipes that produce executable binaries (such as |
| 43 | building the cross-compiler and a C library as pre-requisites, and |
| 44 | splitting out of debug symbols during packaging). |
| 45 | |
| 46 | .. note:: |
| 47 | |
| 48 | Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that |
| 49 | produce packages that depend on tunings through use of the |
| 50 | :term:`RDEPENDS` and |
| 51 | :term:`TUNE_PKGARCH` variables, should never be |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 52 | configured for all architectures using :ref:`allarch <ref-classes-allarch>`. This is the case |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 53 | even if the recipes do not produce architecture-specific output. |
| 54 | |
| 55 | Configuring such recipes for all architectures causes the |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 56 | :ref:`do_package_write_* <ref-tasks-package_write_deb>` tasks to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 57 | have different signatures for the machines with different tunings. |
| 58 | Additionally, unnecessary rebuilds occur every time an image for a |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 59 | different :term:`MACHINE` is built even when the recipe never changes. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 60 | |
| 61 | By default, all recipes inherit the :ref:`base <ref-classes-base>` and |
| 62 | :ref:`package <ref-classes-package>` classes, which enable |
| 63 | functionality needed for recipes that produce executable output. If your |
| 64 | recipe, for example, only produces packages that contain configuration |
| 65 | files, media files, or scripts (e.g. Python and Perl), then it should |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 66 | inherit the :ref:`allarch <ref-classes-allarch>` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 67 | |
| 68 | .. _ref-classes-archiver: |
| 69 | |
| 70 | ``archiver.bbclass`` |
| 71 | ==================== |
| 72 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 73 | The :ref:`archiver <ref-classes-archiver>` class supports releasing source code and other |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 74 | materials with the binaries. |
| 75 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 76 | For more details on the source :ref:`archiver <ref-classes-archiver>`, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 77 | ":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 78 | section in the Yocto Project Development Tasks Manual. You can also see |
| 79 | the :term:`ARCHIVER_MODE` variable for information |
| 80 | about the variable flags (varflags) that help control archive creation. |
| 81 | |
| 82 | .. _ref-classes-autotools: |
| 83 | |
| 84 | ``autotools*.bbclass`` |
| 85 | ====================== |
| 86 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 87 | The :ref:`autotools* <ref-classes-autotools>` classes support packages built with the |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 88 | :wikipedia:`GNU Autotools <GNU_Autotools>`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 89 | |
| 90 | The ``autoconf``, ``automake``, and ``libtool`` packages bring |
| 91 | standardization. This class defines a set of tasks (e.g. ``configure``, |
| 92 | ``compile`` and so forth) that work for all Autotooled packages. It |
| 93 | should usually be enough to define a few standard variables and then |
| 94 | simply ``inherit autotools``. These classes can also work with software |
| 95 | that emulates Autotools. For more information, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 96 | ":ref:`dev-manual/common-tasks:autotooled package`" section |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 97 | in the Yocto Project Development Tasks Manual. |
| 98 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 99 | By default, the :ref:`autotools* <ref-classes-autotools>` classes use out-of-tree builds (i.e. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 100 | ``autotools.bbclass`` building with ``B != S``). |
| 101 | |
| 102 | If the software being built by a recipe does not support using |
| 103 | out-of-tree builds, you should have the recipe inherit the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 104 | :ref:`autotools-brokensep <ref-classes-autotools>` class. The :ref:`autotools-brokensep <ref-classes-autotools>` class behaves |
| 105 | the same as the :ref:`autotools <ref-classes-autotools>` class but builds with :term:`B` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 106 | == :term:`S`. This method is useful when out-of-tree build |
| 107 | support is either not present or is broken. |
| 108 | |
| 109 | .. note:: |
| 110 | |
| 111 | It is recommended that out-of-tree support be fixed and used if at |
| 112 | all possible. |
| 113 | |
| 114 | It's useful to have some idea of how the tasks defined by the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 115 | :ref:`autotools* <ref-classes-autotools>` classes work and what they do behind the scenes. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 116 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 117 | - :ref:`ref-tasks-configure` --- regenerates the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 118 | configure script (using ``autoreconf``) and then launches it with a |
| 119 | standard set of arguments used during cross-compilation. You can pass |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 120 | additional parameters to ``configure`` through the :term:`EXTRA_OECONF` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 121 | or :term:`PACKAGECONFIG_CONFARGS` |
| 122 | variables. |
| 123 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 124 | - :ref:`ref-tasks-compile` --- runs ``make`` with |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 125 | arguments that specify the compiler and linker. You can pass |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 126 | additional arguments through the :term:`EXTRA_OEMAKE` variable. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 127 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 128 | - :ref:`ref-tasks-install` --- runs ``make install`` and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 129 | passes in ``${``\ :term:`D`\ ``}`` as ``DESTDIR``. |
| 130 | |
| 131 | .. _ref-classes-base: |
| 132 | |
| 133 | ``base.bbclass`` |
| 134 | ================ |
| 135 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 136 | The :ref:`base <ref-classes-base>` class is special in that every ``.bb`` file implicitly |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 137 | inherits the class. This class contains definitions for standard basic |
| 138 | tasks such as fetching, unpacking, configuring (empty by default), |
| 139 | compiling (runs any ``Makefile`` present), installing (empty by default) |
| 140 | and packaging (empty by default). These classes are often overridden or |
| 141 | extended by other classes such as the |
| 142 | :ref:`autotools <ref-classes-autotools>` class or the |
| 143 | :ref:`package <ref-classes-package>` class. |
| 144 | |
| 145 | The class also contains some commonly used functions such as |
| 146 | ``oe_runmake``, which runs ``make`` with the arguments specified in |
| 147 | :term:`EXTRA_OEMAKE` variable as well as the |
| 148 | arguments passed directly to ``oe_runmake``. |
| 149 | |
| 150 | .. _ref-classes-bash-completion: |
| 151 | |
| 152 | ``bash-completion.bbclass`` |
| 153 | =========================== |
| 154 | |
| 155 | Sets up packaging and dependencies appropriate for recipes that build |
| 156 | software that includes bash-completion data. |
| 157 | |
| 158 | .. _ref-classes-bin-package: |
| 159 | |
| 160 | ``bin_package.bbclass`` |
| 161 | ======================= |
| 162 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 163 | The :ref:`bin_package <ref-classes-bin-package>` class is a helper class for recipes that extract the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 164 | contents of a binary package (e.g. an RPM) and install those contents |
| 165 | rather than building the binary from source. The binary package is |
| 166 | extracted and new packages in the configured output package format are |
| 167 | created. Extraction and installation of proprietary binaries is a good |
| 168 | example use for this class. |
| 169 | |
| 170 | .. note:: |
| 171 | |
| 172 | For RPMs and other packages that do not contain a subdirectory, you |
| 173 | should specify an appropriate fetcher parameter to point to the |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 174 | subdirectory. For example, if BitBake is using the Git fetcher (``git://``), |
| 175 | the "subpath" parameter limits the checkout to a specific subpath |
| 176 | of the tree. Here is an example where ``${BP}`` is used so that the files |
| 177 | are extracted into the subdirectory expected by the default value of |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 178 | :term:`S`:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 179 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 180 | SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=main;subpath=${BP}" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 181 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 182 | See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for |
| 183 | more information on supported BitBake Fetchers. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 184 | |
| 185 | .. _ref-classes-binconfig: |
| 186 | |
| 187 | ``binconfig.bbclass`` |
| 188 | ===================== |
| 189 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 190 | The :ref:`binconfig <ref-classes-binconfig>` class helps to correct paths in shell scripts. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 191 | |
| 192 | Before ``pkg-config`` had become widespread, libraries shipped shell |
| 193 | scripts to give information about the libraries and include paths needed |
| 194 | to build software (usually named ``LIBNAME-config``). This class assists |
| 195 | any recipe using such scripts. |
| 196 | |
| 197 | During staging, the OpenEmbedded build system installs such scripts into |
| 198 | the ``sysroots/`` directory. Inheriting this class results in all paths |
| 199 | in these scripts being changed to point into the ``sysroots/`` directory |
| 200 | so that all builds that use the script use the correct directories for |
| 201 | the cross compiling layout. See the |
| 202 | :term:`BINCONFIG_GLOB` variable for more |
| 203 | information. |
| 204 | |
| 205 | .. _ref-classes-binconfig-disabled: |
| 206 | |
| 207 | ``binconfig-disabled.bbclass`` |
| 208 | ============================== |
| 209 | |
| 210 | An alternative version of the :ref:`binconfig <ref-classes-binconfig>` |
| 211 | class, which disables binary configuration scripts by making them return |
| 212 | an error in favor of using ``pkg-config`` to query the information. The |
| 213 | scripts to be disabled should be specified using the |
| 214 | :term:`BINCONFIG` variable within the recipe inheriting |
| 215 | the class. |
| 216 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 217 | .. _ref-classes-buildhistory: |
| 218 | |
| 219 | ``buildhistory.bbclass`` |
| 220 | ======================== |
| 221 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 222 | The :ref:`buildhistory <ref-classes-buildhistory>` class records a history of build output metadata, |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 223 | which can be used to detect possible regressions as well as used for |
| 224 | analysis of the build output. For more information on using Build |
| 225 | History, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 226 | ":ref:`dev-manual/common-tasks:maintaining build output quality`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 227 | section in the Yocto Project Development Tasks Manual. |
| 228 | |
| 229 | .. _ref-classes-buildstats: |
| 230 | |
| 231 | ``buildstats.bbclass`` |
| 232 | ====================== |
| 233 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 234 | The :ref:`buildstats <ref-classes-buildstats>` class records performance statistics about each task |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 235 | executed during the build (e.g. elapsed time, CPU usage, and I/O usage). |
| 236 | |
| 237 | When you use this class, the output goes into the |
| 238 | :term:`BUILDSTATS_BASE` directory, which defaults |
| 239 | to ``${TMPDIR}/buildstats/``. You can analyze the elapsed time using |
| 240 | ``scripts/pybootchartgui/pybootchartgui.py``, which produces a cascading |
| 241 | chart of the entire build process and can be useful for highlighting |
| 242 | bottlenecks. |
| 243 | |
| 244 | Collecting build statistics is enabled by default through the |
| 245 | :term:`USER_CLASSES` variable from your |
| 246 | ``local.conf`` file. Consequently, you do not have to do anything to |
| 247 | enable the class. However, if you want to disable the class, simply |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 248 | remove ":ref:`buildstats <ref-classes-buildstats>`" from the :term:`USER_CLASSES` list. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 249 | |
| 250 | .. _ref-classes-buildstats-summary: |
| 251 | |
| 252 | ``buildstats-summary.bbclass`` |
| 253 | ============================== |
| 254 | |
| 255 | When inherited globally, prints statistics at the end of the build on |
| 256 | sstate re-use. In order to function, this class requires the |
| 257 | :ref:`buildstats <ref-classes-buildstats>` class be enabled. |
| 258 | |
| 259 | .. _ref-classes-ccache: |
| 260 | |
| 261 | ``ccache.bbclass`` |
| 262 | ================== |
| 263 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 264 | The :ref:`ccache <ref-classes-ccache>` class enables the C/C++ Compiler Cache for the build. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 265 | This class is used to give a minor performance boost during the build. |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 266 | |
| 267 | See https://ccache.samba.org/ for information on the C/C++ Compiler |
| 268 | Cache, and the :oe_git:`ccache.bbclass </openembedded-core/tree/meta/classes/ccache.bbclass>` |
| 269 | file for details about how to enable this mechanism in your configuration |
| 270 | file, how to disable it for specific recipes, and how to share ``ccache`` |
| 271 | files between builds. |
| 272 | |
| 273 | However, using the class can lead to unexpected side-effects. Thus, using |
| 274 | this class is not recommended. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 275 | |
| 276 | .. _ref-classes-chrpath: |
| 277 | |
| 278 | ``chrpath.bbclass`` |
| 279 | =================== |
| 280 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 281 | The :ref:`chrpath <ref-classes-chrpath>` class is a wrapper around the "chrpath" utility, which |
| 282 | is used during the build process for :ref:`nativesdk <ref-classes-nativesdk>`, :ref:`cross <ref-classes-cross>`, and |
| 283 | :ref:`cross-canadian <ref-classes-cross-canadian>` recipes to change ``RPATH`` records within binaries |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 284 | in order to make them relocatable. |
| 285 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 286 | .. _ref-classes-cmake: |
| 287 | |
| 288 | ``cmake.bbclass`` |
| 289 | ================= |
| 290 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 291 | The ref:`cmake <ref-classes-cmake>` class allows for recipes that need to build software using |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 292 | the `CMake <https://cmake.org/overview/>`__ build system. You can use |
| 293 | the :term:`EXTRA_OECMAKE` variable to specify |
| 294 | additional configuration options to be passed using the ``cmake`` |
| 295 | command line. |
| 296 | |
| 297 | On the occasion that you would be installing custom CMake toolchain |
| 298 | files supplied by the application being built, you should install them |
| 299 | to the preferred CMake Module directory: ``${D}${datadir}/cmake/`` |
| 300 | Modules during |
| 301 | :ref:`ref-tasks-install`. |
| 302 | |
| 303 | .. _ref-classes-cml1: |
| 304 | |
| 305 | ``cml1.bbclass`` |
| 306 | ================ |
| 307 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 308 | The :ref:`cml1 <ref-classes-cml1>` class provides basic support for the Linux kernel style |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 309 | build configuration system. |
| 310 | |
| 311 | .. _ref-classes-compress_doc: |
| 312 | |
| 313 | ``compress_doc.bbclass`` |
| 314 | ======================== |
| 315 | |
| 316 | Enables compression for man pages and info pages. This class is intended |
| 317 | to be inherited globally. The default compression mechanism is gz (gzip) |
| 318 | but you can select an alternative mechanism by setting the |
| 319 | :term:`DOC_COMPRESS` variable. |
| 320 | |
| 321 | .. _ref-classes-copyleft_compliance: |
| 322 | |
| 323 | ``copyleft_compliance.bbclass`` |
| 324 | =============================== |
| 325 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 326 | The :ref:`copyleft_compliance <ref-classes-copyleft_compliance>` class preserves source code for the purposes |
| 327 | of license compliance. This class is an alternative to the :ref:`archiver <ref-classes-archiver>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 328 | class and is still used by some users even though it has been deprecated |
| 329 | in favor of the :ref:`archiver <ref-classes-archiver>` class. |
| 330 | |
| 331 | .. _ref-classes-copyleft_filter: |
| 332 | |
| 333 | ``copyleft_filter.bbclass`` |
| 334 | =========================== |
| 335 | |
| 336 | A class used by the :ref:`archiver <ref-classes-archiver>` and |
| 337 | :ref:`copyleft_compliance <ref-classes-copyleft_compliance>` classes |
| 338 | for filtering licenses. The ``copyleft_filter`` class is an internal |
| 339 | class and is not intended to be used directly. |
| 340 | |
| 341 | .. _ref-classes-core-image: |
| 342 | |
| 343 | ``core-image.bbclass`` |
| 344 | ====================== |
| 345 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 346 | The :ref:`core-image <ref-classes-core-image>` class provides common definitions for the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 347 | ``core-image-*`` image recipes, such as support for additional |
| 348 | :term:`IMAGE_FEATURES`. |
| 349 | |
| 350 | .. _ref-classes-cpan: |
| 351 | |
| 352 | ``cpan*.bbclass`` |
| 353 | ================= |
| 354 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 355 | The :ref:`cpan* <ref-classes-cpan>` classes support Perl modules. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 356 | |
| 357 | Recipes for Perl modules are simple. These recipes usually only need to |
| 358 | point to the source's archive and then inherit the proper class file. |
| 359 | Building is split into two methods depending on which method the module |
| 360 | authors used. |
| 361 | |
| 362 | - Modules that use old ``Makefile.PL``-based build system require |
| 363 | ``cpan.bbclass`` in their recipes. |
| 364 | |
| 365 | - Modules that use ``Build.PL``-based build system require using |
| 366 | ``cpan_build.bbclass`` in their recipes. |
| 367 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 368 | Both build methods inherit the :ref:`cpan-base <ref-classes-cpan>` class for basic Perl |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 369 | support. |
| 370 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 371 | .. _ref-classes-create-spdx: |
| 372 | |
| 373 | ``create-spdx.bbclass`` |
| 374 | ======================= |
| 375 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 376 | The :ref:`create-spdx <ref-classes-create-spdx>` class provides support for |
| 377 | automatically creating :term:`SPDX` :term:`SBOM` documents based upon image |
| 378 | and SDK contents. |
| 379 | |
| 380 | This class is meant to be inherited globally from a configuration file:: |
| 381 | |
| 382 | INHERIT += "create-spdx" |
| 383 | |
| 384 | The toplevel :term:`SPDX` output file is generated in JSON format as a |
| 385 | ``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the |
| 386 | :term:`Build Directory`. There are other related files in the same directory, |
| 387 | as well as in ``tmp/deploy/spdx``. |
| 388 | |
| 389 | The exact behaviour of this class, and the amount of output can be controlled |
| 390 | by the :term:`SPDX_PRETTY`, :term:`SPDX_ARCHIVE_PACKAGED`, |
| 391 | :term:`SPDX_ARCHIVE_SOURCES` and :term:`SPDX_INCLUDE_SOURCES` variables. |
| 392 | |
| 393 | See the description of these variables and the |
| 394 | ":ref:`dev-manual/common-tasks:creating a software bill of materials`" |
| 395 | section in the Yocto Project Development Manual for more details. |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 396 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 397 | .. _ref-classes-cross: |
| 398 | |
| 399 | ``cross.bbclass`` |
| 400 | ================= |
| 401 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 402 | The :ref:`cross <ref-classes-cross>` class provides support for the recipes that build the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 403 | cross-compilation tools. |
| 404 | |
| 405 | .. _ref-classes-cross-canadian: |
| 406 | |
| 407 | ``cross-canadian.bbclass`` |
| 408 | ========================== |
| 409 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 410 | The :ref:`cross-canadian <ref-classes-cross-canadian>` class provides support for the recipes that build |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 411 | the Canadian Cross-compilation tools for SDKs. See the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 412 | ":ref:`overview-manual/concepts:cross-development toolchain generation`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 413 | section in the Yocto Project Overview and Concepts Manual for more |
| 414 | discussion on these cross-compilation tools. |
| 415 | |
| 416 | .. _ref-classes-crosssdk: |
| 417 | |
| 418 | ``crosssdk.bbclass`` |
| 419 | ==================== |
| 420 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 421 | The :ref:`crosssdk <ref-classes-crosssdk>` class provides support for the recipes that build the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 422 | cross-compilation tools used for building SDKs. See the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 423 | ":ref:`overview-manual/concepts:cross-development toolchain generation`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 424 | section in the Yocto Project Overview and Concepts Manual for more |
| 425 | discussion on these cross-compilation tools. |
| 426 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 427 | .. _ref-classes-cve-check: |
| 428 | |
| 429 | ``cve-check.bbclass`` |
| 430 | ===================== |
| 431 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 432 | The :ref:`cve-check <ref-classes-cve-check>` class looks for known CVEs (Common Vulnerabilities |
| 433 | and Exposures) while building with BitBake. This class is meant to be |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 434 | inherited globally from a configuration file:: |
| 435 | |
| 436 | INHERIT += "cve-check" |
| 437 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 438 | To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core, |
| 439 | add following line to the build configuration file:: |
| 440 | |
| 441 | include cve-extra-exclusions.inc |
| 442 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 443 | You can also look for vulnerabilities in specific packages by passing |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 444 | ``-c cve_check`` to BitBake. |
| 445 | |
| 446 | After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve`` |
| 447 | and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files. |
| 448 | |
| 449 | When building, the CVE checker will emit build time warnings for any detected |
| 450 | issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component |
| 451 | and version being compiled and no patches to address the issue are applied. Other states |
| 452 | for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already |
| 453 | applied, and ``Ignored`` meaning that the issue can be ignored. |
| 454 | |
| 455 | The ``Patched`` state of a CVE issue is detected from patch files with the format |
| 456 | ``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using |
| 457 | CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file. |
| 458 | |
| 459 | If the recipe lists the ``CVE-ID`` in :term:`CVE_CHECK_IGNORE` variable, then the CVE state is reported |
| 460 | as ``Ignored``. Multiple CVEs can be listed separated by spaces. Example:: |
| 461 | |
| 462 | CVE_CHECK_IGNORE += "CVE-2020-29509 CVE-2020-29511" |
| 463 | |
| 464 | If CVE check reports that a recipe contains false positives or false negatives, these may be |
| 465 | fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables. |
| 466 | :term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE |
| 467 | database vendor and product pairs using the syntax:: |
| 468 | |
| 469 | CVE_PRODUCT = "flex_project:flex" |
| 470 | |
| 471 | where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly |
| 472 | if the default recipe version :term:`PV` does not match the version numbers of the software component |
| 473 | in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the |
| 474 | CVE database compatible version number, for example:: |
| 475 | |
| 476 | CVE_VERSION = "2.39" |
| 477 | |
| 478 | Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database |
| 479 | via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__. |
| 480 | |
| 481 | Users should note that security is a process, not a product, and thus also CVE checking, analyzing results, |
| 482 | patching and updating the software should be done as a regular process. The data and assumptions |
| 483 | required for CVE checker to reliably detect issues are frequently broken in various ways. |
| 484 | These can only be detected by reviewing the details of the issues and iterating over the generated reports, |
| 485 | and following what happens in other Linux distributions and in the greater open source community. |
| 486 | |
| 487 | You will find some more details in the |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 488 | ":ref:`dev-manual/common-tasks:checking for vulnerabilities`" |
| 489 | section in the Development Tasks Manual. |
| 490 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 491 | .. _ref-classes-debian: |
| 492 | |
| 493 | ``debian.bbclass`` |
| 494 | ================== |
| 495 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 496 | The :ref:`debian <ref-classes-debian>` class renames output packages so that they follow the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 497 | Debian naming policy (i.e. ``glibc`` becomes ``libc6`` and |
| 498 | ``glibc-devel`` becomes ``libc6-dev``.) Renaming includes the library |
| 499 | name and version as part of the package name. |
| 500 | |
| 501 | If a recipe creates packages for multiple libraries (shared object files |
| 502 | of ``.so`` type), use the :term:`LEAD_SONAME` |
| 503 | variable in the recipe to specify the library on which to apply the |
| 504 | naming scheme. |
| 505 | |
| 506 | .. _ref-classes-deploy: |
| 507 | |
| 508 | ``deploy.bbclass`` |
| 509 | ================== |
| 510 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 511 | The :ref:`deploy <ref-classes-deploy>` class handles deploying files to the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 512 | :term:`DEPLOY_DIR_IMAGE` directory. The main |
| 513 | function of this class is to allow the deploy step to be accelerated by |
| 514 | shared state. Recipes that inherit this class should define their own |
| 515 | :ref:`ref-tasks-deploy` function to copy the files to be |
| 516 | deployed to :term:`DEPLOYDIR`, and use ``addtask`` to |
| 517 | add the task at the appropriate place, which is usually after |
| 518 | :ref:`ref-tasks-compile` or |
| 519 | :ref:`ref-tasks-install`. The class then takes care of |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 520 | staging the files from :term:`DEPLOYDIR` to :term:`DEPLOY_DIR_IMAGE`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 521 | |
| 522 | .. _ref-classes-devshell: |
| 523 | |
| 524 | ``devshell.bbclass`` |
| 525 | ==================== |
| 526 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 527 | The :ref:`devshell <ref-classes-devshell>` class adds the :ref:`ref-tasks-devshell` task. Distribution |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 528 | policy dictates whether to include this class. See the ":ref:`dev-manual/common-tasks:using a development shell`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 529 | section in the Yocto Project Development Tasks Manual for more |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 530 | information about using :ref:`devshell <ref-classes-devshell>`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 531 | |
| 532 | .. _ref-classes-devupstream: |
| 533 | |
| 534 | ``devupstream.bbclass`` |
| 535 | ======================= |
| 536 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 537 | The :ref:`devupstream <ref-classes-devupstream>` class uses |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 538 | :term:`BBCLASSEXTEND` to add a variant of the |
| 539 | recipe that fetches from an alternative URI (e.g. Git) instead of a |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 540 | tarball. Following is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 541 | |
| 542 | BBCLASSEXTEND = "devupstream:target" |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 543 | SRC_URI:class-devupstream = "git://git.example.com/example;branch=main" |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 544 | SRCREV:class-devupstream = "abcd1234" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 545 | |
| 546 | Adding the above statements to your recipe creates a variant that has |
| 547 | :term:`DEFAULT_PREFERENCE` set to "-1". |
| 548 | Consequently, you need to select the variant of the recipe to use it. |
| 549 | Any development-specific adjustments can be done by using the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 550 | ``class-devupstream`` override. Here is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 551 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 552 | DEPENDS:append:class-devupstream = " gperf-native" |
| 553 | do_configure:prepend:class-devupstream() { |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 554 | touch ${S}/README |
| 555 | } |
| 556 | |
| 557 | The class |
| 558 | currently only supports creating a development variant of the target |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 559 | recipe, not :ref:`native <ref-classes-native>` or :ref:`nativesdk <ref-classes-nativesdk>` variants. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 560 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 561 | The :term:`BBCLASSEXTEND` syntax (i.e. ``devupstream:target``) provides |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 562 | support for :ref:`native <ref-classes-native>` and :ref:`nativesdk <ref-classes-nativesdk>` variants. Consequently, this |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 563 | functionality can be added in a future release. |
| 564 | |
| 565 | Support for other version control systems such as Subversion is limited |
| 566 | due to BitBake's automatic fetch dependencies (e.g. |
| 567 | ``subversion-native``). |
| 568 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 569 | .. _ref-classes-externalsrc: |
| 570 | |
| 571 | ``externalsrc.bbclass`` |
| 572 | ======================= |
| 573 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 574 | The :ref:`externalsrc <ref-classes-externalsrc>` class supports building software from source code |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 575 | that is external to the OpenEmbedded build system. Building software |
| 576 | from an external source tree means that the build system's normal fetch, |
| 577 | unpack, and patch process is not used. |
| 578 | |
| 579 | By default, the OpenEmbedded build system uses the :term:`S` |
| 580 | and :term:`B` variables to locate unpacked recipe source code |
| 581 | and to build it, respectively. When your recipe inherits the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 582 | :ref:`externalsrc <ref-classes-externalsrc>` class, you use the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 583 | :term:`EXTERNALSRC` and |
| 584 | :term:`EXTERNALSRC_BUILD` variables to |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 585 | ultimately define :term:`S` and :term:`B`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 586 | |
| 587 | By default, this class expects the source code to support recipe builds |
| 588 | that use the :term:`B` variable to point to the directory in |
| 589 | which the OpenEmbedded build system places the generated objects built |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 590 | from the recipes. By default, the :term:`B` directory is set to the |
| 591 | following, which is separate from the source directory (:term:`S`):: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 592 | |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 593 | ${WORKDIR}/${BPN}-{PV}/ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 594 | |
| 595 | See these variables for more information: |
| 596 | :term:`WORKDIR`, :term:`BPN`, and |
| 597 | :term:`PV`, |
| 598 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 599 | For more information on the :ref:`externalsrc <ref-classes-externalsrc>` class, see the comments in |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 600 | ``meta/classes/externalsrc.bbclass`` in the :term:`Source Directory`. |
| 601 | For information on how to use the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 602 | :ref:`externalsrc <ref-classes-externalsrc>` class, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 603 | ":ref:`dev-manual/common-tasks:building software from an external source`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 604 | section in the Yocto Project Development Tasks Manual. |
| 605 | |
| 606 | .. _ref-classes-extrausers: |
| 607 | |
| 608 | ``extrausers.bbclass`` |
| 609 | ====================== |
| 610 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 611 | The :ref:`extrausers <ref-classes-extrausers>` class allows additional user and group configuration |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 612 | to be applied at the image level. Inheriting this class either globally |
| 613 | or from an image recipe allows additional user and group operations to |
| 614 | be performed using the |
| 615 | :term:`EXTRA_USERS_PARAMS` variable. |
| 616 | |
| 617 | .. note:: |
| 618 | |
| 619 | The user and group operations added using the |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 620 | :ref:`extrausers <ref-classes-extrausers>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 621 | class are not tied to a specific recipe outside of the recipe for the |
| 622 | image. Thus, the operations can be performed across the image as a |
| 623 | whole. Use the |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 624 | :ref:`useradd <ref-classes-useradd>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 625 | class to add user and group configuration to a specific recipe. |
| 626 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 627 | Here is an example that uses this class in an image recipe:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 628 | |
| 629 | inherit extrausers |
| 630 | EXTRA_USERS_PARAMS = "\ |
| 631 | useradd -p '' tester; \ |
| 632 | groupadd developers; \ |
| 633 | userdel nobody; \ |
| 634 | groupdel -g video; \ |
| 635 | groupmod -g 1020 developers; \ |
| 636 | usermod -s /bin/sh tester; \ |
| 637 | " |
| 638 | |
| 639 | Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 640 | passwords. First on host, create the (escaped) password hash:: |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 641 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 642 | printf "%q" $(mkpasswd -m sha256crypt tester01) |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 643 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 644 | The resulting hash is set to a variable and used in ``useradd`` command parameters:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 645 | |
| 646 | inherit extrausers |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 647 | PASSWD = "\$X\$ABC123\$A-Long-Hash" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 648 | EXTRA_USERS_PARAMS = "\ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 649 | useradd -p '${PASSWD}' tester-jim; \ |
| 650 | useradd -p '${PASSWD}' tester-sue; \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 651 | " |
| 652 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 653 | Finally, here is an example that sets the root password:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 654 | |
| 655 | inherit extrausers |
| 656 | EXTRA_USERS_PARAMS = "\ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 657 | usermod -p '${PASSWD}' root; \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 658 | " |
| 659 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 660 | .. note:: |
| 661 | |
| 662 | From a security perspective, hardcoding a default password is not |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 663 | generally a good idea or even legal in some jurisdictions. It is |
| 664 | recommended that you do not do this if you are building a production |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 665 | image. |
| 666 | |
| 667 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 668 | .. _ref-classes-features_check: |
| 669 | |
| 670 | ``features_check.bbclass`` |
| 671 | ================================= |
| 672 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 673 | The :ref:`features_check <ref-classes-features_check>` class allows individual recipes to check |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 674 | for required and conflicting |
| 675 | :term:`DISTRO_FEATURES`, :term:`MACHINE_FEATURES` or :term:`COMBINED_FEATURES`. |
| 676 | |
| 677 | This class provides support for the following variables: |
| 678 | |
| 679 | - :term:`REQUIRED_DISTRO_FEATURES` |
| 680 | - :term:`CONFLICT_DISTRO_FEATURES` |
| 681 | - :term:`ANY_OF_DISTRO_FEATURES` |
| 682 | - ``REQUIRED_MACHINE_FEATURES`` |
| 683 | - ``CONFLICT_MACHINE_FEATURES`` |
| 684 | - ``ANY_OF_MACHINE_FEATURES`` |
| 685 | - ``REQUIRED_COMBINED_FEATURES`` |
| 686 | - ``CONFLICT_COMBINED_FEATURES`` |
| 687 | - ``ANY_OF_COMBINED_FEATURES`` |
| 688 | |
| 689 | If any conditions specified in the recipe using the above |
| 690 | variables are not met, the recipe will be skipped, and if the |
| 691 | build system attempts to build the recipe then an error will be |
| 692 | triggered. |
| 693 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 694 | .. _ref-classes-fontcache: |
| 695 | |
| 696 | ``fontcache.bbclass`` |
| 697 | ===================== |
| 698 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 699 | The :ref:`fontcache <ref-classes-fontcache>` class generates the proper post-install and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 700 | post-remove (postinst and postrm) scriptlets for font packages. These |
| 701 | scriptlets call ``fc-cache`` (part of ``Fontconfig``) to add the fonts |
| 702 | to the font information cache. Since the cache files are |
| 703 | architecture-specific, ``fc-cache`` runs using QEMU if the postinst |
| 704 | scriptlets need to be run on the build host during image creation. |
| 705 | |
| 706 | If the fonts being installed are in packages other than the main |
| 707 | package, set :term:`FONT_PACKAGES` to specify the |
| 708 | packages containing the fonts. |
| 709 | |
| 710 | .. _ref-classes-fs-uuid: |
| 711 | |
| 712 | ``fs-uuid.bbclass`` |
| 713 | =================== |
| 714 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 715 | The :ref:`fs-uuid <ref-classes-fs-uuid>` class extracts UUID from |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 716 | ``${``\ :term:`ROOTFS`\ ``}``, which must have been built |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 717 | by the time that this function gets called. The :ref:`fs-uuid <ref-classes-fs-uuid>` class only |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 718 | works on ``ext`` file systems and depends on ``tune2fs``. |
| 719 | |
| 720 | .. _ref-classes-gconf: |
| 721 | |
| 722 | ``gconf.bbclass`` |
| 723 | ================= |
| 724 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 725 | The :ref:`gconf <ref-classes-gconf>` class provides common functionality for recipes that need |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 726 | to install GConf schemas. The schemas will be put into a separate |
| 727 | package (``${``\ :term:`PN`\ ``}-gconf``) that is created |
| 728 | automatically when this class is inherited. This package uses the |
| 729 | appropriate post-install and post-remove (postinst/postrm) scriptlets to |
| 730 | register and unregister the schemas in the target image. |
| 731 | |
| 732 | .. _ref-classes-gettext: |
| 733 | |
| 734 | ``gettext.bbclass`` |
| 735 | =================== |
| 736 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 737 | The :ref:`gettext <ref-classes-gettext>` class provides support for building software that uses |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 738 | the GNU ``gettext`` internationalization and localization system. All |
| 739 | recipes building software that use ``gettext`` should inherit this |
| 740 | class. |
| 741 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 742 | .. _ref-classes-github-releases: |
| 743 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 744 | ``github-releases.bbclass`` |
| 745 | =========================== |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 746 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 747 | For recipes that fetch release tarballs from github, the :ref:`github-releases <ref-classes-github-releases>` |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 748 | class sets up a standard way for checking available upstream versions |
| 749 | (to support ``devtool upgrade`` and the Automated Upgrade Helper (AUH)). |
| 750 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 751 | To use it, add ":ref:`github-releases <ref-classes-github-releases>`" to the inherit line in the recipe, |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 752 | and if the default value of :term:`GITHUB_BASE_URI` is not suitable, |
| 753 | then set your own value in the recipe. You should then use ``${GITHUB_BASE_URI}`` |
| 754 | in the value you set for :term:`SRC_URI` within the recipe. |
| 755 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 756 | .. _ref-classes-gnomebase: |
| 757 | |
| 758 | ``gnomebase.bbclass`` |
| 759 | ===================== |
| 760 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 761 | The :ref:`gnomebase <ref-classes-gnomebase>` class is the base class for recipes that build |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 762 | software from the GNOME stack. This class sets |
| 763 | :term:`SRC_URI` to download the source from the GNOME |
| 764 | mirrors as well as extending :term:`FILES` with the typical |
| 765 | GNOME installation paths. |
| 766 | |
| 767 | .. _ref-classes-gobject-introspection: |
| 768 | |
| 769 | ``gobject-introspection.bbclass`` |
| 770 | ================================= |
| 771 | |
| 772 | Provides support for recipes building software that supports GObject |
| 773 | introspection. This functionality is only enabled if the |
| 774 | "gobject-introspection-data" feature is in |
| 775 | :term:`DISTRO_FEATURES` as well as |
| 776 | "qemu-usermode" being in |
| 777 | :term:`MACHINE_FEATURES`. |
| 778 | |
| 779 | .. note:: |
| 780 | |
| 781 | This functionality is backfilled by default and, if not applicable, |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 782 | should be disabled through :term:`DISTRO_FEATURES_BACKFILL_CONSIDERED` or |
| 783 | :term:`MACHINE_FEATURES_BACKFILL_CONSIDERED`, respectively. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 784 | |
| 785 | .. _ref-classes-grub-efi: |
| 786 | |
| 787 | ``grub-efi.bbclass`` |
| 788 | ==================== |
| 789 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 790 | The :ref:`grub-efi <ref-classes-grub-efi>` class provides ``grub-efi``-specific functions for |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 791 | building bootable images. |
| 792 | |
| 793 | This class supports several variables: |
| 794 | |
| 795 | - :term:`INITRD`: Indicates list of filesystem images to |
| 796 | concatenate and use as an initial RAM disk (initrd) (optional). |
| 797 | |
| 798 | - :term:`ROOTFS`: Indicates a filesystem image to include |
| 799 | as the root filesystem (optional). |
| 800 | |
| 801 | - :term:`GRUB_GFXSERIAL`: Set this to "1" to have |
| 802 | graphics and serial in the boot menu. |
| 803 | |
| 804 | - :term:`LABELS`: A list of targets for the automatic |
| 805 | configuration. |
| 806 | |
| 807 | - :term:`APPEND`: An override list of append strings for |
| 808 | each ``LABEL``. |
| 809 | |
| 810 | - :term:`GRUB_OPTS`: Additional options to add to the |
| 811 | configuration (optional). Options are delimited using semi-colon |
| 812 | characters (``;``). |
| 813 | |
| 814 | - :term:`GRUB_TIMEOUT`: Timeout before executing |
| 815 | the default ``LABEL`` (optional). |
| 816 | |
| 817 | .. _ref-classes-gsettings: |
| 818 | |
| 819 | ``gsettings.bbclass`` |
| 820 | ===================== |
| 821 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 822 | The :ref:`gsettings <ref-classes-gsettings>` class provides common functionality for recipes that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 823 | need to install GSettings (glib) schemas. The schemas are assumed to be |
| 824 | part of the main package. Appropriate post-install and post-remove |
| 825 | (postinst/postrm) scriptlets are added to register and unregister the |
| 826 | schemas in the target image. |
| 827 | |
| 828 | .. _ref-classes-gtk-doc: |
| 829 | |
| 830 | ``gtk-doc.bbclass`` |
| 831 | =================== |
| 832 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 833 | The :ref:`gtk-doc <ref-classes-gtk-doc>` class is a helper class to pull in the appropriate |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 834 | ``gtk-doc`` dependencies and disable ``gtk-doc``. |
| 835 | |
| 836 | .. _ref-classes-gtk-icon-cache: |
| 837 | |
| 838 | ``gtk-icon-cache.bbclass`` |
| 839 | ========================== |
| 840 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 841 | The :ref:`gtk-icon-cache <ref-classes-gtk-icon-cache>` class generates the proper post-install and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 842 | post-remove (postinst/postrm) scriptlets for packages that use GTK+ and |
| 843 | install icons. These scriptlets call ``gtk-update-icon-cache`` to add |
| 844 | the fonts to GTK+'s icon cache. Since the cache files are |
| 845 | architecture-specific, ``gtk-update-icon-cache`` is run using QEMU if |
| 846 | the postinst scriptlets need to be run on the build host during image |
| 847 | creation. |
| 848 | |
| 849 | .. _ref-classes-gtk-immodules-cache: |
| 850 | |
| 851 | ``gtk-immodules-cache.bbclass`` |
| 852 | =============================== |
| 853 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 854 | The :ref:`gtk-immodules-cache <ref-classes-gtk-immodules-cache>` class generates the proper post-install and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 855 | post-remove (postinst/postrm) scriptlets for packages that install GTK+ |
| 856 | input method modules for virtual keyboards. These scriptlets call |
| 857 | ``gtk-update-icon-cache`` to add the input method modules to the cache. |
| 858 | Since the cache files are architecture-specific, |
| 859 | ``gtk-update-icon-cache`` is run using QEMU if the postinst scriptlets |
| 860 | need to be run on the build host during image creation. |
| 861 | |
| 862 | If the input method modules being installed are in packages other than |
| 863 | the main package, set |
| 864 | :term:`GTKIMMODULES_PACKAGES` to specify |
| 865 | the packages containing the modules. |
| 866 | |
| 867 | .. _ref-classes-gzipnative: |
| 868 | |
| 869 | ``gzipnative.bbclass`` |
| 870 | ====================== |
| 871 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 872 | The :ref:`gzipnative <ref-classes-gzipnative>` class enables the use of different native versions of |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 873 | ``gzip`` and ``pigz`` rather than the versions of these tools from the |
| 874 | build host. |
| 875 | |
| 876 | .. _ref-classes-icecc: |
| 877 | |
| 878 | ``icecc.bbclass`` |
| 879 | ================= |
| 880 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 881 | The :ref:`icecc <ref-classes-icecc>` class supports |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 882 | `Icecream <https://github.com/icecc/icecream>`__, which facilitates |
| 883 | taking compile jobs and distributing them among remote machines. |
| 884 | |
| 885 | The class stages directories with symlinks from ``gcc`` and ``g++`` to |
| 886 | ``icecc``, for both native and cross compilers. Depending on each |
| 887 | configure or compile, the OpenEmbedded build system adds the directories |
| 888 | at the head of the ``PATH`` list and then sets the ``ICECC_CXX`` and |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 889 | ``ICECC_CC`` variables, which are the paths to the ``g++`` and ``gcc`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 890 | compilers, respectively. |
| 891 | |
| 892 | For the cross compiler, the class creates a ``tar.gz`` file that |
| 893 | contains the Yocto Project toolchain and sets ``ICECC_VERSION``, which |
| 894 | is the version of the cross-compiler used in the cross-development |
| 895 | toolchain, accordingly. |
| 896 | |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 897 | The class handles all three different compile stages (i.e native, |
| 898 | cross-kernel and target) and creates the necessary environment |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 899 | ``tar.gz`` file to be used by the remote machines. The class also |
| 900 | supports SDK generation. |
| 901 | |
| 902 | If :term:`ICECC_PATH` is not set in your |
| 903 | ``local.conf`` file, then the class tries to locate the ``icecc`` binary |
| 904 | using ``which``. If :term:`ICECC_ENV_EXEC` is set |
| 905 | in your ``local.conf`` file, the variable should point to the |
| 906 | ``icecc-create-env`` script provided by the user. If you do not point to |
| 907 | a user-provided script, the build system uses the default script |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 908 | provided by the recipe :oe_git:`icecc-create-env_0.1.bb |
| 909 | </openembedded-core/tree/meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb>`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 910 | |
| 911 | .. note:: |
| 912 | |
| 913 | This script is a modified version and not the one that comes with |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 914 | ``icecream``. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 915 | |
| 916 | If you do not want the Icecream distributed compile support to apply to |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 917 | specific recipes or classes, you can ask them to be ignored by Icecream |
| 918 | by listing the recipes and classes using the |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 919 | :term:`ICECC_RECIPE_DISABLE` and |
| 920 | :term:`ICECC_CLASS_DISABLE` variables, |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 921 | respectively, in your ``local.conf`` file. Doing so causes the |
| 922 | OpenEmbedded build system to handle these compilations locally. |
| 923 | |
| 924 | Additionally, you can list recipes using the |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 925 | :term:`ICECC_RECIPE_ENABLE` variable in |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 926 | your ``local.conf`` file to force ``icecc`` to be enabled for recipes |
| 927 | using an empty :term:`PARALLEL_MAKE` variable. |
| 928 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 929 | Inheriting the :ref:`icecc <ref-classes-icecc>` class changes all sstate signatures. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 930 | Consequently, if a development team has a dedicated build system that |
| 931 | populates :term:`SSTATE_MIRRORS` and they want to |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 932 | reuse sstate from :term:`SSTATE_MIRRORS`, then all developers and the build |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 933 | system need to either inherit the :ref:`icecc <ref-classes-icecc>` class or nobody should. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 934 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 935 | At the distribution level, you can inherit the :ref:`icecc <ref-classes-icecc>` class to be |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 936 | sure that all builders start with the same sstate signatures. After |
| 937 | inheriting the class, you can then disable the feature by setting the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 938 | :term:`ICECC_DISABLED` variable to "1" as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 939 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 940 | INHERIT_DISTRO:append = " icecc" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 941 | ICECC_DISABLED ??= "1" |
| 942 | |
| 943 | This practice |
| 944 | makes sure everyone is using the same signatures but also requires |
| 945 | individuals that do want to use Icecream to enable the feature |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 946 | individually as follows in your ``local.conf`` file:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 947 | |
| 948 | ICECC_DISABLED = "" |
| 949 | |
| 950 | .. _ref-classes-image: |
| 951 | |
| 952 | ``image.bbclass`` |
| 953 | ================= |
| 954 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 955 | The :ref:`image <ref-classes-image>` class helps support creating images in different formats. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 956 | First, the root filesystem is created from packages using one of the |
| 957 | ``rootfs*.bbclass`` files (depending on the package format used) and |
| 958 | then one or more image files are created. |
| 959 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 960 | - The :term:`IMAGE_FSTYPES` variable controls the types of images to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 961 | generate. |
| 962 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 963 | - The :term:`IMAGE_INSTALL` variable controls the list of packages to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 964 | install into the image. |
| 965 | |
| 966 | For information on customizing images, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 967 | ":ref:`dev-manual/common-tasks:customizing images`" section |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 968 | in the Yocto Project Development Tasks Manual. For information on how |
| 969 | images are created, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 970 | ":ref:`overview-manual/concepts:images`" section in the |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 971 | Yocto Project Overview and Concepts Manual. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 972 | |
| 973 | .. _ref-classes-image-buildinfo: |
| 974 | |
| 975 | ``image-buildinfo.bbclass`` |
| 976 | =========================== |
| 977 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 978 | The :ref:`image-buildinfo <ref-classes-image-buildinfo>` class writes a plain text file containing |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 979 | build information to the target filesystem at ``${sysconfdir}/buildinfo`` |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 980 | by default (as specified by :term:`IMAGE_BUILDINFO_FILE`). |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 981 | This can be useful for manually determining the origin of any given |
| 982 | image. It writes out two sections: |
| 983 | |
| 984 | 1. `Build Configuration`: a list of variables and their values (specified |
| 985 | by :term:`IMAGE_BUILDINFO_VARS`, which defaults to :term:`DISTRO` and |
| 986 | :term:`DISTRO_VERSION`) |
| 987 | |
| 988 | 2. `Layer Revisions`: the revisions of all of the layers used in the |
| 989 | build. |
| 990 | |
| 991 | Additionally, when building an SDK it will write the same contents |
| 992 | to ``/buildinfo`` by default (as specified by |
| 993 | :term:`SDK_BUILDINFO_FILE`). |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 994 | |
| 995 | .. _ref-classes-image_types: |
| 996 | |
| 997 | ``image_types.bbclass`` |
| 998 | ======================= |
| 999 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1000 | The :ref:`image_types <ref-classes-image_types>` class defines all of the standard image output types |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1001 | that you can enable through the |
| 1002 | :term:`IMAGE_FSTYPES` variable. You can use this |
| 1003 | class as a reference on how to add support for custom image output |
| 1004 | types. |
| 1005 | |
| 1006 | By default, the :ref:`image <ref-classes-image>` class automatically |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1007 | enables the :ref:`image_types <ref-classes-image_types>` class. The :ref:`image <ref-classes-image>` class uses the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1008 | ``IMGCLASSES`` variable as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1009 | |
| 1010 | IMGCLASSES = "rootfs_${IMAGE_PKGTYPE} image_types ${IMAGE_CLASSES}" |
| 1011 | IMGCLASSES += "${@['populate_sdk_base', 'populate_sdk_ext']['linux' in d.getVar("SDK_OS")]}" |
| 1012 | IMGCLASSES += "${@bb.utils.contains_any('IMAGE_FSTYPES', 'live iso hddimg', 'image-live', '', d)}" |
| 1013 | IMGCLASSES += "${@bb.utils.contains('IMAGE_FSTYPES', 'container', 'image-container', '', d)}" |
| 1014 | IMGCLASSES += "image_types_wic" |
| 1015 | IMGCLASSES += "rootfs-postcommands" |
| 1016 | IMGCLASSES += "image-postinst-intercepts" |
| 1017 | inherit ${IMGCLASSES} |
| 1018 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1019 | The :ref:`image_types <ref-classes-image_types>` class also handles conversion and compression of images. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1020 | |
| 1021 | .. note:: |
| 1022 | |
| 1023 | To build a VMware VMDK image, you need to add "wic.vmdk" to |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1024 | :term:`IMAGE_FSTYPES`. This would also be similar for Virtual Box Virtual Disk |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1025 | Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1026 | |
| 1027 | .. _ref-classes-image-live: |
| 1028 | |
| 1029 | ``image-live.bbclass`` |
| 1030 | ====================== |
| 1031 | |
| 1032 | This class controls building "live" (i.e. HDDIMG and ISO) images. Live |
| 1033 | images contain syslinux for legacy booting, as well as the bootloader |
| 1034 | specified by :term:`EFI_PROVIDER` if |
| 1035 | :term:`MACHINE_FEATURES` contains "efi". |
| 1036 | |
| 1037 | Normally, you do not use this class directly. Instead, you add "live" to |
| 1038 | :term:`IMAGE_FSTYPES`. |
| 1039 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1040 | .. _ref-classes-insane: |
| 1041 | |
| 1042 | ``insane.bbclass`` |
| 1043 | ================== |
| 1044 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1045 | The :ref:`insane <ref-classes-insane>` class adds a step to the package generation process so |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1046 | that output quality assurance checks are generated by the OpenEmbedded |
| 1047 | build system. A range of checks are performed that check the build's |
| 1048 | output for common problems that show up during runtime. Distribution |
| 1049 | policy usually dictates whether to include this class. |
| 1050 | |
| 1051 | You can configure the sanity checks so that specific test failures |
| 1052 | either raise a warning or an error message. Typically, failures for new |
| 1053 | tests generate a warning. Subsequent failures for the same test would |
| 1054 | then generate an error message once the metadata is in a known and good |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1055 | condition. See the ":doc:`/ref-manual/qa-checks`" Chapter for a list of all the warning |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1056 | and error messages you might encounter using a default configuration. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1057 | |
| 1058 | Use the :term:`WARN_QA` and |
| 1059 | :term:`ERROR_QA` variables to control the behavior of |
| 1060 | these checks at the global level (i.e. in your custom distro |
| 1061 | configuration). However, to skip one or more checks in recipes, you |
| 1062 | should use :term:`INSANE_SKIP`. For example, to skip |
| 1063 | the check for symbolic link ``.so`` files in the main package of a |
| 1064 | recipe, add the following to the recipe. You need to realize that the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1065 | package name override, in this example ``${PN}``, must be used:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1066 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 1067 | INSANE_SKIP:${PN} += "dev-so" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1068 | |
| 1069 | Please keep in mind that the QA checks |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1070 | are meant to detect real or potential problems in the packaged |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1071 | output. So exercise caution when disabling these checks. |
| 1072 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1073 | Here are the tests you can list with the :term:`WARN_QA` and |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 1074 | :term:`ERROR_QA` variables: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1075 | |
| 1076 | - ``already-stripped:`` Checks that produced binaries have not |
| 1077 | already been stripped prior to the build system extracting debug |
| 1078 | symbols. It is common for upstream software projects to default to |
| 1079 | stripping debug symbols for output binaries. In order for debugging |
| 1080 | to work on the target using ``-dbg`` packages, this stripping must be |
| 1081 | disabled. |
| 1082 | |
| 1083 | - ``arch:`` Checks the Executable and Linkable Format (ELF) type, bit |
| 1084 | size, and endianness of any binaries to ensure they match the target |
| 1085 | architecture. This test fails if any binaries do not match the type |
| 1086 | since there would be an incompatibility. The test could indicate that |
| 1087 | the wrong compiler or compiler options have been used. Sometimes |
| 1088 | software, like bootloaders, might need to bypass this check. |
| 1089 | |
| 1090 | - ``buildpaths:`` Checks for paths to locations on the build host |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 1091 | inside the output files. Not only can these leak information about |
| 1092 | the build environment, they also hinder binary reproducibility. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1093 | |
| 1094 | - ``build-deps:`` Determines if a build-time dependency that is |
| 1095 | specified through :term:`DEPENDS`, explicit |
| 1096 | :term:`RDEPENDS`, or task-level dependencies exists |
| 1097 | to match any runtime dependency. This determination is particularly |
| 1098 | useful to discover where runtime dependencies are detected and added |
| 1099 | during packaging. If no explicit dependency has been specified within |
| 1100 | the metadata, at the packaging stage it is too late to ensure that |
| 1101 | the dependency is built, and thus you can end up with an error when |
| 1102 | the package is installed into the image during the |
| 1103 | :ref:`ref-tasks-rootfs` task because the auto-detected |
| 1104 | dependency was not satisfied. An example of this would be where the |
| 1105 | :ref:`update-rc.d <ref-classes-update-rc.d>` class automatically |
| 1106 | adds a dependency on the ``initscripts-functions`` package to |
| 1107 | packages that install an initscript that refers to |
| 1108 | ``/etc/init.d/functions``. The recipe should really have an explicit |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 1109 | :term:`RDEPENDS` for the package in question on ``initscripts-functions`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1110 | so that the OpenEmbedded build system is able to ensure that the |
| 1111 | ``initscripts`` recipe is actually built and thus the |
| 1112 | ``initscripts-functions`` package is made available. |
| 1113 | |
| 1114 | - ``compile-host-path:`` Checks the |
| 1115 | :ref:`ref-tasks-compile` log for indications that |
| 1116 | paths to locations on the build host were used. Using such paths |
| 1117 | might result in host contamination of the build output. |
| 1118 | |
| 1119 | - ``debug-deps:`` Checks that all packages except ``-dbg`` packages |
| 1120 | do not depend on ``-dbg`` packages, which would cause a packaging |
| 1121 | bug. |
| 1122 | |
| 1123 | - ``debug-files:`` Checks for ``.debug`` directories in anything but |
| 1124 | the ``-dbg`` package. The debug files should all be in the ``-dbg`` |
| 1125 | package. Thus, anything packaged elsewhere is incorrect packaging. |
| 1126 | |
| 1127 | - ``dep-cmp:`` Checks for invalid version comparison statements in |
| 1128 | runtime dependency relationships between packages (i.e. in |
| 1129 | :term:`RDEPENDS`, |
| 1130 | :term:`RRECOMMENDS`, |
| 1131 | :term:`RSUGGESTS`, |
| 1132 | :term:`RPROVIDES`, |
| 1133 | :term:`RREPLACES`, and |
| 1134 | :term:`RCONFLICTS` variable values). Any invalid |
| 1135 | comparisons might trigger failures or undesirable behavior when |
| 1136 | passed to the package manager. |
| 1137 | |
| 1138 | - ``desktop:`` Runs the ``desktop-file-validate`` program against any |
| 1139 | ``.desktop`` files to validate their contents against the |
| 1140 | specification for ``.desktop`` files. |
| 1141 | |
| 1142 | - ``dev-deps:`` Checks that all packages except ``-dev`` or |
| 1143 | ``-staticdev`` packages do not depend on ``-dev`` packages, which |
| 1144 | would be a packaging bug. |
| 1145 | |
| 1146 | - ``dev-so:`` Checks that the ``.so`` symbolic links are in the |
| 1147 | ``-dev`` package and not in any of the other packages. In general, |
| 1148 | these symlinks are only useful for development purposes. Thus, the |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1149 | ``-dev`` package is the correct location for them. In very rare |
| 1150 | cases, such as dynamically loaded modules, these symlinks |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1151 | are needed instead in the main package. |
| 1152 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 1153 | - ``empty-dirs:`` Checks that packages are not installing files to |
| 1154 | directories that are normally expected to be empty (such as ``/tmp``) |
| 1155 | The list of directories that are checked is specified by the |
| 1156 | :term:`QA_EMPTY_DIRS` variable. |
| 1157 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1158 | - ``file-rdeps:`` Checks that file-level dependencies identified by |
| 1159 | the OpenEmbedded build system at packaging time are satisfied. For |
| 1160 | example, a shell script might start with the line ``#!/bin/bash``. |
| 1161 | This line would translate to a file dependency on ``/bin/bash``. Of |
| 1162 | the three package managers that the OpenEmbedded build system |
| 1163 | supports, only RPM directly handles file-level dependencies, |
| 1164 | resolving them automatically to packages providing the files. |
| 1165 | However, the lack of that functionality in the other two package |
| 1166 | managers does not mean the dependencies do not still need resolving. |
| 1167 | This QA check attempts to ensure that explicitly declared |
| 1168 | :term:`RDEPENDS` exist to handle any file-level |
| 1169 | dependency detected in packaged files. |
| 1170 | |
| 1171 | - ``files-invalid:`` Checks for :term:`FILES` variable |
| 1172 | values that contain "//", which is invalid. |
| 1173 | |
| 1174 | - ``host-user-contaminated:`` Checks that no package produced by the |
| 1175 | recipe contains any files outside of ``/home`` with a user or group |
| 1176 | ID that matches the user running BitBake. A match usually indicates |
| 1177 | that the files are being installed with an incorrect UID/GID, since |
| 1178 | target IDs are independent from host IDs. For additional information, |
| 1179 | see the section describing the |
| 1180 | :ref:`ref-tasks-install` task. |
| 1181 | |
| 1182 | - ``incompatible-license:`` Report when packages are excluded from |
| 1183 | being created due to being marked with a license that is in |
| 1184 | :term:`INCOMPATIBLE_LICENSE`. |
| 1185 | |
| 1186 | - ``install-host-path:`` Checks the |
| 1187 | :ref:`ref-tasks-install` log for indications that |
| 1188 | paths to locations on the build host were used. Using such paths |
| 1189 | might result in host contamination of the build output. |
| 1190 | |
| 1191 | - ``installed-vs-shipped:`` Reports when files have been installed |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1192 | within :ref:`ref-tasks-install` but have not been included in any package by |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1193 | way of the :term:`FILES` variable. Files that do not |
| 1194 | appear in any package cannot be present in an image later on in the |
| 1195 | build process. Ideally, all installed files should be packaged or not |
| 1196 | installed at all. These files can be deleted at the end of |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1197 | :ref:`ref-tasks-install` if the files are not needed in any package. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1198 | |
| 1199 | - ``invalid-chars:`` Checks that the recipe metadata variables |
| 1200 | :term:`DESCRIPTION`, |
| 1201 | :term:`SUMMARY`, :term:`LICENSE`, and |
| 1202 | :term:`SECTION` do not contain non-UTF-8 characters. |
| 1203 | Some package managers do not support such characters. |
| 1204 | |
| 1205 | - ``invalid-packageconfig:`` Checks that no undefined features are |
| 1206 | being added to :term:`PACKAGECONFIG`. For |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1207 | example, any name "foo" for which the following form does not exist:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1208 | |
| 1209 | PACKAGECONFIG[foo] = "..." |
| 1210 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1211 | - ``la:`` Checks ``.la`` files for any :term:`TMPDIR` paths. Any ``.la`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1212 | file containing these paths is incorrect since ``libtool`` adds the |
| 1213 | correct sysroot prefix when using the files automatically itself. |
| 1214 | |
| 1215 | - ``ldflags:`` Ensures that the binaries were linked with the |
| 1216 | :term:`LDFLAGS` options provided by the build system. |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1217 | If this test fails, check that the :term:`LDFLAGS` variable is being |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1218 | passed to the linker command. |
| 1219 | |
| 1220 | - ``libdir:`` Checks for libraries being installed into incorrect |
| 1221 | (possibly hardcoded) installation paths. For example, this test will |
| 1222 | catch recipes that install ``/lib/bar.so`` when ``${base_libdir}`` is |
| 1223 | "lib32". Another example is when recipes install |
| 1224 | ``/usr/lib64/foo.so`` when ``${libdir}`` is "/usr/lib". |
| 1225 | |
| 1226 | - ``libexec:`` Checks if a package contains files in |
| 1227 | ``/usr/libexec``. This check is not performed if the ``libexecdir`` |
| 1228 | variable has been set explicitly to ``/usr/libexec``. |
| 1229 | |
| 1230 | - ``packages-list:`` Checks for the same package being listed |
| 1231 | multiple times through the :term:`PACKAGES` variable |
| 1232 | value. Installing the package in this manner can cause errors during |
| 1233 | packaging. |
| 1234 | |
| 1235 | - ``perm-config:`` Reports lines in ``fs-perms.txt`` that have an |
| 1236 | invalid format. |
| 1237 | |
| 1238 | - ``perm-line:`` Reports lines in ``fs-perms.txt`` that have an |
| 1239 | invalid format. |
| 1240 | |
| 1241 | - ``perm-link:`` Reports lines in ``fs-perms.txt`` that specify |
| 1242 | 'link' where the specified target already exists. |
| 1243 | |
| 1244 | - ``perms:`` Currently, this check is unused but reserved. |
| 1245 | |
| 1246 | - ``pkgconfig:`` Checks ``.pc`` files for any |
| 1247 | :term:`TMPDIR`/:term:`WORKDIR` paths. |
| 1248 | Any ``.pc`` file containing these paths is incorrect since |
| 1249 | ``pkg-config`` itself adds the correct sysroot prefix when the files |
| 1250 | are accessed. |
| 1251 | |
| 1252 | - ``pkgname:`` Checks that all packages in |
| 1253 | :term:`PACKAGES` have names that do not contain |
| 1254 | invalid characters (i.e. characters other than 0-9, a-z, ., +, and |
| 1255 | -). |
| 1256 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1257 | - ``pkgv-undefined:`` Checks to see if the :term:`PKGV` variable is |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1258 | undefined during :ref:`ref-tasks-package`. |
| 1259 | |
| 1260 | - ``pkgvarcheck:`` Checks through the variables |
| 1261 | :term:`RDEPENDS`, |
| 1262 | :term:`RRECOMMENDS`, |
| 1263 | :term:`RSUGGESTS`, |
| 1264 | :term:`RCONFLICTS`, |
| 1265 | :term:`RPROVIDES`, |
| 1266 | :term:`RREPLACES`, :term:`FILES`, |
| 1267 | :term:`ALLOW_EMPTY`, ``pkg_preinst``, |
| 1268 | ``pkg_postinst``, ``pkg_prerm`` and ``pkg_postrm``, and reports if |
| 1269 | there are variable sets that are not package-specific. Using these |
| 1270 | variables without a package suffix is bad practice, and might |
| 1271 | unnecessarily complicate dependencies of other packages within the |
| 1272 | same recipe or have other unintended consequences. |
| 1273 | |
| 1274 | - ``pn-overrides:`` Checks that a recipe does not have a name |
| 1275 | (:term:`PN`) value that appears in |
| 1276 | :term:`OVERRIDES`. If a recipe is named such that |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1277 | its :term:`PN` value matches something already in :term:`OVERRIDES` (e.g. |
| 1278 | :term:`PN` happens to be the same as :term:`MACHINE` or |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1279 | :term:`DISTRO`), it can have unexpected consequences. |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 1280 | For example, assignments such as ``FILES:${PN} = "xyz"`` effectively |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1281 | turn into ``FILES = "xyz"``. |
| 1282 | |
| 1283 | - ``rpaths:`` Checks for rpaths in the binaries that contain build |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 1284 | system paths such as :term:`TMPDIR`. If this test fails, bad ``-rpath`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1285 | options are being passed to the linker commands and your binaries |
| 1286 | have potential security issues. |
| 1287 | |
| 1288 | - ``split-strip:`` Reports that splitting or stripping debug symbols |
| 1289 | from binaries has failed. |
| 1290 | |
| 1291 | - ``staticdev:`` Checks for static library files (``*.a``) in |
| 1292 | non-``staticdev`` packages. |
| 1293 | |
| 1294 | - ``symlink-to-sysroot:`` Checks for symlinks in packages that point |
| 1295 | into :term:`TMPDIR` on the host. Such symlinks will |
| 1296 | work on the host, but are clearly invalid when running on the target. |
| 1297 | |
| 1298 | - ``textrel:`` Checks for ELF binaries that contain relocations in |
| 1299 | their ``.text`` sections, which can result in a performance impact at |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1300 | runtime. See the explanation for the ``ELF binary`` message in |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1301 | ":doc:`/ref-manual/qa-checks`" for more information regarding runtime performance |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1302 | issues. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1303 | |
| 1304 | - ``unlisted-pkg-lics:`` Checks that all declared licenses applying |
| 1305 | for a package are also declared on the recipe level (i.e. any license |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 1306 | in ``LICENSE:*`` should appear in :term:`LICENSE`). |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1307 | |
| 1308 | - ``useless-rpaths:`` Checks for dynamic library load paths (rpaths) |
| 1309 | in the binaries that by default on a standard system are searched by |
| 1310 | the linker (e.g. ``/lib`` and ``/usr/lib``). While these paths will |
| 1311 | not cause any breakage, they do waste space and are unnecessary. |
| 1312 | |
| 1313 | - ``var-undefined:`` Reports when variables fundamental to packaging |
| 1314 | (i.e. :term:`WORKDIR`, |
| 1315 | :term:`DEPLOY_DIR`, :term:`D`, |
| 1316 | :term:`PN`, and :term:`PKGD`) are undefined |
| 1317 | during :ref:`ref-tasks-package`. |
| 1318 | |
| 1319 | - ``version-going-backwards:`` If Build History is enabled, reports |
| 1320 | when a package being written out has a lower version than the |
| 1321 | previously written package under the same name. If you are placing |
| 1322 | output packages into a feed and upgrading packages on a target system |
| 1323 | using that feed, the version of a package going backwards can result |
| 1324 | in the target system not correctly upgrading to the "new" version of |
| 1325 | the package. |
| 1326 | |
| 1327 | .. note:: |
| 1328 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1329 | This is only relevant when you are using runtime package management |
| 1330 | on your target system. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1331 | |
| 1332 | - ``xorg-driver-abi:`` Checks that all packages containing Xorg |
| 1333 | drivers have ABI dependencies. The ``xserver-xorg`` recipe provides |
| 1334 | driver ABI names. All drivers should depend on the ABI versions that |
| 1335 | they have been built against. Driver recipes that include |
| 1336 | ``xorg-driver-input.inc`` or ``xorg-driver-video.inc`` will |
| 1337 | automatically get these versions. Consequently, you should only need |
| 1338 | to explicitly add dependencies to binary driver recipes. |
| 1339 | |
| 1340 | .. _ref-classes-insserv: |
| 1341 | |
| 1342 | ``insserv.bbclass`` |
| 1343 | =================== |
| 1344 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1345 | The :ref:`insserv <ref-classes-insserv>` class uses the ``insserv`` utility to update the order |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1346 | of symbolic links in ``/etc/rc?.d/`` within an image based on |
| 1347 | dependencies specified by LSB headers in the ``init.d`` scripts |
| 1348 | themselves. |
| 1349 | |
| 1350 | .. _ref-classes-kernel: |
| 1351 | |
| 1352 | ``kernel.bbclass`` |
| 1353 | ================== |
| 1354 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1355 | The :ref:`kernel <ref-classes-kernel>` class handles building Linux kernels. The class contains |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1356 | code to build all kernel trees. All needed headers are staged into the |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 1357 | :term:`STAGING_KERNEL_DIR` directory to allow out-of-tree module builds |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1358 | using the :ref:`module <ref-classes-module>` class. |
| 1359 | |
| 1360 | This means that each built kernel module is packaged separately and |
| 1361 | inter-module dependencies are created by parsing the ``modinfo`` output. |
| 1362 | If all modules are required, then installing the ``kernel-modules`` |
| 1363 | package installs all packages with modules and various other kernel |
| 1364 | packages such as ``kernel-vmlinux``. |
| 1365 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1366 | The :ref:`kernel <ref-classes-kernel>` class contains logic that allows you to embed an initial |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1367 | RAM filesystem (:term:`Initramfs`) image when you build the kernel image. For |
| 1368 | information on how to build an :term:`Initramfs`, see the |
| 1369 | ":ref:`dev-manual/common-tasks:building an initial ram filesystem (Initramfs) image`" section in |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1370 | the Yocto Project Development Tasks Manual. |
| 1371 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1372 | Various other classes are used by the :ref:`kernel <ref-classes-kernel>` and :ref:`module <ref-classes-module>` classes |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1373 | internally including the :ref:`kernel-arch <ref-classes-kernel-arch>`, |
| 1374 | :ref:`module-base <ref-classes-module-base>`, and |
| 1375 | :ref:`linux-kernel-base <ref-classes-linux-kernel-base>` classes. |
| 1376 | |
| 1377 | .. _ref-classes-kernel-arch: |
| 1378 | |
| 1379 | ``kernel-arch.bbclass`` |
| 1380 | ======================= |
| 1381 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1382 | The :ref:`kernel-arch <ref-classes-kernel-arch>` class sets the ``ARCH`` environment variable for |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1383 | Linux kernel compilation (including modules). |
| 1384 | |
| 1385 | .. _ref-classes-kernel-devicetree: |
| 1386 | |
| 1387 | ``kernel-devicetree.bbclass`` |
| 1388 | ============================= |
| 1389 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1390 | The :ref:`kernel-devicetree <ref-classes-kernel-devicetree>` class, which is inherited by the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1391 | :ref:`kernel <ref-classes-kernel>` class, supports device tree |
| 1392 | generation. |
| 1393 | |
| 1394 | .. _ref-classes-kernel-fitimage: |
| 1395 | |
| 1396 | ``kernel-fitimage.bbclass`` |
| 1397 | =========================== |
| 1398 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1399 | The :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` class provides support to pack a kernel image, |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1400 | device trees, a U-boot script, a Initramfs bundle and a RAM disk |
| 1401 | into a single FIT image. In theory, a FIT image can support any number |
| 1402 | of kernels, U-boot scripts, Initramfs bundles, RAM disks and device-trees. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1403 | However, :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` currently only supports |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 1404 | limited usecases: just one kernel image, an optional U-boot script, |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1405 | an optional Initramfs bundle, an optional RAM disk, and any number of |
| 1406 | device tree. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1407 | |
| 1408 | To create a FIT image, it is required that :term:`KERNEL_CLASSES` |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1409 | is set to include "kernel-fitimage" and :term:`KERNEL_IMAGETYPE` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1410 | is set to "fitImage". |
| 1411 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1412 | The options for the device tree compiler passed to ``mkimage -D`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1413 | when creating the FIT image are specified using the |
| 1414 | :term:`UBOOT_MKIMAGE_DTCOPTS` variable. |
| 1415 | |
| 1416 | Only a single kernel can be added to the FIT image created by |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1417 | :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` and the kernel image in FIT is mandatory. The |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1418 | address where the kernel image is to be loaded by U-Boot is |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1419 | specified by :term:`UBOOT_LOADADDRESS` and the entrypoint by |
| 1420 | :term:`UBOOT_ENTRYPOINT`. |
| 1421 | |
| 1422 | Multiple device trees can be added to the FIT image created by |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1423 | :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` and the device tree is optional. |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1424 | The address where the device tree is to be loaded by U-Boot is |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1425 | specified by :term:`UBOOT_DTBO_LOADADDRESS` for device tree overlays |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1426 | and by :term:`UBOOT_DTB_LOADADDRESS` for device tree binaries. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1427 | |
| 1428 | Only a single RAM disk can be added to the FIT image created by |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1429 | :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` and the RAM disk in FIT is optional. |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1430 | The address where the RAM disk image is to be loaded by U-Boot |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1431 | is specified by :term:`UBOOT_RD_LOADADDRESS` and the entrypoint by |
| 1432 | :term:`UBOOT_RD_ENTRYPOINT`. The ramdisk is added to FIT image when |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1433 | :term:`INITRAMFS_IMAGE` is specified and that :term:`INITRAMFS_IMAGE_BUNDLE` |
| 1434 | is set to 0. |
| 1435 | |
| 1436 | Only a single Initramfs bundle can be added to the FIT image created by |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1437 | :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` and the Initramfs bundle in FIT is optional. |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1438 | In case of Initramfs, the kernel is configured to be bundled with the root filesystem |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1439 | in the same binary (example: zImage-initramfs-:term:`MACHINE`.bin). |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1440 | When the kernel is copied to RAM and executed, it unpacks the Initramfs root filesystem. |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1441 | The Initramfs bundle can be enabled when :term:`INITRAMFS_IMAGE` |
| 1442 | is specified and that :term:`INITRAMFS_IMAGE_BUNDLE` is set to 1. |
| 1443 | The address where the Initramfs bundle is to be loaded by U-boot is specified |
| 1444 | by :term:`UBOOT_LOADADDRESS` and the entrypoint by :term:`UBOOT_ENTRYPOINT`. |
| 1445 | |
| 1446 | Only a single U-boot boot script can be added to the FIT image created by |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1447 | :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` and the boot script is optional. |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1448 | The boot script is specified in the ITS file as a text file containing |
| 1449 | U-boot commands. When using a boot script the user should configure the |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 1450 | U-boot :ref:`ref-tasks-install` task to copy the script to sysroot. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1451 | So the script can be included in the FIT image by the :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 1452 | class. At run-time, U-boot CONFIG_BOOTCOMMAND define can be configured to |
| 1453 | load the boot script from the FIT image and executes it. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1454 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1455 | The FIT image generated by :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` class is signed when the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1456 | variables :term:`UBOOT_SIGN_ENABLE`, :term:`UBOOT_MKIMAGE_DTCOPTS`, |
| 1457 | :term:`UBOOT_SIGN_KEYDIR` and :term:`UBOOT_SIGN_KEYNAME` are set |
| 1458 | appropriately. The default values used for :term:`FIT_HASH_ALG` and |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1459 | :term:`FIT_SIGN_ALG` in :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` are "sha256" and |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 1460 | "rsa2048" respectively. The keys for signing fitImage can be generated using |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1461 | the :ref:`kernel-fitimage <ref-classes-kernel-fitimage>` class when both :term:`FIT_GENERATE_KEYS` and |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 1462 | :term:`UBOOT_SIGN_ENABLE` are set to "1". |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1463 | |
| 1464 | |
| 1465 | .. _ref-classes-kernel-grub: |
| 1466 | |
| 1467 | ``kernel-grub.bbclass`` |
| 1468 | ======================= |
| 1469 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1470 | The :ref:`kernel-grub <ref-classes-kernel-grub>` class updates the boot area and the boot menu with |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1471 | the kernel as the priority boot mechanism while installing a RPM to |
| 1472 | update the kernel on a deployed target. |
| 1473 | |
| 1474 | .. _ref-classes-kernel-module-split: |
| 1475 | |
| 1476 | ``kernel-module-split.bbclass`` |
| 1477 | =============================== |
| 1478 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1479 | The :ref:`kernel-module-split <ref-classes-kernel-module-split>` class provides common functionality for |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1480 | splitting Linux kernel modules into separate packages. |
| 1481 | |
| 1482 | .. _ref-classes-kernel-uboot: |
| 1483 | |
| 1484 | ``kernel-uboot.bbclass`` |
| 1485 | ======================== |
| 1486 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1487 | The :ref:`kernel-uboot <ref-classes-kernel-uboot>` class provides support for building from |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1488 | vmlinux-style kernel sources. |
| 1489 | |
| 1490 | .. _ref-classes-kernel-uimage: |
| 1491 | |
| 1492 | ``kernel-uimage.bbclass`` |
| 1493 | ========================= |
| 1494 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1495 | The :ref:`kernel-uimage <ref-classes-kernel-uimage>` class provides support to pack uImage. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1496 | |
| 1497 | .. _ref-classes-kernel-yocto: |
| 1498 | |
| 1499 | ``kernel-yocto.bbclass`` |
| 1500 | ======================== |
| 1501 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1502 | The :ref:`kernel-yocto <ref-classes-kernel-yocto>` class provides common functionality for building |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1503 | from linux-yocto style kernel source repositories. |
| 1504 | |
| 1505 | .. _ref-classes-kernelsrc: |
| 1506 | |
| 1507 | ``kernelsrc.bbclass`` |
| 1508 | ===================== |
| 1509 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1510 | The :ref:`kernelsrc <ref-classes-kernelsrc>` class sets the Linux kernel source and version. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1511 | |
| 1512 | .. _ref-classes-lib_package: |
| 1513 | |
| 1514 | ``lib_package.bbclass`` |
| 1515 | ======================= |
| 1516 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1517 | The :ref:`lib_package <ref-classes-lib_package>` class supports recipes that build libraries and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1518 | produce executable binaries, where those binaries should not be |
| 1519 | installed by default along with the library. Instead, the binaries are |
| 1520 | added to a separate ``${``\ :term:`PN`\ ``}-bin`` package to |
| 1521 | make their installation optional. |
| 1522 | |
| 1523 | .. _ref-classes-libc*: |
| 1524 | |
| 1525 | ``libc*.bbclass`` |
| 1526 | ================= |
| 1527 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1528 | The :ref:`libc* <ref-classes-libc*>` classes support recipes that build packages with ``libc``: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1529 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1530 | - The :ref:`libc-common <ref-classes-libc*>` class provides common support for building with |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1531 | ``libc``. |
| 1532 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1533 | - The :ref:`libc-package <ref-classes-libc*>` class supports packaging up ``glibc`` and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1534 | ``eglibc``. |
| 1535 | |
| 1536 | .. _ref-classes-license: |
| 1537 | |
| 1538 | ``license.bbclass`` |
| 1539 | =================== |
| 1540 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1541 | The :ref:`license <ref-classes-license>` class provides license manifest creation and license |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1542 | exclusion. This class is enabled by default using the default value for |
| 1543 | the :term:`INHERIT_DISTRO` variable. |
| 1544 | |
| 1545 | .. _ref-classes-linux-kernel-base: |
| 1546 | |
| 1547 | ``linux-kernel-base.bbclass`` |
| 1548 | ============================= |
| 1549 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1550 | The :ref:`linux-kernel-base <ref-classes-linux-kernel-base>` class provides common functionality for |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1551 | recipes that build out of the Linux kernel source tree. These builds |
| 1552 | goes beyond the kernel itself. For example, the Perf recipe also |
| 1553 | inherits this class. |
| 1554 | |
| 1555 | .. _ref-classes-linuxloader: |
| 1556 | |
| 1557 | ``linuxloader.bbclass`` |
| 1558 | ======================= |
| 1559 | |
| 1560 | Provides the function ``linuxloader()``, which gives the value of the |
| 1561 | dynamic loader/linker provided on the platform. This value is used by a |
| 1562 | number of other classes. |
| 1563 | |
| 1564 | .. _ref-classes-logging: |
| 1565 | |
| 1566 | ``logging.bbclass`` |
| 1567 | =================== |
| 1568 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1569 | The :ref:`logging <ref-classes-logging>` class provides the standard shell functions used to log |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1570 | messages for various BitBake severity levels (i.e. ``bbplain``, |
| 1571 | ``bbnote``, ``bbwarn``, ``bberror``, ``bbfatal``, and ``bbdebug``). |
| 1572 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1573 | This class is enabled by default since it is inherited by the :ref:`base <ref-classes-base>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1574 | class. |
| 1575 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1576 | .. _ref-classes-metadata_scm: |
| 1577 | |
| 1578 | ``metadata_scm.bbclass`` |
| 1579 | ======================== |
| 1580 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1581 | The :ref:`metadata_scm <ref-classes-metadata_scm>` class provides functionality for querying the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1582 | branch and revision of a Source Code Manager (SCM) repository. |
| 1583 | |
| 1584 | The :ref:`base <ref-classes-base>` class uses this class to print the |
| 1585 | revisions of each layer before starting every build. The |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1586 | :ref:`metadata_scm <ref-classes-metadata_scm>` class is enabled by default because it is inherited by |
| 1587 | the :ref:`base <ref-classes-base>` class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1588 | |
| 1589 | .. _ref-classes-migrate_localcount: |
| 1590 | |
| 1591 | ``migrate_localcount.bbclass`` |
| 1592 | ============================== |
| 1593 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1594 | The :ref:`migrate_localcount <ref-classes-migrate_localcount>` class verifies a recipe's localcount data and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1595 | increments it appropriately. |
| 1596 | |
| 1597 | .. _ref-classes-mime: |
| 1598 | |
| 1599 | ``mime.bbclass`` |
| 1600 | ================ |
| 1601 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1602 | The :ref:`mime <ref-classes-mime>` class generates the proper post-install and post-remove |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1603 | (postinst/postrm) scriptlets for packages that install MIME type files. |
| 1604 | These scriptlets call ``update-mime-database`` to add the MIME types to |
| 1605 | the shared database. |
| 1606 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 1607 | .. _ref-classes-mime-xdg: |
| 1608 | |
| 1609 | ``mime-xdg.bbclass`` |
| 1610 | ==================== |
| 1611 | |
| 1612 | The :ref:`mime-xdg <ref-classes-mime-xdg>` class generates the proper |
| 1613 | post-install and post-remove (postinst/postrm) scriptlets for packages |
| 1614 | that install ``.desktop`` files containing ``MimeType`` entries. |
| 1615 | These scriptlets call ``update-desktop-database`` to add the MIME types |
| 1616 | to the database of MIME types handled by desktop files. |
| 1617 | |
| 1618 | Thanks to this class, when users open a file through a file browser |
| 1619 | on recently created images, they don't have to choose the application |
| 1620 | to open the file from the pool of all known applications, even the ones |
| 1621 | that cannot open the selected file. |
| 1622 | |
| 1623 | If you have recipes installing their ``.desktop`` files as absolute |
| 1624 | symbolic links, the detection of such files cannot be done by the current |
| 1625 | implementation of this class. In this case, you have to add the corresponding |
| 1626 | package names to the :term:`MIME_XDG_PACKAGES` variable. |
| 1627 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1628 | .. _ref-classes-mirrors: |
| 1629 | |
| 1630 | ``mirrors.bbclass`` |
| 1631 | =================== |
| 1632 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1633 | The :ref:`mirrors <ref-classes-mirrors>` class sets up some standard |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1634 | :term:`MIRRORS` entries for source code mirrors. These |
| 1635 | mirrors provide a fall-back path in case the upstream source specified |
| 1636 | in :term:`SRC_URI` within recipes is unavailable. |
| 1637 | |
| 1638 | This class is enabled by default since it is inherited by the |
| 1639 | :ref:`base <ref-classes-base>` class. |
| 1640 | |
| 1641 | .. _ref-classes-module: |
| 1642 | |
| 1643 | ``module.bbclass`` |
| 1644 | ================== |
| 1645 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1646 | The :ref:`module <ref-classes-module>` class provides support for building out-of-tree Linux |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1647 | kernel modules. The class inherits the |
| 1648 | :ref:`module-base <ref-classes-module-base>` and |
| 1649 | :ref:`kernel-module-split <ref-classes-kernel-module-split>` classes, |
| 1650 | and implements the :ref:`ref-tasks-compile` and |
| 1651 | :ref:`ref-tasks-install` tasks. The class provides |
| 1652 | everything needed to build and package a kernel module. |
| 1653 | |
| 1654 | For general information on out-of-tree Linux kernel modules, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1655 | ":ref:`kernel-dev/common:incorporating out-of-tree modules`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1656 | section in the Yocto Project Linux Kernel Development Manual. |
| 1657 | |
| 1658 | .. _ref-classes-module-base: |
| 1659 | |
| 1660 | ``module-base.bbclass`` |
| 1661 | ======================= |
| 1662 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1663 | The :ref:`module-base <ref-classes-module-base>` class provides the base functionality for building |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1664 | Linux kernel modules. Typically, a recipe that builds software that |
| 1665 | includes one or more kernel modules and has its own means of building |
| 1666 | the module inherits this class as opposed to inheriting the |
| 1667 | :ref:`module <ref-classes-module>` class. |
| 1668 | |
| 1669 | .. _ref-classes-multilib*: |
| 1670 | |
| 1671 | ``multilib*.bbclass`` |
| 1672 | ===================== |
| 1673 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1674 | The :ref:`multilib* <ref-classes-multilib*>` classes provide support for building libraries with |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1675 | different target optimizations or target architectures and installing |
| 1676 | them side-by-side in the same image. |
| 1677 | |
| 1678 | For more information on using the Multilib feature, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1679 | ":ref:`dev-manual/common-tasks:combining multiple versions of library files into one image`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1680 | section in the Yocto Project Development Tasks Manual. |
| 1681 | |
| 1682 | .. _ref-classes-native: |
| 1683 | |
| 1684 | ``native.bbclass`` |
| 1685 | ================== |
| 1686 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1687 | The :ref:`native <ref-classes-native>` class provides common functionality for recipes that |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1688 | build tools to run on the :term:`Build Host` (i.e. tools that use the compiler |
| 1689 | or other tools from the build host). |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1690 | |
| 1691 | You can create a recipe that builds tools that run natively on the host |
| 1692 | a couple different ways: |
| 1693 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1694 | - Create a ``myrecipe-native.bb`` recipe that inherits the :ref:`native <ref-classes-native>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1695 | class. If you use this method, you must order the inherit statement |
| 1696 | in the recipe after all other inherit statements so that the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1697 | :ref:`native <ref-classes-native>` class is inherited last. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1698 | |
| 1699 | .. note:: |
| 1700 | |
| 1701 | When creating a recipe this way, the recipe name must follow this |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1702 | naming convention:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1703 | |
| 1704 | myrecipe-native.bb |
| 1705 | |
| 1706 | |
| 1707 | Not using this naming convention can lead to subtle problems |
| 1708 | caused by existing code that depends on that naming convention. |
| 1709 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1710 | - Create or modify a target recipe that contains the following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1711 | |
| 1712 | BBCLASSEXTEND = "native" |
| 1713 | |
| 1714 | Inside the |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 1715 | recipe, use ``:class-native`` and ``:class-target`` overrides to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1716 | specify any functionality specific to the respective native or target |
| 1717 | case. |
| 1718 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1719 | Although applied differently, the :ref:`native <ref-classes-native>` class is used with both |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1720 | methods. The advantage of the second method is that you do not need to |
| 1721 | have two separate recipes (assuming you need both) for native and |
| 1722 | target. All common parts of the recipe are automatically shared. |
| 1723 | |
| 1724 | .. _ref-classes-nativesdk: |
| 1725 | |
| 1726 | ``nativesdk.bbclass`` |
| 1727 | ===================== |
| 1728 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1729 | The :ref:`nativesdk <ref-classes-nativesdk>` class provides common functionality for recipes that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1730 | wish to build tools to run as part of an SDK (i.e. tools that run on |
| 1731 | :term:`SDKMACHINE`). |
| 1732 | |
| 1733 | You can create a recipe that builds tools that run on the SDK machine a |
| 1734 | couple different ways: |
| 1735 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 1736 | - Create a ``nativesdk-myrecipe.bb`` recipe that inherits the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1737 | :ref:`nativesdk <ref-classes-nativesdk>` class. If you use this method, you must order the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1738 | inherit statement in the recipe after all other inherit statements so |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1739 | that the :ref:`nativesdk <ref-classes-nativesdk>` class is inherited last. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1740 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1741 | - Create a :ref:`nativesdk <ref-classes-nativesdk>` variant of any recipe by adding the following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1742 | |
| 1743 | BBCLASSEXTEND = "nativesdk" |
| 1744 | |
| 1745 | Inside the |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 1746 | recipe, use ``:class-nativesdk`` and ``:class-target`` overrides to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1747 | specify any functionality specific to the respective SDK machine or |
| 1748 | target case. |
| 1749 | |
| 1750 | .. note:: |
| 1751 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1752 | When creating a recipe, you must follow this naming convention:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1753 | |
| 1754 | nativesdk-myrecipe.bb |
| 1755 | |
| 1756 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1757 | Not doing so can lead to subtle problems because there is code that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1758 | depends on the naming convention. |
| 1759 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1760 | Although applied differently, the :ref:`nativesdk <ref-classes-nativesdk>` class is used with both |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1761 | methods. The advantage of the second method is that you do not need to |
| 1762 | have two separate recipes (assuming you need both) for the SDK machine |
| 1763 | and the target. All common parts of the recipe are automatically shared. |
| 1764 | |
| 1765 | .. _ref-classes-nopackages: |
| 1766 | |
| 1767 | ``nopackages.bbclass`` |
| 1768 | ====================== |
| 1769 | |
| 1770 | Disables packaging tasks for those recipes and classes where packaging |
| 1771 | is not needed. |
| 1772 | |
| 1773 | .. _ref-classes-npm: |
| 1774 | |
| 1775 | ``npm.bbclass`` |
| 1776 | =============== |
| 1777 | |
Patrick Williams | 7784c42 | 2022-11-17 07:29:11 -0600 | [diff] [blame] | 1778 | Provides support for building Node.js software fetched using the |
| 1779 | :wikipedia:`node package manager (NPM) <Npm_(software)>`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1780 | |
| 1781 | .. note:: |
| 1782 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1783 | Currently, recipes inheriting this class must use the ``npm://`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1784 | fetcher to have dependencies fetched and packaged automatically. |
| 1785 | |
| 1786 | For information on how to create NPM packages, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1787 | ":ref:`dev-manual/common-tasks:creating node package manager (npm) packages`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1788 | section in the Yocto Project Development Tasks Manual. |
| 1789 | |
| 1790 | .. _ref-classes-oelint: |
| 1791 | |
| 1792 | ``oelint.bbclass`` |
| 1793 | ================== |
| 1794 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1795 | The :ref:`oelint <ref-classes-oelint>` class is an obsolete lint checking tool available in |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1796 | ``meta/classes`` in the :term:`Source Directory`. |
| 1797 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1798 | There are some classes that could be generally useful in OE-Core but |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1799 | are never actually used within OE-Core itself. The :ref:`oelint <ref-classes-oelint>` class is |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1800 | one such example. However, being aware of this class can reduce the |
| 1801 | proliferation of different versions of similar classes across multiple |
| 1802 | layers. |
| 1803 | |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 1804 | .. _ref-classes-overlayfs: |
| 1805 | |
| 1806 | ``overlayfs.bbclass`` |
| 1807 | ======================= |
| 1808 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1809 | It's often desired in Embedded System design to have a read-only root filesystem. |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 1810 | But a lot of different applications might want to have read-write access to |
| 1811 | some parts of a filesystem. It can be especially useful when your update mechanism |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1812 | overwrites the whole root filesystem, but you may want your application data to be preserved |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 1813 | between updates. The :ref:`overlayfs <ref-classes-overlayfs>` class provides a way |
| 1814 | to achieve that by means of ``overlayfs`` and at the same time keeping the base |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1815 | root filesystem read-only. |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 1816 | |
| 1817 | To use this class, set a mount point for a partition ``overlayfs`` is going to use as upper |
| 1818 | layer in your machine configuration. The underlying file system can be anything that |
| 1819 | is supported by ``overlayfs``. This has to be done in your machine configuration:: |
| 1820 | |
| 1821 | OVERLAYFS_MOUNT_POINT[data] = "/data" |
| 1822 | |
| 1823 | .. note:: |
| 1824 | |
| 1825 | * QA checks fail to catch file existence if you redefine this variable in your recipe! |
| 1826 | * Only the existence of the systemd mount unit file is checked, not its contents. |
| 1827 | * To get more details on ``overlayfs``, its internals and supported operations, please refer |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1828 | to the official documentation of the `Linux kernel <https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html>`__. |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 1829 | |
| 1830 | The class assumes you have a ``data.mount`` systemd unit defined elsewhere in your BSP |
| 1831 | (e.g. in ``systemd-machine-units`` recipe) and it's installed into the image. |
| 1832 | |
| 1833 | Then you can specify writable directories on a recipe basis (e.g. in my-application.bb):: |
| 1834 | |
| 1835 | OVERLAYFS_WRITABLE_PATHS[data] = "/usr/share/my-custom-application" |
| 1836 | |
| 1837 | To support several mount points you can use a different variable flag. Assuming we |
| 1838 | want to have a writable location on the file system, but do not need that the data |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1839 | survives a reboot, then we could have a ``mnt-overlay.mount`` unit for a ``tmpfs`` |
| 1840 | file system. |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 1841 | |
| 1842 | In your machine configuration:: |
| 1843 | |
| 1844 | OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay" |
| 1845 | |
| 1846 | and then in your recipe:: |
| 1847 | |
| 1848 | OVERLAYFS_WRITABLE_PATHS[mnt-overlay] = "/usr/share/another-application" |
| 1849 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1850 | On a practical note, your application recipe might require multiple |
| 1851 | overlays to be mounted before running to avoid writing to the underlying |
| 1852 | file system (which can be forbidden in case of read-only file system) |
| 1853 | To achieve that :ref:`overlayfs <ref-classes-overlayfs>` provides a ``systemd`` |
| 1854 | helper service for mounting overlays. This helper service is named |
| 1855 | ``${PN}-overlays.service`` and can be depended on in your application recipe |
| 1856 | (named ``application`` in the following example) ``systemd`` unit by adding |
| 1857 | to the unit the following:: |
| 1858 | |
| 1859 | [Unit] |
| 1860 | After=application-overlays.service |
| 1861 | Requires=application-overlays.service |
| 1862 | |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 1863 | .. note:: |
| 1864 | |
| 1865 | The class does not support the ``/etc`` directory itself, because ``systemd`` depends on it. |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1866 | In order to get ``/etc`` in overlayfs, see :ref:`overlayfs-etc <ref-classes-overlayfs-etc>`. |
| 1867 | |
| 1868 | .. _ref-classes-overlayfs-etc: |
| 1869 | |
| 1870 | ``overlayfs-etc.bbclass`` |
| 1871 | ========================= |
| 1872 | |
| 1873 | In order to have the ``/etc`` directory in overlayfs a special handling at early |
| 1874 | boot stage is required. The idea is to supply a custom init script that mounts |
| 1875 | ``/etc`` before launching the actual init program, because the latter already |
| 1876 | requires ``/etc`` to be mounted. |
| 1877 | |
| 1878 | Example usage in image recipe:: |
| 1879 | |
| 1880 | IMAGE_FEATURES += "overlayfs-etc" |
| 1881 | |
| 1882 | .. note:: |
| 1883 | |
| 1884 | This class must not be inherited directly. Use :term:`IMAGE_FEATURES` or :term:`EXTRA_IMAGE_FEATURES` |
| 1885 | |
| 1886 | Your machine configuration should define at least the device, mount point, and file system type |
| 1887 | you are going to use for ``overlayfs``:: |
| 1888 | |
| 1889 | OVERLAYFS_ETC_MOUNT_POINT = "/data" |
| 1890 | OVERLAYFS_ETC_DEVICE = "/dev/mmcblk0p2" |
| 1891 | OVERLAYFS_ETC_FSTYPE ?= "ext4" |
| 1892 | |
| 1893 | To control more mount options you should consider setting mount options |
| 1894 | (``defaults`` is used by default):: |
| 1895 | |
| 1896 | OVERLAYFS_ETC_MOUNT_OPTIONS = "wsync" |
| 1897 | |
| 1898 | The class provides two options for ``/sbin/init`` generation: |
| 1899 | |
| 1900 | - The default option is to rename the original ``/sbin/init`` to ``/sbin/init.orig`` |
| 1901 | and place the generated init under original name, i.e. ``/sbin/init``. It has an advantage |
| 1902 | that you won't need to change any kernel parameters in order to make it work, |
| 1903 | but it poses a restriction that package-management can't be used, because updating |
| 1904 | the init manager would remove the generated script. |
| 1905 | |
| 1906 | - If you wish to keep original init as is, you can set:: |
| 1907 | |
| 1908 | OVERLAYFS_ETC_USE_ORIG_INIT_NAME = "0" |
| 1909 | |
| 1910 | Then the generated init will be named ``/sbin/preinit`` and you would need to extend your |
| 1911 | kernel parameters manually in your bootloader configuration. |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 1912 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1913 | .. _ref-classes-own-mirrors: |
| 1914 | |
| 1915 | ``own-mirrors.bbclass`` |
| 1916 | ======================= |
| 1917 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1918 | The :ref:`own-mirrors <ref-classes-own-mirrors>` class makes it easier to set up your own |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1919 | :term:`PREMIRRORS` from which to first fetch source |
| 1920 | before attempting to fetch it from the upstream specified in |
| 1921 | :term:`SRC_URI` within each recipe. |
| 1922 | |
| 1923 | To use this class, inherit it globally and specify |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 1924 | :term:`SOURCE_MIRROR_URL`. Here is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1925 | |
| 1926 | INHERIT += "own-mirrors" |
| 1927 | SOURCE_MIRROR_URL = "http://example.com/my-source-mirror" |
| 1928 | |
| 1929 | You can specify only a single URL |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1930 | in :term:`SOURCE_MIRROR_URL`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1931 | |
| 1932 | .. _ref-classes-package: |
| 1933 | |
| 1934 | ``package.bbclass`` |
| 1935 | =================== |
| 1936 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1937 | The :ref:`package <ref-classes-package>` class supports generating packages from a build's |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1938 | output. The core generic functionality is in ``package.bbclass``. The |
| 1939 | code specific to particular package types resides in these |
| 1940 | package-specific classes: |
| 1941 | :ref:`package_deb <ref-classes-package_deb>`, |
| 1942 | :ref:`package_rpm <ref-classes-package_rpm>`, |
| 1943 | :ref:`package_ipk <ref-classes-package_ipk>`, and |
| 1944 | :ref:`package_tar <ref-classes-package_tar>`. |
| 1945 | |
| 1946 | .. note:: |
| 1947 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1948 | The :ref:`package_tar <ref-classes-package_tar>` class is broken and |
| 1949 | not supported. It is recommended that you do not use this class. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1950 | |
| 1951 | You can control the list of resulting package formats by using the |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1952 | :term:`PACKAGE_CLASSES` variable defined in your ``conf/local.conf`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1953 | configuration file, which is located in the :term:`Build Directory`. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1954 | When defining the variable, you can specify one or more package types. |
| 1955 | Since images are generated from packages, a packaging class is needed |
| 1956 | to enable image generation. The first class listed in this variable is |
| 1957 | used for image generation. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1958 | |
| 1959 | If you take the optional step to set up a repository (package feed) on |
| 1960 | the development host that can be used by DNF, you can install packages |
| 1961 | from the feed while you are running the image on the target (i.e. |
| 1962 | runtime installation of packages). For more information, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 1963 | ":ref:`dev-manual/common-tasks:using runtime package management`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1964 | section in the Yocto Project Development Tasks Manual. |
| 1965 | |
| 1966 | The package-specific class you choose can affect build-time performance |
| 1967 | and has space ramifications. In general, building a package with IPK |
| 1968 | takes about thirty percent less time as compared to using RPM to build |
| 1969 | the same or similar package. This comparison takes into account a |
| 1970 | complete build of the package with all dependencies previously built. |
| 1971 | The reason for this discrepancy is because the RPM package manager |
| 1972 | creates and processes more :term:`Metadata` than the IPK package |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 1973 | manager. Consequently, you might consider setting :term:`PACKAGE_CLASSES` to |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1974 | ":ref:`package_ipk <ref-classes-package_ipk>`" if you are building smaller systems. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1975 | |
| 1976 | Before making your package manager decision, however, you should |
| 1977 | consider some further things about using RPM: |
| 1978 | |
| 1979 | - RPM starts to provide more abilities than IPK due to the fact that it |
| 1980 | processes more Metadata. For example, this information includes |
| 1981 | individual file types, file checksum generation and evaluation on |
| 1982 | install, sparse file support, conflict detection and resolution for |
| 1983 | Multilib systems, ACID style upgrade, and repackaging abilities for |
| 1984 | rollbacks. |
| 1985 | |
| 1986 | - For smaller systems, the extra space used for the Berkeley Database |
| 1987 | and the amount of metadata when using RPM can affect your ability to |
| 1988 | perform on-device upgrades. |
| 1989 | |
| 1990 | You can find additional information on the effects of the package class |
| 1991 | at these two Yocto Project mailing list links: |
| 1992 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1993 | - :yocto_lists:`/pipermail/poky/2011-May/006362.html` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1994 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 1995 | - :yocto_lists:`/pipermail/poky/2011-May/006363.html` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1996 | |
| 1997 | .. _ref-classes-package_deb: |
| 1998 | |
| 1999 | ``package_deb.bbclass`` |
| 2000 | ======================= |
| 2001 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2002 | The :ref:`package_deb <ref-classes-package_deb>` class provides support for creating packages that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2003 | use the Debian (i.e. ``.deb``) file format. The class ensures the |
| 2004 | packages are written out in a ``.deb`` file format to the |
| 2005 | ``${``\ :term:`DEPLOY_DIR_DEB`\ ``}`` directory. |
| 2006 | |
| 2007 | This class inherits the :ref:`package <ref-classes-package>` class and |
| 2008 | is enabled through the :term:`PACKAGE_CLASSES` |
| 2009 | variable in the ``local.conf`` file. |
| 2010 | |
| 2011 | .. _ref-classes-package_ipk: |
| 2012 | |
| 2013 | ``package_ipk.bbclass`` |
| 2014 | ======================= |
| 2015 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2016 | The :ref:`package_ipk <ref-classes-package_ipk>` class provides support for creating packages that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2017 | use the IPK (i.e. ``.ipk``) file format. The class ensures the packages |
| 2018 | are written out in a ``.ipk`` file format to the |
| 2019 | ``${``\ :term:`DEPLOY_DIR_IPK`\ ``}`` directory. |
| 2020 | |
| 2021 | This class inherits the :ref:`package <ref-classes-package>` class and |
| 2022 | is enabled through the :term:`PACKAGE_CLASSES` |
| 2023 | variable in the ``local.conf`` file. |
| 2024 | |
| 2025 | .. _ref-classes-package_rpm: |
| 2026 | |
| 2027 | ``package_rpm.bbclass`` |
| 2028 | ======================= |
| 2029 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2030 | The :ref:`package_rpm <ref-classes-package_rpm>` class provides support for creating packages that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2031 | use the RPM (i.e. ``.rpm``) file format. The class ensures the packages |
| 2032 | are written out in a ``.rpm`` file format to the |
| 2033 | ``${``\ :term:`DEPLOY_DIR_RPM`\ ``}`` directory. |
| 2034 | |
| 2035 | This class inherits the :ref:`package <ref-classes-package>` class and |
| 2036 | is enabled through the :term:`PACKAGE_CLASSES` |
| 2037 | variable in the ``local.conf`` file. |
| 2038 | |
| 2039 | .. _ref-classes-package_tar: |
| 2040 | |
| 2041 | ``package_tar.bbclass`` |
| 2042 | ======================= |
| 2043 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2044 | The :ref:`package_tar <ref-classes-package_tar>` class provides support for creating tarballs. The |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2045 | class ensures the packages are written out in a tarball format to the |
| 2046 | ``${``\ :term:`DEPLOY_DIR_TAR`\ ``}`` directory. |
| 2047 | |
| 2048 | This class inherits the :ref:`package <ref-classes-package>` class and |
| 2049 | is enabled through the :term:`PACKAGE_CLASSES` |
| 2050 | variable in the ``local.conf`` file. |
| 2051 | |
| 2052 | .. note:: |
| 2053 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2054 | You cannot specify the :ref:`package_tar <ref-classes-package_tar>` class first using the |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2055 | :term:`PACKAGE_CLASSES` variable. You must use ``.deb``, ``.ipk``, or ``.rpm`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2056 | file formats for your image or SDK. |
| 2057 | |
| 2058 | .. _ref-classes-packagedata: |
| 2059 | |
| 2060 | ``packagedata.bbclass`` |
| 2061 | ======================= |
| 2062 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2063 | The :ref:`packagedata <ref-classes-packagedata>` class provides common functionality for reading |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2064 | ``pkgdata`` files found in :term:`PKGDATA_DIR`. These |
| 2065 | files contain information about each output package produced by the |
| 2066 | OpenEmbedded build system. |
| 2067 | |
| 2068 | This class is enabled by default because it is inherited by the |
| 2069 | :ref:`package <ref-classes-package>` class. |
| 2070 | |
| 2071 | .. _ref-classes-packagegroup: |
| 2072 | |
| 2073 | ``packagegroup.bbclass`` |
| 2074 | ======================== |
| 2075 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2076 | The :ref:`packagegroup <ref-classes-packagegroup>` class sets default values appropriate for package |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2077 | group recipes (e.g. :term:`PACKAGES`, :term:`PACKAGE_ARCH`, :term:`ALLOW_EMPTY`, and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2078 | so forth). It is highly recommended that all package group recipes |
| 2079 | inherit this class. |
| 2080 | |
| 2081 | For information on how to use this class, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2082 | ":ref:`dev-manual/common-tasks:customizing images using custom package groups`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2083 | section in the Yocto Project Development Tasks Manual. |
| 2084 | |
| 2085 | Previously, this class was called the ``task`` class. |
| 2086 | |
| 2087 | .. _ref-classes-patch: |
| 2088 | |
| 2089 | ``patch.bbclass`` |
| 2090 | ================= |
| 2091 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2092 | The :ref:`patch <ref-classes-patch>` class provides all functionality for applying patches |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2093 | during the :ref:`ref-tasks-patch` task. |
| 2094 | |
| 2095 | This class is enabled by default because it is inherited by the |
| 2096 | :ref:`base <ref-classes-base>` class. |
| 2097 | |
| 2098 | .. _ref-classes-perlnative: |
| 2099 | |
| 2100 | ``perlnative.bbclass`` |
| 2101 | ====================== |
| 2102 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2103 | When inherited by a recipe, the :ref:`perlnative <ref-classes-perlnative>` class supports using the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2104 | native version of Perl built by the build system rather than using the |
| 2105 | version provided by the build host. |
| 2106 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2107 | .. _ref-classes-pypi: |
| 2108 | |
| 2109 | ``pypi.bbclass`` |
| 2110 | ================ |
| 2111 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2112 | The :ref:`pypi <ref-classes-pypi>` class sets variables appropriately for recipes that build |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2113 | Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index. |
| 2114 | By default it determines the PyPI package name based upon :term:`BPN` |
| 2115 | (stripping the "python-" or "python3-" prefix off if present), however in |
| 2116 | some cases you may need to set it manually in the recipe by setting |
| 2117 | :term:`PYPI_PACKAGE`. |
| 2118 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2119 | Variables set by the :ref:`pypi <ref-classes-pypi>` class include :term:`SRC_URI`, :term:`SECTION`, |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2120 | :term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX` |
| 2121 | and :term:`CVE_PRODUCT`. |
| 2122 | |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2123 | .. _ref-classes-python_flit_core: |
| 2124 | |
| 2125 | ``python_flit_core.bbclass`` |
| 2126 | ============================ |
| 2127 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2128 | The :ref:`python_flit_core <ref-classes-python_flit_core>` class enables building Python modules which declare |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2129 | the `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant |
| 2130 | ``flit_core.buildapi`` ``build-backend`` in the ``[build-system]`` |
| 2131 | section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__). |
| 2132 | |
| 2133 | Python modules built with ``flit_core.buildapi`` are pure Python (no |
| 2134 | ``C`` or ``Rust`` extensions). |
| 2135 | |
| 2136 | Internally this uses the :ref:`python_pep517 <ref-classes-python_pep517>` class. |
| 2137 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2138 | .. _ref-classes-python_pep517: |
| 2139 | |
| 2140 | ``python_pep517.bbclass`` |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2141 | ========================= |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2142 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2143 | The :ref:`python_pep517 <ref-classes-python_pep517>` class builds and installs a Python ``wheel`` binary |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2144 | archive (see `PEP-517 <https://peps.python.org/pep-0517/>`__). |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2145 | |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2146 | Recipes wouldn't inherit this directly, instead typically another class will |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 2147 | inherit this and add the relevant native dependencies. |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2148 | |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2149 | Examples of classes which do this are :ref:`python_flit_core |
| 2150 | <ref-classes-python_flit_core>`, :ref:`python_setuptools_build_meta |
| 2151 | <ref-classes-python_setuptools_build_meta>`, and :ref:`python_poetry_core |
| 2152 | <ref-classes-python_poetry_core>`. |
| 2153 | |
| 2154 | .. _ref-classes-python_poetry_core: |
| 2155 | |
| 2156 | ``python_poetry_core.bbclass`` |
| 2157 | ============================== |
| 2158 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2159 | The :ref:`python_poetry_core <ref-classes-python_poetry_core>` class enables building Python modules which use the |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2160 | `Poetry Core <https://python-poetry.org>`__ build system. |
| 2161 | |
| 2162 | Internally this uses the :ref:`python_pep517 <ref-classes-python_pep517>` class. |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2163 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2164 | .. _ref-classes-pixbufcache: |
| 2165 | |
| 2166 | ``pixbufcache.bbclass`` |
| 2167 | ======================= |
| 2168 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2169 | The :ref:`pixbufcache <ref-classes-pixbufcache>` class generates the proper post-install and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2170 | post-remove (postinst/postrm) scriptlets for packages that install |
| 2171 | pixbuf loaders, which are used with ``gdk-pixbuf``. These scriptlets |
| 2172 | call ``update_pixbuf_cache`` to add the pixbuf loaders to the cache. |
| 2173 | Since the cache files are architecture-specific, ``update_pixbuf_cache`` |
| 2174 | is run using QEMU if the postinst scriptlets need to be run on the build |
| 2175 | host during image creation. |
| 2176 | |
| 2177 | If the pixbuf loaders being installed are in packages other than the |
| 2178 | recipe's main package, set |
| 2179 | :term:`PIXBUF_PACKAGES` to specify the packages |
| 2180 | containing the loaders. |
| 2181 | |
| 2182 | .. _ref-classes-pkgconfig: |
| 2183 | |
| 2184 | ``pkgconfig.bbclass`` |
| 2185 | ===================== |
| 2186 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2187 | The :ref:`pkgconfig <ref-classes-pkgconfig>` class provides a standard way to get header and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2188 | library information by using ``pkg-config``. This class aims to smooth |
| 2189 | integration of ``pkg-config`` into libraries that use it. |
| 2190 | |
| 2191 | During staging, BitBake installs ``pkg-config`` data into the |
| 2192 | ``sysroots/`` directory. By making use of sysroot functionality within |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2193 | ``pkg-config``, the :ref:`pkgconfig <ref-classes-pkgconfig>` class no longer has to manipulate the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2194 | files. |
| 2195 | |
| 2196 | .. _ref-classes-populate-sdk: |
| 2197 | |
| 2198 | ``populate_sdk.bbclass`` |
| 2199 | ======================== |
| 2200 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2201 | The :ref:`populate_sdk <ref-classes-populate-sdk>` class provides support for SDK-only recipes. For |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2202 | information on advantages gained when building a cross-development |
| 2203 | toolchain using the :ref:`ref-tasks-populate_sdk` |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2204 | task, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2205 | section in the Yocto Project Application Development and the Extensible |
| 2206 | Software Development Kit (eSDK) manual. |
| 2207 | |
| 2208 | .. _ref-classes-populate-sdk-*: |
| 2209 | |
| 2210 | ``populate_sdk_*.bbclass`` |
| 2211 | ========================== |
| 2212 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2213 | The :ref:`populate_sdk_* <ref-classes-populate-sdk-*>` classes support SDK creation and consist of the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2214 | following classes: |
| 2215 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2216 | - :ref:`populate_sdk_base <ref-classes-populate-sdk-*>`: The base class supporting SDK creation under |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2217 | all package managers (i.e. DEB, RPM, and opkg). |
| 2218 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2219 | - :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the Debian |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2220 | package manager. |
| 2221 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2222 | - :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the RPM |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2223 | package manager. |
| 2224 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2225 | - :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>`: Supports creation of the SDK given the opkg |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2226 | (IPK format) package manager. |
| 2227 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2228 | - :ref:`populate_sdk_ext <ref-classes-populate-sdk-*>`: Supports extensible SDK creation under all |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2229 | package managers. |
| 2230 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2231 | The :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class inherits the appropriate |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2232 | ``populate_sdk_*`` (i.e. ``deb``, ``rpm``, and ``ipk``) based on |
| 2233 | :term:`IMAGE_PKGTYPE`. |
| 2234 | |
| 2235 | The base class ensures all source and destination directories are |
| 2236 | established and then populates the SDK. After populating the SDK, the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2237 | :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` class constructs two sysroots: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2238 | ``${``\ :term:`SDK_ARCH`\ ``}-nativesdk``, which |
| 2239 | contains the cross-compiler and associated tooling, and the target, |
| 2240 | which contains a target root filesystem that is configured for the SDK |
| 2241 | usage. These two images reside in :term:`SDK_OUTPUT`, |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2242 | which consists of the following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2243 | |
| 2244 | ${SDK_OUTPUT}/${SDK_ARCH}-nativesdk-pkgs |
| 2245 | ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/target-pkgs |
| 2246 | |
| 2247 | Finally, the base populate SDK class creates the toolchain environment |
| 2248 | setup script, the tarball of the SDK, and the installer. |
| 2249 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2250 | The respective :ref:`populate_sdk_deb <ref-classes-populate-sdk-*>`, :ref:`populate_sdk_rpm <ref-classes-populate-sdk-*>`, and |
| 2251 | :ref:`populate_sdk_ipk <ref-classes-populate-sdk-*>` classes each support the specific type of SDK. |
| 2252 | These classes are inherited by and used with the :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2253 | class. |
| 2254 | |
| 2255 | For more information on the cross-development toolchain generation, see |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2256 | the ":ref:`overview-manual/concepts:cross-development toolchain generation`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2257 | section in the Yocto Project Overview and Concepts Manual. For |
| 2258 | information on advantages gained when building a cross-development |
| 2259 | toolchain using the :ref:`ref-tasks-populate_sdk` |
| 2260 | task, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2261 | ":ref:`sdk-manual/appendix-obtain:building an sdk installer`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2262 | section in the Yocto Project Application Development and the Extensible |
| 2263 | Software Development Kit (eSDK) manual. |
| 2264 | |
| 2265 | .. _ref-classes-prexport: |
| 2266 | |
| 2267 | ``prexport.bbclass`` |
| 2268 | ==================== |
| 2269 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2270 | The :ref:`prexport <ref-classes-prexport>` class provides functionality for exporting |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2271 | :term:`PR` values. |
| 2272 | |
| 2273 | .. note:: |
| 2274 | |
| 2275 | This class is not intended to be used directly. Rather, it is enabled |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2276 | when using "``bitbake-prserv-tool export``". |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2277 | |
| 2278 | .. _ref-classes-primport: |
| 2279 | |
| 2280 | ``primport.bbclass`` |
| 2281 | ==================== |
| 2282 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2283 | The :ref:`primport <ref-classes-primport>` class provides functionality for importing |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2284 | :term:`PR` values. |
| 2285 | |
| 2286 | .. note:: |
| 2287 | |
| 2288 | This class is not intended to be used directly. Rather, it is enabled |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2289 | when using "``bitbake-prserv-tool import``". |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2290 | |
| 2291 | .. _ref-classes-prserv: |
| 2292 | |
| 2293 | ``prserv.bbclass`` |
| 2294 | ================== |
| 2295 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2296 | The :ref:`prserv <ref-classes-prserv>` class provides functionality for using a :ref:`PR |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2297 | service <dev-manual/common-tasks:working with a pr service>` in order to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2298 | automatically manage the incrementing of the :term:`PR` |
| 2299 | variable for each recipe. |
| 2300 | |
| 2301 | This class is enabled by default because it is inherited by the |
| 2302 | :ref:`package <ref-classes-package>` class. However, the OpenEmbedded |
| 2303 | build system will not enable the functionality of this class unless |
| 2304 | :term:`PRSERV_HOST` has been set. |
| 2305 | |
| 2306 | .. _ref-classes-ptest: |
| 2307 | |
| 2308 | ``ptest.bbclass`` |
| 2309 | ================= |
| 2310 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2311 | The :ref:`ptest <ref-classes-ptest>` class provides functionality for packaging and installing |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2312 | runtime tests for recipes that build software that provides these tests. |
| 2313 | |
| 2314 | This class is intended to be inherited by individual recipes. However, |
| 2315 | the class' functionality is largely disabled unless "ptest" appears in |
| 2316 | :term:`DISTRO_FEATURES`. See the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2317 | ":ref:`dev-manual/common-tasks:testing packages with ptest`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2318 | section in the Yocto Project Development Tasks Manual for more information |
| 2319 | on ptest. |
| 2320 | |
| 2321 | .. _ref-classes-ptest-gnome: |
| 2322 | |
| 2323 | ``ptest-gnome.bbclass`` |
| 2324 | ======================= |
| 2325 | |
| 2326 | Enables package tests (ptests) specifically for GNOME packages, which |
| 2327 | have tests intended to be executed with ``gnome-desktop-testing``. |
| 2328 | |
| 2329 | For information on setting up and running ptests, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2330 | ":ref:`dev-manual/common-tasks:testing packages with ptest`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2331 | section in the Yocto Project Development Tasks Manual. |
| 2332 | |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 2333 | .. _ref-classes-python3-dir: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2334 | |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 2335 | ``python3-dir.bbclass`` |
| 2336 | ======================= |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2337 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2338 | The :ref:`python3-dir <ref-classes-python3-dir>` class provides the base version, location, and site |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 2339 | package location for Python 3. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2340 | |
| 2341 | .. _ref-classes-python3native: |
| 2342 | |
| 2343 | ``python3native.bbclass`` |
| 2344 | ========================= |
| 2345 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2346 | The :ref:`python3native <ref-classes-python3native>` class supports using the native version of Python |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2347 | 3 built by the build system rather than support of the version provided |
| 2348 | by the build host. |
| 2349 | |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 2350 | .. _ref-classes-python3targetconfig: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2351 | |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 2352 | ``python3targetconfig.bbclass`` |
| 2353 | =============================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2354 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2355 | The :ref:`python3targetconfig <ref-classes-python3targetconfig>` class supports using the native version of Python |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 2356 | 3 built by the build system rather than support of the version provided |
| 2357 | by the build host, except that the configuration for the target machine |
| 2358 | is accessible (such as correct installation directories). This also adds a |
| 2359 | dependency on target ``python3``, so should only be used where appropriate |
| 2360 | in order to avoid unnecessarily lengthening builds. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2361 | |
| 2362 | .. _ref-classes-qemu: |
| 2363 | |
| 2364 | ``qemu.bbclass`` |
| 2365 | ================ |
| 2366 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2367 | The :ref:`qemu <ref-classes-qemu>` class provides functionality for recipes that either need |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2368 | QEMU or test for the existence of QEMU. Typically, this class is used to |
| 2369 | run programs for a target system on the build host using QEMU's |
| 2370 | application emulation mode. |
| 2371 | |
| 2372 | .. _ref-classes-recipe_sanity: |
| 2373 | |
| 2374 | ``recipe_sanity.bbclass`` |
| 2375 | ========================= |
| 2376 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2377 | The :ref:`recipe_sanity <ref-classes-recipe_sanity>` class checks for the presence of any host system |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2378 | recipe prerequisites that might affect the build (e.g. variables that |
| 2379 | are set or software that is present). |
| 2380 | |
| 2381 | .. _ref-classes-relocatable: |
| 2382 | |
| 2383 | ``relocatable.bbclass`` |
| 2384 | ======================= |
| 2385 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2386 | The :ref:`relocatable <ref-classes-relocatable>` class enables relocation of binaries when they are |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2387 | installed into the sysroot. |
| 2388 | |
| 2389 | This class makes use of the :ref:`chrpath <ref-classes-chrpath>` class |
| 2390 | and is used by both the :ref:`cross <ref-classes-cross>` and |
| 2391 | :ref:`native <ref-classes-native>` classes. |
| 2392 | |
| 2393 | .. _ref-classes-remove-libtool: |
| 2394 | |
| 2395 | ``remove-libtool.bbclass`` |
| 2396 | ========================== |
| 2397 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2398 | The :ref:`remove-libtool <ref-classes-remove-libtool>` class adds a post function to the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2399 | :ref:`ref-tasks-install` task to remove all ``.la`` files |
| 2400 | installed by ``libtool``. Removing these files results in them being |
| 2401 | absent from both the sysroot and target packages. |
| 2402 | |
| 2403 | If a recipe needs the ``.la`` files to be installed, then the recipe can |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2404 | override the removal by setting ``REMOVE_LIBTOOL_LA`` to "0" as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2405 | |
| 2406 | REMOVE_LIBTOOL_LA = "0" |
| 2407 | |
| 2408 | .. note:: |
| 2409 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2410 | The :ref:`remove-libtool <ref-classes-remove-libtool>` class is not enabled by default. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2411 | |
| 2412 | .. _ref-classes-report-error: |
| 2413 | |
| 2414 | ``report-error.bbclass`` |
| 2415 | ======================== |
| 2416 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2417 | The :ref:`report-error <ref-classes-report-error>` class supports enabling the :ref:`error reporting |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2418 | tool <dev-manual/common-tasks:using the error reporting tool>`", |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2419 | which allows you to submit build error information to a central database. |
| 2420 | |
| 2421 | The class collects debug information for recipe, recipe version, task, |
| 2422 | machine, distro, build system, target system, host distro, branch, |
| 2423 | commit, and log. From the information, report files using a JSON format |
| 2424 | are created and stored in |
| 2425 | ``${``\ :term:`LOG_DIR`\ ``}/error-report``. |
| 2426 | |
| 2427 | .. _ref-classes-rm-work: |
| 2428 | |
| 2429 | ``rm_work.bbclass`` |
| 2430 | =================== |
| 2431 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2432 | The :ref:`rm_work <ref-classes-rm-work>` class supports deletion of temporary workspace, which |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2433 | can ease your hard drive demands during builds. |
| 2434 | |
| 2435 | The OpenEmbedded build system can use a substantial amount of disk space |
| 2436 | during the build process. A portion of this space is the work files |
| 2437 | under the ``${TMPDIR}/work`` directory for each recipe. Once the build |
| 2438 | system generates the packages for a recipe, the work files for that |
| 2439 | recipe are no longer needed. However, by default, the build system |
| 2440 | preserves these files for inspection and possible debugging purposes. If |
| 2441 | you would rather have these files deleted to save disk space as the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2442 | build progresses, you can enable :ref:`rm_work <ref-classes-rm-work>` by adding the following to |
| 2443 | your ``local.conf`` file, which is found in the :term:`Build Directory`:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2444 | |
| 2445 | INHERIT += "rm_work" |
| 2446 | |
| 2447 | If you are |
| 2448 | modifying and building source code out of the work directory for a |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2449 | recipe, enabling :ref:`rm_work <ref-classes-rm-work>` will potentially result in your changes to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2450 | the source being lost. To exclude some recipes from having their work |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2451 | directories deleted by :ref:`rm_work <ref-classes-rm-work>`, you can add the names of the recipe |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2452 | or recipes you are working on to the :term:`RM_WORK_EXCLUDE` variable, which |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2453 | can also be set in your ``local.conf`` file. Here is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2454 | |
| 2455 | RM_WORK_EXCLUDE += "busybox glibc" |
| 2456 | |
| 2457 | .. _ref-classes-rootfs*: |
| 2458 | |
| 2459 | ``rootfs*.bbclass`` |
| 2460 | =================== |
| 2461 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2462 | The :ref:`rootfs* <ref-classes-rootfs*>` classes support creating the root filesystem for an |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2463 | image and consist of the following classes: |
| 2464 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2465 | - The :ref:`rootfs-postcommands <ref-classes-rootfs*>` class, which defines filesystem |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2466 | post-processing functions for image recipes. |
| 2467 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2468 | - The :ref:`rootfs_deb <ref-classes-rootfs*>` class, which supports creation of root filesystems |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2469 | for images built using ``.deb`` packages. |
| 2470 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2471 | - The :ref:`rootfs_rpm <ref-classes-rootfs*>` class, which supports creation of root filesystems |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2472 | for images built using ``.rpm`` packages. |
| 2473 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2474 | - The :ref:`rootfs_ipk <ref-classes-rootfs*>` class, which supports creation of root filesystems |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2475 | for images built using ``.ipk`` packages. |
| 2476 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2477 | - The :ref:`rootfsdebugfiles <ref-classes-rootfs*>` class, which installs additional files found |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2478 | on the build host directly into the root filesystem. |
| 2479 | |
| 2480 | The root filesystem is created from packages using one of the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2481 | :ref:`rootfs*.bbclass <ref-classes-rootfs*>` files as determined by the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2482 | :term:`PACKAGE_CLASSES` variable. |
| 2483 | |
| 2484 | For information on how root filesystem images are created, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2485 | ":ref:`overview-manual/concepts:image generation`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2486 | section in the Yocto Project Overview and Concepts Manual. |
| 2487 | |
| 2488 | .. _ref-classes-sanity: |
| 2489 | |
| 2490 | ``sanity.bbclass`` |
| 2491 | ================== |
| 2492 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2493 | The :ref:`sanity <ref-classes-sanity>` class checks to see if prerequisite software is present |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2494 | on the host system so that users can be notified of potential problems |
| 2495 | that might affect their build. The class also performs basic user |
| 2496 | configuration checks from the ``local.conf`` configuration file to |
| 2497 | prevent common mistakes that cause build failures. Distribution policy |
| 2498 | usually determines whether to include this class. |
| 2499 | |
| 2500 | .. _ref-classes-scons: |
| 2501 | |
| 2502 | ``scons.bbclass`` |
| 2503 | ================= |
| 2504 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2505 | The :ref:`scons <ref-classes-scons>` class supports recipes that need to build software that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2506 | uses the SCons build system. You can use the |
| 2507 | :term:`EXTRA_OESCONS` variable to specify |
| 2508 | additional configuration options you want to pass SCons command line. |
| 2509 | |
| 2510 | .. _ref-classes-sdl: |
| 2511 | |
| 2512 | ``sdl.bbclass`` |
| 2513 | =============== |
| 2514 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2515 | The :ref:`sdl <ref-classes-sdl>` class supports recipes that need to build software that uses |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2516 | the Simple DirectMedia Layer (SDL) library. |
| 2517 | |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2518 | .. _ref-classes-python_setuptools_build_meta: |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2519 | |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2520 | ``python_setuptools_build_meta.bbclass`` |
| 2521 | ======================================== |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2522 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2523 | The :ref:`python_setuptools_build_meta <ref-classes-python_setuptools_build_meta>` class enables building Python modules which |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2524 | declare the |
| 2525 | `PEP-517 <https://www.python.org/dev/peps/pep-0517/>`__ compliant |
| 2526 | ``setuptools.build_meta`` ``build-backend`` in the ``[build-system]`` |
| 2527 | section of ``pyproject.toml`` (See `PEP-518 <https://www.python.org/dev/peps/pep-0518/>`__). |
| 2528 | |
| 2529 | Python modules built with ``setuptools.build_meta`` can be pure Python or |
| 2530 | include ``C`` or ``Rust`` extensions). |
| 2531 | |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2532 | Internally this uses the :ref:`python_pep517 <ref-classes-python_pep517>` class. |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2533 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2534 | .. _ref-classes-setuptools3: |
| 2535 | |
| 2536 | ``setuptools3.bbclass`` |
| 2537 | ======================= |
| 2538 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2539 | The :ref:`setuptools3 <ref-classes-setuptools3>` class supports Python version 3.x extensions that |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2540 | use build systems based on ``setuptools`` (e.g. only have a ``setup.py`` and |
| 2541 | have not migrated to the official ``pyproject.toml`` format). If your recipe |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2542 | uses these build systems, the recipe needs to inherit the :ref:`setuptools3 <ref-classes-setuptools3>` class. |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2543 | |
| 2544 | .. note:: |
| 2545 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2546 | The :ref:`setuptools3 <ref-classes-setuptools3>` class :ref:`ref-tasks-compile` task now calls |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2547 | ``setup.py bdist_wheel`` to build the ``wheel`` binary archive format |
| 2548 | (See `PEP-427 <https://www.python.org/dev/peps/pep-0427/>`__). |
| 2549 | |
| 2550 | A consequence of this is that legacy software still using deprecated |
| 2551 | ``distutils`` from the Python standard library cannot be packaged as |
| 2552 | ``wheels``. A common solution is the replace |
| 2553 | ``from distutils.core import setup`` with ``from setuptools import setup``. |
| 2554 | |
| 2555 | .. note:: |
| 2556 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2557 | The :ref:`setuptools3 <ref-classes-setuptools3>` class :ref:`ref-tasks-install` task now installs the ``wheel`` |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2558 | binary archive. In current versions of ``setuptools`` the legacy ``setup.py |
| 2559 | install`` method is deprecated. If the ``setup.py`` cannot be used with |
| 2560 | wheels, for example it creates files outside of the Python module or |
| 2561 | standard entry points, then :ref:`setuptools3_legacy |
| 2562 | <ref-classes-setuptools3_legacy>` should be used. |
| 2563 | |
| 2564 | .. _ref-classes-setuptools3_legacy: |
| 2565 | |
| 2566 | ``setuptools3_legacy.bbclass`` |
| 2567 | ============================== |
| 2568 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2569 | The :ref:`setuptools3_legacy <ref-classes-setuptools3_legacy>` class supports Python version 3.x extensions that use |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2570 | build systems based on ``setuptools`` (e.g. only have a ``setup.py`` and have |
| 2571 | not migrated to the official ``pyproject.toml`` format). Unlike |
| 2572 | ``setuptools3.bbclass``, this uses the traditional ``setup.py`` ``build`` and |
| 2573 | ``install`` commands and not wheels. This use of ``setuptools`` like this is |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2574 | `deprecated <https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5830>`__ |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2575 | but still relatively common. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2576 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2577 | .. _ref-classes-setuptools3-base: |
| 2578 | |
| 2579 | ``setuptools3-base.bbclass`` |
| 2580 | ============================ |
| 2581 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2582 | The :ref:`setuptools3-base <ref-classes-setuptools3-base>` class provides a reusable base for other classes |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2583 | that support building Python version 3.x extensions. If you need |
| 2584 | functionality that is not provided by the :ref:`setuptools3 <ref-classes-setuptools3>` class, you may |
| 2585 | want to ``inherit setuptools3-base``. Some recipes do not need the tasks |
| 2586 | in the :ref:`setuptools3 <ref-classes-setuptools3>` class and inherit this class instead. |
| 2587 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2588 | .. _ref-classes-sign_rpm: |
| 2589 | |
| 2590 | ``sign_rpm.bbclass`` |
| 2591 | ==================== |
| 2592 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2593 | The :ref:`sign_rpm <ref-classes-sign_rpm>` class supports generating signed RPM packages. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2594 | |
| 2595 | .. _ref-classes-sip: |
| 2596 | |
| 2597 | ``sip.bbclass`` |
| 2598 | =============== |
| 2599 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2600 | The :ref:`sip <ref-classes-sip>` class supports recipes that build or package SIP-based |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2601 | Python bindings. |
| 2602 | |
| 2603 | .. _ref-classes-siteconfig: |
| 2604 | |
| 2605 | ``siteconfig.bbclass`` |
| 2606 | ====================== |
| 2607 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2608 | The :ref:`siteconfig <ref-classes-siteconfig>` class provides functionality for handling site |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2609 | configuration. The class is used by the |
| 2610 | :ref:`autotools <ref-classes-autotools>` class to accelerate the |
| 2611 | :ref:`ref-tasks-configure` task. |
| 2612 | |
| 2613 | .. _ref-classes-siteinfo: |
| 2614 | |
| 2615 | ``siteinfo.bbclass`` |
| 2616 | ==================== |
| 2617 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2618 | The :ref:`siteinfo <ref-classes-siteinfo>` class provides information about the targets that might |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2619 | be needed by other classes or recipes. |
| 2620 | |
| 2621 | As an example, consider Autotools, which can require tests that must |
| 2622 | execute on the target hardware. Since this is not possible in general |
| 2623 | when cross compiling, site information is used to provide cached test |
| 2624 | results so these tests can be skipped over but still make the correct |
| 2625 | values available. The ``meta/site directory`` contains test results |
| 2626 | sorted into different categories such as architecture, endianness, and |
| 2627 | the ``libc`` used. Site information provides a list of files containing |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2628 | data relevant to the current build in the :term:`CONFIG_SITE` variable that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2629 | Autotools automatically picks up. |
| 2630 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2631 | The class also provides variables like :term:`SITEINFO_ENDIANNESS` and |
| 2632 | :term:`SITEINFO_BITS` that can be used elsewhere in the metadata. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2633 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2634 | .. _ref-classes-sstate: |
| 2635 | |
| 2636 | ``sstate.bbclass`` |
| 2637 | ================== |
| 2638 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2639 | The :ref:`sstate <ref-classes-sstate>` class provides support for Shared State (sstate). By |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2640 | default, the class is enabled through the |
| 2641 | :term:`INHERIT_DISTRO` variable's default value. |
| 2642 | |
| 2643 | For more information on sstate, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2644 | ":ref:`overview-manual/concepts:shared state cache`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2645 | section in the Yocto Project Overview and Concepts Manual. |
| 2646 | |
| 2647 | .. _ref-classes-staging: |
| 2648 | |
| 2649 | ``staging.bbclass`` |
| 2650 | =================== |
| 2651 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2652 | The :ref:`staging <ref-classes-staging>` class installs files into individual recipe work |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2653 | directories for sysroots. The class contains the following key tasks: |
| 2654 | |
| 2655 | - The :ref:`ref-tasks-populate_sysroot` task, |
| 2656 | which is responsible for handing the files that end up in the recipe |
| 2657 | sysroots. |
| 2658 | |
| 2659 | - The |
| 2660 | :ref:`ref-tasks-prepare_recipe_sysroot` |
| 2661 | task (a "partner" task to the ``populate_sysroot`` task), which |
| 2662 | installs the files into the individual recipe work directories (i.e. |
| 2663 | :term:`WORKDIR`). |
| 2664 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2665 | The code in the :ref:`staging <ref-classes-staging>` class is complex and basically works in two |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2666 | stages: |
| 2667 | |
| 2668 | - *Stage One:* The first stage addresses recipes that have files they |
| 2669 | want to share with other recipes that have dependencies on the |
| 2670 | originating recipe. Normally these dependencies are installed through |
| 2671 | the :ref:`ref-tasks-install` task into |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 2672 | ``${``\ :term:`D`\ ``}``. The :ref:`ref-tasks-populate_sysroot` task |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2673 | copies a subset of these files into ``${SYSROOT_DESTDIR}``. This |
| 2674 | subset of files is controlled by the |
| 2675 | :term:`SYSROOT_DIRS`, |
| 2676 | :term:`SYSROOT_DIRS_NATIVE`, and |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 2677 | :term:`SYSROOT_DIRS_IGNORE` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2678 | variables. |
| 2679 | |
| 2680 | .. note:: |
| 2681 | |
| 2682 | Additionally, a recipe can customize the files further by |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2683 | declaring a processing function in the :term:`SYSROOT_PREPROCESS_FUNCS` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2684 | variable. |
| 2685 | |
| 2686 | A shared state (sstate) object is built from these files and the |
| 2687 | files are placed into a subdirectory of |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2688 | :ref:`structure-build-tmp-sysroots-components`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2689 | The files are scanned for hardcoded paths to the original |
| 2690 | installation location. If the location is found in text files, the |
| 2691 | hardcoded locations are replaced by tokens and a list of the files |
| 2692 | needing such replacements is created. These adjustments are referred |
| 2693 | to as "FIXMEs". The list of files that are scanned for paths is |
| 2694 | controlled by the :term:`SSTATE_SCAN_FILES` |
| 2695 | variable. |
| 2696 | |
| 2697 | - *Stage Two:* The second stage addresses recipes that want to use |
| 2698 | something from another recipe and declare a dependency on that recipe |
| 2699 | through the :term:`DEPENDS` variable. The recipe will |
| 2700 | have a |
| 2701 | :ref:`ref-tasks-prepare_recipe_sysroot` |
| 2702 | task and when this task executes, it creates the ``recipe-sysroot`` |
| 2703 | and ``recipe-sysroot-native`` in the recipe work directory (i.e. |
| 2704 | :term:`WORKDIR`). The OpenEmbedded build system |
| 2705 | creates hard links to copies of the relevant files from |
| 2706 | ``sysroots-components`` into the recipe work directory. |
| 2707 | |
| 2708 | .. note:: |
| 2709 | |
| 2710 | If hard links are not possible, the build system uses actual |
| 2711 | copies. |
| 2712 | |
| 2713 | The build system then addresses any "FIXMEs" to paths as defined from |
| 2714 | the list created in the first stage. |
| 2715 | |
| 2716 | Finally, any files in ``${bindir}`` within the sysroot that have the |
| 2717 | prefix "``postinst-``" are executed. |
| 2718 | |
| 2719 | .. note:: |
| 2720 | |
| 2721 | Although such sysroot post installation scripts are not |
| 2722 | recommended for general use, the files do allow some issues such |
| 2723 | as user creation and module indexes to be addressed. |
| 2724 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2725 | Because recipes can have other dependencies outside of :term:`DEPENDS` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2726 | (e.g. ``do_unpack[depends] += "tar-native:do_populate_sysroot"``), |
| 2727 | the sysroot creation function ``extend_recipe_sysroot`` is also added |
| 2728 | as a pre-function for those tasks whose dependencies are not through |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 2729 | :term:`DEPENDS` but operate similarly. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2730 | |
| 2731 | When installing dependencies into the sysroot, the code traverses the |
| 2732 | dependency graph and processes dependencies in exactly the same way |
| 2733 | as the dependencies would or would not be when installed from sstate. |
| 2734 | This processing means, for example, a native tool would have its |
| 2735 | native dependencies added but a target library would not have its |
| 2736 | dependencies traversed or installed. The same sstate dependency code |
| 2737 | is used so that builds should be identical regardless of whether |
| 2738 | sstate was used or not. For a closer look, see the |
| 2739 | ``setscene_depvalid()`` function in the |
| 2740 | :ref:`sstate <ref-classes-sstate>` class. |
| 2741 | |
| 2742 | The build system is careful to maintain manifests of the files it |
| 2743 | installs so that any given dependency can be installed as needed. The |
| 2744 | sstate hash of the installed item is also stored so that if it |
| 2745 | changes, the build system can reinstall it. |
| 2746 | |
| 2747 | .. _ref-classes-syslinux: |
| 2748 | |
| 2749 | ``syslinux.bbclass`` |
| 2750 | ==================== |
| 2751 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2752 | The :ref:`syslinux <ref-classes-syslinux>` class provides syslinux-specific functions for building |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2753 | bootable images. |
| 2754 | |
| 2755 | The class supports the following variables: |
| 2756 | |
| 2757 | - :term:`INITRD`: Indicates list of filesystem images to |
| 2758 | concatenate and use as an initial RAM disk (initrd). This variable is |
| 2759 | optional. |
| 2760 | |
| 2761 | - :term:`ROOTFS`: Indicates a filesystem image to include |
| 2762 | as the root filesystem. This variable is optional. |
| 2763 | |
| 2764 | - :term:`AUTO_SYSLINUXMENU`: Enables creating |
| 2765 | an automatic menu when set to "1". |
| 2766 | |
| 2767 | - :term:`LABELS`: Lists targets for automatic |
| 2768 | configuration. |
| 2769 | |
| 2770 | - :term:`APPEND`: Lists append string overrides for each |
| 2771 | label. |
| 2772 | |
| 2773 | - :term:`SYSLINUX_OPTS`: Lists additional options |
| 2774 | to add to the syslinux file. Semicolon characters separate multiple |
| 2775 | options. |
| 2776 | |
| 2777 | - :term:`SYSLINUX_SPLASH`: Lists a background |
| 2778 | for the VGA boot menu when you are using the boot menu. |
| 2779 | |
| 2780 | - :term:`SYSLINUX_DEFAULT_CONSOLE`: Set |
| 2781 | to "console=ttyX" to change kernel boot default console. |
| 2782 | |
| 2783 | - :term:`SYSLINUX_SERIAL`: Sets an alternate |
| 2784 | serial port. Or, turns off serial when the variable is set with an |
| 2785 | empty string. |
| 2786 | |
| 2787 | - :term:`SYSLINUX_SERIAL_TTY`: Sets an |
| 2788 | alternate "console=tty..." kernel boot argument. |
| 2789 | |
| 2790 | .. _ref-classes-systemd: |
| 2791 | |
| 2792 | ``systemd.bbclass`` |
| 2793 | =================== |
| 2794 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2795 | The :ref:`systemd <ref-classes-systemd>` class provides support for recipes that install systemd |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2796 | unit files. |
| 2797 | |
| 2798 | The functionality for this class is disabled unless you have "systemd" |
| 2799 | in :term:`DISTRO_FEATURES`. |
| 2800 | |
| 2801 | Under this class, the recipe or Makefile (i.e. whatever the recipe is |
| 2802 | calling during the :ref:`ref-tasks-install` task) |
| 2803 | installs unit files into |
| 2804 | ``${``\ :term:`D`\ ``}${systemd_unitdir}/system``. If the unit |
| 2805 | files being installed go into packages other than the main package, you |
| 2806 | need to set :term:`SYSTEMD_PACKAGES` in your |
| 2807 | recipe to identify the packages in which the files will be installed. |
| 2808 | |
| 2809 | You should set :term:`SYSTEMD_SERVICE` to the |
| 2810 | name of the service file. You should also use a package name override to |
| 2811 | indicate the package to which the value applies. If the value applies to |
| 2812 | the recipe's main package, use ``${``\ :term:`PN`\ ``}``. Here |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2813 | is an example from the connman recipe:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2814 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 2815 | SYSTEMD_SERVICE:${PN} = "connman.service" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2816 | |
| 2817 | Services are set up to start on boot automatically |
| 2818 | unless you have set |
| 2819 | :term:`SYSTEMD_AUTO_ENABLE` to "disable". |
| 2820 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2821 | For more information on :ref:`systemd <ref-classes-systemd>`, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2822 | ":ref:`dev-manual/common-tasks:selecting an initialization manager`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2823 | section in the Yocto Project Development Tasks Manual. |
| 2824 | |
| 2825 | .. _ref-classes-systemd-boot: |
| 2826 | |
| 2827 | ``systemd-boot.bbclass`` |
| 2828 | ======================== |
| 2829 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2830 | The :ref:`systemd-boot <ref-classes-systemd-boot>` class provides functions specific to the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2831 | systemd-boot bootloader for building bootable images. This is an |
| 2832 | internal class and is not intended to be used directly. |
| 2833 | |
| 2834 | .. note:: |
| 2835 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2836 | The :ref:`systemd-boot <ref-classes-systemd-boot>` class is a result from merging the ``gummiboot`` class |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2837 | used in previous Yocto Project releases with the ``systemd`` project. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2838 | |
| 2839 | Set the :term:`EFI_PROVIDER` variable to |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2840 | ":ref:`systemd-boot <ref-classes-systemd-boot>`" to use this class. Doing so creates a standalone EFI |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2841 | bootloader that is not dependent on systemd. |
| 2842 | |
| 2843 | For information on more variables used and supported in this class, see |
| 2844 | the :term:`SYSTEMD_BOOT_CFG`, |
| 2845 | :term:`SYSTEMD_BOOT_ENTRIES`, and |
| 2846 | :term:`SYSTEMD_BOOT_TIMEOUT` variables. |
| 2847 | |
| 2848 | You can also see the `Systemd-boot |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 2849 | documentation <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2850 | for more information. |
| 2851 | |
| 2852 | .. _ref-classes-terminal: |
| 2853 | |
| 2854 | ``terminal.bbclass`` |
| 2855 | ==================== |
| 2856 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2857 | The :ref:`terminal <ref-classes-terminal>` class provides support for starting a terminal session. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2858 | The :term:`OE_TERMINAL` variable controls which |
| 2859 | terminal emulator is used for the session. |
| 2860 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2861 | Other classes use the :ref:`terminal <ref-classes-terminal>` class anywhere a separate terminal |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2862 | session needs to be started. For example, the |
| 2863 | :ref:`patch <ref-classes-patch>` class assuming |
| 2864 | :term:`PATCHRESOLVE` is set to "user", the |
| 2865 | :ref:`cml1 <ref-classes-cml1>` class, and the |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2866 | :ref:`devshell <ref-classes-devshell>` class all use the :ref:`terminal <ref-classes-terminal>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2867 | class. |
| 2868 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2869 | .. _ref-classes-testimage: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2870 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2871 | ``testimage.bbclass`` |
| 2872 | ===================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2873 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2874 | The :ref:`testimage <ref-classes-testimage>` class supports running automated tests against |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2875 | images using QEMU and on actual hardware. The classes handle loading the |
| 2876 | tests and starting the image. To use the classes, you need to perform |
| 2877 | steps to set up the environment. |
| 2878 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2879 | To enable this class, add the following to your configuration:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2880 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2881 | IMAGE_CLASSES += "testimage" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2882 | |
| 2883 | The tests are commands that run on the target system over ``ssh``. Each |
| 2884 | test is written in Python and makes use of the ``unittest`` module. |
| 2885 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2886 | The :ref:`testimage <ref-classes-testimage>` class runs tests on an image when called using the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2887 | following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2888 | |
| 2889 | $ bitbake -c testimage image |
| 2890 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 2891 | Alternatively, if you wish to have tests automatically run for each image |
| 2892 | after it is built, you can set :term:`TESTIMAGE_AUTO`:: |
| 2893 | |
| 2894 | TESTIMAGE_AUTO = "1" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2895 | |
| 2896 | For information on how to enable, run, and create new tests, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 2897 | ":ref:`dev-manual/common-tasks:performing automated runtime testing`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2898 | section in the Yocto Project Development Tasks Manual. |
| 2899 | |
| 2900 | .. _ref-classes-testsdk: |
| 2901 | |
| 2902 | ``testsdk.bbclass`` |
| 2903 | =================== |
| 2904 | |
| 2905 | This class supports running automated tests against software development |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2906 | kits (SDKs). The :ref:`testsdk <ref-classes-testsdk>` class runs tests on an SDK when called |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2907 | using the following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2908 | |
| 2909 | $ bitbake -c testsdk image |
| 2910 | |
| 2911 | .. note:: |
| 2912 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2913 | Best practices include using :term:`IMAGE_CLASSES` rather than |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2914 | :term:`INHERIT` to inherit the :ref:`testsdk <ref-classes-testsdk>` class for automated SDK |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2915 | testing. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2916 | |
| 2917 | .. _ref-classes-texinfo: |
| 2918 | |
| 2919 | ``texinfo.bbclass`` |
| 2920 | =================== |
| 2921 | |
| 2922 | This class should be inherited by recipes whose upstream packages invoke |
| 2923 | the ``texinfo`` utilities at build-time. Native and cross recipes are |
| 2924 | made to use the dummy scripts provided by ``texinfo-dummy-native``, for |
| 2925 | improved performance. Target architecture recipes use the genuine |
| 2926 | Texinfo utilities. By default, they use the Texinfo utilities on the |
| 2927 | host system. |
| 2928 | |
| 2929 | .. note:: |
| 2930 | |
| 2931 | If you want to use the Texinfo recipe shipped with the build system, |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 2932 | you can remove "texinfo-native" from :term:`ASSUME_PROVIDED` and makeinfo |
| 2933 | from :term:`SANITY_REQUIRED_UTILITIES`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2934 | |
| 2935 | .. _ref-classes-toaster: |
| 2936 | |
| 2937 | ``toaster.bbclass`` |
| 2938 | =================== |
| 2939 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2940 | The :ref:`toaster <ref-classes-toaster>` class collects information about packages and images and |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2941 | sends them as events that the BitBake user interface can receive. The |
| 2942 | class is enabled when the Toaster user interface is running. |
| 2943 | |
| 2944 | This class is not intended to be used directly. |
| 2945 | |
| 2946 | .. _ref-classes-toolchain-scripts: |
| 2947 | |
| 2948 | ``toolchain-scripts.bbclass`` |
| 2949 | ============================= |
| 2950 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2951 | The :ref:`toolchain-scripts <ref-classes-toolchain-scripts>` class provides the scripts used for setting up |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2952 | the environment for installed SDKs. |
| 2953 | |
| 2954 | .. _ref-classes-typecheck: |
| 2955 | |
| 2956 | ``typecheck.bbclass`` |
| 2957 | ===================== |
| 2958 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2959 | The :ref:`typecheck <ref-classes-typecheck>` class provides support for validating the values of |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2960 | variables set at the configuration level against their defined types. |
| 2961 | The OpenEmbedded build system allows you to define the type of a |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2962 | variable using the "type" varflag. Here is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2963 | |
| 2964 | IMAGE_FEATURES[type] = "list" |
| 2965 | |
| 2966 | .. _ref-classes-uboot-config: |
| 2967 | |
| 2968 | ``uboot-config.bbclass`` |
| 2969 | ======================== |
| 2970 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 2971 | The :ref:`uboot-config <ref-classes-uboot-config>` class provides support for U-Boot configuration for |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2972 | a machine. Specify the machine in your recipe as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2973 | |
| 2974 | UBOOT_CONFIG ??= <default> |
| 2975 | UBOOT_CONFIG[foo] = "config,images" |
| 2976 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 2977 | You can also specify the machine using this method:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2978 | |
| 2979 | UBOOT_MACHINE = "config" |
| 2980 | |
| 2981 | See the :term:`UBOOT_CONFIG` and :term:`UBOOT_MACHINE` variables for additional |
| 2982 | information. |
| 2983 | |
| 2984 | .. _ref-classes-uninative: |
| 2985 | |
| 2986 | ``uninative.bbclass`` |
| 2987 | ===================== |
| 2988 | |
| 2989 | Attempts to isolate the build system from the host distribution's C |
| 2990 | library in order to make re-use of native shared state artifacts across |
| 2991 | different host distributions practical. With this class enabled, a |
| 2992 | tarball containing a pre-built C library is downloaded at the start of |
| 2993 | the build. In the Poky reference distribution this is enabled by default |
| 2994 | through ``meta/conf/distro/include/yocto-uninative.inc``. Other |
| 2995 | distributions that do not derive from poky can also |
| 2996 | "``require conf/distro/include/yocto-uninative.inc``" to use this. |
| 2997 | Alternatively if you prefer, you can build the uninative-tarball recipe |
| 2998 | yourself, publish the resulting tarball (e.g. via HTTP) and set |
| 2999 | ``UNINATIVE_URL`` and ``UNINATIVE_CHECKSUM`` appropriately. For an |
| 3000 | example, see the ``meta/conf/distro/include/yocto-uninative.inc``. |
| 3001 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3002 | The :ref:`uninative <ref-classes-uninative>` class is also used unconditionally by the extensible |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3003 | SDK. When building the extensible SDK, ``uninative-tarball`` is built |
| 3004 | and the resulting tarball is included within the SDK. |
| 3005 | |
| 3006 | .. _ref-classes-update-alternatives: |
| 3007 | |
| 3008 | ``update-alternatives.bbclass`` |
| 3009 | =============================== |
| 3010 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3011 | The :ref:`update-alternatives <ref-classes-update-alternatives>` class helps the alternatives system when |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3012 | multiple sources provide the same command. This situation occurs when |
| 3013 | several programs that have the same or similar function are installed |
| 3014 | with the same name. For example, the ``ar`` command is available from |
| 3015 | the ``busybox``, ``binutils`` and ``elfutils`` packages. The |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3016 | :ref:`update-alternatives <ref-classes-update-alternatives>` class handles renaming the binaries so that |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3017 | multiple packages can be installed without conflicts. The ``ar`` command |
| 3018 | still works regardless of which packages are installed or subsequently |
| 3019 | removed. The class renames the conflicting binary in each package and |
| 3020 | symlinks the highest priority binary during installation or removal of |
| 3021 | packages. |
| 3022 | |
| 3023 | To use this class, you need to define a number of variables: |
| 3024 | |
| 3025 | - :term:`ALTERNATIVE` |
| 3026 | |
| 3027 | - :term:`ALTERNATIVE_LINK_NAME` |
| 3028 | |
| 3029 | - :term:`ALTERNATIVE_TARGET` |
| 3030 | |
| 3031 | - :term:`ALTERNATIVE_PRIORITY` |
| 3032 | |
| 3033 | These variables list alternative commands needed by a package, provide |
| 3034 | pathnames for links, default links for targets, and so forth. For |
| 3035 | details on how to use this class, see the comments in the |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 3036 | :yocto_git:`update-alternatives.bbclass </poky/tree/meta/classes-recipe/update-alternatives.bbclass>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3037 | file. |
| 3038 | |
| 3039 | .. note:: |
| 3040 | |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 3041 | You can use the ``update-alternatives`` command directly in your recipes. |
| 3042 | However, this class simplifies things in most cases. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3043 | |
| 3044 | .. _ref-classes-update-rc.d: |
| 3045 | |
| 3046 | ``update-rc.d.bbclass`` |
| 3047 | ======================= |
| 3048 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3049 | The :ref:`update-rc.d <ref-classes-update-rc.d>` class uses ``update-rc.d`` to safely install an |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3050 | initialization script on behalf of the package. The OpenEmbedded build |
| 3051 | system takes care of details such as making sure the script is stopped |
| 3052 | before a package is removed and started when the package is installed. |
| 3053 | |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3054 | Three variables control this class: :term:`INITSCRIPT_PACKAGES`, |
| 3055 | :term:`INITSCRIPT_NAME` and :term:`INITSCRIPT_PARAMS`. See the variable links |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3056 | for details. |
| 3057 | |
| 3058 | .. _ref-classes-useradd: |
| 3059 | |
| 3060 | ``useradd*.bbclass`` |
| 3061 | ==================== |
| 3062 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3063 | The :ref:`useradd* <ref-classes-useradd>` classes support the addition of users or groups for |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3064 | usage by the package on the target. For example, if you have packages |
| 3065 | that contain system services that should be run under their own user or |
| 3066 | group, you can use these classes to enable creation of the user or |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 3067 | group. The :oe_git:`meta-skeleton/recipes-skeleton/useradd/useradd-example.bb |
| 3068 | </openembedded-core/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb>` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3069 | recipe in the :term:`Source Directory` provides a simple |
| 3070 | example that shows how to add three users and groups to two packages. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3071 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3072 | The :ref:`useradd_base <ref-classes-useradd>` class provides basic functionality for user or |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3073 | groups settings. |
| 3074 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3075 | The :ref:`useradd* <ref-classes-useradd>` classes support the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3076 | :term:`USERADD_PACKAGES`, |
| 3077 | :term:`USERADD_PARAM`, |
| 3078 | :term:`GROUPADD_PARAM`, and |
| 3079 | :term:`GROUPMEMS_PARAM` variables. |
| 3080 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3081 | The :ref:`useradd-staticids <ref-classes-useradd>` class supports the addition of users or groups |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3082 | that have static user identification (``uid``) and group identification |
| 3083 | (``gid``) values. |
| 3084 | |
| 3085 | The default behavior of the OpenEmbedded build system for assigning |
| 3086 | ``uid`` and ``gid`` values when packages add users and groups during |
| 3087 | package install time is to add them dynamically. This works fine for |
| 3088 | programs that do not care what the values of the resulting users and |
| 3089 | groups become. In these cases, the order of the installation determines |
| 3090 | the final ``uid`` and ``gid`` values. However, if non-deterministic |
| 3091 | ``uid`` and ``gid`` values are a problem, you can override the default, |
| 3092 | dynamic application of these values by setting static values. When you |
| 3093 | set static values, the OpenEmbedded build system looks in |
| 3094 | :term:`BBPATH` for ``files/passwd`` and ``files/group`` |
| 3095 | files for the values. |
| 3096 | |
| 3097 | To use static ``uid`` and ``gid`` values, you need to set some |
| 3098 | variables. See the :term:`USERADDEXTENSION`, |
| 3099 | :term:`USERADD_UID_TABLES`, |
| 3100 | :term:`USERADD_GID_TABLES`, and |
| 3101 | :term:`USERADD_ERROR_DYNAMIC` variables. |
| 3102 | You can also see the :ref:`useradd <ref-classes-useradd>` class for |
| 3103 | additional information. |
| 3104 | |
| 3105 | .. note:: |
| 3106 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3107 | You do not use the :ref:`useradd-staticids <ref-classes-useradd>` class directly. You either enable |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3108 | or disable the class by setting the :term:`USERADDEXTENSION` variable. If you |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 3109 | enable or disable the class in a configured system, :term:`TMPDIR` might |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 3110 | contain incorrect ``uid`` and ``gid`` values. Deleting the :term:`TMPDIR` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3111 | directory will correct this condition. |
| 3112 | |
| 3113 | .. _ref-classes-utility-tasks: |
| 3114 | |
| 3115 | ``utility-tasks.bbclass`` |
| 3116 | ========================= |
| 3117 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3118 | The :ref:`utility-tasks <ref-classes-utility-tasks>` class provides support for various "utility" type |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3119 | tasks that are applicable to all recipes, such as |
| 3120 | :ref:`ref-tasks-clean` and |
| 3121 | :ref:`ref-tasks-listtasks`. |
| 3122 | |
| 3123 | This class is enabled by default because it is inherited by the |
| 3124 | :ref:`base <ref-classes-base>` class. |
| 3125 | |
| 3126 | .. _ref-classes-utils: |
| 3127 | |
| 3128 | ``utils.bbclass`` |
| 3129 | ================= |
| 3130 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3131 | The :ref:`utils <ref-classes-utils>` class provides some useful Python functions that are |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3132 | typically used in inline Python expressions (e.g. ``${@...}``). One |
| 3133 | example use is for ``bb.utils.contains()``. |
| 3134 | |
| 3135 | This class is enabled by default because it is inherited by the |
| 3136 | :ref:`base <ref-classes-base>` class. |
| 3137 | |
| 3138 | .. _ref-classes-vala: |
| 3139 | |
| 3140 | ``vala.bbclass`` |
| 3141 | ================ |
| 3142 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3143 | The :ref:`vala <ref-classes-vala>` class supports recipes that need to build software written |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3144 | using the Vala programming language. |
| 3145 | |
| 3146 | .. _ref-classes-waf: |
| 3147 | |
| 3148 | ``waf.bbclass`` |
| 3149 | =============== |
| 3150 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 3151 | The :ref:`waf <ref-classes-waf>` class supports recipes that need to build software that uses |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 3152 | the Waf build system. You can use the |
| 3153 | :term:`EXTRA_OECONF` or |
| 3154 | :term:`PACKAGECONFIG_CONFARGS` variables |
| 3155 | to specify additional configuration options to be passed on the Waf |
| 3156 | command line. |