structure.rst 31 KB

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