README.structure 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. A walk through the poky directory tree
  2. ======================================
  3. Poky consists of several components and understanding what these are and where
  4. they each live is one of the keys to using it.
  5. Top level core components
  6. =========================
  7. bitbake/
  8. A copy of bitbake is included within poky for ease of use and resides here.
  9. This should usually be the same as a standard bitbake release from the bitbake
  10. project. Bitbake is a metadata interpreter and is responsible for reading the
  11. poky metadata and running the tasks it defines. Failures are usually from the
  12. metadata and not bitbake itself and most users don't need to worry about
  13. bitbake. bitbake/bin is placed into the PATH environmental variable so bitbake
  14. can be found.
  15. build/
  16. This directory contains user configuration files and the output from Poky is
  17. also placed here.
  18. meta/
  19. The core metadata - this is the key part of poky. Within this directory there
  20. are definitions of the machines, the poky distribution and the packages that
  21. make up a given system.
  22. meta-extras/
  23. Similar to meta containing some extra package files not included in standard
  24. poky, disabled by default and hence not supported as part of poky.
  25. scripts/
  26. Various integration scripts which implement extra functionality in the poky
  27. environment for example the qemu scripts. This directory is appended to the
  28. PATH environmental variable.
  29. sources/
  30. Whilst not part of a checkout, poky will create this directory as part of any
  31. build. Any downloads are placed in this directory (as specified by the
  32. DL_DIR variable). This directory can be shared between poky builds to save
  33. downloading files multiple times. SCM checkouts are also stored here as e.g.
  34. sources/svn/, sources/cvs/ or sources/git/ and the sources directory may contain
  35. archives of checkouts for various revisions or dates.
  36. Its worth noting that bitbake creates .md5 stamp files for downloads. It uses
  37. these to mark downloads as complete as well as for checksum and access
  38. accounting purposes. If you add a file manually to the directory, you need to
  39. touch the corresponding .md5 file too.
  40. poky-init-build-env
  41. This script is used to setup the poky build environment. Sourcing this file in
  42. a shell makes changes to PATH and sets other core bitbake variables based on the
  43. current working directory. You need to use this before running poky commands.
  44. Internally it uses scripts within the scripts/ directory to do the bulk of the
  45. work.
  46. The Build Directory
  47. ===================
  48. conf/local.conf
  49. This file contains all the local user configuration of poky. If it isn't
  50. present, its created from local.conf.sample. That file contains documentation
  51. on the various standard options which can be configured there although any
  52. standard conf file variable can be also be set here and usually overrides any
  53. variable set elsewhere within poky.
  54. Edit this file to set the MACHINE you want to build for, which package types you
  55. which to use (PACKAGE_CLASSES) or where downloaded files should go (DL_DIR) for
  56. exmaple.
  57. tmp/
  58. This is created by bitbake if it doesn't exist and is where all the poky output
  59. is placed. To clean poky and start a build from scratch (other than downloads),
  60. you can wipe this directory. tmp has some important subcomponents detailed
  61. below.
  62. tmp/cache/
  63. When bitbake parses the metadata it creates a cache file of the result which can
  64. be used when subsequently running the command. These are stored here, usually on
  65. a per machine basis.
  66. tmp/cross/
  67. The cross compiler when generated is placed into this directory and those
  68. beneath it.
  69. tmp/deploy/
  70. Any 'end result' output from poky is placed under here.
  71. tmp/deploy/deb/
  72. Any .deb packages emitted by poky are placed here, sorted into feeds for
  73. different architecture types.
  74. tmp/deploy/images/
  75. Complete filesystem images are placed here. If you want to flash the resulting
  76. image from a build onto a device, look here for them.
  77. tmp/deploy/ipk/
  78. Any resulting .ipk packages emitted by poky are placed here.
  79. tmp/rootfs/
  80. This is a temporary scratch area used when creating filesystem images. It is run
  81. under fakeroot and is not useful once that fakeroot session has ended as
  82. information is lost. It is left around since it is still useful in debugging
  83. image creation problems.
  84. tmp/staging/
  85. Any package needing to share output with other packages does so within staging.
  86. This means it contains any shared header files and any shared libraries amongst
  87. other data. It is subdivided by architecture so multiple builds can run within
  88. the one build directory.
  89. tmp/stamps/
  90. This is used by bitbake for accounting purposes to keep track of which tasks
  91. have been run and when. It is also subdivided by architecture. The files are
  92. empty and the important information is the filenames and timestamps.
  93. tmp/work/
  94. Each package build by bitbake is worked on its own work directory. Here, the
  95. source is unpacked, patched, configured, compiled etc. It is subdivided by
  96. architecture.
  97. It is worth considering the structure of a typical work directory. An example is
  98. the linux-rp kernel, version 2.6.20 r7 on the machine spitz built within poky
  99. which would result in a work directory of
  100. "tmp/work/spitz-poky-linux-gnueabi/linux-rp-2.6.20-r7", referred to as WORKDIR.
  101. Within this, the source is unpacked to linux-2.6.20 and then patched by quilt
  102. hence the existence of the standard quilt directories linux-2.6.20/patches and
  103. linux-2.6.20/.pc. Within the linux-2.6.20 directory, standard quilt commands
  104. can be used.
  105. There are other directories generated within WORKDIR. The most important/useful
  106. is WORKDIR/temp which has log files for each task (log.do_*.pid) and the scripts
  107. bitbake runs for each task (run.do_*.pid). WORKDIR/image is where "make install"
  108. places its output which is then split into subpackages within WORKDIR/install.
  109. The Metadata
  110. ============
  111. As mentioned previously, this is the core of poky. It has several important
  112. subdivisions:
  113. meta/classes/
  114. Contains the *.bbclass files. Class files are used to abstract common code
  115. allowing it to be reused by multiple packages. The base.bbclass file is
  116. inherited by every package. Examples of other important classes are
  117. autotools.bbclass which in theory allows any "autotooled" package to work with
  118. poky with minimal effort or kernel.bbclass which contains common code and
  119. functions for working with the linux kernel. Functions like image generation or
  120. packaging also have their specific class files (image.bbclass, rootfs_*.bbclass
  121. and package*.bbclass).
  122. meta/conf/
  123. This is the core set of configuration files which start from bitbake.conf and
  124. from which all other configuration files are included (see the includes at the
  125. end of the file, even local.conf is loaded from there!). Whilst bitbake.conf
  126. sets up the defaults, often these can be overridden by user (local.conf),
  127. machine or distribution configuration files.
  128. meta/conf/machine/
  129. Contains all the machine configuration files. If you set MACHINE="spitz", the
  130. end result is poky looking for a spitz.conf file in this directory. The includes
  131. directory contains various data common to multiple machines. If you want to add
  132. support for a new machine to poky, this is the directory to look in.
  133. meta/conf/distro/
  134. Any distribution specific configuration is controlled from here. OpenEmbedded
  135. supports multiple distributions of which poky is one. Poky only contains the
  136. poky distribution so poky.conf is the main file here. This includes the
  137. versions and SRCDATES for applications which are configured here. An example of
  138. an alternative configuration is poky-bleeding.conf although this mainly inherits
  139. its configuration from poky itself.
  140. packages/
  141. Each application (package) poky can build has an associated .bb file which are
  142. all stored under this directory. Poky finds them through the BBFILES variable
  143. which defaults to packages/*/*.bb. Adding a new piece of software to poky
  144. consists of adding the appropriate .bb file. The .bb files from OpenEmbedded
  145. upstream are usually compatible although they are not supported.
  146. site/
  147. Certain autoconf test results cannot be determined when cross compiling since it
  148. can't run tests on a live system. This directory therefore contains a list of
  149. cached results for various architectures which is passed to autoconf.
  150. Copyright (C) 2006-2007 OpenedHand Ltd.