ref-structure.xml 48 KB

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