This version of the project is now considered obsolete, please select and use a more recent version.

Yocto Project Reference Manual

Scott Rifenbark

Scotty's Documentation Services, INC

Permission is granted to copy, distribute and/or modify this document under the terms of the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales as published by Creative Commons.

Manual Notes

  • This version of the Yocto Project Reference Manual is for the 2.4 release of the Yocto Project. To be sure you have the latest version of the manual for this release, use the manual from the Yocto Project documentation page.

  • For manuals associated with other releases of the Yocto Project, go to the Yocto Project documentation page and use the drop-down "Active Releases" button and choose the manual associated with the desired Yocto Project.

  • To report any inaccuracies or problems with this manual, send an email to the Yocto Project discussion group at yocto@yoctoproject.com or log into the freenode #yocto channel.

Revision History
Revision 4.0+git24 November 2010
Released with the Yocto Project 0.9 Release
Revision 1.06 April 2011
Released with the Yocto Project 1.0 Release.
Revision 1.0.123 May 2011
Released with the Yocto Project 1.0.1 Release.
Revision 1.16 October 2011
Released with the Yocto Project 1.1 Release.
Revision 1.2April 2012
Released with the Yocto Project 1.2 Release.
Revision 1.3October 2012
Released with the Yocto Project 1.3 Release.
Revision 1.4April 2013
Released with the Yocto Project 1.4 Release.
Revision 1.5October 2013
Released with the Yocto Project 1.5 Release.
Revision 1.5.1January 2014
Released with the Yocto Project 1.5.1 Release.
Revision 1.6April 2014
Released with the Yocto Project 1.6 Release.
Revision 1.7October 2014
Released with the Yocto Project 1.7 Release.
Revision 1.8April 2015
Released with the Yocto Project 1.8 Release.
Revision 2.0October 2015
Released with the Yocto Project 2.0 Release.
Revision 2.1April 2016
Released with the Yocto Project 2.1 Release.
Revision 2.2October 2016
Released with the Yocto Project 2.2 Release.
Revision 2.3May 2017
Released with the Yocto Project 2.3 Release.
Revision 2.4October 2017
Released with the Yocto Project 2.4 Release.

Table of Contents

1. Introduction
1.1. Welcome
1.2. Introducing the Yocto Project Development Environment
1.3. System Requirements
1.3.1. Supported Linux Distributions
1.3.2. Required Packages for the Host Development System
1.3.3. Required Git, tar, and Python Versions
1.4. Obtaining the Yocto Project
1.5. Development Checkouts
1.6. Yocto Project Terms
2. Using the Yocto Project
2.1. Running a Build
2.1.1. Build Overview
2.1.2. Building an Image Using GPL Components
2.2. Installing and Using the Result
2.3. Debugging Tools and Techniques
2.3.1. Viewing Logs from Failed Tasks
2.3.2. Viewing Variable Values
2.3.3. Viewing Package Information with oe-pkgdata-util
2.3.4. Viewing Dependencies Between Recipes and Tasks
2.3.5. Viewing Task Variable Dependencies
2.3.6. Running Specific Tasks
2.3.7. General BitBake Problems
2.3.8. Development Host System Issues
2.3.9. Building with No Dependencies
2.3.10. Recipe Logging Mechanisms
2.3.11. Other Tips
2.4. Quick EMUlator (QEMU)
2.4.1. QEMU Availability
2.4.2. QEMU Performance
2.4.3. QEMU Command-Line Syntax
2.4.4. runqemu Command-Line Options
2.5. Maintaining Build Output Quality
2.5.1. Enabling and Disabling Build History
2.5.2. Understanding What the Build History Contains
2.6. Speeding Up the Build
3. The Yocto Project Development Environment
3.1. Open Source Philosophy
3.2. Workflows
3.3. Git
3.3.1. Repositories, Tags, and Branches
3.3.2. Basic Commands
3.4. Yocto Project Source Repositories
3.5. Licensing
3.6. Recipe Syntax
3.7. Development Concepts
3.7.1. User Configuration
3.7.2. Metadata, Machine Configuration, and Policy Configuration
3.7.3. Sources
3.7.4. Package Feeds
3.7.5. BitBake
3.7.6. Images
3.7.7. Application Development SDK
4. Technical Details
4.1. Yocto Project Components
4.1.1. BitBake
4.1.2. Metadata (Recipes)
4.1.3. Metadata (Virtual Providers)
4.1.4. Classes
4.1.5. Configuration
4.2. Cross-Development Toolchain Generation
4.3. Shared State Cache
4.3.1. Overall Architecture
4.3.2. Checksums (Signatures)
4.3.3. Shared State
4.3.4. Tips and Tricks
4.4. Automatically Added Runtime Dependencies
4.5. Fakeroot and Pseudo
4.6. Wic Plug-Ins Interface
4.7. x32
4.7.1. Support
4.7.2. Completing x32
4.7.3. Using x32 Right Now
4.8. Wayland
4.8.1. Support
4.8.2. Enabling Wayland in an Image
4.8.3. Running Weston
4.9. Licenses
4.9.1. Tracking License Changes
4.9.2. Enabling Commercially Licensed Recipes
5. Yocto Project Releases and the Stable Release Process
5.1. Major and Minor Release Cadence
5.2. Major Release Codenames
5.3. Stable Release Process
5.4. Testing and Quality Assurance
6. Migrating to a Newer Yocto Project Release
6.1. General Migration Considerations
6.2. Moving to the Yocto Project 1.3 Release
6.2.1. Local Configuration
6.2.2. Recipes
6.2.3. Linux Kernel Naming
6.3. Moving to the Yocto Project 1.4 Release
6.3.1. BitBake
6.3.2. Build Behavior
6.3.3. Proxies and Fetching Source
6.3.4. Custom Interfaces File (netbase change)
6.3.5. Remote Debugging
6.3.6. Variables
6.3.7. Target Package Management with RPM
6.3.8. Recipes Moved
6.3.9. Removals and Renames
6.4. Moving to the Yocto Project 1.5 Release
6.4.1. Host Dependency Changes
6.4.2. atom-pc Board Support Package (BSP)
6.4.3. BitBake
6.4.4. QA Warnings
6.4.5. Directory Layout Changes
6.4.6. Shortened Git SRCREV Values
6.4.7. IMAGE_FEATURES
6.4.8. /run
6.4.9. Removal of Package Manager Database Within Image Recipes
6.4.10. Images Now Rebuild Only on Changes Instead of Every Time
6.4.11. Task Recipes
6.4.12. BusyBox
6.4.13. Automated Image Testing
6.4.14. Build History
6.4.15. udev
6.4.16. Removed and Renamed Recipes
6.4.17. Other Changes
6.5. Moving to the Yocto Project 1.6 Release
6.5.1. archiver Class
6.5.2. Packaging Changes
6.5.3. BitBake
6.5.4. Changes to Variables
6.5.5. Package Test (ptest)
6.5.6. Build Changes
6.5.7. qemu-native
6.5.8. core-image-basic
6.5.9. Licensing
6.5.10. CFLAGS Options
6.5.11. Custom Image Output Types
6.5.12. Tasks
6.5.13. update-alternative Provider
6.5.14. virtclass Overrides
6.5.15. Removed and Renamed Recipes
6.5.16. Removed Classes
6.5.17. Reference Board Support Packages (BSPs)
6.6. Moving to the Yocto Project 1.7 Release
6.6.1. Changes to Setting QEMU PACKAGECONFIG Options in local.conf
6.6.2. Minimum Git version
6.6.3. Autotools Class Changes
6.6.4. Binary Configuration Scripts Disabled
6.6.5. eglibc 2.19 Replaced with glibc 2.20
6.6.6. Kernel Module Autoloading
6.6.7. QA Check Changes
6.6.8. Removed Recipes
6.6.9. Miscellaneous Changes
6.7. Moving to the Yocto Project 1.8 Release
6.7.1. Removed Recipes
6.7.2. BlueZ 4.x / 5.x Selection
6.7.3. Kernel Build Changes
6.7.4. SSL 3.0 is Now Disabled in OpenSSL
6.7.5. Default Sysroot Poisoning
6.7.6. Rebuild Improvements
6.7.7. QA Check and Validation Changes
6.7.8. Miscellaneous Changes
6.8. Moving to the Yocto Project 2.0 Release
6.8.1. GCC 5
6.8.2. Gstreamer 0.10 Removed
6.8.3. Removed Recipes
6.8.4. BitBake datastore improvements
6.8.5. Shell Message Function Changes
6.8.6. Extra Development/Debug Package Cleanup
6.8.7. Recipe Maintenance Tracking Data Moved to OE-Core
6.8.8. Automatic Stale Sysroot File Cleanup
6.8.9. linux-yocto Kernel Metadata Repository Now Split from Source
6.8.10. Additional QA checks
6.8.11. Miscellaneous Changes
6.9. Moving to the Yocto Project 2.1 Release
6.9.1. Variable Expansion in Python Functions
6.9.2. Overrides Must Now be Lower-Case
6.9.3. Expand Parameter to getVar() and getVarFlag() is Now Mandatory
6.9.4. Makefile Environment Changes
6.9.5. libexecdir Reverted to ${prefix}/libexec
6.9.6. ac_cv_sizeof_off_t is No Longer Cached in Site Files
6.9.7. Image Generation is Now Split Out from Filesystem Generation
6.9.8. Removed Recipes
6.9.9. Class Changes
6.9.10. Build System User Interface Changes
6.9.11. ADT Removed
6.9.12. Poky Reference Distribution Changes
6.9.13. Packaging Changes
6.9.14. Tuning File Changes
6.9.15. Supporting GObject Introspection
6.9.16. Miscellaneous Changes
6.10. Moving to the Yocto Project 2.2 Release
6.10.1. Minimum Kernel Version
6.10.2. Staging Directories in Sysroot Has Been Simplified
6.10.3. Removal of Old Images and Other Files in tmp/deploy Now Enabled
6.10.4. Python Changes
6.10.5. uClibc Replaced by musl
6.10.6. ${B} No Longer Default Working Directory for Tasks
6.10.7. runqemu Ported to Python
6.10.8. Default Linker Hash Style Changed
6.10.9. KERNEL_IMAGE_BASE_NAME no Longer Uses KERNEL_IMAGETYPE
6.10.10. BitBake Changes
6.10.11. Swabber has Been Removed
6.10.12. Removed Recipes
6.10.13. Removed Classes
6.10.14. Minor Packaging Changes
6.10.15. Miscellaneous Changes
6.11. Moving to the Yocto Project 2.3 Release
6.11.1. Recipe-specific Sysroots
6.11.2. PATH Variable
6.11.3. Changes to Scripts
6.11.4. Changes to Functions
6.11.5. BitBake Changes
6.11.6. Absolute Symbolic Links
6.11.7. GPLv2 Versions of GPLv3 Recipes Moved
6.11.8. Package Management Changes
6.11.9. Removed Recipes
6.11.10. Wic Changes
6.11.11. QA Changes
6.11.12. Miscellaneous Changes
6.12. Moving to the Yocto Project 2.4 Release
6.12.1. Memory Resident Mode
6.12.2. Packaging Changes
6.12.3. Removed Recipes
6.12.4. Kernel Device Tree Move
6.12.5. Package QA Changes
6.12.6. README File Changes
6.12.7. Miscellaneous Changes
7. Source Directory Structure
7.1. Top-Level Core Components
7.1.1. bitbake/
7.1.2. build/
7.1.3. documentation/
7.1.4. meta/
7.1.5. meta-poky/
7.1.6. meta-yocto-bsp/
7.1.7. meta-selftest/
7.1.8. meta-skeleton/
7.1.9. scripts/
7.1.10. oe-init-build-env
7.1.11. LICENSE, README, and README.hardware
7.2. The Build Directory - build/
7.2.1. build/buildhistory
7.2.2. build/conf/local.conf
7.2.3. build/conf/bblayers.conf
7.2.4. build/conf/sanity_info
7.2.5. build/downloads/
7.2.6. build/sstate-cache/
7.2.7. build/tmp/
7.2.8. build/tmp/buildstats/
7.2.9. build/tmp/cache/
7.2.10. build/tmp/deploy/
7.2.11. build/tmp/deploy/deb/
7.2.12. build/tmp/deploy/rpm/
7.2.13. build/tmp/deploy/ipk/
7.2.14. build/tmp/deploy/licenses/
7.2.15. build/tmp/deploy/images/
7.2.16. build/tmp/deploy/sdk/
7.2.17. build/tmp/sstate-control/
7.2.18. build/tmp/sysroots-components/
7.2.19. build/tmp/sysroots/
7.2.20. build/tmp/stamps/
7.2.21. build/tmp/log/
7.2.22. build/tmp/work/
7.2.23. build/tmp/work/tunearch/recipename/version/
7.2.24. build/tmp/work-shared/
7.3. The Metadata - meta/
7.3.1. meta/classes/
7.3.2. meta/conf/
7.3.3. meta/conf/machine/
7.3.4. meta/conf/distro/
7.3.5. meta/conf/machine-sdk/
7.3.6. meta/files/
7.3.7. meta/lib/
7.3.8. meta/recipes-bsp/
7.3.9. meta/recipes-connectivity/
7.3.10. meta/recipes-core/
7.3.11. meta/recipes-devtools/
7.3.12. meta/recipes-extended/
7.3.13. meta/recipes-gnome/
7.3.14. meta/recipes-graphics/
7.3.15. meta/recipes-kernel/
7.3.16. meta/recipes-lsb4/
7.3.17. meta/recipes-multimedia/
7.3.18. meta/recipes-rt/
7.3.19. meta/recipes-sato/
7.3.20. meta/recipes-support/
7.3.21. meta/site/
7.3.22. meta/recipes.txt
8. Classes
8.1. allarch.bbclass
8.2. archiver.bbclass
8.3. autotools*.bbclass
8.4. base.bbclass
8.5. bash-completion.bbclass
8.6. bin_package.bbclass
8.7. binconfig.bbclass
8.8. binconfig-disabled.bbclass
8.9. blacklist.bbclass
8.10. bluetooth.bbclass
8.11. bugzilla.bbclass
8.12. buildhistory.bbclass
8.13. buildstats.bbclass
8.14. buildstats-summary.bbclass
8.15. ccache.bbclass
8.16. chrpath.bbclass
8.17. clutter.bbclass
8.18. cmake.bbclass
8.19. cml1.bbclass
8.20. compress_doc.bbclass
8.21. copyleft_compliance.bbclass
8.22. copyleft_filter.bbclass
8.23. core-image.bbclass
8.24. cpan*.bbclass
8.25. cross.bbclass
8.26. cross-canadian.bbclass
8.27. crosssdk.bbclass
8.28. debian.bbclass
8.29. deploy.bbclass
8.30. devshell.bbclass
8.31. distro_features_check.bbclass
8.32. distrodata.bbclass
8.33. distutils*.bbclass
8.34. distutils3*.bbclass
8.35. externalsrc.bbclass
8.36. extrausers.bbclass
8.37. fontcache.bbclass
8.38. fs-uuid.bbclass
8.39. gconf.bbclass
8.40. gettext.bbclass
8.41. gnome.bbclass
8.42. gnomebase.bbclass
8.43. gobject-introspection.bbclass
8.44. grub-efi.bbclass
8.45. gsettings.bbclass
8.46. gtk-doc.bbclass
8.47. gtk-icon-cache.bbclass
8.48. gtk-immodules-cache.bbclass
8.49. gzipnative.bbclass
8.50. icecc.bbclass
8.51. image.bbclass
8.52. image-buildinfo.bbclass
8.53. image_types.bbclass
8.54. image-live.bbclass
8.55. image-mklibs.bbclass
8.56. image-prelink.bbclass
8.57. insane.bbclass
8.58. insserv.bbclass
8.59. kernel.bbclass
8.60. kernel-arch.bbclass
8.61. kernel-fitimage.bbclass
8.62. kernel-grub.bbclass
8.63. kernel-module-split.bbclass
8.64. kernel-uboot.bbclass
8.65. kernel-uimage.bbclass
8.66. kernel-yocto.bbclass
8.67. kernelsrc.bbclass
8.68. lib_package.bbclass
8.69. libc*.bbclass
8.70. license.bbclass
8.71. linux-kernel-base.bbclass
8.72. linuxloader.bbclass
8.73. logging.bbclass
8.74. meta.bbclass
8.75. metadata_scm.bbclass
8.76. migrate_localcount.bbclass
8.77. mime.bbclass
8.78. mirrors.bbclass
8.79. module.bbclass
8.80. module-base.bbclass
8.81. multilib*.bbclass
8.82. native.bbclass
8.83. nativesdk.bbclass
8.84. nopackages.bbclass
8.85. npm.bbclass
8.86. oelint.bbclass
8.87. own-mirrors.bbclass
8.88. package.bbclass
8.89. package_deb.bbclass
8.90. package_ipk.bbclass
8.91. package_rpm.bbclass
8.92. package_tar.bbclass
8.93. packagedata.bbclass
8.94. packagegroup.bbclass
8.95. patch.bbclass
8.96. perlnative.bbclass
8.97. pixbufcache.bbclass
8.98. pkgconfig.bbclass
8.99. populate_sdk.bbclass
8.100. populate_sdk_*.bbclass
8.101. prexport.bbclass
8.102. primport.bbclass
8.103. prserv.bbclass
8.104. ptest.bbclass
8.105. ptest-gnome.bbclass
8.106. python-dir.bbclass
8.107. python3native.bbclass
8.108. pythonnative.bbclass
8.109. qemu.bbclass
8.110. recipe_sanity.bbclass
8.111. relocatable.bbclass
8.112. remove-libtool.bbclass
8.113. report-error.bbclass
8.114. rm_work.bbclass
8.115. rootfs*.bbclass
8.116. sanity.bbclass
8.117. scons.bbclass
8.118. sdl.bbclass
8.119. setuptools.bbclass
8.120. setuptools3.bbclass
8.121. sign_rpm.bbclass
8.122. sip.bbclass
8.123. siteconfig.bbclass
8.124. siteinfo.bbclass
8.125. spdx.bbclass
8.126. sstate.bbclass
8.127. staging.bbclass
8.128. syslinux.bbclass
8.129. systemd.bbclass
8.130. systemd-boot.bbclass
8.131. terminal.bbclass
8.132. testimage*.bbclass
8.133. testsdk.bbclass
8.134. texinfo.bbclass
8.135. tinderclient.bbclass
8.136. toaster.bbclass
8.137. toolchain-scripts.bbclass
8.138. typecheck.bbclass
8.139. uboot-config.bbclass
8.140. uninative.bbclass
8.141. update-alternatives.bbclass
8.142. update-rc.d.bbclass
8.143. useradd*.bbclass
8.144. utility-tasks.bbclass
8.145. utils.bbclass
8.146. vala.bbclass
8.147. waf.bbclass
9. Tasks
9.1. Normal Recipe Build Tasks
9.1.1. do_build
9.1.2. do_compile
9.1.3. do_compile_ptest_base
9.1.4. do_configure
9.1.5. do_configure_ptest_base
9.1.6. do_deploy
9.1.7. do_distrodata
9.1.8. do_fetch
9.1.9. do_image
9.1.10. do_image_complete
9.1.11. do_install
9.1.12. do_install_ptest_base
9.1.13. do_package
9.1.14. do_package_qa
9.1.15. do_package_write_deb
9.1.16. do_package_write_ipk
9.1.17. do_package_write_rpm
9.1.18. do_package_write_tar
9.1.19. do_packagedata
9.1.20. do_patch
9.1.21. do_populate_lic
9.1.22. do_populate_sdk
9.1.23. do_populate_sysroot
9.1.24. do_prepare_recipe_sysroot
9.1.25. do_rm_work
9.1.26. do_rm_work_all
9.1.27. do_unpack
9.2. Manually Called Tasks
9.2.1. do_checkpkg
9.2.2. do_checkuri
9.2.3. do_checkuriall
9.2.4. do_clean
9.2.5. do_cleanall
9.2.6. do_cleansstate
9.2.7. do_devpyshell
9.2.8. do_devshell
9.2.9. do_fetchall
9.2.10. do_listtasks
9.2.11. do_package_index
9.3. Image-Related Tasks
9.3.1. do_bootimg
9.3.2. do_bundle_initramfs
9.3.3. do_rootfs
9.3.4. do_testimage
9.3.5. do_testimage_auto
9.4. Kernel-Related Tasks
9.4.1. do_compile_kernelmodules
9.4.2. do_diffconfig
9.4.3. do_kernel_checkout
9.4.4. do_kernel_configcheck
9.4.5. do_kernel_configme
9.4.6. do_kernel_menuconfig
9.4.7. do_kernel_metadata
9.4.8. do_menuconfig
9.4.9. do_savedefconfig
9.4.10. do_shared_workdir
9.4.11. do_sizecheck
9.4.12. do_strip
9.4.13. do_validate_branches
9.5. Miscellaneous Tasks
9.5.1. do_spdx
10. devtool Quick Reference
10.1. Getting Help
10.2. The Workspace Layer Structure
10.3. Adding a New Recipe to the Workspace Layer
10.4. Extracting the Source for an Existing Recipe
10.5. Synchronizing a Recipe's Extracted Source Tree
10.6. Modifying an Existing Recipe
10.7. Edit an Existing Recipe
10.8. Updating a Recipe
10.9. Upgrading a Recipe
10.10. Resetting a Recipe
10.11. Building Your Recipe
10.12. Building Your Image
10.13. Deploying Your Software on the Target Machine
10.14. Removing Your Software from the Target Machine
10.15. Creating the Workspace Layer in an Alternative Location
10.16. Get the Status of the Recipes in Your Workspace
10.17. Search for Available Target Recipes
11. OpenEmbedded Kickstart (.wks) Reference
11.1. Introduction
11.2. Command: part or partition
11.3. Command: bootloader
12. QA Error and Warning Messages
12.1. Introduction
12.2. Errors and Warnings
12.3. Configuring and Disabling QA Checks
13. Images
14. Features
14.1. Machine Features
14.2. Distro Features
14.3. Image Features
14.4. Feature Backfilling
15. Variables Glossary
Glossary
16. Variable Context
16.1. Configuration
16.1.1. Distribution (Distro)
16.1.2. Machine
16.1.3. Local
16.2. Recipes
16.2.1. Required
16.2.2. Dependencies
16.2.3. Paths
16.2.4. Extra Build Information
17. FAQ
18. Contributions and Additional Information
18.1. Introduction
18.2. Contributions
18.3. Yocto Project Bugzilla
18.4. Mailing lists
18.5. Internet Relay Chat (IRC)
18.6. Links and Related Documentation

Chapter 1. Introduction

1.1. Welcome

Welcome to the Yocto Project Reference Manual. This manual provides reference information for the current release of the Yocto Project. This manual is best used after you have an understanding of the basics of the Yocto Project. The manual is neither meant to be read as a starting point to the Yocto Project nor read from start to finish. Use this manual to find concepts, variable definitions, class descriptions, and so forth as needed during the course of using the Yocto Project.

For introductory information on the Yocto Project, see the Yocto Project Website and the "Introducing the Yocto Project Development Environment" section.

If you want to use the Yocto Project to test run building an image without having to understand concepts, work through the Yocto Project Quick Start. You can find "how-to" information in the Yocto Project Development Tasks Manual.

Tip

For more information about the Yocto Project Documentation set, see the "Links and Related Documentation" section.

1.2. Introducing the Yocto Project Development Environment

The Yocto Project is an open-source collaboration project whose focus is for developers of embedded Linux systems. Among other things, the Yocto Project uses an OpenEmbedded build system. The build system, which is based on the OpenEmbedded (OE) project and uses the BitBake tool, constructs complete Linux images for architectures based on ARM, MIPS, PowerPC, x86 and x86-64.

Note

Historically, the OpenEmbedded build system, which is the combination of BitBake and OE components, formed a reference build host that was known as "Poky" (Pah-kee). The term "Poky", as used throughout the Yocto Project Documentation set, can have different meanings.

The Yocto Project provides various ancillary tools for the embedded developer and also features the Sato reference User Interface, which is optimized for stylus-driven, low-resolution screens.

Here are some highlights for the Yocto Project:

  • Provides a recent Linux kernel along with a set of system commands and libraries suitable for the embedded environment.

  • Makes available system components such as X11, GTK+, Qt, Clutter, and SDL (among others) so you can create a rich user experience on devices that have display hardware. For devices that do not have a display or where you wish to use alternative UI frameworks, these components need not be installed.

  • Creates a focused and stable core compatible with the OpenEmbedded project with which you can easily and reliably build and develop.

  • Fully supports a wide range of hardware and device emulation through the Quick EMUlator (QEMU).

  • Provides a layer mechanism that allows you to easily extend the system, make customizations, and keep them organized.

You can use the Yocto Project to generate images for many kinds of devices. As mentioned earlier, the Yocto Project supports creation of reference images that you can boot within and emulate using QEMU. The standard example machines target QEMU full-system emulation for 32-bit and 64-bit variants of x86, ARM, MIPS, and PowerPC architectures. Beyond emulation, you can use the layer mechanism to extend support to just about any platform that Linux can run on and that a toolchain can target.

Another Yocto Project feature is the Sato reference User Interface. This optional UI that is based on GTK+ is intended for devices with restricted screen sizes and is included as part of the OpenEmbedded Core layer so that developers can test parts of the software stack.

While the Yocto Project does not provide a strict testing framework, it does provide or generate for you artifacts that let you perform target-level and emulated testing and debugging. Additionally, if you are an Eclipse™ IDE user, you can install an Eclipse Yocto Plug-in to allow you to develop within that familiar environment.

By default, using the Yocto Project to build an image creates a Poky distribution. However, you can create your own distribution by providing key Metadata. A good example is Angstrom, which has had a distribution based on the Yocto Project since its inception. Other examples include commercial distributions like Wind River Linux, Mentor Embedded Linux, ENEA Linux and others. See the "Creating Your Own Distribution" section in the Yocto Project Development Tasks Manual for more information.

1.3. System Requirements

For general Yocto Project system requirements, see the "Setting Up to Use the Yocto Project" section in the Yocto Project Quick Start. The remainder of this section provides details on system requirements not covered in the Yocto Project Quick Start.

1.3.1. Supported Linux Distributions

Currently, the Yocto Project is supported on the following distributions:

Note

Yocto Project releases are tested against the stable Linux distributions in the following list. The Yocto Project should work on other distributions but validation is not performed against them.

In particular, the Yocto Project does not support and currently has no plans to support rolling-releases or development distributions due to their constantly changing nature. We welcome patches and bug reports, but keep in mind that our priority is on the supported platforms listed below.

If you encounter problems, please go to Yocto Project Bugzilla and submit a bug. We are interested in hearing about your experience.

  • Ubuntu 14.04 (LTS)

  • Ubuntu 14.10

  • Ubuntu 15.04

  • Ubuntu 15.10

  • Ubuntu 16.04

  • Fedora release 22

  • Fedora release 23

  • Fedora release 24

  • CentOS release 7.x

  • Debian GNU/Linux 8.x (Jessie)

  • Debian GNU/Linux 9.x (Stretch)

  • openSUSE 13.2

  • openSUSE 42.1

Note

While the Yocto Project Team attempts to ensure all Yocto Project releases are one hundred percent compatible with each officially supported Linux distribution, instances might exist where you encounter a problem while using the Yocto Project on a specific distribution.

1.3.2. Required Packages for the Host Development System

The list of packages you need on the host development system can be large when covering all build scenarios using the Yocto Project. This section provides required packages according to Linux distribution and function.

1.3.2.1. Ubuntu and Debian

The following list shows the required packages by function given a supported Ubuntu or Debian Linux distribution:

Note

If your build system has the oss4-dev package installed, you might experience QEMU build failures due to the package installing its own custom /usr/include/linux/soundcard.h on the Debian system. If you run into this situation, either of the following solutions exist:
     $ sudo apt-get build-dep qemu
     $ sudo apt-get remove oss4-dev
                    

  • Essentials: Packages needed to build an image on a headless system:

         $ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
         build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
         xz-utils debianutils iputils-ping
                            
  • Graphical and Eclipse Plug-In Extras: Packages recommended if the host system has graphics support or if you are going to use the Eclipse IDE:

         $ sudo apt-get install libsdl1.2-dev xterm
                            
  • Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:

         $ sudo apt-get install make xsltproc docbook-utils fop dblatex xmlto
                            
  • OpenEmbedded Self-Test (oe-selftest): Packages needed if you are going to run oe-selftest:

         $ sudo apt-get install python-git
                            

1.3.2.2. Fedora Packages

The following list shows the required packages by function given a supported Fedora Linux distribution:

  • Essentials: Packages needed to build an image for a headless system:

         $ sudo dnf install gawk make wget tar bzip2 gzip python3 unzip perl patch \
         diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \
         ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue perl-bignum socat \
         python3-pexpect findutils which file cpio python python3-pip xz
                            
  • Graphical and Eclipse Plug-In Extras: Packages recommended if the host system has graphics support or if you are going to use the Eclipse IDE:

         $ sudo dnf install SDL-devel xterm
                            
  • Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:

         $ sudo dnf install make docbook-style-dsssl docbook-style-xsl \
         docbook-dtds docbook-utils fop libxslt dblatex xmlto
                            
  • OpenEmbedded Self-Test (oe-selftest): Packages needed if you are going to run oe-selftest:

         $ sudo dnf install python3-GitPython
                            

1.3.2.3. openSUSE Packages

The following list shows the required packages by function given a supported openSUSE Linux distribution:

  • Essentials: Packages needed to build an image for a headless system:

         $ sudo zypper install python gcc gcc-c++ git chrpath make wget python-xml \
         diffstat makeinfo python-curses patch socat python3 python3-curses tar python3-pip \
         python3-pexpect xz which
                            
  • Graphical and Eclipse Plug-In Extras: Packages recommended if the host system has graphics support or if you are going to use the Eclipse IDE:

         $ sudo zypper install libSDL-devel xterm
                            
  • Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:

         $ sudo zypper install make dblatex xmlto
                            
  • OpenEmbedded Self-Test (oe-selftest): Packages needed if you are going to run oe-selftest:

         $ sudo zypper install python-GitPython
                            

1.3.2.4. CentOS Packages

The following list shows the required packages by function given a supported CentOS Linux distribution:

Note

For CentOS 6.x, some of the versions of the components provided by the distribution are too old (e.g. Git, Python, and tar). It is recommended that you install the buildtools in order to provide versions that will work with the OpenEmbedded build system. For information on how to install the buildtools tarball, see the "Required Git, Tar, and Python Versions" section.

  • Essentials: Packages needed to build an image for a headless system:

         $ sudo yum install -y epel-release
         $ sudo yum makecache
         $ sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch \
         diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath socat \
         perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3-pip xz \
         which SDL-devel xterm
                            

    Notes

    • Extra Packages for Enterprise Linux (i.e. epel-release) is a collection of packages from Fedora built on RHEL/CentOS for easy installation of packages not included in enterprise Linux by default. You need to install these packages separately.

    • The makecache command consumes additional Metadata from epel-release.

  • Graphical and Eclipse Plug-In Extras: Packages recommended if the host system has graphics support or if you are going to use the Eclipse IDE:

         $ sudo yum install SDL-devel xterm
                            
  • Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:

         $ sudo yum install make docbook-style-dsssl docbook-style-xsl \
         docbook-dtds docbook-utils fop libxslt dblatex xmlto
                            
  • OpenEmbedded Self-Test (oe-selftest): Packages needed if you are going to run oe-selftest:

         $ sudo yum install GitPython
                            

1.3.3. Required Git, tar, and Python Versions

In order to use the build system, your host development system must meet the following version requirements for Git, tar, and Python:

  • Git 1.8.3.1 or greater

  • tar 1.27 or greater

  • Python 3.4.0 or greater

If your host development system does not meet all these requirements, you can resolve this by installing a buildtools tarball that contains these tools. You can get the tarball one of two ways: download a pre-built tarball or use BitBake to build the tarball.

1.3.3.1. Downloading a Pre-Built buildtools Tarball

Downloading and running a pre-built buildtools installer is the easiest of the two methods by which you can get these tools:

  1. Locate and download the *.sh at http://downloads.yoctoproject.org/releases/yocto/yocto-2.4/buildtools/.

  2. Execute the installation script. Here is an example:

         $ sh poky-glibc-x86_64-buildtools-tarball-x86_64-buildtools-nativesdk-standalone-2.4.sh
                            

    During execution, a prompt appears that allows you to choose the installation directory. For example, you could choose the following:

         /home/your-username/buildtools
                            

  3. Source the tools environment setup script by using a command like the following:

         $ source /home/your_username/buildtools/environment-setup-i586-poky-linux
                            

    Of course, you need to supply your installation directory and be sure to use the right file (i.e. i585 or x86-64).

    After you have sourced the setup script, the tools are added to PATH and any other environment variables required to run the tools are initialized. The results are working versions versions of Git, tar, Python and chrpath.

1.3.3.2. Building Your Own buildtools Tarball

Building and running your own buildtools installer applies only when you have a build host that can already run BitBake. In this case, you use that machine to build the .sh file and then take steps to transfer and run it on a machine that does not meet the minimal Git, tar, and Python requirements.

Here are the steps to take to build and run your own buildtools installer:

  1. On the machine that is able to run BitBake, be sure you have set up your build environment with the setup script (oe-init-build-env).

  2. Run the BitBake command to build the tarball:

         $ bitbake buildtools-tarball
                            

    Note

    The SDKMACHINE variable in your local.conf file determines whether you build tools for a 32-bit or 64-bit system.

    Once the build completes, you can find the .sh file that installs the tools in the tmp/deploy/sdk subdirectory of the Build Directory. The installer file has the string "buildtools" in the name.

  3. Transfer the .sh file from the build host to the machine that does not meet the Git, tar, or Python requirements.

  4. On the machine that does not meet the requirements, run the .sh file to install the tools. Here is an example:

         $ sh poky-glibc-x86_64-buildtools-tarball-x86_64-buildtools-nativesdk-standalone-2.4.sh
                           

    During execution, a prompt appears that allows you to choose the installation directory. For example, you could choose the following:

         /home/your_username/buildtools
                           

  5. Source the tools environment setup script by using a command like the following:

         $ source /home/your_username/buildtools/environment-setup-i586-poky-linux
                            

    Of course, you need to supply your installation directory and be sure to use the right file (i.e. i585 or x86-64).

    After you have sourced the setup script, the tools are added to PATH and any other environment variables required to run the tools are initialized. The results are working versions versions of Git, tar, Python and chrpath.

1.4. Obtaining the Yocto Project

The Yocto Project development team makes the Yocto Project available through a number of methods:

1.5. Development Checkouts

Development using the Yocto Project requires a local Source Directory. You can set up the Source Directory by cloning a copy of the upstream poky Git repository. For information on how to do this, see the "Working With Yocto Project Source Files" section in the Yocto Project Development Tasks Manual.

1.6. Yocto Project Terms

Following is a list of terms and definitions users new to the Yocto Project development environment might find helpful. While some of these terms are universal, the list includes them just in case:

  • Append Files: Files that append build information to a recipe file. Append files are known as BitBake append files and .bbappend files. The OpenEmbedded build system expects every append file to have a corresponding recipe (.bb) file. Furthermore, the append file and corresponding recipe file must use the same root filename. The filenames can differ only in the file type suffix used (e.g. formfactor_0.0.bb and formfactor_0.0.bbappend).

    Information in append files extends or overrides the information in the similarly-named recipe file. For an example of an append file in use, see the "Using .bbappend Files in Your Layer" section in the Yocto Project Development Tasks Manual.

    Note

    Append files can also use wildcard patterns in their version numbers so they can be applied to more than one version of the underlying recipe file.

  • BitBake: The task executor and scheduler used by the OpenEmbedded build system to build images. For more information on BitBake, see the BitBake User Manual.

  • Board Support Package (BSP): A group of drivers, definitions, and other components that provide support for a specific hardware configuration. For more information on BSPs, see the Yocto Project Board Support Package (BSP) Developer's Guide.

  • Build Directory: This term refers to the area used by the OpenEmbedded build system for builds. The area is created when you source the setup environment script that is found in the Source Directory (i.e. oe-init-build-env). The TOPDIR variable points to the Build Directory.

    You have a lot of flexibility when creating the Build Directory. Following are some examples that show how to create the directory. The examples assume your Source Directory is named poky:

    • Create the Build Directory inside your Source Directory and let the name of the Build Directory default to build:

           $ cd $HOME/poky
           $ source oe-init-build-env
                              

    • Create the Build Directory inside your home directory and specifically name it test-builds:

           $ cd $HOME
           $ source poky/oe-init-build-env test-builds
                              

    • Provide a directory path and specifically name the Build Directory. Any intermediate folders in the pathname must exist. This next example creates a Build Directory named YP-19.0.0 in your home directory within the existing directory mybuilds:

           $cd $HOME
           $ source $HOME/poky/oe-init-build-env $HOME/mybuilds/YP-19.0.0
                              

    Note

    By default, the Build Directory contains TMPDIR, which is a temporary directory the build system uses for its work. TMPDIR cannot be under NFS. Thus, by default, the Build Directory cannot be under NFS. However, if you need the Build Directory to be under NFS, you can set this up by setting TMPDIR in your local.conf file to use a local drive. Doing so effectively separates TMPDIR from TOPDIR, which is the Build Directory.

  • Build System: The system used to build images in a Yocto Project Development environment. The build system is sometimes referred to as the development host.

  • Classes: Files that provide for logic encapsulation and inheritance so that commonly used patterns can be defined once and then easily used in multiple recipes. For reference information on the Yocto Project classes, see the "Classes" chapter. Class files end with the .bbclass filename extension.

  • Configuration File: Configuration information in various .conf files provides global definitions of variables. The conf/local.conf configuration file in the Build Directory contains user-defined variables that affect every build. The meta-poky/conf/distro/poky.conf configuration file defines Yocto "distro" configuration variables used only when building with this policy. Machine configuration files, which are located throughout the Source Directory, define variables for specific hardware and are only used when building for that target (e.g. the machine/beaglebone.conf configuration file defines variables for the Texas Instruments ARM Cortex-A8 development board). Configuration files end with a .conf filename extension.

  • Cross-Development Toolchain: In general, a cross-development toolchain is a collection of software development tools and utilities that run on one architecture and allow you to develop software for a different, or targeted, architecture. These toolchains contain cross-compilers, linkers, and debuggers that are specific to the target architecture.

    The Yocto Project supports two different cross-development toolchains:

    • A toolchain only used by and within BitBake when building an image for a target architecture.

    • A relocatable toolchain used outside of BitBake by developers when developing applications that will run on a targeted device.

    Creation of these toolchains is simple and automated. For information on toolchain concepts as they apply to the Yocto Project, see the "Cross-Development Toolchain Generation" section. You can also find more information on using the relocatable toolchain in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.

  • Image: An image is an artifact of the BitBake build process given a collection of recipes and related Metadata. Images are the binary output that run on specific hardware or QEMU and are used for specific use-cases. For a list of the supported image types that the Yocto Project provides, see the "Images" chapter.

  • Layer: A collection of recipes representing the core, a BSP, or an application stack. For a discussion specifically on BSP Layers, see the "BSP Layers" section in the Yocto Project Board Support Packages (BSP) Developer's Guide.

  • Metadata: The files that BitBake parses when building an image. In general, Metadata includes recipes, classes, and configuration files. In the context of the kernel ("kernel Metadata"), the term refers to the kernel config fragments and features contained in the yocto-kernel-cache Git repository.

  • OE-Core: A core set of Metadata originating with OpenEmbedded (OE) that is shared between OE and the Yocto Project. This Metadata is found in the meta directory of the Source Directory.

  • OpenEmbedded Build System: The build system specific to the Yocto Project. The OpenEmbedded build system is based on another project known as "Poky", which uses BitBake as the task executor. Throughout the Yocto Project documentation set, the OpenEmbedded build system is sometimes referred to simply as "the build system". If other build systems, such as a host or target build system are referenced, the documentation clearly states the difference.

    Note

    For some historical information about Poky, see the Poky term.

  • Package: In the context of the Yocto Project, this term refers to a recipe's packaged output produced by BitBake (i.e. a "baked recipe"). A package is generally the compiled binaries produced from the recipe's sources. You "bake" something by running it through BitBake.

    It is worth noting that the term "package" can, in general, have subtle meanings. For example, the packages referred to in the "The Build Host Packages" section in the Yocto Project Quick Start are compiled binaries that, when installed, add functionality to your Linux distribution.

    Another point worth noting is that historically within the Yocto Project, recipes were referred to as packages - thus, the existence of several BitBake variables that are seemingly mis-named, (e.g. PR, PV, and PE).

  • Package Groups: Arbitrary groups of software Recipes. You use package groups to hold recipes that, when built, usually accomplish a single task. For example, a package group could contain the recipes for a company’s proprietary or value-add software. Or, the package group could contain the recipes that enable graphics. A package group is really just another recipe. Because package group files are recipes, they end with the .bb filename extension.

  • Poky: The term "poky", which is pronounced Pah-kee, can mean several things:

    • In its most general sense, poky is an open-source project that was initially developed by OpenedHand. OpenedHand developed poky off of the existing OpenEmbedded build system to create a commercially supportable build system for embedded Linux. After Intel Corporation acquired OpenedHand, the poky project became the basis for the Yocto Project's build system.

    • Within the Yocto Project Source Repositories, "poky" exists as a separate Git repository from which you can clone to yield a local Git repository that is a copy on your host system. Thus, "poky" can refer to the upstream or local copy of the files used for development within the Yocto Project.

    • Finally, "poky" can refer to the default DISTRO (i.e. distribution) created when you use the Yocto Project in conjunction with the poky repository to build an image.

  • Recipe: A set of instructions for building packages. A recipe describes where you get source code, which patches to apply, how to configure the source, how to compile it and so on. Recipes also describe dependencies for libraries or for other recipes. Recipes represent the logical unit of execution, the software to build, the images to build, and use the .bb file extension.

  • Reference Kit: A working example of a system, which includes a BSP as well as a build system and other components, that can work on specific hardware.

  • Source Directory: This term refers to the directory structure created as a result of creating a local copy of the poky Git repository git://git.yoctoproject.org/poky or expanding a released poky tarball.

    Note

    Creating a local copy of the poky Git repository is the recommended method for setting up your Source Directory.

    Sometimes you might hear the term "poky directory" used to refer to this directory structure.

    Note

    The OpenEmbedded build system does not support file or directory names that contain spaces. Be sure that the Source Directory you use does not contain these types of names.

    The Source Directory contains BitBake, Documentation, Metadata and other files that all support the Yocto Project. Consequently, you must have the Source Directory in place on your development system in order to do any development using the Yocto Project.

    When you create a local copy of the Git repository, you can name the repository anything you like. Throughout much of the documentation, "poky" is used as the name of the top-level folder of the local copy of the poky Git repository. So, for example, cloning the poky Git repository results in a local Git repository whose top-level folder is also named "poky".

    While it is not recommended that you use tarball expansion to set up the Source Directory, if you do, the top-level directory name of the Source Directory is derived from the Yocto Project release tarball. For example, downloading and unpacking poky-rocko-19.0.0.tar.bz2 results in a Source Directory whose root folder is named poky-rocko-19.0.0.

    It is important to understand the differences between the Source Directory created by unpacking a released tarball as compared to cloning git://git.yoctoproject.org/poky. When you unpack a tarball, you have an exact copy of the files based on the time of release - a fixed release point. Any changes you make to your local files in the Source Directory are on top of the release and will remain local only. On the other hand, when you clone the poky Git repository, you have an active development repository with access to the upstream repository's branches and tags. In this case, any local changes you make to the local Source Directory can be later applied to active development branches of the upstream poky Git repository.

    For more information on concepts related to Git repositories, branches, and tags, see the "Repositories, Tags, and Branches" section.

  • Task: A unit of execution for BitBake (e.g. do_compile, do_fetch, do_patch, and so forth).

  • Toaster: A web interface to the Yocto Project's OpenEmbedded Build System. The interface enables you to configure and run your builds. Information about builds is collected and stored in a database. For information on Toaster, see the Yocto Project Toaster Manual.

  • Upstream: A reference to source code or repositories that are not local to the development system but located in a master area that is controlled by the maintainer of the source code. For example, in order for a developer to work on a particular piece of code, they need to first get a copy of it from an "upstream" source.

Chapter 2. Using the Yocto Project

This chapter describes common usage for the Yocto Project. The information is introductory in nature as other manuals in the Yocto Project documentation set provide more details on how to use the Yocto Project.

2.1. Running a Build

This section provides a summary of the build process and provides information for less obvious aspects of the build process. For general information on how to build an image using the OpenEmbedded build system, see the "Building Images" section of the Yocto Project Quick Start.

2.1.1. Build Overview

In the development environment you will need to build an image whenever you change hardware support, add or change system libraries, or add or change services that have dependencies.

Building an Image

The first thing you need to do is set up the OpenEmbedded build environment by sourcing the environment setup script (i.e. oe-init-build-env). Here is an example:

     $ source oe-init-build-env [build_dir]
            

The build_dir argument is optional and specifies the directory the OpenEmbedded build system uses for the build - the Build Directory. If you do not specify a Build Directory, it defaults to a directory named build in your current working directory. A common practice is to use a different Build Directory for different targets. For example, ~/build/x86 for a qemux86 target, and ~/build/arm for a qemuarm target.

Once the build environment is set up, you can build a target using:

     $ bitbake target
            

Note

If you experience a build error due to resources temporarily being unavailable and it appears you should not be having this issue, it might be due to the combination of a 4.3+ Linux kernel and systemd version 228+ (i.e. see this link for information).

To work around this issue, you can try either of the following:

  • Try the build again.

  • Modify the "DefaultTasksMax" systemd parameter by uncommenting it and setting it to "infinity". You can find this parameter in the system.conf file located in /etc/systemd on most systems.

The target is the name of the recipe you want to build. Common targets are the images in meta/recipes-core/images, meta/recipes-sato/images, etc. all found in the Source Directory. Or, the target can be the name of a recipe for a specific piece of software such as BusyBox. For more details about the images the OpenEmbedded build system supports, see the "Images" chapter.

Note

Building an image without GNU General Public License Version 3 (GPLv3), or similarly licensed, components is supported for only minimal and base images. See the "Images" chapter for more information.

2.1.2. Building an Image Using GPL Components

When building an image using GPL components, you need to maintain your original settings and not switch back and forth applying different versions of the GNU General Public License. If you rebuild using different versions of GPL, dependency errors might occur due to some components not being rebuilt.

2.2. Installing and Using the Result

Once an image has been built, it often needs to be installed. The images and kernels built by the OpenEmbedded build system are placed in the Build Directory in tmp/deploy/images. For information on how to run pre-built images such as qemux86 and qemuarm, see the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual. For information about how to install these images, see the documentation for your particular board or machine.

2.3. Debugging Tools and Techniques

The exact method for debugging build failures depends on the nature of the problem and on the system's area from which the bug originates. Standard debugging practices such as comparison against the last known working version with examination of the changes and the re-application of steps to identify the one causing the problem are valid for the Yocto Project just as they are for any other system. Even though it is impossible to detail every possible potential failure, this section provides some general tips to aid in debugging.

A useful feature for debugging is the error reporting tool. Configuring the Yocto Project to use this tool causes the OpenEmbedded build system to produce error reporting commands as part of the console output. You can enter the commands after the build completes to log error information into a common database, that can help you figure out what might be going wrong. For information on how to enable and use this feature, see the "Using the Error Reporting Tool" section in the Yocto Project Development Tasks Manual.

For discussions on debugging, see the "Debugging With the GNU Project Debugger (GDB) Remotely" section in the Yocto Project Development Tasks Manual and the "Working within Eclipse" section in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.

Note

The remainder of this section presents many examples of the bitbake command. You can learn about BitBake by reading the BitBake User Manual.

2.3.1. Viewing Logs from Failed Tasks

You can find the log for a task in the file ${WORKDIR}/temp/log.do_taskname. For example, the log for the do_compile task of the QEMU minimal image for the x86 machine (qemux86) might be in tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.do_compile. To see the commands BitBake ran to generate a log, look at the corresponding run.do_taskname file in the same directory.

log.do_taskname and run.do_taskname are actually symbolic links to log.do_taskname.pid and log.run_taskname.pid, where pid is the PID the task had when it ran. The symlinks always point to the files corresponding to the most recent run.

2.3.2. Viewing Variable Values

BitBake's -e option is used to display variable values after parsing. The following command displays the variable values after the configuration files (i.e. local.conf, bblayers.conf, bitbake.conf and so forth) have been parsed:

     $ bitbake -e
            

The following command displays variable values after a specific recipe has been parsed. The variables include those from the configuration as well:

     $ bitbake -e recipename
            

Note

Each recipe has its own private set of variables (datastore). Internally, after parsing the configuration, a copy of the resulting datastore is made prior to parsing each recipe. This copying implies that variables set in one recipe will not be visible to other recipes.

Likewise, each task within a recipe gets a private datastore based on the recipe datastore, which means that variables set within one task will not be visible to other tasks.

In the output of bitbake -e, each variable is preceded by a description of how the variable got its value, including temporary values that were later overriden. This description also includes variable flags (varflags) set on the variable. The output can be very helpful during debugging.

Variables that are exported to the environment are preceded by export in the output of bitbake -e. See the following example:

     export CC="i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/ulf/poky/build/tmp/sysroots/qemux86"
            

In addition to variable values, the output of the bitbake -e and bitbake -e recipe commands includes the following information:

  • The output starts with a tree listing all configuration files and classes included globally, recursively listing the files they include or inherit in turn. Much of the behavior of the OpenEmbedded build system (including the behavior of the normal recipe build tasks) is implemented in the base class and the classes it inherits, rather than being built into BitBake itself.

  • After the variable values, all functions appear in the output. For shell functions, variables referenced within the function body are expanded. If a function has been modified using overrides or using override-style operators like _append and _prepend, then the final assembled function body appears in the output.

2.3.3. Viewing Package Information with oe-pkgdata-util

You can use the oe-pkgdata-util command-line utility to query PKGDATA_DIR and display various package-related information. When you use the utility, you must use it to view information on packages that have already been built.

Following are a few of the available oe-pkgdata-util subcommands.

Note

You can use the standard * and ? globbing wildcards as part of package names and paths.

  • oe-pkgdata-util list-pkgs [pattern]: Lists all packages that have been built, optionally limiting the match to packages that match pattern.

  • oe-pkgdata-util list-pkg-files package ...: Lists the files and directories contained in the given packages.

    Note

    A different way to view the contents of a package is to look at the ${WORKDIR}/packages-split directory of the recipe that generates the package. This directory is created by the do_package task and has one subdirectory for each package the recipe generates, which contains the files stored in that package.

    If you want to inspect the ${WORKDIR}/packages-split directory, make sure that rm_work is not enabled when you build the recipe.

  • oe-pkgdata-util find-path path ...: Lists the names of the packages that contain the given paths. For example, the following tells us that /usr/share/man/man1/make.1 is contained in the make-doc package:

         $ oe-pkgdata-util find-path /usr/share/man/man1/make.1
         make-doc: /usr/share/man/man1/make.1
                        

  • oe-pkgdata-util lookup-recipe package ...: Lists the name of the recipes that produce the given packages.

For more information on the oe-pkgdata-util command, use the help facility:

     $ oe-pkgdata-util ‐‐help
     $ oe-pkgdata-util subcommand --help
            

2.3.4. Viewing Dependencies Between Recipes and Tasks

Sometimes it can be hard to see why BitBake wants to build other recipes before the one you have specified. Dependency information can help you understand why a recipe is built.

To generate dependency information for a recipe, run the following command:

     $ bitbake -g recipename
            

This command writes the following files in the current directory:

  • pn-buildlist: A list of recipes/targets involved in building recipename. "Involved" here means that at least one task from the recipe needs to run when building recipename from scratch. Targets that are in ASSUME_PROVIDED are not listed.

  • task-depends.dot: A graph showing dependencies between tasks.

The graphs are in DOT format and can be converted to images (e.g. using the dot tool from Graphviz).

Notes

  • DOT files use a plain text format. The graphs generated using the bitbake -g command are often so large as to be difficult to read without special pruning (e.g. with Bitbake's -I option) and processing. Despite the form and size of the graphs, the corresponding .dot files can still be possible to read and provide useful information.

    As an example, the task-depends.dot file contains lines such as the following:

         "libxslt.do_configure" -> "libxml2.do_populate_sysroot"
                            

    The above example line reveals that the do_configure task in libxslt depends on the do_populate_sysroot task in libxml2, which is a normal DEPENDS dependency between the two recipes.

  • For an example of how .dot files can be processed, see the scripts/contrib/graph-tool Python script, which finds and displays paths between graph nodes.

You can use a different method to view dependency information by using the following command:

     $ bitbake -g -u taskexp recipename
            

This command displays a GUI window from which you can view build-time and runtime dependencies for the recipes involved in building recipename.

2.3.5. Viewing Task Variable Dependencies

As mentioned in the "Checksums (Signatures)" section of the BitBake User Manual, BitBake tries to automatically determine what variables a task depends on so that it can rerun the task if any values of the variables change. This determination is usually reliable. However, if you do things like construct variable names at runtime, then you might have to manually declare dependencies on those variables using vardeps as described in the "Variable Flags" section of the BitBake User Manual.

If you are unsure whether a variable dependency is being picked up automatically for a given task, you can list the variable dependencies BitBake has determined by doing the following:

  1. Build the recipe containing the task:

         $ bitbake recipename
                        

  2. Inside the STAMPS_DIR directory, find the signature data (sigdata) file that corresponds to the task. The sigdata files contain a pickled Python database of all the metadata that went into creating the input checksum for the task. As an example, for the do_fetch task of the db recipe, the sigdata file might be found in the following location:

         ${BUILDDIR}/tmp/stamps/i586-poky-linux/db/6.0.30-r1.do_fetch.sigdata.7c048c18222b16ff0bcee2000ef648b1
                        

    For tasks that are accelerated through the shared state (sstate) cache, an additional siginfo file is written into SSTATE_DIR along with the cached task output. The siginfo files contain exactly the same information as sigdata files.

  3. Run bitbake-dumpsig on the sigdata or siginfo file. Here is an example:

         $ bitbake-dumpsig ${BUILDDIR}/tmp/stamps/i586-poky-linux/db/6.0.30-r1.do_fetch.sigdata.7c048c18222b16ff0bcee2000ef648b1
                        

    In the output of the above command, you will find a line like the following, which lists all the (inferred) variable dependencies for the task. This list also includes indirect dependencies from variables depending on other variables, recursively.

         Task dependencies: ['PV', 'SRCREV', 'SRC_URI', 'SRC_URI[md5sum]', 'SRC_URI[sha256sum]', 'base_do_fetch']
                        

    Note

    Functions (e.g. base_do_fetch) also count as variable dependencies. These functions in turn depend on the variables they reference.

    The output of bitbake-dumpsig also includes the value each variable had, a list of dependencies for each variable, and BB_HASHBASE_WHITELIST information.

There is also a bitbake-diffsigs command for comparing two siginfo or sigdata files. This command can be helpful when trying to figure out what changed between two versions of a task. If you call bitbake-diffsigs with just one file, the command behaves like bitbake-dumpsig.

You can also use BitBake to dump out the signature construction information without executing tasks by using either of the following BitBake command-line options:

     ‐‐dump-signatures=SIGNATURE_HANDLER
     -S SIGNATURE_HANDLER
            

Note

Two common values for SIGNATURE_HANDLER are "none" and "printdiff", which dump only the signature or compare the dumped signature with the cached one, respectively.

Using BitBake with either of these options causes BitBake to dump out sigdata files in the stamps directory for every task it would have executed instead of building the specified target package.

2.3.6. Running Specific Tasks

Any given recipe consists of a set of tasks. The standard BitBake behavior in most cases is: do_fetch, do_unpack, do_patch, do_configure, do_compile, do_install, do_package, do_package_write_*, and do_build. The default task is do_build and any tasks on which it depends build first. Some tasks, such as do_devshell, are not part of the default build chain. If you wish to run a task that is not part of the default build chain, you can use the -c option in BitBake. Here is an example:

     $ bitbake matchbox-desktop -c devshell
            

The -c option respects task dependencies, which means that all other tasks (including tasks from other recipes) that the specified task depends on will be run before the task. Even when you manually specify a task to run with -c, BitBake will only run the task if it considers it "out of date". See the "Stamp Files and the Rerunning of Tasks" section for how BitBake determines whether a task is "out of date".

If you want to force an up-to-date task to be rerun (e.g. because you made manual modifications to the recipe's WORKDIR that you want to try out), then you can use the -f option.

Note

The reason -f is never required when running the do_devshell task is because the [nostamp] variable flag is already set for the task.

The following example shows one way you can use the -f option:

     $ bitbake matchbox-desktop
               .
               .
     make some changes to the source code in the work directory
               .
               .
     $ bitbake matchbox-desktop -c compile -f
     $ bitbake matchbox-desktop
            

This sequence first builds and then recompiles matchbox-desktop. The last command reruns all tasks (basically the packaging tasks) after the compile. BitBake recognizes that the do_compile task was rerun and therefore understands that the other tasks also need to be run again.

Another, shorter way to rerun a task and all normal recipe build tasks that depend on it is to use the -C option.

Note

This option is upper-cased and is separate from the -c option, which is lower-cased.

Using this option invalidates the given task and then runs the do_build task, which is the default task if no task is given, and the tasks on which it depends. You could replace the final two commands in the previous example with the following single command:

     $ bitbake matchbox-desktop -C compile
            

Internally, the -f and -C options work by tainting (modifying) the input checksum of the specified task. This tainting indirectly causes the task and its dependent tasks to be rerun through the normal task dependency mechanisms.

Note

BitBake explicitly keeps track of which tasks have been tainted in this fashion, and will print warnings such as the following for builds involving such tasks:
     WARNING: /home/ulf/poky/meta/recipes-sato/matchbox-desktop/matchbox-desktop_2.1.bb.do_compile is tainted from a forced run
                
The purpose of the warning is to let you know that the work directory and build output might not be in the clean state they would be in for a "normal" build, depending on what actions you took. To get rid of such warnings, you can remove the work directory and rebuild the recipe, as follows:
     $ bitbake matchbox-desktop -c clean
     $ bitbake matchbox-desktop
                

You can view a list of tasks in a given package by running the do_listtasks task as follows:

     $ bitbake matchbox-desktop -c listtasks
            

The results appear as output to the console and are also in the file ${WORKDIR}/temp/log.do_listtasks.

2.3.7. General BitBake Problems

You can see debug output from BitBake by using the -D option. The debug output gives more information about what BitBake is doing and the reason behind it. Each -D option you use increases the logging level. The most common usage is -DDD.

The output from bitbake -DDD -v targetname can reveal why BitBake chose a certain version of a package or why BitBake picked a certain provider. This command could also help you in a situation where you think BitBake did something unexpected.

2.3.8. Development Host System Issues

Sometimes issues on the host development system can cause your build to fail. Following are known, host-specific problems. Be sure to always consult the Release Notes for a look at all release-related issues.

  • glibc-initial fails to build: If your development host system has the unpatched GNU Make 3.82, the do_install task fails for glibc-initial during the build.

    Typically, every distribution that ships GNU Make 3.82 as the default already has the patched version. However, some distributions, such as Debian, have GNU Make 3.82 as an option, which is unpatched. You will see this error on these types of distributions. Switch to GNU Make 3.81 or patch your make to solve the problem.

2.3.9. Building with No Dependencies

To build a specific recipe (.bb file), you can use the following command form:

     $ bitbake -b somepath/somerecipe.bb
            

This command form does not check for dependencies. Consequently, you should use it only when you know existing dependencies have been met.

Note

You can also specify fragments of the filename. In this case, BitBake checks for a unique match.

2.3.10. Recipe Logging Mechanisms

The Yocto Project provides several logging functions for producing debugging output and reporting errors and warnings. For Python functions, the following logging functions exist. All of these functions log to ${T}/log.do_task, and can also log to standard output (stdout) with the right settings:

  • bb.plain(msg): Writes msg as is to the log while also logging to stdout.

  • bb.note(msg): Writes "NOTE: msg" to the log. Also logs to stdout if BitBake is called with "-v".

  • bb.debug(levelmsg): Writes "DEBUG: msg" to the log. Also logs to stdout if the log level is greater than or equal to level. See the "-D" option in the BitBake User Manual for more information.

  • bb.warn(msg): Writes "WARNING: msg" to the log while also logging to stdout.

  • bb.error(msg): Writes "ERROR: msg" to the log while also logging to stdout.

    Note

    Calling this function does not cause the task to fail.

  • bb.fatal(msg): This logging function is similar to bb.error(msg) but also causes the calling task to fail.

    Note

    bb.fatal() raises an exception, which means you do not need to put a "return" statement after the function.

The same logging functions are also available in shell functions, under the names bbplain, bbnote, bbdebug, bbwarn, bberror, and bbfatal. The logging class implements these functions. See that class in the meta/classes folder of the Source Directory for information.

2.3.10.1. Logging With Python

When creating recipes using Python and inserting code that handles build logs, keep in mind the goal is to have informative logs while keeping the console as "silent" as possible. Also, if you want status messages in the log, use the "debug" loglevel.

Following is an example written in Python. The code handles logging for a function that determines the number of tasks needed to be run. See the "do_listtasks" section for additional information:

     python do_listtasks() {
         bb.debug(2, "Starting to figure out the task list")
         if noteworthy_condition:
             bb.note("There are 47 tasks to run")
         bb.debug(2, "Got to point xyz")
         if warning_trigger:
             bb.warn("Detected warning_trigger, this might be a problem later.")
         if recoverable_error:
             bb.error("Hit recoverable_error, you really need to fix this!")
         if fatal_error:
             bb.fatal("fatal_error detected, unable to print the task list")
         bb.plain("The tasks present are abc")
         bb.debug(2, "Finished figuring out the tasklist")
     }
                

2.3.10.2. Logging With Bash

When creating recipes using Bash and inserting code that handles build logs, you have the same goals - informative with minimal console output. The syntax you use for recipes written in Bash is similar to that of recipes written in Python described in the previous section.

Following is an example written in Bash. The code logs the progress of the do_my_function function.

     do_my_function() {
         bbdebug 2 "Running do_my_function"
         if [ exceptional_condition ]; then
             bbnote "Hit exceptional_condition"
         fi
         bbdebug 2  "Got to point xyz"
         if [ warning_trigger ]; then
             bbwarn "Detected warning_trigger, this might cause a problem later."
         fi
         if [ recoverable_error ]; then
             bberror "Hit recoverable_error, correcting"
         fi
         if [ fatal_error ]; then
             bbfatal "fatal_error detected"
         fi
         bbdebug 2 "Completed do_my_function"
     }
                

2.3.11. Other Tips

Here are some other tips that you might find useful:

  • When adding new packages, it is worth watching for undesirable items making their way into compiler command lines. For example, you do not want references to local system files like /usr/lib/ or /usr/include/.

  • If you want to remove the psplash boot splashscreen, add psplash=false to the kernel command line. Doing so prevents psplash from loading and thus allows you to see the console. It is also possible to switch out of the splashscreen by switching the virtual console (e.g. Fn+Left or Fn+Right on a Zaurus).

  • Removing TMPDIR (usually tmp/, within the Build Directory) can often fix temporary build issues. Removing TMPDIR is usually a relatively cheap operation, because task output will be cached in SSTATE_DIR (usually sstate-cache/, which is also in the Build Directory).

    Note

    Removing TMPDIR might be a workaround rather than a fix. Consequently, trying to determine the underlying cause of an issue before removing the directory is a good idea.

  • Understanding how a feature is used in practice within existing recipes can be very helpful. It is recommended that you configure some method that allows you to quickly search through files.

    Using GNU Grep, you can use the following shell function to recursively search through common recipe-related files, skipping binary files, .git directories, and the Build Directory (assuming its name starts with "build"):

         g() {
             grep -Ir \
                  --exclude-dir=.git \
                  --exclude-dir='build*' \
                  --include='*.bb*' \
                  --include='*.inc*' \
                  --include='*.conf*' \
                  --include='*.py*' \
                  "$@"
         }
                        

    Following are some usage examples:

         $ g FOO    # Search recursively for "FOO"
         $ g -i foo # Search recursively for "foo", ignoring case
         $ g -w FOO # Search recursively for "FOO" as a word, ignoring e.g. "FOOBAR"
                        

    If figuring out how some feature works requires a lot of searching, it might indicate that the documentation should be extended or improved. In such cases, consider filing a documentation bug using the Yocto Project implementation of Bugzilla. For general information on how to submit a bug against the Yocto Project, see the Yocto Project Bugzilla wiki page" or the Submitting a Defect Against the Yocto Project" section, which is in the Yocto Project Development Tasks Manual.

    Note

    The manuals might not be the right place to document variables that are purely internal and have a limited scope (e.g. internal variables used to implement a single .bbclass file).

2.4. Quick EMUlator (QEMU)

The Yocto Project uses an implementation of the Quick EMUlator (QEMU) Open Source project as part of the Yocto Project development "tool set".

Within the context of the Yocto Project, QEMU is an emulator and virtualization machine that allows you to run a complete image you have built using the Yocto Project as just another task on your build system. QEMU is useful for running and testing images and applications on supported Yocto Project architectures without having actual hardware. Among other things, the Yocto Project uses QEMU to run automated Quality Assurance (QA) tests on final images shipped with each release.

Note

This implementation is not the same as QEMU in general.

This section provides a brief reference for the Yocto Project implementation of QEMU.

For official information and documentation on QEMU in general, see the following references:

For information on how to use the Yocto Project implementation of QEMU, see the "Using the Quick EMUlator (QEMU)" chapter in the Yocto Project Development Tasks Manual.

2.4.1. QEMU Availability

QEMU is made available with the Yocto Project a number of ways. One method is to install a Software Development Kit (SDK). For more information on how to make sure you have QEMU available, see "The QEMU Emulator" section in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.

2.4.2. QEMU Performance

Using QEMU to emulate your hardware can result in speed issues depending on the target and host architecture mix. For example, using the qemux86 image in the emulator on an Intel-based 32-bit (x86) host machine is fast because the target and host architectures match. On the other hand, using the qemuarm image on the same Intel-based host can be slower. But, you still achieve faithful emulation of ARM-specific issues.

To speed things up, the QEMU images support using distcc to call a cross-compiler outside the emulated system. If you used runqemu to start QEMU, and the distccd application is present on the host system, any BitBake cross-compiling toolchain available from the build system is automatically used from within QEMU simply by calling distcc. You can accomplish this by defining the cross-compiler variable (e.g. export CC="distcc"). Alternatively, if you are using a suitable SDK image or the appropriate stand-alone toolchain is present, the toolchain is also automatically used.

Note

Several mechanisms exist that let you connect to the system running on the QEMU emulator:
  • QEMU provides a framebuffer interface that makes standard consoles available.

  • Generally, headless embedded devices have a serial port. If so, you can configure the operating system of the running image to use that port to run a console. The connection uses standard IP networking.

  • SSH servers exist in some QEMU images. The core-image-sato QEMU image has a Dropbear secure shell (SSH) server that runs with the root password disabled. The core-image-full-cmdline and core-image-lsb QEMU images have OpenSSH instead of Dropbear. Including these SSH servers allow you to use standard ssh and scp commands. The core-image-minimal QEMU image, however, contains no SSH server.

  • You can use a provided, user-space NFS server to boot the QEMU session using a local copy of the root filesystem on the host. In order to make this connection, you must extract a root filesystem tarball by using the runqemu-extract-sdk command. After running the command, you must then point the runqemu script to the extracted directory instead of a root filesystem image file. See the "Running Under a Network File System (NFS) Server" section in the Yocto Project Development Tasks Manual for more information.

2.4.3. QEMU Command-Line Syntax

The basic runqemu command syntax is as follows:

     $ runqemu [option ]  [...]
            

Based on what you provide on the command line, runqemu does a good job of figuring out what you are trying to do. For example, by default, QEMU looks for the most recently built image according to the timestamp when it needs to look for an image. Minimally, through the use of options, you must provide either a machine name, a virtual machine image (*wic.vmdk), or a kernel image (*.bin).

Following is the command-line help output for the runqemu command:

     $ runqemu --help

     Usage: you can run this script with any valid combination
     of the following environment variables (in any order):
       KERNEL - the kernel image file to use
       ROOTFS - the rootfs image file or nfsroot directory to use
       MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)
       Simplified QEMU command-line options can be passed with:
         nographic - disable video console
         serial - enable a serial console on /dev/ttyS0
         slirp - enable user networking, no root privileges is required
         kvm - enable KVM when running x86/x86_64 (VT-capable CPU required)
         kvm-vhost - enable KVM with vhost when running x86/x86_64 (VT-capable CPU required)
         publicvnc - enable a VNC server open to all hosts
         audio - enable audio
         [*/]ovmf* - OVMF firmware file or base name for booting with UEFI
       tcpserial=<port> - specify tcp serial port number
       biosdir=<dir> - specify custom bios dir
       biosfilename=<filename> - specify bios filename
       qemuparams=<xyz> - specify custom parameters to QEMU
       bootparams=<xyz> - specify custom kernel parameters during boot
       help, -h, --help: print this text

     Examples:
       runqemu
       runqemu qemuarm
       runqemu tmp/deploy/images/qemuarm
       runqemu tmp/deploy/images/qemux86/<qemuboot.conf>
       runqemu qemux86-64 core-image-sato ext4
       runqemu qemux86-64 wic-image-minimal wic
       runqemu path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial
       runqemu qemux86 iso/hddimg/wic.vmdk/wic.qcow2/wic.vdi/ramfs/cpio.gz...
       runqemu qemux86 qemuparams="-m 256"
       runqemu qemux86 bootparams="psplash=false"
       runqemu path/to/<image>-<machine>.wic
       runqemu path/to/<image>-<machine>.wic.vmdk
            

2.4.4. runqemu Command-Line Options

Following is a description of runqemu options you can provide on the command line:

Tip

If you do provide some "illegal" option combination or perhaps you do not provide enough in the way of options, runqemu provides appropriate error messaging to help you correct the problem.

  • QEMUARCH: The QEMU machine architecture, which must be "qemuarm", "qemuarm64", "qemumips", "qemumips64", "qemuppc", "qemux86", or "qemux86-64".

  • VM: The virtual machine image, which must be a .wic.vmdk file. Use this option when you want to boot a .wic.vmdk image. The image filename you provide must contain one of the following strings: "qemux86-64", "qemux86", "qemuarm", "qemumips64", "qemumips", "qemuppc", or "qemush4".

  • ROOTFS: A root filesystem that has one of the following filetype extensions: "ext2", "ext3", "ext4", "jffs2", "nfs", or "btrfs". If the filename you provide for this option uses “nfs”, it must provide an explicit root filesystem path.

  • KERNEL: A kernel image, which is a .bin file. When you provide a .bin file, runqemu detects it and assumes the file is a kernel image.

  • MACHINE: The architecture of the QEMU machine, which must be one of the following: "qemux86", "qemux86-64", "qemuarm", "qemuarm64", "qemumips", “qemumips64", or "qemuppc". The MACHINE and QEMUARCH options are basically identical. If you do not provide a MACHINE option, runqemu tries to determine it based on other options.

  • ramfs: Indicates you are booting an initial RAM disk (initramfs) image, which means the FSTYPE is cpio.gz.

  • iso: Indicates you are booting an ISO image, which means the FSTYPE is .iso.

  • nographic: Disables the video console, which sets the console to "ttys0".

  • serial: Enables a serial console on /dev/ttyS0.

  • biosdir: Establishes a custom directory for BIOS, VGA BIOS and keymaps.

  • biosfilename: Establishes a custom BIOS name.

  • qemuparams=\"xyz\": Specifies custom QEMU parameters. Use this option to pass options other than the simple "kvm" and "serial" options.

  • bootparams=\"xyz\": Specifies custom boot parameters for the kernel.

  • audio: Enables audio in QEMU. The MACHINE option must be either "qemux86" or "qemux86-64" in order for audio to be enabled. Additionally, the snd_intel8x0 or snd_ens1370 driver must be installed in linux guest.

  • slirp: Enables "slirp" networking, which is a different way of networking that does not need root access but also is not as easy to use or comprehensive as the default.

  • kvm: Enables KVM when running "qemux86" or "qemux86-64" QEMU architectures. For KVM to work, all the following conditions must be met:

    • Your MACHINE must be either qemux86" or "qemux86-64".

    • Your build host has to have the KVM modules installed, which are /dev/kvm.

    • The build host /dev/kvm directory has to be both writable and readable.

  • kvm-vhost: Enables KVM with VHOST support when running "qemux86" or "qemux86-64" QEMU architectures. For KVM with VHOST to work, the following conditions must be met:

    • kvm option conditions must be met.

    • Your build host has to have virtio net device, which are /dev/vhost-net.

    • The build host /dev/vhost-net directory has to be either readable or writable and “slirp-enabled”.

  • publicvnc: Enables a VNC server open to all hosts.

2.5. Maintaining Build Output Quality

Many factors can influence the quality of a build. For example, if you upgrade a recipe to use a new version of an upstream software package or you experiment with some new configuration options, subtle changes can occur that you might not detect until later. Consider the case where your recipe is using a newer version of an upstream package. In this case, a new version of a piece of software might introduce an optional dependency on another library, which is auto-detected. If that library has already been built when the software is building, the software will link to the built library and that library will be pulled into your image along with the new software even if you did not want the library.

The buildhistory class exists to help you maintain the quality of your build output. You can use the class to highlight unexpected and possibly unwanted changes in the build output. When you enable build history, it records information about the contents of each package and image and then commits that information to a local Git repository where you can examine the information.

The remainder of this section describes the following:

  • How you can enable and disable build history

  • How to understand what the build history contains

  • How to limit the information used for build history

  • How to examine the build history from both a command-line and web interface

2.5.1. Enabling and Disabling Build History

Build history is disabled by default. To enable it, add the following INHERIT statement and set the BUILDHISTORY_COMMIT variable to "1" at the end of your conf/local.conf file found in the Build Directory:

     INHERIT += "buildhistory"
     BUILDHISTORY_COMMIT = "1"
            

Enabling build history as previously described causes the OpenEmbedded build system to collect build output information and commit it as a single commit to a local Git repository.

Note

Enabling build history increases your build times slightly, particularly for images, and increases the amount of disk space used during the build.

You can disable build history by removing the previous statements from your conf/local.conf file.

2.5.2. Understanding What the Build History Contains

Build history information is kept in ${TOPDIR}/buildhistory in the Build Directory as defined by the BUILDHISTORY_DIR variable. The following is an example abbreviated listing:

At the top level, there is a metadata-revs file that lists the revisions of the repositories for the layers enabled when the build was produced. The rest of the data splits into separate packages, images and sdk directories, the contents of which are described below.

2.5.2.1. Build History Package Information

The history for each package contains a text file that has name-value pairs with information about the package. For example, buildhistory/packages/i586-poky-linux/busybox/busybox/latest contains the following:

     PV = 1.22.1
     PR = r32
     RPROVIDES =
     RDEPENDS = glibc (>= 2.20) update-alternatives-opkg
     RRECOMMENDS = busybox-syslog busybox-udhcpc update-rc.d
     PKGSIZE = 540168
     FILES = /usr/bin/* /usr/sbin/* /usr/lib/busybox/* /usr/lib/lib*.so.* \
        /etc /com /var /bin/* /sbin/* /lib/*.so.* /lib/udev/rules.d \
        /usr/lib/udev/rules.d /usr/share/busybox /usr/lib/busybox/* \
        /usr/share/pixmaps /usr/share/applications /usr/share/idl \
        /usr/share/omf /usr/share/sounds /usr/lib/bonobo/servers
     FILELIST = /bin/busybox /bin/busybox.nosuid /bin/busybox.suid /bin/sh \
        /etc/busybox.links.nosuid /etc/busybox.links.suid
                

Most of these name-value pairs correspond to variables used to produce the package. The exceptions are FILELIST, which is the actual list of files in the package, and PKGSIZE, which is the total size of files in the package in bytes.

There is also a file corresponding to the recipe from which the package came (e.g. buildhistory/packages/i586-poky-linux/busybox/latest):

     PV = 1.22.1
     PR = r32
     DEPENDS = initscripts kern-tools-native update-rc.d-native \
        virtual/i586-poky-linux-compilerlibs virtual/i586-poky-linux-gcc \
        virtual/libc virtual/update-alternatives
     PACKAGES = busybox-ptest busybox-httpd busybox-udhcpd busybox-udhcpc \
        busybox-syslog busybox-mdev busybox-hwclock busybox-dbg \
        busybox-staticdev busybox-dev busybox-doc busybox-locale busybox
                

Finally, for those recipes fetched from a version control system (e.g., Git), a file exists that lists source revisions that are specified in the recipe and lists the actual revisions used during the build. Listed and actual revisions might differ when SRCREV is set to ${AUTOREV}. Here is an example assuming buildhistory/packages/qemux86-poky-linux/linux-yocto/latest_srcrev):

     # SRCREV_machine = "38cd560d5022ed2dbd1ab0dca9642e47c98a0aa1"
     SRCREV_machine = "38cd560d5022ed2dbd1ab0dca9642e47c98a0aa1"
     # SRCREV_meta = "a227f20eff056e511d504b2e490f3774ab260d6f"
     SRCREV_meta = "a227f20eff056e511d504b2e490f3774ab260d6f"
                

You can use the buildhistory-collect-srcrevs command with the -a option to collect the stored SRCREV values from build history and report them in a format suitable for use in global configuration (e.g., local.conf or a distro include file) to override floating AUTOREV values to a fixed set of revisions. Here is some example output from this command:

     $ buildhistory-collect-srcrevs -a
     # i586-poky-linux
     SRCREV_pn-glibc = "b8079dd0d360648e4e8de48656c5c38972621072"
     SRCREV_pn-glibc-initial = "b8079dd0d360648e4e8de48656c5c38972621072"
     SRCREV_pn-opkg-utils = "53274f087565fd45d8452c5367997ba6a682a37a"
     SRCREV_pn-kmod = "fd56638aed3fe147015bfa10ed4a5f7491303cb4"
     # x86_64-linux
     SRCREV_pn-gtk-doc-stub-native = "1dea266593edb766d6d898c79451ef193eb17cfa"
     SRCREV_pn-dtc-native = "65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf"
     SRCREV_pn-update-rc.d-native = "eca680ddf28d024954895f59a241a622dd575c11"
     SRCREV_glibc_pn-cross-localedef-native = "b8079dd0d360648e4e8de48656c5c38972621072"
     SRCREV_localedef_pn-cross-localedef-native = "c833367348d39dad7ba018990bfdaffaec8e9ed3"
     SRCREV_pn-prelink-native = "faa069deec99bf61418d0bab831c83d7c1b797ca"
     SRCREV_pn-opkg-utils-native = "53274f087565fd45d8452c5367997ba6a682a37a"
     SRCREV_pn-kern-tools-native = "23345b8846fe4bd167efdf1bd8a1224b2ba9a5ff"
     SRCREV_pn-kmod-native = "fd56638aed3fe147015bfa10ed4a5f7491303cb4"
     # qemux86-poky-linux
     SRCREV_machine_pn-linux-yocto = "38cd560d5022ed2dbd1ab0dca9642e47c98a0aa1"
     SRCREV_meta_pn-linux-yocto = "a227f20eff056e511d504b2e490f3774ab260d6f"
     # all-poky-linux
     SRCREV_pn-update-rc.d = "eca680ddf28d024954895f59a241a622dd575c11"
                

Note

Here are some notes on using the buildhistory-collect-srcrevs command:
  • By default, only values where the SRCREV was not hardcoded (usually when AUTOREV was used) are reported. Use the -a option to see all SRCREV values.

  • The output statements might not have any effect if overrides are applied elsewhere in the build system configuration. Use the -f option to add the forcevariable override to each output line if you need to work around this restriction.

  • The script does apply special handling when building for multiple machines. However, the script does place a comment before each set of values that specifies which triplet to which they belong as shown above (e.g., i586-poky-linux).

2.5.2.2. Build History Image Information

The files produced for each image are as follows:

  • image-files: A directory containing selected files from the root filesystem. The files are defined by BUILDHISTORY_IMAGE_FILES.

  • build-id.txt: Human-readable information about the build configuration and metadata source revisions. This file contains the full build header as printed by BitBake.

  • *.dot: Dependency graphs for the image that are compatible with graphviz.

  • files-in-image.txt: A list of files in the image with permissions, owner, group, size, and symlink information.

  • image-info.txt: A text file containing name-value pairs with information about the image. See the following listing example for more information.

  • installed-package-names.txt: A list of installed packages by name only.

  • installed-package-sizes.txt: A list of installed packages ordered by size.

  • installed-packages.txt: A list of installed packages with full package filenames.

Note

Installed package information is able to be gathered and produced even if package management is disabled for the final image.

Here is an example of image-info.txt:

     DISTRO = poky
     DISTRO_VERSION = 1.7
     USER_CLASSES = buildstats image-mklibs image-prelink
     IMAGE_CLASSES = image_types
     IMAGE_FEATURES = debug-tweaks
     IMAGE_LINGUAS =
     IMAGE_INSTALL = packagegroup-core-boot run-postinsts
     BAD_RECOMMENDATIONS =
     NO_RECOMMENDATIONS =
     PACKAGE_EXCLUDE =
     ROOTFS_POSTPROCESS_COMMAND = write_package_manifest; license_create_manifest; \
        write_image_manifest ; buildhistory_list_installed_image ; \
        buildhistory_get_image_installed ; ssh_allow_empty_password;  \
        postinst_enable_logging; rootfs_update_timestamp ; ssh_disable_dns_lookup ;
     IMAGE_POSTPROCESS_COMMAND =   buildhistory_get_imageinfo ;
     IMAGESIZE = 6900
                

Other than IMAGESIZE, which is the total size of the files in the image in Kbytes, the name-value pairs are variables that may have influenced the content of the image. This information is often useful when you are trying to determine why a change in the package or file listings has occurred.

2.5.2.3. Using Build History to Gather Image Information Only

As you can see, build history produces image information, including dependency graphs, so you can see why something was pulled into the image. If you are just interested in this information and not interested in collecting specific package or SDK information, you can enable writing only image information without any history by adding the following to your conf/local.conf file found in the Build Directory:

     INHERIT += "buildhistory"
     BUILDHISTORY_COMMIT = "0"
     BUILDHISTORY_FEATURES = "image"
                

Here, you set the BUILDHISTORY_FEATURES variable to use the image feature only.

2.5.2.4. Build History SDK Information

Build history collects similar information on the contents of SDKs (e.g. bitbake -c populate_sdk imagename) as compared to information it collects for images. Furthermore, this information differs depending on whether an extensible or standard SDK is being produced.

The following list shows the files produced for SDKs:

  • files-in-sdk.txt: A list of files in the SDK with permissions, owner, group, size, and symlink information. This list includes both the host and target parts of the SDK.

  • sdk-info.txt: A text file containing name-value pairs with information about the SDK. See the following listing example for more information.

  • sstate-task-sizes.txt: A text file containing name-value pairs with information about task group sizes (e.g. do_populate_sysroot tasks have a total size). The sstate-task-sizes.txt file exists only when an extensible SDK is created.

  • sstate-package-sizes.txt: A text file containing name-value pairs with information for the shared-state packages and sizes in the SDK. The sstate-package-sizes.txt file exists only when an extensible SDK is created.

  • sdk-files: A folder that contains copies of the files mentioned in BUILDHISTORY_SDK_FILES if the files are present in the output. Additionally, the default value of BUILDHISTORY_SDK_FILES is specific to the extensible SDK although you can set it differently if you would like to pull in specific files from the standard SDK.

    The default files are conf/local.conf, conf/bblayers.conf, conf/auto.conf, conf/locked-sigs.inc, and conf/devtool.conf. Thus, for an extensible SDK, these files get copied into the sdk-files directory.

  • The following information appears under each of the host and target directories for the portions of the SDK that run on the host and on the target, respectively:

    Note

    The following files for the most part are empty when producing an extensible SDK because this type of SDK is not constructed from packages as is the standard SDK.

    • depends.dot: Dependency graph for the SDK that is compatible with graphviz.

    • installed-package-names.txt: A list of installed packages by name only.

    • installed-package-sizes.txt: A list of installed packages ordered by size.

    • installed-packages.txt: A list of installed packages with full package filenames.

Here is an example of sdk-info.txt:

     DISTRO = poky
     DISTRO_VERSION = 1.3+snapshot-20130327
     SDK_NAME = poky-glibc-i686-arm
     SDK_VERSION = 1.3+snapshot
     SDKMACHINE =
     SDKIMAGE_FEATURES = dev-pkgs dbg-pkgs
     BAD_RECOMMENDATIONS =
     SDKSIZE = 352712
                

Other than SDKSIZE, which is the total size of the files in the SDK in Kbytes, the name-value pairs are variables that might have influenced the content of the SDK. This information is often useful when you are trying to determine why a change in the package or file listings has occurred.

2.5.2.5. Examining Build History Information

You can examine build history output from the command line or from a web interface.

To see any changes that have occurred (assuming you have BUILDHISTORY_COMMIT = "1"), you can simply use any Git command that allows you to view the history of a repository. Here is one method:

      $ git log -p
                

You need to realize, however, that this method does show changes that are not significant (e.g. a package's size changing by a few bytes).

A command-line tool called buildhistory-diff does exist, though, that queries the Git repository and prints just the differences that might be significant in human-readable form. Here is an example:

     $ ~/poky/poky/scripts/buildhistory-diff . HEAD^
     Changes to images/qemux86_64/glibc/core-image-minimal (files-in-image.txt):
        /etc/anotherpkg.conf was added
        /sbin/anotherpkg was added
        * (installed-package-names.txt):
        *   anotherpkg was added
     Changes to images/qemux86_64/glibc/core-image-minimal (installed-package-names.txt):
        anotherpkg was added
     packages/qemux86_64-poky-linux/v86d: PACKAGES: added "v86d-extras"
        * PR changed from "r0" to "r1"
        * PV changed from "0.1.10" to "0.1.12"
     packages/qemux86_64-poky-linux/v86d/v86d: PKGSIZE changed from 110579 to 144381 (+30%)
        * PR changed from "r0" to "r1"
        * PV changed from "0.1.10" to "0.1.12"
                

Note

The buildhistory-diff tool requires the GitPython package. Be sure to install it using Pip3 as follows:
   $ pip3 install GitPython --user
                    
Alternatively, you can install python3-git using the appropriate distribution package manager (e.g. apt-get, dnf, or zipper).

To see changes to the build history using a web interface, follow the instruction in the README file here. http://git.yoctoproject.org/cgit/cgit.cgi/buildhistory-web/.

Here is a sample screenshot of the interface:

2.6. Speeding Up the Build

Build time can be an issue. By default, the build system uses simple controls to try and maximize build efficiency. In general, the default settings for all the following variables result in the most efficient build times when dealing with single socket systems (i.e. a single CPU). If you have multiple CPUs, you might try increasing the default values to gain more speed. See the descriptions in the glossary for each variable for more information:

As mentioned, these variables all scale to the number of processor cores available on the build system. For single socket systems, this auto-scaling ensures that the build system fundamentally takes advantage of potential parallel operations during the build based on the build machine's capabilities.

Following are additional factors that can affect build speed:

  • File system type: The file system type that the build is being performed on can also influence performance. Using ext4 is recommended as compared to ext2 and ext3 due to ext4 improved features such as extents.

  • Disabling the updating of access time using noatime: The noatime mount option prevents the build system from updating file and directory access times.

  • Setting a longer commit: Using the "commit=" mount option increases the interval in seconds between disk cache writes. Changing this interval from the five second default to something longer increases the risk of data loss but decreases the need to write to the disk, thus increasing the build performance.

  • Choosing the packaging backend: Of the available packaging backends, IPK is the fastest. Additionally, selecting a singular packaging backend also helps.

  • Using tmpfs for TMPDIR as a temporary file system: While this can help speed up the build, the benefits are limited due to the compiler using -pipe. The build system goes to some lengths to avoid sync() calls into the file system on the principle that if there was a significant failure, the Build Directory contents could easily be rebuilt.

  • Inheriting the rm_work class: Inheriting this class has shown to speed up builds due to significantly lower amounts of data stored in the data cache as well as on disk. Inheriting this class also makes cleanup of TMPDIR faster, at the expense of being easily able to dive into the source code. File system maintainers have recommended that the fastest way to clean up large numbers of files is to reformat partitions rather than delete files due to the linear nature of partitions. This, of course, assumes you structure the disk partitions and file systems in a way that this is practical.

Aside from the previous list, you should keep some trade offs in mind that can help you speed up the build:

  • Remove items from DISTRO_FEATURES that you might not need.

  • Exclude debug symbols and other debug information: If you do not need these symbols and other debug information, disabling the *-dbg package generation can speed up the build. You can disable this generation by setting the INHIBIT_PACKAGE_DEBUG_SPLIT variable to "1".

  • Disable static library generation for recipes derived from autoconf or libtool: Following is an example showing how to disable static libraries and still provide an override to handle exceptions:

         STATICLIBCONF = "--disable-static"
         STATICLIBCONF_sqlite3-native = ""
         EXTRA_OECONF += "${STATICLIBCONF}"
                    

    Notes

    • Some recipes need static libraries in order to work correctly (e.g. pseudo-native needs sqlite3-native). Overrides, as in the previous example, account for these kinds of exceptions.

    • Some packages have packaging code that assumes the presence of the static libraries. If so, you might need to exclude them as well.

Chapter 3. The Yocto Project Development Environment

This chapter takes a look at the Yocto Project development environment and also provides a detailed look at what goes on during development in that environment. The chapter provides Yocto Project Development environment concepts that help you understand how work is accomplished in an open source environment, which is very different as compared to work accomplished in a closed, proprietary environment.

Specifically, this chapter addresses open source philosophy, workflows, Git, source repositories, licensing, recipe syntax, and development syntax.

3.1. Open Source Philosophy

Open source philosophy is characterized by software development directed by peer production and collaboration through an active community of developers. Contrast this to the more standard centralized development models used by commercial software companies where a finite set of developers produces a product for sale using a defined set of procedures that ultimately result in an end product whose architecture and source material are closed to the public.

Open source projects conceptually have differing concurrent agendas, approaches, and production. These facets of the development process can come from anyone in the public (community) that has a stake in the software project. The open source environment contains new copyright, licensing, domain, and consumer issues that differ from the more traditional development environment. In an open source environment, the end product, source material, and documentation are all available to the public at no cost.

A benchmark example of an open source project is the Linux kernel, which was initially conceived and created by Finnish computer science student Linus Torvalds in 1991. Conversely, a good example of a non-open source project is the Windows® family of operating systems developed by Microsoft® Corporation.

Wikipedia has a good historical description of the Open Source Philosophy here. You can also find helpful information on how to participate in the Linux Community here.

3.2. Workflows

This section provides workflow concepts using the Yocto Project and Git. In particular, the information covers basic practices that describe roles and actions in a collaborative development environment.

Note

If you are familiar with this type of development environment, you might not want to read this section.

The Yocto Project files are maintained using Git in "master" branches whose Git histories track every change and whose structures provides branches for all diverging functionality. Although there is no need to use Git, many open source projects do so.

For the Yocto Project, a key individual called the "maintainer" is responsible for the "master" branch of a given Git repository. The "master" branch is the “upstream” repository from which final or most recent builds of the project occur. The maintainer is responsible for accepting changes from other developers and for organizing the underlying branch structure to reflect release strategies and so forth.

Note

For information on finding out who is responsible for (maintains) a particular area of code, see the "Submitting a Change to the Yocto Project" section of the Yocto Project Development Tasks Manual.

The Yocto Project poky Git repository also has an upstream contribution Git repository named poky-contrib. You can see all the branches in this repository using the web interface of the Source Repositories organized within the "Poky Support" area. These branches temporarily hold changes to the project that have been submitted or committed by the Yocto Project development team and by community members who contribute to the project. The maintainer determines if the changes are qualified to be moved from the "contrib" branches into the "master" branch of the Git repository.

Developers (including contributing community members) create and maintain cloned repositories of the upstream "master" branch. The cloned repositories are local to their development platforms and are used to develop changes. When a developer is satisfied with a particular feature or change, they "push" the changes to the appropriate "contrib" repository.

Developers are responsible for keeping their local repository up-to-date with "master". They are also responsible for straightening out any conflicts that might arise within files that are being worked on simultaneously by more than one person. All this work is done locally on the developer’s machine before anything is pushed to a "contrib" area and examined at the maintainer’s level.

A somewhat formal method exists by which developers commit changes and push them into the "contrib" area and subsequently request that the maintainer include them into "master". This process is called “submitting a patch” or "submitting a change." For information on submitting patches and changes, see the "Submitting a Change to the Yocto Project" section in the Yocto Project Development Tasks Manual.

To summarize the development workflow: a single point of entry exists for changes into the project’s "master" branch of the Git repository, which is controlled by the project’s maintainer. And, a set of developers exist who independently develop, test, and submit changes to "contrib" areas for the maintainer to examine. The maintainer then chooses which changes are going to become a permanent part of the project.

While each development environment is unique, there are some best practices or methods that help development run smoothly. The following list describes some of these practices. For more information about Git workflows, see the workflow topics in the Git Community Book.

  • Make Small Changes: It is best to keep the changes you commit small as compared to bundling many disparate changes into a single commit. This practice not only keeps things manageable but also allows the maintainer to more easily include or refuse changes.

    It is also good practice to leave the repository in a state that allows you to still successfully build your project. In other words, do not commit half of a feature, then add the other half as a separate, later commit. Each commit should take you from one buildable project state to another buildable state.

  • Use Branches Liberally: It is very easy to create, use, and delete local branches in your working Git repository. You can name these branches anything you like. It is helpful to give them names associated with the particular feature or change on which you are working. Once you are done with a feature or change and have merged it into your local master branch, simply discard the temporary branch.

  • Merge Changes: The git merge command allows you to take the changes from one branch and fold them into another branch. This process is especially helpful when more than a single developer might be working on different parts of the same feature. Merging changes also automatically identifies any collisions or "conflicts" that might happen as a result of the same lines of code being altered by two different developers.

  • Manage Branches: Because branches are easy to use, you should use a system where branches indicate varying levels of code readiness. For example, you can have a "work" branch to develop in, a "test" branch where the code or change is tested, a "stage" branch where changes are ready to be committed, and so forth. As your project develops, you can merge code across the branches to reflect ever-increasing stable states of the development.

  • Use Push and Pull: The push-pull workflow is based on the concept of developers "pushing" local commits to a remote repository, which is usually a contribution repository. This workflow is also based on developers "pulling" known states of the project down into their local development repositories. The workflow easily allows you to pull changes submitted by other developers from the upstream repository into your work area ensuring that you have the most recent software on which to develop. The Yocto Project has two scripts named create-pull-request and send-pull-request that ship with the release to facilitate this workflow. You can find these scripts in the scripts folder of the Source Directory. For information on how to use these scripts, see the "Using Scripts to Push a Change Upstream and Request a Pull" section in the Yocto Project Development Tasks Manual.

  • Patch Workflow: This workflow allows you to notify the maintainer through an email that you have a change (or patch) you would like considered for the "master" branch of the Git repository. To send this type of change, you format the patch and then send the email using the Git commands git format-patch and git send-email. For information on how to use these scripts, see the "Submitting a Change to the Yocto Project" section in the Yocto Project Development Tasks Manual.

3.3. Git

The Yocto Project makes extensive use of Git, which is a free, open source distributed version control system. Git supports distributed development, non-linear development, and can handle large projects. It is best that you have some fundamental understanding of how Git tracks projects and how to work with Git if you are going to use the Yocto Project for development. This section provides a quick overview of how Git works and provides you with a summary of some essential Git commands.

Notes

  • For more information on Git, see http://git-scm.com/documentation.

  • If you need to download Git, it is recommended that you add Git to your system through your distribution's "software store" (e.g. for Ubuntu, use the Ubuntu Software feature). For the Git download page, see http://git-scm.com/download.

  • For examples beyond the limited few in this section on how to use Git with the Yocto Project, see the "Working With Yocto Project Source Files" section in the Yocto Project Development Tasks Manual.

3.3.1. Repositories, Tags, and Branches

As mentioned briefly in the previous section and also in the "Workflows" section, the Yocto Project maintains source repositories at http://git.yoctoproject.org/cgit.cgi. If you look at this web-interface of the repositories, each item is a separate Git repository.

Git repositories use branching techniques that track content change (not files) within a project (e.g. a new feature or updated documentation). Creating a tree-like structure based on project divergence allows for excellent historical information over the life of a project. This methodology also allows for an environment from which you can do lots of local experimentation on projects as you develop changes or new features.

A Git repository represents all development efforts for a given project. For example, the Git repository poky contains all changes and developments for Poky over the course of its entire life. That means that all changes that make up all releases are captured. The repository maintains a complete history of changes.

You can create a local copy of any repository by "cloning" it with the git clone command. When you clone a Git repository, you end up with an identical copy of the repository on your development system. Once you have a local copy of a repository, you can take steps to develop locally. For examples on how to clone Git repositories, see the "Working With Yocto Project Source Files" section in the Yocto Project Development Tasks Manual.

It is important to understand that Git tracks content change and not files. Git uses "branches" to organize different development efforts. For example, the poky repository has several branches that include the current "rocko" branch, the "master" branch, and many branches for past Yocto Project releases. You can see all the branches by going to http://git.yoctoproject.org/cgit.cgi/poky/ and clicking on the [...] link beneath the "Branch" heading.

Each of these branches represents a specific area of development. The "master" branch represents the current or most recent development. All other branches represent offshoots of the "master" branch.

When you create a local copy of a Git repository, the copy has the same set of branches as the original. This means you can use Git to create a local working area (also called a branch) that tracks a specific development branch from the upstream source Git repository. in other words, you can define your local Git environment to work on any development branch in the repository. To help illustrate, consider the following example Git commands:

     $ cd ~
     $ git clone git://git.yoctoproject.org/poky
     $ cd poky
     $ git checkout -b rocko origin/rocko
            

In the previous example after moving to the home directory, the git clone command creates a local copy of the upstream poky Git repository. By default, Git checks out the "master" branch for your work. After changing the working directory to the new local repository (i.e. poky), the git checkout command creates and checks out a local branch named "rocko", which tracks the upstream "origin/rocko" branch. Changes you make while in this branch would ultimately affect the upstream "rocko" branch of the poky repository.

It is important to understand that when you create and checkout a local working branch based on a branch name, your local environment matches the "tip" of that particular development branch at the time you created your local branch, which could be different from the files in the "master" branch of the upstream repository. In other words, creating and checking out a local branch based on the "rocko" branch name is not the same as cloning and checking out the "master" branch if the repository. Keep reading to see how you create a local snapshot of a Yocto Project Release.

Git uses "tags" to mark specific changes in a repository. Typically, a tag is used to mark a special point such as the final change before a project is released. You can see the tags used with the poky Git repository by going to http://git.yoctoproject.org/cgit.cgi/poky/ and clicking on the [...] link beneath the "Tag" heading.

Some key tags for the poky are jethro-14.0.3, morty-16.0.1, pyro-17.0.0, and rocko-19.0.0. These tags represent Yocto Project releases.

When you create a local copy of the Git repository, you also have access to all the tags in the upstream repository. Similar to branches, you can create and checkout a local working Git branch based on a tag name. When you do this, you get a snapshot of the Git repository that reflects the state of the files when the change was made associated with that tag. The most common use is to checkout a working branch that matches a specific Yocto Project release. Here is an example:

     $ cd ~
     $ git clone git://git.yoctoproject.org/poky
     $ cd poky
     $ git fetch --all --tags --prune
     $ git checkout tags/pyro-17.0.0 -b my-pyro-17.0.0
            

In this example, the name of the top-level directory of your local Yocto Project repository is poky. After moving to the poky directory, the git fetch command makes all the upstream tags available locally in your repository. Finally, the git checkout command creates and checks out a branch named "my-pyro-17.0.0" that is based on the specific change upstream in the repository associated with the "pyro-17.0.0" tag. The files in your repository now exactly match that particular Yocto Project release as it is tagged in the upstream Git repository. It is important to understand that when you create and checkout a local working branch based on a tag, your environment matches a specific point in time and not the entire development branch (i.e. the "tip" of the branch).

3.3.2. Basic Commands

Git has an extensive set of commands that lets you manage changes and perform collaboration over the life of a project. Conveniently though, you can manage with a small set of basic operations and workflows once you understand the basic philosophy behind Git. You do not have to be an expert in Git to be functional. A good place to look for instruction on a minimal set of Git commands is here.

If you do not know much about Git, you should educate yourself by visiting the links previously mentioned.

The following list of Git commands briefly describes some basic Git operations as a way to get started. As with any set of commands, this list (in most cases) simply shows the base command and omits the many arguments they support. See the Git documentation for complete descriptions and strategies on how to use these commands:

  • git init: Initializes an empty Git repository. You cannot use Git commands unless you have a .git repository.

  • git clone: Creates a local clone of a Git repository that is on equal footing with a fellow developer’s Git repository or an upstream repository.

  • git add: Locally stages updated file contents to the index that Git uses to track changes. You must stage all files that have changed before you can commit them.

  • git commit: Creates a local "commit" that documents the changes you made. Only changes that have been staged can be committed. Commits are used for historical purposes, for determining if a maintainer of a project will allow the change, and for ultimately pushing the change from your local Git repository into the project’s upstream repository.

  • git status: Reports any modified files that possibly need to be staged and gives you a status of where you stand regarding local commits as compared to the upstream repository.

  • git checkout branch-name: Changes your working branch. This command is analogous to "cd".

  • git checkout –b working-branch: Creates and checks out a working branch on your local machine that you can use to isolate your work. It is a good idea to use local branches when adding specific features or changes. Using isolated branches facilitates easy removal of changes if they do not work out.

  • git branch: Displays the existing local branches associated with your local repository. The branch that you have currently checked out is noted with an asterisk character.

  • git branch -D branch-name: Deletes an existing local branch. You need to be in a local branch other than the one you are deleting in order to delete branch-name.

  • git pull: Retrieves information from an upstream Git repository and places it in your local Git repository. You use this command to make sure you are synchronized with the repository from which you are basing changes (.e.g. the "master" branch).

  • git push: Sends all your committed local changes to the upstream Git repository that your local repository is tracking (e.g. a contribution repository). The maintainer of the project draws from these repositories to merge changes (commits) into the appropriate branch of project's upstream repository.

  • git merge: Combines or adds changes from one local branch of your repository with another branch. When you create a local Git repository, the default branch is named "master". A typical workflow is to create a temporary branch that is based off "master" that you would use for isolated work. You would make your changes in that isolated branch, stage and commit them locally, switch to the "master" branch, and then use the git merge command to apply the changes from your isolated branch into the currently checked out branch (e.g. "master"). After the merge is complete and if you are done with working in that isolated branch, you can safely delete the isolated branch.

  • git cherry-pick: Choose and apply specific commits from one branch into another branch. There are times when you might not be able to merge all the changes in one branch with another but need to pick out certain ones.

  • gitk: Provides a GUI view of the branches and changes in your local Git repository. This command is a good way to graphically see where things have diverged in your local repository.

    Note

    You need to install the gitk package on your development system to use this command.

  • git log: Reports a history of your commits to the repository. This report lists all commits regardless of whether you have pushed them upstream or not.

  • git diff: Displays line-by-line differences between a local working file and the same file as understood by Git. This command is useful to see what you have changed in any given file.

3.4. Yocto Project Source Repositories

The Yocto Project team maintains complete source repositories for all Yocto Project files at http://git.yoctoproject.org/cgit/cgit.cgi. This web-based source code browser is organized into categories by function such as IDE Plugins, Matchbox, Poky, Yocto Linux Kernel, and so forth. From the interface, you can click on any particular item in the "Name" column and see the URL at the bottom of the page that you need to clone a Git repository for that particular item. Having a local Git repository of the Source Directory, which is usually named "poky", allows you to make changes, contribute to the history, and ultimately enhance the Yocto Project's tools, Board Support Packages, and so forth.

For any supported release of Yocto Project, you can also go to the Yocto Project Website and select the "Downloads" tab and get a released tarball of the poky repository or any supported BSP tarballs. Unpacking these tarballs gives you a snapshot of the released files.

Notes

  • The recommended method for setting up the Yocto Project Source Directory and the files for supported BSPs (e.g., meta-intel) is to use Git to create a local copy of the upstream repositories.

  • Be sure to always work in matching branches for both the selected BSP repository and the Source Directory (i.e. poky) repository. For example, if you have checked out the "master" branch of poky and you are going to use meta-intel, be sure to checkout the "master" branch of meta-intel.

In summary, here is where you can get the project files needed for development:

  • Source Repositories: This area contains IDE Plugins, Matchbox, Poky, Poky Support, Tools, Yocto Linux Kernel, and Yocto Metadata Layers. You can create local copies of Git repositories for each of these areas.

    For steps on how to view and access these upstream Git repositories, see the "Accessing Source Repositories" Section in the Yocto Project Development Tasks Manual.

  • Index of /releases: This is an index of releases such as the Eclipse™ Yocto Plug-in, miscellaneous support, Poky, Pseudo, installers for cross-development toolchains, and all released versions of Yocto Project in the form of images or tarballs. Downloading and extracting these files does not produce a local copy of the Git repository but rather a snapshot of a particular release or image.

    For steps on how to view and access these files, see the "Accessing Index of Releases" section in the Yocto Project Development Tasks Manual.

  • "Downloads" page for the Yocto Project Website:

    This section will change due to reworking of the YP Website.

    The Yocto Project website includes a "Downloads" tab that allows you to download any Yocto Project release and Board Support Package (BSP) in tarball form. The tarballs are similar to those found in the Index of /releases: area.

    For steps on how to use the "Downloads" page, see the "Using the Downloads Page" section in the Yocto Project Development Tasks Manual.

3.5. Licensing

Because open source projects are open to the public, they have different licensing structures in place. License evolution for both Open Source and Free Software has an interesting history. If you are interested in this history, you can find basic information here:

In general, the Yocto Project is broadly licensed under the Massachusetts Institute of Technology (MIT) License. MIT licensing permits the reuse of software within proprietary software as long as the license is distributed with that software. MIT is also compatible with the GNU General Public License (GPL). Patches to the Yocto Project follow the upstream licensing scheme. You can find information on the MIT license here. You can find information on the GNU GPL here.

When you build an image using the Yocto Project, the build process uses a known list of licenses to ensure compliance. You can find this list in the Source Directory at meta/files/common-licenses. Once the build completes, the list of all licenses found and used during that build are kept in the Build Directory at tmp/deploy/licenses.

If a module requires a license that is not in the base list, the build process generates a warning during the build. These tools make it easier for a developer to be certain of the licenses with which their shipped products must comply. However, even with these tools it is still up to the developer to resolve potential licensing issues.

The base list of licenses used by the build process is a combination of the Software Package Data Exchange (SPDX) list and the Open Source Initiative (OSI) projects. SPDX Group is a working group of the Linux Foundation that maintains a specification for a standard format for communicating the components, licenses, and copyrights associated with a software package. OSI is a corporation dedicated to the Open Source Definition and the effort for reviewing and approving licenses that conform to the Open Source Definition (OSD).

You can find a list of the combined SPDX and OSI licenses that the Yocto Project uses in the meta/files/common-licenses directory in your Source Directory.

For information that can help you maintain compliance with various open source licensing during the lifecycle of a product created using the Yocto Project, see the "Maintaining Open Source License Compliance During Your Product's Lifecycle" section in the Yocto Project Development Tasks Manual.

3.6. Recipe Syntax

Understanding recipe file syntax is important for writing recipes. The following list overviews the basic items that make up a BitBake recipe file. For more complete BitBake syntax descriptions, see the "Syntax and Operators" chapter of the BitBake User Manual.

  • Variable Assignments and Manipulations: Variable assignments allow a value to be assigned to a variable. The assignment can be static text or might include the contents of other variables. In addition to the assignment, appending and prepending operations are also supported.

    The following example shows some of the ways you can use variables in recipes:

         S = "${WORKDIR}/postfix-${PV}"
         CFLAGS += "-DNO_ASM"
         SRC_URI_append = " file://fixup.patch"
                    

  • Functions: Functions provide a series of actions to be performed. You usually use functions to override the default implementation of a task function or to complement a default function (i.e. append or prepend to an existing function). Standard functions use sh shell syntax, although access to OpenEmbedded variables and internal methods are also available.

    The following is an example function from the sed recipe:

         do_install () {
             autotools_do_install
             install -d ${D}${base_bindir}
             mv ${D}${bindir}/sed ${D}${base_bindir}/sed
             rmdir ${D}${bindir}/
         }
                    

    It is also possible to implement new functions that are called between existing tasks as long as the new functions are not replacing or complementing the default functions. You can implement functions in Python instead of shell. Both of these options are not seen in the majority of recipes.

  • Keywords: BitBake recipes use only a few keywords. You use keywords to include common functions (inherit), load parts of a recipe from other files (include and require) and export variables to the environment (export).

    The following example shows the use of some of these keywords:

         export POSTCONF = "${STAGING_BINDIR}/postconf"
         inherit autoconf
         require otherfile.inc
                    

  • Comments: Any lines that begin with the hash character (#) are treated as comment lines and are ignored:

         # This is a comment
                    

This next list summarizes the most important and most commonly used parts of the recipe syntax. For more information on these parts of the syntax, you can reference the Syntax and Operators chapter in the BitBake User Manual.

  • Line Continuation: \ - Use the backward slash (\) character to split a statement over multiple lines. Place the slash character at the end of the line that is to be continued on the next line:

         VAR = "A really long \
                line"
                    

    Note

    You cannot have any characters including spaces or tabs after the slash character.

  • Using Variables: ${...} - Use the ${VARNAME} syntax to access the contents of a variable:

         SRC_URI = "${SOURCEFORGE_MIRROR}/libpng/zlib-${PV}.tar.gz"
                    

    Note

    It is important to understand that the value of a variable expressed in this form does not get substituted automatically. The expansion of these expressions happens on-demand later (e.g. usually when a function that makes reference to the variable executes). This behavior ensures that the values are most appropriate for the context in which they are finally used. On the rare occasion that you do need the variable expression to be expanded immediately, you can use the := operator instead of = when you make the assignment, but this is not generally needed.

  • Quote All Assignments: "value" - Use double quotes around the value in all variable assignments.

         VAR1 = "${OTHERVAR}"
         VAR2 = "The version is ${PV}"
                    

  • Conditional Assignment: ?= - Conditional assignment is used to assign a value to a variable, but only when the variable is currently unset. Use the question mark followed by the equal sign (?=) to make a "soft" assignment used for conditional assignment. Typically, "soft" assignments are used in the local.conf file for variables that are allowed to come through from the external environment.

    Here is an example where VAR1 is set to "New value" if it is currently empty. However, if VAR1 has already been set, it remains unchanged:

         VAR1 ?= "New value"
                    

    In this next example, VAR1 is left with the value "Original value":

         VAR1 = "Original value"
         VAR1 ?= "New value"
                    

  • Appending: += - Use the plus character followed by the equals sign (+=) to append values to existing variables.

    Note

    This operator adds a space between the existing content of the variable and the new content.

    Here is an example:

         SRC_URI += "file://fix-makefile.patch"
                    

  • Prepending: =+ - Use the equals sign followed by the plus character (=+) to prepend values to existing variables.

    Note

    This operator adds a space between the new content and the existing content of the variable.

    Here is an example:

         VAR =+ "Starts"
                    

  • Appending: _append - Use the _append operator to append values to existing variables. This operator does not add any additional space. Also, the operator is applied after all the +=, and =+ operators have been applied and after all = assignments have occurred.

    The following example shows the space being explicitly added to the start to ensure the appended value is not merged with the existing value:

         SRC_URI_append = " file://fix-makefile.patch"
                    

    You can also use the _append operator with overrides, which results in the actions only being performed for the specified target or machine:

         SRC_URI_append_sh4 = " file://fix-makefile.patch"
                    

  • Prepending: _prepend - Use the _prepend operator to prepend values to existing variables. This operator does not add any additional space. Also, the operator is applied after all the +=, and =+ operators have been applied and after all = assignments have occurred.

    The following example shows the space being explicitly added to the end to ensure the prepended value is not merged with the existing value:

         CFLAGS_prepend = "-I${S}/myincludes "
                    

    You can also use the _prepend operator with overrides, which results in the actions only being performed for the specified target or machine:

         CFLAGS_prepend_sh4 = "-I${S}/myincludes "
                    

  • Overrides: - You can use overrides to set a value conditionally, typically based on how the recipe is being built. For example, to set the KBRANCH variable's value to "standard/base" for any target MACHINE, except for qemuarm where it should be set to "standard/arm-versatile-926ejs", you would do the following:

         KBRANCH = "standard/base"
         KBRANCH_qemuarm  = "standard/arm-versatile-926ejs"
                    

    Overrides are also used to separate alternate values of a variable in other situations. For example, when setting variables such as FILES and RDEPENDS that are specific to individual packages produced by a recipe, you should always use an override that specifies the name of the package.

  • Indentation: Use spaces for indentation rather than than tabs. For shell functions, both currently work. However, it is a policy decision of the Yocto Project to use tabs in shell functions. Realize that some layers have a policy to use spaces for all indentation.

  • Using Python for Complex Operations: ${@python_code} - For more advanced processing, it is possible to use Python code during variable assignments (e.g. search and replacement on a variable).

    You indicate Python code using the ${@python_code} syntax for the variable assignment:

         SRC_URI = "ftp://ftp.info-zip.org/pub/infozip/src/zip${@d.getVar('PV',1).replace('.', '')}.tgz
                    

  • Shell Function Syntax: Write shell functions as if you were writing a shell script when you describe a list of actions to take. You should ensure that your script works with a generic sh and that it does not require any bash or other shell-specific functionality. The same considerations apply to various system utilities (e.g. sed, grep, awk, and so forth) that you might wish to use. If in doubt, you should check with multiple implementations - including those from BusyBox.

3.7. Development Concepts

This section takes a more detailed look inside the development process. The following diagram represents development at a high level. The remainder of this chapter expands on the fundamental input, output, process, and Metadata) blocks that make up development in the Yocto Project environment.

In general, development consists of several functional areas:

  • User Configuration: Metadata you can use to control the build process.

  • Metadata Layers: Various layers that provide software, machine, and distro Metadata.

  • Source Files: Upstream releases, local projects, and SCMs.

  • Build System: Processes under the control of BitBake. This block expands on how BitBake fetches source, applies patches, completes compilation, analyzes output for package generation, creates and tests packages, generates images, and generates cross-development tools.

  • Package Feeds: Directories containing output packages (RPM, DEB or IPK), which are subsequently used in the construction of an image or SDK, produced by the build system. These feeds can also be copied and shared using a web server or other means to facilitate extending or updating existing images on devices at runtime if runtime package management is enabled.

  • Images: Images produced by the development process.

  • Application Development SDK: Cross-development tools that are produced along with an image or separately with BitBake.

3.7.1. User Configuration

User configuration helps define the build. Through user configuration, you can tell BitBake the target architecture for which you are building the image, where to store downloaded source, and other build properties.

The following figure shows an expanded representation of the "User Configuration" box of the general Yocto Project Development Environment figure:

BitBake needs some basic configuration files in order to complete a build. These files are *.conf files. The minimally necessary ones reside as example files in the Source Directory. For simplicity, this section refers to the Source Directory as the "Poky Directory."

When you clone the poky Git repository or you download and unpack a Yocto Project release, you can set up the Source Directory to be named anything you want. For this discussion, the cloned repository uses the default name poky.

Note

The Poky repository is primarily an aggregation of existing repositories. It is not a canonical upstream source.

The meta-poky layer inside Poky contains a conf directory that has example configuration files. These example files are used as a basis for creating actual configuration files when you source the build environment script (i.e. oe-init-build-env).

Sourcing the build environment script creates a Build Directory if one does not already exist. BitBake uses the Build Directory for all its work during builds. The Build Directory has a conf directory that contains default versions of your local.conf and bblayers.conf configuration files. These default configuration files are created only if versions do not already exist in the Build Directory at the time you source the build environment setup script.

Because the Poky repository is fundamentally an aggregation of existing repositories, some users might be familiar with running the oe-init-build-env script in the context of separate OpenEmbedded-Core and BitBake repositories rather than a single Poky repository. This discussion assumes the script is executed from within a cloned or unpacked version of Poky.

Depending on where the script is sourced, different sub-scripts are called to set up the Build Directory (Yocto or OpenEmbedded). Specifically, the script scripts/oe-setup-builddir inside the poky directory sets up the Build Directory and seeds the directory (if necessary) with configuration files appropriate for the Yocto Project development environment.

Note

The scripts/oe-setup-builddir script uses the $TEMPLATECONF variable to determine which sample configuration files to locate.

The local.conf file provides many basic variables that define a build environment. Here is a list of a few. To see the default configurations in a local.conf file created by the build environment script, see the local.conf.sample in the meta-poky layer:

Note

Configurations set in the conf/local.conf file can also be set in the conf/site.conf and conf/auto.conf configuration files.

The bblayers.conf file tells BitBake what layers you want considered during the build. By default, the layers listed in this file include layers minimally needed by the build system. However, you must manually add any custom layers you have created. You can find more information on working with the bblayers.conf file in the "Enabling Your Layer" section in the Yocto Project Development Tasks Manual.

The files site.conf and auto.conf are not created by the environment initialization script. If you want the site.conf file, you need to create that yourself. The auto.conf file is typically created by an autobuilder:

  • site.conf: You can use the conf/site.conf configuration file to configure multiple build directories. For example, suppose you had several build environments and they shared some common features. You can set these default build properties here. A good example is perhaps the packaging format to use through the PACKAGE_CLASSES variable.

    One useful scenario for using the conf/site.conf file is to extend your BBPATH variable to include the path to a conf/site.conf. Then, when BitBake looks for Metadata using BBPATH, it finds the conf/site.conf file and applies your common configurations found in the file. To override configurations in a particular build directory, alter the similar configurations within that build directory's conf/local.conf file.

  • auto.conf: The file is usually created and written to by an autobuilder. The settings put into the file are typically the same as you would find in the conf/local.conf or the conf/site.conf files.

You can edit all configuration files to further define any particular build environment. This process is represented by the "User Configuration Edits" box in the figure.

When you launch your build with the bitbake target command, BitBake sorts out the configurations to ultimately define your build environment. It is important to understand that the OpenEmbedded build system reads the configuration files in a specific order: site.conf, auto.conf, and local.conf. And, the build system applies the normal assignment statement rules. Because the files are parsed in a specific order, variable assignments for the same variable could be affected. For example, if the auto.conf file and the local.conf set variable1 to different values, because the build system parses local.conf after auto.conf, variable1 is assigned the value from the local.conf file.

3.7.2. Metadata, Machine Configuration, and Policy Configuration

The previous section described the user configurations that define BitBake's global behavior. This section takes a closer look at the layers the build system uses to further control the build. These layers provide Metadata for the software, machine, and policy.

In general, three types of layer input exist:

  • Policy Configuration: Distribution Layers provide top-level or general policies for the image or SDK being built. For example, this layer would dictate whether BitBake produces RPM or IPK packages.

  • Machine Configuration: Board Support Package (BSP) layers provide machine configurations. This type of information is specific to a particular target architecture.

  • Metadata: Software layers contain user-supplied recipe files, patches, and append files.

The following figure shows an expanded representation of the Metadata, Machine Configuration, and Policy Configuration input (layers) boxes of the general Yocto Project Development Environment figure:

In general, all layers have a similar structure. They all contain a licensing file (e.g. COPYING) if the layer is to be distributed, a README file as good practice and especially if the layer is to be distributed, a configuration directory, and recipe directories.

The Yocto Project has many layers that can be used. You can see a web-interface listing of them on the Source Repositories page. The layers are shown at the bottom categorized under "Yocto Metadata Layers." These layers are fundamentally a subset of the OpenEmbedded Metadata Index, which lists all layers provided by the OpenEmbedded community.

Note

Layers exist in the Yocto Project Source Repositories that cannot be found in the OpenEmbedded Metadata Index. These layers are either deprecated or experimental in nature.

BitBake uses the conf/bblayers.conf file, which is part of the user configuration, to find what layers it should be using as part of the build.

For more information on layers, see the "Understanding and Creating Layers" section in the Yocto Project Development Tasks Manual.

3.7.2.1. Distro Layer

The distribution layer provides policy configurations for your distribution. Best practices dictate that you isolate these types of configurations into their own layer. Settings you provide in conf/distro/distro.conf override similar settings that BitBake finds in your conf/local.conf file in the Build Directory.

The following list provides some explanation and references for what you typically find in the distribution layer:

  • classes: Class files (.bbclass) hold common functionality that can be shared among recipes in the distribution. When your recipes inherit a class, they take on the settings and functions for that class. You can read more about class files in the "Classes" section.

  • conf: This area holds configuration files for the layer (conf/layer.conf), the distribution (conf/distro/distro.conf), and any distribution-wide include files.

  • recipes-*: Recipes and append files that affect common functionality across the distribution. This area could include recipes and append files to add distribution-specific configuration, initialization scripts, custom image recipes, and so forth.

3.7.2.2. BSP Layer

The BSP Layer provides machine configurations. Everything in this layer is specific to the machine for which you are building the image or the SDK. A common structure or form is defined for BSP layers. You can learn more about this structure in the Yocto Project Board Support Package (BSP) Developer's Guide.

Note

In order for a BSP layer to be considered compliant with the Yocto Project, it must meet some structural requirements.

The BSP Layer's configuration directory contains configuration files for the machine (conf/machine/machine.conf) and, of course, the layer (conf/layer.conf).

The remainder of the layer is dedicated to specific recipes by function: recipes-bsp, recipes-core, recipes-graphics, and recipes-kernel. Metadata can exist for multiple formfactors, graphics support systems, and so forth.

Note

While the figure shows several recipes-* directories, not all these directories appear in all BSP layers.

3.7.2.3. Software Layer

The software layer provides the Metadata for additional software packages used during the build. This layer does not include Metadata that is specific to the distribution or the machine, which are found in their respective layers.

This layer contains any new recipes that your project needs in the form of recipe files.

3.7.3. Sources

In order for the OpenEmbedded build system to create an image or any target, it must be able to access source files. The general Yocto Project Development Environment figure represents source files using the "Upstream Project Releases", "Local Projects", and "SCMs (optional)" boxes. The figure represents mirrors, which also play a role in locating source files, with the "Source Mirror(s)" box.

The method by which source files are ultimately organized is a function of the project. For example, for released software, projects tend to use tarballs or other archived files that can capture the state of a release guaranteeing that it is statically represented. On the other hand, for a project that is more dynamic or experimental in nature, a project might keep source files in a repository controlled by a Source Control Manager (SCM) such as Git. Pulling source from a repository allows you to control the point in the repository (the revision) from which you want to build software. Finally, a combination of the two might exist, which would give the consumer a choice when deciding where to get source files.

BitBake uses the SRC_URI variable to point to source files regardless of their location. Each recipe must have a SRC_URI variable that points to the source.

Another area that plays a significant role in where source files come from is pointed to by the DL_DIR variable. This area is a cache that can hold previously downloaded source. You can also instruct the OpenEmbedded build system to create tarballs from Git repositories, which is not the default behavior, and store them in the DL_DIR by using the BB_GENERATE_MIRROR_TARBALLS variable.

Judicious use of a DL_DIR directory can save the build system a trip across the Internet when looking for files. A good method for using a download directory is to have DL_DIR point to an area outside of your Build Directory. Doing so allows you to safely delete the Build Directory if needed without fear of removing any downloaded source file.

The remainder of this section provides a deeper look into the source files and the mirrors. Here is a more detailed look at the source file area of the base figure:

3.7.3.1. Upstream Project Releases

Upstream project releases exist anywhere in the form of an archived file (e.g. tarball or zip file). These files correspond to individual recipes. For example, the figure uses specific releases each for BusyBox, Qt, and Dbus. An archive file can be for any released product that can be built using a recipe.

3.7.3.2. Local Projects

Local projects are custom bits of software the user provides. These bits reside somewhere local to a project - perhaps a directory into which the user checks in items (e.g. a local directory containing a development source tree used by the group).

The canonical method through which to include a local project is to use the externalsrc class to include that local project. You use either the local.conf or a recipe's append file to override or set the recipe to point to the local directory on your disk to pull in the whole source tree.

For information on how to use the externalsrc class, see the "externalsrc.bbclass" section.

3.7.3.3. Source Control Managers (Optional)

Another place the build system can get source files from is through an SCM such as Git or Subversion. In this case, a repository is cloned or checked out. The do_fetch task inside BitBake uses the SRC_URI variable and the argument's prefix to determine the correct fetcher module.

Note

For information on how to have the OpenEmbedded build system generate tarballs for Git repositories and place them in the DL_DIR directory, see the BB_GENERATE_MIRROR_TARBALLS variable.

When fetching a repository, BitBake uses the SRCREV variable to determine the specific revision from which to build.

3.7.3.4. Source Mirror(s)

Two kinds of mirrors exist: pre-mirrors and regular mirrors. The PREMIRRORS and MIRRORS variables point to these, respectively. BitBake checks pre-mirrors before looking upstream for any source files. Pre-mirrors are appropriate when you have a shared directory that is not a directory defined by the DL_DIR variable. A Pre-mirror typically points to a shared directory that is local to your organization.

Regular mirrors can be any site across the Internet that is used as an alternative location for source code should the primary site not be functioning for some reason or another.

3.7.4. Package Feeds

When the OpenEmbedded build system generates an image or an SDK, it gets the packages from a package feed area located in the Build Directory. The general Yocto Project Development Environment figure shows this package feeds area in the upper-right corner.

This section looks a little closer into the package feeds area used by the build system. Here is a more detailed look at the area:

Package feeds are an intermediary step in the build process. The OpenEmbedded build system provides classes to generate different package types, and you specify which classes to enable through the PACKAGE_CLASSES variable. Before placing the packages into package feeds, the build process validates them with generated output quality assurance checks through the insane class.

The package feed area resides in the Build Directory. The directory the build system uses to temporarily store packages is determined by a combination of variables and the particular package manager in use. See the "Package Feeds" box in the illustration and note the information to the right of that area. In particular, the following defines where package files are kept:

  • DEPLOY_DIR: Defined as tmp/deploy in the Build Directory.

  • DEPLOY_DIR_*: Depending on the package manager used, the package type sub-folder. Given RPM, IPK, or DEB packaging and tarball creation, the DEPLOY_DIR_RPM, DEPLOY_DIR_IPK, DEPLOY_DIR_DEB, or DEPLOY_DIR_TAR, variables are used, respectively.

  • PACKAGE_ARCH: Defines architecture-specific sub-folders. For example, packages could exist for the i586 or qemux86 architectures.

BitBake uses the do_package_write_* tasks to generate packages and place them into the package holding area (e.g. do_package_write_ipk for IPK packages). See the "do_package_write_deb", "do_package_write_ipk", "do_package_write_rpm", and "do_package_write_tar" sections for additional information. As an example, consider a scenario where an IPK packaging manager is being used and package architecture support for both i586 and qemux86 exist. Packages for the i586 architecture are placed in build/tmp/deploy/ipk/i586, while packages for the qemux86 architecture are placed in build/tmp/deploy/ipk/qemux86.

3.7.5. BitBake

The OpenEmbedded build system uses BitBake to produce images. You can see from the general Yocto Project Development Environment figure, the BitBake area consists of several functional areas. This section takes a closer look at each of those areas.

Separate documentation exists for the BitBake tool. See the BitBake User Manual for reference material on BitBake.

3.7.5.1. Source Fetching

The first stages of building a recipe are to fetch and unpack the source code:

The do_fetch and do_unpack tasks fetch the source files and unpack them into the work directory.

Note

For every local file (e.g. file://) that is part of a recipe's SRC_URI statement, the OpenEmbedded build system takes a checksum of the file for the recipe and inserts the checksum into the signature for the do_fetch. If any local file has been modified, the do_fetch task and all tasks that depend on it are re-executed.

By default, everything is accomplished in the Build Directory, which has a defined structure. For additional general information on the Build Directory, see the "build/" section.

Unpacked source files are pointed to by the S variable. Each recipe has an area in the Build Directory where the unpacked source code resides. The name of that directory for any given recipe is defined from several different variables. You can see the variables that define these directories by looking at the figure:

  • TMPDIR - The base directory where the OpenEmbedded build system performs all its work during the build.

  • PACKAGE_ARCH - The architecture of the built package or packages.

  • TARGET_OS - The operating system of the target device.

  • PN - The name of the built package.

  • PV - The version of the recipe used to build the package.

  • PR - The revision of the recipe used to build the package.

  • WORKDIR - The location within TMPDIR where a specific package is built.

  • S - Contains the unpacked source files for a given recipe.

3.7.5.2. Patching

Once source code is fetched and unpacked, BitBake locates patch files and applies them to the source files:

The do_patch task processes recipes by using the SRC_URI variable to locate applicable patch files, which by default are *.patch or *.diff files, or any file if "apply=yes" is specified for the file in SRC_URI.

BitBake finds and applies multiple patches for a single recipe in the order in which it finds the patches. Patches are applied to the recipe's source files located in the S directory.

For more information on how the source directories are created, see the "Source Fetching" section.

3.7.5.3. Configuration and Compilation

After source code is patched, BitBake executes tasks that configure and compile the source code:

This step in the build process consists of three tasks:

  • do_prepare_recipe_sysroot: This task sets up the two sysroots in ${WORKDIR} (i.e. recipe-sysroot and recipe-sysroot-native) so that the sysroots contain the contents of the do_populate_sysroot tasks of the recipes on which the recipe containing the tasks depends. A sysroot exists for both the target and for the native binaries, which run on the host system.

  • do_configure: This task configures the source by enabling and disabling any build-time and configuration options for the software being built. Configurations can come from the recipe itself as well as from an inherited class. Additionally, the software itself might configure itself depending on the target for which it is being built.

    The configurations handled by the do_configure task are specific to source code configuration for the source code being built by the recipe.

    If you are using the autotools class, you can add additional configuration options by using the EXTRA_OECONF or PACKAGECONFIG_CONFARGS variables. For information on how this variable works within that class, see the meta/classes/autotools.bbclass file.

  • do_compile: Once a configuration task has been satisfied, BitBake compiles the source using the do_compile task. Compilation occurs in the directory pointed to by the B variable. Realize that the B directory is, by default, the same as the S directory.

  • do_install: Once compilation is done, BitBake executes the do_install task. This task copies files from the B directory and places them in a holding area pointed to by the D variable.

3.7.5.4. Package Splitting

After source code is configured and compiled, the OpenEmbedded build system analyzes the results and splits the output into packages:

The do_package and do_packagedata tasks combine to analyze the files found in the D directory and split them into subsets based on available packages and files. The analyzing process involves the following as well as other items: splitting out debugging symbols, looking at shared library dependencies between packages, and looking at package relationships. The do_packagedata task creates package metadata based on the analysis such that the OpenEmbedded build system can generate the final packages. Working, staged, and intermediate results of the analysis and package splitting process use these areas:

  • PKGD - The destination directory for packages before they are split.

  • PKGDATA_DIR - A shared, global-state directory that holds data generated during the packaging process.

  • PKGDESTWORK - A temporary work area used by the do_package task.

  • PKGDEST - The parent directory for packages after they have been split.

The FILES variable defines the files that go into each package in PACKAGES. If you want details on how this is accomplished, you can look at the package class.

Depending on the type of packages being created (RPM, DEB, or IPK), the do_package_write_* task creates the actual packages and places them in the Package Feed area, which is ${TMPDIR}/deploy. You can see the "Package Feeds" section for more detail on that part of the build process.

Note

Support for creating feeds directly from the deploy/* directories does not exist. Creating such feeds usually requires some kind of feed maintenance mechanism that would upload the new packages into an official package feed (e.g. the Ångström distribution). This functionality is highly distribution-specific and thus is not provided out of the box.

3.7.5.5. Image Generation

Once packages are split and stored in the Package Feeds area, the OpenEmbedded build system uses BitBake to generate the root filesystem image:

The image generation process consists of several stages and depends on several tasks and variables. The do_rootfs task creates the root filesystem (file and directory structure) for an image. This task uses several key variables to help create the list of packages to actually install:

  • IMAGE_INSTALL: Lists out the base set of packages to install from the Package Feeds area.

  • PACKAGE_EXCLUDE: Specifies packages that should not be installed.

  • IMAGE_FEATURES: Specifies features to include in the image. Most of these features map to additional packages for installation.

  • PACKAGE_CLASSES: Specifies the package backend to use and consequently helps determine where to locate packages within the Package Feeds area.

  • IMAGE_LINGUAS: Determines the language(s) for which additional language support packages are installed.

  • PACKAGE_INSTALL: The final list of packages passed to the package manager for installation into the image.

With IMAGE_ROOTFS pointing to the location of the filesystem under construction and the PACKAGE_INSTALL variable providing the final list of packages to install, the root file system is created.

Package installation is under control of the package manager (e.g. dnf/rpm, opkg, or apt/dpkg) regardless of whether or not package management is enabled for the target. At the end of the process, if package management is not enabled for the target, the package manager's data files are deleted from the root filesystem. As part of the final stage of package installation, postinstall scripts that are part of the packages are run. Any scripts that fail to run on the build host are run on the target when the target system is first booted. If you are using a read-only root filesystem, all the post installation scripts must succeed during the package installation phase since the root filesystem is read-only.

The final stages of the do_rootfs task handle post processing. Post processing includes creation of a manifest file and optimizations.

The manifest file (.manifest) resides in the same directory as the root filesystem image. This file lists out, line-by-line, the installed packages. The manifest file is useful for the testimage class, for example, to determine whether or not to run specific tests. See the IMAGE_MANIFEST variable for additional information.

Optimizing processes run across the image include mklibs, prelink, and any other post-processing commands as defined by the ROOTFS_POSTPROCESS_COMMAND variable. The mklibs process optimizes the size of the libraries, while the prelink process optimizes the dynamic linking of shared libraries to reduce start up time of executables.

After the root filesystem is built, processing begins on the image through the do_image task. The build system runs any pre-processing commands as defined by the IMAGE_PREPROCESS_COMMAND variable. This variable specifies a list of functions to call before the OpenEmbedded build system creates the final image output files.

The OpenEmbedded build system dynamically creates do_image_* tasks as needed, based on the image types specified in the IMAGE_FSTYPES variable. The process turns everything into an image file or a set of image files and compresses the root filesystem image to reduce the overall size of the image. The formats used for the root filesystem depend on the IMAGE_FSTYPES variable.

As an example, a dynamically created task when creating a particular image type would take the following form:

     do_image_type[depends]
                

So, if the type as specified by the IMAGE_FSTYPES were ext4, the dynamically generated task would be as follows:

     do_image_ext4[depends]
                

The final task involved in image creation is the do_image_complete task. This task completes the image by applying any image post processing as defined through the IMAGE_POSTPROCESS_COMMAND variable. The variable specifies a list of functions to call once the OpenEmbedded build system has created the final image output files.

Note

The entire image generation process is run under Pseudo. Running under Pseudo ensures that the files in the root filesystem have correct ownership.

3.7.5.6. SDK Generation

The OpenEmbedded build system uses BitBake to generate the Software Development Kit (SDK) installer script for both the standard and extensible SDKs:

Note

For more information on the cross-development toolchain generation, see the "Cross-Development Toolchain Generation" section. For information on advantages gained when building a cross-development toolchain using the do_populate_sdk task, see the "Building an SDK Installer" section in the Yocto Project Application Development and the Extensible Software Development Kit (SDK) manual.

Like image generation, the SDK script process consists of several stages and depends on many variables. The do_populate_sdk and do_populate_sdk_ext tasks use these key variables to help create the list of packages to actually install. For information on the variables listed in the figure, see the "Application Development SDK" section.

The do_populate_sdk task helps create the standard SDK and handles two parts: a target part and a host part. The target part is the part built for the target hardware and includes libraries and headers. The host part is the part of the SDK that runs on the SDKMACHINE.

The do_populate_sdk_ext task helps create the extensible SDK and handles host and target parts differently than its counter part does for the standard SDK. For the extensible SDK, the task encapsulates the build system, which includes everything needed (host and target) for the SDK.

Regardless of the type of SDK being constructed, the tasks perform some cleanup after which a cross-development environment setup script and any needed configuration files are created. The final output is the Cross-development toolchain installation script (.sh file), which includes the environment setup script.

3.7.5.7. Stamp Files and the Rerunning of Tasks

For each task that completes successfully, BitBake writes a stamp file into the STAMPS_DIR directory. The beginning of the stamp file's filename is determined by the STAMP variable, and the end of the name consists of the task's name and current input checksum.

Note

This naming scheme assumes that BB_SIGNATURE_HANDLER is "OEBasicHash", which is almost always the case in current OpenEmbedded.

To determine if a task needs to be rerun, BitBake checks if a stamp file with a matching input checksum exists for the task. If such a stamp file exists, the task's output is assumed to exist and still be valid. If the file does not exist, the task is rerun.

Note

The stamp mechanism is more general than the shared state (sstate) cache mechanism described in the "Setscene Tasks and Shared State" section. BitBake avoids rerunning any task that has a valid stamp file, not just tasks that can be accelerated through the sstate cache.

However, you should realize that stamp files only serve as a marker that some work has been done and that these files do not record task output. The actual task output would usually be somewhere in TMPDIR (e.g. in some recipe's WORKDIR.) What the sstate cache mechanism adds is a way to cache task output that can then be shared between build machines.

Since STAMPS_DIR is usually a subdirectory of TMPDIR, removing TMPDIR will also remove STAMPS_DIR, which means tasks will properly be rerun to repopulate TMPDIR.

If you want some task to always be considered "out of date", you can mark it with the nostamp varflag. If some other task depends on such a task, then that task will also always be considered out of date, which might not be what you want.

For details on how to view information about a task's signature, see the "Viewing Task Variable Dependencies" section.

3.7.5.8. Setscene Tasks and Shared State

The description of tasks so far assumes that BitBake needs to build everything and there are no prebuilt objects available. BitBake does support skipping tasks if prebuilt objects are available. These objects are usually made available in the form of a shared state (sstate) cache.

Note

For information on variables affecting sstate, see the SSTATE_DIR and SSTATE_MIRRORS variables.

The idea of a setscene task (i.e do_taskname_setscene) is a version of the task where instead of building something, BitBake can skip to the end result and simply place a set of files into specific locations as needed. In some cases, it makes sense to have a setscene task variant (e.g. generating package files in the do_package_write_* task). In other cases, it does not make sense, (e.g. a do_patch task or do_unpack task) since the work involved would be equal to or greater than the underlying task.

In the OpenEmbedded build system, the common tasks that have setscene variants are do_package, do_package_write_*, do_deploy, do_packagedata, and do_populate_sysroot. Notice that these are most of the tasks whose output is an end result.

The OpenEmbedded build system has knowledge of the relationship between these tasks and other tasks that precede them. For example, if BitBake runs do_populate_sysroot_setscene for something, there is little point in running any of the do_fetch, do_unpack, do_patch, do_configure, do_compile, and do_install tasks. However, if do_package needs to be run, BitBake would need to run those other tasks.

It becomes more complicated if everything can come from an sstate cache because some objects are simply not required at all. For example, you do not need a compiler or native tools, such as quilt, if there is nothing to compile or patch. If the do_package_write_* packages are available from sstate, BitBake does not need the do_package task data.

To handle all these complexities, BitBake runs in two phases. The first is the "setscene" stage. During this stage, BitBake first checks the sstate cache for any targets it is planning to build. BitBake does a fast check to see if the object exists rather than a complete download. If nothing exists, the second phase, which is the setscene stage, completes and the main build proceeds.

If objects are found in the sstate cache, the OpenEmbedded build system works backwards from the end targets specified by the user. For example, if an image is being built, the OpenEmbedded build system first looks for the packages needed for that image and the tools needed to construct an image. If those are available, the compiler is not needed. Thus, the compiler is not even downloaded. If something was found to be unavailable, or the download or setscene task fails, the OpenEmbedded build system then tries to install dependencies, such as the compiler, from the cache.

The availability of objects in the sstate cache is handled by the function specified by the BB_HASHCHECK_FUNCTION variable and returns a list of the objects that are available. The function specified by the BB_SETSCENE_DEPVALID variable is the function that determines whether a given dependency needs to be followed, and whether for any given relationship the function needs to be passed. The function returns a True or False value.

3.7.6. Images

The images produced by the OpenEmbedded build system are compressed forms of the root filesystem that are ready to boot on a target device. You can see from the general Yocto Project Development Environment figure that BitBake output, in part, consists of images. This section is going to look more closely at this output:

For a list of example images that the Yocto Project provides, see the "Images" chapter.

Images are written out to the Build Directory inside the tmp/deploy/images/machine/ folder as shown in the figure. This folder contains any files expected to be loaded on the target device. The DEPLOY_DIR variable points to the deploy directory, while the DEPLOY_DIR_IMAGE variable points to the appropriate directory containing images for the current configuration.

  • kernel-image: A kernel binary file. The KERNEL_IMAGETYPE variable setting determines the naming scheme for the kernel image file. Depending on that variable, the file could begin with a variety of naming strings. The deploy/images/machine directory can contain multiple image files for the machine.

  • root-filesystem-image: Root filesystems for the target device (e.g. *.ext3 or *.bz2 files). The IMAGE_FSTYPES variable setting determines the root filesystem image type. The deploy/images/machine directory can contain multiple root filesystems for the machine.

  • kernel-modules: Tarballs that contain all the modules built for the kernel. Kernel module tarballs exist for legacy purposes and can be suppressed by setting the MODULE_TARBALL_DEPLOY variable to "0". The deploy/images/machine directory can contain multiple kernel module tarballs for the machine.

  • bootloaders: Bootloaders supporting the image, if applicable to the target machine. The deploy/images/machine directory can contain multiple bootloaders for the machine.

  • symlinks: The deploy/images/machine folder contains a symbolic link that points to the most recently built file for each machine. These links might be useful for external scripts that need to obtain the latest version of each file.

3.7.7. Application Development SDK

In the general Yocto Project Development Environment figure, the output labeled "Application Development SDK" represents an SDK. The SDK generation process differs depending on whether you build a standard SDK (e.g. bitbake -c populate_sdk imagename) or an extensible SDK (e.g. bitbake -c populate_sdk_ext imagename). This section is going to take a closer look at this output:

The specific form of this output is a self-extracting SDK installer (*.sh) that, when run, installs the SDK, which consists of a cross-development toolchain, a set of libraries and headers, and an SDK environment setup script. Running this installer essentially sets up your cross-development environment. You can think of the cross-toolchain as the "host" part because it runs on the SDK machine. You can think of the libraries and headers as the "target" part because they are built for the target hardware. The environment setup script is added so that you can initialize the environment before using the tools.

Note

The Yocto Project supports several methods by which you can set up this cross-development environment. These methods include downloading pre-built SDK installers or building and installing your own SDK installer.

For background information on cross-development toolchains in the Yocto Project development environment, see the "Cross-Development Toolchain Generation" section. For information on setting up a cross-development environment, see the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.

Once built, the SDK installers are written out to the deploy/sdk folder inside the Build Directory as shown in the figure at the beginning of this section. Depending on the type of SDK, several variables exist that help configure these files. The following list shows the variables associated with a standard SDK:

  • DEPLOY_DIR: Points to the deploy directory.

  • SDKMACHINE: Specifies the architecture of the machine on which the cross-development tools are run to create packages for the target hardware.

  • SDKIMAGE_FEATURES: Lists the features to include in the "target" part of the SDK.

  • TOOLCHAIN_HOST_TASK: Lists packages that make up the host part of the SDK (i.e. the part that runs on the SDKMACHINE). When you use bitbake -c populate_sdk imagename to create the SDK, a set of default packages apply. This variable allows you to add more packages.

  • TOOLCHAIN_TARGET_TASK: Lists packages that make up the target part of the SDK (i.e. the part built for the target hardware).

  • SDKPATH: Defines the default SDK installation path offered by the installation script.

This next list, shows the variables associated with an extensible SDK:

  • DEPLOY_DIR: Points to the deploy directory.

  • SDK_EXT_TYPE: Controls whether or not shared state artifacts are copied into the extensible SDK. By default, all required shared state artifacts are copied into the SDK.

  • SDK_INCLUDE_PKGDATA: Specifies whether or not packagedata will be included in the extensible SDK for all recipes in the "world" target.

  • SDK_INCLUDE_TOOLCHAIN: Specifies whether or not the toolchain will be included when building the extensible SDK.

  • SDK_LOCAL_CONF_WHITELIST: A list of variables allowed through from the build system configuration into the extensible SDK configuration.

  • SDK_LOCAL_CONF_BLACKLIST: A list of variables not allowed through from the build system configuration into the extensible SDK configuration.

  • SDK_INHERIT_BLACKLIST: A list of classes to remove from the INHERIT value globally within the extensible SDK configuration.

Chapter 4. Technical Details

This chapter provides technical details for various parts of the Yocto Project. Currently, topics include Yocto Project components, cross-toolchain generation, shared state (sstate) cache, x32, Wayland support, and Licenses.

4.1. Yocto Project Components

The BitBake task executor together with various types of configuration files form the OpenEmbedded Core. This section overviews these components by describing their use and how they interact.

BitBake handles the parsing and execution of the data files. The data itself is of various types:

  • Recipes: Provides details about particular pieces of software.

  • Class Data: Abstracts common build information (e.g. how to build a Linux kernel).

  • Configuration Data: Defines machine-specific settings, policy decisions, and so forth. Configuration data acts as the glue to bind everything together.

BitBake knows how to combine multiple data sources together and refers to each data source as a layer. For information on layers, see the "Understanding and Creating Layers" section of the Yocto Project Development Tasks Manual.

Following are some brief details on these core components. For additional information on how these components interact during a build, see the "Development Concepts" section.

4.1.1. BitBake

BitBake is the tool at the heart of the OpenEmbedded build system and is responsible for parsing the Metadata, generating a list of tasks from it, and then executing those tasks.

This section briefly introduces BitBake. If you want more information on BitBake, see the BitBake User Manual.

To see a list of the options BitBake supports, use either of the following commands:

     $ bitbake -h
     $ bitbake --help
            

The most common usage for BitBake is bitbake packagename, where packagename is the name of the package you want to build (referred to as the "target" in this manual). The target often equates to the first part of a recipe's filename (e.g. "foo" for a recipe named foo_1.3.0-r0.bb). So, to process the matchbox-desktop_1.2.3.bb recipe file, you might type the following:

     $ bitbake matchbox-desktop
            

Several different versions of matchbox-desktop might exist. BitBake chooses the one selected by the distribution configuration. You can get more details about how BitBake chooses between different target versions and providers in the "Preferences" section of the BitBake User Manual.

BitBake also tries to execute any dependent tasks first. So for example, before building matchbox-desktop, BitBake would build a cross compiler and glibc if they had not already been built.

A useful BitBake option to consider is the -k or --continue option. This option instructs BitBake to try and continue processing the job as long as possible even after encountering an error. When an error occurs, the target that failed and those that depend on it cannot be remade. However, when you use this option other dependencies can still be processed.

4.1.2. Metadata (Recipes)

Files that have the .bb suffix are "recipes" files. In general, a recipe contains information about a single piece of software. This information includes the location from which to download the unaltered source, any source patches to be applied to that source (if needed), which special configuration options to apply, how to compile the source files, and how to package the compiled output.

The term "package" is sometimes used to refer to recipes. However, since the word "package" is used for the packaged output from the OpenEmbedded build system (i.e. .ipk or .deb files), this document avoids using the term "package" when referring to recipes.

4.1.3. Metadata (Virtual Providers)

Prior to the build, if you know that several different recipes provide the same functionality, you can use a virtual provider (i.e. virtual/*) as a placeholder for the actual provider. The actual provider would be determined at build time. In this case, you should add virtual/* to DEPENDS, rather than listing the specified provider. You would select the actual provider by setting the PREFERRED_PROVIDER variable (i.e. PREFERRED_PROVIDER_virtual/*) in the build's configuration file (e.g. poky/build/conf/local.conf).

Note

Any recipe that PROVIDES a virtual/* item that is ultimately not selected through PREFERRED_PROVIDER does not get built. Preventing these recipes from building is usually the desired behavior since this mechanism's purpose is to select between mutually exclusive alternative providers.

The following lists specific examples of virtual providers:

  • virtual/mesa: Provides gbm.pc.

  • virtual/egl: Provides egl.pc and possibly wayland-egl.pc.

  • virtual/libgl: Provides gl.pc (i.e. libGL).

  • virtual/libgles1: Provides glesv1_cm.pc (i.e. libGLESv1_CM).

  • virtual/libgles2: Provides glesv2.pc (i.e. libGLESv2).

4.1.4. Classes

Class files (.bbclass) contain information that is useful to share between Metadata files. An example is the autotools class, which contains common settings for any application that Autotools uses. The "Classes" chapter provides details about classes and how to use them.

4.1.5. Configuration

The configuration files (.conf) define various configuration variables that govern the OpenEmbedded build process. These files fall into several areas that define machine configuration options, distribution configuration options, compiler tuning options, general common configuration options, and user configuration options in local.conf, which is found in the Build Directory.

4.2. Cross-Development Toolchain Generation

The Yocto Project does most of the work for you when it comes to creating cross-development toolchains. This section provides some technical background on how cross-development toolchains are created and used. For more information on toolchains, you can also see the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.

In the Yocto Project development environment, cross-development toolchains are used to build the image and applications that run on the target hardware. With just a few commands, the OpenEmbedded build system creates these necessary toolchains for you.

The following figure shows a high-level build environment regarding toolchain construction and use.

Most of the work occurs on the Build Host. This is the machine used to build images and generally work within the the Yocto Project environment. When you run BitBake to create an image, the OpenEmbedded build system uses the host gcc compiler to bootstrap a cross-compiler named gcc-cross. The gcc-cross compiler is what BitBake uses to compile source files when creating the target image. You can think of gcc-cross simply as an automatically generated cross-compiler that is used internally within BitBake only.

Note

The extensible SDK does not use gcc-cross-canadian since this SDK ships a copy of the OpenEmbedded build system and the sysroot within it contains gcc-cross.

The chain of events that occurs when gcc-cross is bootstrapped is as follows:

     gcc -> binutils-cross -> gcc-cross-initial -> linux-libc-headers -> glibc-initial -> glibc -> gcc-cross -> gcc-runtime
        

  • gcc: The build host's GNU Compiler Collection (GCC).

  • binutils-cross: The bare minimum binary utilities needed in order to run the gcc-cross-initial phase of the bootstrap operation.

  • gcc-cross-initial: An early stage of the bootstrap process for creating the cross-compiler. This stage builds enough of the gcc-cross, the C library, and other pieces needed to finish building the final cross-compiler in later stages. This tool is a "native" package (i.e. it is designed to run on the build host).

  • linux-libc-headers: Headers needed for the cross-compiler.

  • glibc-initial: An initial version of the Embedded GLIBC needed to bootstrap glibc.

  • gcc-cross: The final stage of the bootstrap process for the cross-compiler. This stage results in the actual cross-compiler that BitBake uses when it builds an image for a targeted device.

    Note

    If you are replacing this cross compiler toolchain with a custom version, you must replace gcc-cross.

    This tool is also a "native" package (i.e. it is designed to run on the build host).

  • gcc-runtime: Runtime libraries resulting from the toolchain bootstrapping process. This tool produces a binary that consists of the runtime libraries need for the targeted device.

You can use the OpenEmbedded build system to build an installer for the relocatable SDK used to develop applications. When you run the installer, it installs the toolchain, which contains the development tools (e.g., the gcc-cross-canadian), binutils-cross-canadian, and other nativesdk-* tools, which are tools native to the SDK (i.e. native to SDK_ARCH), you need to cross-compile and test your software. The figure shows the commands you use to easily build out this toolchain. This cross-development toolchain is built to execute on the SDKMACHINE, which might or might not be the same machine as the Build Host.

Note

If your target architecture is supported by the Yocto Project, you can take advantage of pre-built images that ship with the Yocto Project and already contain cross-development toolchain installers.

Here is the bootstrap process for the relocatable toolchain:

     gcc -> binutils-crosssdk -> gcc-crosssdk-initial -> linux-libc-headers ->
        glibc-initial -> nativesdk-glibc -> gcc-crosssdk -> gcc-cross-canadian
        

  • gcc: The build host's GNU Compiler Collection (GCC).

  • binutils-crosssdk: The bare minimum binary utilities needed in order to run the gcc-crosssdk-initial phase of the bootstrap operation.

  • gcc-crosssdk-initial: An early stage of the bootstrap process for creating the cross-compiler. This stage builds enough of the gcc-crosssdk and supporting pieces so that the final stage of the bootstrap process can produce the finished cross-compiler. This tool is a "native" binary that runs on the build host.

  • linux-libc-headers: Headers needed for the cross-compiler.

  • glibc-initial: An initial version of the Embedded GLIBC needed to bootstrap nativesdk-glibc.

  • nativesdk-glibc: The Embedded GLIBC needed to bootstrap the gcc-crosssdk.

  • gcc-crosssdk: The final stage of the bootstrap process for the relocatable cross-compiler. The gcc-crosssdk is a transitory compiler and never leaves the build host. Its purpose is to help in the bootstrap process to create the eventual relocatable gcc-cross-canadian compiler, which is relocatable. This tool is also a "native" package (i.e. it is designed to run on the build host).

  • gcc-cross-canadian: The final relocatable cross-compiler. When run on the SDKMACHINE, this tool produces executable code that runs on the target device. Only one cross-canadian compiler is produced per architecture since they can be targeted at different processor optimizations using configurations passed to the compiler through the compile commands. This circumvents the need for multiple compilers and thus reduces the size of the toolchains.

Note

For information on advantages gained when building a cross-development toolchain installer, see the "Building an SDK Installer" section in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.

4.3. Shared State Cache

By design, the OpenEmbedded build system builds everything from scratch unless BitBake can determine that parts do not need to be rebuilt. Fundamentally, building from scratch is attractive as it means all parts are built fresh and there is no possibility of stale data causing problems. When developers hit problems, they typically default back to building from scratch so they know the state of things from the start.

Building an image from scratch is both an advantage and a disadvantage to the process. As mentioned in the previous paragraph, building from scratch ensures that everything is current and starts from a known state. However, building from scratch also takes much longer as it generally means rebuilding things that do not necessarily need to be rebuilt.

The Yocto Project implements shared state code that supports incremental builds. The implementation of the shared state code answers the following questions that were fundamental roadblocks within the OpenEmbedded incremental build support system:

  • What pieces of the system have changed and what pieces have not changed?

  • How are changed pieces of software removed and replaced?

  • How are pre-built components that do not need to be rebuilt from scratch used when they are available?

For the first question, the build system detects changes in the "inputs" to a given task by creating a checksum (or signature) of the task's inputs. If the checksum changes, the system assumes the inputs have changed and the task needs to be rerun. For the second question, the shared state (sstate) code tracks which tasks add which output to the build process. This means the output from a given task can be removed, upgraded or otherwise manipulated. The third question is partly addressed by the solution for the second question assuming the build system can fetch the sstate objects from remote locations and install them if they are deemed to be valid.

Note

The OpenEmbedded build system does not maintain PR information as part of the shared state packages. Consequently, considerations exist that affect maintaining shared state feeds. For information on how the OpenEmbedded build system works with packages and can track incrementing PR information, see the "Automatically Incrementing a Binary Package Revision Number" section in the Yocto Project Development Tasks Manual.

The rest of this section goes into detail about the overall incremental build architecture, the checksums (signatures), shared state, and some tips and tricks.

4.3.1. Overall Architecture

When determining what parts of the system need to be built, BitBake works on a per-task basis rather than a per-recipe basis. You might wonder why using a per-task basis is preferred over a per-recipe basis. To help explain, consider having the IPK packaging backend enabled and then switching to DEB. In this case, the do_install and do_package task outputs are still valid. However, with a per-recipe approach, the build would not include the .deb files. Consequently, you would have to invalidate the whole build and rerun it. Rerunning everything is not the best solution. Also, in this case, the core must be "taught" much about specific tasks. This methodology does not scale well and does not allow users to easily add new tasks in layers or as external recipes without touching the packaged-staging core.

4.3.2. Checksums (Signatures)

The shared state code uses a checksum, which is a unique signature of a task's inputs, to determine if a task needs to be run again. Because it is a change in a task's inputs that triggers a rerun, the process needs to detect all the inputs to a given task. For shell tasks, this turns out to be fairly easy because the build process generates a "run" shell script for each task and it is possible to create a checksum that gives you a good idea of when the task's data changes.

To complicate the problem, there are things that should not be included in the checksum. First, there is the actual specific build path of a given task - the WORKDIR. It does not matter if the work directory changes because it should not affect the output for target packages. Also, the build process has the objective of making native or cross packages relocatable.

Note

Both native and cross packages run on the build host. However, cross packages generate output for the target architecture.

The checksum therefore needs to exclude WORKDIR. The simplistic approach for excluding the work directory is to set WORKDIR to some fixed value and create the checksum for the "run" script.

Another problem results from the "run" scripts containing functions that might or might not get called. The incremental build solution contains code that figures out dependencies between shell functions. This code is used to prune the "run" scripts down to the minimum set, thereby alleviating this problem and making the "run" scripts much more readable as a bonus.

So far we have solutions for shell scripts. What about Python tasks? The same approach applies even though these tasks are more difficult. The process needs to figure out what variables a Python function accesses and what functions it calls. Again, the incremental build solution contains code that first figures out the variable and function dependencies, and then creates a checksum for the data used as the input to the task.

Like the WORKDIR case, situations exist where dependencies should be ignored. For these cases, you can instruct the build process to ignore a dependency by using a line like the following:

     PACKAGE_ARCHS[vardepsexclude] = "MACHINE"
            

This example ensures that the PACKAGE_ARCHS variable does not depend on the value of MACHINE, even if it does reference it.

Equally, there are cases where we need to add dependencies BitBake is not able to find. You can accomplish this by using a line like the following:

      PACKAGE_ARCHS[vardeps] = "MACHINE"
            

This example explicitly adds the MACHINE variable as a dependency for PACKAGE_ARCHS.

Consider a case with in-line Python, for example, where BitBake is not able to figure out dependencies. When running in debug mode (i.e. using -DDD), BitBake produces output when it discovers something for which it cannot figure out dependencies. The Yocto Project team has currently not managed to cover those dependencies in detail and is aware of the need to fix this situation.

Thus far, this section has limited discussion to the direct inputs into a task. Information based on direct inputs is referred to as the "basehash" in the code. However, there is still the question of a task's indirect inputs - the things that were already built and present in the Build Directory. The checksum (or signature) for a particular task needs to add the hashes of all the tasks on which the particular task depends. Choosing which dependencies to add is a policy decision. However, the effect is to generate a master checksum that combines the basehash and the hashes of the task's dependencies.

At the code level, there are a variety of ways both the basehash and the dependent task hashes can be influenced. Within the BitBake configuration file, we can give BitBake some extra information to help it construct the basehash. The following statement effectively results in a list of global variable dependency excludes - variables never included in any checksum:

     BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH DL_DIR \
         SSTATE_DIR THISDIR FILESEXTRAPATHS FILE_DIRNAME HOME LOGNAME SHELL TERM \
         USER FILESPATH STAGING_DIR_HOST STAGING_DIR_TARGET COREBASE PRSERV_HOST \
         PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \
         CCACHE_DIR EXTERNAL_TOOLCHAIN CCACHE CCACHE_DISABLE LICENSE_PATH SDKPKGSUFFIX"
            

The previous example excludes WORKDIR since that variable is actually constructed as a path within TMPDIR, which is on the whitelist.

The rules for deciding which hashes of dependent tasks to include through dependency chains are more complex and are generally accomplished with a Python function. The code in meta/lib/oe/sstatesig.py shows two examples of this and also illustrates how you can insert your own policy into the system if so desired. This file defines the two basic signature generators OE-Core uses: "OEBasic" and "OEBasicHash". By default, there is a dummy "noop" signature handler enabled in BitBake. This means that behavior is unchanged from previous versions. OE-Core uses the "OEBasicHash" signature handler by default through this setting in the bitbake.conf file:

     BB_SIGNATURE_HANDLER ?= "OEBasicHash"
            

The "OEBasicHash" BB_SIGNATURE_HANDLER is the same as the "OEBasic" version but adds the task hash to the stamp files. This results in any Metadata change that changes the task hash, automatically causing the task to be run again. This removes the need to bump PR values, and changes to Metadata automatically ripple across the build.

It is also worth noting that the end result of these signature generators is to make some dependency and hash information available to the build. This information includes:

  • BB_BASEHASH_task-taskname: The base hashes for each task in the recipe.

  • BB_BASEHASH_filename:taskname: The base hashes for each dependent task.

  • BBHASHDEPS_filename:taskname: The task dependencies for each task.

  • BB_TASKHASH: The hash of the currently running task.

4.3.3. Shared State

Checksums and dependencies, as discussed in the previous section, solve half the problem of supporting a shared state. The other part of the problem is being able to use checksum information during the build and being able to reuse or rebuild specific components.

The sstate class is a relatively generic implementation of how to "capture" a snapshot of a given task. The idea is that the build process does not care about the source of a task's output. Output could be freshly built or it could be downloaded and unpacked from somewhere - the build process does not need to worry about its origin.

There are two types of output, one is just about creating a directory in WORKDIR. A good example is the output of either do_install or do_package. The other type of output occurs when a set of data is merged into a shared directory tree such as the sysroot.

The Yocto Project team has tried to keep the details of the implementation hidden in sstate class. From a user's perspective, adding shared state wrapping to a task is as simple as this do_deploy example taken from the deploy class:

     DEPLOYDIR = "${WORKDIR}/deploy-${PN}"
     SSTATETASKS += "do_deploy"
     do_deploy[sstate-inputdirs] = "${DEPLOYDIR}"
     do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}"

     python do_deploy_setscene () {
         sstate_setscene(d)
     }
     addtask do_deploy_setscene
     do_deploy[dirs] = "${DEPLOYDIR} ${B}"
            

The following list explains the previous example:

  • Adding "do_deploy" to SSTATETASKS adds some required sstate-related processing, which is implemented in the sstate class, to before and after the do_deploy task.

  • The do_deploy[sstate-inputdirs] = "${DEPLOYDIR}" declares that do_deploy places its output in ${DEPLOYDIR} when run normally (i.e. when not using the sstate cache). This output becomes the input to the shared state cache.

  • The do_deploy[sstate-outputdirs] = "${DEPLOY_DIR_IMAGE}" line causes the contents of the shared state cache to be copied to ${DEPLOY_DIR_IMAGE}.

    Note

    If do_deploy is not already in the shared state cache or if its input checksum (signature) has changed from when the output was cached, the task will be run to populate the shared state cache, after which the contents of the shared state cache is copied to ${DEPLOY_DIR_IMAGE}. If do_deploy is in the shared state cache and its signature indicates that the cached output is still valid (i.e. if no relevant task inputs have changed), then the contents of the shared state cache will be copied directly to ${DEPLOY_DIR_IMAGE} by the do_deploy_setscene task instead, skipping the do_deploy task.

  • The following task definition is glue logic needed to make the previous settings effective:

         python do_deploy_setscene () {
             sstate_setscene(d)
         }
         addtask do_deploy_setscene
                        

    sstate_setscene() takes the flags above as input and accelerates the do_deploy task through the shared state cache if possible. If the task was accelerated, sstate_setscene() returns True. Otherwise, it returns False, and the normal do_deploy task runs. For more information, see the "setscene" section in the BitBake User Manual.

  • The do_deploy[dirs] = "${DEPLOYDIR} ${B}" line creates ${DEPLOYDIR} and ${B} before the do_deploy task runs, and also sets the current working directory of do_deploy to ${B}. For more information, see the "Variable Flags" section in the BitBake User Manual.

    Note

    In cases where sstate-inputdirs and sstate-outputdirs would be the same, you can use sstate-plaindirs. For example, to preserve the ${PKGD} and ${PKGDEST} output from the do_package task, use the following:
         do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST}"
                            

  • sstate-inputdirs and sstate-outputdirs can also be used with multiple directories. For example, the following declares PKGDESTWORK and SHLIBWORK as shared state input directories, which populates the shared state cache, and PKGDATA_DIR and SHLIBSDIR as the corresponding shared state output directories:

         do_package[sstate-inputdirs] = "${PKGDESTWORK} ${SHLIBSWORKDIR}"
         do_package[sstate-outputdirs] = "${PKGDATA_DIR} ${SHLIBSDIR}"
                         

  • These methods also include the ability to take a lockfile when manipulating shared state directory structures, for cases where file additions or removals are sensitive:

         do_package[sstate-lockfile] = "${PACKAGELOCK}"
                         

Behind the scenes, the shared state code works by looking in SSTATE_DIR and SSTATE_MIRRORS for shared state files. Here is an example:

     SSTATE_MIRRORS ?= "\
     file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \
     file://.* file:///some/local/dir/sstate/PATH"
            

Note

The shared state directory (SSTATE_DIR) is organized into two-character subdirectories, where the subdirectory names are based on the first two characters of the hash. If the shared state directory structure for a mirror has the same structure as SSTATE_DIR, you must specify "PATH" as part of the URI to enable the build system to map to the appropriate subdirectory.

The shared state package validity can be detected just by looking at the filename since the filename contains the task checksum (or signature) as described earlier in this section. If a valid shared state package is found, the build process downloads it and uses it to accelerate the task.

The build processes use the *_setscene tasks for the task acceleration phase. BitBake goes through this phase before the main execution code and tries to accelerate any tasks for which it can find shared state packages. If a shared state package for a task is available, the shared state package is used. This means the task and any tasks on which it is dependent are not executed.

As a real world example, the aim is when building an IPK-based image, only the do_package_write_ipk tasks would have their shared state packages fetched and extracted. Since the sysroot is not used, it would never get extracted. This is another reason why a task-based approach is preferred over a recipe-based approach, which would have to install the output from every task.

4.3.4. Tips and Tricks

The code in the build system that supports incremental builds is not simple code. This section presents some tips and tricks that help you work around issues related to shared state code.

4.3.4.1. Debugging

Seeing what metadata went into creating the input signature of a shared state (sstate) task can be a useful debugging aid. This information is available in signature information (siginfo) files in SSTATE_DIR. For information on how to view and interpret information in siginfo files, see the "Viewing Task Variable Dependencies" section.

4.3.4.2. Invalidating Shared State

The OpenEmbedded build system uses checksums and shared state cache to avoid unnecessarily rebuilding tasks. Collectively, this scheme is known as "shared state code."

As with all schemes, this one has some drawbacks. It is possible that you could make implicit changes to your code that the checksum calculations do not take into account. These implicit changes affect a task's output but do not trigger the shared state code into rebuilding a recipe. Consider an example during which a tool changes its output. Assume that the output of rpmdeps changes. The result of the change should be that all the package and package_write_rpm shared state cache items become invalid. However, because the change to the output is external to the code and therefore implicit, the associated shared state cache items do not become invalidated. In this case, the build process uses the cached items rather than running the task again. Obviously, these types of implicit changes can cause problems.

To avoid these problems during the build, you need to understand the effects of any changes you make. Realize that changes you make directly to a function are automatically factored into the checksum calculation. Thus, these explicit changes invalidate the associated area of shared state cache. However, you need to be aware of any implicit changes that are not obvious changes to the code and could affect the output of a given task.

When you identify an implicit change, you can easily take steps to invalidate the cache and force the tasks to run. The steps you can take are as simple as changing a function's comments in the source code. For example, to invalidate package shared state files, change the comment statements of do_package or the comments of one of the functions it calls. Even though the change is purely cosmetic, it causes the checksum to be recalculated and forces the OpenEmbedded build system to run the task again.

Note

For an example of a commit that makes a cosmetic change to invalidate shared state, see this commit.

4.4. Automatically Added Runtime Dependencies

The OpenEmbedded build system automatically adds common types of runtime dependencies between packages, which means that you do not need to explicitly declare the packages using RDEPENDS. Three automatic mechanisms exist (shlibdeps, pcdeps, and depchains) that handle shared libraries, package configuration (pkg-config) modules, and -dev and -dbg packages, respectively. For other types of runtime dependencies, you must manually declare the dependencies.

  • shlibdeps: During the do_package task of each recipe, all shared libraries installed by the recipe are located. For each shared library, the package that contains the shared library is registered as providing the shared library. More specifically, the package is registered as providing the soname of the library. The resulting shared-library-to-package mapping is saved globally in PKGDATA_DIR by the do_packagedata task.

    Simultaneously, all executables and shared libraries installed by the recipe are inspected to see what shared libraries they link against. For each shared library dependency that is found, PKGDATA_DIR is queried to see if some package (likely from a different recipe) contains the shared library. If such a package is found, a runtime dependency is added from the package that depends on the shared library to the package that contains the library.

    The automatically added runtime dependency also includes a version restriction. This version restriction specifies that at least the current version of the package that provides the shared library must be used, as if "package (>= version)" had been added to RDEPENDS. This forces an upgrade of the package containing the shared library when installing the package that depends on the library, if needed.

    If you want to avoid a package being registered as providing a particular shared library (e.g. because the library is for internal use only), then add the library to PRIVATE_LIBS inside the package's recipe.

  • pcdeps: During the do_package task of each recipe, all pkg-config modules (*.pc files) installed by the recipe are located. For each module, the package that contains the module is registered as providing the module. The resulting module-to-package mapping is saved globally in PKGDATA_DIR by the do_packagedata task.

    Simultaneously, all pkg-config modules installed by the recipe are inspected to see what other pkg-config modules they depend on. A module is seen as depending on another module if it contains a "Requires:" line that specifies the other module. For each module dependency, PKGDATA_DIR is queried to see if some package contains the module. If such a package is found, a runtime dependency is added from the package that depends on the module to the package that contains the module.

    Note

    The pcdeps mechanism most often infers dependencies between -dev packages.

  • depchains: If a package foo depends on a package bar, then foo-dev and foo-dbg are also made to depend on bar-dev and bar-dbg, respectively. Taking the -dev packages as an example, the bar-dev package might provide headers and shared library symlinks needed by foo-dev, which shows the need for a dependency between the packages.

    The dependencies added by depchains are in the form of RRECOMMENDS.

    Note

    By default, foo-dev also has an RDEPENDS-style dependency on foo, because the default value of RDEPENDS_${PN}-dev (set in bitbake.conf) includes "${PN}".

    To ensure that the dependency chain is never broken, -dev and -dbg packages are always generated by default, even if the packages turn out to be empty. See the ALLOW_EMPTY variable for more information.

The do_package task depends on the do_packagedata task of each recipe in DEPENDS through use of a [deptask] declaration, which guarantees that the required shared-library/module-to-package mapping information will be available when needed as long as DEPENDS has been correctly set.

4.5. Fakeroot and Pseudo

Some tasks are easier to implement when allowed to perform certain operations that are normally reserved for the root user. For example, the do_install task benefits from being able to set the UID and GID of installed files to arbitrary values.

One approach to allowing tasks to perform root-only operations would be to require BitBake to run as root. However, this method is cumbersome and has security issues. The approach that is actually used is to run tasks that benefit from root privileges in a "fake" root environment. Within this environment, the task and its child processes believe that they are running as the root user, and see an internally consistent view of the filesystem. As long as generating the final output (e.g. a package or an image) does not require root privileges, the fact that some earlier steps ran in a fake root environment does not cause problems.

The capability to run tasks in a fake root environment is known as "fakeroot", which is derived from the BitBake keyword/variable flag that requests a fake root environment for a task. In current versions of the OpenEmbedded build system, the program that implements fakeroot is known as Pseudo.

Pseudo overrides system calls through the LD_PRELOAD mechanism to give the illusion of running as root. To keep track of "fake" file ownership and permissions resulting from operations that require root permissions, an sqlite3 database is used. This database is stored in ${WORKDIR}/pseudo/files.db for individual recipes. Storing the database in a file as opposed to in memory gives persistence between tasks, and even between builds.

Caution

If you add your own task that manipulates the same files or directories as a fakeroot task, then that task should also run under fakeroot. Otherwise, the task will not be able to run root-only operations, and will not see the fake file ownership and permissions set by the other task. You should also add a dependency on virtual/fakeroot-native:do_populate_sysroot, giving the following:
       fakeroot do_mytask () {
           ...
       }
       do_mytask[depends] += "virtual/fakeroot-native:do_populate_sysroot"
            

For more information, see the FAKEROOT* variables in the BitBake User Manual. You can also reference this Pseudo article.

4.6. Wic Plug-Ins Interface

You can extend and specialize Wic functionality by using Wic plug-ins. This section explains the Wic plug-in interface. For information on using Wic in general, see the "Creating Partitioned Images Using Wic" section in the Yocto Project Development Tasks Manual.

Note

Wic plug-ins consist of "source" and "imager" plug-ins. Imager plug-ins are beyond the scope of this section.

Source plug-ins provide a mechanism to customize partition content during the Wic image generation process. You can use source plug-ins to map values that you specify using --source commands in kickstart files (i.e. *.wks) to a plug-in implementation used to populate a given partition.

Note

If you use plug-ins that have build-time dependencies (e.g. native tools, bootloaders, and so forth) when building a Wic image, you need to specify those dependencies using the WKS_FILE_DEPENDS variable.

Source plug-ins are subclasses defined in plug-in files. As shipped, the Yocto Project provides several plug-in files. You can see the source plug-in files that ship with the Yocto Project here. Each of these plug-in files contain source plug-ins that are designed to populate a specific Wic image partition.

Source plug-ins are subclasses of the SourcePlugin class, which is defined in the poky/scripts/lib/wic/pluginbase.py file. For example, the BootimgEFIPlugin source plug-in found in the bootimg-efi.py file is a subclass of the SourcePlugin class, which is found in the pluginbase.py file.

You can also implement source plug-ins in a layer outside of the Source Repositories (external layer). To do so, be sure that your plug-in files are located in a directory whose path is scripts/lib/wic/plugins/source/ within your external layer. When the plug-in files are located there, the source plug-ins they contain are made available to Wic.

When the Wic implementation needs to invoke a partition-specific implementation, it looks for the plug-in with the same name as the --source parameter used in the kickstart file given to that partition. For example, if the partition is set up using the following command in a kickstart file:

     part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024
        

The methods defined as class members of the matching source plug-in (i.e. bootimg-pcbios) in the bootimg-pcbios.py plug-in file are used.

To be more concrete, here is the corresponding plug-in definition from the bootimg-pcbios.py file for the previous command along with an example method called by the Wic implementation when it needs to prepare a partition using an implementation-specific function:

     bootimg-pcbios.py
                  .
                  .
                  .
        class BootimgPcbiosPlugin(SourcePlugin):
        """
        Create MBR boot partition and install syslinux on it.
        """

        name = 'bootimg-pcbios'
                  .
                  .
                  .
        @classmethod
        def do_prepare_partition(cls, part, source_params, creator, cr_workdir,
                                 oe_builddir, bootimg_dir, kernel_dir,
                                 rootfs_dir, native_sysroot):
            """
            Called to do the actual content population for a partition i.e. it
            'prepares' the partition to be incorporated into the image.
            In this case, prepare content for legacy bios boot partition.
            """
                  .
                  .
                  .
        

If a subclass (plug-in) itself does not implement a particular function, Wic locates and uses the default version in the superclass. It is for this reason that all source plug-ins are derived from the SourcePlugin class.

The SourcePlugin class defined in the pluginbase.py file defines a set of methods that source plug-ins can implement or override. Any plug-ins (subclass of SourcePlugin) that do not implement a particular method inherit the implementation of the method from the SourcePlugin class. For more information, see the SourcePlugin class in the pluginbase.py file for details:

The following list describes the methods implemented in the SourcePlugin class:

  • do_prepare_partition(): Called to populate a partition with actual content. In other words, the method prepares the final partition image that is incorporated into the disk image.

  • do_configure_partition(): Called before do_prepare_partition() to create custom configuration files for a partition (e.g. syslinux or grub configuration files).

  • do_install_disk(): Called after all partitions have been prepared and assembled into a disk image. This method provides a hook to allow finalization of a disk image (e.g. writing an MBR).

  • do_stage_partition(): Special content-staging hook called before do_prepare_partition(). This method is normally empty.

    Typically, a partition just uses the passed-in parameters (e.g. the unmodified value of bootimg_dir). However, in some cases, things might need to be more tailored. As an example, certain files might additionally need to be taken from bootimg_dir + /boot. This hook allows those files to be staged in a customized fashion.

    Note

    get_bitbake_var() allows you to access non-standard variables that you might want to use for this behavior.

You can extend the source plug-in mechanism. To add more hooks, create more source plug-in methods within SourcePlugin and the corresponding derived subclasses. The code that calls the plug-in methods uses the plugin.get_source_plugin_methods() function to find the method or methods needed by the call. Retrieval of those methods is accomplished by filling up a dict with keys that contain the method names of interest. On success, these will be filled in with the actual methods. See the Wic implementation for examples and details.

4.7. x32

x32 is a processor-specific Application Binary Interface (psABI) for x86_64. An ABI defines the calling conventions between functions in a processing environment. The interface determines what registers are used and what the sizes are for various C data types.

Some processing environments prefer using 32-bit applications even when running on Intel 64-bit platforms. Consider the i386 psABI, which is a very old 32-bit ABI for Intel 64-bit platforms. The i386 psABI does not provide efficient use and access of the Intel 64-bit processor resources, leaving the system underutilized. Now consider the x86_64 psABI. This ABI is newer and uses 64-bits for data sizes and program pointers. The extra bits increase the footprint size of the programs, libraries, and also increases the memory and file system size requirements. Executing under the x32 psABI enables user programs to utilize CPU and system resources more efficiently while keeping the memory footprint of the applications low. Extra bits are used for registers but not for addressing mechanisms.

4.7.1. Support

This Yocto Project release supports the final specifications of x32 psABI. Support for x32 psABI exists as follows:

  • You can create packages and images in x32 psABI format on x86_64 architecture targets.

  • You can successfully build many recipes with the x32 toolchain.

  • You can create and boot core-image-minimal and core-image-sato images.

4.7.2. Completing x32

Future Plans for the x32 psABI in the Yocto Project include the following:

  • Enhance and fix the few remaining recipes so they work with and support x32 toolchains.

  • Enhance RPM Package Manager (RPM) support for x32 binaries.

  • Support larger images.

4.7.3. Using x32 Right Now

Follow these steps to use the x32 spABI:

  • Enable the x32 psABI tuning file for x86_64 machines by editing the conf/local.conf like this:

          MACHINE = "qemux86-64"
          DEFAULTTUNE = "x86-64-x32"
          baselib = "${@d.getVar('BASE_LIB_tune-' + (d.getVar('DEFAULTTUNE', True) \
             or 'INVALID'), True) or 'lib'}"
          #MACHINE = "genericx86"
          #DEFAULTTUNE = "core2-64-x32"
                        
  • As usual, use BitBake to build an image that supports the x32 psABI. Here is an example:

         $ bitbake core-image-sato
                        
  • As usual, run your image using QEMU:

         $ runqemu qemux86-64 core-image-sato
                        

4.8. Wayland

Wayland is a computer display server protocol that provides a method for compositing window managers to communicate directly with applications and video hardware and expects them to communicate with input hardware using other libraries. Using Wayland with supporting targets can result in better control over graphics frame rendering than an application might otherwise achieve.

The Yocto Project provides the Wayland protocol libraries and the reference Weston compositor as part of its release. This section describes what you need to do to implement Wayland and use the compositor when building an image for a supporting target.

4.8.1. Support

The Wayland protocol libraries and the reference Weston compositor ship as integrated packages in the meta layer of the Source Directory. Specifically, you can find the recipes that build both Wayland and Weston at meta/recipes-graphics/wayland.

You can build both the Wayland and Weston packages for use only with targets that accept the Mesa 3D and Direct Rendering Infrastructure, which is also known as Mesa DRI. This implies that you cannot build and use the packages if your target uses, for example, the Intel® Embedded Media and Graphics Driver (Intel® EMGD) that overrides Mesa DRI.

Note

Due to lack of EGL support, Weston 1.0.3 will not run directly on the emulated QEMU hardware. However, this version of Weston will run under X emulation without issues.

4.8.2. Enabling Wayland in an Image

To enable Wayland, you need to enable it to be built and enable it to be included in the image.

4.8.2.1. Building

To cause Mesa to build the wayland-egl platform and Weston to build Wayland with Kernel Mode Setting (KMS) support, include the "wayland" flag in the DISTRO_FEATURES statement in your local.conf file:

     DISTRO_FEATURES_append = " wayland"
                

Note

If X11 has been enabled elsewhere, Weston will build Wayland with X11 support

4.8.2.2. Installing

To install the Wayland feature into an image, you must include the following CORE_IMAGE_EXTRA_INSTALL statement in your local.conf file:

     CORE_IMAGE_EXTRA_INSTALL += "wayland weston"
                

4.8.3. Running Weston

To run Weston inside X11, enabling it as described earlier and building a Sato image is sufficient. If you are running your image under Sato, a Weston Launcher appears in the "Utility" category.

Alternatively, you can run Weston through the command-line interpretor (CLI), which is better suited for development work. To run Weston under the CLI, you need to do the following after your image is built:

  1. Run these commands to export XDG_RUNTIME_DIR:

         mkdir -p /tmp/$USER-weston
         chmod 0700 /tmp/$USER-weston
         export XDG_RUNTIME_DIR=/tmp/$USER-weston
                        
  2. Launch Weston in the shell:

         weston
                        

4.9. Licenses

This section describes the mechanism by which the OpenEmbedded build system tracks changes to licensing text. The section also describes how to enable commercially licensed recipes, which by default are disabled.

For information that can help you maintain compliance with various open source licensing during the lifecycle of the product, see the "Maintaining Open Source License Compliance During Your Project's Lifecycle" section in the Yocto Project Development Tasks Manual.

4.9.1. Tracking License Changes

The license of an upstream project might change in the future. In order to prevent these changes going unnoticed, the LIC_FILES_CHKSUM variable tracks changes to the license text. The checksums are validated at the end of the configure step, and if the checksums do not match, the build will fail.

4.9.1.1. Specifying the LIC_FILES_CHKSUM Variable

The LIC_FILES_CHKSUM variable contains checksums of the license text in the source code for the recipe. Following is an example of how to specify LIC_FILES_CHKSUM:

     LIC_FILES_CHKSUM = "file://COPYING;md5=xxxx \
                         file://licfile1.txt;beginline=5;endline=29;md5=yyyy \
                         file://licfile2.txt;endline=50;md5=zzzz \
                         ..."
                

Notes

  • When using "beginline" and "endline", realize that line numbering begins with one and not zero. Also, the included lines are inclusive (i.e. lines five through and including 29 in the previous example for licfile1.txt).

  • When a license check fails, the selected license text is included as part of the QA message. Using this output, you can determine the exact start and finish for the needed license text.

The build system uses the S variable as the default directory when searching files listed in LIC_FILES_CHKSUM. The previous example employs the default directory.

Consider this next example:

     LIC_FILES_CHKSUM = "file://src/ls.c;beginline=5;endline=16;\
                                         md5=bb14ed3c4cda583abc85401304b5cd4e"
     LIC_FILES_CHKSUM = "file://${WORKDIR}/license.html;md5=5c94767cedb5d6987c902ac850ded2c6"
                

The first line locates a file in ${S}/src/ls.c and isolates lines five through 16 as license text. The second line refers to a file in WORKDIR.

Note that LIC_FILES_CHKSUM variable is mandatory for all recipes, unless the LICENSE variable is set to "CLOSED".

4.9.1.2. Explanation of Syntax

As mentioned in the previous section, the LIC_FILES_CHKSUM variable lists all the important files that contain the license text for the source code. It is possible to specify a checksum for an entire file, or a specific section of a file (specified by beginning and ending line numbers with the "beginline" and "endline" parameters, respectively). The latter is useful for source files with a license notice header, README documents, and so forth. If you do not use the "beginline" parameter, then it is assumed that the text begins on the first line of the file. Similarly, if you do not use the "endline" parameter, it is assumed that the license text ends with the last line of the file.

The "md5" parameter stores the md5 checksum of the license text. If the license text changes in any way as compared to this parameter then a mismatch occurs. This mismatch triggers a build failure and notifies the developer. Notification allows the developer to review and address the license text changes. Also note that if a mismatch occurs during the build, the correct md5 checksum is placed in the build log and can be easily copied to the recipe.

There is no limit to how many files you can specify using the LIC_FILES_CHKSUM variable. Generally, however, every project requires a few specifications for license tracking. Many projects have a "COPYING" file that stores the license information for all the source code files. This practice allows you to just track the "COPYING" file as long as it is kept up to date.

Tip

If you specify an empty or invalid "md5" parameter, BitBake returns an md5 mis-match error and displays the correct "md5" parameter value during the build. The correct parameter is also captured in the build log.

Tip

If the whole file contains only license text, you do not need to use the "beginline" and "endline" parameters.

4.9.2. Enabling Commercially Licensed Recipes

By default, the OpenEmbedded build system disables components that have commercial or other special licensing requirements. Such requirements are defined on a recipe-by-recipe basis through the LICENSE_FLAGS variable definition in the affected recipe. For instance, the poky/meta/recipes-multimedia/gstreamer/gst-plugins-ugly recipe contains the following statement:

     LICENSE_FLAGS = "commercial"
            

Here is a slightly more complicated example that contains both an explicit recipe name and version (after variable expansion):

     LICENSE_FLAGS = "license_${PN}_${PV}"
            

In order for a component restricted by a LICENSE_FLAGS definition to be enabled and included in an image, it needs to have a matching entry in the global LICENSE_FLAGS_WHITELIST variable, which is a variable typically defined in your local.conf file. For example, to enable the poky/meta/recipes-multimedia/gstreamer/gst-plugins-ugly package, you could add either the string "commercial_gst-plugins-ugly" or the more general string "commercial" to LICENSE_FLAGS_WHITELIST. See the "License Flag Matching" section for a full explanation of how LICENSE_FLAGS matching works. Here is the example:

     LICENSE_FLAGS_WHITELIST = "commercial_gst-plugins-ugly"
            

Likewise, to additionally enable the package built from the recipe containing LICENSE_FLAGS = "license_${PN}_${PV}", and assuming that the actual recipe name was emgd_1.10.bb, the following string would enable that package as well as the original gst-plugins-ugly package:

     LICENSE_FLAGS_WHITELIST = "commercial_gst-plugins-ugly license_emgd_1.10"
            

As a convenience, you do not need to specify the complete license string in the whitelist for every package. You can use an abbreviated form, which consists of just the first portion or portions of the license string before the initial underscore character or characters. A partial string will match any license that contains the given string as the first portion of its license. For example, the following whitelist string will also match both of the packages previously mentioned as well as any other packages that have licenses starting with "commercial" or "license".

     LICENSE_FLAGS_WHITELIST = "commercial license"
            

4.9.2.1. License Flag Matching

License flag matching allows you to control what recipes the OpenEmbedded build system includes in the build. Fundamentally, the build system attempts to match LICENSE_FLAGS strings found in recipes against LICENSE_FLAGS_WHITELIST strings found in the whitelist. A match causes the build system to include a recipe in the build, while failure to find a match causes the build system to exclude a recipe.

In general, license flag matching is simple. However, understanding some concepts will help you correctly and effectively use matching.

Before a flag defined by a particular recipe is tested against the contents of the whitelist, the expanded string _${PN} is appended to the flag. This expansion makes each LICENSE_FLAGS value recipe-specific. After expansion, the string is then matched against the whitelist. Thus, specifying LICENSE_FLAGS = "commercial" in recipe "foo", for example, results in the string "commercial_foo". And, to create a match, that string must appear in the whitelist.

Judicious use of the LICENSE_FLAGS strings and the contents of the LICENSE_FLAGS_WHITELIST variable allows you a lot of flexibility for including or excluding recipes based on licensing. For example, you can broaden the matching capabilities by using license flags string subsets in the whitelist.

Note

When using a string subset, be sure to use the part of the expanded string that precedes the appended underscore character (e.g. usethispart_1.3, usethispart_1.4, and so forth).

For example, simply specifying the string "commercial" in the whitelist matches any expanded LICENSE_FLAGS definition that starts with the string "commercial" such as "commercial_foo" and "commercial_bar", which are the strings the build system automatically generates for hypothetical recipes named "foo" and "bar" assuming those recipes simply specify the following:

     LICENSE_FLAGS = "commercial"
                

Thus, you can choose to exhaustively enumerate each license flag in the whitelist and allow only specific recipes into the image, or you can use a string subset that causes a broader range of matches to allow a range of recipes into the image.

This scheme works even if the LICENSE_FLAGS string already has _${PN} appended. For example, the build system turns the license flag "commercial_1.2_foo" into "commercial_1.2_foo_foo" and would match both the general "commercial" and the specific "commercial_1.2_foo" strings found in the whitelist, as expected.

Here are some other scenarios:

  • You can specify a versioned string in the recipe such as "commercial_foo_1.2" in a "foo" recipe. The build system expands this string to "commercial_foo_1.2_foo". Combine this license flag with a whitelist that has the string "commercial" and you match the flag along with any other flag that starts with the string "commercial".

  • Under the same circumstances, you can use "commercial_foo" in the whitelist and the build system not only matches "commercial_foo_1.2" but also matches any license flag with the string "commercial_foo", regardless of the version.

  • You can be very specific and use both the package and version parts in the whitelist (e.g. "commercial_foo_1.2") to specifically match a versioned recipe.

Other helpful variables related to commercial license handling exist and are defined in the poky/meta/conf/distro/include/default-distrovars.inc file:

     COMMERCIAL_AUDIO_PLUGINS ?= ""
     COMMERCIAL_VIDEO_PLUGINS ?= ""
                

If you want to enable these components, you can do so by making sure you have statements similar to the following in your local.conf configuration file:

     COMMERCIAL_AUDIO_PLUGINS = "gst-plugins-ugly-mad \
        gst-plugins-ugly-mpegaudioparse"
     COMMERCIAL_VIDEO_PLUGINS = "gst-plugins-ugly-mpeg2dec \
        gst-plugins-ugly-mpegstream gst-plugins-bad-mpegvideoparse"
     LICENSE_FLAGS_WHITELIST = "commercial_gst-plugins-ugly commercial_gst-plugins-bad commercial_qmmp"
                

Of course, you could also create a matching whitelist for those components using the more general "commercial" in the whitelist, but that would also enable all the other packages with LICENSE_FLAGS containing "commercial", which you may or may not want:

     LICENSE_FLAGS_WHITELIST = "commercial"
                

Specifying audio and video plug-ins as part of the COMMERCIAL_AUDIO_PLUGINS and COMMERCIAL_VIDEO_PLUGINS statements (along with the enabling LICENSE_FLAGS_WHITELIST) includes the plug-ins or components into built images, thus adding support for media formats or components.

Chapter 5. Yocto Project Releases and the Stable Release Process

The Yocto Project release process is predictable and consists of both major and minor (point) releases. This brief chapter provides information on how releases are named, their life cycle, and their stability.

5.1. Major and Minor Release Cadence

The Yocto Project delivers major releases (e.g. 2.4) using a six month cadence roughly timed each April and October of the year. Following are examples of some major YP releases with their codenames also shown. See the "Major Release Codenames" section for information on codenames used with major releases.

    2.2 (Morty)
    2.1 (Krogoth)
    2.0 (Jethro)
        

While the cadence is never perfect, this timescale facilitates regular releases that have strong QA cycles while not overwhelming users with too many new releases. The cadence is predictable and avoids many major holidays in various geographies.

The Yocto project delivers minor (point) releases on an unscheduled basis and are usually driven by the accumulation of enough significant fixes or enhancements to the associated major release. Following are some example past point releases:

    2.1.1
    2.1.2
    2.2.1
        

The point release indicates a point in the major release branch where a full QA cycle and release process validates the content of the new branch.

Note

Realize that there can be patches merged onto the stable release branches as and when they become available.

5.2. Major Release Codenames

Each major release receives a codename that identifies the release in the Yocto Project Source Repositories. The concept is that branches of Metadata with the same codename are likely to be compatible and thus work together.

Note

Codenames are associated with major releases because a Yocto Project release number (e.g. 2.4) could conflict with a given layer or company versioning scheme. Codenames are unique, interesting, and easily identifiable.

Releases are given a nominal release version as well but the codename is used in repositories for this reason. You can find information on Yocto Project releases and codenames at https://wiki.yoctoproject.org/wiki/Releases.

5.3. Stable Release Process

Once released, the release enters the stable release process at which time a person is assigned as the maintainer for that stable release. This maintainer monitors activity for the release by investigating and handling nominated patches and backport activity. Only fixes and enhancements that have first been applied on the "master" branch (i.e. the current, in-development branch) are considered for backporting to a stable release.

Note

The current Yocto Project policy regarding backporting is to consider bug fixes and security fixes only. Policy dictates that features are not backported to a stable release. This policy means generic recipe version upgrades are unlikely to be accepted for backporting. The exception to this policy occurs when a strong reason exists such as the fix happens to also be the preferred upstream approach.

Stable release branches have strong maintenance for about a year after their initial release. Should significant issues be found for any release regardless of its age, fixes could be backported to older releases. For issues that are not backported given an older release, Community LTS trees and branches exist where community members share patches for older releases. However, these types of patches do not go through the same release process as do point releases. You can find more information about stable branch maintenance at https://wiki.yoctoproject.org/wiki/Stable_branch_maintenance.

5.4. Testing and Quality Assurance

Part of the Yocto Project development and release process is quality assurance through the execution of test strategies. Test strategies provide the Yocto Project team a way to ensure a release is validated. Additionally, because the test strategies are visible to you as a developer, you can validate your projects. This section overviews the available test infrastructure used in the Yocto Project. For information on how to run available tests on your projects, see the "Performing Automated Runtime Testing" section in the Yocto Project Development Tasks Manual.

The QA/testing infrastructure is woven into the project to the point where core developers take some of it for granted. The infrastructure consists of the following pieces:

  • bitbake-selftest: A standalone command that runs unit tests on key pieces of BitBake and its fetchers.

  • sanity.bbclass: This automatically included class checks the build environment for missing tools (e.g. gcc) or common misconfigurations such as MACHINE set incorrectly.

  • insane.bbclass: This class checks the generated output from builds for sanity. For example, if building for an ARM target, did the build produce ARM binaries. If, for example, the build produced PPC binaries then there is a problem.

  • testimage.bbclass: This class performs runtime testing of images after they are built. The tests are usually used with QEMU to boot the images and check the combined runtime result boot operation and functions. However, the test can also use the IP address of a machine to test.

  • ptest: Runs tests against packages produced during the build for a given piece of software. The test allows the packages to be be run within a target image.

  • oe-selftest: Tests combination BitBake invocations. These tests operate outside the OpenEmbedded build system itself. The oe-selftest can run all tests by default or can run selected tests or test suites.

    Note

    Running oe-selftest requires host packages beyond the "Essential" grouping. See the "Required Packages for the Host Development System" section for more information.

Originally, much of this testing was done manually. However, significant effort has been made to automate the tests so that more people can use them and the Yocto Project development team can run them faster and more efficiently.

The Yocto Project's main Autobuilder (autobuilder.yoctoproject.org) publicly tests each Yocto Project release's code in the OE-Core, Poky, and BitBake repositories. The testing occurs for both the current state of the "master" branch and also for submitted patches. Testing for submitted patches usually occurs in the "ross/mut" branch in the poky-contrib repository (i.e. the master-under-test branch) or in the "master-next" branch in the poky repository.

Note

You can find all these branches in the Yocto Project Source Repositories.

Testing within these public branches ensures in a publicly visible way that all of the main supposed architectures and recipes in OE-Core successfully build and behave properly.

Various features such as multilib, sub architectures (e.g. x32, poky-tiny, musl, no-x11 and and so forth), bitbake-selftest, and oe-selftest are tested as part of the QA process of a release. Complete testing and validation for a release takes the Autobuilder workers several hours.

Note

The Autobuilder workers are non-homogeneous, which means regular testing across a variety of Linux distributions occurs. The Autobuilder is limited to only testing QEMU-based setups and not real hardware.

Finally, in addition to the Autobuilder's tests, the Yocto Project QA team also performs testing on a variety of platforms, which includes actual hardware, to ensure expected results.

Chapter 6. Migrating to a Newer Yocto Project Release

Table of Contents

6.1. General Migration Considerations
6.2. Moving to the Yocto Project 1.3 Release
6.2.1. Local Configuration
6.2.2. Recipes
6.2.3. Linux Kernel Naming
6.3. Moving to the Yocto Project 1.4 Release
6.3.1. BitBake
6.3.2. Build Behavior
6.3.3. Proxies and Fetching Source
6.3.4. Custom Interfaces File (netbase change)
6.3.5. Remote Debugging
6.3.6. Variables
6.3.7. Target Package Management with RPM
6.3.8. Recipes Moved
6.3.9. Removals and Renames
6.4. Moving to the Yocto Project 1.5 Release
6.4.1. Host Dependency Changes
6.4.2. atom-pc Board Support Package (BSP)
6.4.3. BitBake
6.4.4. QA Warnings
6.4.5. Directory Layout Changes
6.4.6. Shortened Git SRCREV Values
6.4.7. IMAGE_FEATURES
6.4.8. /run
6.4.9. Removal of Package Manager Database Within Image Recipes
6.4.10. Images Now Rebuild Only on Changes Instead of Every Time
6.4.11. Task Recipes
6.4.12. BusyBox
6.4.13. Automated Image Testing
6.4.14. Build History
6.4.15. udev
6.4.16. Removed and Renamed Recipes
6.4.17. Other Changes
6.5. Moving to the Yocto Project 1.6 Release
6.5.1. archiver Class
6.5.2. Packaging Changes
6.5.3. BitBake
6.5.4. Changes to Variables
6.5.5. Package Test (ptest)
6.5.6. Build Changes
6.5.7. qemu-native
6.5.8. core-image-basic
6.5.9. Licensing
6.5.10. CFLAGS Options
6.5.11. Custom Image Output Types
6.5.12. Tasks
6.5.13. update-alternative Provider
6.5.14. virtclass Overrides
6.5.15. Removed and Renamed Recipes
6.5.16. Removed Classes
6.5.17. Reference Board Support Packages (BSPs)
6.6. Moving to the Yocto Project 1.7 Release
6.6.1. Changes to Setting QEMU PACKAGECONFIG Options in local.conf
6.6.2. Minimum Git version
6.6.3. Autotools Class Changes
6.6.4. Binary Configuration Scripts Disabled
6.6.5. eglibc 2.19 Replaced with glibc 2.20
6.6.6. Kernel Module Autoloading
6.6.7. QA Check Changes
6.6.8. Removed Recipes
6.6.9. Miscellaneous Changes
6.7. Moving to the Yocto Project 1.8 Release
6.7.1. Removed Recipes
6.7.2. BlueZ 4.x / 5.x Selection
6.7.3. Kernel Build Changes
6.7.4. SSL 3.0 is Now Disabled in OpenSSL
6.7.5. Default Sysroot Poisoning
6.7.6. Rebuild Improvements
6.7.7. QA Check and Validation Changes
6.7.8. Miscellaneous Changes
6.8. Moving to the Yocto Project 2.0 Release
6.8.1. GCC 5
6.8.2. Gstreamer 0.10 Removed
6.8.3. Removed Recipes
6.8.4. BitBake datastore improvements
6.8.5. Shell Message Function Changes
6.8.6. Extra Development/Debug Package Cleanup
6.8.7. Recipe Maintenance Tracking Data Moved to OE-Core
6.8.8. Automatic Stale Sysroot File Cleanup
6.8.9. linux-yocto Kernel Metadata Repository Now Split from Source
6.8.10. Additional QA checks
6.8.11. Miscellaneous Changes
6.9. Moving to the Yocto Project 2.1 Release
6.9.1. Variable Expansion in Python Functions
6.9.2. Overrides Must Now be Lower-Case
6.9.3. Expand Parameter to getVar() and getVarFlag() is Now Mandatory
6.9.4. Makefile Environment Changes
6.9.5. libexecdir Reverted to ${prefix}/libexec
6.9.6. ac_cv_sizeof_off_t is No Longer Cached in Site Files
6.9.7. Image Generation is Now Split Out from Filesystem Generation
6.9.8. Removed Recipes
6.9.9. Class Changes
6.9.10. Build System User Interface Changes
6.9.11. ADT Removed
6.9.12. Poky Reference Distribution Changes
6.9.13. Packaging Changes
6.9.14. Tuning File Changes
6.9.15. Supporting GObject Introspection
6.9.16. Miscellaneous Changes
6.10. Moving to the Yocto Project 2.2 Release
6.10.1. Minimum Kernel Version
6.10.2. Staging Directories in Sysroot Has Been Simplified
6.10.3. Removal of Old Images and Other Files in tmp/deploy Now Enabled
6.10.4. Python Changes
6.10.5. uClibc Replaced by musl
6.10.6. ${B} No Longer Default Working Directory for Tasks
6.10.7. runqemu Ported to Python
6.10.8. Default Linker Hash Style Changed
6.10.9. KERNEL_IMAGE_BASE_NAME no Longer Uses KERNEL_IMAGETYPE
6.10.10. BitBake Changes
6.10.11. Swabber has Been Removed
6.10.12. Removed Recipes
6.10.13. Removed Classes
6.10.14. Minor Packaging Changes
6.10.15. Miscellaneous Changes
6.11. Moving to the Yocto Project 2.3 Release
6.11.1. Recipe-specific Sysroots
6.11.2. PATH Variable
6.11.3. Changes to Scripts
6.11.4. Changes to Functions
6.11.5. BitBake Changes
6.11.6. Absolute Symbolic Links
6.11.7. GPLv2 Versions of GPLv3 Recipes Moved
6.11.8. Package Management Changes
6.11.9. Removed Recipes
6.11.10. Wic Changes
6.11.11. QA Changes
6.11.12. Miscellaneous Changes
6.12. Moving to the Yocto Project 2.4 Release
6.12.1. Memory Resident Mode
6.12.2. Packaging Changes
6.12.3. Removed Recipes
6.12.4. Kernel Device Tree Move
6.12.5. Package QA Changes
6.12.6. README File Changes
6.12.7. Miscellaneous Changes

This chapter provides information you can use to migrate work to a newer Yocto Project release. You can find the same information in the release notes for a given release.

6.1. General Migration Considerations

Some considerations are not tied to a specific Yocto Project release. This section presents information you should consider when migrating to any new Yocto Project release.

  • Dealing with Customized Recipes: Issues could arise if you take older recipes that contain customizations and simply copy them forward expecting them to work after you migrate to new Yocto Project metadata. For example, suppose you have a recipe in your layer that is a customized version of a core recipe copied from the earlier release, rather than through the use of an append file. When you migrate to a newer version of Yocto Project, the metadata (e.g. perhaps an include file used by the recipe) could have changed in a way that would break the build. Say, for example, a function is removed from an include file and the customized recipe tries to call that function.

    You could "forward-port" all your customizations in your recipe so that everything works for the new release. However, this is not the optimal solution as you would have to repeat this process with each new release if changes occur that give rise to problems.

    The better solution (where practical) is to use append files (*.bbappend) to capture any customizations you want to make to a recipe. Doing so, isolates your changes from the main recipe making them much more manageable. However, sometimes it is not practical to use an append file. A good example of this is when introducing a newer or older version of a recipe in another layer.

  • Updating Append Files: Since append files generally only contain your customizations, they often do not need to be adjusted for new releases. However, if the .bbappend file is specific to a particular version of the recipe (i.e. its name does not use the % wildcard) and the version of the recipe to which it is appending has changed, then you will at a minimum need to rename the append file to match the name of the recipe file. A mismatch between an append file and its corresponding recipe file (.bb) will trigger an error during parsing.

    Depending on the type of customization the append file applies, other incompatibilities might occur when you upgrade. For example, if your append file applies a patch and the recipe to which it is appending is updated to a newer version, the patch might no longer apply. If this is the case and assuming the patch is still needed, you must modify the patch file so that it does apply.

6.2. Moving to the Yocto Project 1.3 Release

This section provides migration information for moving to the Yocto Project 1.3 Release from the prior release.

6.2.1. Local Configuration

Differences include changes for SSTATE_MIRRORS and bblayers.conf.

6.2.1.1. SSTATE_MIRRORS

The shared state cache (sstate-cache), as pointed to by SSTATE_DIR, by default now has two-character subdirectories to prevent issues arising from too many files in the same directory. Also, native sstate-cache packages, which are built to run on the host system, will go into a subdirectory named using the distro ID string. If you copy the newly structured sstate-cache to a mirror location (either local or remote) and then point to it in SSTATE_MIRRORS, you need to append "PATH" to the end of the mirror URL so that the path used by BitBake before the mirror substitution is appended to the path used to access the mirror. Here is an example:

     SSTATE_MIRRORS = "file://.* http://someserver.tld/share/sstate/PATH"
                

6.2.1.2. bblayers.conf

The meta-yocto layer consists of two parts that correspond to the Poky reference distribution and the reference hardware Board Support Packages (BSPs), respectively: meta-yocto and meta-yocto-bsp. When running BitBake for the first time after upgrading, your conf/bblayers.conf file will be updated to handle this change and you will be asked to re-run or restart for the changes to take effect.

6.2.2. Recipes

Differences include changes for the following:

  • Python function whitespace

  • proto= in SRC_URI

  • nativesdk

  • Task recipes

  • IMAGE_FEATURES

  • Removed recipes

6.2.2.1. Python Function Whitespace

All Python functions must now use four spaces for indentation. Previously, an inconsistent mix of spaces and tabs existed, which made extending these functions using _append or _prepend complicated given that Python treats whitespace as syntactically significant. If you are defining or extending any Python functions (e.g. populate_packages, do_unpack, do_patch and so forth) in custom recipes or classes, you need to ensure you are using consistent four-space indentation.

6.2.2.2. proto= in SRC_URI

Any use of proto= in SRC_URI needs to be changed to protocol=. In particular, this applies to the following URIs:

  • svn://

  • bzr://

  • hg://

  • osc://

Other URIs were already using protocol=. This change improves consistency.

6.2.2.3. nativesdk

The suffix nativesdk is now implemented as a prefix, which simplifies a lot of the packaging code for nativesdk recipes. All custom nativesdk recipes, which are relocatable packages that are native to SDK_ARCH, and any references need to be updated to use nativesdk-* instead of *-nativesdk.

6.2.2.4. Task Recipes

"Task" recipes are now known as "Package groups" and have been renamed from task-*.bb to packagegroup-*.bb. Existing references to the previous task-* names should work in most cases as there is an automatic upgrade path for most packages. However, you should update references in your own recipes and configurations as they could be removed in future releases. You should also rename any custom task-* recipes to packagegroup-*, and change them to inherit packagegroup instead of task, as well as taking the opportunity to remove anything now handled by packagegroup.bbclass, such as providing -dev and -dbg packages, setting LIC_FILES_CHKSUM, and so forth. See the "packagegroup.bbclass" section for further details.

6.2.2.5. IMAGE_FEATURES

Image recipes that previously included "apps-console-core" in IMAGE_FEATURES should now include "splash" instead to enable the boot-up splash screen. Retaining "apps-console-core" will still include the splash screen but generates a warning. The "apps-x11-core" and "apps-x11-games" IMAGE_FEATURES features have been removed.

6.2.2.6. Removed Recipes

The following recipes have been removed. For most of them, it is unlikely that you would have any references to them in your own Metadata. However, you should check your metadata against this list to be sure:

  • libx11-trim: Replaced by libx11, which has a negligible size difference with modern Xorg.

  • xserver-xorg-lite: Use xserver-xorg, which has a negligible size difference when DRI and GLX modules are not installed.

  • xserver-kdrive: Effectively unmaintained for many years.

  • mesa-xlib: No longer serves any purpose.

  • galago: Replaced by telepathy.

  • gail: Functionality was integrated into GTK+ 2.13.

  • eggdbus: No longer needed.

  • gcc-*-intermediate: The build has been restructured to avoid the need for this step.

  • libgsmd: Unmaintained for many years. Functionality now provided by ofono instead.

  • contacts, dates, tasks, eds-tools: Largely unmaintained PIM application suite. It has been moved to meta-gnome in meta-openembedded.

In addition to the previously listed changes, the meta-demoapps directory has also been removed because the recipes in it were not being maintained and many had become obsolete or broken. Additionally, these recipes were not parsed in the default configuration. Many of these recipes are already provided in an updated and maintained form within the OpenEmbedded community layers such as meta-oe and meta-gnome. For the remainder, you can now find them in the meta-extras repository, which is in the Yocto Project Source Repositories.

6.2.3. Linux Kernel Naming

The naming scheme for kernel output binaries has been changed to now include PE as part of the filename:

     KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PE}-${PV}-${PR}-${MACHINE}-${DATETIME}"
            

Because the PE variable is not set by default, these binary files could result with names that include two dash characters. Here is an example:

     bzImage--3.10.9+git0+cd502a8814_7144bcc4b8-r0-qemux86-64-20130830085431.bin
            

6.3. Moving to the Yocto Project 1.4 Release

This section provides migration information for moving to the Yocto Project 1.4 Release from the prior release.

6.3.1. BitBake

Differences include the following:

  • Comment Continuation: If a comment ends with a line continuation (\) character, then the next line must also be a comment. Any instance where this is not the case, now triggers a warning. You must either remove the continuation character, or be sure the next line is a comment.

  • Package Name Overrides: The runtime package specific variables RDEPENDS, RRECOMMENDS, RSUGGESTS, RPROVIDES, RCONFLICTS, RREPLACES, FILES, ALLOW_EMPTY, and the pre, post, install, and uninstall script functions pkg_preinst, pkg_postinst, pkg_prerm, and pkg_postrm should always have a package name override. For example, use RDEPENDS_${PN} for the main package instead of RDEPENDS. BitBake uses more strict checks when it parses recipes.

6.3.2. Build Behavior

Differences include the following:

  • Shared State Code: The shared state code has been optimized to avoid running unnecessary tasks. For example, the following no longer populates the target sysroot since that is not necessary:

         $ bitbake -c rootfs some-image
                        

    Instead, the system just needs to extract the output package contents, re-create the packages, and construct the root filesystem. This change is unlikely to cause any problems unless you have missing declared dependencies.

  • Scanning Directory Names: When scanning for files in SRC_URI, the build system now uses FILESOVERRIDES instead of OVERRIDES for the directory names. In general, the values previously in OVERRIDES are now in FILESOVERRIDES as well. However, if you relied upon an additional value you previously added to OVERRIDES, you might now need to add it to FILESOVERRIDES unless you are already adding it through the MACHINEOVERRIDES or DISTROOVERRIDES variables, as appropriate. For more related changes, see the "Variables" section.

6.3.3. Proxies and Fetching Source

A new oe-git-proxy script has been added to replace previous methods of handling proxies and fetching source from Git. See the meta-yocto/conf/site.conf.sample file for information on how to use this script.

6.3.4. Custom Interfaces File (netbase change)

If you have created your own custom etc/network/interfaces file by creating an append file for the netbase recipe, you now need to create an append file for the init-ifupdown recipe instead, which you can find in the Source Directory at meta/recipes-core/init-ifupdown. For information on how to use append files, see the "Using .bbappend Files" in the Yocto Project Development Tasks Manual.

6.3.5. Remote Debugging

Support for remote debugging with the Eclipse IDE is now separated into an image feature (eclipse-debug) that corresponds to the packagegroup-core-eclipse-debug package group. Previously, the debugging feature was included through the tools-debug image feature, which corresponds to the packagegroup-core-tools-debug package group.

6.3.6. Variables

The following variables have changed:

  • SANITY_TESTED_DISTROS: This variable now uses a distribution ID, which is composed of the host distributor ID followed by the release. Previously, SANITY_TESTED_DISTROS was composed of the description field. For example, "Ubuntu 12.10" becomes "Ubuntu-12.10". You do not need to worry about this change if you are not specifically setting this variable, or if you are specifically setting it to "".

  • SRC_URI: The ${PN}, ${PF}, ${P}, and FILE_DIRNAME directories have been dropped from the default value of the FILESPATH variable, which is used as the search path for finding files referred to in SRC_URI. If you have a recipe that relied upon these directories, which would be unusual, then you will need to add the appropriate paths within the recipe or, alternatively, rearrange the files. The most common locations are still covered by ${BP}, ${BPN}, and "files", which all remain in the default value of FILESPATH.

6.3.7. Target Package Management with RPM

If runtime package management is enabled and the RPM backend is selected, Smart is now installed for package download, dependency resolution, and upgrades instead of Zypper. For more information on how to use Smart, run the following command on the target:

     smart --help
            

6.3.8. Recipes Moved

The following recipes were moved from their previous locations because they are no longer used by anything in the OpenEmbedded-Core:

  • clutter-box2d: Now resides in the meta-oe layer.

  • evolution-data-server: Now resides in the meta-gnome layer.

  • gthumb: Now resides in the meta-gnome layer.

  • gtkhtml2: Now resides in the meta-oe layer.

  • gupnp: Now resides in the meta-multimedia layer.

  • gypsy: Now resides in the meta-oe layer.

  • libcanberra: Now resides in the meta-gnome layer.

  • libgdata: Now resides in the meta-gnome layer.

  • libmusicbrainz: Now resides in the meta-multimedia layer.

  • metacity: Now resides in the meta-gnome layer.

  • polkit: Now resides in the meta-oe layer.

  • zeroconf: Now resides in the meta-networking layer.

6.3.9. Removals and Renames

The following list shows what has been removed or renamed:

  • evieext: Removed because it has been removed from xserver since 2008.

  • Gtk+ DirectFB: Removed support because upstream Gtk+ no longer supports it as of version 2.18.

  • libxfontcache / xfontcacheproto: Removed because they were removed from the Xorg server in 2008.

  • libxp / libxprintapputil / libxprintutil / printproto: Removed because the XPrint server was removed from Xorg in 2008.

  • libxtrap / xtrapproto: Removed because their functionality was broken upstream.

  • linux-yocto 3.0 kernel: Removed with linux-yocto 3.8 kernel being added. The linux-yocto 3.2 and linux-yocto 3.4 kernels remain as part of the release.

  • lsbsetup: Removed with functionality now provided by lsbtest.

  • matchbox-stroke: Removed because it was never more than a proof-of-concept.

  • matchbox-wm-2 / matchbox-theme-sato-2: Removed because they are not maintained. However, matchbox-wm and matchbox-theme-sato are still provided.

  • mesa-dri: Renamed to mesa.

  • mesa-xlib: Removed because it was no longer useful.

  • mutter: Removed because nothing ever uses it and the recipe is very old.

  • orinoco-conf: Removed because it has become obsolete.

  • update-modules: Removed because it is no longer used. The kernel module postinstall and postrm scripts can now do the same task without the use of this script.

  • web: Removed because it is not maintained. Superseded by web-webkit.

  • xf86bigfontproto: Removed because upstream it has been disabled by default since 2007. Nothing uses xf86bigfontproto.

  • xf86rushproto: Removed because its dependency in xserver was spurious and it was removed in 2005.

  • zypper / libzypp / sat-solver: Removed and been functionally replaced with Smart (python-smartpm) when RPM packaging is used and package management is enabled on the target.

6.4. Moving to the Yocto Project 1.5 Release

This section provides migration information for moving to the Yocto Project 1.5 Release from the prior release.

6.4.1. Host Dependency Changes

The OpenEmbedded build system now has some additional requirements on the host system:

  • Python 2.7.3+

  • Tar 1.24+

  • Git 1.7.8+

  • Patched version of Make if you are using 3.82. Most distributions that provide Make 3.82 use the patched version.

If the Linux distribution you are using on your build host does not provide packages for these, you can install and use the Buildtools tarball, which provides an SDK-like environment containing them.

For more information on this requirement, see the "Required Git, tar, and Python Versions" section.

6.4.2. atom-pc Board Support Package (BSP)

The atom-pc hardware reference BSP has been replaced by a genericx86 BSP. This BSP is not necessarily guaranteed to work on all x86 hardware, but it will run on a wider range of systems than the atom-pc did.

Note

Additionally, a genericx86-64 BSP has been added for 64-bit Atom systems.

6.4.3. BitBake

The following changes have been made that relate to BitBake:

  • BitBake now supports a _remove operator. The addition of this operator means you will have to rename any items in recipe space (functions, variables) whose names currently contain _remove_ or end with _remove to avoid unexpected behavior.

  • BitBake's global method pool has been removed. This method is not particularly useful and led to clashes between recipes containing functions that had the same name.

  • The "none" server backend has been removed. The "process" server backend has been serving well as the default for a long time now.

  • The bitbake-runtask script has been removed.

  • ${P} and ${PF} are no longer added to PROVIDES by default in bitbake.conf. These version-specific PROVIDES items were seldom used. Attempting to use them could result in two versions being built simultaneously rather than just one version due to the way BitBake resolves dependencies.

6.4.4. QA Warnings

The following changes have been made to the package QA checks:

  • If you have customized ERROR_QA or WARN_QA values in your configuration, check that they contain all of the issues that you wish to be reported. Previous Yocto Project versions contained a bug that meant that any item not mentioned in ERROR_QA or WARN_QA would be treated as a warning. Consequently, several important items were not already in the default value of WARN_QA. All of the possible QA checks are now documented in the "insane.bbclass" section.

  • An additional QA check has been added to check if /usr/share/info/dir is being installed. Your recipe should delete this file within do_install if "make install" is installing it.

  • If you are using the buildhistory class, the check for the package version going backwards is now controlled using a standard QA check. Thus, if you have customized your ERROR_QA or WARN_QA values and still wish to have this check performed, you should add "version-going-backwards" to your value for one or the other variables depending on how you wish it to be handled. See the documented QA checks in the "insane.bbclass" section.

6.4.5. Directory Layout Changes

The following directory changes exist:

  • Output SDK installer files are now named to include the image name and tuning architecture through the SDK_NAME variable.

  • Images and related files are now installed into a directory that is specific to the machine, instead of a parent directory containing output files for multiple machines. The DEPLOY_DIR_IMAGE variable continues to point to the directory containing images for the current MACHINE and should be used anywhere there is a need to refer to this directory. The runqemu script now uses this variable to find images and kernel binaries and will use BitBake to determine the directory. Alternatively, you can set the DEPLOY_DIR_IMAGE variable in the external environment.

  • When buildhistory is enabled, its output is now written under the Build Directory rather than TMPDIR. Doing so makes it easier to delete TMPDIR and preserve the build history. Additionally, data for produced SDKs is now split by IMAGE_NAME.

  • The pkgdata directory produced as part of the packaging process has been collapsed into a single machine-specific directory. This directory is located under sysroots and uses a machine-specific name (i.e. tmp/sysroots/machine/pkgdata).

6.4.6. Shortened Git SRCREV Values

BitBake will now shorten revisions from Git repositories from the normal 40 characters down to 10 characters within SRCPV for improved usability in path and file names. This change should be safe within contexts where these revisions are used because the chances of spatially close collisions is very low. Distant collisions are not a major issue in the way the values are used.

6.4.7. IMAGE_FEATURES

The following changes have been made that relate to IMAGE_FEATURES:

  • The value of IMAGE_FEATURES is now validated to ensure invalid feature items are not added. Some users mistakenly add package names to this variable instead of using IMAGE_INSTALL in order to have the package added to the image, which does not work. This change is intended to catch those kinds of situations. Valid IMAGE_FEATURES are drawn from PACKAGE_GROUP definitions, COMPLEMENTARY_GLOB and a new "validitems" varflag on IMAGE_FEATURES. The "validitems" varflag change allows additional features to be added if they are not provided using the previous two mechanisms.

  • The previously deprecated "apps-console-core" IMAGE_FEATURES item is no longer supported. Add "splash" to IMAGE_FEATURES if you wish to have the splash screen enabled, since this is all that apps-console-core was doing.

6.4.8. /run

The /run directory from the Filesystem Hierarchy Standard 3.0 has been introduced. You can find some of the implications for this change here. The change also means that recipes that install files to /var/run must be changed. You can find a guide on how to make these changes here.

6.4.9. Removal of Package Manager Database Within Image Recipes

The image core-image-minimal no longer adds remove_packaging_data_files to ROOTFS_POSTPROCESS_COMMAND. This addition is now handled automatically when "package-management" is not in IMAGE_FEATURES. If you have custom image recipes that make this addition, you should remove the lines, as they are not needed and might interfere with correct operation of postinstall scripts.

6.4.10. Images Now Rebuild Only on Changes Instead of Every Time

The do_rootfs and other related image construction tasks are no longer marked as "nostamp". Consequently, they will only be re-executed when their inputs have changed. Previous versions of the OpenEmbedded build system always rebuilt the image when requested rather when necessary.

6.4.11. Task Recipes

The previously deprecated task.bbclass has now been dropped. For recipes that previously inherited from this class, you should rename them from task-* to packagegroup-* and inherit packagegroup instead.

For more information, see the "packagegroup.bbclass" section.

6.4.12. BusyBox

By default, we now split BusyBox into two binaries: one that is suid root for those components that need it, and another for the rest of the components. Splitting BusyBox allows for optimization that eliminates the tinylogin recipe as recommended by upstream. You can disable this split by setting BUSYBOX_SPLIT_SUID to "0".

6.4.13. Automated Image Testing

A new automated image testing framework has been added through the testimage.bbclass class. This framework replaces the older imagetest-qemu framework.

You can learn more about performing automated image tests in the "Performing Automated Runtime Testing" section in the Yocto Project Development Tasks Manual.

6.4.14. Build History

Following are changes to Build History:

  • Installed package sizes: installed-package-sizes.txt for an image now records the size of the files installed by each package instead of the size of each compressed package archive file.

  • The dependency graphs (depends*.dot) now use the actual package names instead of replacing dashes, dots and plus signs with underscores.

  • The buildhistory-diff and buildhistory-collect-srcrevs utilities have improved command-line handling. Use the --help option for each utility for more information on the new syntax.

For more information on Build History, see the "Maintaining Build Output Quality" section.

6.4.15. udev

Following are changes to udev:

  • udev no longer brings in udev-extraconf automatically through RRECOMMENDS, since this was originally intended to be optional. If you need the extra rules, then add udev-extraconf to your image.

  • udev no longer brings in pciutils-ids or usbutils-ids through RRECOMMENDS. These are not needed by udev itself and removing them saves around 350KB.

6.4.16. Removed and Renamed Recipes

  • The linux-yocto 3.2 kernel has been removed.

  • libtool-nativesdk has been renamed to nativesdk-libtool.

  • tinylogin has been removed. It has been replaced by a suid portion of Busybox. See the "BusyBox" section for more information.

  • external-python-tarball has been renamed to buildtools-tarball.

  • web-webkit has been removed. It has been functionally replaced by midori.

  • imake has been removed. It is no longer needed by any other recipe.

  • transfig-native has been removed. It is no longer needed by any other recipe.

  • anjuta-remote-run has been removed. Anjuta IDE integration has not been officially supported for several releases.

6.4.17. Other Changes

Following is a list of short entries describing other changes:

  • run-postinsts: Make this generic.

  • base-files: Remove the unnecessary media/xxx directories.

  • alsa-state: Provide an empty asound.conf by default.

  • classes/image: Ensure BAD_RECOMMENDATIONS supports pre-renamed package names.

  • classes/rootfs_rpm: Implement BAD_RECOMMENDATIONS for RPM.

  • systemd: Remove systemd_unitdir if systemd is not in DISTRO_FEATURES.

  • systemd: Remove init.d dir if systemd unit file is present and sysvinit is not a distro feature.

  • libpam: Deny all services for the OTHER entries.

  • image.bbclass: Move runtime_mapping_rename to avoid conflict with multilib. See YOCTO #4993 in Bugzilla for more information.

  • linux-dtb: Use kernel build system to generate the dtb files.

  • kern-tools: Switch from guilt to new kgit-s2q tool.

6.5. Moving to the Yocto Project 1.6 Release

This section provides migration information for moving to the Yocto Project 1.6 Release from the prior release.

6.5.1. archiver Class

The archiver class has been rewritten and its configuration has been simplified. 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 Tasks Manual.

6.5.2. Packaging Changes

The following packaging changes have been made:

  • The binutils recipe no longer produces a binutils-symlinks package. update-alternatives is now used to handle the preferred binutils variant on the target instead.

  • The tc (traffic control) utilities have been split out of the main iproute2 package and put into the iproute2-tc package.

  • The gtk-engines schemas have been moved to a dedicated gtk-engines-schemas package.

  • The armv7a with thumb package architecture suffix has changed. The suffix for these packages with the thumb optimization enabled is "t2" as it should be. Use of this suffix was not the case in the 1.5 release. Architecture names will change within package feeds as a result.

6.5.3. BitBake

The following changes have been made to BitBake.

6.5.3.1. Matching Branch Requirement for Git Fetching

When fetching source from a Git repository using SRC_URI, BitBake will now validate the SRCREV value against the branch. You can specify the branch using the following form:

     SRC_URI = "git://server.name/repository;branch=branchname"
                

If you do not specify a branch, BitBake looks in the default "master" branch.

Alternatively, if you need to bypass this check (e.g. if you are fetching a revision corresponding to a tag that is not on any branch), you can add ";nobranch=1" to the end of the URL within SRC_URI.

6.5.3.2. Python Definition substitutions

BitBake had some previously deprecated Python definitions within its bb module removed. You should use their sub-module counterparts instead:

  • bb.MalformedUrl: Use bb.fetch.MalformedUrl.

  • bb.encodeurl: Use bb.fetch.encodeurl.

  • bb.decodeurl: Use bb.fetch.decodeurl

  • bb.mkdirhier: Use bb.utils.mkdirhier.

  • bb.movefile: Use bb.utils.movefile.

  • bb.copyfile: Use bb.utils.copyfile.

  • bb.which: Use bb.utils.which.

  • bb.vercmp_string: Use bb.utils.vercmp_string.

  • bb.vercmp: Use bb.utils.vercmp.

6.5.3.3. SVK Fetcher

The SVK fetcher has been removed from BitBake.

6.5.3.4. Console Output Error Redirection

The BitBake console UI will now output errors to stderr instead of stdout. Consequently, if you are piping or redirecting the output of bitbake to somewhere else, and you wish to retain the errors, you will need to add 2>&1 (or something similar) to the end of your bitbake command line.

6.5.3.5. task-taskname Overrides

task-taskname overrides have been adjusted so that tasks whose names contain underscores have the underscores replaced by hyphens for the override so that they now function properly. For example, the task override for do_populate_sdk is task-populate-sdk.

6.5.4. Changes to Variables

The following variables have changed. For information on the OpenEmbedded build system variables, see the "Variables Glossary" Chapter.

6.5.4.1. TMPDIR

TMPDIR can no longer be on an NFS mount. NFS does not offer full POSIX locking and inode consistency and can cause unexpected issues if used to store TMPDIR.

The check for this occurs on startup. If TMPDIR is detected on an NFS mount, an error occurs.

6.5.4.2. PRINC

The PRINC variable has been deprecated and triggers a warning if detected during a build. For PR increments on changes, use the PR service instead. You can find out more about this service in the "Working With a PR Service" section in the Yocto Project Development Tasks Manual.

6.5.4.3. IMAGE_TYPES

The "sum.jffs2" option for IMAGE_TYPES has been replaced by the "jffs2.sum" option, which fits the processing order.

6.5.4.4. COPY_LIC_MANIFEST

The COPY_LIC_MANIFEST variable must now be set to "1" rather than any value in order to enable it.

6.5.4.5. COPY_LIC_DIRS

The COPY_LIC_DIRS variable must now be set to "1" rather than any value in order to enable it.

6.5.4.6. PACKAGE_GROUP

The PACKAGE_GROUP variable has been renamed to FEATURE_PACKAGES to more accurately reflect its purpose. You can still use PACKAGE_GROUP but the OpenEmbedded build system produces a warning message when it encounters the variable.

6.5.4.7. Preprocess and Post Process Command Variable Behavior

The following variables now expect a semicolon separated list of functions to call and not arbitrary shell commands:

     ROOTFS_PREPROCESS_COMMAND
     ROOTFS_POSTPROCESS_COMMAND
     SDK_POSTPROCESS_COMMAND
     POPULATE_SDK_POST_TARGET_COMMAND
     POPULATE_SDK_POST_HOST_COMMAND
     IMAGE_POSTPROCESS_COMMAND
     IMAGE_PREPROCESS_COMMAND
     ROOTFS_POSTUNINSTALL_COMMAND
     ROOTFS_POSTINSTALL_COMMAND
                

For migration purposes, you can simply wrap shell commands in a shell function and then call the function. Here is an example:

     my_postprocess_function() {
        echo "hello" > ${IMAGE_ROOTFS}/hello.txt
     }
     ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "
                

6.5.5. Package Test (ptest)

Package Tests (ptest) are built but not installed by default. For information on using Package Tests, see the "Setting up and running package test (ptest)" section in the Yocto Project Development Tasks Manual. For information on the ptest class, see the "ptest.bbclass" section.

6.5.6. Build Changes

Separate build and source directories have been enabled by default for selected recipes where it is known to work (a whitelist) and for all recipes that inherit the cmake class. In future releases the autotools class will enable a separate build directory by default as well. Recipes building Autotools-based software that fails to build with a separate build directory should be changed to inherit from the autotools-brokensep class instead of the autotools or autotools_stageclasses.

6.5.7. qemu-native

qemu-native now builds without SDL-based graphical output support by default. The following additional lines are needed in your local.conf to enable it:

     PACKAGECONFIG_pn-qemu-native = "sdl"
     ASSUME_PROVIDED += "libsdl-native"
            

Note

The default local.conf contains these statements. Consequently, if you are building a headless system and using a default local.conf file, you will need comment these two lines out.

6.5.8. core-image-basic

core-image-basic has been renamed to core-image-full-cmdline.

In addition to core-image-basic being renamed, packagegroup-core-basic has been renamed to packagegroup-core-full-cmdline to match.

6.5.9. Licensing

The top-level LICENSE file has been changed to better describe the license of the various components of OE-Core. However, the licensing itself remains unchanged.

Normally, this change would not cause any side-effects. However, some recipes point to this file within LIC_FILES_CHKSUM (as ${COREBASE}/LICENSE) and thus the accompanying checksum must be changed from 3f40d7994397109285ec7b81fdeb3b58 to 4d92cd373abda3937c2bc47fbc49d690. A better alternative is to have LIC_FILES_CHKSUM point to a file describing the license that is distributed with the source that the recipe is building, if possible, rather than pointing to ${COREBASE}/LICENSE.

6.5.10. CFLAGS Options

The "-fpermissive" option has been removed from the default CFLAGS value. You need to take action on individual recipes that fail when building with this option. You need to either patch the recipes to fix the issues reported by the compiler, or you need to add "-fpermissive" to CFLAGS in the recipes.

6.5.11. Custom Image Output Types

Custom image output types, as selected using IMAGE_FSTYPES, must declare their dependencies on other image types (if any) using a new IMAGE_TYPEDEP variable.

6.5.12. Tasks

The do_package_write task has been removed. The task is no longer needed.

6.5.13. update-alternative Provider

The default update-alternatives provider has been changed from opkg to opkg-utils. This change resolves some troublesome circular dependencies. The runtime package has also been renamed from update-alternatives-cworth to update-alternatives-opkg.

6.5.14. virtclass Overrides

The virtclass overrides are now deprecated. Use the equivalent class overrides instead (e.g. virtclass-native becomes class-native.)

6.5.15. Removed and Renamed Recipes

The following recipes have been removed:

  • packagegroup-toolset-native - This recipe is largely unused.

  • linux-yocto-3.8 - Support for the Linux yocto 3.8 kernel has been dropped. Support for the 3.10 and 3.14 kernels have been added with the linux-yocto-3.10 and linux-yocto-3.14 recipes.

  • ocf-linux - This recipe has been functionally replaced using cryptodev-linux.

  • genext2fs - genext2fs is no longer used by the build system and is unmaintained upstream.

  • js - This provided an ancient version of Mozilla's javascript engine that is no longer needed.

  • zaurusd - The recipe has been moved to the meta-handheld layer.

  • eglibc 2.17 - Replaced by the eglibc 2.19 recipe.

  • gcc 4.7.2 - Replaced by the now stable gcc 4.8.2.

  • external-sourcery-toolchain - this recipe is now maintained in the meta-sourcery layer.

  • linux-libc-headers-yocto 3.4+git - Now using version 3.10 of the linux-libc-headers by default.

  • meta-toolchain-gmae - This recipe is obsolete.

  • packagegroup-core-sdk-gmae - This recipe is obsolete.

  • packagegroup-core-standalone-gmae-sdk-target - This recipe is obsolete.

6.5.16. Removed Classes

The following classes have become obsolete and have been removed:

  • module_strip

  • pkg_metainfo

  • pkg_distribute

  • image-empty

6.5.17. Reference Board Support Packages (BSPs)

The following reference BSPs changes occurred:

  • The BeagleBoard (beagleboard) ARM reference hardware has been replaced by the BeagleBone (beaglebone) hardware.

  • The RouterStation Pro (routerstationpro) MIPS reference hardware has been replaced by the EdgeRouter Lite (edgerouter) hardware.

The previous reference BSPs for the beagleboard and routerstationpro machines are still available in a new meta-yocto-bsp-old layer in the Source Repositories at http://git.yoctoproject.org/cgit/cgit.cgi/meta-yocto-bsp-old/.

6.6. Moving to the Yocto Project 1.7 Release

This section provides migration information for moving to the Yocto Project 1.7 Release from the prior release.

6.6.1. Changes to Setting QEMU PACKAGECONFIG Options in local.conf

The QEMU recipe now uses a number of PACKAGECONFIG options to enable various optional features. The method used to set defaults for these options means that existing local.conf files will need to be be modified to append to PACKAGECONFIG for qemu-native and nativesdk-qemu instead of setting it. In other words, to enable graphical output for QEMU, you should now have these lines in local.conf:

     PACKAGECONFIG_append_pn-qemu-native = " sdl"
     PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
            

6.6.2. Minimum Git version

The minimum Git version required on the build host is now 1.7.8 because the --list option is now required by BitBake's Git fetcher. As always, if your host distribution does not provide a version of Git that meets this requirement, you can use the buildtools-tarball that does. See the "Required Git, tar, and Python Versions" section for more information.

6.6.3. Autotools Class Changes

The following autotools class changes occurred:

  • A separate build directory is now used by default: The autotools class has been changed to use a directory for building (B), which is separate from the source directory (S). This is commonly referred to as B != S, or an out-of-tree build.

    If the software being built is already capable of building in a directory separate from the source, you do not need to do anything. However, if the software is not capable of being built in this manner, you will need to either patch the software so that it can build separately, or you will need to change the recipe to inherit the autotools-brokensep class instead of the autotools or autotools_stage classes.

  • The --foreign option is no longer passed to automake when running autoconf: This option tells automake that a particular software package does not follow the GNU standards and therefore should not be expected to distribute certain files such as ChangeLog, AUTHORS, and so forth. Because the majority of upstream software packages already tell automake to enable foreign mode themselves, the option is mostly superfluous. However, some recipes will need patches for this change. You can easily make the change by patching configure.ac so that it passes "foreign" to AM_INIT_AUTOMAKE(). See this commit for an example showing how to make the patch.

6.6.4. Binary Configuration Scripts Disabled

Some of the core recipes that package binary configuration scripts now disable the scripts due to the scripts previously requiring error-prone path substitution. Software that links against these libraries using these scripts should use the much more robust pkg-config instead. The list of recipes changed in this version (and their configuration scripts) is as follows:

     directfb (directfb-config)
     freetype (freetype-config)
     gpgme (gpgme-config)
     libassuan (libassuan-config)
     libcroco (croco-6.0-config)
     libgcrypt (libgcrypt-config)
     libgpg-error (gpg-error-config)
     libksba (ksba-config)
     libpcap (pcap-config)
     libpcre (pcre-config)
     libpng (libpng-config, libpng16-config)
     libsdl (sdl-config)
     libusb-compat (libusb-config)
     libxml2 (xml2-config)
     libxslt (xslt-config)
     ncurses (ncurses-config)
     neon (neon-config)
     npth (npth-config)
     pth (pth-config)
     taglib (taglib-config)
            

Additionally, support for pkg-config has been added to some recipes in the previous list in the rare cases where the upstream software package does not already provide it.

6.6.5. eglibc 2.19 Replaced with glibc 2.20

Because eglibc and glibc were already fairly close, this replacement should not require any significant changes to other software that links to eglibc. However, there were a number of minor changes in glibc 2.20 upstream that could require patching some software (e.g. the removal of the _BSD_SOURCE feature test macro).

glibc 2.20 requires version 2.6.32 or greater of the Linux kernel. Thus, older kernels will no longer be usable in conjunction with it.

For full details on the changes in glibc 2.20, see the upstream release notes here.

6.6.6. Kernel Module Autoloading

The module_autoload_* variable is now deprecated and a new KERNEL_MODULE_AUTOLOAD variable should be used instead. Also, module_conf_* must now be used in conjunction with a new KERNEL_MODULE_PROBECONF variable. The new variables no longer require you to specify the module name as part of the variable name. This change not only simplifies usage but also allows the values of these variables to be appropriately incorporated into task signatures and thus trigger the appropriate tasks to re-execute when changed. You should replace any references to module_autoload_* with KERNEL_MODULE_AUTOLOAD, and add any modules for which module_conf_* is specified to KERNEL_MODULE_PROBECONF.

For more information, see the KERNEL_MODULE_AUTOLOAD and KERNEL_MODULE_PROBECONF variables.

6.6.7. QA Check Changes

The following changes have occurred to the QA check process:

  • Additional QA checks file-rdeps and build-deps have been added in order to verify that file dependencies are satisfied (e.g. package contains a script requiring /bin/bash) and build-time dependencies are declared, respectively. For more information, please see the "QA Error and Warning Messages" chapter.

  • Package QA checks are now performed during a new do_package_qa task rather than being part of the do_package task. This allows more parallel execution. This change is unlikely to be an issue except for highly customized recipes that disable packaging tasks themselves by marking them as noexec. For those packages, you will need to disable the do_package_qa task as well.

  • Files being overwritten during the do_populate_sysroot task now trigger an error instead of a warning. Recipes should not be overwriting files written to the sysroot by other recipes. If you have these types of recipes, you need to alter them so that they do not overwrite these files.

    You might now receive this error after changes in configuration or metadata resulting in orphaned files being left in the sysroot. If you do receive this error, the way to resolve the issue is to delete your TMPDIR or to move it out of the way and then re-start the build. Anything that has been fully built up to that point and does not need rebuilding will be restored from the shared state cache and the rest of the build will be able to proceed as normal.

6.6.8. Removed Recipes

The following recipes have been removed:

  • x-load: This recipe has been superseded by U-boot SPL for all Cortex-based TI SoCs. For legacy boards, the meta-ti layer, which contains a maintained recipe, should be used instead.

  • ubootchart: This recipe is obsolete. A bootchart2 recipe has been added to functionally replace it.

  • linux-yocto 3.4: Support for the linux-yocto 3.4 kernel has been dropped. Support for the 3.10 and 3.14 kernels remains, while support for version 3.17 has been added.

  • eglibc has been removed in favor of glibc. See the "eglibc 2.19 Replaced with glibc 2.20" section for more information.

6.6.9. Miscellaneous Changes

The following miscellaneous change occurred:

  • The build history feature now writes build-id.txt instead of build-id. Additionally, build-id.txt now contains the full build header as printed by BitBake upon starting the build. You should manually remove old "build-id" files from your existing build history repositories to avoid confusion. For information on the build history feature, see the "Maintaining Build Output Quality" section.

6.7. Moving to the Yocto Project 1.8 Release

This section provides migration information for moving to the Yocto Project 1.8 Release from the prior release.

6.7.1. Removed Recipes

The following recipes have been removed:

  • owl-video: Functionality replaced by gst-player.

  • gaku: Functionality replaced by gst-player.

  • gnome-desktop: This recipe is now available in meta-gnome and is no longer needed.

  • gsettings-desktop-schemas: This recipe is now available in meta-gnome and is no longer needed.

  • python-argparse: The argparse module is already provided in the default Python distribution in a package named python-argparse. Consequently, the separate python-argparse recipe is no longer needed.

  • telepathy-python, libtelepathy, telepathy-glib, telepathy-idle, telepathy-mission-control: All these recipes have moved to meta-oe and are consequently no longer needed by any recipes in OpenEmbedded-Core.

  • linux-yocto_3.10 and linux-yocto_3.17: Support for the linux-yocto 3.10 and 3.17 kernels has been dropped. Support for the 3.14 kernel remains, while support for 3.19 kernel has been added.

  • poky-feed-config-opkg: This recipe has become obsolete and is no longer needed. Use distro-feed-config from meta-oe instead.

  • libav 0.8.x: libav 9.x is now used.

  • sed-native: No longer needed. A working version of sed is expected to be provided by the host distribution.

6.7.2. BlueZ 4.x / 5.x Selection

Proper built-in support for selecting BlueZ 5.x in preference to the default of 4.x now exists. To use BlueZ 5.x, simply add "bluez5" to your DISTRO_FEATURES value. If you had previously added append files (*.bbappend) to make this selection, you can now remove them.

Additionally, a bluetooth class has been added to make selection of the appropriate bluetooth support within a recipe a little easier. If you wish to make use of this class in a recipe, add something such as the following:

     inherit bluetooth
     PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', '${BLUEZ}', '', d)}
     PACKAGECONFIG[bluez4] = "--enable-bluetooth,--disable-bluetooth,bluez4"
     PACKAGECONFIG[bluez5] = "--enable-bluez5,--disable-bluez5,bluez5"
            

6.7.3. Kernel Build Changes

The kernel build process was changed to place the source in a common shared work area and to place build artifacts separately in the source code tree. In theory, migration paths have been provided for most common usages in kernel recipes but this might not work in all cases. In particular, users need to ensure that ${S} (source files) and ${B} (build artifacts) are used correctly in functions such as do_configure and do_install. For kernel recipes that do not inherit from kernel-yocto or include linux-yocto.inc, you might wish to refer to the linux.inc file in the meta-oe layer for the kinds of changes you need to make. For reference, here is the commit where the linux.inc file in meta-oe was updated.

Recipes that rely on the kernel source code and do not inherit the module classes might need to add explicit dependencies on the do_shared_workdir kernel task, for example:

     do_configure[depends] += "virtual/kernel:do_shared_workdir"
            

6.7.4. SSL 3.0 is Now Disabled in OpenSSL

SSL 3.0 is now disabled when building OpenSSL. Disabling SSL 3.0 avoids any lingering instances of the POODLE vulnerability. If you feel you must re-enable SSL 3.0, then you can add an append file (*.bbappend) for the openssl recipe to remove "-no-ssl3" from EXTRA_OECONF.

6.7.5. Default Sysroot Poisoning

gcc's default sysroot and include directories are now "poisoned". In other words, the sysroot and include directories are being redirected to a non-existent location in order to catch when host directories are being used due to the correct options not being passed. This poisoning applies both to the cross-compiler used within the build and to the cross-compiler produced in the SDK.

If this change causes something in the build to fail, it almost certainly means the various compiler flags and commands are not being passed correctly to the underlying piece of software. In such cases, you need to take corrective steps.

6.7.6. Rebuild Improvements

Changes have been made to the base, autotools, and cmake classes to clean out generated files when the do_configure task needs to be re-executed.

One of the improvements is to attempt to run "make clean" during the do_configure task if a Makefile exists. Some software packages do not provide a working clean target within their make files. If you have such recipes, you need to set CLEANBROKEN to "1" within the recipe, for example:

     CLEANBROKEN = "1"
            

6.7.7. QA Check and Validation Changes

The following QA Check and Validation Changes have occurred:

  • Usage of PRINC previously triggered a warning. It now triggers an error. You should remove any remaining usage of PRINC in any recipe or append file.

  • An additional QA check has been added to detect usage of ${D} in FILES values where D values should not be used at all. The same check ensures that $D is used in pkg_preinst/pkg_postinst/pkg_prerm/pkg_postrm functions instead of ${D}.

  • S now needs to be set to a valid value within a recipe. If S is not set in the recipe, the directory is not automatically created. If S does not point to a directory that exists at the time the do_unpack task finishes, a warning will be shown.

  • LICENSE is now validated for correct formatting of multiple licenses. If the format is invalid (e.g. multiple licenses are specified with no operators to specify how the multiple licenses interact), then a warning will be shown.

6.7.8. Miscellaneous Changes

The following miscellaneous changes have occurred:

  • The send-error-report script now expects a "-s" option to be specified before the server address. This assumes a server address is being specified.

  • The oe-pkgdata-util script now expects a "-p" option to be specified before the pkgdata directory, which is now optional. If the pkgdata directory is not specified, the script will run BitBake to query PKGDATA_DIR from the build environment.

6.8. Moving to the Yocto Project 2.0 Release

This section provides migration information for moving to the Yocto Project 2.0 Release from the prior release.

6.8.1. GCC 5

The default compiler is now GCC 5.2. This change has required fixes for compilation errors in a number of other recipes.

One important example is a fix for when the Linux kernel freezes at boot time on ARM when built with GCC 5. If you are using your own kernel recipe or source tree and building for ARM, you will likely need to apply this patch. The standard linux-yocto kernel source tree already has a workaround for the same issue.

For further details, see https://gcc.gnu.org/gcc-5/changes.html and the porting guide at https://gcc.gnu.org/gcc-5/porting_to.html.

Alternatively, you can switch back to GCC 4.9 or 4.8 by setting GCCVERSION in your configuration, as follows:

     GCCVERSION = "4.9%"
            

6.8.2. Gstreamer 0.10 Removed

Gstreamer 0.10 has been removed in favor of Gstreamer 1.x. As part of the change, recipes for Gstreamer 0.10 and related software are now located in meta-multimedia. This change results in Qt4 having Phonon and Gstreamer support in QtWebkit disabled by default.

6.8.3. Removed Recipes

The following recipes have been moved or removed:

  • bluez4: The recipe is obsolete and has been moved due to bluez5 becoming fully integrated. The bluez4 recipe now resides in meta-oe.

  • gamin: The recipe is obsolete and has been removed.

  • gnome-icon-theme: The recipe's functionally has been replaced by adwaita-icon-theme.

  • Gstreamer 0.10 Recipes: Recipes for Gstreamer 0.10 have been removed in favor of the recipes for Gstreamer 1.x.

  • insserv: The recipe is obsolete and has been removed.

  • libunique: The recipe is no longer used and has been moved to meta-oe.

  • midori: The recipe's functionally has been replaced by epiphany.

  • python-gst: The recipe is obsolete and has been removed since it only contains bindings for Gstreamer 0.10.

  • qt-mobility: The recipe is obsolete and has been removed since it requires Gstreamer 0.10, which has been replaced.

  • subversion: All 1.6.x versions of this recipe have been removed.

  • webkit-gtk: The older 1.8.3 version of this recipe has been removed in favor of webkitgtk.

6.8.4. BitBake datastore improvements

The method by which BitBake's datastore handles overrides has changed. Overrides are now applied dynamically and bb.data.update_data() is now a no-op. Thus, bb.data.update_data() is no longer required in order to apply the correct overrides. In practice, this change is unlikely to require any changes to Metadata. However, these minor changes in behavior exist:

  • All potential overrides are now visible in the variable history as seen when you run the following:

         $ bitbake -e
                        

  • d.delVar('VARNAME') and d.setVar('VARNAME', None) result in the variable and all of its overrides being cleared out. Before the change, only the non-overridden values were cleared.

6.8.5. Shell Message Function Changes

The shell versions of the BitBake message functions (i.e. bbdebug, bbnote, bbwarn, bbplain, bberror, and bbfatal) are now connected through to their BitBake equivalents bb.debug(), bb.note(), bb.warn(), bb.plain(), bb.error(), and bb.fatal(), respectively. Thus, those message functions that you would expect to be printed by the BitBake UI are now actually printed. In practice, this change means two things:

  • If you now see messages on the console that you did not previously see as a result of this change, you might need to clean up the calls to bbwarn, bberror, and so forth. Or, you might want to simply remove the calls.

  • The bbfatal message function now suppresses the full error log in the UI, which means any calls to bbfatal where you still wish to see the full error log should be replaced by die or bbfatal_log.

6.8.6. Extra Development/Debug Package Cleanup

The following recipes have had extra dev/dbg packages removed:

  • acl

  • apmd

  • aspell

  • attr

  • augeas

  • bzip2

  • cogl

  • curl

  • elfutils

  • gcc-target

  • libgcc

  • libtool

  • libxmu

  • opkg

  • pciutils

  • rpm

  • sysfsutils

  • tiff

  • xz

All of the above recipes now conform to the standard packaging scheme where a single -dev, -dbg, and -staticdev package exists per recipe.

6.8.7. Recipe Maintenance Tracking Data Moved to OE-Core

Maintenance tracking data for recipes that was previously part of meta-yocto has been moved to OE-Core. The change includes package_regex.inc and distro_alias.inc, which are typically enabled when using the distrodata class. Additionally, the contents of upstream_tracking.inc has now been split out to the relevant recipes.

6.8.8. Automatic Stale Sysroot File Cleanup

Stale files from recipes that no longer exist in the current configuration are now automatically removed from sysroot as well as removed from any other place managed by shared state. This automatic cleanup means that the build system now properly handles situations such as renaming the build system side of recipes, removal of layers from bblayers.conf, and DISTRO_FEATURES changes.

Additionally, work directories for old versions of recipes are now pruned. If you wish to disable pruning old work directories, you can set the following variable in your configuration:

     SSTATE_PRUNE_OBSOLETEWORKDIR = "0"
            

6.8.9. linux-yocto Kernel Metadata Repository Now Split from Source

The linux-yocto tree has up to now been a combined set of kernel changes and configuration (meta) data carried in a single tree. While this format is effective at keeping kernel configuration and source modifications synchronized, it is not always obvious to developers how to manipulate the Metadata as compared to the source.

Metadata processing has now been removed from the kernel-yocto class and the external Metadata repository yocto-kernel-cache, which has always been used to seed the linux-yocto "meta" branch. This separate linux-yocto cache repository is now the primary location for this data. Due to this change, linux-yocto is no longer able to process combined trees. Thus, if you need to have your own combined kernel repository, you must do the split there as well and update your recipes accordingly. See the meta/recipes-kernel/linux/linux-yocto_4.1.bb recipe for an example.

6.8.10. Additional QA checks

The following QA checks have been added:

  • Added a "host-user-contaminated" check for ownership issues for packaged files outside of /home. The check looks for files that are incorrectly owned by the user that ran BitBake instead of owned by a valid user in the target system.

  • Added an "invalid-chars" check for invalid (non-UTF8) characters in recipe metadata variable values (i.e. DESCRIPTION, SUMMARY, LICENSE, and SECTION). Some package managers do not support these characters.

  • Added an "invalid-packageconfig" check for any options specified in PACKAGECONFIG that do not match any PACKAGECONFIG option defined for the recipe.

6.8.11. Miscellaneous Changes

These additional changes exist:

  • gtk-update-icon-cache has been renamed to gtk-icon-utils.

  • The tools-profile IMAGE_FEATURES item as well as its corresponding packagegroup and packagegroup-core-tools-profile no longer bring in oprofile. Bringing in oprofile was originally added to aid compilation on resource-constrained targets. However, this aid has not been widely used and is not likely to be used going forward due to the more powerful target platforms and the existence of better cross-compilation tools.

  • The IMAGE_FSTYPES variable's default value now specifies ext4 instead of ext3.

  • All support for the PRINC variable has been removed.

  • The packagegroup-core-full-cmdline packagegroup no longer brings in lighttpd due to the fact that bringing in lighttpd is not really in line with the packagegroup's purpose, which is to add full versions of command-line tools that by default are provided by busybox.

6.9. Moving to the Yocto Project 2.1 Release

This section provides migration information for moving to the Yocto Project 2.1 Release from the prior release.

6.9.1. Variable Expansion in Python Functions

Variable expressions, such as ${VARNAME} no longer expand automatically within Python functions. Suppressing expansion was done to allow Python functions to construct shell scripts or other code for situations in which you do not want such expressions expanded. For any existing code that relies on these expansions, you need to change the expansions to expand the value of individual variables through d.getVar(). To alternatively expand more complex expressions, use d.expand().

6.9.2. Overrides Must Now be Lower-Case

The convention for overrides has always been for them to be lower-case characters. This practice is now a requirement as BitBake's datastore now assumes lower-case characters in order to give a slight performance boost during parsing. In practical terms, this requirement means that anything that ends up in OVERRIDES must now appear in lower-case characters (e.g. values for MACHINE, TARGET_ARCH, DISTRO, and also recipe names if _pn-recipename overrides are to be effective).

6.9.3. Expand Parameter to getVar() and getVarFlag() is Now Mandatory

The expand parameter to getVar() and getVarFlag() previously defaulted to False if not specified. Now, however, no default exists so one must be specified. You must change any getVar() calls that do not specify the final expand parameter to calls that do specify the parameter. You can run the following sed command at the base of a layer to make this change:

     sed -e 's:\(\.getVar([^,()]*\)):\1, False):g' -i `grep -ril getVar *`
     sed -e 's:\(\.getVarFlag([^,()]*, [^,()]*\)):\1, False):g' -i `grep -ril getVarFlag *`
            

Note

The reason for this change is that it prepares the way for changing the default to True in a future Yocto Project release. This future change is a much more sensible default than False. However, the change needs to be made gradually as a sudden change of the default would potentially cause side-effects that would be difficult to detect.

6.9.4. Makefile Environment Changes

EXTRA_OEMAKE now defaults to "" instead of "-e MAKEFLAGS=". Setting EXTRA_OEMAKE to "-e MAKEFLAGS=" by default was a historical accident that has required many classes (e.g. autotools, module) and recipes to override this default in order to work with sensible build systems. When upgrading to the release, you must edit any recipe that relies upon this old default by either setting EXTRA_OEMAKE back to "-e MAKEFLAGS=" or by explicitly setting any required variable value overrides using EXTRA_OEMAKE, which is typically only needed when a Makefile sets a default value for a variable that is inappropriate for cross-compilation using the "=" operator rather than the "?=" operator.

6.9.5. libexecdir Reverted to ${prefix}/libexec

The use of ${libdir}/${BPN} as libexecdir is different as compared to all other mainstream distributions, which either uses ${prefix}/libexec or ${libdir}. The use is also contrary to the GNU Coding Standards (i.e. https://www.gnu.org/prep/standards/html_node/Directory-Variables.html) that suggest ${prefix}/libexec and also notes that any package-specific nesting should be done by the package itself. Finally, having libexecdir change between recipes makes it very difficult for different recipes to invoke binaries that have been installed into libexecdir. The Filesystem Hierarchy Standard (i.e. http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html) now recognizes the use of ${prefix}/libexec/, giving distributions the choice between ${prefix}/lib or ${prefix}/libexec without breaking FHS.

6.9.6. ac_cv_sizeof_off_t is No Longer Cached in Site Files

For recipes inheriting the autotools class, ac_cv_sizeof_off_t is no longer cached in the site files for autoconf. The reason for this change is because the ac_cv_sizeof_off_t value is not necessarily static per architecture as was previously assumed. Rather, the value changes based on whether large file support is enabled. For most software that uses autoconf, this change should not be a problem. However, if you have a recipe that bypasses the standard do_configure task from the autotools class and the software the recipe is building uses a very old version of autoconf, the recipe might be incapable of determining the correct size of off_t during do_configure.

The best course of action is to patch the software as necessary to allow the default implementation from the autotools class to work such that autoreconf succeeds and produces a working configure script, and to remove the overridden do_configure task such that the default implementation does get used.

6.9.7. Image Generation is Now Split Out from Filesystem Generation

Previously, for image recipes the do_rootfs task assembled the filesystem and then from that filesystem generated images. With this Yocto Project release, image generation is split into separate do_image_* tasks for clarity both in operation and in the code.

For most cases, this change does not present any problems. However, if you have made customizations that directly modify the do_rootfs task or that mention do_rootfs, you might need to update those changes. In particular, if you had added any tasks after do_rootfs, you should make edits so that those tasks are after the do_image_complete task rather than after do_rootfs so that the your added tasks run at the correct time.

A minor part of this restructuring is that the post-processing definitions and functions have been moved from the image class to the rootfs-postcommands class. Functionally, however, they remain unchanged.

6.9.8. Removed Recipes

The following recipes have been removed in the 2.1 release:

  • gcc version 4.8: Versions 4.9 and 5.3 remain.

  • qt4: All support for Qt 4.x has been moved out to a separate meta-qt4 layer because Qt 4 is no longer supported upstream.

  • x11vnc: Moved to the meta-oe layer.

  • linux-yocto-3.14: No longer supported.

  • linux-yocto-3.19: No longer supported.

  • libjpeg: Replaced by the libjpeg-turbo recipe.

  • pth: Became obsolete.

  • liboil: Recipe is no longer needed and has been moved to the meta-multimedia layer.

  • gtk-theme-torturer: Recipe is no longer needed and has been moved to the meta-gnome layer.

  • gnome-mime-data: Recipe is no longer needed and has been moved to the meta-gnome layer.

  • udev: Replaced by the eudev recipe for compatibility when using sysvinit with newer kernels.

  • python-pygtk: Recipe became obsolete.

  • adt-installer: Recipe became obsolete. See the "ADT Removed" section for more information.

6.9.9. Class Changes

The following classes have changed:

  • autotools_stage: Removed because the autotools class now provides its functionality. Recipes that inherited from autotools_stage should now inherit from autotools instead.

  • boot-directdisk: Merged into the image-vm class. The boot-directdisk class was rarely directly used. Consequently, this change should not cause any issues.

  • bootimg: Merged into the image-live class. The bootimg class was rarely directly used. Consequently, this change should not cause any issues.

  • packageinfo: Removed due to its limited use by the Hob UI, which has itself been removed.

6.9.10. Build System User Interface Changes

The following changes have been made to the build system user interface:

  • Hob GTK+-based UI: Removed because it is unmaintained and based on the outdated GTK+ 2 library. The Toaster web-based UI is much more capable and is actively maintained. See the "Using the Toaster Web Interface" section in the Yocto Project Toaster User Manual for more information on this interface.

  • "puccho" BitBake UI: Removed because is unmaintained and no longer useful.

6.9.11. ADT Removed

The Application Development Toolkit (ADT) has been removed because its functionality almost completely overlapped with the standard SDK and the extensible SDK. For information on these SDKs and how to build and use them, see the Yocto Project Software Development Kit (SDK) Developer's Guide.

Note

The Yocto Project Eclipse IDE Plug-in is still supported and is not affected by this change.

6.9.12. Poky Reference Distribution Changes

The following changes have been made for the Poky distribution:

  • The meta-yocto layer has been renamed to meta-poky to better match its purpose, which is to provide the Poky reference distribution. The meta-yocto-bsp layer retains its original name since it provides reference machines for the Yocto Project and it is otherwise unrelated to Poky. References to meta-yocto in your conf/bblayers.conf should automatically be updated, so you should not need to change anything unless you are relying on this naming elsewhere.

  • The uninative class is now enabled by default in Poky. This class attempts to isolate the build system from the host distribution's C library and makes re-use of native shared state artifacts across different host distributions practical. With this class enabled, a tarball containing a pre-built C library is downloaded at the start of the build.

    The uninative class is enabled through the meta/conf/distro/include/yocto-uninative.inc file, which for those not using the Poky distribution, can include to easily enable the same functionality.

    Alternatively, if you wish to build your own uninative tarball, you can do so by building the uninative-tarball recipe, making it available to your build machines (e.g. over HTTP/HTTPS) and setting a similar configuration as the one set by yocto-uninative.inc.

  • Static library generation, for most cases, is now disabled by default in the Poky distribution. Disabling this generation saves some build time as well as the size used for build output artifacts.

    Disabling this library generation is accomplished through a meta/conf/distro/include/no-static-libs.inc, which for those not using the Poky distribution can easily include to enable the same functionality.

    Any recipe that needs to opt-out of having the "--disable-static" option specified on the configure command line either because it is not a supported option for the configure script or because static libraries are needed should set the following variable:

         DISABLE_STATIC = ""
                        

  • The separate poky-tiny distribution now uses the musl C library instead of a heavily pared down glibc. Using musl results in a smaller distribution and facilitates much greater maintainability because musl is designed to have a small footprint.

    If you have used poky-tiny and have customized the glibc configuration you will need to redo those customizations with musl when upgrading to the new release.

6.9.13. Packaging Changes

The following changes have been made to packaging:

  • The runuser and mountpoint binaries, which were previously in the main util-linux package, have been split out into the util-linux-runuser and util-linux-mountpoint packages, respectively.

  • The python-elementtree package has been merged into the python-xml package.

6.9.14. Tuning File Changes

The following changes have been made to the tuning files:

  • The "no-thumb-interwork" tuning feature has been dropped from the ARM tune include files. Because interworking is required for ARM EABI, attempting to disable it through a tuning feature no longer makes sense.

    Note

    Support for ARM OABI was deprecated in gcc 4.7.

  • The tune-cortexm*.inc and tune-cortexr4.inc files have been removed because they are poorly tested. Until the OpenEmbedded build system officially gains support for CPUs without an MMU, these tuning files would probably be better maintained in a separate layer if needed.

6.9.15. Supporting GObject Introspection

This release supports generation of GLib Introspective Repository (GIR) files through GObject introspection, which is the standard mechanism for accessing GObject-based software from runtime environments. You can enable, disable, and test the generation of this data. See the "Enabling GObject Introspection Support" section in the Yocto Project Development Tasks Manual for more information.

6.9.16. Miscellaneous Changes

These additional changes exist:

  • The minimum Git version has been increased to 1.8.3.1. If your host distribution does not provide a sufficiently recent version, you can install the buildtools, which will provide it. See the "Required Git, tar, and Python Versions" section for more information on the buildtools tarball.

  • The buggy and incomplete support for the RPM version 4 package manager has been removed. The well-tested and maintained support for RPM version 5 remains.

  • Previously, the following list of packages were removed if package-management was not in IMAGE_FEATURES, regardless of any dependencies:

         update-rc.d
         base-passwd
         shadow
         update-alternatives
         run-postinsts
                        

    With the Yocto Project 2.1 release, these packages are only removed if "read-only-rootfs" is in IMAGE_FEATURES, since they might still be needed for a read-write image even in the absence of a package manager (e.g. if users need to be added, modified, or removed at runtime).

  • The devtool modify command now defaults to extracting the source since that is most commonly expected. The "-x" or "--extract" options are now no-ops. If you wish to provide your own existing source tree, you will now need to specify either the "-n" or "--no-extract" options when running devtool modify.

  • If the formfactor for a machine is either not supplied or does not specify whether a keyboard is attached, then the default is to assume a keyboard is attached rather than assume no keyboard. This change primarily affects the Sato UI.

  • The .debug directory packaging is now automatic. If your recipe builds software that installs binaries into directories other than the standard ones, you no longer need to take care of setting FILES_${PN}-dbg to pick up the resulting .debug directories as these directories are automatically found and added.

  • Inaccurate disk and CPU percentage data has been dropped from buildstats output. This data has been replaced with getrusage() data and corrected IO statistics. You will probably need to update any custom code that reads the buildstats data.

  • The meta/conf/distro/include/package_regex.inc is now deprecated. The contents of this file have been moved to individual recipes.

    Tip

    Because this file will likely be removed in a future Yocto Project release, it is suggested that you remove any references to the file that might be in your configuration.

  • The v86d/uvesafb has been removed from the genericx86 and genericx86-64 reference machines, which are provided by the meta-yocto-bsp layer. Most modern x86 boards do not rely on this file and it only adds kernel error messages during startup. If you do still need to support uvesafb, you can simply add v86d to your image.

  • Build sysroot paths are now removed from debug symbol files. Removing these paths means that remote GDB using an unstripped build system sysroot will no longer work (although this was never documented to work). The supported method to accomplish something similar is to set IMAGE_GEN_DEBUGFS to "1", which will generate a companion debug image containing unstripped binaries and associated debug sources alongside the image.

6.10. Moving to the Yocto Project 2.2 Release

This section provides migration information for moving to the Yocto Project 2.2 Release from the prior release.

6.10.1. Minimum Kernel Version

The minimum kernel version for the target system and for SDK is now 3.2.0, due to the upgrade to glibc 2.24. Specifically, for AArch64-based targets the version is 3.14. For Nios II-based targets, the minimum kernel version is 3.19.

Note

For x86 and x86_64, you can reset OLDEST_KERNEL to anything down to 2.6.32 if desired.

6.10.2. Staging Directories in Sysroot Has Been Simplified

The way directories are staged in sysroot has been simplified and introduces the new SYSROOT_DIRS, SYSROOT_DIRS_NATIVE, and SYSROOT_DIRS_BLACKLIST. See the v2 patch series on the OE-Core Mailing List for additional information.

6.10.3. Removal of Old Images and Other Files in tmp/deploy Now Enabled

Removal of old images and other files in tmp/deploy/ is now enabled by default due to a new staging method used for those files. As a result of this change, the RM_OLD_IMAGE variable is now redundant.

6.10.4. Python Changes

The following changes for Python occurred:

6.10.4.1. BitBake Now Requires Python 3.4+

BitBake requires Python 3.4 or greater.

6.10.4.2. UTF-8 Locale Required on Build Host

A UTF-8 locale is required on the build host due to Python 3. Since C.UTF-8 is not a standard, the default is en_US.UTF-8.

6.10.4.3. Metadata Must Now Use Python 3 Syntax

The metadata is now required to use Python 3 syntax. For help preparing metadata, see any of the many Python 3 porting guides available. Alternatively, you can reference the conversion commits for Bitbake and you can use OE-Core as a guide for changes. Following are particular areas of interest:

     * subprocess command-line pipes needing locale decoding
     * the syntax for octal values changed
     * the iter*() functions changed name
     * iterators now return views, not lists
     * changed names for Python modules
                

6.10.4.4. Target Python Recipes Switched to Python 3

Most target Python recipes have now been switched to Python 3. Unfortunately, systems using RPM as a package manager and providing online package-manager support through SMART still require Python 2.

Note

Python 2 and recipes that use it can still be built for the target as with previous versions.

6.10.4.5. buildtools-tarball Includes Python 3

buildtools-tarball now includes Python 3.

6.10.5. uClibc Replaced by musl

uClibc has been removed in favor of musl. Musl has matured, is better maintained, and is compatible with a wider range of applications as compared to uClibc.

6.10.6. ${B} No Longer Default Working Directory for Tasks

${B} is no longer the default working directory for tasks. Consequently, any custom tasks you define now need to either have the [dirs] flag set, or the task needs to change into the appropriate working directory manually (e.g using cd for a shell task).

Note

The preferred method is to use the [dirs] flag.

6.10.7. runqemu Ported to Python

runqemu has been ported to Python and has changed behavior in some cases. Previous usage patterns continue to be supported.

The new runqemu is a Python script. Machine knowledge is no longer hardcoded into runqemu. You can choose to use the qemuboot configuration file to define the BSP's own arguments and to make it bootable with runqemu. If you use a configuration file, use the following form:

     image-name-machine.qemuboot.conf
            

The configuration file enables fine-grained tuning of options passed to QEMU without the runqemu script hard-coding any knowledge about different machines. Using a configuration file is particularly convenient when trying to use QEMU with machines other than the qemu* machines in OE-Core. The qemuboot.conf file is generated by the qemuboot class when the root filesystem is being build (i.e. build rootfs). QEMU boot arguments can be set in BSP's configuration file and the qemuboot class will save them to qemuboot.conf.

If you want to use runqemu without a configuration file, use the following command form:

     $ runqemu machine rootfs kernel [options]
            

Supported machines are as follows:

     qemuarm
     qemuarm64
     qemux86
     qemux86-64
     qemuppc
     qemumips
     qemumips64
     qemumipsel
     qemumips64el
            

Consider the following example, which uses the qemux86-64 machine, provides a root filesystem, provides an image, and uses the nographic option:

$ runqemu qemux86-64 tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.ext4 tmp/deploy/images/qemux86-64/bzImage nographic
            

Following is a list of variables that can be set in configuration files such as bsp.conf to enable the BSP to be booted by runqemu:

Note

"QB" means "QEMU Boot".

     QB_SYSTEM_NAME: QEMU name (e.g. "qemu-system-i386")
     QB_OPT_APPEND: Options to append to QEMU (e.g. "-show-cursor")
     QB_DEFAULT_KERNEL: Default kernel to boot (e.g. "bzImage")
     QB_DEFAULT_FSTYPE: Default FSTYPE to boot (e.g. "ext4")
     QB_MEM: Memory (e.g. "-m 512")
     QB_MACHINE: QEMU machine (e.g. "-machine virt")
     QB_CPU: QEMU cpu (e.g. "-cpu qemu32")
     QB_CPU_KVM: Similar to QB_CPU except used for kvm support (e.g. "-cpu kvm64")
     QB_KERNEL_CMDLINE_APPEND: Options to append to the kernel's -append
                               option (e.g. "console=ttyS0 console=tty")
     QB_DTB: QEMU dtb name
     QB_AUDIO_DRV: QEMU audio driver (e.g. "alsa", set it when support audio)
     QB_AUDIO_OPT: QEMU audio option (e.g. "-soundhw ac97,es1370"), which is used
                   when QB_AUDIO_DRV is set.
     QB_KERNEL_ROOT: Kernel's root (e.g. /dev/vda)
     QB_TAP_OPT: Network option for 'tap' mode (e.g.
                 "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no -device virtio-net-device,netdev=net0").
                  runqemu will replace "@TAP@" with the one that is used, such as tap0, tap1 ...
     QB_SLIRP_OPT: Network option for SLIRP mode (e.g. "-netdev user,id=net0 -device virtio-net-device,netdev=net0")
     QB_ROOTFS_OPT: Used as rootfs (e.g.
                    "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0").
                    runqemu will replace "@ROOTFS@" with the one which is used, such as
                    core-image-minimal-qemuarm64.ext4.
     QB_SERIAL_OPT: Serial port (e.g. "-serial mon:stdio")
     QB_TCPSERIAL_OPT: tcp serial port option (e.g.
                       " -device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device      virtconsole,chardev=virtcon"
                       runqemu will replace "@PORT@" with the port number which is used.
            

To use runqemu, set IMAGE_CLASSES as follows and run runqemu:

Note

For command-line syntax, use runqemu help.

     IMAGE_CLASSES += "qemuboot"
            

6.10.8. Default Linker Hash Style Changed

The default linker hash style for gcc-cross is now "sysv" in order to catch recipes that are building software without using the OpenEmbedded LDFLAGS. This change could result in seeing some "No GNU_HASH in the elf binary" QA issues when building such recipes. You need to fix these recipes so that they use the expected LDFLAGS. Depending on how the software is built, the build system used by the software (e.g. a Makefile) might need to be patched. However, sometimes making this fix is as simple as adding the following to the recipe:

     TARGET_CC_ARCH += "${LDFLAGS}"
            

6.10.9. KERNEL_IMAGE_BASE_NAME no Longer Uses KERNEL_IMAGETYPE

The KERNEL_IMAGE_BASE_NAME variable no longer uses the KERNEL_IMAGETYPE variable to create the image's base name. Because the OpenEmbedded build system can now build multiple kernel image types, this part of the kernel image base name as been removed leaving only the following:

     KERNEL_IMAGE_BASE_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}
            

If you have recipes or classes that use KERNEL_IMAGE_BASE_NAME directly, you might need to update the references to ensure they continue to work.

6.10.10. BitBake Changes

The following changes took place for BitBake:

  • The "goggle" UI and standalone image-writer tool have been removed as they both require GTK+ 2.0 and were not being maintained.

  • The Perforce fetcher now supports SRCREV for specifying the source revision to use, be it ${AUTOREV}, changelist number, p4date, or label, in preference to separate SRC_URI parameters to specify these. This change is more in-line with how the other fetchers work for source control systems. Recipes that fetch from Perforce will need to be updated to use SRCREV in place of specifying the source revision within SRC_URI.

  • Some of BitBake's internal code structures for accessing the recipe cache needed to be changed to support the new multi-configuration functionality. These changes will affect external tools that use BitBake's tinfoil module. For information on these changes, see the changes made to the scripts supplied with OpenEmbedded-Core: 1 and 2.

  • The task management code has been rewritten to avoid using ID indirection in order to improve performance. This change is unlikely to cause any problems for most users. However, the setscene verification function as pointed to by BB_SETSCENE_VERIFY_FUNCTION needed to change signature. Consequently, a new variable named BB_SETSCENE_VERIFY_FUNCTION2 has been added allowing multiple versions of BitBake to work with suitably written metadata, which includes OpenEmbedded-Core and Poky. Anyone with custom BitBake task scheduler code might also need to update the code to handle the new structure.

6.10.11. Swabber has Been Removed

Swabber, a tool that was intended to detect host contamination in the build process, has been removed, as it has been unmaintained and unused for some time and was never particularly effective. The OpenEmbedded build system has since incorporated a number of mechanisms including enhanced QA checks that mean that there is less of a need for such a tool.

6.10.12. Removed Recipes

The following recipes have been removed:

  • augeas: No longer needed and has been moved to meta-oe.

  • directfb: Unmaintained and has been moved to meta-oe.

  • gcc: Removed 4.9 version. Versions 5.4 and 6.2 are still present.

  • gnome-doc-utils: No longer needed.

  • gtk-doc-stub: Replaced by gtk-doc.

  • gtk-engines: No longer needed and has been moved to meta-gnome.

  • gtk-sato-engine: Became obsolete.

  • libglade: No longer needed and has been moved to meta-oe.

  • libmad: Unmaintained and functionally replaced by libmpg123. libmad has been moved to meta-oe.

  • libowl: Became obsolete.

  • libxsettings-client: No longer needed.

  • oh-puzzles: Functionally replaced by puzzles.

  • oprofileui: Became obsolete. OProfile has been largely supplanted by perf.

  • packagegroup-core-directfb.bb: Removed.

  • core-image-directfb.bb: Removed.

  • pointercal: No longer needed and has been moved to meta-oe.

  • python-imaging: No longer needed and moved to meta-python

  • python-pyrex: No longer needed and moved to meta-python.

  • sato-icon-theme: Became obsolete.

  • swabber-native: Swabber has been removed. See the entry on Swabber.

  • tslib: No longer needed and has been moved to meta-oe.

  • uclibc: Removed in favor of musl.

  • xtscal: No longer needed and moved to meta-oe

6.10.13. Removed Classes

The following classes have been removed:

  • distutils-native-base: No longer needed.

  • distutils3-native-base: No longer needed.

  • sdl: Only set DEPENDS and SECTION, which are better set within the recipe instead.

  • sip: Mostly unused.

  • swabber: See the entry on Swabber.

6.10.14. Minor Packaging Changes

The following minor packaging changes have occurred:

  • grub: Split grub-editenv into its own package.

  • systemd: Split container and vm related units into a new package, systemd-container.

  • util-linux: Moved prlimit to a separate util-linux-prlimit package.

6.10.15. Miscellaneous Changes

The following miscellaneous changes have occurred:

  • package_regex.inc: Removed because the definitions package_regex.inc previously contained have been moved to their respective recipes.

  • Both devtool add and recipetool create now use a fixed SRCREV by default when fetching from a Git repository. You can override this in either case to use ${AUTOREV} instead by using the -a or ‐‐autorev command-line option

  • distcc: GTK+ UI is now disabled by default.

  • packagegroup-core-tools-testapps: Removed Piglit.

  • image.bbclass: Renamed COMPRESS(ION) to CONVERSION. This change means that COMPRESSIONTYPES, COMPRESS_DEPENDS and COMPRESS_CMD are deprecated in favor of CONVERSIONTYPES, CONVERSION_DEPENDS and CONVERSION_CMD. The COMPRESS* variable names will still work in the 2.2 release but metadata that does not need to be backwards-compatible should be changed to use the new names as the COMPRESS* ones will be removed in a future release.

  • gtk-doc: A full version of gtk-doc is now made available. However, some old software might not be capable of using the current version of gtk-doc to build documentation. You need to change recipes that build such software so that they explicitly disable building documentation with gtk-doc.

6.11. Moving to the Yocto Project 2.3 Release

This section provides migration information for moving to the Yocto Project 2.3 Release from the prior release.

6.11.1. Recipe-specific Sysroots

The OpenEmbedded build system now uses one sysroot per recipe to resolve long-standing issues with configuration script auto-detection of undeclared dependencies. Consequently, you might find that some of your previously written custom recipes are missing declared dependencies, particularly those dependencies that are incidentally built earlier in a typical build process and thus are already likely to be present in the shared sysroot in previous releases.

Consider the following:

  • Declare Build-Time Dependencies: Because of this new feature, you must explicitly declare all build-time dependencies for your recipe. If you do not declare these dependencies, they are not populated into the sysroot for the recipe.

  • Specify Pre-Installation and Post-Installation Native Tool Dependencies: You must specifically specify any special native tool dependencies of pkg_preinst and pkg_postinst scripts by using the PACKAGE_WRITE_DEPS variable. Specifying these dependencies ensures that these tools are available if these scripts need to be run on the build host during the do_rootfs task.

    As an example, see the dbus recipe. You will see that this recipe has a pkg_postinst that calls systemctl if "systemd" is in DISTRO_FEATURES. In the example, systemd-systemctl-native is added to PACKAGE_WRITE_DEPS, which is also conditional on "systemd" being in DISTRO_FEATURES.

  • Examine Recipes that Use SSTATEPOSTINSTFUNCS: You need to examine any recipe that uses SSTATEPOSTINSTFUNCS and determine steps to take.

    Functions added to SSTATEPOSTINSTFUNCS are still called as they were in previous Yocto Project releases. However, since a separate sysroot is now being populated for every recipe and if existing functions being called through SSTATEPOSTINSTFUNCS are doing relocation, then you will need to change these to use a post-installation script that is installed by a function added to SYSROOT_PREPROCESS_FUNCS.

    For an example, see the pixbufcache class in meta/classes/ in the Yocto Project Source Repositories.

    Note

    The SSTATEPOSTINSTFUNCS variable itself is now deprecated in favor of the do_populate_sysroot[postfuncs] task. Consequently, if you do still have any function or functions that need to be called after the sysroot component is created for a recipe, then you would be well advised to take steps to use a post installation script as described previously. Taking these steps prepares your code for when SSTATEPOSTINSTFUNCS is removed in a future Yocto Project release.

  • Specify the Sysroot when Using Certain External Scripts: Because the shared sysroot is now gone, the scripts oe-find-native-sysroot and oe-run-native have been changed such that you need to specify which recipe's STAGING_DIR_NATIVE is used.

Note

You can find more information on how recipe-specific sysroots work in the "staging.bbclass" section.

6.11.2. PATH Variable

Within the environment used to run build tasks, the environment variable PATH is now sanitized such that the normal native binary paths (/bin, /sbin, /usr/bin and so forth) are removed and a directory containing symbolic links linking only to the binaries from the host mentioned in the HOSTTOOLS and HOSTTOOLS_NONFATAL variables is added to PATH.

Consequently, any native binaries provided by the host that you need to call needs to be in one of these two variables at the configuration level.

Alternatively, you can add a native recipe (i.e. -native) that provides the binary to the recipe's DEPENDS value.

Note

PATH is not sanitized in the same way within devshell. If it were, you would have difficulty running host tools for development and debugging within the shell.

6.11.3. Changes to Scripts

The following changes to scripts took place:

  • oe-find-native-sysroot: The usage for the oe-find-native-sysroot script has changed to the following:

         $ . oe-find-native-sysroot recipe
                        

    You must now supply a recipe for recipe as part of the command. Prior to the Yocto Project 2.4 release, it was not necessary to provide the script with the command.

  • oe-run-native: The usage for the oe-run-native script has changed to the following:

         $ oe-run-native native_recipe tool
                        

    You must supply the name of the native recipe and the tool you want to run as part of the command. Prior to the Yocto Project 2.4 release, it was not necessary to provide the native recipe with the command.

  • cleanup-workdir: The cleanup-workdir script has been removed because the script was found to be deleting files it should not have, which lead to broken build trees. Rather than trying to delete portions of TMPDIR and getting it wrong, it is recommended that you delete TMPDIR and have it restored from shared state (sstate) on subsequent builds.

  • wipe-sysroot: The wipe-sysroot script has been removed as it is no longer needed with recipe-specific sysroots.

6.11.4. Changes to Functions

The previously deprecated bb.data.getVar(), bb.data.setVar(), and related functions have been removed in favor of d.getVar(), d.setVar(), and so forth.

You need to fix any references to these old functions.

6.11.5. BitBake Changes

The following changes took place for BitBake:

  • BitBake's Graphical Dependency Explorer UI Replaced: BitBake's graphical dependency explorer UI depexp was replaced by taskexp ("Task Explorer"), which provides a graphical way of exploring the task-depends.dot file. The data presented by Task Explorer is much more accurate than the data that was presented by depexp. Being able to visualize the data is an often requested feature as standard *.dot file viewers cannot usual cope with the size of the task-depends.dot file.

  • BitBake "-g" Output Changes: The package-depends.dot and pn-depends.dot files as previously generated using the bitbake -g command have been removed. A recipe-depends.dot file is now generated as a collapsed version of task-depends.dot instead.

    The reason for this change is because package-depends.dot and pn-depends.dot largely date back to a time before task-based execution and do not take into account task-level dependencies between recipes, which could be misleading.

  • Mirror Variable Splitting Changes: Mirror variables including MIRRORS, PREMIRRORS, and SSTATE_MIRRORS can now separate values entirely with spaces. Consequently, you no longer need "\\n". BitBake looks for pairs of values, which simplifies usage. There should be no change required to existing mirror variable values themselves.

  • The Subversion (SVN) Fetcher Uses an "ssh" Parameter and Not an "rsh" Parameter: The SVN fetcher now takes an "ssh" parameter instead of an "rsh" parameter. This new optional parameter is used when the "protocol" parameter is set to "svn+ssh". You can only use the new parameter to specify the ssh program used by SVN. The SVN fetcher passes the new parameter through the SVN_SSH environment variable during the do_fetch task.

    See the "Subversion (SVN) Fetcher (svn://)" section in the Yocto Project BitBake User Manual for additional information.

  • BB_SETSCENE_VERIFY_FUNCTION and BB_SETSCENE_VERIFY_FUNCTION2 Removed: Because the mechanism they were part of is no longer necessary with recipe-specific sysroots, the BB_SETSCENE_VERIFY_FUNCTION and BB_SETSCENE_VERIFY_FUNCTION2 variables have been removed.

Absolute symbolic links (symlinks) within staged files are no longer permitted and now trigger an error. Any explicit creation of symlinks can use the lnr script, which is a replacement for ln -r.

If the build scripts in the software that the recipe is building are creating a number of absolute symlinks that need to be corrected, you can inherit relative_symlinks within the recipe to turn those absolute symlinks into relative symlinks.

6.11.7. GPLv2 Versions of GPLv3 Recipes Moved

Older GPLv2 versions of GPLv3 recipes have moved to a separate meta-gplv2 layer.

If you use INCOMPATIBLE_LICENSE to exclude GPLv3 or set PREFERRED_VERSION to substitute a GPLv2 version of a GPLv3 recipe, then you must add the meta-gplv2 layer to your configuration.

Note

You can find meta-gplv2 layer in the OpenEmbedded layer index at https://layers.openembedded.org/layerindex/branch/master/layer/meta-gplv2/.

These relocated GPLv2 recipes do not receive the same level of maintenance as other core recipes. The recipes do not get security fixes and upstream no longer maintains them. In fact, the upstream community is actively hostile towards people that use the old versions of the recipes. Moving these recipes into a separate layer both makes the different needs of the recipes clearer and clearly identifies the number of these recipes.

Note

The long-term solution might be to move to BSD-licensed replacements of the GPLv3 components for those that need to exclude GPLv3-licensed components from the target system. This solution will be investigated for future Yocto Project releases.

6.11.8. Package Management Changes

The following package management changes took place:

  • Smart package manager is replaced by DNF package manager. Smart has become unmaintained upstream, is not ported to Python 3.x. Consequently, Smart needed to be replaced. DNF is the only feasible candidate.

    The change in functionality is that the on-target runtime package management from remote package feeds is now done with a different tool that has a different set of command-line options. If you have scripts that call the tool directly, or use its API, they need to be fixed.

    For more information, see the DNF Documentation.

  • Rpm 5.x is replaced with Rpm 4.x. This is done for two major reasons:

    • DNF is API-incompatible with Rpm 5.x and porting it and maintaining the port is non-trivial.

    • Rpm 5.x itself has limited maintenance upstream, and the Yocto Project is one of the very few remaining users.

  • Berkeley DB 6.x is removed and Berkeley DB 5.x becomes the default:

    • Version 6.x of Berkeley DB has largely been rejected by the open source community due to its AGPLv3 license. As a result, most mainstream open source projects that require DB are still developed and tested with DB 5.x.

    • In OE-core, the only thing that was requiring DB 6.x was Rpm 5.x. Thus, no reason exists to continue carrying DB 6.x in OE-core.

  • createrepo is replaced with createrepo_c.

    createrepo_c is the current incarnation of the tool that generates remote repository metadata. It is written in C as compared to createrepo, which is written in Python. createrepo_c is faster and is maintained.

  • Architecture-independent RPM packages are "noarch" instead of "all".

    This change was made because too many places in DNF/RPM4 stack already make that assumption. Only the filenames and the architecture tag has changed. Nothing else has changed in OE-core system, particularly in the allarch.bbclass class.

  • Signing of remote package feeds using PACKAGE_FEED_SIGN is not currently supported. This issue will be fully addressed in a future Yocto Project release. See defect 11209 for more information on a solution to package feed signing with RPM in the Yocto Project 2.3 release.

  • OPKG now uses the libsolv backend for resolving package dependencies by default. This is vastly superior to OPKG's internal ad-hoc solver that was previously used. This change does have a small impact on disk (around 500 KB) and memory footprint.

    Note

    For further details on this change, see the commit message.

6.11.9. Removed Recipes

The following recipes have been removed:

  • linux-yocto 4.8: Version 4.8 has been removed. Versions 4.1 (LTSI), 4.4 (LTS), 4.9 (LTS/LTSI) and 4.10 are now present.

  • python-smartpm: Functionally replaced by dnf.

  • createrepo: Replaced by the createrepo-c recipe.

  • rpmresolve: No longer needed with the move to RPM 4 as RPM itself is used instead.

  • gstreamer: Removed the GStreamer Git version recipes as they have been stale. 1.10.x recipes are still present.

  • alsa-conf-base: Merged into alsa-conf since libasound depended on both. Essentially, no way existed to install only one of these.

  • tremor: Moved to meta-multimedia. Fixed-integer Vorbis decoding is not needed by current hardware. Thus, GStreamer's ivorbis plugin has been disabled by default eliminating the need for the tremor recipe in OE-Core.

  • gummiboot: Replaced by systemd-boot.

6.11.10. Wic Changes

The following changes have been made to Wic:

Note

For more information on Wic, see the "Creating Partitioned Images Using Wic" section in the Yocto Project Development Tasks Manual.

  • Default Output Directory Changed: Wic's default output directory is now the current directory by default instead of the unusual /var/tmp/wic.

    The "-o" and "--outdir" options remain unchanged and are used to specify your preferred output directory if you do not want to use the default directory.

  • fsimage Plug-in Removed: The Wic fsimage plug-in has been removed as it duplicates functionality of the rawcopy plug-in.

6.11.11. QA Changes

The following QA checks have changed:

  • unsafe-references-in-binaries: The unsafe-references-in-binaries QA check, which was disabled by default, has now been removed. This check was intended to detect binaries in /bin that link to libraries in /usr/lib and have the case where the user has /usr on a separate filesystem to /.

    The removed QA check was buggy. Additionally, /usr residing on a separate partition from / is now a rare configuration. Consequently, unsafe-references-in-binaries was removed.

  • file-rdeps: The file-rdeps QA check is now an error by default instead of a warning. Because it is an error instead of a warning, you need to address missing runtime dependencies.

    For additional information, see the insane class and the "Errors and Warnings" section.

6.11.12. Miscellaneous Changes

The following miscellaneous changes have occurred:

  • In this release, a number of recipes have been changed to ignore the largefile DISTRO_FEATURES item, enabling large file support unconditionally. This feature has always been enabled by default. Disabling the feature has not been widely tested.

    Note

    Future releases of the Yocto Project will remove entirely the ability to disable the largefile feature, which would make it unconditionally enabled everywhere.

  • If the DISTRO_VERSION value contains the value of the DATE variable, which is the default between Poky releases, the DATE value is explicitly excluded from /etc/issue and /etc/issue.net, which is displayed at the login prompt, in order to avoid conflicts with Multilib enabled. Regardless, the DATE value is inaccurate if the base-files recipe is restored from shared state (sstate) rather than rebuilt.

    If you need the build date recorded in /etc/issue* or anywhere else in your image, a better method is to define a post-processing function to do it and have the function called from ROOTFS_POSTPROCESS_COMMAND. Doing so ensures the value is always up-to-date with the created image.

  • Dropbear's init script now disables DSA host keys by default. This change is in line with the systemd service file, which supports RSA keys only, and with recent versions of OpenSSH, which deprecates DSA host keys.

  • The buildhistory class now correctly uses tabs as separators between all columns in installed-package-sizes.txt in order to aid import into other tools.

  • The USE_LDCONFIG variable has been replaced with the "ldconfig" DISTRO_FEATURES feature. Distributions that previously set:

         USE_LDCONFIG = "0"
                        

    should now instead use the following:

         DISTRO_FEATURES_BACKFILL_CONSIDERED_append = " ldconfig"
                        

  • The default value of COPYLEFT_LICENSE_INCLUDE now includes all versions of AGPL licenses in addition to GPL and LGPL.

    Note

    The default list is not intended to be guaranteed as a complete safe list. You should seek legal advice based on what you are distributing if you are unsure.

  • Kernel module packages are now suffixed with the kernel version in order to allow module packages from multiple kernel versions to co-exist on a target system. If you wish to return to the previous naming scheme that does not include the version suffix, use the following:

         KERNEL_MODULE_PACKAGE_SUFFIX to ""
                        

  • Removal of libtool *.la files is now enabled by default. The *.la files are not actually needed on Linux and relocating them is an unnecessary burden.

    If you need to preserve these .la files (e.g. in a custom distribution), you must change INHERIT_DISTRO such that "remove-libtool" is not included in the value.

  • Extensible SDKs built for GCC 5+ now refuse to install on a distribution where the host GCC version is 4.8 or 4.9. This change resulted from the fact that the installation is known to fail due to the way the uninative shared state (sstate) package is built. See the uninative class for additional information.

  • All native and nativesdk recipes now use a separate DISTRO_FEATURES value instead of sharing the value used by recipes for the target, in order to avoid unnecessary rebuilds.

    The DISTRO_FEATURES for native recipes is DISTRO_FEATURES_NATIVE added to an intersection of DISTRO_FEATURES and DISTRO_FEATURES_FILTER_NATIVE.

    For nativesdk recipes, the corresponding variables are DISTRO_FEATURES_NATIVESDK and DISTRO_FEATURES_FILTER_NATIVESDK.

  • The FILESDIR variable, which was previously deprecated and rarely used, has now been removed. You should change any recipes that set FILESDIR to set FILESPATH instead.

  • The MULTIMACH_HOST_SYS variable has been removed as it is no longer needed with recipe-specific sysroots.

6.12. Moving to the Yocto Project 2.4 Release

This section provides migration information for moving to the Yocto Project 2.4 Release from the prior release.

6.12.1. Memory Resident Mode

A persistent mode is now available in BitBake's default operation, replacing its previous "memory resident mode" (i.e. oe-init-build-env-memres). Now you only need to set BB_SERVER_TIMEOUT to a timeout (in seconds) and BitBake's server stays resident for that amount of time between invocations. The oe-init-build-env-memres script has been removed since a separate environment setup script is no longer needed.

6.12.2. Packaging Changes

This section provides information about packaging changes that have ocurred:

  • python3 Changes:

    • The main "python3" package now brings in all of the standard Python 3 distribution rather than a subset. This behavior matches what is expected based on traditional Linux distributions. If you wish to install a subset of Python 3, specify python-core plus one or more of the individual packages that are still produced.

    • python3: The bz2.py, lzma.py, and _compression.py scripts have been moved from the python3-misc package to the python3-compression package.

  • binutils: The libbfd library is now packaged in a separate "libbfd" package. This packaging saves space when certain tools (e.g. perf) are installed. In such cases, the tools only need libbfd rather than all the packages in binutils.

  • util-linux Changes:

    • The su program is now packaged in a separate "util-linux-su" package, which is only built when "pam" is listed in the DISTRO_FEATURES variable. util-linux should not be installed unless it is needed because su is normally provided through the shadow file format. The main util-linux package has runtime dependencies (i.e. RDEPENDS) on the util-linux-su package when "pam" is in DISTRO_FEATURES.

    • The switch_root program is now packaged in a separate "util-linux-switch-root" package for small initramfs images that do not need the whole util-linux package or the busybox binary, which are both much larger than switch_root. The main util-linux package has a recommended runtime dependency (i.e. RRECOMMENDS) on the util-linux-switch-root package.

    • The ionice program is now packaged in a separate "util-linux-ionice" package. The main util-linux package has a recommended runtime dependency (i.e. RRECOMMENDS) on the util-linux-ionice package.

  • initscripts: The sushell program is now packaged in a separate "initscripts-sushell" package. This packaging change allows systems to pull sushell in when selinux is enabled. The change also eliminates needing to pull in the entire initscripts package. The main initscripts package has a runtime dependency (i.e. RDEPENDS) on the sushell package when "selinux" is in DISTRO_FEATURES.

  • glib-2.0: The glib-2.0 package now has a recommended runtime dependency (i.e. RRECOMMENDS) on the shared-mime-info package, since large portions of GIO are not useful without the MIME database. You can remove the dependency by using the BAD_RECOMMENDATIONS variable if shared-mime-info is too large and is not required.

  • Go Standard Runtime: The Go standard runtime has been split out from the main go recipe into a separate go-runtime recipe.

6.12.3. Removed Recipes

The following recipes have been removed:

  • acpitests: This recipe is not maintained.

  • autogen-native: No longer required by Grub, oe-core, or meta-oe.

  • bdwgc: Nothing in OpenEmbedded-Core requires this recipe. It has moved to meta-oe.

  • byacc: This recipe was only needed by rpm 5.x and has moved to meta-oe.

  • gcc (5.4): The 5.4 series dropped the recipe in favor of 6.3 / 7.2.

  • gnome-common: Deprecated upstream and no longer needed.

  • go-bootstrap-native: Go 1.9 does its own bootstrapping so this recipe has been removed.

  • guile: This recipe was only needed by autogen-native and remake. The recipe is no longer needed by either of these programs.

  • libclass-isa-perl: This recipe was previously needed for LSB 4, no longer needed.

  • libdumpvalue-perl: This recipe was previously needed for LSB 4, no longer needed.

  • libenv-perl: This recipe was previously needed for LSB 4, no longer needed.

  • libfile-checktree-perl: This recipe was previously needed for LSB 4, no longer needed.

  • libi18n-collate-perl: This recipe was previously needed for LSB 4, no longer needed.

  • libiconv: This recipe was only needed for uclibc, which was removed in the previous release. glibc and musl have their own implementations. meta-mingw still needs libiconv, so it has been moved to meta-mingw.

  • libpng12: This recipe was previously needed for LSB. The current libpng is 1.6.x.

  • libpod-plainer-perl: This recipe was previously needed for LSB 4, no longer needed.

  • linux-yocto (4.1): This recipe was removed in favor of 4.4, 4.9, 4.10 and 4.12.

  • mailx: This recipe was previously only needed for LSB compatibility, and upstream is defunct.

  • mesa (git version only): The git version recipe was stale with respect to the release version.

  • ofono (git version only): The git version recipe was stale with respect to the release version.

  • portmap: This recipe is obsolete and is superseded by rpcbind.

  • python3-pygpgme: This recipe is old and unmaintained. It was previously required by dnf, which has switched to official gpgme Python bindings.

  • python-async: This recipe has been removed in favor of the Python 3 version.

  • python-gitdb: This recipe has been removed in favor of the Python 3 version.

  • python-git: This recipe was removed in favor of the Python 3 version.

  • python-mako: This recipe was removed in favor of the Python 3 version.

  • python-pexpect: This recipe was removed in favor of the Python 3 version.

  • python-ptyprocess: This recipe was removed in favor of Python the 3 version.

  • python-pycurl: Nothing is using this recipe in OpenEmbedded-Core (i.e. meta-oe).

  • python-six: This recipe was removed in favor of the Python 3 version.

  • python-smmap: This recipe was removed in favor of the Python 3 version.

  • remake: Using remake as the provider of virtual/make is broken. Consequently, this recipe is not needed in OpenEmbedded-Core.

6.12.4. Kernel Device Tree Move

Kernel Device Tree support is now easier to enable in a kernel recipe. The Device Tree code has moved to a kernel-devicetree class. Functionality is automatically enabled for any recipe that inherits the kernel class and sets the KERNEL_DEVICETREE variable. The previous mechanism for doing this, meta/recipes-kernel/linux/linux-dtb.inc, is still available to avoid breakage, but triggers a deprecation warning. Future releases of the Yocto Project will remove meta/recipes-kernel/linux/linux-dtb.inc. It is advisable to remove any require statements that request meta/recipes-kernel/linux/linux-dtb.inc from any custom kernel recipes you might have. This will avoid breakage in post 2.4 releases.

6.12.5. Package QA Changes

The following package QA changes took place:

  • The "unsafe-references-in-scripts" QA check has been removed.

  • If you refer to ${COREBASE}/LICENSE within LIC_FILES_CHKSUM you receive a warning because this file is a description of the license for OE-Core. Use ${COMMON_LICENSE_DIR}/MIT if your recipe is MIT-licensed and you cannot use the preferred method of referring to a file within the source tree.

6.12.6. README File Changes

The following are changes to README files:

  • The main Poky README file has been moved to the meta-poky layer and has been renamed README.poky. A symlink has been created so that references to the old location work.

  • The README.hardware file has been moved to meta-yocto-bsp. A symlink has been created so that references to the old location work.

  • A README.qemu file has been created with coverage of the qemu* machines.

6.12.7. Miscellaneous Changes

The following are additional changes:

  • The ROOTFS_PKGMANAGE_BOOTSTRAP variable and any references to it have been removed. You should remove this variable from any custom recipes.

  • The meta-yocto directory has been removed.

    Note

    In the Yocto Project 2.1 release meta-yocto was renamed to meta-poky and the meta-yocto subdirectory remained to avoid breaking existing configurations.

  • The maintainers.inc file, which tracks maintainers by listing a primary person responsible for each recipe in OE-Core, has been moved from meta-poky to OE-Core (i.e. from meta-poky/conf/distro/include to meta/conf/distro/include).

  • The buildhistory class now makes a single commit per build rather than one commit per subdirectory in the repository. This behavior assumes the commits are enabled with BUILDHISTORY_COMMIT = "1", which is typical. Previously, the buildhistory class made one commit per subdirectory in the repository in order to make it easier to see the changes for a particular subdirectory. To view a particular change, specify that subdirectory as the last parameter on the git show or git diff commands.

  • The x86-base.inc file, which is included by all x86-based machine configurations, now sets IMAGE_FSTYPES using ?= to "live" rather than appending with +=. This change makes the default easier to override.

  • BitBake fires multiple "BuildStarted" events when multiconfig is enabled (one per configuration). For more information, see the "Events" in the BitBake User Manual.

  • By default, the security_flags.inc file sets a GCCPIE variable with an option to enable Position Independent Executables (PIE) within gcc. Enabling PIE in the GNU C Compiler (GCC), makes Return Oriented Programming (ROP) attacks much more difficult to execute.

  • OE-Core now provides a bitbake-layers plugin that implements a "create-layer" subcommand. The implementation of this subcommand has resulted in the yocto-layer script being deprecated and will likely be removed in the next Yocto Project release.

  • The vmdk, vdi, and qcow2 image file types are now used in conjunction with the "wic" image type through CONVERSION_CMD. Consequently, the equivalent image types are now wic.vmdk, wic.vdi, and wic.qcow2, respectively.

  • do_image_<type>[depends] has replaced IMAGE_DEPENDS_<type>. If you have your own classes that implement custom image types, then you need to update them.

  • OpenSSL 1.1 has been introduced. However, the default is still 1.0.x through the PREFERRED_VERSION variable. This preference is set is due to the remaining compatibility issues with other software. The PROVIDES variable in the openssl 1.0 recipe now includes "openssl10" as a marker that can be used in DEPENDS within recipes that build software that still depend on OpenSSL 1.0.

  • To ensure consistent behavior, BitBake's "-r" and "-R" options (i.e. prefile and postfile), which are used to read or post-read additional configuration files from the command line, now only affect the current BitBake command. Before these BitBake changes, these options would "stick" for future executions.

Chapter 7. Source Directory Structure

Table of Contents

7.1. Top-Level Core Components
7.1.1. bitbake/
7.1.2. build/
7.1.3. documentation/
7.1.4. meta/
7.1.5. meta-poky/
7.1.6. meta-yocto-bsp/
7.1.7. meta-selftest/
7.1.8. meta-skeleton/
7.1.9. scripts/
7.1.10. oe-init-build-env
7.1.11. LICENSE, README, and README.hardware
7.2. The Build Directory - build/
7.2.1. build/buildhistory
7.2.2. build/conf/local.conf
7.2.3. build/conf/bblayers.conf
7.2.4. build/conf/sanity_info
7.2.5. build/downloads/
7.2.6. build/sstate-cache/
7.2.7. build/tmp/
7.2.8. build/tmp/buildstats/
7.2.9. build/tmp/cache/
7.2.10. build/tmp/deploy/
7.2.11. build/tmp/deploy/deb/
7.2.12. build/tmp/deploy/rpm/
7.2.13. build/tmp/deploy/ipk/
7.2.14. build/tmp/deploy/licenses/
7.2.15. build/tmp/deploy/images/
7.2.16. build/tmp/deploy/sdk/
7.2.17. build/tmp/sstate-control/
7.2.18. build/tmp/sysroots-components/
7.2.19. build/tmp/sysroots/
7.2.20. build/tmp/stamps/
7.2.21. build/tmp/log/
7.2.22. build/tmp/work/
7.2.23. build/tmp/work/tunearch/recipename/version/
7.2.24. build/tmp/work-shared/
7.3. The Metadata - meta/
7.3.1. meta/classes/
7.3.2. meta/conf/
7.3.3. meta/conf/machine/
7.3.4. meta/conf/distro/
7.3.5. meta/conf/machine-sdk/
7.3.6. meta/files/
7.3.7. meta/lib/
7.3.8. meta/recipes-bsp/
7.3.9. meta/recipes-connectivity/
7.3.10. meta/recipes-core/
7.3.11. meta/recipes-devtools/
7.3.12. meta/recipes-extended/
7.3.13. meta/recipes-gnome/
7.3.14. meta/recipes-graphics/
7.3.15. meta/recipes-kernel/
7.3.16. meta/recipes-lsb4/
7.3.17. meta/recipes-multimedia/
7.3.18. meta/recipes-rt/
7.3.19. meta/recipes-sato/
7.3.20. meta/recipes-support/
7.3.21. meta/site/
7.3.22. meta/recipes.txt

The Source Directory consists of several components. Understanding them and knowing where they are located is key to using the Yocto Project well. This chapter describes the Source Directory and gives information about the various files and directories.

For information on how to establish a local Source Directory on your development system, see the "Working With Yocto Project Source Files" section in the Yocto Project Development Tasks Manual.

Note

The OpenEmbedded build system does not support file or directory names that contain spaces. Be sure that the Source Directory you use does not contain these types of names.

7.1. Top-Level Core Components

This section describes the top-level components of the Source Directory.

7.1.1. bitbake/

This directory includes a copy of BitBake for ease of use. The copy usually matches the current stable BitBake release from the BitBake project. BitBake, a Metadata interpreter, reads the Yocto Project Metadata and runs the tasks defined by that data. Failures are usually from the Metadata and not from BitBake itself. Consequently, most users do not need to worry about BitBake.

When you run the bitbake command, the main BitBake executable, which resides in the bitbake/bin/ directory, starts. Sourcing the environment setup script (i.e. oe-init-build-env) places the scripts and bitbake/bin directories (in that order) into the shell's PATH environment variable.

For more information on BitBake, see the BitBake User Manual.

7.1.2. build/

This directory contains user configuration files and the output generated by the OpenEmbedded build system in its standard configuration where the source tree is combined with the output. The Build Directory is created initially when you source the OpenEmbedded build environment setup script (i.e. oe-init-build-env).

It is also possible to place output and configuration files in a directory separate from the Source Directory by providing a directory name when you source the setup script. For information on separating output from your local Source Directory files, see the "oe-init-build-env" section.

7.1.3. documentation/

This directory holds the source for the Yocto Project documentation as well as templates and tools that allow you to generate PDF and HTML versions of the manuals. Each manual is contained in a sub-folder. For example, the files for this manual reside in the ref-manual/ directory.

7.1.4. meta/

This directory contains the OpenEmbedded Core metadata. The directory holds recipes, common classes, and machine configuration for emulated targets (qemux86, qemuarm, and so forth.)

7.1.5. meta-poky/

This directory contains the configuration for the Poky reference distribution.

7.1.6. meta-yocto-bsp/

This directory contains the Yocto Project reference hardware Board Support Packages (BSPs). For more information on BSPs, see the Yocto Project Board Support Package (BSP) Developer's Guide.

7.1.7. meta-selftest/

This directory adds additional recipes and append files used by the OpenEmbedded selftests to verify the behavior of the build system.

You do not have to add this layer to your bblayers.conf file unless you want to run the selftests.

7.1.8. meta-skeleton/

This directory contains template recipes for BSP and kernel development.

7.1.9. scripts/

This directory contains various integration scripts that implement extra functionality in the Yocto Project environment (e.g. QEMU scripts). The oe-init-build-env script appends this directory to the shell's PATH environment variable.

The scripts directory has useful scripts that assist in contributing back to the Yocto Project, such as create-pull-request and send-pull-request.

7.1.10. oe-init-build-env

This script sets up the OpenEmbedded build environment. Running this script with the source command in a shell makes changes to PATH and sets other core BitBake variables based on the current working directory. You need to run an environment setup script before running BitBake commands. The script uses other scripts within the scripts directory to do the bulk of the work.

When you run this script, your Yocto Project environment is set up, a Build Directory is created, your working directory becomes the Build Directory, and you are presented with a list of common BitBake targets. Here is an example:

     $ source oe-init-build-env

     ### Shell environment set up for builds. ###

     You can now run 'bitbake <target>'

     Common targets are:
         core-image-minimal
         core-image-sato
         meta-toolchain
         meta-ide-support

     You can also run generated qemu images with a command like 'runqemu qemux86'
            

The script gets its default list of common targets from the conf-notes.txt file, which is found in the meta-poky directory within the Source Directory. Should you have custom distributions, it is very easy to modify this configuration file to include your targets for your distribution. See the "Creating a Custom Template Configuration Directory" section in the Yocto Project Development Tasks Manual for more information.

By default, running this script without a Build Directory argument creates the build directory in your current working directory. If you provide a Build Directory argument when you source the script, you direct the OpenEmbedded build system to create a Build Directory of your choice. For example, the following command creates a Build Directory named mybuilds that is outside of the Source Directory:

     $ source oe-init-build-env ~/mybuilds
            

The OpenEmbedded build system uses the template configuration files, which are found by default in the meta-poky/conf directory in the Source Directory. See the "Creating a Custom Template Configuration Directory" section in the Yocto Project Development Tasks Manual for more information.

Note

The OpenEmbedded build system does not support file or directory names that contain spaces. If you attempt to run the oe-init-build-env script from a Source Directory that contains spaces in either the filenames or directory names, the script returns an error indicating no such file or directory. Be sure to use a Source Directory free of names containing spaces.

7.1.11. LICENSE, README, and README.hardware

These files are standard top-level files.

7.2. The Build Directory - build/

The OpenEmbedded build system creates the Build Directory when you run the build environment setup scripts (i.e. oe-init-build-env).

If you do not give the Build Directory a specific name when you run a setup script, the name defaults to build.

The TOPDIR variable points to the Build Directory.

7.2.1. build/buildhistory

The OpenEmbedded build system creates this directory when you enable the build history feature. The directory tracks build information into image, packages, and SDK subdirectories. For information on the build history feature, see the "Maintaining Build Output Quality" section.

7.2.2. build/conf/local.conf

This configuration file contains all the local user configurations for your build environment. The local.conf file contains documentation on the various configuration options. Any variable set here overrides any variable set elsewhere within the environment unless that variable is hard-coded within a file (e.g. by using '=' instead of '?='). Some variables are hard-coded for various reasons but these variables are relatively rare.

Edit this file to set the MACHINE for which you want to build, which package types you wish to use (PACKAGE_CLASSES), and the location from which you want to access downloaded files (DL_DIR).

If local.conf is not present when you start the build, the OpenEmbedded build system creates it from local.conf.sample when you source the top-level build environment setup script (i.e. oe-init-build-env).

The source local.conf.sample file used depends on the $TEMPLATECONF script variable, which defaults to meta-poky/conf when you are building from the Yocto Project development environment and defaults to meta/conf when you are building from the OpenEmbedded Core environment. Because the script variable points to the source of the local.conf.sample file, this implies that you can configure your build environment from any layer by setting the variable in the top-level build environment setup script as follows:

     TEMPLATECONF=your_layer/conf
            

Once the build process gets the sample file, it uses sed to substitute final ${OEROOT} values for all ##OEROOT## values.

Note

You can see how the TEMPLATECONF variable is used by looking at the scripts/oe-setup-builddir script in the Source Directory. You can find the Yocto Project version of the local.conf.sample file in the meta-poky/conf directory.

7.2.3. build/conf/bblayers.conf

This configuration file defines layers, which are directory trees, traversed (or walked) by BitBake. The bblayers.conf file uses the BBLAYERS variable to list the layers BitBake tries to find.

If bblayers.conf is not present when you start the build, the OpenEmbedded build system creates it from bblayers.conf.sample when you source the top-level build environment setup script (i.e. oe-init-build-env).

The source bblayers.conf.sample file used depends on the $TEMPLATECONF script variable, which defaults to meta-poky/conf when you are building from the Yocto Project development environment and defaults to meta/conf when you are building from the OpenEmbedded Core environment. Because the script variable points to the source of the bblayers.conf.sample file, this implies that you can base your build from any layer by setting the variable in the top-level build environment setup script as follows:

     TEMPLATECONF=your_layer/conf
            

Once the build process gets the sample file, it uses sed to substitute final ${OEROOT} values for all ##OEROOT## values.

Note

You can see how the TEMPLATECONF variable scripts/oe-setup-builddir script in the Source Directory. You can find the Yocto Project version of the bblayers.conf.sample file in the meta-poky/conf directory.

7.2.4. build/conf/sanity_info

This file indicates the state of the sanity checks and is created during the build.

7.2.5. build/downloads/

This directory contains downloaded upstream source tarballs. You can reuse the directory for multiple builds or move the directory to another location. You can control the location of this directory through the DL_DIR variable.

7.2.6. build/sstate-cache/

This directory contains the shared state cache. You can reuse the directory for multiple builds or move the directory to another location. You can control the location of this directory through the SSTATE_DIR variable.

7.2.7. build/tmp/

The OpenEmbedded build system creates and uses this directory for all the build system's output. The TMPDIR variable points to this directory.

BitBake creates this directory if it does not exist. As a last resort, to clean up a build and start it from scratch (other than the downloads), you can remove everything in the tmp directory or get rid of the directory completely. If you do, you should also completely remove the build/sstate-cache directory.

7.2.8. build/tmp/buildstats/

This directory stores the build statistics.

7.2.9. build/tmp/cache/

When BitBake parses the metadata (recipes and configuration files), it caches the results in build/tmp/cache/ to speed up future builds. The results are stored on a per-machine basis.

During subsequent builds, BitBake checks each recipe (together with, for example, any files included or appended to it) to see if they have been modified. Changes can be detected, for example, through file modification time (mtime) changes and hashing of file contents. If no changes to the file are detected, then the parsed result stored in the cache is reused. If the file has changed, it is reparsed.

7.2.10. build/tmp/deploy/

This directory contains any "end result" output from the OpenEmbedded build process. The DEPLOY_DIR variable points to this directory. For more detail on the contents of the deploy directory, see the "Images" and "Application Development SDK" sections.

7.2.11. build/tmp/deploy/deb/

This directory receives any .deb packages produced by the build process. The packages are sorted into feeds for different architecture types.

7.2.12. build/tmp/deploy/rpm/

This directory receives any .rpm packages produced by the build process. The packages are sorted into feeds for different architecture types.

7.2.13. build/tmp/deploy/ipk/

This directory receives .ipk packages produced by the build process.

7.2.14. build/tmp/deploy/licenses/

This directory receives package licensing information. For example, the directory contains sub-directories for bash, busybox, and glibc (among others) that in turn contain appropriate COPYING license files with other licensing information. For information on licensing, see the "Maintaining Open Source License Compliance During Your Product's Lifecycle" section in the Yocto Project Development Tasks Manual.

7.2.15. build/tmp/deploy/images/

This directory receives complete filesystem images. If you want to flash the resulting image from a build onto a device, look here for the image.

Be careful when deleting files in this directory. You can safely delete old images from this directory (e.g. core-image-*). However, the kernel (*zImage*, *uImage*, etc.), bootloader and other supplementary files might be deployed here prior to building an image. Because these files are not directly produced from the image, if you delete them they will not be automatically re-created when you build the image again.

If you do accidentally delete files here, you will need to force them to be re-created. In order to do that, you will need to know the target that produced them. For example, these commands rebuild and re-create the kernel files:

     $ bitbake -c clean virtual/kernel
     $ bitbake virtual/kernel
            

7.2.16. build/tmp/deploy/sdk/

The OpenEmbedded build system creates this directory to hold toolchain installer scripts, which when executed, install the sysroot that matches your target hardware. You can find out more about these installers in the "Building an SDK Installer" section in the Yocto Project Application Development and the Extensible Software Development Kit (eSDK) manual.

7.2.17. build/tmp/sstate-control/

The OpenEmbedded build system uses this directory for the shared state manifest files. The shared state code uses these files to record the files installed by each sstate task so that the files can be removed when cleaning the recipe or when a newer version is about to be installed. The build system also uses the manifests to detect and produce a warning when files from one task are overwriting those from another.

7.2.18. build/tmp/sysroots-components/

This directory is the location of the sysroot contents that the task do_prepare_recipe_sysroot links or copies into the recipe-specific sysroot for each recipe listed in DEPENDS. Population of this directory is handled through shared state, while the path is specified by the COMPONENTS_DIR variable. Apart from a few unusual circumstances, handling of the sysroots-components directory should be automatic, and recipes should not directly reference build/tmp/sysroots-components.

7.2.19. build/tmp/sysroots/

Previous versions of the OpenEmbedded build system used to create a global shared sysroot per machine along with a native sysroot. Beginning with the 2.4 version of the Yocto Project, sysroots exist in recipe-specific WORKDIR directories. Thus, the build/tmp/sysroots/ directory is unused.

Note

The build/tmp/sysroots/ directory can still be populated using the bitbake build-sysroots command and can be used for compatibility in some cases. However, in general it is not recommended to populate this directory. Individual recipe-specific sysroots should be used.

7.2.20. build/tmp/stamps/

This directory holds information that BitBake uses for accounting purposes to track what tasks have run and when they have run. The directory is sub-divided by architecture, package name, and version. Following is an example:

     stamps/all-poky-linux/distcc-config/1.0-r0.do_build-2fdd....2do
            

Although the files in the directory are empty of data, BitBake uses the filenames and timestamps for tracking purposes.

For information on how BitBake uses stamp files to determine if a task should be rerun, see the "Stamp Files and the Rerunning of Tasks" section.

7.2.21. build/tmp/log/

This directory contains general logs that are not otherwise placed using the package's WORKDIR. Examples of logs are the output from the do_check_pkg or do_distro_check tasks. Running a build does not necessarily mean this directory is created.

7.2.22. build/tmp/work/

This directory contains architecture-specific work sub-directories for packages built by BitBake. All tasks execute from the appropriate work directory. For example, the source for a particular package is unpacked, patched, configured and compiled all within its own work directory. Within the work directory, organization is based on the package group and version for which the source is being compiled as defined by the WORKDIR.

It is worth considering the structure of a typical work directory. As an example, consider linux-yocto-kernel-3.0 on the machine qemux86 built within the Yocto Project. For this package, a work directory of tmp/work/qemux86-poky-linux/linux-yocto/3.0+git1+<.....>, referred to as the WORKDIR, is created. Within this directory, the source is unpacked to linux-qemux86-standard-build and then patched by Quilt. (See the "Using Quilt in Your Workflow" section in the Yocto Project Development Tasks Manual for more information.) Within the linux-qemux86-standard-build directory, standard Quilt directories linux-3.0/patches and linux-3.0/.pc are created, and standard Quilt commands can be used.

There are other directories generated within WORKDIR. The most important directory is WORKDIR/temp/, which has log files for each task (log.do_*.pid) and contains the scripts BitBake runs for each task (run.do_*.pid). The WORKDIR/image/ directory is where "make install" places its output that is then split into sub-packages within WORKDIR/packages-split/.

7.2.23. build/tmp/work/tunearch/recipename/version/

The recipe work directory - ${WORKDIR}.

As described earlier in the "build/tmp/sysroots/" section, beginning with the 2.4 release of the Yocto Project, the OpenEmbedded build system builds each recipe in its own work directory (i.e. WORKDIR). The path to the work directory is constructed using the architecture of the given build (e.g. TUNE_PKGARCH, MACHINE_ARCH, or "allarch"), the recipe name, and the version of the recipe (i.e. PE:PV-PR).

A number of key subdirectories exist within each recipe work directory:

  • ${WORKDIR}/temp: Contains the log files of each task executed for this recipe, the "run" files for each executed task, which contain the code run, and a log.task_order file, which lists the order in which tasks were executed.

  • ${WORKDIR}/image: Contains the output of the do_install task, which corresponds to the ${D} variable in that task.

  • ${WORKDIR}/pseudo: Contains the pseudo database and log for any tasks executed under pseudo for the recipe.

  • ${WORKDIR}/sysroot-destdir: Contains the output of the do_populate_sysroot task.

  • ${WORKDIR}/package: Contains the output of the do_package task before the output is split into individual packages.

  • ${WORKDIR}/packages-split: Contains the output of the do_package task after the output has been split into individual packages. Subdirectories exist for each individual package created by the recipe.

  • ${WORKDIR}/recipe-sysroot: A directory populated with the target dependencies of the recipe. This directory looks like the target filesystem and contains libraries that the recipe might need to link against (e.g. the C library).

  • ${WORKDIR}/recipe-sysroot-native: A directory populated with the native dependencies of the recipe. This directory contains the tools the recipe needs to build (e.g. the compiler, Autoconf, libtool, and so forth).

  • ${WORKDIR}/build: This subdirectory applies only to recipes that support builds where the source is separate from the build artifacts. The OpenEmbedded build system uses this directory as a separate build directory (i.e. ${B}).

7.2.24. build/tmp/work-shared/

For efficiency, the OpenEmbedded build system creates and uses this directory to hold recipes that share a work directory with other recipes. In practice, this is only used for gcc and its variants (e.g. gcc-cross, libgcc, gcc-runtime, and so forth).

7.3. The Metadata - meta/

As mentioned previously, Metadata is the core of the Yocto Project. Metadata has several important subdivisions:

7.3.1. meta/classes/

This directory contains the *.bbclass files. Class files are used to abstract common code so it can be reused by multiple packages. Every package inherits the base.bbclass file. Examples of other important classes are autotools.bbclass, which in theory allows any Autotool-enabled package to work with the Yocto Project with minimal effort. Another example is kernel.bbclass that contains common code and functions for working with the Linux kernel. Functions like image generation or packaging also have their specific class files such as image.bbclass, rootfs_*.bbclass and package*.bbclass.

For reference information on classes, see the "Classes" chapter.

7.3.2. meta/conf/

This directory contains the core set of configuration files that start from bitbake.conf and from which all other configuration files are included. See the include statements at the end of the bitbake.conf file and you will note that even local.conf is loaded from there. While bitbake.conf sets up the defaults, you can often override these by using the (local.conf) file, machine file or the distribution configuration file.

7.3.3. meta/conf/machine/

This directory contains all the machine configuration files. If you set MACHINE = "qemux86", the OpenEmbedded build system looks for a qemux86.conf file in this directory. The include directory contains various data common to multiple machines. If you want to add support for a new machine to the Yocto Project, look in this directory.

7.3.4. meta/conf/distro/

The contents of this directory controls any distribution-specific configurations. For the Yocto Project, the defaultsetup.conf is the main file here. This directory includes the versions and the SRCDATE definitions for applications that are configured here. An example of an alternative configuration might be poky-bleeding.conf. Although this file mainly inherits its configuration from Poky.

7.3.5. meta/conf/machine-sdk/

The OpenEmbedded build system searches this directory for configuration files that correspond to the value of SDKMACHINE. By default, 32-bit and 64-bit x86 files ship with the Yocto Project that support some SDK hosts. However, it is possible to extend that support to other SDK hosts by adding additional configuration files in this subdirectory within another layer.

7.3.6. meta/files/

This directory contains common license files and several text files used by the build system. The text files contain minimal device information and lists of files and directories with known permissions.

7.3.7. meta/lib/

This directory contains OpenEmbedded Python library code used during the build process.

7.3.8. meta/recipes-bsp/

This directory contains anything linking to specific hardware or hardware configuration information such as "u-boot" and "grub".

7.3.9. meta/recipes-connectivity/

This directory contains libraries and applications related to communication with other devices.

7.3.10. meta/recipes-core/

This directory contains what is needed to build a basic working Linux image including commonly used dependencies.

7.3.11. meta/recipes-devtools/

This directory contains tools that are primarily used by the build system. The tools, however, can also be used on targets.

7.3.12. meta/recipes-extended/

This directory contains non-essential applications that add features compared to the alternatives in core. You might need this directory for full tool functionality or for Linux Standard Base (LSB) compliance.

7.3.13. meta/recipes-gnome/

This directory contains all things related to the GTK+ application framework.

7.3.14. meta/recipes-graphics/

This directory contains X and other graphically related system libraries

7.3.15. meta/recipes-kernel/

This directory contains the kernel and generic applications and libraries that have strong kernel dependencies.

7.3.16. meta/recipes-lsb4/

This directory contains recipes specifically added to support the Linux Standard Base (LSB) version 4.x.

7.3.17. meta/recipes-multimedia/

This directory contains codecs and support utilities for audio, images and video.

7.3.18. meta/recipes-rt/

This directory contains package and image recipes for using and testing the PREEMPT_RT kernel.

7.3.19. meta/recipes-sato/

This directory contains the Sato demo/reference UI/UX and its associated applications and configuration data.

7.3.20. meta/recipes-support/

This directory contains recipes used by other recipes, but that are not directly included in images (i.e. dependencies of other recipes).

7.3.21. meta/site/

This directory contains a list of cached results for various architectures. Because certain "autoconf" test results cannot be determined when cross-compiling due to the tests not able to run on a live system, the information in this directory is passed to "autoconf" for the various architectures.

7.3.22. meta/recipes.txt

This file is a description of the contents of recipes-*.

Chapter 8. Classes

Table of Contents

8.1. allarch.bbclass
8.2. archiver.bbclass
8.3. autotools*.bbclass
8.4. base.bbclass
8.5. bash-completion.bbclass
8.6. bin_package.bbclass
8.7. binconfig.bbclass
8.8. binconfig-disabled.bbclass
8.9. blacklist.bbclass
8.10. bluetooth.bbclass
8.11. bugzilla.bbclass
8.12. buildhistory.bbclass
8.13. buildstats.bbclass
8.14. buildstats-summary.bbclass
8.15. ccache.bbclass
8.16. chrpath.bbclass
8.17. clutter.bbclass
8.18. cmake.bbclass
8.19. cml1.bbclass
8.20. compress_doc.bbclass
8.21. copyleft_compliance.bbclass
8.22. copyleft_filter.bbclass
8.23. core-image.bbclass
8.24. cpan*.bbclass
8.25. cross.bbclass
8.26. cross-canadian.bbclass
8.27. crosssdk.bbclass
8.28. debian.bbclass
8.29. deploy.bbclass
8.30. devshell.bbclass
8.31. distro_features_check.bbclass
8.32. distrodata.bbclass
8.33. distutils*.bbclass
8.34. distutils3*.bbclass
8.35. externalsrc.bbclass
8.36. extrausers.bbclass
8.37. fontcache.bbclass
8.38. fs-uuid.bbclass
8.39. gconf.bbclass
8.40. gettext.bbclass
8.41. gnome.bbclass
8.42. gnomebase.bbclass
8.43. gobject-introspection.bbclass
8.44. grub-efi.bbclass
8.45. gsettings.bbclass
8.46. gtk-doc.bbclass
8.47. gtk-icon-cache.bbclass
8.48. gtk-immodules-cache.bbclass
8.49. gzipnative.bbclass
8.50. icecc.bbclass
8.51. image.bbclass
8.52. image-buildinfo.bbclass
8.53. image_types.bbclass
8.54. image-live.bbclass
8.55. image-mklibs.bbclass
8.56. image-prelink.bbclass
8.57. insane.bbclass
8.58. insserv.bbclass
8.59. kernel.bbclass
8.60. kernel-arch.bbclass
8.61. kernel-fitimage.bbclass
8.62. kernel-grub.bbclass
8.63. kernel-module-split.bbclass
8.64. kernel-uboot.bbclass
8.65. kernel-uimage.bbclass
8.66. kernel-yocto.bbclass
8.67. kernelsrc.bbclass
8.68. lib_package.bbclass
8.69. libc*.bbclass
8.70. license.bbclass
8.71. linux-kernel-base.bbclass
8.72. linuxloader.bbclass
8.73. logging.bbclass
8.74. meta.bbclass
8.75. metadata_scm.bbclass
8.76. migrate_localcount.bbclass
8.77. mime.bbclass
8.78. mirrors.bbclass
8.79. module.bbclass
8.80. module-base.bbclass
8.81. multilib*.bbclass
8.82. native.bbclass
8.83. nativesdk.bbclass
8.84. nopackages.bbclass
8.85. npm.bbclass
8.86. oelint.bbclass
8.87. own-mirrors.bbclass
8.88. package.bbclass
8.89. package_deb.bbclass
8.90. package_ipk.bbclass
8.91. package_rpm.bbclass
8.92. package_tar.bbclass
8.93. packagedata.bbclass
8.94. packagegroup.bbclass
8.95. patch.bbclass
8.96. perlnative.bbclass
8.97. pixbufcache.bbclass
8.98. pkgconfig.bbclass
8.99. populate_sdk.bbclass
8.100. populate_sdk_*.bbclass
8.101. prexport.bbclass
8.102. primport.bbclass
8.103. prserv.bbclass
8.104. ptest.bbclass
8.105. ptest-gnome.bbclass
8.106. python-dir.bbclass
8.107. python3native.bbclass
8.108. pythonnative.bbclass
8.109. qemu.bbclass
8.110. recipe_sanity.bbclass
8.111. relocatable.bbclass
8.112. remove-libtool.bbclass
8.113. report-error.bbclass
8.114. rm_work.bbclass
8.115. rootfs*.bbclass
8.116. sanity.bbclass
8.117. scons.bbclass
8.118. sdl.bbclass
8.119. setuptools.bbclass
8.120. setuptools3.bbclass
8.121. sign_rpm.bbclass
8.122. sip.bbclass
8.123. siteconfig.bbclass
8.124. siteinfo.bbclass
8.125. spdx.bbclass
8.126. sstate.bbclass
8.127. staging.bbclass
8.128. syslinux.bbclass
8.129. systemd.bbclass
8.130. systemd-boot.bbclass
8.131. terminal.bbclass
8.132. testimage*.bbclass
8.133. testsdk.bbclass
8.134. texinfo.bbclass
8.135. tinderclient.bbclass
8.136. toaster.bbclass
8.137. toolchain-scripts.bbclass
8.138. typecheck.bbclass
8.139. uboot-config.bbclass
8.140. uninative.bbclass
8.141. update-alternatives.bbclass
8.142. update-rc.d.bbclass
8.143. useradd*.bbclass
8.144. utility-tasks.bbclass
8.145. utils.bbclass
8.146. vala.bbclass
8.147. waf.bbclass

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.

8.1. allarch.bbclass

The 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).

Note

Unlike some distro recipes (e.g. Debian), OpenEmbedded recipes that produce packages that depend on tunings through use of the RDEPENDS and TUNE_PKGARCH variables, should never be configured for all architectures using allarch. This is the case even if the recipes do not produce architecture-specific output.

Configuring such recipes for all architectures causes the do_package_write_* tasks to have different signatures for the machines with different tunings. Additionally, unnecessary rebuilds occur every time an image for a different MACHINE is built even when the recipe never changes.

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.

8.2. archiver.bbclass

The archiver class supports releasing source code and other materials with the binaries.

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 Tasks Manual. You can also see the ARCHIVER_MODE variable for information about the variable flags (varflags) that help control archive creation.

8.3. autotools*.bbclass

The autotools* classes support Autotooled packages.

The autoconf, automake, and libtool packages bring standardization. This class defines a set of tasks (e.g. configure, compile and so forth) that work for all Autotooled packages. It should usually be enough to define a few standard variables and then simply inherit autotools. These classes can also work with software that emulates Autotools. For more information, see the "Autotooled Package" section in the Yocto Project Development Tasks Manual.

By default, the autotools* classes use out-of-tree builds (i.e. autotools.bbclass). (B != S).

If the software being built by a recipe does not support using out-of-tree builds, you should have the recipe inherit the autotools-brokensep class. The autotools-brokensep class behaves the same as the autotools class but builds with B == S. This method is useful when out-of-tree build support is either not present or is broken.

Note

It is recommended that out-of-tree support be fixed and used if at all possible.

It's useful to have some idea of how the tasks defined by the autotools* classes 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 or PACKAGECONFIG_CONFARGS variables.

  • 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.

8.4. base.bbclass

The base class is special in that every .bb file implicitly inherits the class. 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 the autotools class or the package class.

The class also contains some commonly used functions such as oe_runmake, which runs make with the arguments specified in EXTRA_OEMAKE variable as well as the arguments passed directly to oe_runmake.

8.5. bash-completion.bbclass

Sets up packaging and dependencies appropriate for recipes that build software that includes bash-completion data.

8.6. bin_package.bbclass

The 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. Extraction and installation of proprietary binaries is a good example use for this class.

Note

For RPMs and other packages that do not contain a subdirectory, you should specify an appropriate fetcher parameter to point to the subdirectory. For example, if BitBake is using the Git fetcher (git://), the "subpath" parameter limits the checkout to a specific subpath of the tree. Here is an example where ${BP} is used so that the files are extracted into the subdirectory expected by the default value of S:
     SRC_URI = "git://example.com/downloads/somepackage.rpm;subpath=${BP}"
            
See the "Fetchers" section in the BitBake User Manual for more information on supported BitBake Fetchers.

8.7. binconfig.bbclass

The binconfig 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.

8.8. binconfig-disabled.bbclass

An alternative version of the binconfig class, which disables binary configuration scripts by making them return an error in favor of using pkg-config to query the information. The scripts to be disabled should be specified using the BINCONFIG variable within the recipe inheriting the class.

8.9. blacklist.bbclass

The 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."
        

8.10. bluetooth.bbclass

The bluetooth class defines a variable that expands to the recipe (package) providing core bluetooth support on the platform.

For details on how the class works, see the meta/classes/bluetooth.bbclass file in the Yocto Project Source Directory.

8.11. bugzilla.bbclass

The bugzilla class supports setting up an instance of Bugzilla in which you can automatically files bug reports in response to build failures. For this class to work, you need to enable the XML-RPC interface in the instance of Bugzilla.

8.12. buildhistory.bbclass

The 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.

8.13. buildstats.bbclass

The 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.

Collecting build statistics is enabled by default through the USER_CLASSES variable from your local.conf file. Consequently, you do not have to do anything to enable the class. However, if you want to disable the class, simply remove "buildstats" from the USER_CLASSES list.

8.14. buildstats-summary.bbclass

When inherited globally, prints statistics at the end of the build on sstate re-use. In order to function, this class requires the buildstats class be enabled.

8.15. ccache.bbclass

The ccache class enables the C/C++ Compiler 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 http://ccache.samba.org/ for information on the C/C++ Compiler Cache.

8.16. chrpath.bbclass

The chrpath class is a wrapper around the "chrpath" utility, which is used during the build process for nativesdk, cross, and cross-canadian recipes to change RPATH records within binaries in order to make them relocatable.

8.17. clutter.bbclass

The clutter class consolidates the major and minor version naming and other common items used by Clutter and related recipes.

Note

Unlike some other classes related to specific libraries, recipes building other software that uses Clutter do not need to inherit this class unless they use the same recipe versioning scheme that the Clutter and related recipes do.

8.18. cmake.bbclass

The 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.

8.19. cml1.bbclass

The cml1 class provides basic support for the Linux kernel style build configuration system.

8.20. compress_doc.bbclass

Enables compression for man pages and info pages. This class is intended to be inherited globally. The default compression mechanism is gz (gzip) but you can select an alternative mechanism by setting the DOC_COMPRESS variable.

8.21. copyleft_compliance.bbclass

The copyleft_compliance class preserves source code for the purposes of license compliance. This class is an alternative to the archiver class and is still used by some users even though it has been deprecated in favor of the archiver class.

8.22. copyleft_filter.bbclass

A class used by the archiver and copyleft_compliance classes for filtering licenses. The copyleft_filter class is an internal class and is not intended to be used directly.

8.23. core-image.bbclass

The core-image class provides common definitions for the core-image-* image recipes, such as support for additional IMAGE_FEATURES.

8.24. cpan*.bbclass

The cpan* classes support Perl modules.

Recipes for Perl modules are simple. These recipes usually only need to point to the source's archive and then inherit the proper class 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.

Both build methods inherit the cpan-base class for basic Perl support.

8.25. cross.bbclass

The cross class provides support for the recipes that build the cross-compilation tools.

8.26. cross-canadian.bbclass

The cross-canadian class provides support for the recipes that build the Canadian Cross-compilation tools for SDKs. See the "Cross-Development Toolchain Generation" section for more discussion on these cross-compilation tools.

8.27. crosssdk.bbclass

The crosssdk class provides support for the recipes that build the cross-compilation tools used for building SDKs. See the "Cross-Development Toolchain Generation" section for more discussion on these cross-compilation tools.

8.28. debian.bbclass

The debian class renames output packages so that they follow the Debian naming policy (i.e. glibc becomes libc6 and glibc-devel becomes libc6-dev.) Renaming includes the library name and version as part of the package name.

If a recipe creates packages for multiple libraries (shared object files of .so type), use the LEAD_SONAME variable in the recipe to specify the library on which to apply the naming scheme.

8.29. deploy.bbclass

The 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. The class then takes care of staging the files from DEPLOYDIR to DEPLOY_DIR_IMAGE.

8.30. devshell.bbclass

The devshell class adds the do_devshell task. Distribution policy dictates whether to include this class. See the "Using a Development Shell" section in the Yocto Project Development Tasks Manual for more information about using devshell.

8.31. distro_features_check.bbclass

The 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.

8.32. distrodata.bbclass

The distrodata class provides for automatic checking for upstream recipe updates. The class creates a comma-separated value (CSV) spreadsheet that contains information about the recipes. The information provides the do_distrodata and do_distro_check tasks, which do upstream checking and also verify if a package is used in multiple major distributions.

The class is not included by default. To use it, you must set the INHERIT variable:

     INHERIT+= "distrodata"
        

The distrodata class also provides the do_checkpkg task, which can be used against a simple recipe or against an image to get all its recipe information.

8.33. distutils*.bbclass

The distutils* classes support recipes for Python version 2.x extensions, which are simple. These recipes usually only need to point to the source's archive and then inherit the proper class. 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 the classes based on distutils in their recipes.

  • Extensions that use build systems based on distutils require the distutils class in their recipes.

  • Extensions that use build systems based on setuptools require the setuptools class in their recipes.

The distutils-common-base class is required by some of the distutils* classes to provide common Python2 support.

The distutils-tools class supports recipes for additional "distutils" tools.

8.34. distutils3*.bbclass

The distutils3* classes support recipes for Python version 3.x extensions, which are simple. These recipes usually only need to point to the source's archive and then inherit the proper class. Building is split into three methods depending on which method the module authors used.

  • Extensions that use an Autotools-based build system require Autotools and distutils-based classes in their recipes.

  • Extensions that use distutils-based build systems require the distutils class in their recipes.

  • Extensions that use build systems based on setuptools3 require the setuptools3 class in their recipes.

The distutils3* classes either inherit their corresponding distutils* class or replicate them using a Python3 version instead (e.g. distutils3-base inherits distutils-common-base, which is the same as distutils-base but inherits python3native instead of pythonnative).

8.35. externalsrc.bbclass

The externalsrc class supports building 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 the externalsrc class, 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 these variables for more information: WORKDIR, BPN, and PV,

For more information on the externalsrc class, see the comments in meta/classes/externalsrc.bbclass in the Source Directory. For information on how to use the externalsrc class, see the "Building Software from an External Source" section in the Yocto Project Development Tasks Manual.

8.36. extrausers.bbclass

The 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.

Note

The user and group operations added using the extrausers class are not tied to a specific recipe outside of the recipe for the image. Thus, the operations can be performed across the image as a whole. Use the useradd class 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; \
         "
        

Here is an example that adds two users named "tester-jim" and "tester-sue" and assigns passwords:

     inherit extrausers
     EXTRA_USERS_PARAMS = "\
         useradd -P tester01 tester-jim; \
         useradd -P tester01 tester-sue; \
         "
        

Finally, here is an example that sets the root password to "1876*18":

     inherit extrausers
     EXTRA_USERS_PARAMS = "\
         usermod -P 1876*18 root; \
         "
        

8.37. fontcache.bbclass

The fontcache class generates the proper post-install 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 specify the packages containing the fonts.

8.38. fs-uuid.bbclass

The fs-uuid class extracts UUID from ${ROOTFS}, which must have been built by the time that this function gets called. The fs-uuid class only works on ext file systems and depends on tune2fs.

8.39. gconf.bbclass

The 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-install and post-remove (postinst/postrm) scriptlets to register and unregister the schemas in the target image.

8.40. gettext.bbclass

The 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.

8.41. gnome.bbclass

The 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 GObject introspection where applicable.

8.42. gnomebase.bbclass

The gnomebase class is the base class for recipes that build software from the GNOME stack. This class sets SRC_URI to download the source from the GNOME mirrors as well as extending FILES with the typical GNOME installation paths.

8.43. gobject-introspection.bbclass

Provides support for recipes building software that supports GObject introspection. This functionality is only enabled if the "gobject-introspection-data" feature is in DISTRO_FEATURES as well as "qemu-usermode" being in MACHINE_FEATURES.

Note

This functionality is backfilled by default and, if not applicable, should be disabled through DISTRO_FEATURES_BACKFILL_CONSIDERED or MACHINE_FEATURES_BACKFILL_CONSIDERED, respectively.

8.44. grub-efi.bbclass

The grub-efi class provides grub-efi-specific functions for building bootable images.

This class supports several variables:

  • INITRD: Indicates list of filesystem images to concatenate and use as an initial RAM disk (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).

8.45. gsettings.bbclass

The 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-install and post-remove (postinst/postrm) scriptlets are added to register and unregister the schemas in the target image.

8.46. gtk-doc.bbclass

The gtk-doc class is a helper class to pull in the appropriate gtk-doc dependencies and disable gtk-doc.

8.47. gtk-icon-cache.bbclass

The 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.

8.48. gtk-immodules-cache.bbclass

The 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 specify the packages containing the modules.

8.49. gzipnative.bbclass

The gzipnative class enables the use of different native versions of gzip and pigz rather than the versions of these tools from the build host.

8.50. icecc.bbclass

The icecc class supports Icecream, which facilitates taking compile jobs and distributing them among remote machines.

The 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 the ICECC_CXX and ICEC_CC variables, which are the paths to the g++ and gcc compilers, respectively.

For the cross compiler, the class creates a tar.gz file that contains the Yocto Project toolchain and sets ICECC_VERSION, which is the version of the cross-compiler used in the cross-development toolchain, 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 the icecc binary 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-native.bb.

Note

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 recipes or classes, you can effectively "blacklist" them by listing the recipes 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 recipes using the ICECC_USER_PACKAGE_WL variable in your local.conf file to force icecc to be enabled for recipes using an empty PARALLEL_MAKE variable.

Inheriting the icecc class changes all sstate signatures. Consequently, if a development team has a dedicated build system that populates STATE_MIRRORS and they want to reuse sstate from STATE_MIRRORS, then all developers and the build system need to either inherit the icecc class or nobody should.

At the distribution level, you can inherit the icecc class to be sure that all builders start with the same sstate signatures. After inheriting the class, you can then disable the feature by setting the ICECC_DISABLED variable to "1" as follows:

     INHERIT_DISTRO_append = " icecc"
     ICECC_DISABLED ??= "1"
        

This practice makes sure everyone is using the same signatures but also requires individuals that do want to use Icecream to enable the feature individually as follows in your local.conf file:

     ICECC_DISABLED = ""
        

8.51. image.bbclass

The image class helps support creating images in different formats. First, the root filesystem is created from packages using one of the rootfs*.bbclass files (depending on the package format used) and then one or more image files are 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.

For information on customizing images, see the "Customizing Images" section in the Yocto Project Development Tasks Manual. For information on how images are created, see the "Images" section elsewhere in this manual.

8.52. image-buildinfo.bbclass

The image-buildinfo class writes information to the target filesystem on /etc/build.

8.53. image_types.bbclass

The image_types class defines all of the standard image output types that you can enable through the IMAGE_FSTYPES variable. You can use this class as a reference on how to add support for custom image output types.

By default, this class is enabled through the IMAGE_CLASSES variable in image.bbclass. If you define your own image types using a custom BitBake class and then use IMAGE_CLASSES to enable it, the custom class must either inherit image_types or image_types must also appear in IMAGE_CLASSES.

This class also handles conversion and compression of images.

Note

To build a VMware VMDK image, you need to add "wic.vmdk" to IMAGE_FSTYPES. This would also be similar for Virtual Box Virtual Disk Image ("vdi") and QEMU Copy On Write Version 2 ("qcow2") images.

8.54. image-live.bbclass

This class controls building "live" (i.e. HDDIMG and ISO) images. Live images contain syslinux for legacy booting, as well as the bootloader specified by EFI_PROVIDER if MACHINE_FEATURES contains "efi".

Normally, you do not use this class directly. Instead, you add "live" to IMAGE_FSTYPES. You can selectively build just one of these types through the NOISO and NOHDD variables. For example, if you were building an ISO image, you would add "live" to IMAGE_FSTYPES, set the NOISO variable to "0" and the build system would use the image-live class to build the ISO image.

8.55. image-mklibs.bbclass