ref-structure.rst 31 KB

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