%poky; ] > Classes Class files are used to abstract common functionality and share it amongst multiple recipe (.bb) files. To use a class file, you simply make sure the recipe inherits the class. In most cases, when a recipe inherits a class it is enough to enable its features. There are cases, however, where in the recipe you might need to set variables or override some default behavior. Any Metadata usually found in a recipe can also be placed in a class file. Class files are identified by the extension .bbclass and are usually placed in a classes/ directory beneath the meta*/ directory found in the Source Directory. Class files can also be pointed to by BUILDDIR (e.g. build/) in the same way as .conf files in the conf directory. Class files are searched for in BBPATH using the same method by which .conf files are searched. This chapter discusses only the most useful and important classes. Other classes do exist within the meta/classes directory in the Source Directory. You can reference the .bbclass files directly for more information.
<filename>allarch.bbclass</filename> The all architecture (allarch) class is inherited by recipes that do not produce architecture-specific output. The class disables functionality that is normally needed for recipes that produce executable binaries (such as building the cross-compiler and a C library as pre-requisites, and splitting out of debug symbols during packaging). By default, all recipes inherit the base and package classes, which enable functionality needed for recipes that produce executable output. If your recipe, for example, only produces packages that contain configuration files, media files, or scripts (e.g. Python and Perl), then it should inherit the allarch class.
The base Class - <filename>base.bbclass</filename> The base class is special in that every .bb file inherits it automatically. This class contains definitions for standard basic tasks such as fetching, unpacking, configuring (empty by default), compiling (runs any Makefile present), installing (empty by default) and packaging (empty by default). These classes are often overridden or extended by other classes such as autotools.bbclass or package.bbclass. The class also contains some commonly used functions such as oe_runmake.
Autotooled Packages - <filename>autotools.bbclass</filename> Autotools (autoconf, automake, and libtool) bring standardization. This class defines a set of tasks (configure, compile etc.) that work for all Autotooled packages. It should usually be enough to define a few standard variables and then simply inherit autotools. This class can also work with software that emulates Autotools. For more information, see the "Autotooled Package" section in the Yocto Project Development Manual. It's useful to have some idea of how the tasks defined by this class work and what they do behind the scenes. do_configure ‐ Regenerates the configure script (using autoreconf) and then launches it with a standard set of arguments used during cross-compilation. You can pass additional parameters to configure through the EXTRA_OECONF variable. do_compile ‐ Runs make with arguments that specify the compiler and linker. You can pass additional arguments through the EXTRA_OEMAKE variable. do_install ‐ Runs make install and passes in ${D} as DESTDIR.
Alternatives - <filename>update-alternatives.bbclass</filename> This class helps the alternatives system when multiple sources provide the same command. This situation occurs when several programs that have the same or similar function are installed with the same name. For example, the ar command is available from the busybox, binutils and elfutils packages. The update-alternatives.bbclass class handles renaming the binaries so that multiple packages can be installed without conflicts. The ar command still works regardless of which packages are installed or subsequently removed. The class renames the conflicting binary in each package and symlinks the highest priority binary during installation or removal of packages. To use this class, you need to define a number of variables: ALTERNATIVE ALTERNATIVE_LINK_NAME ALTERNATIVE_TARGET ALTERNATIVE_PRIORITY These variables list alternative commands needed by a package, provide pathnames for links, default links for targets, and so forth. For details on how to use this class, see the comments in the update-alternatives.bbclass. You can use the update-alternatives command directly in your recipes. However, this class simplifies things in most cases.
Initscripts - <filename>update-rc.d.bbclass</filename> This class uses update-rc.d to safely install an initialization script on behalf of the package. The OpenEmbedded build system takes care of details such as making sure the script is stopped before a package is removed and started when the package is installed. Three variables control this class: INITSCRIPT_PACKAGES, INITSCRIPT_NAME and INITSCRIPT_PARAMS. See the variable links for details.
<filename>binconfig.bbclass</filename> This class helps to correct paths in shell scripts. Before pkg-config had become widespread, libraries shipped shell scripts to give information about the libraries and include paths needed to build software (usually named LIBNAME-config). This class assists any recipe using such scripts. During staging, the OpenEmbedded build system installs such scripts into the sysroots/ directory. Inheriting this class results in all paths in these scripts being changed to point into the sysroots/ directory so that all builds that use the script use the correct directories for the cross compiling layout. See the BINCONFIG_GLOB variable for more information.
<filename>bin_package.bbclass</filename> The binary package (bin_package) class is a helper class for recipes that extract the contents of a binary package (e.g. an RPM) and install those contents rather than building the binary from source. The binary package is extracted and new packages in the configured output package format are created. For RPMs and other packages that do not contain a subdirectory, you should specify a "subdir" parameter. Here is an example where ${BP} matches the subdirectory expected by the default value of S: SRC_URI = "http://example.com/downloads/somepackage.rpm;subdir=${BP}"
<filename>blacklist.bbclass</filename> The blacklist (blacklist) class prevents the OpenEmbedded build system from building specific recipes (blacklists them). To use this class, inherit the class globally and set PNBLACKLIST for each recipe you wish to blacklist. Specify the PN value as a variable flag (varflag) and provide a reason, which is reported, if the package is requested to be built as the value. For example, if you want to blacklist a recipe called "exoticware", you add the following to your local.conf or distribution configuration: INHERIT += "blacklist" PNBLACKLIST[exoticware] = "Not supported by our organization."
<filename>boot-directdisk.bbclass</filename> The boot direct disk (boot-directdisk) class creates an image that can be placed directly onto a hard disk using dd and then booted. The image uses SYSLINUX. The end result is a 512 boot sector populated with a Master Boot Record (MBR) and partition table followed by an MSDOS FAT16 partition containing SYSLINUX and a Linux kernel completed by the ext2 and ext3 root filesystems.
<filename>bootimg.bbclass</filename> The boot image (bootimg class creates a bootable image using SYSLINUX, your kernel and an optional initial RAM disk (initrd). When you use this class, two things happen: A .hddimg file is created. This file which is an MSDOS filesystem that contains SYSLINUX, a kernel, an initrd, and a root filesystem image. All three of these can be written to hard drives directly and also booted on a USB flash disks using dd. A CD .iso image is created. When this file is booted, the initrd boots and processes the label selected in SYSLINUX. Actions based on the label are then performed (e.g. installing to a hard drive). The bootimg class supports the INITRD, NOISO, NOHDD, and ROOTFS variables.
<filename>bugzilla.bbclass</filename> The Bugzilla (bugzilla) class, if enabled in your instance of Bugzilla, automatically files bug reports to that enabled instance in response to build failures. This class uses Bugzilla's XML-RPC interface.
<filename>buildhistory.bbclass</filename> The Build History (buildhistory) class records a history of build output metadata, which can be used to detect possible regressions as well as used for analysis of the build output. For more information on using Build History, see the "Maintaining Build Output Quality" section.
<filename>buildstats.bbclass</filename> The Build Stats (buildstats) class records performance statistics about each task executed during the build (e.g. elapsed time, CPU usage, and I/O usage). When you use this class, the output goes into the BUILDSTATS_BASE directory, which defaults to ${TMPDIR}/buildstats/. You can analyze the elapsed time using scripts/pybootchartgui/pybootchartgui.py, which produces a cascading chart of the entire build process and can be useful for highlighting bottlenecks. To enable this class, use the USER_CLASSES variable from your local.conf file. The meta-yocto/conf/local.conf.sample file in the Source Directory enables this class by default.
<filename>chrpath.bbclass</filename> The change runtime search path (chrpath) class is a wrapper around the "chrpath" utility, which is used during the build process for nativesdk recipes to change RPATH records within binaries in order to make them relocatable.
<filename>ccache.bbclass</filename> The C/C++ Compiler Cache (ccache) class enables this cache for the build. This class is used to give a minor performance boost during the build. However, using the class can lead to unexpected side-effects. Thus, it is recommended that you do not use this class. See for information on the C/C++ Compiler Cache.
<filename>clutter.bbclass</filename> The Clutter (clutter) class consolidates the major and minor version naming and other common items used by Clutter and related recipes.
<filename>cmake.bbclass</filename> The CMake build system (cmake) class allows for recipes that need to build software using the CMake build system. You can use the EXTRA_OECMAKE variable to specify additional configuration options to be passed on the cmake command line.
<filename>cml1.bbclass</filename> The cml1 class provides basic support for the Linux kernel style build configuration system.
<filename>copyleft_compliance.bbclass</filename> The Copyleft Compliance (copyleft_compliance) class preserves source code for the purposes of license compliance. This class is an alternative to the archive* classes and is still used by some users even though it has been deprecated in favor of the archive* classes.
<filename>core-image.bbclass</filename> The Core Image (core-image) class provides common definitions for the core-image-* image recipes, such as support for additional IMAGE_FEATURES.
<filename>cross.bbclass</filename> The cross-compilation (cross) class provides support for cross-compilation tools.
<filename>cross-canadian.bbclass</filename> The Canadian Cross (cross-canadian) class provides support for Canadian Cross compilation tools for SDKs. See the "Cross-Development Toolchain Generation" section for more discussion on these cross-compilation tools.
<filename>crosssdk.bbclass</filename> The Cross SDK (crosssdk) class provides support for cross-compilation tools used for building SDKs. See the "Cross-Development Toolchain Generation" section for more discussion on these cross-compilation tools.
<filename>deploy.bbclass</filename> The Deploy (deploy) class handles deploying files to the DEPLOY_DIR_IMAGE directory. The main function of this class is to allow the deploy step to be accelerated by shared state. Recipes that inherit this class should define their own do_deploy function to copy the files to be deployed to DEPLOYDIR, and use addtask to add the task at the appropriate place, which is usually after do_compile or do_install.
<filename>distrodata.bbclass</filename> The Distribution Data (distrodata) class provides for automatic checking for upstream recipe updates.
<filename>distro_features_check.bbclass</filename> The Distribution Features Check (distro_features_check) class allows individual recipes to check for required and conflicting DISTRO_FEATURES. This class provides support for the REQUIRED_DISTRO_FEATURES and CONFLICT_DISTRO_FEATURES variables. If any conditions specified in the recipe using the above variables are not met, the recipe will be skipped.
<filename>extrausers.bbclass</filename> The extra users (extrausers) class allows additional user and group configuration to be applied at the image level. Inheriting this class either globally or from an image recipe allows additional user and group operations to be performed using the EXTRA_USERS_PARAMS variable. The user and group operations added using the extrausers class are not tied to a specific recipe but can be performed across the image as a whole. See the useradd class for information on how to add user and group configuration to a specific recipe. Here is an example that uses this class in an image recipe: inherit extrausers EXTRA_USERS_PARAMS = "\ useradd -p '' tester; \ groupadd developers; \ userdel nobody; \ groupdel -g video; \ groupmod -g 1020 developers; \ usermod -s /bin/sh tester; \ "
<filename>fontcache.bbclass</filename> The font cache (fontcache) class generates the proper post-installation and post-remove (postinst and postrm) scriptlets for font packages. These scriptlets call fc-cache (part of Fontconfig) to add the fonts to the font information cache. Since the cache files are architecture-specific, fc-cache runs using QEMU if the postinst scriptlets need to be run on the build host during image creation. If the fonts being installed are in packages other than the main package, set FONT_PACKAGES to include the packages containing the fonts.
Debian Renaming - <filename>debian.bbclass</filename> This class renames packages so that they follow the Debian naming policy (i.e. eglibc becomes libc6 and eglibc-devel becomes libc6-dev.)
<filename>gconf.bbclass</filename> The GConf (gconf) class provides common functionality for recipes that need to install GConf schemas. The schemas will be put into a separate package (${PN}-gconf) that is created automatically when this class is inherited. This package uses the appropriate post-installation and post-remove (postinst/postrm) scriptlets to register and unregister the schemas in the target image.
<filename>gettext.bbclass</filename> The GText (gettext) class provides support for building software that uses the GNU gettext internationalization and localization system. All recipes building software that use gettext should inherit this class.
<filename>gnome.bbclass</filename> The GNOME (gnome) class supports recipes that build software from the GNOME stack. This class inherits the gnomebase, gtk-icon-cache, gconf and mime classes. The class also disables GLib Object System (Gobject) introspection where applicable.
<filename>gnomebase.bbclass</filename> The GNOME base (gnomebase) class is the base class for recipes that build software from the GNOME stack.
<filename>grub-efi.bbclass</filename> The GRUB Extensible Firmware Interface (grub-efi) class provides grub-efi-specific functions for building bootable images. This class supports several variables: INITRD: Indicates a filesystem image to use as an initrd (optional). ROOTFS: Indicates a filesystem image to include as the root filesystem (optional). GRUB_GFXSERIAL: Set this to "1" to have graphics and serial in the boot menu. LABELS: A list of targets for the automatic configuration. APPEND: An override list of append strings for each LABEL. GRUB_OPTS: Additional options to add to the configuration (optional). Options are delimited using semi-colon characters (;). GRUB_TIMEOUT: Timeout before executing the default LABEL (optional).
<filename>gsettings.bbclass</filename> The GSettings (gsettings) class provides common functionality for recipes that need to install GSettings (glib) schemas. The schemas are assumed to be part of the main package. Appropriate post-installation and post-remove (postinst/postrm) scriptlets are added to register and unregister the schemas in the target image.
<filename>gtk-doc.bbclass</filename> The GIMP Toolkit Documentation (gtk-doc) class is a helper class to pull in the appropriate gtk-doc dependencies and disable gtk-doc.
<filename>gtk-icon-cache.bbclass</filename> The GIMP Toolkit icon cache (gtk-icon-cache) class Generates the proper post-install and post-remove (postinst/postrm) scriptlets for packages that use GTK+ and install icons. These scriptlets call gtk-update-icon-cache to add the fonts to GTK+'s icon cache. Since the cache files are architecture-specific, gtk-update-icon-cache is run using QEMU if the postinst scriptlets need to be run on the build host during image creation.
<filename>gtk-immodules-cache.bbclass</filename> The GIMP Toolkit input method modules (gtk-immodules-cache) class generates the proper post-install and post-remove (postinst/postrm) scriptlets for packages that install GTK+ input method modules for virtual keyboards. These scriptlets call gtk-update-icon-cache to add the input method modules to the cache. Since the cache files are architecture-specific, gtk-update-icon-cache is run using QEMU if the postinst scriptlets need to be run on the build host during image creation. If the input method modules being installed are in packages other than the main package, set GTKIMMODULES_PACKAGES to include the packages containing the modules.
<filename>gzipnative.bbclass</filename> The gzip native (gzipnative) class enables the use of native versions of gzip and pigz rather than the system versions.
<filename>icecc.bbclass</filename> The Icecream distributed compile support (icecc) class stages directories with symlinks from gcc and g++ to icecc, for both native and cross compilers. Depending on each configure or compile, the OpenEmbedded build system adds the directories at the head of the PATH list and then sets ICECC_CXX and ICEC_CC. For the cross compiler, the class creates a tar.gz file that contains the Yocto Project toolchain and sets ICECC_VERSION accordingly. The class handles all three different compile stages (i.e native ,cross-kernel and target) and creates the necessary environment tar.gz file to be used by the remote machines. The class also supports SDK generation. If ICECC_PATH is not set in your local.conf file, then the class tries to locate it using which. If ICECC_ENV_EXEC is set in your local.conf file, the variable should point to the icecc-create-env script provided by the user. If you do not point to a user-provided script, the build system uses the default script provided by the recipe icecc-create-env.bb. This script is a modified version and not the one that comes with icecc. If you do not want the Icecream distributed compile support to apply to specific packages or classes, you can effectively "blacklist" them by listing the packages and classes using the ICECC_USER_PACKAGE_BL and ICECC_USER_CLASS_BL, variables, respectively, in your local.conf file. Doing so causes the OpenEmbedded build system to handle these compilations locally. Additionally, you can list packages using the ICECC_USER_PACKAGE_WL variable in your local.conf file to force icecc to be enabled for packages using an empty PARALLEL_MAKE variable.
<filename>image-live.bbclass</filename> The live image (image-live) class supports building "live" images. Normally, you do not use this class directly. Instead, you add "live" to IMAGE_FSTYPES.
<filename>image-vmdk.bbclass</filename> The Virtual Machine Disk image (image-vmdk) class supports building VMware VMDK images. Normally, you do not use this class directly. Instead, you add "vmdk" to IMAGE_FSTYPES.
<filename>image-mklibs.bbclass</filename> The make libraries (mklibs) class enables the use of the mklibs utility during the do_rootfs task, which optimizes the size of libraries contained in the image. The USER_CLASSES variable enables this class. By default, the class is enabled in the local.conf.template in the Source Directory as follows: USER_CLASSES ?= "buildstats image-mklibs image-prelink"
<filename>image-swab.bbclass</filename> The image Swabber (image-swab) class enables the Swabber tool in order to detect and log accesses to the host system during the OpenEmbedded build process. This class is currently unmaintained.
<filename>mime.bbclass</filename> The GNOME (mime) class
Pkg-config - <filename>pkgconfig.bbclass</filename> pkg-config provides a standard way to get header and library information. This class aims to smooth integration of pkg-config into libraries that use it. During staging, BitBake installs pkg-config data into the sysroots/ directory. By making use of sysroot functionality within pkg-config, this class no longer has to manipulate the files.
Archiving Sources - <filename>archive*.bbclass</filename> Many software licenses require that source code and other materials be released with the binaries. To help with that task, the following classes are provided: archive-original-sources.bbclass archive-patched-sources.bbclass archive-configured-sources.bbclass archiver.bbclass For more details on the source archiver, see the "Maintaining Open Source License Compliance During Your Product's Lifecycle" section in the Yocto Project Development Manual.
Perl Modules - <filename>cpan.bbclass</filename> Recipes for Perl modules are simple. These recipes usually only need to point to the source's archive and then inherit the proper .bbclass file. Building is split into two methods depending on which method the module authors used. Modules that use old Makefile.PL-based build system require cpan.bbclass in their recipes. Modules that use Build.PL-based build system require using cpan_build.bbclass in their recipes.
Python Extensions - <filename>distutils.bbclass</filename> Recipes for Python extensions are simple. These recipes usually only need to point to the source's archive and then inherit the proper .bbclass file. Building is split into two methods depending on which method the module authors used. Extensions that use an Autotools-based build system require Autotools and distutils-based .bbclasse files in their recipes. Extensions that use distutils-based build systems require distutils.bbclass in their recipes.
Developer Shell - <filename>devshell.bbclass</filename> This class adds the devshell task. Distribution policy dictates whether to include this class. See the "Using a Development Shell" section in the Yocto Project Development Manual for more information about using devshell.
Package Groups - <filename>packagegroup.bbclass</filename> This class sets default values appropriate for package group recipes (e.g. PACKAGES, PACKAGE_ARCH, ALLOW_EMPTY, and so forth). It is highly recommended that all package group recipes inherit this class. For information on how to use this class, see the "Customizing Images Using Custom Package Groups" section in the Yocto Project Development Manual. Previously, this class was named task.bbclass.
Packaging - <filename>package*.bbclass</filename> The packaging classes add support for generating packages from a build's output. The core generic functionality is in package.bbclass. The code specific to particular package types is contained in various sub-classes such as package_deb.bbclass, package_ipk.bbclass, and package_rpm.bbclass. Most users will want one or more of these classes. You can control the list of resulting package formats by using the PACKAGE_CLASSES variable defined in the local.conf configuration file, which is located in the conf folder of the Source Directory. When defining the variable, you can specify one or more package types. Since images are generated from packages, a packaging class is needed to enable image generation. The first class listed in this variable is used for image generation. If you take the optional step to set up a repository (package feed) on the development host that can be used by Smart, you can install packages from the feed while you are running the image on the target (i.e. runtime installation of packages). For more information, see the "Using Runtime Package Management" section in the Yocto Project Development Manual. The package class you choose can affect build-time performance and has space ramifications. In general, building a package with IPK takes about thirty percent less time as compared to using RPM to build the same or similar package. This comparison takes into account a complete build of the package with all dependencies previously built. The reason for this discrepancy is because the RPM package manager creates and processes more Metadata than the IPK package manager. Consequently, you might consider setting PACKAGE_CLASSES to "package_ipk" if you are building smaller systems. Before making your decision on package manager, however, you should consider some further things about using RPM: RPM starts to provide more abilities than IPK due to the fact that it processes more metadata. For example, this information includes individual file types, file checksum generation and evaluation on install, sparse file support, conflict detection and resolution for Multilib systems, ACID style upgrade, and repackaging abilities for rollbacks. For smaller systems, the extra space used for the Berkley Database and the amount of metadata when using RPM can affect your ability to perform on-device upgrades. You can find additional information on the effects of the package class at these two Yocto Project mailing list links: https://lists.yoctoproject.org/pipermail/poky/2011-May/006362.html https://lists.yoctoproject.org/pipermail/poky/2011-May/006363.html
Building Kernels - <filename>kernel.bbclass</filename> This class handles building Linux kernels. The class contains code to build all kernel trees. All needed headers are staged into the STAGING_KERNEL_DIR directory to allow out-of-tree module builds using module.bbclass. This means that each built kernel module is packaged separately and inter-module dependencies are created by parsing the modinfo output. If all modules are required, then installing the kernel-modules package installs all packages with modules and various other kernel packages such as kernel-vmlinux. Various other classes are used by the kernel and module classes internally including kernel-arch.bbclass, module_strip.bbclass, module-base.bbclass, and linux-kernel-base.bbclass.
Creating Images - <filename>image.bbclass</filename> and <filename>rootfs*.bbclass</filename> These classes add support for creating images in several formats. First, the root filesystem is created from packages using one of the rootfs_*.bbclass files (depending on the package format used) and then the image is created. The IMAGE_FSTYPES variable controls the types of images to generate. The IMAGE_INSTALL variable controls the list of packages to install into the image.
Host System Sanity Checks - <filename>sanity.bbclass</filename> This class checks to see if prerequisite software is present on the host system so that users can be notified of potential problems that might affect their build. The class also performs basic user configuration checks from the local.conf configuration file to prevent common mistakes that cause build failures. Distribution policy usually determines whether to include this class.
<filename>insane.bbclass</filename> This class adds a step to the package generation process so that output quality assurance checks are generated by the OpenEmbedded build system. A range of checks are performed that check the build's output for common problems that show up during runtime. Distribution policy usually dictates whether to include this class. You can configure the sanity checks so that specific test failures either raise a warning or an error message. Typically, failures for new tests generate a warning. Subsequent failures for the same test would then generate an error message once the metadata is in a known and good condition. Use the WARN_QA and ERROR_QA variables to control the behavior of these checks at the global level (i.e. in your custom distro configuration). However, to skip one or more checks in recipes, you should use INSANE_SKIP. For example, to skip the check for symbolic link .so files in the main package of a recipe, add the following to the recipe. You need to realize that the package name override, in this example ${PN}, must be used: INSANE_SKIP_${PN} += "dev-so" Please keep in mind that the QA checks exist in order to detect real or potential problems in the packaged output. So exercise caution when disabling these checks. The following list shows the tests you can list with the WARN_QA and ERROR_QA variables: ldflags: Ensures that the binaries were linked with the LDFLAGS options provided by the build system. If this test fails, check that the LDFLAGS variable is being passed to the linker command. useless-rpaths: Checks for dynamic library load paths (rpaths) in the binaries that by default on a standard system are searched by the linker (e.g. /lib and /usr/lib). While these paths will not cause any breakage, they do waste space and are unnecessary. rpaths: Checks for rpaths in the binaries that contain build system paths such as TMPDIR. If this test fails, bad -rpath options are being passed to the linker commands and your binaries have potential security issues. dev-so: Checks that the .so symbolic links are in the -dev package and not in any of the other packages. In general, these symlinks are only useful for development purposes. Thus, the -dev package is the correct location for them. Some very rare cases do exist for dynamically loaded modules where these symlinks are needed instead in the main package. debug-files: Checks for .debug directories in anything but the -dbg package. The debug files should all be in the -dbg package. Thus, anything packaged elsewhere is incorrect packaging. arch: Checks the Executable and Linkable Format (ELF) type, bit size, and endianness of any binaries to ensure they match the target architecture. This test fails if any binaries don't match the type since there would be an incompatibility. Sometimes software, like bootloaders, might need to bypass this check. debug-deps: Checks that -dbg packages only depend on other -dbg packages and not on any other types of packages, which would cause a packaging bug. dev-deps: Checks that -dev packages only depend on other -dev packages and not on any other types of packages, which would be a packaging bug. pkgconfig: Checks .pc files for any TMPDIR/WORKDIR paths. Any .pc file containing these paths is incorrect since pkg-config itself adds the correct sysroot prefix when the files are accessed. textrel: Checks for ELF binaries that contain relocations in their .text sections, which can result in a performance impact at runtime. pkgvarcheck: Checks through the variables RDEPENDS, RRECOMMENDS, RSUGGESTS, RCONFLICTS, RPROVIDES, RREPLACES, FILES, ALLOW_EMPTY, pkg_preinst, pkg_postinst, pkg_prerm and pkg_postrm, and reports if there are variable sets that are not package-specific. Using these variables without a package suffix is bad practice, and might unnecessarily complicate dependencies of other packages within the same recipe or have other unintended consequences. xorg-driver-abi: Checks that all packages containing Xorg drivers have ABI dependencies. The xserver-xorg recipe provides driver ABI names. All drivers should depend on the ABI versions that they have been built against. Driver recipes that include xorg-driver-input.inc or xorg-driver-video.inc will automatically get these versions. Consequently, you should only need to explicitly add dependencies to binary driver recipes. libexec: Checks if a package contains files in /usr/libexec. This check is not performed if the libexecdir variable has been set explicitly to /usr/libexec. staticdev: Checks for static library files (*.a) in non-staticdev packages. la: Checks .la files for any TMPDIR paths. Any .la file containing these paths is incorrect since libtool adds the correct sysroot prefix when using the files automatically itself. desktop: Runs the desktop-file-validate program against any .desktop files to validate their contents against the specification for .desktop files. already-stripped: Checks that produced binaries have not already been stripped prior to the build system extracting debug symbols. It is common for upstream software projects to default to stripping debug symbols for output binaries. In order for debugging to work on the target using -dbg packages, this stripping must be disabled. split-strip: Reports that splitting or stripping debug symbols from binaries has failed. arch: Checks to ensure the architecture, bit size, and endianness of all output binaries matches that of the target. This test can detect when the wrong compiler or compiler options have been used. installed-vs-shipped: Reports when files have been installed within do_install but have not been included in any package by way of the FILES variable. Files that do not appear in any package cannot be present in an image later on in the build process. Ideally, all installed files should be packaged or not installed at all. These files can be deleted at the end of do_install if the files are not needed in any package. dep-cmp: Checks for invalid version comparison statements in runtime dependency relationships between packages (i.e. in RDEPENDS, RRECOMMENDS, RSUGGESTS, RPROVIDES, RREPLACES, and RCONFLICTS variable values). Any invalid comparisons might trigger failures or undesirable behavior when passed to the package manager. files-invalid: Checks for FILES variable values that contain "//", which is invalid. incompatible-license: Report when packages are excluded from being created due to being marked with a license that is in INCOMPATIBLE_LICENSE. compile-host-path: Checks the do_compile log for indications that paths to locations on the build host were used. Using such paths might result in host contamination of the build output. install-host-path: Checks the do_install log for indications that paths to locations on the build host were used. Using such paths might result in host contamination of the build output. libdir: Checks for libraries being installed into incorrect (possibly hardcoded) installation paths. For example, this test will catch recipes that install /lib/bar.so when ${base_libdir} is "lib32". Another example is when recipes install /usr/lib64/foo.so when ${libdir} is "/usr/lib". packages-list: Checks for the same package being listed multiple times through the PACKAGES variable value. Installing the package in this manner can cause errors during packaging. perm-config: Reports lines in fs-perms.txt that have an invalid format. perm-line: Reports lines in fs-perms.txt that have an invalid format. perm-link: Reports lines in fs-perms.txt that specify 'link' where the specified target already exists. pkgname: Checks that all packages in PACKAGES have names that do not contain invalid characters (i.e. characters other than 0-9, a-z, ., +, and -). pn-overrides: Checks that a recipe does not have a name (PN) value that appears in OVERRIDES. If a recipe is named such that its PN value matches something already in OVERRIDES (e.g. PN happens to be the same as MACHINE or DISTRO), it can have unexpected consequences. For example, assignments such as FILES_${PN} = "xyz" effectively turn into FILES = "xyz". unsafe-references-in-binaries: Reports when a binary installed in ${base_libdir}, ${base_bindir}, or ${base_sbindir}, depends on another binary installed under ${exec_prefix}. This dependency is a concern if you want the system to remain basically operable if /usr is mounted separately and is not mounted. Defaults for binaries installed in ${base_libdir}, ${base_bindir}, and ${base_sbindir} are /lib, /bin, and /sbin, respectively. The default for a binary installed under ${exec_prefix} is /usr. unsafe-references-in-scripts: Reports when a script file installed in ${base_libdir}, ${base_bindir}, or ${base_sbindir}, depends on files installed under ${exec_prefix}. This dependency is a concern if you want the system to remain basically operable if /usr is mounted separately and is not mounted. Defaults for binaries installed in ${base_libdir}, ${base_bindir}, and ${base_sbindir} are /lib, /bin, and /sbin, respectively. The default for a binary installed under ${exec_prefix} is /usr. var-undefined: Reports when variables fundamental to packaging (i.e. WORKDIR, DEPLOY_DIR, D, PN, and PKGD) are undefined during do_package. pkgv-undefined: Checks to see if the PKGV variable is undefined during do_package. buildpaths: Checks for paths to locations on the build host inside the output files. Currently, this test triggers too many false positives and thus is not normally enabled. perms: Currently, this check is unused but reserved. version-going-backwards: If Build History is enabled, reports when a package being written out has a lower version than the previously written package under the same name. If you are placing output packages into a feed and upgrading packages on a target system using that feed, the version of a package going backwards can result in the target system not correctly upgrading to the "new" version of the package. If you are not using runtime package management on your target system, then you do not need to worry about this situation.
Removing Work Files During the Build - <filename>rm_work.bbclass</filename> The OpenEmbedded build system can use a substantial amount of disk space during the build process. A portion of this space is the work files under the ${TMPDIR}/work directory for each recipe. Once the build system generates the packages for a recipe, the work files for that recipe are no longer needed. However, by default, the build system preserves these files for inspection and possible debugging purposes. If you would rather have these files deleted to save disk space as the build progresses, you can enable rm_work by adding the following to your local.conf file, which is found in the Build Directory. INHERIT += "rm_work" If you are modifying and building source code out of the work directory for a recipe, enabling rm_work will potentially result in your changes to the source being lost. To exclude some recipes from having their work directories deleted by rm_work, you can add the names of the recipe or recipes you are working on to the RM_WORK_EXCLUDE variable, which can also be set in your local.conf file. Here is an example: RM_WORK_EXCLUDE += "busybox eglibc"
Autotools Configuration Data Cache - <filename>siteinfo.bbclass</filename> Autotools can require tests that must execute on the target hardware. Since this is not possible in general when cross compiling, site information is used to provide cached test results so these tests can be skipped over but still make the correct values available. The meta/site directory contains test results sorted into different categories such as architecture, endianness, and the libc used. Site information provides a list of files containing data relevant to the current build in the CONFIG_SITE variable that Autotools automatically picks up. The class also provides variables like SITEINFO_ENDIANNESS and SITEINFO_BITS that can be used elsewhere in the metadata. Because this class is included from base.bbclass, it is always active.
Adding Users - <filename>useradd.bbclass</filename> If you have packages that install files that are owned by custom users or groups, you can use this class to specify those packages and associate the users and groups with those packages. The meta-skeleton/recipes-skeleton/useradd/useradd-example.bb recipe in the Source Directory provides a simple example that shows how to add three users and groups to two packages. See the useradd-example.bb for more information on how to use this class.
<filename>externalsrc.bbclass</filename> You can use this class to build software from source code that is external to the OpenEmbedded build system. Building software from an external source tree means that the build system's normal fetch, unpack, and patch process is not used. By default, the OpenEmbedded build system uses the S and B variables to locate unpacked recipe source code and to build it, respectively. When your recipe inherits externalsrc.bbclass, you use the EXTERNALSRC and EXTERNALSRC_BUILD variables to ultimately define S and B. By default, this class expects the source code to support recipe builds that use the B variable to point to the directory in which the OpenEmbedded build system places the generated objects built from the recipes. By default, the B directory is set to the following, which is separate from the source directory (S): ${WORKDIR}/${BPN}/{PV}/ See the glossary entries for the WORKDIR, BPN, PV, For more information on externalsrc.bbclass, see the comments in meta/classes/externalsrc.bbclass in the Source Directory. For information on how to use externalsrc.bbclass, see the "Building Software from an External Source" section in the Yocto Project Development Manual.
<filename>testimage.bbclass</filename> You can use this class to enable running a series of automated tests for images. The class handles loading the tests and starting the image. Currently, there is only support for running these tests under QEMU. To use the class, you need to perform steps to set up the environment. The tests are commands that run on the target system over ssh. they are written in Python and make use of the unittest module. For information on how to enable, run, and create new tests, see the "Performing Automated Runtime Testing" section.
Other Classes Thus far, this chapter has discussed only the most useful and important classes. However, other classes exist within the meta/classes directory in the Source Directory. You can examine the .bbclass files directly for more information.