ref-structure.xml 49 KB

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