diff options
| author | Scott Rifenbark <srifenbark@gmail.com> | 2018-05-16 15:07:08 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-05-24 17:18:05 +0100 |
| commit | a9bdc538e6425b79fb0b64550a6fce372ab9ada4 (patch) | |
| tree | be5a3d5165d834eb58a2ab2971b84422dfccf92b /documentation/dev-manual/dev-manual-common-tasks.xml | |
| parent | 9ec257403ee385088f122fc39f77a846fa60f4ca (diff) | |
| download | poky-a9bdc538e6425b79fb0b64550a6fce372ab9ada4.tar.gz | |
dev-manual: Moved "Speeding Up the Build" and renamed it.
Renamed to "Speeding Up a Build" and moved out of the setting up
chapter to the common tasks chapter. Fixed a couple links in the
ref-manual.
(From yocto-docs rev: c53fddd353230c8ef1abc21c7a2d2b1f492f034a)
Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/dev-manual/dev-manual-common-tasks.xml')
| -rw-r--r-- | documentation/dev-manual/dev-manual-common-tasks.xml | 161 |
1 files changed, 158 insertions, 3 deletions
diff --git a/documentation/dev-manual/dev-manual-common-tasks.xml b/documentation/dev-manual/dev-manual-common-tasks.xml index d4b99bc69f..9e8dd5fa92 100644 --- a/documentation/dev-manual/dev-manual-common-tasks.xml +++ b/documentation/dev-manual/dev-manual-common-tasks.xml | |||
| @@ -6224,11 +6224,166 @@ | |||
| 6224 | 6224 | ||
| 6225 | 6225 | ||
| 6226 | 6226 | ||
| 6227 | <section id='speeding-up-a-build'> | ||
| 6228 | <title>Speeding Up a Build</title> | ||
| 6227 | 6229 | ||
| 6230 | <para> | ||
| 6231 | Build time can be an issue. | ||
| 6232 | By default, the build system uses simple controls to try and maximize | ||
| 6233 | build efficiency. | ||
| 6234 | In general, the default settings for all the following variables | ||
| 6235 | result in the most efficient build times when dealing with single | ||
| 6236 | socket systems (i.e. a single CPU). | ||
| 6237 | If you have multiple CPUs, you might try increasing the default | ||
| 6238 | values to gain more speed. | ||
| 6239 | See the descriptions in the glossary for each variable for more | ||
| 6240 | information: | ||
| 6241 | <itemizedlist> | ||
| 6242 | <listitem><para> | ||
| 6243 | <ulink url='&YOCTO_DOCS_REF_URL;#var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename>:</ulink> | ||
| 6244 | The maximum number of threads BitBake simultaneously executes. | ||
| 6245 | </para></listitem> | ||
| 6246 | <listitem><para> | ||
| 6247 | <ulink url='&YOCTO_DOCS_BB_URL;#var-BB_NUMBER_PARSE_THREADS'><filename>BB_NUMBER_PARSE_THREADS</filename>:</ulink> | ||
| 6248 | The number of threads BitBake uses during parsing. | ||
| 6249 | </para></listitem> | ||
| 6250 | <listitem><para> | ||
| 6251 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKE'><filename>PARALLEL_MAKE</filename>:</ulink> | ||
| 6252 | Extra options passed to the <filename>make</filename> command | ||
| 6253 | during the | ||
| 6254 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-compile'><filename>do_compile</filename></ulink> | ||
| 6255 | task in order to specify parallel compilation on the | ||
| 6256 | local build host. | ||
| 6257 | </para></listitem> | ||
| 6258 | <listitem><para> | ||
| 6259 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PARALLEL_MAKEINST'><filename>PARALLEL_MAKEINST</filename>:</ulink> | ||
| 6260 | Extra options passed to the <filename>make</filename> command | ||
| 6261 | during the | ||
| 6262 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink> | ||
| 6263 | task in order to specify parallel installation on the | ||
| 6264 | local build host. | ||
| 6265 | </para></listitem> | ||
| 6266 | </itemizedlist> | ||
| 6267 | As mentioned, these variables all scale to the number of processor | ||
| 6268 | cores available on the build system. | ||
| 6269 | For single socket systems, this auto-scaling ensures that the build | ||
| 6270 | system fundamentally takes advantage of potential parallel operations | ||
| 6271 | during the build based on the build machine's capabilities. | ||
| 6272 | </para> | ||
| 6228 | 6273 | ||
| 6229 | 6274 | <para> | |
| 6230 | 6275 | Following are additional factors that can affect build speed: | |
| 6231 | 6276 | <itemizedlist> | |
| 6277 | <listitem><para> | ||
| 6278 | File system type: | ||
| 6279 | The file system type that the build is being performed on can | ||
| 6280 | also influence performance. | ||
| 6281 | Using <filename>ext4</filename> is recommended as compared | ||
| 6282 | to <filename>ext2</filename> and <filename>ext3</filename> | ||
| 6283 | due to <filename>ext4</filename> improved features | ||
| 6284 | such as extents. | ||
| 6285 | </para></listitem> | ||
| 6286 | <listitem><para> | ||
| 6287 | Disabling the updating of access time using | ||
| 6288 | <filename>noatime</filename>: | ||
| 6289 | The <filename>noatime</filename> mount option prevents the | ||
| 6290 | build system from updating file and directory access times. | ||
| 6291 | </para></listitem> | ||
| 6292 | <listitem><para> | ||
| 6293 | Setting a longer commit: | ||
| 6294 | Using the "commit=" mount option increases the interval | ||
| 6295 | in seconds between disk cache writes. | ||
| 6296 | Changing this interval from the five second default to | ||
| 6297 | something longer increases the risk of data loss but decreases | ||
| 6298 | the need to write to the disk, thus increasing the build | ||
| 6299 | performance. | ||
| 6300 | </para></listitem> | ||
| 6301 | <listitem><para> | ||
| 6302 | Choosing the packaging backend: | ||
| 6303 | Of the available packaging backends, IPK is the fastest. | ||
| 6304 | Additionally, selecting a singular packaging backend also | ||
| 6305 | helps. | ||
| 6306 | </para></listitem> | ||
| 6307 | <listitem><para> | ||
| 6308 | Using <filename>tmpfs</filename> for | ||
| 6309 | <ulink url='&YOCTO_DOCS_REF_URL;#var-TMPDIR'><filename>TMPDIR</filename></ulink> | ||
| 6310 | as a temporary file system: | ||
| 6311 | While this can help speed up the build, the benefits are | ||
| 6312 | limited due to the compiler using | ||
| 6313 | <filename>-pipe</filename>. | ||
| 6314 | The build system goes to some lengths to avoid | ||
| 6315 | <filename>sync()</filename> calls into the | ||
| 6316 | file system on the principle that if there was a significant | ||
| 6317 | failure, the | ||
| 6318 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink> | ||
| 6319 | contents could easily be rebuilt. | ||
| 6320 | </para></listitem> | ||
| 6321 | <listitem><para> | ||
| 6322 | Inheriting the | ||
| 6323 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-rm-work'><filename>rm_work</filename></ulink> | ||
| 6324 | class: | ||
| 6325 | Inheriting this class has shown to speed up builds due to | ||
| 6326 | significantly lower amounts of data stored in the data | ||
| 6327 | cache as well as on disk. | ||
| 6328 | Inheriting this class also makes cleanup of | ||
| 6329 | <ulink url='&YOCTO_DOCS_REF_URL;#var-TMPDIR'><filename>TMPDIR</filename></ulink> | ||
| 6330 | faster, at the expense of being easily able to dive into the | ||
| 6331 | source code. | ||
| 6332 | File system maintainers have recommended that the fastest way | ||
| 6333 | to clean up large numbers of files is to reformat partitions | ||
| 6334 | rather than delete files due to the linear nature of | ||
| 6335 | partitions. | ||
| 6336 | This, of course, assumes you structure the disk partitions and | ||
| 6337 | file systems in a way that this is practical. | ||
| 6338 | </para></listitem> | ||
| 6339 | </itemizedlist> | ||
| 6340 | Aside from the previous list, you should keep some trade offs in | ||
| 6341 | mind that can help you speed up the build: | ||
| 6342 | <itemizedlist> | ||
| 6343 | <listitem><para> | ||
| 6344 | Remove items from | ||
| 6345 | <ulink url='&YOCTO_DOCS_REF_URL;#var-DISTRO_FEATURES'><filename>DISTRO_FEATURES</filename></ulink> | ||
| 6346 | that you might not need. | ||
| 6347 | </para></listitem> | ||
| 6348 | <listitem><para> | ||
| 6349 | Exclude debug symbols and other debug information: | ||
| 6350 | If you do not need these symbols and other debug information, | ||
| 6351 | disabling the <filename>*-dbg</filename> package generation | ||
| 6352 | can speed up the build. | ||
| 6353 | You can disable this generation by setting the | ||
| 6354 | <ulink url='&YOCTO_DOCS_REF_URL;#var-INHIBIT_PACKAGE_DEBUG_SPLIT'><filename>INHIBIT_PACKAGE_DEBUG_SPLIT</filename></ulink> | ||
| 6355 | variable to "1". | ||
| 6356 | </para></listitem> | ||
| 6357 | <listitem><para> | ||
| 6358 | Disable static library generation for recipes derived from | ||
| 6359 | <filename>autoconf</filename> or <filename>libtool</filename>: | ||
| 6360 | Following is an example showing how to disable static | ||
| 6361 | libraries and still provide an override to handle exceptions: | ||
| 6362 | <literallayout class='monospaced'> | ||
| 6363 | STATICLIBCONF = "--disable-static" | ||
| 6364 | STATICLIBCONF_sqlite3-native = "" | ||
| 6365 | EXTRA_OECONF += "${STATICLIBCONF}" | ||
| 6366 | </literallayout> | ||
| 6367 | <note><title>Notes</title> | ||
| 6368 | <itemizedlist> | ||
| 6369 | <listitem><para> | ||
| 6370 | Some recipes need static libraries in order to work | ||
| 6371 | correctly (e.g. <filename>pseudo-native</filename> | ||
| 6372 | needs <filename>sqlite3-native</filename>). | ||
| 6373 | Overrides, as in the previous example, account for | ||
| 6374 | these kinds of exceptions. | ||
| 6375 | </para></listitem> | ||
| 6376 | <listitem><para> | ||
| 6377 | Some packages have packaging code that assumes the | ||
| 6378 | presence of the static libraries. | ||
| 6379 | If so, you might need to exclude them as well. | ||
| 6380 | </para></listitem> | ||
| 6381 | </itemizedlist> | ||
| 6382 | </note> | ||
| 6383 | </para></listitem> | ||
| 6384 | </itemizedlist> | ||
| 6385 | </para> | ||
| 6386 | </section> | ||
| 6232 | 6387 | ||
| 6233 | <section id="platdev-working-with-libraries"> | 6388 | <section id="platdev-working-with-libraries"> |
| 6234 | <title>Working With Libraries</title> | 6389 | <title>Working With Libraries</title> |
