A.1. Top level core components
A.1.1. bitbake/
The Yocto Project 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. The bitbake/bin/
directory is placed into the shell's PATH
environment variable by the oe-init-build-env script.
For more information on BitBake, see the BitBake on-line manual at http://bitbake.berlios.de/manual/.
在 bitbake/bin 目录下面可以看到所有可以执行的命令,包括bitbake , bitbake-layers, etc 。
A.1.2. build/
This directory contains user configuration files and the output generated by the Yocto Project in its standard configuration where the source tree is combined with the output. The build directory is created initially when you source
the Yocto Project environment setup script oe-init-build-env
.
It is also possible to place output and configuration files in a directory separate from the Yocto Project files by providing a directory name when you source
the setup script. For information on separating output from the Yocto Project files, see oe-init-build-env.
A.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 poky-ref-manual
.
A.1.4. meta/
This directory contains the Yocto Project core metadata. The directory holds machine definitions, the Yocto Project distribution, and the packages that make up a given system.
A.1.5. meta-demoapps/
This directory contains recipes for applications and demos that are not part of the Yocto Project core.
A.1.6. meta-rt/
This directory contains recipes for real-time kernels.
A.1.7. meta-skeleton/
This directory contains template recipes for BSP and kernel development.
A.1.8. 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 contributing back to the Yocto Project, such as create_pull_request
and send_pull_request
.
A.1.9. oe-init-build-env
This script sets up the Yocto Project 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 this script before running BitBake commands. The script uses other scripts within the scripts
directory to do the bulk of the work.
By default, running this script without a build directory argument creates the build
directory. If you provide a build directory argument when you source
the script, you direct the Yocto Project to create a build directory of your choice. For example, the following command creates a build directory named mybuilds
that is outside of the Yocto Project files:
$ source oe-init-build-env ~/mybuilds
A.1.10. LICENSE, README, and README.hardware
These files are standard top-level files.
A.2. The Build Directory - build/
A.2.1. build/pseudodone
This tag file indicates that the initial pseudo binary was created. The file is built the first time BitBake is invoked.
A.2.2. build/conf/local.conf
This file contains all the local user configuration of the Yocto Project. If there is no local.conf
present, it is created from local.conf.sample
. The local.conf
file contains documentation on the various configuration options. Any variable set here overrides any variable set elsewhere within the Yocto Project unless that variable is hard-coded within the Yocto Project (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
), or where you want to downloaded files (DL_DIR
).
A.2.3. build/conf/bblayers.conf
This file defines layers, which is a directory tree, traversed (or walked) by BitBake. If bblayers.conf
is not present, it is created from bblayers.conf.sample
when you source
the environment setup script.
A.2.4. build/conf/sanity_info
This file is created during the build to indicate the state of the sanity checks.
A.2.5. build/downloads/
This directory is used for the upstream source tarballs. The directory can be reused by multiple builds or moved to another location. You can control the location of this directory through the DL_DIR
variable.
A.2.6. build/sstate-cache/
This directory is used for the shared state cache. The directory can be reused by multiple builds or moved to another location. You can control the location of this directory through the SSTATE_DIR
variable.
A.2.7. build/tmp/
This directory receives all the Yocto Project output. BitBake creates this directory if it does not exist. As a last resort, to clean the Yocto Project and start a build from scratch (other than downloads), you can remove everything in this directory or get rid of the directory completely. If you do, you should also completely remove the build/sstate-cache
directory as well.
A.2.8. build/tmp/buildstats/
This directory stores the build statistics.
A.2.9. build/tmp/cache/
When BitBake parses the metadata, it creates a cache file of the result that can be used when subsequently running commands. These results are stored here on a per-machine basis.
A.2.10. build/tmp/deploy/
This directory contains any 'end result' output from the Yocto Project build process.
A.2.11. build/tmp/deploy/deb/
This directory receives any .deb
packages produced by the Yocto Project. The packages are sorted into feeds for different architecture types.
A.2.12. build/tmp/deploy/rpm/
This directory receives any .rpm
packages produced by the Yocto Project. The packages are sorted into feeds for different architecture types.
A.2.13. 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.
Note, you should not remove any files from this directory by hand in an attempt to rebuild an image. If you want to clean out the cache, re-run the build using the following BitBake command:
$ bitbake -c cleanall <target>
A.2.14. build/tmp/deploy/ipk/
This directory receives .ipk
packages produced by the Yocto Project.
A.2.15. build/tmp/sysroots/
This directory contains shared header files and libraries as well as other shared data. Packages that need to share output with other packages do so within this directory. The directory is subdivided by architecture so multiple builds can run within the one build directory.
A.2.16. build/tmp/stamps/
This directory holds information that that BitBake uses for accounting purposes to track what tasks have run and when they have run. The directory is sub-divided by architecture. The files in the directory are empty of data. However, BitBake uses the filenames and timestamps for tracking purposes.
A.2.17. 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 check_pkg
or distro_check
tasks.
A.2.18. build/tmp/pkgdata/
This directory contains intermediate packaging data that is used later in the packaging process. For more information, see the "Packaging - package*.bbclass" section.
A.2.19. build/tmp/work/
This directory contains architecture-specific work sub-directories for packages built by BitBake. All tasks execute from a 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 for which the source is being compiled.
It is worth considering the structure of a typical work directory. As an example, consider the 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 WORKDIR
, is created. Within this directory, the source is unpacked to linux-qemux86-standard-build
and then patched by Quilt (see the "Modifying Package Source Code with Quilt" section in the Yocto Project Development Manual. 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/
.
A.3. The Metadata - meta/
As mentioned previously, metadata is the core of the Yocto Project. Metadata has several important subdivisions:
A.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
.
A.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 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.
A.3.3. meta/conf/machine/
This directory contains all the machine configuration files. If you set MACHINE="qemux86"
, Yocto Project 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.
A.3.4. meta/conf/distro/
Any distribution-specific configuration is controlled from this directory. The Yocto Project only contains the Yocto Project distribution so 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 is poky-bleeding.conf
although this file mainly inherits its configuration from the Yocto Project itself.
A.3.5. meta/recipes-bsp/
This directory contains anything linking to specific hardware or hardware configuration information such as "u-boot" and "grub".
A.3.6. meta/recipes-connectivity/
This directory contains libraries and applications related to communication with other devices.
A.3.7. meta/recipes-core/
This directory contains what is needed to build a basic working Linux image including commonly used dependencies.
A.3.8. meta/recipes-devtools/
This directory contains tools that are primarily used by the build system. The tools, however, can also be used on targets.
A.3.9. 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.
A.3.10. meta/recipes-gnome/
This directory contains all things related to the GTK+ application framework.
A.3.11. meta/recipes-graphics/
This directory contains X and other graphically related system libraries
A.3.12. meta/recipes-kernel/
This directory contains the kernel and generic applications and libraries that have strong kernel dependencies.
A.3.13. meta/recipes-multimedia/
This directory contains codecs and support utilities for audio, images and video.
A.3.14. meta/recipes-qt/
This directory contains all things related to the Qt application framework.
A.3.15. meta/recipes-sato/
This directory contains the Sato demo/reference UI/UX and its associated applications and configuration data.
A.3.16. meta/recipes-support/
This directory contains recipes that used by other recipes, but that are not directly included in images (i.e. dependencies of other recipes).
A.3.17. 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.
A.3.18. meta/recipes.txt/
This file is a description of the contents of recipes-*
.