blob: 8588e9c2ddd6b0e41863fb1eea44dbecc6c43c42 [file] [log] [blame]
Andrew Geissler4873add2020-11-02 18:44:49 -06001<!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<!--SPDX-License-Identifier: CC-BY-2.0-UK-->
5
6<chapter id='ref-structure'>
7
8<title>Source Directory Structure</title>
9
10<para>
11 The <link linkend='source-directory'>Source Directory</link>
12 consists of numerous files, directories and subdirectories;
13 understanding their locations and contents is key to using the
14 Yocto Project effectively.
15 This chapter describes the Source Directory and gives information about
16 those files and directories.
17</para>
18
19<para>
20 For information on how to establish a local Source Directory on your
21 development system, see the
22 "<ulink url='&YOCTO_DOCS_DEV_URL;#locating-yocto-project-source-files'>Locating Yocto Project Source Files</ulink>"
23 section in the Yocto Project Development Tasks Manual.
24</para>
25
26 <note>
27 The OpenEmbedded build system does not support file or directory names that
28 contain spaces.
29 Be sure that the Source Directory you use does not contain these types
30 of names.
31 </note>
32
33<section id='structure-core'>
34 <title>Top-Level Core Components</title>
35
36 <para>
37 This section describes the top-level components of the
38 <link linkend='source-directory'>Source Directory</link>.
39 </para>
40
41 <section id='structure-core-bitbake'>
42 <title><filename>bitbake/</filename></title>
43
44 <para>
45 This directory includes a copy of BitBake for ease of use.
46 The copy usually matches the current stable BitBake release from
47 the BitBake project.
48 BitBake, a
49 <link linkend='metadata'>Metadata</link>
50 interpreter, reads the Yocto Project Metadata and runs the tasks
51 defined by that data.
52 Failures are usually caused by errors in your Metadata and not from BitBake itself;
53 consequently, most users do not need to worry about BitBake.
54 </para>
55
56 <para>
57 When you run the <filename>bitbake</filename> command, the
58 main BitBake executable (which resides in the
59 <filename>bitbake/bin/</filename> directory) starts.
60 Sourcing the environment setup script (i.e.
61 <link linkend="structure-core-script"><filename>&OE_INIT_FILE;</filename></link>)
62 places the <filename>scripts/</filename> and
63 <filename>bitbake/bin/</filename> directories (in that order) into
64 the shell's <filename>PATH</filename> environment variable.
65 </para>
66
67 <para>
68 For more information on BitBake, see the
69 <ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
70 </para>
71 </section>
72
73 <section id='structure-core-build'>
74 <title><filename>build/</filename></title>
75
76 <para>
77 This directory contains user configuration files and the output
78 generated by the OpenEmbedded build system in its standard configuration where
79 the source tree is combined with the output.
80 The
81 <link linkend='build-directory'>Build Directory</link>
82 is created initially when you <filename>source</filename>
83 the OpenEmbedded build environment setup script
84 (i.e.
85 <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
86 </para>
87
88 <para>
89 It is also possible to place output and configuration
90 files in a directory separate from the
91 <link linkend='source-directory'>Source Directory</link>
92 by providing a directory name when you <filename>source</filename>
93 the setup script.
94 For information on separating output from your local
95 Source Directory files (commonly described as an "out of tree" build), see the
96 "<link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>"
97 section.
98 </para>
99 </section>
100
101 <section id='handbook'>
102 <title><filename>documentation/</filename></title>
103
104 <para>
105 This directory holds the source for the Yocto Project documentation
106 as well as templates and tools that allow you to generate PDF and HTML
107 versions of the manuals.
108 Each manual is contained in its own sub-folder;
109 for example, the files for this reference manual reside in
110 the <filename>ref-manual/</filename> directory.
111 </para>
112 </section>
113
114 <section id='structure-core-meta'>
115 <title><filename>meta/</filename></title>
116
117 <para>
118 This directory contains the minimal, underlying OpenEmbedded-Core metadata.
119 The directory holds recipes, common classes, and machine
120 configuration for strictly emulated targets (<filename>qemux86</filename>,
121 <filename>qemuarm</filename>, and so forth.)
122 </para>
123 </section>
124
125 <section id='structure-core-meta-poky'>
126 <title><filename>meta-poky/</filename></title>
127
128 <para>
129 Designed above the <filename>meta/</filename> content, this directory
130 adds just enough metadata to define the Poky reference distribution.
131 </para>
132 </section>
133
134 <section id='structure-core-meta-yocto-bsp'>
135 <title><filename>meta-yocto-bsp/</filename></title>
136
137 <para>
138 This directory contains the Yocto Project reference
139 hardware Board Support Packages (BSPs).
140 For more information on BSPs, see the
141 <ulink url='&YOCTO_DOCS_BSP_URL;'>Yocto Project Board Support 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 You do not have to add this layer to your
153 <filename>bblayers.conf</filename> file unless you want to run the
154 selftests.
155 </para>
156 </section>
157
158 <section id='structure-meta-skeleton'>
159 <title><filename>meta-skeleton/</filename></title>
160
161 <para>
162 This directory contains template recipes for BSP and kernel development.
163 </para>
164 </section>
165
166 <section id='structure-core-scripts'>
167 <title><filename>scripts/</filename></title>
168
169 <para>
170 This directory contains various integration scripts that implement
171 extra functionality in the Yocto Project environment (e.g. QEMU scripts).
172 The <link linkend="structure-core-script"><filename>&OE_INIT_FILE;</filename></link>
173 script prepends this directory to the shell's
174 <filename>PATH</filename> environment variable.
175 </para>
176
177 <para>
178 The <filename>scripts</filename> directory has useful scripts that assist in contributing
179 back to the Yocto Project, such as <filename>create-pull-request</filename> and
180 <filename>send-pull-request</filename>.
181 </para>
182 </section>
183
184 <section id='structure-core-script'>
185 <title><filename>&OE_INIT_FILE;</filename></title>
186
187 <para>
188 This script sets up the OpenEmbedded build environment.
189 Running this script with the <filename>source</filename> command in
190 a shell makes changes to <filename>PATH</filename> and sets other
191 core BitBake variables based on the current working directory.
192 You need to run an environment setup script before running BitBake
193 commands.
194 The script uses other scripts within the
195 <filename>scripts</filename> directory to do the bulk of the work.
196 </para>
197
198 <para>
199 When you run this script, your Yocto Project environment is set
200 up, a
201 <link linkend='build-directory'>Build Directory</link>
202 is created, your working directory becomes the Build Directory,
203 and you are presented with some simple suggestions as to what to do
204 next, including a list of some possible targets to build.
205 Here is an example:
206 <literallayout class='monospaced'>
207 $ source oe-init-build-env
208
209 ### Shell environment set up for builds. ###
210
211 You can now run 'bitbake &lt;target&gt;'
212
213 Common targets are:
214 core-image-minimal
215 core-image-sato
216 meta-toolchain
217 meta-ide-support
218
219 You can also run generated qemu images with a command like 'runqemu qemux86-64'
220 </literallayout>
221 The default output of the <filename>oe-init-build-env</filename> script
222 is from the <filename>conf-notes.txt</filename> file, which is found in the
223 <filename>meta-poky</filename> directory within the
224 <link linkend='source-directory'>Source Directory</link>.
225 If you design a custom distribution, you can include your own version
226 of this configuration file to mention the targets defined by your
227 distribution.
228 See the
229 "<ulink url='&YOCTO_DOCS_DEV_URL;#creating-a-custom-template-configuration-directory'>Creating a Custom Template Configuration Directory</ulink>"
230 section in the Yocto Project Development Tasks Manual for more
231 information.
232 </para>
233
234 <para>
235 By default, running this script without a Build Directory
236 argument creates the <filename>build/</filename> directory
237 in your current working directory.
238 If you provide a Build Directory argument when you
239 <filename>source</filename> the script, you direct the OpenEmbedded
240 build system to create a Build Directory of your choice.
241 For example, the following command creates a Build Directory named
242 <filename>mybuilds/</filename> that is outside of the
243 <link linkend='source-directory'>Source Directory</link>:
244 <literallayout class='monospaced'>
245 $ source &OE_INIT_FILE; ~/mybuilds
246 </literallayout>
247 The OpenEmbedded build system uses the template configuration
248 files, which are found by default in the
249 <filename>meta-poky/conf/</filename> directory in the
250 Source Directory.
251 See the
252 "<ulink url='&YOCTO_DOCS_DEV_URL;#creating-a-custom-template-configuration-directory'>Creating a Custom Template Configuration Directory</ulink>"
253 section in the Yocto Project Development Tasks Manual for more
254 information.
255 <note>
256 The OpenEmbedded build system does not support file or directory names that
257 contain spaces.
258 If you attempt to run the <filename>&OE_INIT_FILE;</filename> script
259 from a Source Directory that contains spaces in either the filenames
260 or directory names, the script returns an error indicating no such
261 file or directory.
262 Be sure to use a Source Directory free of names containing spaces.
263 </note>
264 </para>
265 </section>
266
267 <section id='structure-basic-top-level'>
268 <title><filename>LICENSE, README, and README.hardware</filename></title>
269
270 <para>
271 These files are standard top-level files.
272 </para>
273 </section>
274</section>
275
276<section id='structure-build'>
277 <title>The Build Directory - <filename>build/</filename></title>
278
279 <para>
280 The OpenEmbedded build system creates the
281 <link linkend='build-directory'>Build Directory</link>
282 when you run the build environment setup script
283 <link
284linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>.
285 If you do not give the Build Directory a specific name when you run
286 the setup script, the name defaults to <filename>build/</filename>.
287 </para>
288
289 <para>
290 For subsequent parsing and processing, the name of the Build
291 directory is available via the
292 <link linkend='var-TOPDIR'><filename>TOPDIR</filename></link> variable.
293 </para>
294
295 <section id='structure-build-buildhistory'>
296 <title><filename>build/buildhistory/</filename></title>
297
298 <para>
299 The OpenEmbedded build system creates this directory when you
300 enable build history via the <filename>buildhistory</filename> class file.
301 The directory organizes build information into image, packages, and
302 SDK subdirectories.
303 For information on the build history feature, see the
304 "<ulink url='&YOCTO_DOCS_DEV_URL;#maintaining-build-output-quality'>Maintaining Build Output Quality</ulink>"
305 section in the Yocto Project Development Tasks Manual.
306 </para>
307 </section>
308
309 <section id='structure-build-conf-local.conf'>
310 <title><filename>build/conf/local.conf</filename></title>
311
312 <para>
313 This configuration file contains all the local user configurations
314 for your build environment.
315 The <filename>local.conf</filename> file contains documentation on
316 the various configuration options.
317 Any variable set here overrides any variable set elsewhere within
318 the environment unless that variable is hard-coded within a file
319 (e.g. by using '=' instead of '?=').
320 Some variables are hard-coded for various reasons but such
321 variables are relatively rare.
322 </para>
323
324 <para>
325 At a minimum, you would normally edit this file to select the target
326 <filename><link linkend='var-MACHINE'>MACHINE</link></filename>,
327 which package types you wish to use
328 (<link linkend='var-PACKAGE_CLASSES'><filename>PACKAGE_CLASSES</filename></link>),
329 and the location from which you want to access downloaded files
330 (<filename><link linkend='var-DL_DIR'>DL_DIR</link></filename>).
331 </para>
332
333 <para>
334 If <filename>local.conf</filename> is not present when you
335 start the build, the OpenEmbedded build system creates it from
336 <filename>local.conf.sample</filename> when
337 you <filename>source</filename> the top-level build environment
338 setup script
339 <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>.
340 </para>
341
342 <para>
343 The source <filename>local.conf.sample</filename> file used
344 depends on the <filename>$TEMPLATECONF</filename> script variable,
345 which defaults to <filename>meta-poky/conf/</filename>
346 when you are building from the Yocto Project development
347 environment, and to <filename>meta/conf/</filename> when
348 you are building from the OpenEmbedded-Core environment.
349 Because the script variable points to the source of the
350 <filename>local.conf.sample</filename> file, this implies that
351 you can configure your build environment from any layer by setting
352 the variable in the top-level build environment setup script as
353 follows:
354 <literallayout class='monospaced'>
355 TEMPLATECONF=<replaceable>your_layer</replaceable>/conf
356 </literallayout>
357 Once the build process gets the sample file, it uses
358 <filename>sed</filename> to substitute final
359 <filename>${</filename><link linkend='var-OEROOT'><filename>OEROOT</filename></link><filename>}</filename>
360 values for all <filename>##OEROOT##</filename> values.
361 <note>
362 You can see how the <filename>TEMPLATECONF</filename> variable
363 is used by looking at the
364 <filename>scripts/oe-setup-builddir</filename> script in the
365 <link linkend='source-directory'>Source Directory</link>.
366 You can find the Yocto Project version of the
367 <filename>local.conf.sample</filename> file in the
368 <filename>meta-poky/conf</filename> directory.
369 </note>
370 </para>
371 </section>
372
373 <section id='structure-build-conf-bblayers.conf'>
374 <title><filename>build/conf/bblayers.conf</filename></title>
375
376 <para>
377 This configuration file defines
378 <ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>layers</ulink>,
379 which are directory trees, traversed (or walked) by BitBake.
380 The <filename>bblayers.conf</filename> file uses the
381 <link linkend='var-BBLAYERS'><filename>BBLAYERS</filename></link>
382 variable to list the layers BitBake tries to find.
383 </para>
384
385 <para>
386 If <filename>bblayers.conf</filename> is not present when you
387 start the build, the OpenEmbedded build system creates it from
388 <filename>bblayers.conf.sample</filename> when
389 you <filename>source</filename> the top-level build environment
390 setup script (i.e.
391 <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
392 </para>
393
394 <para>
395 As with the <filename>local.conf</filename> file,
396 the source <filename>bblayers.conf.sample</filename> file used
397 depends on the <filename>$TEMPLATECONF</filename> script variable,
398 which defaults to <filename>meta-poky/conf/</filename>
399 when you are building from the Yocto Project development
400 environment, and to <filename>meta/conf/</filename> when
401 you are building from the OpenEmbedded-Core environment.
402 Because the script variable points to the source of the
403 <filename>bblayers.conf.sample</filename> file, this implies that
404 you can base your build from any layer by setting the variable in
405 the top-level build environment setup script as follows:
406 <literallayout class='monospaced'>
407 TEMPLATECONF=<replaceable>your_layer</replaceable>/conf
408 </literallayout>
409 Once the build process gets the sample file, it uses
410 <filename>sed</filename> to substitute final
411 <filename>${</filename><link linkend='var-OEROOT'><filename>OEROOT</filename></link><filename>}</filename>
412 values for all <filename>##OEROOT##</filename> values.
413 <note>
414 You can see how the <filename>TEMPLATECONF</filename> variable
415 <filename>scripts/oe-setup-builddir</filename> script in the
416 <link linkend='source-directory'>Source Directory</link>.
417 You can find the Yocto Project version of the
418 <filename>bblayers.conf.sample</filename> file in the
419 <filename>meta-poky/conf/</filename> directory.
420 </note>
421 </para>
422 </section>
423
424 <section id='structure-build-conf-sanity_info'>
425 <title><filename>build/cache/sanity_info</filename></title>
426
427 <para>
428 This file indicates the state of the sanity checks and is created
429 during the build.
430 </para>
431 </section>
432
433 <section id='structure-build-downloads'>
434 <title><filename>build/downloads/</filename></title>
435
436 <para>
437 This directory contains downloaded upstream source tarballs.
438 You can reuse the directory for multiple builds or move
439 the directory to another location.
440 You can control the location of this directory through the
441 <filename><link linkend='var-DL_DIR'>DL_DIR</link></filename> variable.
442 </para>
443 </section>
444
445 <section id='structure-build-sstate-cache'>
446 <title><filename>build/sstate-cache/</filename></title>
447
448 <para>
449 This directory contains the shared state cache.
450 You can reuse the directory for multiple builds or move
451 the directory to another location.
452 You can control the location of this directory through the
453 <filename><link linkend='var-SSTATE_DIR'>SSTATE_DIR</link></filename> variable.
454 </para>
455 </section>
456
457 <section id='structure-build-tmp'>
458 <title><filename>build/tmp/</filename></title>
459
460 <para>
461 The OpenEmbedded build system creates and uses this directory
462 for all the build system's output.
463 The
464 <link linkend='var-TMPDIR'><filename>TMPDIR</filename></link>
465 variable points to this directory.
466 </para>
467
468 <para>
469 BitBake creates this directory if it does not exist.
470 As a last resort, to clean up a build and start it from scratch
471 (other than the downloads), you can remove everything in the
472 <filename>tmp</filename> directory or get rid of the
473 directory completely.
474 If you do, you should also completely remove the
475 <filename>build/sstate-cache</filename> directory.
476 </para>
477 </section>
478
479 <section id='structure-build-tmp-buildstats'>
480 <title><filename>build/tmp/buildstats/</filename></title>
481
482 <para>
483 This directory stores the build statistics.
484 </para>
485 </section>
486
487 <section id='structure-build-tmp-cache'>
488 <title><filename>build/tmp/cache/</filename></title>
489
490 <para>
491 When BitBake parses the metadata (recipes and configuration files),
492 it caches the results in <filename>build/tmp/cache/</filename>
493 to speed up future builds.
494 The results are stored on a per-machine basis.
495 </para>
496
497 <para>
498 During subsequent builds, BitBake checks each recipe (together
499 with, for example, any files included or appended to it) to see
500 if they have been modified.
501 Changes can be detected, for example, through file modification
502 time (mtime) changes and hashing of file contents.
503 If no changes to the file are detected, then the parsed result
504 stored in the cache is reused.
505 If the file has changed, it is reparsed.
506 </para>
507 </section>
508
509 <section id='structure-build-tmp-deploy'>
510 <title><filename>build/tmp/deploy/</filename></title>
511
512 <para>
513 This directory contains any "end result" output from the
514 OpenEmbedded build process.
515 The <link linkend='var-DEPLOY_DIR'><filename>DEPLOY_DIR</filename></link>
516 variable points to this directory.
517 For more detail on the contents of the <filename>deploy</filename>
518 directory, see the
519 "<ulink url='&YOCTO_DOCS_OM_URL;#images-dev-environment'>Images</ulink>"
520 and
521 "<ulink url='&YOCTO_DOCS_OM_URL;#sdk-dev-environment'>Application Development SDK</ulink>"
522 sections in the Yocto Project Overview and Concepts Manual.
523 </para>
524 </section>
525
526 <section id='structure-build-tmp-deploy-deb'>
527 <title><filename>build/tmp/deploy/deb/</filename></title>
528
529 <para>
530 This directory receives any <filename>.deb</filename> packages produced by
531 the build process.
532 The packages are sorted into feeds for different architecture types.
533 </para>
534 </section>
535
536 <section id='structure-build-tmp-deploy-rpm'>
537 <title><filename>build/tmp/deploy/rpm/</filename></title>
538
539 <para>
540 This directory receives any <filename>.rpm</filename> packages produced by
541 the build process.
542 The packages are sorted into feeds for different architecture types.
543 </para>
544 </section>
545
546 <section id='structure-build-tmp-deploy-ipk'>
547 <title><filename>build/tmp/deploy/ipk/</filename></title>
548
549 <para>
550 This directory receives <filename>.ipk</filename> packages produced by
551 the build process.
552 </para>
553 </section>
554
555 <section id='structure-build-tmp-deploy-licenses'>
556 <title><filename>build/tmp/deploy/licenses/</filename></title>
557
558 <para>
559 This directory receives package licensing information.
560 For example, the directory contains sub-directories for <filename>bash</filename>,
561 <filename>busybox</filename>, and <filename>glibc</filename> (among others) that in turn
562 contain appropriate <filename>COPYING</filename> license files with other licensing information.
563 For information on licensing, see the
564 "<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>"
565 section in the Yocto Project Development Tasks Manual.
566 </para>
567 </section>
568
569 <section id='structure-build-tmp-deploy-images'>
570 <title><filename>build/tmp/deploy/images/</filename></title>
571
572 <para>
573 This directory is populated with the basic output objects of the
574 build (think of them as the "generated artifacts" of the build process),
575 including things like the boot loader image, kernel, root filesystem and more.
576 If you want to flash the resulting image from a build onto a device,
577 look here for the necessary components.
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.
583 <filename>core-image-*</filename>).
584 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
611 "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-building-an-sdk-installer'>Building an SDK Installer</ulink>"
612 section in the Yocto Project Application Development and the
613 Extensible Software Development Kit (eSDK) manual.
614 </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
633 <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
644 the path is specified by the
645 <link linkend='var-COMPONENTS_DIR'><filename>COMPONENTS_DIR</filename></link>
646 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
653 <section id='structure-build-tmp-sysroots'>
654 <title><filename>build/tmp/sysroots/</filename></title>
655
656 <para>
657 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>
675 </para>
676 </section>
677
678 <section id='structure-build-tmp-stamps'>
679 <title><filename>build/tmp/stamps/</filename></title>
680
681 <para>
682 This directory holds information that BitBake uses for
683 accounting purposes to track what tasks have run and when they
684 have run.
685 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>
694
695 <para>
696 For information on how BitBake uses stamp files to determine if
697 a task should be rerun, see the
698 "<ulink url='&YOCTO_DOCS_OM_URL;#stamp-files-and-the-rerunning-of-tasks'>Stamp Files and the Rerunning of Tasks</ulink>"
699 section in the Yocto Project Overview and Concepts Manual.
700 </para>
701 </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 <filename>WORKDIR</filename>, is created.
739 Within this directory, the source is unpacked to
740 <filename>linux-qemux86-standard-build</filename> and then patched by Quilt.
741 (See the
742 "<ulink url='&YOCTO_DOCS_DEV_URL;#using-a-quilt-workflow'>Using Quilt in Your Workflow</ulink>"
743 section in the Yocto Project Development Tasks Manual for more
744 information.)
745 Within the <filename>linux-qemux86-standard-build</filename> directory,
746 standard Quilt directories <filename>linux-3.0/patches</filename>
747 and <filename>linux-3.0/.pc</filename> are created,
748 and standard Quilt commands can be used.
749 </para>
750
751 <para>
752 There are other directories generated within <filename>WORKDIR</filename>.
753 The most important directory is <filename>WORKDIR/temp/</filename>,
754 which has log files for each task (<filename>log.do_*.pid</filename>)
755 and contains the scripts BitBake runs for each task
756 (<filename>run.do_*.pid</filename>).
757 The <filename>WORKDIR/image/</filename> directory is where "make
758 install" places its output that is then split into sub-packages
759 within <filename>WORKDIR/packages-split/</filename>.
760 </para>
761 </section>
762
763 <section id='structure-build-tmp-work-tunearch-recipename-version'>
764 <title><filename>build/tmp/work/<replaceable>tunearch</replaceable>/<replaceable>recipename</replaceable>/<replaceable>version</replaceable>/</filename></title>
765
766 <para>
767 The recipe work directory - <filename>${WORKDIR}</filename>.
768 </para>
769
770 <para>
771 As described earlier in the
772 "<link linkend='structure-build-tmp-sysroots'><filename>build/tmp/sysroots/</filename></link>"
773 section, beginning with the &DISTRO; release of the Yocto
774 Project, the OpenEmbedded build system builds each recipe in its
775 own work directory (i.e.
776 <link linkend='var-WORKDIR'><filename>WORKDIR</filename></link>).
777 The path to the work directory is constructed using the
778 architecture of the given build (e.g.
779 <link linkend='var-TUNE_PKGARCH'><filename>TUNE_PKGARCH</filename></link>,
780 <link linkend='var-MACHINE_ARCH'><filename>MACHINE_ARCH</filename></link>,
781 or "allarch"), the recipe name, and the version of the recipe (i.e.
782 <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>).
783 </para>
784
785 <para>
786 A number of key subdirectories exist within each recipe
787 work directory:
788 <itemizedlist>
789 <listitem><para>
790 <filename>${WORKDIR}/temp</filename>:
791 Contains the log files of each task executed for this
792 recipe, the "run" files for each executed task, which
793 contain the code run, and a
794 <filename>log.task_order</filename> file, which lists the
795 order in which tasks were executed.
796 </para></listitem>
797 <listitem><para>
798 <filename>${WORKDIR}/image</filename>:
799 Contains the output of the
800 <link linkend='ref-tasks-install'><filename>do_install</filename></link>
801 task, which corresponds to the
802 <filename>${</filename><link linkend='var-D'><filename>D</filename></link><filename>}</filename>
803 variable in that task.
804 </para></listitem>
805 <listitem><para>
806 <filename>${WORKDIR}/pseudo</filename>:
807 Contains the pseudo database and log for any tasks executed
808 under pseudo for the recipe.
809 </para></listitem>
810 <listitem><para>
811 <filename>${WORKDIR}/sysroot-destdir</filename>:
812 Contains the output of the
813 <link linkend='ref-tasks-populate_sysroot'><filename>do_populate_sysroot</filename></link>
814 task.
815 </para></listitem>
816 <listitem><para>
817 <filename>${WORKDIR}/package</filename>:
818 Contains the output of the
819 <link linkend='ref-tasks-package'><filename>do_package</filename></link>
820 task before the output is split into individual packages.
821 </para></listitem>
822 <listitem><para>
823 <filename>${WORKDIR}/packages-split</filename>:
824 Contains the output of the <filename>do_package</filename>
825 task after the output has been split into individual
826 packages.
827 Subdirectories exist for each individual package created
828 by the recipe.
829 </para></listitem>
830 <listitem><para>
831 <filename>${WORKDIR}/recipe-sysroot</filename>:
832 A directory populated with the target dependencies of the
833 recipe.
834 This directory looks like the target filesystem and
835 contains libraries that the recipe might need to link
836 against (e.g. the C library).
837 </para></listitem>
838 <listitem><para>
839 <filename>${WORKDIR}/recipe-sysroot-native</filename>:
840 A directory populated with the native dependencies of the
841 recipe.
842 This directory contains the tools the recipe needs to build
843 (e.g. the compiler, Autoconf, libtool, and so forth).
844 </para></listitem>
845 <listitem><para>
846 <filename>${WORKDIR}/build</filename>:
847 This subdirectory applies only to recipes that support
848 builds where the source is separate from the
849 build artifacts.
850 The OpenEmbedded build system uses this directory as a
851 separate build directory (i.e.
852 <filename>${</filename><link linkend='var-B'><filename>B</filename></link><filename>}</filename>).
853 </para></listitem>
854 </itemizedlist>
855 </para>
856 </section>
857
858 <section id='structure-build-work-shared'>
859 <title><filename>build/tmp/work-shared/</filename></title>
860
861 <para>
862 For efficiency, the OpenEmbedded build system creates and uses
863 this directory to hold recipes that share a work directory with
864 other recipes.
865 In practice, this is only used for <filename>gcc</filename>
866 and its variants (e.g. <filename>gcc-cross</filename>,
867 <filename>libgcc</filename>, <filename>gcc-runtime</filename>,
868 and so forth).
869 </para>
870 </section>
871</section>
872
873<section id='structure-meta'>
874 <title>The Metadata - <filename>meta/</filename></title>
875
876 <para>
877 As mentioned previously,
878 <link linkend='metadata'>Metadata</link> is the core
879 of the Yocto Project.
880 Metadata has several important subdivisions:
881 </para>
882
883 <section id='structure-meta-classes'>
884 <title><filename>meta/classes/</filename></title>
885
886 <para>
887 This directory contains the <filename>*.bbclass</filename> files.
888 Class files are used to abstract common code so it can be reused by multiple
889 packages.
890 Every package inherits the <filename>base.bbclass</filename> file.
891 Examples of other important classes are <filename>autotools.bbclass</filename>, which
892 in theory allows any Autotool-enabled package to work with the Yocto Project with minimal effort.
893 Another example is <filename>kernel.bbclass</filename> that contains common code and functions
894 for working with the Linux kernel.
895 Functions like image generation or packaging also have their specific class files
896 such as <filename>image.bbclass</filename>, <filename>rootfs_*.bbclass</filename> and
897 <filename>package*.bbclass</filename>.
898 </para>
899
900 <para>
901 For reference information on classes, see the
902 "<link linkend='ref-classes'>Classes</link>" chapter.
903 </para>
904 </section>
905
906 <section id='structure-meta-conf'>
907 <title><filename>meta/conf/</filename></title>
908
909 <para>
910 This directory contains the core set of configuration files that start from
911 <filename>bitbake.conf</filename> and from which all other configuration
912 files are included.
913 See the include statements at the end of the
914 <filename>bitbake.conf</filename> file and you will note that even
915 <filename>local.conf</filename> is loaded from there.
916 While <filename>bitbake.conf</filename> sets up the defaults, you can often override
917 these by using the (<filename>local.conf</filename>) file, machine file or
918 the distribution configuration file.
919 </para>
920 </section>
921
922 <section id='structure-meta-conf-machine'>
923 <title><filename>meta/conf/machine/</filename></title>
924
925 <para>
926 This directory contains all the machine configuration files.
927 If you set <filename>MACHINE = "qemux86"</filename>,
928 the OpenEmbedded build system looks for a <filename>qemux86.conf</filename> file in this
929 directory.
930 The <filename>include</filename> directory contains various data common to multiple machines.
931 If you want to add support for a new machine to the Yocto Project, look in this directory.
932 </para>
933 </section>
934
935 <section id='structure-meta-conf-distro'>
936 <title><filename>meta/conf/distro/</filename></title>
937
938 <para>
939 The contents of this directory controls any distribution-specific
940 configurations.
941 For the Yocto Project, the <filename>defaultsetup.conf</filename> is the main file here.
942 This directory includes the versions and the
943 <filename>SRCDATE</filename> definitions for applications that are configured here.
944 An example of an alternative configuration might be <filename>poky-bleeding.conf</filename>.
945 Although this file mainly inherits its configuration from Poky.
946 </para>
947 </section>
948
949 <section id='structure-meta-conf-machine-sdk'>
950 <title><filename>meta/conf/machine-sdk/</filename></title>
951
952 <para>
953 The OpenEmbedded build system searches this directory for
954 configuration files that correspond to the value of
955 <link linkend='var-SDKMACHINE'><filename>SDKMACHINE</filename></link>.
956 By default, 32-bit and 64-bit x86 files ship with the Yocto
957 Project that support some SDK hosts.
958 However, it is possible to extend that support to other SDK hosts
959 by adding additional configuration files in this subdirectory
960 within another layer.
961 </para>
962 </section>
963
964 <section id='structure-meta-files'>
965 <title><filename>meta/files/</filename></title>
966
967 <para>
968 This directory contains common license files and several text files
969 used by the build system.
970 The text files contain minimal device information and
971 lists of files and directories with known permissions.
972 </para>
973 </section>
974
975 <section id='structure-meta-lib'>
976 <title><filename>meta/lib/</filename></title>
977
978 <para>
979 This directory contains OpenEmbedded Python library code
980 used during the build process.
981 </para>
982 </section>
983
984 <section id='structure-meta-recipes-bsp'>
985 <title><filename>meta/recipes-bsp/</filename></title>
986
987 <para>
988 This directory contains anything linking to specific hardware or hardware
989 configuration information such as "u-boot" and "grub".
990 </para>
991 </section>
992
993 <section id='structure-meta-recipes-connectivity'>
994 <title><filename>meta/recipes-connectivity/</filename></title>
995
996 <para>
997 This directory contains libraries and applications related to communication with other devices.
998 </para>
999 </section>
1000
1001 <section id='structure-meta-recipes-core'>
1002 <title><filename>meta/recipes-core/</filename></title>
1003
1004 <para>
1005 This directory contains what is needed to build a basic working Linux image
1006 including commonly used dependencies.
1007 </para>
1008 </section>
1009
1010 <section id='structure-meta-recipes-devtools'>
1011 <title><filename>meta/recipes-devtools/</filename></title>
1012
1013 <para>
1014 This directory contains tools that are primarily used by the build system.
1015 The tools, however, can also be used on targets.
1016 </para>
1017 </section>
1018
1019 <section id='structure-meta-recipes-extended'>
1020 <title><filename>meta/recipes-extended/</filename></title>
1021
1022 <para>
1023 This directory contains non-essential applications that add features compared to the
1024 alternatives in core.
1025 You might need this directory for full tool functionality or for Linux Standard Base (LSB)
1026 compliance.
1027 </para>
1028 </section>
1029
1030 <section id='structure-meta-recipes-gnome'>
1031 <title><filename>meta/recipes-gnome/</filename></title>
1032
1033 <para>
1034 This directory contains all things related to the GTK+ application framework.
1035 </para>
1036 </section>
1037
1038 <section id='structure-meta-recipes-graphics'>
1039 <title><filename>meta/recipes-graphics/</filename></title>
1040
1041 <para>
1042 This directory contains X and other graphically related system libraries.
1043 </para>
1044 </section>
1045
1046 <section id='structure-meta-recipes-kernel'>
1047 <title><filename>meta/recipes-kernel/</filename></title>
1048
1049 <para>
1050 This directory contains the kernel and generic applications and libraries that
1051 have strong kernel dependencies.
1052 </para>
1053 </section>
1054
1055 <section id='structure-meta-recipes-lsb4'>
1056 <title><filename>meta/recipes-lsb4/</filename></title>
1057
1058 <para>
1059 This directory contains recipes specifically added to support
1060 the Linux Standard Base (LSB) version 4.x.
1061 </para>
1062 </section>
1063
1064 <section id='structure-meta-recipes-multimedia'>
1065 <title><filename>meta/recipes-multimedia/</filename></title>
1066
1067 <para>
1068 This directory contains codecs and support utilities for audio, images and video.
1069 </para>
1070 </section>
1071
1072 <section id='structure-meta-recipes-rt'>
1073 <title><filename>meta/recipes-rt/</filename></title>
1074
1075 <para>
1076 This directory contains package and image recipes for using and testing
1077 the <filename>PREEMPT_RT</filename> kernel.
1078 </para>
1079 </section>
1080
1081 <section id='structure-meta-recipes-sato'>
1082 <title><filename>meta/recipes-sato/</filename></title>
1083
1084 <para>
1085 This directory contains the Sato demo/reference UI/UX and its associated applications
1086 and configuration data.
1087 </para>
1088 </section>
1089
1090 <section id='structure-meta-recipes-support'>
1091 <title><filename>meta/recipes-support/</filename></title>
1092
1093 <para>
1094 This directory contains recipes used by other recipes, but that are
1095 not directly included in images (i.e. dependencies of other
1096 recipes).
1097 </para>
1098 </section>
1099
1100 <section id='structure-meta-site'>
1101 <title><filename>meta/site/</filename></title>
1102
1103 <para>
1104 This directory contains a list of cached results for various architectures.
1105 Because certain "autoconf" test results cannot be determined when cross-compiling due to
1106 the tests not able to run on a live system, the information in this directory is
1107 passed to "autoconf" for the various architectures.
1108 </para>
1109 </section>
1110
1111 <section id='structure-meta-recipes-txt'>
1112 <title><filename>meta/recipes.txt</filename></title>
1113
1114 <para>
1115 This file is a description of the contents of <filename>recipes-*</filename>.
1116 </para>
1117 </section>
1118</section>
1119
1120</chapter>
1121<!--
1122vim: expandtab tw=80 ts=4
1123-->