ref-structure.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  2. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
  3. <appendix id='ref-structure'>
  4. <title>Reference: Directory Structure</title>
  5. <para>
  6. Poky consists of several components and understanding what these are
  7. and where they're located is one of the keys to using it. This section walks
  8. through the Poky directory structure giving information about the various
  9. files and directories.
  10. </para>
  11. <section id='structure-core'>
  12. <title>Top level core components</title>
  13. <section id='structure-core-bitbake'>
  14. <title><filename class="directory">bitbake/</filename></title>
  15. <para>
  16. A copy of BitBake is included within Poky for ease of use, and should
  17. usually match the current BitBake stable release from the BitBake project.
  18. Bitbake, a metadata interpreter, reads the Poky metadata and runs the tasks
  19. defined in the Poky metadata. Failures are usually from the metadata, not
  20. BitBake itself, so most users don't need to worry about BitBake. The
  21. <filename class="directory">bitbake/bin/</filename> directory is placed
  22. into the PATH environment variable by the <link
  23. linkend="structure-core-script">poky-init-build-env</link> script.
  24. </para>
  25. <para>
  26. For more information on BitBake please see the BitBake project site at
  27. <ulink url="http://bitbake.berlios.de/"/>
  28. and the BitBake on-line manual at <ulink url="http://bitbake.berlios.de/manual/"/>.
  29. </para>
  30. </section>
  31. <section id='structure-core-build'>
  32. <title><filename class="directory">build/</filename></title>
  33. <para>
  34. This directory contains user configuration files and the output
  35. from Poky.
  36. </para>
  37. </section>
  38. <section id='structure-core-meta'>
  39. <title><filename class="directory">meta/</filename></title>
  40. <para>
  41. This directory contains the core metadata, a key part of Poky. Within this
  42. directory there are definitions of the machines, the Poky distribution
  43. and the packages that make up a given system.
  44. </para>
  45. </section>
  46. <section id='structure-core-meta-extras'>
  47. <title><filename class="directory">meta-extras/</filename></title>
  48. <para>
  49. This directory is similar to <filename class="directory">meta/</filename>,
  50. and contains some extra metadata not included in standard Poky. These are
  51. disabled by default, and are not supported as part of Poky.
  52. </para>
  53. </section>
  54. <section id='structure-core-scripts'>
  55. <title><filename class="directory">scripts/</filename></title>
  56. <para>
  57. This directory contains various integration scripts which implement
  58. extra functionality in the Poky environment, such as the QEMU
  59. scripts. This directory is appended to the PATH environment variable by the
  60. <link linkend="structure-core-script">poky-init-build-env</link> script.
  61. </para>
  62. </section>
  63. <section id='structure-core-sources'>
  64. <title><filename class="directory">sources/</filename></title>
  65. <para>
  66. While not part of a checkout, Poky will create this directory as
  67. part of any build. Any downloads are placed in this directory (as
  68. specified by the <glossterm><link linkend='var-DL_DIR'>DL_DIR</link>
  69. </glossterm> variable). This directory can be shared between Poky
  70. builds to save downloading files multiple times. SCM checkouts are
  71. also stored here as e.g. <filename class="directory">sources/svn/
  72. </filename>, <filename class="directory">sources/cvs/</filename> or
  73. <filename class="directory">sources/git/</filename> and the
  74. sources directory may contain archives of checkouts for various
  75. revisions or dates.
  76. </para>
  77. <para>
  78. It's worth noting that BitBake creates <filename class="extension">.md5
  79. </filename> stamp files for downloads. It uses these to mark downloads as
  80. complete as well as for checksum and access accounting purposes. If you add
  81. a file manually to the directory, you need to touch the corresponding
  82. <filename class="extension">.md5</filename> file too.
  83. </para>
  84. <para>
  85. This location can be overridden by setting <glossterm><link
  86. linkend='var-DL_DIR'>DL_DIR</link></glossterm> in <filename>local.conf
  87. </filename>. This directory can be shared between builds and even between
  88. machines via NFS, so downloads are only made once, speeding up builds.
  89. </para>
  90. </section>
  91. <section id='structure-core-script'>
  92. <title><filename>poky-init-build-env</filename></title>
  93. <para>
  94. This script is used to setup the Poky build environment. Sourcing this file in
  95. a shell makes changes to PATH and sets other core BitBake variables based on the
  96. current working directory. You need to use this before running Poky commands.
  97. Internally it uses scripts within the <filename class="directory">scripts/
  98. </filename> directory to do the bulk of the work.
  99. </para>
  100. </section>
  101. </section>
  102. <section id='structure-build'>
  103. <title><filename class="directory">build/</filename> - The Build Directory</title>
  104. <section id='structure-build-conf-local.conf'>
  105. <title><filename>build/conf/local.conf</filename></title>
  106. <para>
  107. This file contains all the local user configuration of Poky. If there
  108. is no <filename>local.conf</filename> present, it is created from
  109. <filename>local.conf.sample</filename>. The <filename>local.conf</filename>
  110. file contains documentation on the various configuration options. Any
  111. variable set here overrides any variable set elsewhere within Poky unless
  112. that variable is hardcoded within Poky (e.g. by using '=' instead of '?=').
  113. Some variables are hardcoded for various reasons but these variables are
  114. relatively rare.
  115. </para>
  116. <para>
  117. Edit this file to set the <glossterm><link linkend='var-MACHINE'>MACHINE</link></glossterm> for which you want to build, which package types you
  118. wish to use (PACKAGE_CLASSES) or where downloaded files should go
  119. (<glossterm><link linkend='var-DL_DIR'>DL_DIR</link></glossterm>).
  120. </para>
  121. </section>
  122. <section id='structure-build-tmp'>
  123. <title><filename class="directory">build/tmp/</filename></title>
  124. <para>
  125. This is created by BitBake if it doesn't exist and is where all the Poky output
  126. is placed. To clean Poky and start a build from scratch (other than downloads),
  127. you can wipe this directory. The <filename class="directory">tmp/
  128. </filename> directory has some important sub-components detailed below.
  129. </para>
  130. </section>
  131. <section id='structure-build-tmp-cache'>
  132. <title><filename class="directory">build/tmp/cache/</filename></title>
  133. <para>
  134. When BitBake parses the metadata it creates a cache file of the result which can
  135. be used when subsequently running commands. These are stored here on
  136. a per machine basis.
  137. </para>
  138. </section>
  139. <section id='structure-build-tmp-cross'>
  140. <title><filename class="directory">build/tmp/cross/</filename></title>
  141. <para>
  142. The cross compiler when generated is placed into this directory and those
  143. beneath it.
  144. </para>
  145. </section>
  146. <section id='structure-build-tmp-deploy'>
  147. <title><filename class="directory">build/tmp/deploy/</filename></title>
  148. <para>Any 'end result' output from Poky is placed under here.</para>
  149. </section>
  150. <section id='structure-build-tmp-deploy-deb'>
  151. <title><filename class="directory">build/tmp/deploy/deb/</filename></title>
  152. <para>
  153. Any .deb packages emitted by Poky are placed here, sorted into feeds for
  154. different architecture types.
  155. </para>
  156. </section>
  157. <section id='structure-build-tmp-deploy-images'>
  158. <title><filename class="directory">build/tmp/deploy/images/</filename></title>
  159. <para>
  160. Complete filesystem images are placed here. If you want to flash the resulting
  161. image from a build onto a device, look here for them.
  162. </para>
  163. </section>
  164. <section id='structure-build-tmp-deploy-ipk'>
  165. <title><filename class="directory">build/tmp/deploy/ipk/</filename></title>
  166. <para>Any resulting .ipk packages emitted by Poky are placed here.</para>
  167. </section>
  168. <section id='structure-build-tmp-rootfs'>
  169. <title><filename class="directory">build/tmp/rootfs/</filename></title>
  170. <para>
  171. This is a temporary scratch area used when creating filesystem images. It is run
  172. under fakeroot and is not useful once that fakeroot session has ended as
  173. information is lost. It is left around since it is still useful in debugging
  174. image creation problems.
  175. </para>
  176. </section>
  177. <section id='structure-build-tmp-staging'>
  178. <title><filename class="directory">build/tmp/staging/</filename></title>
  179. <para>
  180. Any package needing to share output with other packages does so within staging.
  181. This means it contains any shared header files and any shared libraries amongst
  182. other data. It is subdivided by architecture so multiple builds can run within
  183. the one build directory.
  184. </para>
  185. </section>
  186. <section id='structure-build-tmp-stamps'>
  187. <title><filename class="directory">build/tmp/stamps/</filename></title>
  188. <para>
  189. This is used by BitBake for accounting purposes to keep track of which tasks
  190. have been run and when. It is also subdivided by architecture. The files are
  191. empty and the important information is the filenames and timestamps.</para>
  192. </section>
  193. <section id='structure-build-tmp-work'>
  194. <title><filename class="directory">build/tmp/work/</filename></title>
  195. <para>
  196. This directory contains various subdirectories for each architecture, and each package built by BitBake has its own work directory under the appropriate architecture subdirectory. All tasks are executed from this work directory. As an example, the source for a particular package will be unpacked, patched, configured and compiled all within its own work directory.
  197. </para>
  198. <para>
  199. It is worth considering the structure of a typical work directory. An
  200. example is the linux-rp kernel, version 2.6.20 r7 on the machine spitz
  201. built within Poky. For this package a work directory of <filename
  202. class="directory">tmp/work/spitz-poky-linux-gnueabi/linux-rp-2.6.20-r7/
  203. </filename>, referred to as <glossterm><link linkend='var-WORKDIR'>WORKDIR
  204. </link></glossterm>, is created. Within this directory, the source is
  205. unpacked to linux-2.6.20 and then patched by quilt (see <link
  206. linkend="usingpoky-modifying-packages-quilt">Section 3.5.1</link>).
  207. Within the <filename class="directory">linux-2.6.20</filename> directory,
  208. standard Quilt directories <filename class="directory">linux-2.6.20/patches</filename>
  209. and <filename class="directory">linux-2.6.20/.pc</filename> are created,
  210. and standard quilt commands can be used.
  211. </para>
  212. <para>
  213. There are other directories generated within <glossterm><link
  214. linkend='var-WORKDIR'>WORKDIR</link></glossterm>. The most important
  215. is <glossterm><link linkend='var-WORKDIR'>WORKDIR</link></glossterm><filename class="directory">/temp/</filename> which has log files for each
  216. task (<filename>log.do_*.pid</filename>) and the scripts BitBake runs for
  217. each task (<filename>run.do_*.pid</filename>). The <glossterm><link
  218. linkend='var-WORKDIR'>WORKDIR</link></glossterm><filename
  219. class="directory">/image/</filename> directory is where <command>make
  220. install</command> places its output which is then split into subpackages
  221. within <glossterm><link linkend='var-WORKDIR'>WORKDIR</link></glossterm><filename class="directory">/install/</filename>.
  222. </para>
  223. </section>
  224. </section>
  225. <section id='structure-meta'>
  226. <title><filename class="directory">meta/</filename> - The Metadata</title>
  227. <para>
  228. As mentioned previously, this is the core of Poky. It has several
  229. important subdivisions:
  230. </para>
  231. <section id='structure-meta-classes'>
  232. <title><filename class="directory">meta/classes/</filename></title>
  233. <para>
  234. Contains the <filename class="extension">*.bbclass</filename> files. Class
  235. files are used to abstract common code allowing it to be reused by multiple
  236. packages. The <filename>base.bbclass</filename> file is inherited by every
  237. package. Examples of other important classes are
  238. <filename>autotools.bbclass</filename> that in theory allows any
  239. Autotool-enabled package to work with Poky with minimal effort, or
  240. <filename>kernel.bbclass</filename> that contains common code and functions
  241. for working with the linux kernel. Functions like image generation or
  242. packaging also have their specific class files (<filename>image.bbclass
  243. </filename>, <filename>rootfs_*.bbclass</filename> and
  244. <filename>package*.bbclass</filename>).
  245. </para>
  246. </section>
  247. <section id='structure-meta-conf'>
  248. <title><filename class="directory">meta/conf/</filename></title>
  249. <para>
  250. This is the core set of configuration files which start from
  251. <filename>bitbake.conf</filename> and from which all other configuration
  252. files are included (see the includes at the end of the file, even
  253. <filename>local.conf</filename> is loaded from there!). While
  254. <filename>bitbake.conf</filename> sets up the defaults, these can often be
  255. overridden by user (<filename>local.conf</filename>), machine or
  256. distribution configuration files.
  257. </para>
  258. </section>
  259. <section id='structure-meta-conf-machine'>
  260. <title><filename class="directory">meta/conf/machine/</filename></title>
  261. <para>
  262. Contains all the machine configuration files. If you set MACHINE="spitz", the
  263. end result is Poky looking for a <filename>spitz.conf</filename> file in this directory. The includes
  264. directory contains various data common to multiple machines. If you want to add
  265. support for a new machine to Poky, this is the directory to look in.
  266. </para>
  267. </section>
  268. <section id='structure-meta-conf-distro'>
  269. <title><filename class="directory">meta/conf/distro/</filename></title>
  270. <para>
  271. Any distribution specific configuration is controlled from here. OpenEmbedded
  272. supports multiple distributions of which Poky is one. Poky only contains the
  273. Poky distribution so poky.conf is the main file here. This includes the
  274. versions and SRCDATES for applications which are configured here. An example of
  275. an alternative configuration is poky-bleeding.conf although this mainly inherits
  276. its configuration from Poky itself.
  277. </para>
  278. </section>
  279. <section id='structure-meta-packages'>
  280. <title><filename class="directory">meta/packages/</filename></title>
  281. <para>
  282. Each application (package) Poky can build has an associated .bb file which are
  283. all stored under this directory. Poky finds them through the BBFILES variable
  284. which defaults to packages/*/*.bb. Adding a new piece of software to Poky
  285. consists of adding the appropriate .bb file. The .bb files from OpenEmbedded
  286. upstream are usually compatible although they are not supported.
  287. </para>
  288. </section>
  289. <section id='structure-meta-site'>
  290. <title><filename class="directory">meta/site/</filename></title>
  291. <para>
  292. Certain autoconf test results cannot be determined when cross compiling since it
  293. can't run tests on a live system. This directory therefore contains a list of
  294. cached results for various architectures which is passed to autoconf.
  295. </para>
  296. </section>
  297. </section>
  298. </appendix>
  299. <!--
  300. vim: expandtab tw=80 ts=4
  301. -->