ref-structure.xml 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  2. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
  3. [<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
  4. <chapter id='ref-structure'>
  5. <title>Source Directory Structure</title>
  6. <para>
  7. The <link linkend='source-directory'>Source Directory</link>
  8. consists of several components.
  9. Understanding them and knowing where they are located is key to using the
  10. Yocto Project well.
  11. This chapter describes the Source Directory and gives information about
  12. the various files and directories.
  13. </para>
  14. <para>
  15. For information on how to establish a local Source Directory on your
  16. development system, see the
  17. "<ulink url='&YOCTO_DOCS_DEV_URL;#locating-yocto-project-source-files'>Locating Yocto Project Source Files</ulink>"
  18. section in the Yocto Project Development Tasks Manual.
  19. </para>
  20. <note>
  21. The OpenEmbedded build system does not support file or directory names that
  22. contain spaces.
  23. Be sure that the Source Directory you use does not contain these types
  24. of names.
  25. </note>
  26. <section id='structure-core'>
  27. <title>Top-Level Core Components</title>
  28. <para>
  29. This section describes the top-level components of the
  30. <link linkend='source-directory'>Source Directory</link>.
  31. </para>
  32. <section id='structure-core-bitbake'>
  33. <title><filename>bitbake/</filename></title>
  34. <para>
  35. This directory includes a copy of BitBake for ease of use.
  36. The copy usually matches the current stable BitBake release from
  37. the BitBake project.
  38. BitBake, a
  39. <link linkend='metadata'>Metadata</link>
  40. interpreter, reads the Yocto Project Metadata and runs the tasks
  41. defined by that data.
  42. Failures are usually from the Metadata and not from BitBake itself.
  43. Consequently, most users do not need to worry about BitBake.
  44. </para>
  45. <para>
  46. When you run the <filename>bitbake</filename> command, the
  47. main BitBake executable, which resides in the
  48. <filename>bitbake/bin/</filename> directory, starts.
  49. Sourcing the environment setup script (i.e.
  50. <link linkend="structure-core-script"><filename>&OE_INIT_FILE;</filename></link>)
  51. places the <filename>scripts</filename> and
  52. <filename>bitbake/bin</filename> directories (in that order) into
  53. the shell's <filename>PATH</filename> environment variable.
  54. </para>
  55. <para>
  56. For more information on BitBake, see the
  57. <ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
  58. </para>
  59. </section>
  60. <section id='structure-core-build'>
  61. <title><filename>build/</filename></title>
  62. <para>
  63. This directory contains user configuration files and the output
  64. generated by the OpenEmbedded build system in its standard configuration where
  65. the source tree is combined with the output.
  66. The
  67. <link linkend='build-directory'>Build Directory</link>
  68. is created initially when you <filename>source</filename>
  69. the OpenEmbedded build environment setup script
  70. (i.e.
  71. <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
  72. </para>
  73. <para>
  74. It is also possible to place output and configuration
  75. files in a directory separate from the
  76. <link linkend='source-directory'>Source Directory</link>
  77. by providing a directory name when you <filename>source</filename>
  78. the setup script.
  79. For information on separating output from your local
  80. Source Directory files, see the
  81. "<link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>"
  82. section.
  83. </para>
  84. </section>
  85. <section id='handbook'>
  86. <title><filename>documentation/</filename></title>
  87. <para>
  88. This directory holds the source for the Yocto Project documentation
  89. as well as templates and tools that allow you to generate PDF and HTML
  90. versions of the manuals.
  91. Each manual is contained in a sub-folder.
  92. For example, the files for this manual reside in
  93. the <filename>ref-manual/</filename> directory.
  94. </para>
  95. </section>
  96. <section id='structure-core-meta'>
  97. <title><filename>meta/</filename></title>
  98. <para>
  99. This directory contains the OpenEmbedded-Core metadata.
  100. The directory holds recipes, common classes, and machine
  101. configuration for emulated targets (<filename>qemux86</filename>,
  102. <filename>qemuarm</filename>, and so forth.)
  103. </para>
  104. </section>
  105. <section id='structure-core-meta-poky'>
  106. <title><filename>meta-poky/</filename></title>
  107. <para>
  108. This directory contains the configuration for the Poky
  109. reference distribution.
  110. </para>
  111. </section>
  112. <section id='structure-core-meta-yocto-bsp'>
  113. <title><filename>meta-yocto-bsp/</filename></title>
  114. <para>
  115. This directory contains the Yocto Project reference
  116. hardware Board Support Packages (BSPs).
  117. For more information on BSPs, see the
  118. <ulink url='&YOCTO_DOCS_BSP_URL;'>Yocto Project Board Support Package (BSP) Developer's Guide</ulink>.
  119. </para>
  120. </section>
  121. <section id='structure-meta-selftest'>
  122. <title><filename>meta-selftest/</filename></title>
  123. <para>
  124. This directory adds additional recipes and append files
  125. used by the OpenEmbedded selftests to verify the behavior
  126. of the build system.
  127. </para>
  128. <para>
  129. You do not have to add this layer to your
  130. <filename>bblayers.conf</filename> file unless you want to run the
  131. selftests.
  132. </para>
  133. </section>
  134. <section id='structure-meta-skeleton'>
  135. <title><filename>meta-skeleton/</filename></title>
  136. <para>
  137. This directory contains template recipes for BSP and kernel development.
  138. </para>
  139. </section>
  140. <section id='structure-core-scripts'>
  141. <title><filename>scripts/</filename></title>
  142. <para>
  143. This directory contains various integration scripts that implement
  144. extra functionality in the Yocto Project environment (e.g. QEMU scripts).
  145. The <link linkend="structure-core-script"><filename>&OE_INIT_FILE;</filename></link>
  146. script appends this directory to the shell's
  147. <filename>PATH</filename> environment variable.
  148. </para>
  149. <para>
  150. The <filename>scripts</filename> directory has useful scripts that assist in contributing
  151. back to the Yocto Project, such as <filename>create-pull-request</filename> and
  152. <filename>send-pull-request</filename>.
  153. </para>
  154. </section>
  155. <section id='structure-core-script'>
  156. <title><filename>&OE_INIT_FILE;</filename></title>
  157. <para>
  158. This script sets up the OpenEmbedded build environment.
  159. Running this script with the <filename>source</filename> command in
  160. a shell makes changes to <filename>PATH</filename> and sets other
  161. core BitBake variables based on the current working directory.
  162. You need to run an environment setup script before running BitBake
  163. commands.
  164. The script uses other scripts within the
  165. <filename>scripts</filename> directory to do the bulk of the work.
  166. </para>
  167. <para>
  168. When you run this script, your Yocto Project environment is set
  169. up, a
  170. <link linkend='build-directory'>Build Directory</link>
  171. is created, your working directory becomes the Build Directory,
  172. and you are presented with a list of common BitBake targets.
  173. Here is an example:
  174. <literallayout class='monospaced'>
  175. $ source oe-init-build-env
  176. ### Shell environment set up for builds. ###
  177. You can now run 'bitbake &lt;target&gt;'
  178. Common targets are:
  179. core-image-minimal
  180. core-image-sato
  181. meta-toolchain
  182. meta-ide-support
  183. You can also run generated qemu images with a command like 'runqemu qemux86'
  184. </literallayout>
  185. The script gets its default list of common targets from the
  186. <filename>conf-notes.txt</filename> file, which is found in the
  187. <filename>meta-poky</filename> directory within the
  188. <link linkend='source-directory'>Source Directory</link>.
  189. Should you have custom distributions, it is very easy to modify
  190. this configuration file to include your targets for your
  191. distribution.
  192. See the
  193. "<ulink url='&YOCTO_DOCS_DEV_URL;#creating-a-custom-template-configuration-directory'>Creating a Custom Template Configuration Directory</ulink>"
  194. section in the Yocto Project Development Tasks Manual for more
  195. information.
  196. </para>
  197. <para>
  198. By default, running this script without a Build Directory
  199. argument creates the <filename>build</filename> directory
  200. in your current working directory.
  201. If you provide a Build Directory argument when you
  202. <filename>source</filename> the script, you direct the OpenEmbedded
  203. build system to create a Build Directory of your choice.
  204. For example, the following command creates a Build Directory named
  205. <filename>mybuilds</filename> that is outside of the
  206. <link linkend='source-directory'>Source Directory</link>:
  207. <literallayout class='monospaced'>
  208. $ source &OE_INIT_FILE; ~/mybuilds
  209. </literallayout>
  210. The OpenEmbedded build system uses the template configuration
  211. files, which are found by default in the
  212. <filename>meta-poky/conf</filename> directory in the
  213. Source Directory.
  214. See the
  215. "<ulink url='&YOCTO_DOCS_DEV_URL;#creating-a-custom-template-configuration-directory'>Creating a Custom Template Configuration Directory</ulink>"
  216. section in the Yocto Project Development Tasks Manual for more
  217. information.
  218. <note>
  219. The OpenEmbedded build system does not support file or directory names that
  220. contain spaces.
  221. If you attempt to run the <filename>&OE_INIT_FILE;</filename> script
  222. from a Source Directory that contains spaces in either the filenames
  223. or directory names, the script returns an error indicating no such
  224. file or directory.
  225. Be sure to use a Source Directory free of names containing spaces.
  226. </note>
  227. </para>
  228. </section>
  229. <section id='structure-basic-top-level'>
  230. <title><filename>LICENSE, README, and README.hardware</filename></title>
  231. <para>
  232. These files are standard top-level files.
  233. </para>
  234. </section>
  235. </section>
  236. <section id='structure-build'>
  237. <title>The Build Directory - <filename>build/</filename></title>
  238. <para>
  239. The OpenEmbedded build system creates the
  240. <link linkend='build-directory'>Build Directory</link>
  241. when you run the build environment setup scripts (i.e.
  242. <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
  243. </para>
  244. <para>
  245. If you do not give the Build Directory a specific name when you run
  246. a setup script, the name defaults to <filename>build</filename>.
  247. </para>
  248. <para>
  249. The
  250. <link linkend='var-TOPDIR'><filename>TOPDIR</filename></link> variable
  251. points to the Build Directory.
  252. </para>
  253. <section id='structure-build-buildhistory'>
  254. <title><filename>build/buildhistory</filename></title>
  255. <para>
  256. The OpenEmbedded build system creates this directory when you
  257. enable the build history feature.
  258. The directory tracks build information into image, packages, and
  259. SDK subdirectories.
  260. For information on the build history feature, see the
  261. "<ulink url='&YOCTO_DOCS_DEV_URL;#maintaining-build-output-quality'>Maintaining Build Output Quality</ulink>"
  262. section in the Yocto Project Development Tasks Manual.
  263. </para>
  264. </section>
  265. <section id='structure-build-conf-local.conf'>
  266. <title><filename>build/conf/local.conf</filename></title>
  267. <para>
  268. This configuration file contains all the local user configurations
  269. for your build environment.
  270. The <filename>local.conf</filename> file contains documentation on
  271. the various configuration options.
  272. Any variable set here overrides any variable set elsewhere within
  273. the environment unless that variable is hard-coded within a file
  274. (e.g. by using '=' instead of '?=').
  275. Some variables are hard-coded for various reasons but these
  276. variables are relatively rare.
  277. </para>
  278. <para>
  279. Edit this file to set the
  280. <filename><link linkend='var-MACHINE'>MACHINE</link></filename>
  281. for which you want to build, which package types you wish to use
  282. (<link linkend='var-PACKAGE_CLASSES'><filename>PACKAGE_CLASSES</filename></link>),
  283. and the location from which you want to access downloaded files
  284. (<filename><link linkend='var-DL_DIR'>DL_DIR</link></filename>).
  285. </para>
  286. <para>
  287. If <filename>local.conf</filename> is not present when you
  288. start the build, the OpenEmbedded build system creates it from
  289. <filename>local.conf.sample</filename> when
  290. you <filename>source</filename> the top-level build environment
  291. setup script (i.e.
  292. <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
  293. </para>
  294. <para>
  295. The source <filename>local.conf.sample</filename> file used
  296. depends on the <filename>$TEMPLATECONF</filename> script variable,
  297. which defaults to <filename>meta-poky/conf</filename>
  298. when you are building from the Yocto Project development
  299. environment and defaults to <filename>meta/conf</filename> when
  300. you are building from the OpenEmbedded-Core environment.
  301. Because the script variable points to the source of the
  302. <filename>local.conf.sample</filename> file, this implies that
  303. you can configure your build environment from any layer by setting
  304. the variable in the top-level build environment setup script as
  305. follows:
  306. <literallayout class='monospaced'>
  307. TEMPLATECONF=<replaceable>your_layer</replaceable>/conf
  308. </literallayout>
  309. Once the build process gets the sample file, it uses
  310. <filename>sed</filename> to substitute final
  311. <filename>${</filename><link linkend='var-OEROOT'><filename>OEROOT</filename></link><filename>}</filename>
  312. values for all <filename>##OEROOT##</filename> values.
  313. <note>
  314. You can see how the <filename>TEMPLATECONF</filename> variable
  315. is used by looking at the
  316. <filename>scripts/oe-setup-builddir</filename> script in the
  317. <link linkend='source-directory'>Source Directory</link>.
  318. You can find the Yocto Project version of the
  319. <filename>local.conf.sample</filename> file in the
  320. <filename>meta-poky/conf</filename> directory.
  321. </note>
  322. </para>
  323. </section>
  324. <section id='structure-build-conf-bblayers.conf'>
  325. <title><filename>build/conf/bblayers.conf</filename></title>
  326. <para>
  327. This configuration file defines
  328. <ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>layers</ulink>,
  329. which are directory trees, traversed (or walked) by BitBake.
  330. The <filename>bblayers.conf</filename> file uses the
  331. <link linkend='var-BBLAYERS'><filename>BBLAYERS</filename></link>
  332. variable to list the layers BitBake tries to find.
  333. </para>
  334. <para>
  335. If <filename>bblayers.conf</filename> is not present when you
  336. start the build, the OpenEmbedded build system creates it from
  337. <filename>bblayers.conf.sample</filename> when
  338. you <filename>source</filename> the top-level build environment
  339. setup script (i.e.
  340. <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
  341. </para>
  342. <para>
  343. The source <filename>bblayers.conf.sample</filename> file used
  344. depends on the <filename>$TEMPLATECONF</filename> script variable,
  345. which defaults to <filename>meta-poky/conf</filename>
  346. when you are building from the Yocto Project development
  347. environment and defaults to <filename>meta/conf</filename> when
  348. you are building from the OpenEmbedded-Core environment.
  349. Because the script variable points to the source of the
  350. <filename>bblayers.conf.sample</filename> file, this implies that
  351. you can base your build from any layer by setting the variable in
  352. the top-level build environment setup script as follows:
  353. <literallayout class='monospaced'>
  354. TEMPLATECONF=<replaceable>your_layer</replaceable>/conf
  355. </literallayout>
  356. Once the build process gets the sample file, it uses
  357. <filename>sed</filename> to substitute final
  358. <filename>${</filename><link linkend='var-OEROOT'><filename>OEROOT</filename></link><filename>}</filename>
  359. values for all <filename>##OEROOT##</filename> values.
  360. <note>
  361. You can see how the <filename>TEMPLATECONF</filename> variable
  362. <filename>scripts/oe-setup-builddir</filename> script in the
  363. <link linkend='source-directory'>Source Directory</link>.
  364. You can find the Yocto Project version of the
  365. <filename>bblayers.conf.sample</filename> file in the
  366. <filename>meta-poky/conf</filename> directory.
  367. </note>
  368. </para>
  369. </section>
  370. <section id='structure-build-conf-sanity_info'>
  371. <title><filename>build/conf/sanity_info</filename></title>
  372. <para>
  373. This file indicates the state of the sanity checks and is created
  374. during the build.
  375. </para>
  376. </section>
  377. <section id='structure-build-downloads'>
  378. <title><filename>build/downloads/</filename></title>
  379. <para>
  380. This directory contains downloaded upstream source tarballs.
  381. You can reuse the directory for multiple builds or move
  382. the directory to another location.
  383. You can control the location of this directory through the
  384. <filename><link linkend='var-DL_DIR'>DL_DIR</link></filename> variable.
  385. </para>
  386. </section>
  387. <section id='structure-build-sstate-cache'>
  388. <title><filename>build/sstate-cache/</filename></title>
  389. <para>
  390. This directory contains the shared state cache.
  391. You can reuse the directory for multiple builds or move
  392. the directory to another location.
  393. You can control the location of this directory through the
  394. <filename><link linkend='var-SSTATE_DIR'>SSTATE_DIR</link></filename> variable.
  395. </para>
  396. </section>
  397. <section id='structure-build-tmp'>
  398. <title><filename>build/tmp/</filename></title>
  399. <para>
  400. The OpenEmbedded build system creates and uses this directory
  401. for all the build system's output.
  402. The
  403. <link linkend='var-TMPDIR'><filename>TMPDIR</filename></link>
  404. variable points to this directory.
  405. </para>
  406. <para>
  407. BitBake creates this directory if it does not exist.
  408. As a last resort, to clean up a build and start it from scratch
  409. (other than the downloads), you can remove everything in the
  410. <filename>tmp</filename> directory or get rid of the
  411. directory completely.
  412. If you do, you should also completely remove the
  413. <filename>build/sstate-cache</filename> directory.
  414. </para>
  415. </section>
  416. <section id='structure-build-tmp-buildstats'>
  417. <title><filename>build/tmp/buildstats/</filename></title>
  418. <para>
  419. This directory stores the build statistics.
  420. </para>
  421. </section>
  422. <section id='structure-build-tmp-cache'>
  423. <title><filename>build/tmp/cache/</filename></title>
  424. <para>
  425. When BitBake parses the metadata (recipes and configuration files),
  426. it caches the results in <filename>build/tmp/cache/</filename>
  427. to speed up future builds.
  428. The results are stored on a per-machine basis.
  429. </para>
  430. <para>
  431. During subsequent builds, BitBake checks each recipe (together
  432. with, for example, any files included or appended to it) to see
  433. if they have been modified.
  434. Changes can be detected, for example, through file modification
  435. time (mtime) changes and hashing of file contents.
  436. If no changes to the file are detected, then the parsed result
  437. stored in the cache is reused.
  438. If the file has changed, it is reparsed.
  439. </para>
  440. </section>
  441. <section id='structure-build-tmp-deploy'>
  442. <title><filename>build/tmp/deploy/</filename></title>
  443. <para>
  444. This directory contains any "end result" output from the
  445. OpenEmbedded build process.
  446. The <link linkend='var-DEPLOY_DIR'><filename>DEPLOY_DIR</filename></link>
  447. variable points to this directory.
  448. For more detail on the contents of the <filename>deploy</filename>
  449. directory, see the
  450. "<ulink url='&YOCTO_DOCS_OM_URL;#images-dev-environment'>Images</ulink>"
  451. and
  452. "<ulink url='&YOCTO_DOCS_OM_URL;#sdk-dev-environment'>Application Development SDK</ulink>"
  453. sections in the Yocto Project Overview and Concepts Manual.
  454. </para>
  455. </section>
  456. <section id='structure-build-tmp-deploy-deb'>
  457. <title><filename>build/tmp/deploy/deb/</filename></title>
  458. <para>
  459. This directory receives any <filename>.deb</filename> packages produced by
  460. the build process.
  461. The packages are sorted into feeds for different architecture types.
  462. </para>
  463. </section>
  464. <section id='structure-build-tmp-deploy-rpm'>
  465. <title><filename>build/tmp/deploy/rpm/</filename></title>
  466. <para>
  467. This directory receives any <filename>.rpm</filename> packages produced by
  468. the build process.
  469. The packages are sorted into feeds for different architecture types.
  470. </para>
  471. </section>
  472. <section id='structure-build-tmp-deploy-ipk'>
  473. <title><filename>build/tmp/deploy/ipk/</filename></title>
  474. <para>
  475. This directory receives <filename>.ipk</filename> packages produced by
  476. the build process.
  477. </para>
  478. </section>
  479. <section id='structure-build-tmp-deploy-licenses'>
  480. <title><filename>build/tmp/deploy/licenses/</filename></title>
  481. <para>
  482. This directory receives package licensing information.
  483. For example, the directory contains sub-directories for <filename>bash</filename>,
  484. <filename>busybox</filename>, and <filename>glibc</filename> (among others) that in turn
  485. contain appropriate <filename>COPYING</filename> license files with other licensing information.
  486. For information on licensing, see the
  487. "<ulink url='&YOCTO_DOCS_DEV_URL;#maintaining-open-source-license-compliance-during-your-products-lifecycle'>Maintaining Open Source License Compliance During Your Product's Lifecycle</ulink>"
  488. section in the Yocto Project Development Tasks Manual.
  489. </para>
  490. </section>
  491. <section id='structure-build-tmp-deploy-images'>
  492. <title><filename>build/tmp/deploy/images/</filename></title>
  493. <para>
  494. This directory receives complete filesystem images.
  495. If you want to flash the resulting image from a build onto a device, look here for the image.
  496. </para>
  497. <para>
  498. Be careful when deleting files in this directory.
  499. You can safely delete old images from this directory (e.g.
  500. <filename>core-image-*</filename>).
  501. However, the kernel (<filename>*zImage*</filename>, <filename>*uImage*</filename>, etc.),
  502. bootloader and other supplementary files might be deployed here prior to building an
  503. image.
  504. Because these files are not directly produced from the image, if you
  505. delete them they will not be automatically re-created when you build the image again.
  506. </para>
  507. <para>
  508. If you do accidentally delete files here, you will need to force them to be
  509. re-created.
  510. In order to do that, you will need to know the target that produced them.
  511. For example, these commands rebuild and re-create the kernel files:
  512. <literallayout class='monospaced'>
  513. $ bitbake -c clean virtual/kernel
  514. $ bitbake virtual/kernel
  515. </literallayout>
  516. </para>
  517. </section>
  518. <section id='structure-build-tmp-deploy-sdk'>
  519. <title><filename>build/tmp/deploy/sdk/</filename></title>
  520. <para>
  521. The OpenEmbedded build system creates this directory to hold
  522. toolchain installer scripts, which when executed, install the
  523. sysroot that matches your target hardware.
  524. You can find out more about these installers in the
  525. "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-building-an-sdk-installer'>Building an SDK Installer</ulink>"
  526. section in the Yocto Project Application Development and the
  527. Extensible Software Development Kit (eSDK) manual.
  528. </para>
  529. </section>
  530. <section id='structure-build-tmp-sstate-control'>
  531. <title><filename>build/tmp/sstate-control/</filename></title>
  532. <para>
  533. The OpenEmbedded build system uses this directory for the
  534. shared state manifest files.
  535. The shared state code uses these files to record the files
  536. installed by each sstate task so that the files can be removed
  537. when cleaning the recipe or when a newer version is about to
  538. be installed.
  539. The build system also uses the manifests to detect and produce
  540. a warning when files from one task are overwriting those from
  541. another.
  542. </para>
  543. </section>
  544. <section id='structure-build-tmp-sysroots-components'>
  545. <title><filename>build/tmp/sysroots-components/</filename></title>
  546. <para>
  547. This directory is the location of the sysroot contents that the
  548. task
  549. <link linkend='ref-tasks-prepare_recipe_sysroot'><filename>do_prepare_recipe_sysroot</filename></link>
  550. links or copies into the recipe-specific sysroot for each
  551. recipe listed in
  552. <link linkend='var-DEPENDS'><filename>DEPENDS</filename></link>.
  553. Population of this directory is handled through shared state, while
  554. the path is specified by the
  555. <link linkend='var-COMPONENTS_DIR'><filename>COMPONENTS_DIR</filename></link>
  556. variable. Apart from a few unusual circumstances, handling of the
  557. <filename>sysroots-components</filename> directory should be
  558. automatic, and recipes should not directly reference
  559. <filename>build/tmp/sysroots-components</filename>.
  560. </para>
  561. </section>
  562. <section id='structure-build-tmp-sysroots'>
  563. <title><filename>build/tmp/sysroots/</filename></title>
  564. <para>
  565. Previous versions of the OpenEmbedded build system used to
  566. create a global shared sysroot per machine along with a native
  567. sysroot.
  568. Beginning with the &DISTRO; version of the Yocto Project,
  569. sysroots exist in recipe-specific
  570. <link linkend='var-WORKDIR'><filename>WORKDIR</filename></link>
  571. directories.
  572. Thus, the <filename>build/tmp/sysroots/</filename> directory
  573. is unused.
  574. <note>
  575. The <filename>build/tmp/sysroots/</filename> directory
  576. can still be populated using the
  577. <filename>bitbake build-sysroots</filename> command and can
  578. be used for compatibility in some cases.
  579. However, in general it is not recommended to populate
  580. this directory.
  581. Individual recipe-specific sysroots should be used.
  582. </note>
  583. </para>
  584. </section>
  585. <section id='structure-build-tmp-stamps'>
  586. <title><filename>build/tmp/stamps/</filename></title>
  587. <para>
  588. This directory holds information that BitBake uses for
  589. accounting purposes to track what tasks have run and when they
  590. have run.
  591. The directory is sub-divided by architecture, package name, and
  592. version.
  593. Following is an example:
  594. <literallayout class='monospaced'>
  595. stamps/all-poky-linux/distcc-config/1.0-r0.do_build-2fdd....2do
  596. </literallayout>
  597. Although the files in the directory are empty of data,
  598. BitBake uses the filenames and timestamps for tracking purposes.
  599. </para>
  600. <para>
  601. For information on how BitBake uses stamp files to determine if
  602. a task should be rerun, see the
  603. "<ulink url='&YOCTO_DOCS_OM_URL;#stamp-files-and-the-rerunning-of-tasks'>Stamp Files and the Rerunning of Tasks</ulink>"
  604. section in the Yocto Project Overview and Concepts Manual.
  605. </para>
  606. </section>
  607. <section id='structure-build-tmp-log'>
  608. <title><filename>build/tmp/log/</filename></title>
  609. <para>
  610. This directory contains general logs that are not otherwise placed using the
  611. package's <filename><link linkend='var-WORKDIR'>WORKDIR</link></filename>.
  612. Examples of logs are the output from the
  613. <filename>do_check_pkg</filename> or
  614. <filename>do_distro_check</filename> tasks.
  615. Running a build does not necessarily mean this directory is created.
  616. </para>
  617. </section>
  618. <section id='structure-build-tmp-work'>
  619. <title><filename>build/tmp/work/</filename></title>
  620. <para>
  621. This directory contains architecture-specific work sub-directories
  622. for packages built by BitBake.
  623. All tasks execute from the appropriate work directory.
  624. For example, the source for a particular package is unpacked,
  625. patched, configured and compiled all within its own work directory.
  626. Within the work directory, organization is based on the package group
  627. and version for which the source is being compiled
  628. as defined by the
  629. <link linkend='var-WORKDIR'><filename>WORKDIR</filename></link>.
  630. </para>
  631. <para>
  632. It is worth considering the structure of a typical work directory.
  633. As an example, consider <filename>linux-yocto-kernel-3.0</filename>
  634. on the machine <filename>qemux86</filename>
  635. built within the Yocto Project.
  636. For this package, a work directory of
  637. <filename>tmp/work/qemux86-poky-linux/linux-yocto/3.0+git1+&lt;.....&gt;</filename>,
  638. referred to as the <filename>WORKDIR</filename>, is created.
  639. Within this directory, the source is unpacked to
  640. <filename>linux-qemux86-standard-build</filename> and then patched by Quilt.
  641. (See the
  642. "<ulink url='&YOCTO_DOCS_DEV_URL;#using-a-quilt-workflow'>Using Quilt in Your Workflow</ulink>"
  643. section in the Yocto Project Development Tasks Manual for more
  644. information.)
  645. Within the <filename>linux-qemux86-standard-build</filename> directory,
  646. standard Quilt directories <filename>linux-3.0/patches</filename>
  647. and <filename>linux-3.0/.pc</filename> are created,
  648. and standard Quilt commands can be used.
  649. </para>
  650. <para>
  651. There are other directories generated within <filename>WORKDIR</filename>.
  652. The most important directory is <filename>WORKDIR/temp/</filename>,
  653. which has log files for each task (<filename>log.do_*.pid</filename>)
  654. and contains the scripts BitBake runs for each task
  655. (<filename>run.do_*.pid</filename>).
  656. The <filename>WORKDIR/image/</filename> directory is where "make
  657. install" places its output that is then split into sub-packages
  658. within <filename>WORKDIR/packages-split/</filename>.
  659. </para>
  660. </section>
  661. <section id='structure-build-tmp-work-tunearch-recipename-version'>
  662. <title><filename>build/tmp/work/<replaceable>tunearch</replaceable>/<replaceable>recipename</replaceable>/<replaceable>version</replaceable>/</filename></title>
  663. <para>
  664. The recipe work directory - <filename>${WORKDIR}</filename>.
  665. </para>
  666. <para>
  667. As described earlier in the
  668. "<link linkend='structure-build-tmp-sysroots'><filename>build/tmp/sysroots/</filename></link>"
  669. section, beginning with the &DISTRO; release of the Yocto
  670. Project, the OpenEmbedded build system builds each recipe in its
  671. own work directory (i.e.
  672. <link linkend='var-WORKDIR'><filename>WORKDIR</filename></link>).
  673. The path to the work directory is constructed using the
  674. architecture of the given build (e.g.
  675. <link linkend='var-TUNE_PKGARCH'><filename>TUNE_PKGARCH</filename></link>,
  676. <link linkend='var-MACHINE_ARCH'><filename>MACHINE_ARCH</filename></link>,
  677. or "allarch"), the recipe name, and the version of the recipe (i.e.
  678. <link linkend='var-PE'><filename>PE</filename></link><filename>:</filename><link linkend='var-PV'><filename>PV</filename></link><filename>-</filename><link linkend='var-PR'><filename>PR</filename></link>).
  679. </para>
  680. <para>
  681. A number of key subdirectories exist within each recipe
  682. work directory:
  683. <itemizedlist>
  684. <listitem><para>
  685. <filename>${WORKDIR}/temp</filename>:
  686. Contains the log files of each task executed for this
  687. recipe, the "run" files for each executed task, which
  688. contain the code run, and a
  689. <filename>log.task_order</filename> file, which lists the
  690. order in which tasks were executed.
  691. </para></listitem>
  692. <listitem><para>
  693. <filename>${WORKDIR}/image</filename>:
  694. Contains the output of the
  695. <link linkend='ref-tasks-install'><filename>do_install</filename></link>
  696. task, which corresponds to the
  697. <filename>${</filename><link linkend='var-D'><filename>D</filename></link><filename>}</filename>
  698. variable in that task.
  699. </para></listitem>
  700. <listitem><para>
  701. <filename>${WORKDIR}/pseudo</filename>:
  702. Contains the pseudo database and log for any tasks executed
  703. under pseudo for the recipe.
  704. </para></listitem>
  705. <listitem><para>
  706. <filename>${WORKDIR}/sysroot-destdir</filename>:
  707. Contains the output of the
  708. <link linkend='ref-tasks-populate_sysroot'><filename>do_populate_sysroot</filename></link>
  709. task.
  710. </para></listitem>
  711. <listitem><para>
  712. <filename>${WORKDIR}/package</filename>:
  713. Contains the output of the
  714. <link linkend='ref-tasks-package'><filename>do_package</filename></link>
  715. task before the output is split into individual packages.
  716. </para></listitem>
  717. <listitem><para>
  718. <filename>${WORKDIR}/packages-split</filename>:
  719. Contains the output of the <filename>do_package</filename>
  720. task after the output has been split into individual
  721. packages.
  722. Subdirectories exist for each individual package created
  723. by the recipe.
  724. </para></listitem>
  725. <listitem><para>
  726. <filename>${WORKDIR}/recipe-sysroot</filename>:
  727. A directory populated with the target dependencies of the
  728. recipe.
  729. This directory looks like the target filesystem and
  730. contains libraries that the recipe might need to link
  731. against (e.g. the C library).
  732. </para></listitem>
  733. <listitem><para>
  734. <filename>${WORKDIR}/recipe-sysroot-native</filename>:
  735. A directory populated with the native dependencies of the
  736. recipe.
  737. This directory contains the tools the recipe needs to build
  738. (e.g. the compiler, Autoconf, libtool, and so forth).
  739. </para></listitem>
  740. <listitem><para>
  741. <filename>${WORKDIR}/build</filename>:
  742. This subdirectory applies only to recipes that support
  743. builds where the source is separate from the
  744. build artifacts.
  745. The OpenEmbedded build system uses this directory as a
  746. separate build directory (i.e.
  747. <filename>${</filename><link linkend='var-B'><filename>B</filename></link><filename>}</filename>).
  748. </para></listitem>
  749. </itemizedlist>
  750. </para>
  751. </section>
  752. <section id='structure-build-work-shared'>
  753. <title><filename>build/tmp/work-shared/</filename></title>
  754. <para>
  755. For efficiency, the OpenEmbedded build system creates and uses
  756. this directory to hold recipes that share a work directory with
  757. other recipes.
  758. In practice, this is only used for <filename>gcc</filename>
  759. and its variants (e.g. <filename>gcc-cross</filename>,
  760. <filename>libgcc</filename>, <filename>gcc-runtime</filename>,
  761. and so forth).
  762. </para>
  763. </section>
  764. </section>
  765. <section id='structure-meta'>
  766. <title>The Metadata - <filename>meta/</filename></title>
  767. <para>
  768. As mentioned previously,
  769. <link linkend='metadata'>Metadata</link> is the core
  770. of the Yocto Project.
  771. Metadata has several important subdivisions:
  772. </para>
  773. <section id='structure-meta-classes'>
  774. <title><filename>meta/classes/</filename></title>
  775. <para>
  776. This directory contains the <filename>*.bbclass</filename> files.
  777. Class files are used to abstract common code so it can be reused by multiple
  778. packages.
  779. Every package inherits the <filename>base.bbclass</filename> file.
  780. Examples of other important classes are <filename>autotools.bbclass</filename>, which
  781. in theory allows any Autotool-enabled package to work with the Yocto Project with minimal effort.
  782. Another example is <filename>kernel.bbclass</filename> that contains common code and functions
  783. for working with the Linux kernel.
  784. Functions like image generation or packaging also have their specific class files
  785. such as <filename>image.bbclass</filename>, <filename>rootfs_*.bbclass</filename> and
  786. <filename>package*.bbclass</filename>.
  787. </para>
  788. <para>
  789. For reference information on classes, see the
  790. "<link linkend='ref-classes'>Classes</link>" chapter.
  791. </para>
  792. </section>
  793. <section id='structure-meta-conf'>
  794. <title><filename>meta/conf/</filename></title>
  795. <para>
  796. This directory contains the core set of configuration files that start from
  797. <filename>bitbake.conf</filename> and from which all other configuration
  798. files are included.
  799. See the include statements at the end of the
  800. <filename>bitbake.conf</filename> file and you will note that even
  801. <filename>local.conf</filename> is loaded from there.
  802. While <filename>bitbake.conf</filename> sets up the defaults, you can often override
  803. these by using the (<filename>local.conf</filename>) file, machine file or
  804. the distribution configuration file.
  805. </para>
  806. </section>
  807. <section id='structure-meta-conf-machine'>
  808. <title><filename>meta/conf/machine/</filename></title>
  809. <para>
  810. This directory contains all the machine configuration files.
  811. If you set <filename>MACHINE = "qemux86"</filename>,
  812. the OpenEmbedded build system looks for a <filename>qemux86.conf</filename> file in this
  813. directory.
  814. The <filename>include</filename> directory contains various data common to multiple machines.
  815. If you want to add support for a new machine to the Yocto Project, look in this directory.
  816. </para>
  817. </section>
  818. <section id='structure-meta-conf-distro'>
  819. <title><filename>meta/conf/distro/</filename></title>
  820. <para>
  821. The contents of this directory controls any distribution-specific
  822. configurations.
  823. For the Yocto Project, the <filename>defaultsetup.conf</filename> is the main file here.
  824. This directory includes the versions and the
  825. <filename>SRCDATE</filename> definitions for applications that are configured here.
  826. An example of an alternative configuration might be <filename>poky-bleeding.conf</filename>.
  827. Although this file mainly inherits its configuration from Poky.
  828. </para>
  829. </section>
  830. <section id='structure-meta-conf-machine-sdk'>
  831. <title><filename>meta/conf/machine-sdk/</filename></title>
  832. <para>
  833. The OpenEmbedded build system searches this directory for
  834. configuration files that correspond to the value of
  835. <link linkend='var-SDKMACHINE'><filename>SDKMACHINE</filename></link>.
  836. By default, 32-bit and 64-bit x86 files ship with the Yocto
  837. Project that support some SDK hosts.
  838. However, it is possible to extend that support to other SDK hosts
  839. by adding additional configuration files in this subdirectory
  840. within another layer.
  841. </para>
  842. </section>
  843. <section id='structure-meta-files'>
  844. <title><filename>meta/files/</filename></title>
  845. <para>
  846. This directory contains common license files and several text files
  847. used by the build system.
  848. The text files contain minimal device information and
  849. lists of files and directories with known permissions.
  850. </para>
  851. </section>
  852. <section id='structure-meta-lib'>
  853. <title><filename>meta/lib/</filename></title>
  854. <para>
  855. This directory contains OpenEmbedded Python library code
  856. used during the build process.
  857. </para>
  858. </section>
  859. <section id='structure-meta-recipes-bsp'>
  860. <title><filename>meta/recipes-bsp/</filename></title>
  861. <para>
  862. This directory contains anything linking to specific hardware or hardware
  863. configuration information such as "u-boot" and "grub".
  864. </para>
  865. </section>
  866. <section id='structure-meta-recipes-connectivity'>
  867. <title><filename>meta/recipes-connectivity/</filename></title>
  868. <para>
  869. This directory contains libraries and applications related to communication with other devices.
  870. </para>
  871. </section>
  872. <section id='structure-meta-recipes-core'>
  873. <title><filename>meta/recipes-core/</filename></title>
  874. <para>
  875. This directory contains what is needed to build a basic working Linux image
  876. including commonly used dependencies.
  877. </para>
  878. </section>
  879. <section id='structure-meta-recipes-devtools'>
  880. <title><filename>meta/recipes-devtools/</filename></title>
  881. <para>
  882. This directory contains tools that are primarily used by the build system.
  883. The tools, however, can also be used on targets.
  884. </para>
  885. </section>
  886. <section id='structure-meta-recipes-extended'>
  887. <title><filename>meta/recipes-extended/</filename></title>
  888. <para>
  889. This directory contains non-essential applications that add features compared to the
  890. alternatives in core.
  891. You might need this directory for full tool functionality or for Linux Standard Base (LSB)
  892. compliance.
  893. </para>
  894. </section>
  895. <section id='structure-meta-recipes-gnome'>
  896. <title><filename>meta/recipes-gnome/</filename></title>
  897. <para>
  898. This directory contains all things related to the GTK+ application framework.
  899. </para>
  900. </section>
  901. <section id='structure-meta-recipes-graphics'>
  902. <title><filename>meta/recipes-graphics/</filename></title>
  903. <para>
  904. This directory contains X and other graphically related system libraries
  905. </para>
  906. </section>
  907. <section id='structure-meta-recipes-kernel'>
  908. <title><filename>meta/recipes-kernel/</filename></title>
  909. <para>
  910. This directory contains the kernel and generic applications and libraries that
  911. have strong kernel dependencies.
  912. </para>
  913. </section>
  914. <section id='structure-meta-recipes-lsb4'>
  915. <title><filename>meta/recipes-lsb4/</filename></title>
  916. <para>
  917. This directory contains recipes specifically added to support
  918. the Linux Standard Base (LSB) version 4.x.
  919. </para>
  920. </section>
  921. <section id='structure-meta-recipes-multimedia'>
  922. <title><filename>meta/recipes-multimedia/</filename></title>
  923. <para>
  924. This directory contains codecs and support utilities for audio, images and video.
  925. </para>
  926. </section>
  927. <section id='structure-meta-recipes-rt'>
  928. <title><filename>meta/recipes-rt/</filename></title>
  929. <para>
  930. This directory contains package and image recipes for using and testing
  931. the <filename>PREEMPT_RT</filename> kernel.
  932. </para>
  933. </section>
  934. <section id='structure-meta-recipes-sato'>
  935. <title><filename>meta/recipes-sato/</filename></title>
  936. <para>
  937. This directory contains the Sato demo/reference UI/UX and its associated applications
  938. and configuration data.
  939. </para>
  940. </section>
  941. <section id='structure-meta-recipes-support'>
  942. <title><filename>meta/recipes-support/</filename></title>
  943. <para>
  944. This directory contains recipes used by other recipes, but that are
  945. not directly included in images (i.e. dependencies of other
  946. recipes).
  947. </para>
  948. </section>
  949. <section id='structure-meta-site'>
  950. <title><filename>meta/site/</filename></title>
  951. <para>
  952. This directory contains a list of cached results for various architectures.
  953. Because certain "autoconf" test results cannot be determined when cross-compiling due to
  954. the tests not able to run on a live system, the information in this directory is
  955. passed to "autoconf" for the various architectures.
  956. </para>
  957. </section>
  958. <section id='structure-meta-recipes-txt'>
  959. <title><filename>meta/recipes.txt</filename></title>
  960. <para>
  961. This file is a description of the contents of <filename>recipes-*</filename>.
  962. </para>
  963. </section>
  964. </section>
  965. </chapter>
  966. <!--
  967. vim: expandtab tw=80 ts=4
  968. -->