blob: 4bddc599656a9ab49d87cc9101a4d9ffc7bf6909 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001<!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
5<chapter id='ref-structure'>
6
7<title>Source Directory Structure</title>
8
9<para>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050010 The <link linkend='source-directory'>Source Directory</link>
11 consists of several components.
12 Understanding them and knowing where they are located is key to using the
13 Yocto Project well.
14 This chapter describes the Source Directory and gives information about
15 the various files and directories.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016</para>
17
18<para>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050019 For information on how to establish a local Source Directory on your
20 development system, see the
21 "<ulink url='&YOCTO_DOCS_DEV_URL;#working-with-yocto-project-source-files'>Working With Yocto Project Source Files</ulink>"
22 section in the Yocto Project Development Tasks Manual.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050023</para>
24
25<note>
26 The OpenEmbedded build system does not support file or directory names that
27 contain spaces.
28 Be sure that the Source Directory you use does not contain these types
29 of names.
30</note>
31
32<section id='structure-core'>
33 <title>Top-Level Core Components</title>
34
35 <para>
36 This section describes the top-level components of the
Brad Bishopd7bf8c12018-02-25 22:55:05 -050037 <link linkend='source-directory'>Source Directory</link>.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038 </para>
39
40 <section id='structure-core-bitbake'>
41 <title><filename>bitbake/</filename></title>
42
43 <para>
44 This directory includes a copy of BitBake for ease of use.
45 The copy usually matches the current stable BitBake release from
46 the BitBake project.
47 BitBake, a
Brad Bishopd7bf8c12018-02-25 22:55:05 -050048 <link linkend='metadata'>Metadata</link>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049 interpreter, reads the Yocto Project Metadata and runs the tasks
50 defined by that data.
51 Failures are usually from the Metadata and not from BitBake itself.
52 Consequently, most users do not need to worry about BitBake.
53 </para>
54
55 <para>
56 When you run the <filename>bitbake</filename> command, the
57 main BitBake executable, which resides in the
58 <filename>bitbake/bin/</filename> directory, starts.
Brad Bishopd7bf8c12018-02-25 22:55:05 -050059 Sourcing the environment setup script (i.e.
60 <link linkend="structure-core-script"><filename>&OE_INIT_FILE;</filename></link>)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061 places the <filename>scripts</filename> and
62 <filename>bitbake/bin</filename> directories (in that order) into
63 the shell's <filename>PATH</filename> environment variable.
64 </para>
65
66 <para>
67 For more information on BitBake, see the
68 <ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
69 </para>
70 </section>
71
72 <section id='structure-core-build'>
73 <title><filename>build/</filename></title>
74
75 <para>
76 This directory contains user configuration files and the output
77 generated by the OpenEmbedded build system in its standard configuration where
78 the source tree is combined with the output.
Brad Bishopd7bf8c12018-02-25 22:55:05 -050079 The
80 <link linkend='build-directory'>Build Directory</link>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081 is created initially when you <filename>source</filename>
82 the OpenEmbedded build environment setup script
83 (i.e.
Brad Bishopd7bf8c12018-02-25 22:55:05 -050084 <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
Patrick Williamsc124f4f2015-09-15 14:41:29 -050085 </para>
86
87 <para>
88 It is also possible to place output and configuration
89 files in a directory separate from the
Brad Bishopd7bf8c12018-02-25 22:55:05 -050090 <link linkend='source-directory'>Source Directory</link>
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091 by providing a directory name when you <filename>source</filename>
92 the setup script.
93 For information on separating output from your local
94 Source Directory files, see the
Brad Bishopd7bf8c12018-02-25 22:55:05 -050095 "<link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>"
96 section.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097 </para>
98 </section>
99
100 <section id='handbook'>
101 <title><filename>documentation/</filename></title>
102
103 <para>
104 This directory holds the source for the Yocto Project documentation
105 as well as templates and tools that allow you to generate PDF and HTML
106 versions of the manuals.
107 Each manual is contained in a sub-folder.
108 For example, the files for this manual reside in
109 the <filename>ref-manual/</filename> directory.
110 </para>
111 </section>
112
113 <section id='structure-core-meta'>
114 <title><filename>meta/</filename></title>
115
116 <para>
117 This directory contains the OpenEmbedded Core metadata.
118 The directory holds recipes, common classes, and machine
119 configuration for emulated targets (<filename>qemux86</filename>,
120 <filename>qemuarm</filename>, and so forth.)
121 </para>
122 </section>
123
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500124 <section id='structure-core-meta-poky'>
125 <title><filename>meta-poky/</filename></title>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500126
127 <para>
128 This directory contains the configuration for the Poky
129 reference distribution.
130 </para>
131 </section>
132
133 <section id='structure-core-meta-yocto-bsp'>
134 <title><filename>meta-yocto-bsp/</filename></title>
135
136 <para>
137 This directory contains the Yocto Project reference
138 hardware Board Support Packages (BSPs).
139 For more information on BSPs, see the
140 <ulink url='&YOCTO_DOCS_BSP_URL;'>Yocto Project Board Support
141 Package (BSP) Developer's Guide</ulink>.
142 </para>
143 </section>
144
145 <section id='structure-meta-selftest'>
146 <title><filename>meta-selftest/</filename></title>
147
148 <para>
149 This directory adds additional recipes and append files
150 used by the OpenEmbedded selftests to verify the behavior
151 of the build system.
152 </para>
153
154 <para>
155 You do not have to add this layer to your
156 <filename>bblayers.conf</filename> file unless you want to run the
157 selftests.
158 </para>
159 </section>
160
161 <section id='structure-meta-skeleton'>
162 <title><filename>meta-skeleton/</filename></title>
163
164 <para>
165 This directory contains template recipes for BSP and kernel development.
166 </para>
167 </section>
168
169 <section id='structure-core-scripts'>
170 <title><filename>scripts/</filename></title>
171
172 <para>
173 This directory contains various integration scripts that implement
174 extra functionality in the Yocto Project environment (e.g. QEMU scripts).
175 The <link linkend="structure-core-script"><filename>&OE_INIT_FILE;</filename></link>
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500176 script appends this directory to the shell's
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500177 <filename>PATH</filename> environment variable.
178 </para>
179
180 <para>
181 The <filename>scripts</filename> directory has useful scripts that assist in contributing
182 back to the Yocto Project, such as <filename>create-pull-request</filename> and
183 <filename>send-pull-request</filename>.
184 </para>
185 </section>
186
187 <section id='structure-core-script'>
188 <title><filename>&OE_INIT_FILE;</filename></title>
189
190 <para>
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500191 This script sets up the OpenEmbedded build environment.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500192 Running this script with the <filename>source</filename> command in
193 a shell makes changes to <filename>PATH</filename> and sets other
194 core BitBake variables based on the current working directory.
195 You need to run an environment setup script before running BitBake
196 commands.
197 The script uses other scripts within the
198 <filename>scripts</filename> directory to do the bulk of the work.
199 </para>
200
201 <para>
202 When you run this script, your Yocto Project environment is set
203 up, a
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500204 <link linkend='build-directory'>Build Directory</link>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500205 is created, your working directory becomes the Build Directory,
206 and you are presented with a list of common BitBake targets.
207 Here is an example:
208 <literallayout class='monospaced'>
209 $ source oe-init-build-env
210
211 ### Shell environment set up for builds. ###
212
213 You can now run 'bitbake &lt;target&gt;'
214
215 Common targets are:
216 core-image-minimal
217 core-image-sato
218 meta-toolchain
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500219 meta-ide-support
220
221 You can also run generated qemu images with a command like 'runqemu qemux86'
222 </literallayout>
223 The script gets its default list of common targets from the
224 <filename>conf-notes.txt</filename> file, which is found in the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500225 <filename>meta-poky</filename> directory within the
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500226 <link linkend='source-directory'>Source Directory</link>.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500227 Should you have custom distributions, it is very easy to modify
228 this configuration file to include your targets for your
229 distribution.
230 See the
231 "<ulink url='&YOCTO_DOCS_DEV_URL;#creating-a-custom-template-configuration-directory'>Creating a Custom Template Configuration Directory</ulink>"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500232 section in the Yocto Project Development Tasks Manual for more
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500233 information.
234 </para>
235
236 <para>
237 By default, running this script without a
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500238 <link linkend='build-directory'>Build Directory</link>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500239 argument creates the <filename>build</filename> directory
240 in your current working directory.
241 If you provide a Build Directory argument when you
242 <filename>source</filename> the script, you direct the OpenEmbedded
243 build system to create a Build Directory of your choice.
244 For example, the following command creates a Build Directory named
245 <filename>mybuilds</filename> that is outside of the
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500246 <link linkend='source-directory'>Source Directory</link>:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500247 <literallayout class='monospaced'>
248 $ source &OE_INIT_FILE; ~/mybuilds
249 </literallayout>
250 The OpenEmbedded build system uses the template configuration
251 files, which are found by default in the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500252 <filename>meta-poky/conf</filename> directory in the
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500253 Source Directory.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500254 See the
255 "<ulink url='&YOCTO_DOCS_DEV_URL;#creating-a-custom-template-configuration-directory'>Creating a Custom Template Configuration Directory</ulink>"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500256 section in the Yocto Project Development Tasks Manual for more
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500257 information.
258 <note>
259 The OpenEmbedded build system does not support file or directory names that
260 contain spaces.
261 If you attempt to run the <filename>&OE_INIT_FILE;</filename> script
262 from a Source Directory that contains spaces in either the filenames
263 or directory names, the script returns an error indicating no such
264 file or directory.
265 Be sure to use a Source Directory free of names containing spaces.
266 </note>
267 </para>
268 </section>
269
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500270 <section id='structure-basic-top-level'>
271 <title><filename>LICENSE, README, and README.hardware</filename></title>
272
273 <para>
274 These files are standard top-level files.
275 </para>
276 </section>
277</section>
278
279<section id='structure-build'>
280 <title>The Build Directory - <filename>build/</filename></title>
281
282 <para>
283 The OpenEmbedded build system creates the
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500284 <link linkend='build-directory'>Build Directory</link>
285 when you run the build environment setup scripts (i.e.
286 <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500287 </para>
288
289 <para>
290 If you do not give the Build Directory a specific name when you run
291 a setup script, the name defaults to <filename>build</filename>.
292 </para>
293
294 <para>
295 The
296 <link linkend='var-TOPDIR'><filename>TOPDIR</filename></link> variable
297 points to the Build Directory.
298 </para>
299
300 <section id='structure-build-buildhistory'>
301 <title><filename>build/buildhistory</filename></title>
302
303 <para>
304 The OpenEmbedded build system creates this directory when you
305 enable the build history feature.
306 The directory tracks build information into image, packages, and
307 SDK subdirectories.
308 For information on the build history feature, see the
309 "<link linkend='maintaining-build-output-quality'>Maintaining Build Output Quality</link>"
310 section.
311 </para>
312 </section>
313
314 <section id='structure-build-conf-local.conf'>
315 <title><filename>build/conf/local.conf</filename></title>
316
317 <para>
318 This configuration file contains all the local user configurations
319 for your build environment.
320 The <filename>local.conf</filename> file contains documentation on
321 the various configuration options.
322 Any variable set here overrides any variable set elsewhere within
323 the environment unless that variable is hard-coded within a file
324 (e.g. by using '=' instead of '?=').
325 Some variables are hard-coded for various reasons but these
326 variables are relatively rare.
327 </para>
328
329 <para>
330 Edit this file to set the
331 <filename><link linkend='var-MACHINE'>MACHINE</link></filename>
332 for which you want to build, which package types you wish to use
333 (<link linkend='var-PACKAGE_CLASSES'><filename>PACKAGE_CLASSES</filename></link>),
334 and the location from which you want to access downloaded files
335 (<filename><link linkend='var-DL_DIR'>DL_DIR</link></filename>).
336 </para>
337
338 <para>
339 If <filename>local.conf</filename> is not present when you
340 start the build, the OpenEmbedded build system creates it from
341 <filename>local.conf.sample</filename> when
342 you <filename>source</filename> the top-level build environment
343 setup script (i.e.
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500344 <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500345 </para>
346
347 <para>
348 The source <filename>local.conf.sample</filename> file used
349 depends on the <filename>$TEMPLATECONF</filename> script variable,
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500350 which defaults to <filename>meta-poky/conf</filename>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500351 when you are building from the Yocto Project development
352 environment and defaults to <filename>meta/conf</filename> when
353 you are building from the OpenEmbedded Core environment.
354 Because the script variable points to the source of the
355 <filename>local.conf.sample</filename> file, this implies that
356 you can configure your build environment from any layer by setting
357 the variable in the top-level build environment setup script as
358 follows:
359 <literallayout class='monospaced'>
360 TEMPLATECONF=<replaceable>your_layer</replaceable>/conf
361 </literallayout>
362 Once the build process gets the sample file, it uses
363 <filename>sed</filename> to substitute final
364 <filename>${</filename><link linkend='var-OEROOT'><filename>OEROOT</filename></link><filename>}</filename>
365 values for all <filename>##OEROOT##</filename> values.
366 <note>
367 You can see how the <filename>TEMPLATECONF</filename> variable
368 is used by looking at the
369 <filename>scripts/oe-setup-builddir</filename> script in the
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500370 <link linkend='source-directory'>Source Directory</link>.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500371 You can find the Yocto Project version of the
372 <filename>local.conf.sample</filename> file in the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500373 <filename>meta-poky/conf</filename> directory.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500374 </note>
375 </para>
376 </section>
377
378 <section id='structure-build-conf-bblayers.conf'>
379 <title><filename>build/conf/bblayers.conf</filename></title>
380
381 <para>
382 This configuration file defines
383 <ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>layers</ulink>,
384 which are directory trees, traversed (or walked) by BitBake.
385 The <filename>bblayers.conf</filename> file uses the
386 <link linkend='var-BBLAYERS'><filename>BBLAYERS</filename></link>
387 variable to list the layers BitBake tries to find.
388 </para>
389
390 <para>
391 If <filename>bblayers.conf</filename> is not present when you
392 start the build, the OpenEmbedded build system creates it from
393 <filename>bblayers.conf.sample</filename> when
394 you <filename>source</filename> the top-level build environment
395 setup script (i.e.
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500396 <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500397 </para>
398
399 <para>
400 The source <filename>bblayers.conf.sample</filename> file used
401 depends on the <filename>$TEMPLATECONF</filename> script variable,
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500402 which defaults to <filename>meta-poky/conf</filename>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500403 when you are building from the Yocto Project development
404 environment and defaults to <filename>meta/conf</filename> when
405 you are building from the OpenEmbedded Core environment.
406 Because the script variable points to the source of the
407 <filename>bblayers.conf.sample</filename> file, this implies that
408 you can base your build from any layer by setting the variable in
409 the top-level build environment setup script as follows:
410 <literallayout class='monospaced'>
411 TEMPLATECONF=<replaceable>your_layer</replaceable>/conf
412 </literallayout>
413 Once the build process gets the sample file, it uses
414 <filename>sed</filename> to substitute final
415 <filename>${</filename><link linkend='var-OEROOT'><filename>OEROOT</filename></link><filename>}</filename>
416 values for all <filename>##OEROOT##</filename> values.
417 <note>
418 You can see how the <filename>TEMPLATECONF</filename> variable
419 <filename>scripts/oe-setup-builddir</filename> script in the
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500420 <link linkend='source-directory'>Source Directory</link>.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500421 You can find the Yocto Project version of the
422 <filename>bblayers.conf.sample</filename> file in the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500423 <filename>meta-poky/conf</filename> directory.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500424 </note>
425 </para>
426 </section>
427
428 <section id='structure-build-conf-sanity_info'>
429 <title><filename>build/conf/sanity_info</filename></title>
430
431 <para>
432 This file indicates the state of the sanity checks and is created
433 during the build.
434 </para>
435 </section>
436
437 <section id='structure-build-downloads'>
438 <title><filename>build/downloads/</filename></title>
439
440 <para>
441 This directory contains downloaded upstream source tarballs.
442 You can reuse the directory for multiple builds or move
443 the directory to another location.
444 You can control the location of this directory through the
445 <filename><link linkend='var-DL_DIR'>DL_DIR</link></filename> variable.
446 </para>
447 </section>
448
449 <section id='structure-build-sstate-cache'>
450 <title><filename>build/sstate-cache/</filename></title>
451
452 <para>
453 This directory contains the shared state cache.
454 You can reuse the directory for multiple builds or move
455 the directory to another location.
456 You can control the location of this directory through the
457 <filename><link linkend='var-SSTATE_DIR'>SSTATE_DIR</link></filename> variable.
458 </para>
459 </section>
460
461 <section id='structure-build-tmp'>
462 <title><filename>build/tmp/</filename></title>
463
464 <para>
465 The OpenEmbedded build system creates and uses this directory
466 for all the build system's output.
467 The
468 <link linkend='var-TMPDIR'><filename>TMPDIR</filename></link>
469 variable points to this directory.
470 </para>
471
472 <para>
473 BitBake creates this directory if it does not exist.
474 As a last resort, to clean up a build and start it from scratch
475 (other than the downloads), you can remove everything in the
476 <filename>tmp</filename> directory or get rid of the
477 directory completely.
478 If you do, you should also completely remove the
479 <filename>build/sstate-cache</filename> directory.
480 </para>
481 </section>
482
483 <section id='structure-build-tmp-buildstats'>
484 <title><filename>build/tmp/buildstats/</filename></title>
485
486 <para>
487 This directory stores the build statistics.
488 </para>
489 </section>
490
491 <section id='structure-build-tmp-cache'>
492 <title><filename>build/tmp/cache/</filename></title>
493
494 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600495 When BitBake parses the metadata (recipes and configuration files),
496 it caches the results in <filename>build/tmp/cache/</filename>
497 to speed up future builds.
498 The results are stored on a per-machine basis.
499 </para>
500
501 <para>
502 During subsequent builds, BitBake checks each recipe (together
503 with, for example, any files included or appended to it) to see
504 if they have been modified.
505 Changes can be detected, for example, through file modification
506 time (mtime) changes and hashing of file contents.
507 If no changes to the file are detected, then the parsed result
508 stored in the cache is reused.
509 If the file has changed, it is reparsed.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500510 </para>
511 </section>
512
513 <section id='structure-build-tmp-deploy'>
514 <title><filename>build/tmp/deploy/</filename></title>
515
516 <para>
517 This directory contains any "end result" output from the
518 OpenEmbedded build process.
519 The <link linkend='var-DEPLOY_DIR'><filename>DEPLOY_DIR</filename></link>
520 variable points to this directory.
521 For more detail on the contents of the <filename>deploy</filename>
522 directory, see the
523 "<link linkend='images-dev-environment'>Images</link>" and
524 "<link linkend='sdk-dev-environment'>Application Development SDK</link>"
525 sections.
526 </para>
527 </section>
528
529 <section id='structure-build-tmp-deploy-deb'>
530 <title><filename>build/tmp/deploy/deb/</filename></title>
531
532 <para>
533 This directory receives any <filename>.deb</filename> packages produced by
534 the build process.
535 The packages are sorted into feeds for different architecture types.
536 </para>
537 </section>
538
539 <section id='structure-build-tmp-deploy-rpm'>
540 <title><filename>build/tmp/deploy/rpm/</filename></title>
541
542 <para>
543 This directory receives any <filename>.rpm</filename> packages produced by
544 the build process.
545 The packages are sorted into feeds for different architecture types.
546 </para>
547 </section>
548
549 <section id='structure-build-tmp-deploy-ipk'>
550 <title><filename>build/tmp/deploy/ipk/</filename></title>
551
552 <para>
553 This directory receives <filename>.ipk</filename> packages produced by
554 the build process.
555 </para>
556 </section>
557
558 <section id='structure-build-tmp-deploy-licenses'>
559 <title><filename>build/tmp/deploy/licenses/</filename></title>
560
561 <para>
562 This directory receives package licensing information.
563 For example, the directory contains sub-directories for <filename>bash</filename>,
564 <filename>busybox</filename>, and <filename>glibc</filename> (among others) that in turn
565 contain appropriate <filename>COPYING</filename> license files with other licensing information.
566 For information on licensing, see the
567 "<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>"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500568 section in the Yocto Project Development Tasks Manual.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500569 </para>
570 </section>
571
572 <section id='structure-build-tmp-deploy-images'>
573 <title><filename>build/tmp/deploy/images/</filename></title>
574
575 <para>
576 This directory receives complete filesystem images.
577 If you want to flash the resulting image from a build onto a device, look here for the image.
578 </para>
579
580 <para>
581 Be careful when deleting files in this directory.
582 You can safely delete old images from this directory (e.g.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500583 <filename>core-image-*</filename>).
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500584 However, the kernel (<filename>*zImage*</filename>, <filename>*uImage*</filename>, etc.),
585 bootloader and other supplementary files might be deployed here prior to building an
586 image.
587 Because these files are not directly produced from the image, if you
588 delete them they will not be automatically re-created when you build the image again.
589 </para>
590
591 <para>
592 If you do accidentally delete files here, you will need to force them to be
593 re-created.
594 In order to do that, you will need to know the target that produced them.
595 For example, these commands rebuild and re-create the kernel files:
596 <literallayout class='monospaced'>
597 $ bitbake -c clean virtual/kernel
598 $ bitbake virtual/kernel
599 </literallayout>
600 </para>
601 </section>
602
603 <section id='structure-build-tmp-deploy-sdk'>
604 <title><filename>build/tmp/deploy/sdk/</filename></title>
605
606 <para>
607 The OpenEmbedded build system creates this directory to hold
608 toolchain installer scripts, which when executed, install the
609 sysroot that matches your target hardware.
610 You can find out more about these installers in the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500611 "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-building-an-sdk-installer'>Building an SDK Installer</ulink>"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500612 section in the Yocto Project Application Development and the
613 Extensible Software Development Kit (eSDK) manual.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500614 </para>
615 </section>
616
617 <section id='structure-build-tmp-sstate-control'>
618 <title><filename>build/tmp/sstate-control/</filename></title>
619
620 <para>
621 The OpenEmbedded build system uses this directory for the
622 shared state manifest files.
623 The shared state code uses these files to record the files
624 installed by each sstate task so that the files can be removed
625 when cleaning the recipe or when a newer version is about to
626 be installed.
627 The build system also uses the manifests to detect and produce
628 a warning when files from one task are overwriting those from
629 another.
630 </para>
631 </section>
632
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500633 <section id='structure-build-tmp-sysroots-components'>
634 <title><filename>build/tmp/sysroots-components/</filename></title>
635
636 <para>
637 This directory is the location of the sysroot contents that the
638 task
639 <link linkend='ref-tasks-prepare_recipe_sysroot'><filename>do_prepare_recipe_sysroot</filename></link>
640 links or copies into the recipe-specific sysroot for each
641 recipe listed in
642 <link linkend='var-DEPENDS'><filename>DEPENDS</filename></link>.
643 Population of this directory is handled through shared state, while
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500644 the path is specified by the
645 <link linkend='var-COMPONENTS_DIR'><filename>COMPONENTS_DIR</filename></link>
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500646 variable. Apart from a few unusual circumstances, handling of the
647 <filename>sysroots-components</filename> directory should be
648 automatic, and recipes should not directly reference
649 <filename>build/tmp/sysroots-components</filename>.
650 </para>
651 </section>
652
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500653 <section id='structure-build-tmp-sysroots'>
654 <title><filename>build/tmp/sysroots/</filename></title>
655
656 <para>
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500657 Previous versions of the OpenEmbedded build system used to
658 create a global shared sysroot per machine along with a native
659 sysroot.
660 Beginning with the &DISTRO; version of the Yocto Project,
661 sysroots exist in recipe-specific
662 <link linkend='var-WORKDIR'><filename>WORKDIR</filename></link>
663 directories.
664 Thus, the <filename>build/tmp/sysroots/</filename> directory
665 is unused.
666 <note>
667 The <filename>build/tmp/sysroots/</filename> directory
668 can still be populated using the
669 <filename>bitbake build-sysroots</filename> command and can
670 be used for compatibility in some cases.
671 However, in general it is not recommended to populate
672 this directory.
673 Individual recipe-specific sysroots should be used.
674 </note>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500675 </para>
676 </section>
677
678 <section id='structure-build-tmp-stamps'>
679 <title><filename>build/tmp/stamps/</filename></title>
680
681 <para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600682 This directory holds information that BitBake uses for
683 accounting purposes to track what tasks have run and when they
684 have run.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500685 The directory is sub-divided by architecture, package name, and
686 version.
687 Following is an example:
688 <literallayout class='monospaced'>
689 stamps/all-poky-linux/distcc-config/1.0-r0.do_build-2fdd....2do
690 </literallayout>
691 Although the files in the directory are empty of data,
692 BitBake uses the filenames and timestamps for tracking purposes.
693 </para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600694
695 <para>
696 For information on how BitBake uses stamp files to determine if
697 a task should be rerun, see the
698 "<link linkend='stamp-files-and-the-rerunning-of-tasks'>Stamp Files and the Rerunning of Tasks</link>"
699 section.
700 </para>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500701 </section>
702
703 <section id='structure-build-tmp-log'>
704 <title><filename>build/tmp/log/</filename></title>
705
706 <para>
707 This directory contains general logs that are not otherwise placed using the
708 package's <filename><link linkend='var-WORKDIR'>WORKDIR</link></filename>.
709 Examples of logs are the output from the
710 <filename>do_check_pkg</filename> or
711 <filename>do_distro_check</filename> tasks.
712 Running a build does not necessarily mean this directory is created.
713 </para>
714 </section>
715
716 <section id='structure-build-tmp-work'>
717 <title><filename>build/tmp/work/</filename></title>
718
719 <para>
720 This directory contains architecture-specific work sub-directories
721 for packages built by BitBake.
722 All tasks execute from the appropriate work directory.
723 For example, the source for a particular package is unpacked,
724 patched, configured and compiled all within its own work directory.
725 Within the work directory, organization is based on the package group
726 and version for which the source is being compiled
727 as defined by the
728 <link linkend='var-WORKDIR'><filename>WORKDIR</filename></link>.
729 </para>
730
731 <para>
732 It is worth considering the structure of a typical work directory.
733 As an example, consider <filename>linux-yocto-kernel-3.0</filename>
734 on the machine <filename>qemux86</filename>
735 built within the Yocto Project.
736 For this package, a work directory of
737 <filename>tmp/work/qemux86-poky-linux/linux-yocto/3.0+git1+&lt;.....&gt;</filename>,
738 referred to as the
739 <filename><link linkend='var-WORKDIR'>WORKDIR</link></filename>, is created.
740 Within this directory, the source is unpacked to
741 <filename>linux-qemux86-standard-build</filename> and then patched by Quilt.
742 (See the
743 "<ulink url='&YOCTO_DOCS_DEV_URL;#using-a-quilt-workflow'>Using Quilt in Your Workflow</ulink>"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500744 section in the Yocto Project Development Tasks Manual for more
745 information.)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500746 Within the <filename>linux-qemux86-standard-build</filename> directory,
747 standard Quilt directories <filename>linux-3.0/patches</filename>
748 and <filename>linux-3.0/.pc</filename> are created,
749 and standard Quilt commands can be used.
750 </para>
751
752 <para>
753 There are other directories generated within <filename>WORKDIR</filename>.
754 The most important directory is <filename>WORKDIR/temp/</filename>,
755 which has log files for each task (<filename>log.do_*.pid</filename>)
756 and contains the scripts BitBake runs for each task
757 (<filename>run.do_*.pid</filename>).
758 The <filename>WORKDIR/image/</filename> directory is where "make
759 install" places its output that is then split into sub-packages
760 within <filename>WORKDIR/packages-split/</filename>.
761 </para>
762 </section>
763
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500764 <section id='structure-build-tmp-work-tunearch-recipename-version'>
765 <title><filename>build/tmp/work/<replaceable>tunearch</replaceable>/<replaceable>recipename</replaceable>/<replaceable>version</replaceable>/</filename></title>
766
767 <para>
768 The recipe work directory - <filename>${WORKDIR}</filename>.
769 </para>
770
771 <para>
772 As described earlier in the
773 "<link linkend='structure-build-tmp-sysroots'><filename>build/tmp/sysroots/</filename></link>"
774 section, beginning with the &DISTRO; release of the Yocto
775 Project, the OpenEmbedded build system builds each recipe in its
776 own work directory (i.e.
777 <link linkend='var-WORKDIR'><filename>WORKDIR</filename></link>).
778 The path to the work directory is constructed using the
779 architecture of the given build (e.g.
780 <link linkend='var-TUNE_PKGARCH'><filename>TUNE_PKGARCH</filename></link>,
781 <link linkend='var-MACHINE_ARCH'><filename>MACHINE_ARCH</filename></link>,
782 or "allarch"), the recipe name, and the version of the recipe (i.e.
783 <link linkend='var-PE'><filename>PE</filename></link><filename>:</filename><link linkend='var-PV'><filename>PV</filename></link><filename>-</filename><link linkend='var-PR'><filename>PR</filename></link>).
784 </para>
785
786 <para>
787 A number of key subdirectories exist within each recipe
788 work directory:
789 <itemizedlist>
790 <listitem><para>
791 <filename>${WORKDIR}/temp</filename>:
792 Contains the log files of each task executed for this
793 recipe, the "run" files for each executed task, which
794 contain the code run, and a
795 <filename>log.task_order</filename> file, which lists the
796 order in which tasks were executed.
797 </para></listitem>
798 <listitem><para>
799 <filename>${WORKDIR}/image</filename>:
800 Contains the output of the
801 <link linkend='ref-tasks-install'><filename>do_install</filename></link>
802 task, which corresponds to the
803 <filename>${</filename><link linkend='var-D'><filename>D</filename></link><filename>}</filename>
804 variable in that task.
805 </para></listitem>
806 <listitem><para>
807 <filename>${WORKDIR}/pseudo</filename>:
808 Contains the pseudo database and log for any tasks executed
809 under pseudo for the recipe.
810 </para></listitem>
811 <listitem><para>
812 <filename>${WORKDIR}/sysroot-destdir</filename>:
813 Contains the output of the
814 <link linkend='ref-tasks-populate_sysroot'><filename>do_populate_sysroot</filename></link>
815 task.
816 </para></listitem>
817 <listitem><para>
818 <filename>${WORKDIR}/package</filename>:
819 Contains the output of the
820 <link linkend='ref-tasks-package'><filename>do_package</filename></link>
821 task before the output is split into individual packages.
822 </para></listitem>
823 <listitem><para>
824 <filename>${WORKDIR}/packages-split</filename>:
825 Contains the output of the <filename>do_package</filename>
826 task after the output has been split into individual
827 packages.
828 Subdirectories exist for each individual package created
829 by the recipe.
830 </para></listitem>
831 <listitem><para>
832 <filename>${WORKDIR}/recipe-sysroot</filename>:
833 A directory populated with the target dependencies of the
834 recipe.
835 This directory looks like the target filesystem and
836 contains libraries that the recipe might need to link
837 against (e.g. the C library).
838 </para></listitem>
839 <listitem><para>
840 <filename>${WORKDIR}/recipe-sysroot-native</filename>:
841 A directory populated with the native dependencies of the
842 recipe.
843 This directory contains the tools the recipe needs to build
844 (e.g. the compiler, Autoconf, libtool, and so forth).
845 </para></listitem>
846 <listitem><para>
847 <filename>${WORKDIR}/build</filename>:
848 This subdirectory applies only to recipes that support
849 builds where the source is separate from the
850 build artifacts.
851 The OpenEmbedded build system uses this directory as a
852 separate build directory (i.e.
853 <filename>${</filename><link linkend='var-B'><filename>B</filename></link><filename>}</filename>).
854 </para></listitem>
855 </itemizedlist>
856 </para>
857 </section>
858
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500859 <section id='structure-build-work-shared'>
860 <title><filename>build/tmp/work-shared/</filename></title>
861
862 <para>
863 For efficiency, the OpenEmbedded build system creates and uses
864 this directory to hold recipes that share a work directory with
865 other recipes.
866 In practice, this is only used for <filename>gcc</filename>
867 and its variants (e.g. <filename>gcc-cross</filename>,
868 <filename>libgcc</filename>, <filename>gcc-runtime</filename>,
869 and so forth).
870 </para>
871 </section>
872</section>
873
874<section id='structure-meta'>
875 <title>The Metadata - <filename>meta/</filename></title>
876
877 <para>
878 As mentioned previously,
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500879 <link linkend='metadata'>Metadata</link> is the core
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500880 of the Yocto Project.
881 Metadata has several important subdivisions:
882 </para>
883
884 <section id='structure-meta-classes'>
885 <title><filename>meta/classes/</filename></title>
886
887 <para>
888 This directory contains the <filename>*.bbclass</filename> files.
889 Class files are used to abstract common code so it can be reused by multiple
890 packages.
891 Every package inherits the <filename>base.bbclass</filename> file.
892 Examples of other important classes are <filename>autotools.bbclass</filename>, which
893 in theory allows any Autotool-enabled package to work with the Yocto Project with minimal effort.
894 Another example is <filename>kernel.bbclass</filename> that contains common code and functions
895 for working with the Linux kernel.
896 Functions like image generation or packaging also have their specific class files
897 such as <filename>image.bbclass</filename>, <filename>rootfs_*.bbclass</filename> and
898 <filename>package*.bbclass</filename>.
899 </para>
900
901 <para>
902 For reference information on classes, see the
903 "<link linkend='ref-classes'>Classes</link>" chapter.
904 </para>
905 </section>
906
907 <section id='structure-meta-conf'>
908 <title><filename>meta/conf/</filename></title>
909
910 <para>
911 This directory contains the core set of configuration files that start from
912 <filename>bitbake.conf</filename> and from which all other configuration
913 files are included.
914 See the include statements at the end of the
915 <filename>bitbake.conf</filename> file and you will note that even
916 <filename>local.conf</filename> is loaded from there.
917 While <filename>bitbake.conf</filename> sets up the defaults, you can often override
918 these by using the (<filename>local.conf</filename>) file, machine file or
919 the distribution configuration file.
920 </para>
921 </section>
922
923 <section id='structure-meta-conf-machine'>
924 <title><filename>meta/conf/machine/</filename></title>
925
926 <para>
927 This directory contains all the machine configuration files.
928 If you set <filename>MACHINE = "qemux86"</filename>,
929 the OpenEmbedded build system looks for a <filename>qemux86.conf</filename> file in this
930 directory.
931 The <filename>include</filename> directory contains various data common to multiple machines.
932 If you want to add support for a new machine to the Yocto Project, look in this directory.
933 </para>
934 </section>
935
936 <section id='structure-meta-conf-distro'>
937 <title><filename>meta/conf/distro/</filename></title>
938
939 <para>
940 The contents of this directory controls any distribution-specific
941 configurations.
942 For the Yocto Project, the <filename>defaultsetup.conf</filename> is the main file here.
943 This directory includes the versions and the
944 <filename>SRCDATE</filename> definitions for applications that are configured here.
945 An example of an alternative configuration might be <filename>poky-bleeding.conf</filename>.
946 Although this file mainly inherits its configuration from Poky.
947 </para>
948 </section>
949
950 <section id='structure-meta-conf-machine-sdk'>
951 <title><filename>meta/conf/machine-sdk/</filename></title>
952
953 <para>
954 The OpenEmbedded build system searches this directory for
955 configuration files that correspond to the value of
956 <link linkend='var-SDKMACHINE'><filename>SDKMACHINE</filename></link>.
957 By default, 32-bit and 64-bit x86 files ship with the Yocto
958 Project that support some SDK hosts.
959 However, it is possible to extend that support to other SDK hosts
960 by adding additional configuration files in this subdirectory
961 within another layer.
962 </para>
963 </section>
964
965 <section id='structure-meta-files'>
966 <title><filename>meta/files/</filename></title>
967
968 <para>
969 This directory contains common license files and several text files
970 used by the build system.
971 The text files contain minimal device information and
972 lists of files and directories with known permissions.
973 </para>
974 </section>
975
976 <section id='structure-meta-lib'>
977 <title><filename>meta/lib/</filename></title>
978
979 <para>
980 This directory contains OpenEmbedded Python library code
981 used during the build process.
982 </para>
983 </section>
984
985 <section id='structure-meta-recipes-bsp'>
986 <title><filename>meta/recipes-bsp/</filename></title>
987
988 <para>
989 This directory contains anything linking to specific hardware or hardware
990 configuration information such as "u-boot" and "grub".
991 </para>
992 </section>
993
994 <section id='structure-meta-recipes-connectivity'>
995 <title><filename>meta/recipes-connectivity/</filename></title>
996
997 <para>
998 This directory contains libraries and applications related to communication with other devices.
999 </para>
1000 </section>
1001
1002 <section id='structure-meta-recipes-core'>
1003 <title><filename>meta/recipes-core/</filename></title>
1004
1005 <para>
1006 This directory contains what is needed to build a basic working Linux image
1007 including commonly used dependencies.
1008 </para>
1009 </section>
1010
1011 <section id='structure-meta-recipes-devtools'>
1012 <title><filename>meta/recipes-devtools/</filename></title>
1013
1014 <para>
1015 This directory contains tools that are primarily used by the build system.
1016 The tools, however, can also be used on targets.
1017 </para>
1018 </section>
1019
1020 <section id='structure-meta-recipes-extended'>
1021 <title><filename>meta/recipes-extended/</filename></title>
1022
1023 <para>
1024 This directory contains non-essential applications that add features compared to the
1025 alternatives in core.
1026 You might need this directory for full tool functionality or for Linux Standard Base (LSB)
1027 compliance.
1028 </para>
1029 </section>
1030
1031 <section id='structure-meta-recipes-gnome'>
1032 <title><filename>meta/recipes-gnome/</filename></title>
1033
1034 <para>
1035 This directory contains all things related to the GTK+ application framework.
1036 </para>
1037 </section>
1038
1039 <section id='structure-meta-recipes-graphics'>
1040 <title><filename>meta/recipes-graphics/</filename></title>
1041
1042 <para>
1043 This directory contains X and other graphically related system libraries
1044 </para>
1045 </section>
1046
1047 <section id='structure-meta-recipes-kernel'>
1048 <title><filename>meta/recipes-kernel/</filename></title>
1049
1050 <para>
1051 This directory contains the kernel and generic applications and libraries that
1052 have strong kernel dependencies.
1053 </para>
1054 </section>
1055
1056 <section id='structure-meta-recipes-lsb4'>
1057 <title><filename>meta/recipes-lsb4/</filename></title>
1058
1059 <para>
1060 This directory contains recipes specifically added to support
1061 the Linux Standard Base (LSB) version 4.x.
1062 </para>
1063 </section>
1064
1065 <section id='structure-meta-recipes-multimedia'>
1066 <title><filename>meta/recipes-multimedia/</filename></title>
1067
1068 <para>
1069 This directory contains codecs and support utilities for audio, images and video.
1070 </para>
1071 </section>
1072
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001073 <section id='structure-meta-recipes-rt'>
1074 <title><filename>meta/recipes-rt/</filename></title>
1075
1076 <para>
1077 This directory contains package and image recipes for using and testing
1078 the <filename>PREEMPT_RT</filename> kernel.
1079 </para>
1080 </section>
1081
1082 <section id='structure-meta-recipes-sato'>
1083 <title><filename>meta/recipes-sato/</filename></title>
1084
1085 <para>
1086 This directory contains the Sato demo/reference UI/UX and its associated applications
1087 and configuration data.
1088 </para>
1089 </section>
1090
1091 <section id='structure-meta-recipes-support'>
1092 <title><filename>meta/recipes-support/</filename></title>
1093
1094 <para>
1095 This directory contains recipes used by other recipes, but that are
1096 not directly included in images (i.e. dependencies of other
1097 recipes).
1098 </para>
1099 </section>
1100
1101 <section id='structure-meta-site'>
1102 <title><filename>meta/site/</filename></title>
1103
1104 <para>
1105 This directory contains a list of cached results for various architectures.
1106 Because certain "autoconf" test results cannot be determined when cross-compiling due to
1107 the tests not able to run on a live system, the information in this directory is
1108 passed to "autoconf" for the various architectures.
1109 </para>
1110 </section>
1111
1112 <section id='structure-meta-recipes-txt'>
1113 <title><filename>meta/recipes.txt</filename></title>
1114
1115 <para>
1116 This file is a description of the contents of <filename>recipes-*</filename>.
1117 </para>
1118 </section>
1119</section>
1120
1121</chapter>
1122<!--
1123vim: expandtab tw=80 ts=4
1124-->