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