usingpoky.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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='usingpoky'>
  5. <title>Using the Yocto Project</title>
  6. <para>
  7. This chapter describes common usage for the Yocto Project.
  8. The information is introductory in nature as other manuals in the Yocto Project
  9. documentation set provide more details on how to use the Yocto Project.
  10. </para>
  11. OLD START WAS HERE.
  12. OLD END WAS HERE.
  13. <section id='speeding-up-the-build'>
  14. <title>Speeding Up the Build</title>
  15. <para>
  16. Build time can be an issue.
  17. By default, the build system uses simple controls to try and maximize
  18. build efficiency.
  19. In general, the default settings for all the following variables
  20. result in the most efficient build times when dealing with single
  21. socket systems (i.e. a single CPU).
  22. If you have multiple CPUs, you might try increasing the default
  23. values to gain more speed.
  24. See the descriptions in the glossary for each variable for more
  25. information:
  26. <itemizedlist>
  27. <listitem><para>
  28. <link linkend='var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename>:</link>
  29. The maximum number of threads BitBake simultaneously executes.
  30. </para></listitem>
  31. <listitem><para>
  32. <ulink url='&YOCTO_DOCS_BB_URL;#var-BB_NUMBER_PARSE_THREADS'><filename>BB_NUMBER_PARSE_THREADS</filename>:</ulink>
  33. The number of threads BitBake uses during parsing.
  34. </para></listitem>
  35. <listitem><para>
  36. <link linkend='var-PARALLEL_MAKE'><filename>PARALLEL_MAKE</filename>:</link>
  37. Extra options passed to the <filename>make</filename> command
  38. during the
  39. <link linkend='ref-tasks-compile'><filename>do_compile</filename></link>
  40. task in order to specify parallel compilation on the
  41. local build host.
  42. </para></listitem>
  43. <listitem><para>
  44. <link linkend='var-PARALLEL_MAKEINST'><filename>PARALLEL_MAKEINST</filename>:</link>
  45. Extra options passed to the <filename>make</filename> command
  46. during the
  47. <link linkend='ref-tasks-install'><filename>do_install</filename></link>
  48. task in order to specify parallel installation on the
  49. local build host.
  50. </para></listitem>
  51. </itemizedlist>
  52. As mentioned, these variables all scale to the number of processor
  53. cores available on the build system.
  54. For single socket systems, this auto-scaling ensures that the build
  55. system fundamentally takes advantage of potential parallel operations
  56. during the build based on the build machine's capabilities.
  57. </para>
  58. <para>
  59. Following are additional factors that can affect build speed:
  60. <itemizedlist>
  61. <listitem><para>
  62. File system type:
  63. The file system type that the build is being performed on can
  64. also influence performance.
  65. Using <filename>ext4</filename> is recommended as compared
  66. to <filename>ext2</filename> and <filename>ext3</filename>
  67. due to <filename>ext4</filename> improved features
  68. such as extents.
  69. </para></listitem>
  70. <listitem><para>
  71. Disabling the updating of access time using
  72. <filename>noatime</filename>:
  73. The <filename>noatime</filename> mount option prevents the
  74. build system from updating file and directory access times.
  75. </para></listitem>
  76. <listitem><para>
  77. Setting a longer commit:
  78. Using the "commit=" mount option increases the interval
  79. in seconds between disk cache writes.
  80. Changing this interval from the five second default to
  81. something longer increases the risk of data loss but decreases
  82. the need to write to the disk, thus increasing the build
  83. performance.
  84. </para></listitem>
  85. <listitem><para>
  86. Choosing the packaging backend:
  87. Of the available packaging backends, IPK is the fastest.
  88. Additionally, selecting a singular packaging backend also
  89. helps.
  90. </para></listitem>
  91. <listitem><para>
  92. Using <filename>tmpfs</filename> for
  93. <link linkend='var-TMPDIR'><filename>TMPDIR</filename></link>
  94. as a temporary file system:
  95. While this can help speed up the build, the benefits are
  96. limited due to the compiler using
  97. <filename>-pipe</filename>.
  98. The build system goes to some lengths to avoid
  99. <filename>sync()</filename> calls into the
  100. file system on the principle that if there was a significant
  101. failure, the
  102. <link linkend='build-directory'>Build Directory</link>
  103. contents could easily be rebuilt.
  104. </para></listitem>
  105. <listitem><para>
  106. Inheriting the
  107. <link linkend='ref-classes-rm-work'><filename>rm_work</filename></link>
  108. class:
  109. Inheriting this class has shown to speed up builds due to
  110. significantly lower amounts of data stored in the data
  111. cache as well as on disk.
  112. Inheriting this class also makes cleanup of
  113. <link linkend='var-TMPDIR'><filename>TMPDIR</filename></link>
  114. faster, at the expense of being easily able to dive into the
  115. source code.
  116. File system maintainers have recommended that the fastest way
  117. to clean up large numbers of files is to reformat partitions
  118. rather than delete files due to the linear nature of partitions.
  119. This, of course, assumes you structure the disk partitions and
  120. file systems in a way that this is practical.
  121. </para></listitem>
  122. </itemizedlist>
  123. Aside from the previous list, you should keep some trade offs in
  124. mind that can help you speed up the build:
  125. <itemizedlist>
  126. <listitem><para>
  127. Remove items from
  128. <link linkend='var-DISTRO_FEATURES'><filename>DISTRO_FEATURES</filename></link>
  129. that you might not need.
  130. </para></listitem>
  131. <listitem><para>
  132. Exclude debug symbols and other debug information:
  133. If you do not need these symbols and other debug information,
  134. disabling the <filename>*-dbg</filename> package generation
  135. can speed up the build.
  136. You can disable this generation by setting the
  137. <link linkend='var-INHIBIT_PACKAGE_DEBUG_SPLIT'><filename>INHIBIT_PACKAGE_DEBUG_SPLIT</filename></link>
  138. variable to "1".
  139. </para></listitem>
  140. <listitem><para>
  141. Disable static library generation for recipes derived from
  142. <filename>autoconf</filename> or <filename>libtool</filename>:
  143. Following is an example showing how to disable static
  144. libraries and still provide an override to handle exceptions:
  145. <literallayout class='monospaced'>
  146. STATICLIBCONF = "--disable-static"
  147. STATICLIBCONF_sqlite3-native = ""
  148. EXTRA_OECONF += "${STATICLIBCONF}"
  149. </literallayout>
  150. <note><title>Notes</title>
  151. <itemizedlist>
  152. <listitem><para>
  153. Some recipes need static libraries in order to work
  154. correctly (e.g. <filename>pseudo-native</filename>
  155. needs <filename>sqlite3-native</filename>).
  156. Overrides, as in the previous example, account for
  157. these kinds of exceptions.
  158. </para></listitem>
  159. <listitem><para>
  160. Some packages have packaging code that assumes the
  161. presence of the static libraries.
  162. If so, you might need to exclude them as well.
  163. </para></listitem>
  164. </itemizedlist>
  165. </note>
  166. </para></listitem>
  167. </itemizedlist>
  168. </para>
  169. </section>
  170. </chapter>
  171. <!--
  172. vim: expandtab tw=80 ts=4
  173. -->