structure.rst 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. **************************
  3. Source Directory Structure
  4. **************************
  5. The :term:`Source Directory` consists of numerous files,
  6. directories and subdirectories; understanding their locations and
  7. contents is key to using the Yocto Project effectively. This chapter
  8. describes the Source Directory and gives information about those files
  9. and directories.
  10. For information on how to establish a local Source Directory on your
  11. development system, see the
  12. ":ref:`dev-manual/start:locating yocto project source files`"
  13. section in the Yocto Project Development Tasks Manual.
  14. .. note::
  15. The OpenEmbedded build system does not support file or directory
  16. names that contain spaces. Be sure that the Source Directory you use
  17. does not contain these types of names.
  18. .. _structure-core:
  19. Top-Level Core Components
  20. =========================
  21. This section describes the top-level components of the :term:`Source Directory`.
  22. .. _structure-core-bitbake:
  23. ``bitbake/``
  24. ------------
  25. This directory includes a copy of BitBake for ease of use. The copy
  26. usually matches the current stable BitBake release from the BitBake
  27. project. BitBake, a :term:`Metadata` interpreter, reads the
  28. Yocto Project Metadata and runs the tasks defined by that data. Failures
  29. are usually caused by errors in your Metadata and not from BitBake
  30. itself.
  31. When you run the ``bitbake`` command, the main BitBake executable (which
  32. resides in the ``bitbake/bin/`` directory) starts. Sourcing the
  33. environment setup script (i.e. :ref:`structure-core-script`) places
  34. the ``scripts/`` and ``bitbake/bin/`` directories (in that order) into
  35. the shell's ``PATH`` environment variable.
  36. For more information on BitBake, see the :doc:`BitBake User Manual
  37. <bitbake:index>`.
  38. .. _structure-core-build:
  39. ``build/``
  40. ----------
  41. This directory contains user configuration files and the output
  42. generated by the OpenEmbedded build system in its standard configuration
  43. where the source tree is combined with the output. The :term:`Build Directory`
  44. is created initially when you ``source`` the OpenEmbedded build environment
  45. setup script (i.e. :ref:`structure-core-script`).
  46. It is also possible to place output and configuration files in a
  47. directory separate from the :term:`Source Directory` by
  48. providing a directory name when you ``source`` the setup script. For
  49. information on separating output from your local Source Directory files
  50. (commonly described as an "out of tree" build), see the
  51. ":ref:`structure-core-script`" section.
  52. See the ":ref:`The Build Directory --- build/ <structure-build>`" section for details
  53. about the contents of the :term:`Build Directory`.
  54. .. _handbook:
  55. ``documentation/``
  56. ------------------
  57. This directory holds the source for the Yocto Project documentation as
  58. well as templates and tools that allow you to generate PDF and HTML
  59. versions of the manuals. Each manual is contained in its own sub-folder;
  60. for example, the files for this reference manual reside in the
  61. ``ref-manual/`` directory.
  62. .. _structure-core-meta:
  63. ``meta/``
  64. ---------
  65. This directory contains the minimal, underlying OpenEmbedded-Core
  66. metadata. The directory holds recipes, common classes, and machine
  67. configuration for strictly emulated targets (``qemux86``, ``qemuarm``,
  68. and so forth.)
  69. .. _structure-core-meta-poky:
  70. ``meta-poky/``
  71. --------------
  72. Designed above the ``meta/`` content, this directory adds just enough
  73. metadata to define the Poky reference distribution.
  74. .. _structure-core-meta-yocto-bsp:
  75. ``meta-yocto-bsp/``
  76. -------------------
  77. This directory contains the Yocto Project reference hardware Board
  78. Support Packages (BSPs). For more information on BSPs, see the
  79. :doc:`/bsp-guide/index`.
  80. .. _structure-meta-selftest:
  81. ``meta-selftest/``
  82. ------------------
  83. This directory adds additional recipes and append files used by the
  84. OpenEmbedded selftests to verify the behavior of the build system. You
  85. do not have to add this layer to your ``bblayers.conf`` file unless you
  86. want to run the selftests.
  87. .. _structure-meta-skeleton:
  88. ``meta-skeleton/``
  89. ------------------
  90. This directory contains template recipes for BSP and kernel development.
  91. .. _structure-core-scripts:
  92. ``scripts/``
  93. ------------
  94. This directory contains various integration scripts that implement extra
  95. functionality in the Yocto Project environment (e.g. QEMU scripts). The
  96. :ref:`structure-core-script` script prepends this directory to the
  97. shell's ``PATH`` environment variable.
  98. The ``scripts`` directory has useful scripts that assist in contributing
  99. back to the Yocto Project, such as ``create-pull-request`` and
  100. ``send-pull-request``.
  101. .. _structure-core-script:
  102. ``oe-init-build-env``
  103. ---------------------
  104. This script sets up the OpenEmbedded build environment. Running this
  105. script with the ``source`` command in a shell makes changes to ``PATH``
  106. and sets other core BitBake variables based on the current working
  107. directory. You need to run an environment setup script before running
  108. BitBake commands. The script uses other scripts within the ``scripts``
  109. directory to do the bulk of the work.
  110. When you run this script, your Yocto Project environment is set up, a
  111. :term:`Build Directory` is created, your working directory becomes the
  112. :term:`Build Directory`, and you are presented with some simple
  113. suggestions as to what to do next, including a list of some possible
  114. targets to build. Here is an example::
  115. $ source oe-init-build-env
  116. ### Shell environment set up for builds. ###
  117. You can now run 'bitbake <target>'
  118. Common targets are:
  119. core-image-minimal
  120. core-image-sato
  121. meta-toolchain
  122. meta-ide-support
  123. You can also run generated QEMU images with a command like 'runqemu qemux86-64'
  124. The default output of the ``oe-init-build-env`` script is from the
  125. ``conf-summary.txt`` and ``conf-notes.txt`` files, which are found in the ``meta-poky`` directory
  126. within the :term:`Source Directory`. If you design a
  127. custom distribution, you can include your own versions of these
  128. configuration files where you can provide a brief summary and detailed usage
  129. notes, such as a list of the targets defined by your distribution.
  130. See the
  131. ":ref:`dev-manual/custom-template-configuration-directory:creating a custom template configuration directory`"
  132. section in the Yocto Project Development Tasks Manual for more
  133. information.
  134. By default, running this script without a :term:`Build Directory` argument
  135. creates the ``build/`` directory in your current working directory. If
  136. you provide a :term:`Build Directory` argument when you ``source`` the script,
  137. you direct the OpenEmbedded build system to create a :term:`Build Directory` of
  138. your choice. For example, the following command creates a
  139. :term:`Build Directory` named ``mybuilds/`` that is outside of the
  140. :term:`Source Directory`::
  141. $ source oe-init-build-env ~/mybuilds
  142. The OpenEmbedded build system uses the template configuration files, which
  143. are found by default in the ``meta-poky/conf/templates/default`` directory in the Source
  144. Directory. See the
  145. ":ref:`dev-manual/custom-template-configuration-directory:creating a custom template configuration directory`"
  146. section in the Yocto Project Development Tasks Manual for more
  147. information.
  148. .. note::
  149. The OpenEmbedded build system does not support file or directory
  150. names that contain spaces. If you attempt to run the ``oe-init-build-env``
  151. script from a Source Directory that contains spaces in either the
  152. filenames or directory names, the script returns an error indicating
  153. no such file or directory. Be sure to use a Source Directory free of
  154. names containing spaces.
  155. .. _structure-basic-top-level:
  156. ``LICENSE, README, and README.hardware``
  157. ----------------------------------------
  158. These files are standard top-level files.
  159. .. _structure-build:
  160. The Build Directory --- ``build/``
  161. ==================================
  162. The OpenEmbedded build system creates the :term:`Build Directory` when you run
  163. the build environment setup script :ref:`structure-core-script`. If you do not
  164. give the :term:`Build Directory` a specific name when you run the setup script,
  165. the name defaults to ``build/``.
  166. For subsequent parsing and processing, the name of the Build directory
  167. is available via the :term:`TOPDIR` variable.
  168. .. _structure-build-buildhistory:
  169. ``build/buildhistory/``
  170. -----------------------
  171. The OpenEmbedded build system creates this directory when you enable
  172. build history via the :ref:`ref-classes-buildhistory` class file. The directory
  173. organizes build information into image, packages, and SDK
  174. subdirectories. For information on the build history feature, see the
  175. ":ref:`dev-manual/build-quality:maintaining build output quality`"
  176. section in the Yocto Project Development Tasks Manual.
  177. .. _structure-build-cache:
  178. ``build/cache/``
  179. ----------------
  180. This directory contains several internal files used by the OpenEmbedded
  181. build system.
  182. It also contains ``sanity_info``, a text file keeping track of important
  183. build information such as the values of :term:`TMPDIR`, :term:`SSTATE_DIR`,
  184. as well as the name and version of the host distribution.
  185. .. _structure-build-conf-local.conf:
  186. ``build/conf/local.conf``
  187. -------------------------
  188. This configuration file contains all the local user configurations for
  189. your build environment. The ``local.conf`` file contains documentation
  190. on the various configuration options. Any variable set here overrides
  191. any variable set elsewhere within the environment unless that variable
  192. is hard-coded within a file (e.g. by using '=' instead of '?='). Some
  193. variables are hard-coded for various reasons but such variables are
  194. relatively rare.
  195. At a minimum, you would normally edit this file to select the target
  196. :term:`MACHINE`, which package types you wish to use
  197. (:term:`PACKAGE_CLASSES`), and the location from
  198. which you want to access downloaded files (:term:`DL_DIR`).
  199. If ``local.conf`` is not present when you start the build, the
  200. OpenEmbedded build system creates it from ``local.conf.sample`` when you
  201. ``source`` the top-level build environment setup script
  202. :ref:`structure-core-script`.
  203. The source ``local.conf.sample`` file used depends on the
  204. :term:`TEMPLATECONF` script variable, which defaults to ``meta-poky/conf/templates/default``
  205. when you are building from the Yocto Project development environment,
  206. and to ``meta/conf/templates/default`` when you are building from the OpenEmbedded-Core
  207. environment. Because the script variable points to the source of the
  208. ``local.conf.sample`` file, this implies that you can configure your
  209. build environment from any layer by setting the variable in the
  210. top-level build environment setup script as follows::
  211. TEMPLATECONF=your_layer/conf/templates/your_template_name
  212. Once the build process gets the sample
  213. file, it uses ``sed`` to substitute final
  214. ``${``\ :term:`OEROOT`\ ``}`` values for all
  215. ``##OEROOT##`` values.
  216. .. note::
  217. You can see how the :term:`TEMPLATECONF` variable is used by looking at the
  218. ``scripts/oe-setup-builddir`` script in the :term:`Source Directory`.
  219. You can find the Yocto Project version of the ``local.conf.sample`` file in
  220. the ``meta-poky/conf/templates/default`` directory.
  221. .. _structure-build-conf-bblayers.conf:
  222. ``build/conf/bblayers.conf``
  223. ----------------------------
  224. This configuration file defines
  225. :ref:`layers <dev-manual/layers:understanding and creating layers>`,
  226. which are directory trees, traversed (or walked) by BitBake. The
  227. ``bblayers.conf`` file uses the :term:`BBLAYERS`
  228. variable to list the layers BitBake tries to find.
  229. If ``bblayers.conf`` is not present when you start the build, the
  230. OpenEmbedded build system creates it from ``bblayers.conf.sample`` when
  231. you ``source`` the top-level build environment setup script (i.e.
  232. :ref:`structure-core-script`).
  233. As with the ``local.conf`` file, the source ``bblayers.conf.sample``
  234. file used depends on the :term:`TEMPLATECONF` script variable, which
  235. defaults to ``meta-poky/conf/templates/default`` when you are building from the Yocto
  236. Project development environment, and to ``meta/conf/templates/default`` when you are
  237. building from the OpenEmbedded-Core environment. Because the script
  238. variable points to the source of the ``bblayers.conf.sample`` file, this
  239. implies that you can base your build from any layer by setting the
  240. variable in the top-level build environment setup script as follows::
  241. TEMPLATECONF=your_layer/conf/templates/your_template_name
  242. Once the build process gets the sample file, it uses ``sed`` to substitute final
  243. ``${``\ :term:`OEROOT`\ ``}`` values for all ``##OEROOT##`` values.
  244. .. note::
  245. You can see how the :term:`TEMPLATECONF` variable is defined by the ``scripts/oe-setup-builddir``
  246. script in the :term:`Source Directory`. You can find the Yocto Project
  247. version of the ``bblayers.conf.sample`` file in the ``meta-poky/conf/templates/default``
  248. directory.
  249. .. _structure-build-conf-bblock.conf:
  250. ``build/conf/bblock.conf``
  251. --------------------------
  252. This configuration file is generated by :doc:`bblock </dev-manual/bblock>` and
  253. contains the signatures locked by ``bblock``. By default, it does not exist
  254. and will be created upon the first invocation of ``bblock``.
  255. .. _structure-build-downloads:
  256. ``build/downloads/``
  257. --------------------
  258. This directory contains downloaded upstream source tarballs. You can
  259. reuse the directory for multiple builds or move the directory to another
  260. location. You can control the location of this directory through the
  261. :term:`DL_DIR` variable.
  262. .. _structure-build-sstate-cache:
  263. ``build/sstate-cache/``
  264. -----------------------
  265. This directory contains the shared state cache. You can reuse the
  266. directory for multiple builds or move the directory to another location.
  267. You can control the location of this directory through the
  268. :term:`SSTATE_DIR` variable.
  269. .. _structure-build-tmp:
  270. ``build/tmp/``
  271. --------------
  272. The OpenEmbedded build system creates and uses this directory for all
  273. the build system's output. The :term:`TMPDIR` variable
  274. points to this directory.
  275. BitBake creates this directory if it does not exist. As a last resort,
  276. to clean up a build and start it from scratch (other than the
  277. downloads), you can remove everything in the ``tmp`` directory or get
  278. rid of the directory completely. If you do, you should also completely
  279. remove the ``build/sstate-cache`` directory.
  280. .. _structure-build-tmp-buildstats:
  281. ``build/tmp/buildstats/``
  282. ~~~~~~~~~~~~~~~~~~~~~~~~~
  283. This directory stores the build statistics as generated by the
  284. :ref:`ref-classes-buildstats` class.
  285. .. _structure-build-tmp-cache:
  286. ``build/tmp/cache/``
  287. ~~~~~~~~~~~~~~~~~~~~
  288. When BitBake parses the metadata (recipes and configuration files), it
  289. caches the results in ``build/tmp/cache/`` to speed up future builds.
  290. The results are stored on a per-machine basis.
  291. During subsequent builds, BitBake checks each recipe (together with, for
  292. example, any files included or appended to it) to see if they have been
  293. modified. Changes can be detected, for example, through file
  294. modification time (mtime) changes and hashing of file contents. If no
  295. changes to the file are detected, then the parsed result stored in the
  296. cache is reused. If the file has changed, it is reparsed.
  297. .. _structure-build-tmp-deploy:
  298. ``build/tmp/deploy/``
  299. ~~~~~~~~~~~~~~~~~~~~~
  300. This directory contains any "end result" output from the OpenEmbedded
  301. build process. The :term:`DEPLOY_DIR` variable points
  302. to this directory. For more detail on the contents of the ``deploy``
  303. directory, see the
  304. ":ref:`overview-manual/concepts:images`" and
  305. ":ref:`overview-manual/concepts:application development sdk`" sections in the Yocto
  306. Project Overview and Concepts Manual.
  307. .. _structure-build-tmp-deploy-deb:
  308. ``build/tmp/deploy/deb/``
  309. ^^^^^^^^^^^^^^^^^^^^^^^^^
  310. This directory receives any ``.deb`` packages produced by the build
  311. process. The packages are sorted into feeds for different architecture
  312. types.
  313. .. _structure-build-tmp-deploy-rpm:
  314. ``build/tmp/deploy/rpm/``
  315. ^^^^^^^^^^^^^^^^^^^^^^^^^
  316. This directory receives any ``.rpm`` packages produced by the build
  317. process. The packages are sorted into feeds for different architecture
  318. types.
  319. .. _structure-build-tmp-deploy-ipk:
  320. ``build/tmp/deploy/ipk/``
  321. ^^^^^^^^^^^^^^^^^^^^^^^^^
  322. This directory receives ``.ipk`` packages produced by the build process.
  323. .. _structure-build-tmp-deploy-licenses:
  324. ``build/tmp/deploy/licenses/``
  325. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  326. This directory receives package licensing information. For example, the
  327. directory contains sub-directories for ``bash``, ``busybox``, and
  328. ``glibc`` (among others) that in turn contain appropriate ``COPYING``
  329. license files with other licensing information. For information on
  330. licensing, see the
  331. ":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`"
  332. section in the Yocto Project Development Tasks Manual.
  333. .. _structure-build-tmp-deploy-images:
  334. ``build/tmp/deploy/images/``
  335. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  336. This directory is populated with the basic output objects of the build
  337. (think of them as the "generated artifacts" of the build process),
  338. including things like the boot loader image, kernel, root filesystem and
  339. more. If you want to flash the resulting image from a build onto a
  340. device, look here for the necessary components.
  341. Be careful when deleting files in this directory. You can safely delete
  342. old images from this directory (e.g. ``core-image-*``). However, the
  343. kernel (``*zImage*``, ``*uImage*``, etc.), bootloader and other
  344. supplementary files might be deployed here prior to building an image.
  345. Because these files are not directly produced from the image, if you
  346. delete them they will not be automatically re-created when you build the
  347. image again.
  348. If you do accidentally delete files here, you will need to force them to
  349. be re-created. In order to do that, you will need to know the target
  350. that produced them. For example, these commands rebuild and re-create
  351. the kernel files::
  352. $ bitbake -c clean virtual/kernel
  353. $ bitbake virtual/kernel
  354. .. _structure-build-tmp-deploy-sdk:
  355. ``build/tmp/deploy/sdk/``
  356. ^^^^^^^^^^^^^^^^^^^^^^^^^
  357. The OpenEmbedded build system creates this directory to hold toolchain
  358. installer scripts which, when executed, install the sysroot that matches
  359. your target hardware. You can find out more about these installers in
  360. the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`"
  361. section in the Yocto Project Application Development and the Extensible
  362. Software Development Kit (eSDK) manual.
  363. .. _structure-build-tmp-hosttools:
  364. ``build/tmp/hosttools/``
  365. ~~~~~~~~~~~~~~~~~~~~~~~~
  366. The OpenEmbedded build system uses this directory to create symbolic links to
  367. some of the host components that are allowed to be called within tasks. These
  368. are basic components listed in the :ref:`ref-manual/system-requirements:required
  369. packages for the build host` section. These components are also listed in the
  370. :term:`HOSTTOOLS` variable and are limited to this list to prevent host
  371. contamination.
  372. .. _structure-build-tmp-pkgdata:
  373. ``build/tmp/pkgdata/``
  374. ~~~~~~~~~~~~~~~~~~~~~~
  375. The OpenEmbedded build system uses this directory to store package metadata
  376. generated during the :ref:`ref-tasks-packagedata` task. The files stored in this
  377. directory contain information about each output package produced by the
  378. OpenEmbedded build system, and are used in different ways by the build system
  379. such as ":ref:`dev-manual/debugging:viewing package information with
  380. ``oe-pkgdata-util```".
  381. .. _structure-build-tmp-sstate-control:
  382. ``build/tmp/sstate-control/``
  383. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  384. The OpenEmbedded build system uses this directory for the shared state
  385. manifest files. The shared state code uses these files to record the
  386. files installed by each sstate task so that the files can be removed
  387. when cleaning the recipe or when a newer version is about to be
  388. installed. The build system also uses the manifests to detect and
  389. produce a warning when files from one task are overwriting those from
  390. another.
  391. .. _structure-build-tmp-sysroots-components:
  392. ``build/tmp/sysroots-components/``
  393. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  394. This directory is the location of the sysroot contents that the task
  395. :ref:`ref-tasks-prepare_recipe_sysroot`
  396. links or copies into the recipe-specific sysroot for each recipe listed
  397. in :term:`DEPENDS`. Population of this directory is
  398. handled through shared state, while the path is specified by the
  399. :term:`COMPONENTS_DIR` variable. Apart from a few
  400. unusual circumstances, handling of the ``sysroots-components`` directory
  401. should be automatic, and recipes should not directly reference
  402. ``build/tmp/sysroots-components``.
  403. .. _structure-build-tmp-sysroots:
  404. ``build/tmp/sysroots/``
  405. ~~~~~~~~~~~~~~~~~~~~~~~
  406. Previous versions of the OpenEmbedded build system used to create a
  407. global shared sysroot per machine along with a native sysroot. Since
  408. the 2.3 version of the Yocto Project, there are sysroots in
  409. recipe-specific :term:`WORKDIR` directories. Thus, the
  410. ``build/tmp/sysroots/`` directory is unused.
  411. .. note::
  412. The ``build/tmp/sysroots/`` directory can still be populated using the
  413. ``bitbake build-sysroots`` command and can be used for compatibility in some
  414. cases. However, in general it is not recommended to populate this directory.
  415. Individual recipe-specific sysroots should be used.
  416. .. _structure-build-tmp-stamps:
  417. ``build/tmp/stamps/``
  418. ~~~~~~~~~~~~~~~~~~~~~
  419. This directory holds information that BitBake uses for accounting
  420. purposes to track what tasks have run and when they have run. The
  421. directory is sub-divided by architecture, package name, and version.
  422. Here is an example::
  423. stamps/all-poky-linux/distcc-config/1.0-r0.do_build-2fdd....2do
  424. Although the files in the directory are empty of data, BitBake uses the filenames
  425. and timestamps for tracking purposes.
  426. For information on how BitBake uses stamp files to determine if a task
  427. should be rerun, see the
  428. ":ref:`overview-manual/concepts:stamp files and the rerunning of tasks`"
  429. section in the Yocto Project Overview and Concepts Manual.
  430. .. _structure-build-tmp-log:
  431. ``build/tmp/log/``
  432. ~~~~~~~~~~~~~~~~~~
  433. This directory contains general logs that are not otherwise placed using
  434. the package's :term:`WORKDIR`. Examples of logs are the output from the
  435. ``do_check_pkg`` or ``do_distro_check`` tasks. Running a build does not
  436. necessarily mean this directory is created.
  437. .. _structure-build-tmp-work:
  438. ``build/tmp/work/``
  439. ~~~~~~~~~~~~~~~~~~~
  440. This directory contains architecture-specific work sub-directories for
  441. packages built by BitBake. All tasks execute from the appropriate work
  442. directory. For example, the source for a particular package is unpacked,
  443. patched, configured and compiled all within its own work directory.
  444. Within the work directory, organization is based on the package group
  445. and version for which the source is being compiled as defined by the
  446. :term:`WORKDIR`.
  447. It is worth considering the structure of a typical work directory. As an
  448. example, consider ``linux-yocto-kernel-3.0`` on the machine ``qemux86``
  449. built within the Yocto Project. For this package, a work directory of
  450. ``tmp/work/qemux86-poky-linux/linux-yocto/3.0+git1+<.....>``, referred
  451. to as the :term:`WORKDIR`, is created. Within this directory, the source is
  452. unpacked to ``linux-qemux86-standard-build`` and then patched by Quilt.
  453. (See the ":ref:`dev-manual/quilt:using quilt in your workflow`" section in
  454. the Yocto Project Development Tasks Manual for more information.) Within
  455. the ``linux-qemux86-standard-build`` directory, standard Quilt
  456. directories ``linux-3.0/patches`` and ``linux-3.0/.pc`` are created, and
  457. standard Quilt commands can be used.
  458. There are other directories generated within :term:`WORKDIR`. The most
  459. important directory is ``WORKDIR/temp/``, which has log files for each
  460. task (``log.do_*.pid``) and contains the scripts BitBake runs for each
  461. task (``run.do_*.pid``). The ``WORKDIR/image/`` directory is where "make
  462. install" places its output that is then split into sub-packages within
  463. ``WORKDIR/packages-split/``.
  464. .. _structure-build-tmp-work-tunearch-recipename-version:
  465. ``build/tmp/work/tunearch/recipename/version/``
  466. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  467. The recipe work directory --- ``${WORKDIR}``.
  468. As described earlier in the
  469. ":ref:`structure-build-tmp-sysroots`" section,
  470. beginning with the 2.3 release of the Yocto Project, the OpenEmbedded
  471. build system builds each recipe in its own work directory (i.e.
  472. :term:`WORKDIR`). The path to the work directory is
  473. constructed using the architecture of the given build (e.g.
  474. :term:`TUNE_PKGARCH`, :term:`MACHINE_ARCH`, or "allarch"), the recipe
  475. name, and the version of the recipe (i.e.
  476. :term:`PE`\ ``:``\ :term:`PV`\ ``-``\ :term:`PR`).
  477. Here are key subdirectories within each recipe work directory:
  478. - ``${WORKDIR}/temp``: Contains the log files of each task executed for
  479. this recipe, the "run" files for each executed task, which contain
  480. the code run, and a ``log.task_order`` file, which lists the order in
  481. which tasks were executed.
  482. - ``${WORKDIR}/image``: Contains the output of the
  483. :ref:`ref-tasks-install` task, which corresponds to
  484. the ``${``\ :term:`D`\ ``}`` variable in that task.
  485. - ``${WORKDIR}/pseudo``: Contains the pseudo database and log for any
  486. tasks executed under pseudo for the recipe.
  487. - ``${WORKDIR}/sysroot-destdir``: Contains the output of the
  488. :ref:`ref-tasks-populate_sysroot` task.
  489. - ``${WORKDIR}/package``: Contains the output of the
  490. :ref:`ref-tasks-package` task before the output is
  491. split into individual packages.
  492. - ``${WORKDIR}/packages-split``: Contains the output of the
  493. :ref:`ref-tasks-package` task after the output has been split into individual
  494. packages. There are subdirectories for each individual package created by
  495. the recipe.
  496. - ``${WORKDIR}/recipe-sysroot``: A directory populated with the target
  497. dependencies of the recipe. This directory looks like the target
  498. filesystem and contains libraries that the recipe might need to link
  499. against (e.g. the C library).
  500. - ``${WORKDIR}/recipe-sysroot-native``: A directory populated with the
  501. native dependencies of the recipe. This directory contains the tools
  502. the recipe needs to build (e.g. the compiler, Autoconf, libtool, and
  503. so forth).
  504. - ``${WORKDIR}/build``: This subdirectory applies only to recipes that
  505. support builds where the source is separate from the build artifacts.
  506. The OpenEmbedded build system uses this directory as a separate build
  507. directory (i.e. ``${``\ :term:`B`\ ``}``).
  508. .. _structure-build-work-shared:
  509. ``build/tmp/work-shared/``
  510. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  511. For efficiency, the OpenEmbedded build system creates and uses this
  512. directory to hold recipes that share a work directory with other
  513. recipes. This is for example used for ``gcc`` and its variants (e.g.
  514. ``gcc-cross``, ``libgcc``, ``gcc-runtime``, and so forth), or by the
  515. :ref:`ref-classes-kernel` class to make the kernel source code and kernel build
  516. artifacts available to out-of-tree kernel modules or other kernel-dependent
  517. recipes.
  518. In practice, only a few recipes make use of the ``work-shared`` directory. This
  519. directory is especially useful for recipes that would induce a lot of storage
  520. space if they were to be shared with the standard :term:`Sysroot` mechanism.
  521. .. _structure-meta:
  522. The Metadata --- ``meta/``
  523. ==========================
  524. As mentioned previously, :term:`Metadata` is the core of the
  525. Yocto Project. Metadata has several important subdivisions:
  526. .. _structure-meta-classes:
  527. ``meta/classes*/``
  528. ------------------
  529. These directories contain the ``*.bbclass`` files. Class files are used to
  530. abstract common code so it can be reused by multiple packages. Every
  531. package inherits the :ref:`ref-classes-base` file. Examples of other important
  532. classes are :ref:`ref-classes-autotools`, which in theory allows any
  533. Autotool-enabled package to work with the Yocto Project with minimal
  534. effort. Another example is :ref:`ref-classes-kernel` that contains common code
  535. and functions for working with the Linux kernel. Functions like image
  536. generation or packaging also have their specific class files such as
  537. :ref:`ref-classes-image`, :ref:`ref-classes-rootfs*` and
  538. :ref:`package*.bbclass <ref-classes-package>`.
  539. For reference information on classes, see the
  540. ":doc:`/ref-manual/classes`" chapter.
  541. .. _structure-meta-conf:
  542. ``meta/conf/``
  543. --------------
  544. This directory contains the core set of configuration files that start
  545. from ``bitbake.conf`` and from which all other configuration files are
  546. included. See the include statements at the end of the ``bitbake.conf``
  547. file and you will note that even ``local.conf`` is loaded from there.
  548. While ``bitbake.conf`` sets up the defaults, you can often override
  549. these by using the (``local.conf``) file, machine file or the
  550. distribution configuration file.
  551. .. _structure-meta-conf-machine:
  552. ``meta/conf/machine/``
  553. ~~~~~~~~~~~~~~~~~~~~~~
  554. This directory contains all the machine configuration files. If you set
  555. ``MACHINE = "qemux86"``, the OpenEmbedded build system looks for a
  556. ``qemux86.conf`` file in this directory. The ``include`` directory
  557. contains various data common to multiple machines. If you want to add
  558. support for a new machine to the Yocto Project, look in this directory.
  559. .. _structure-meta-conf-distro:
  560. ``meta/conf/distro/``
  561. ~~~~~~~~~~~~~~~~~~~~~
  562. The contents of this directory controls any distribution-specific
  563. configurations. For the Yocto Project, the ``defaultsetup.conf`` is the
  564. main file here. This directory includes the versions and the :term:`SRCDATE`
  565. definitions for applications that are configured here. An example of an
  566. alternative configuration might be ``poky-bleeding.conf``. Although this
  567. file mainly inherits its configuration from Poky.
  568. .. _structure-meta-conf-machine-sdk:
  569. ``meta/conf/machine-sdk/``
  570. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  571. The OpenEmbedded build system searches this directory for configuration
  572. files that correspond to the value of
  573. :term:`SDKMACHINE`. By default, 32-bit and 64-bit x86
  574. files ship with the Yocto Project that support some SDK hosts. However,
  575. it is possible to extend that support to other SDK hosts by adding
  576. additional configuration files in this subdirectory within another
  577. layer.
  578. .. _structure-meta-files:
  579. ``meta/files/``
  580. ---------------
  581. This directory contains common license files and several text files used
  582. by the build system. The text files contain minimal device information
  583. and lists of files and directories with known permissions.
  584. .. _structure-meta-lib:
  585. ``meta/lib/``
  586. -------------
  587. This directory contains OpenEmbedded Python library code used during the
  588. build process. It is enabled via the ``addpylib`` directive in
  589. ``meta/conf/local.conf``. For more information, see
  590. :ref:`bitbake-user-manual/bitbake-user-manual-metadata:extending python library code`.
  591. .. _structure-meta-recipes-bsp:
  592. ``meta/recipes-bsp/``
  593. ---------------------
  594. This directory contains anything linking to specific hardware or
  595. hardware configuration information such as "u-boot" and "grub".
  596. .. _structure-meta-recipes-connectivity:
  597. ``meta/recipes-connectivity/``
  598. ------------------------------
  599. This directory contains libraries and applications related to
  600. communication with other devices.
  601. .. _structure-meta-recipes-core:
  602. ``meta/recipes-core/``
  603. ----------------------
  604. This directory contains what is needed to build a basic working Linux
  605. image including commonly used dependencies.
  606. .. _structure-meta-recipes-devtools:
  607. ``meta/recipes-devtools/``
  608. --------------------------
  609. This directory contains tools that are primarily used by the build
  610. system. The tools, however, can also be used on targets.
  611. .. _structure-meta-recipes-extended:
  612. ``meta/recipes-extended/``
  613. --------------------------
  614. This directory contains non-essential applications that add features
  615. compared to the alternatives in core. You might need this directory for
  616. full tool functionality.
  617. .. _structure-meta-recipes-gnome:
  618. ``meta/recipes-gnome/``
  619. -----------------------
  620. This directory contains all things related to the GTK+ application
  621. framework.
  622. .. _structure-meta-recipes-graphics:
  623. ``meta/recipes-graphics/``
  624. --------------------------
  625. This directory contains X and other graphically related system
  626. libraries.
  627. .. _structure-meta-recipes-kernel:
  628. ``meta/recipes-kernel/``
  629. ------------------------
  630. This directory contains the kernel and generic applications and
  631. libraries that have strong kernel dependencies.
  632. .. _structure-meta-recipes-multimedia:
  633. ``meta/recipes-multimedia/``
  634. ----------------------------
  635. This directory contains codecs and support utilities for audio, images
  636. and video.
  637. .. _structure-meta-recipes-rt:
  638. ``meta/recipes-rt/``
  639. --------------------
  640. This directory contains package and image recipes for using and testing
  641. the ``PREEMPT_RT`` kernel.
  642. .. _structure-meta-recipes-sato:
  643. ``meta/recipes-sato/``
  644. ----------------------
  645. This directory contains the Sato demo/reference UI/UX and its associated
  646. applications and configuration data.
  647. .. _structure-meta-recipes-support:
  648. ``meta/recipes-support/``
  649. -------------------------
  650. This directory contains recipes used by other recipes, but that are not
  651. directly included in images (i.e. dependencies of other recipes).
  652. .. _structure-meta-site:
  653. ``meta/site/``
  654. --------------
  655. This directory contains a list of cached results for various
  656. architectures. Because certain "autoconf" test results cannot be
  657. determined when cross-compiling due to the tests not able to run on a
  658. live system, the information in this directory is passed to "autoconf"
  659. for the various architectures.
  660. .. _structure-meta-recipes-txt:
  661. ``meta/recipes.txt``
  662. --------------------
  663. This file is a description of the contents of ``recipes-*``.