blob: e51ceb1bf5a4668b8da92151b3642d0aa501d476 [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>
663 When BitBake parses the metadata, it creates a cache file of the result that can
664 be used when subsequently running commands.
665 BitBake stores these results here on a per-machine basis.
666 </para>
667 </section>
668
669 <section id='structure-build-tmp-deploy'>
670 <title><filename>build/tmp/deploy/</filename></title>
671
672 <para>
673 This directory contains any "end result" output from the
674 OpenEmbedded build process.
675 The <link linkend='var-DEPLOY_DIR'><filename>DEPLOY_DIR</filename></link>
676 variable points to this directory.
677 For more detail on the contents of the <filename>deploy</filename>
678 directory, see the
679 "<link linkend='images-dev-environment'>Images</link>" and
680 "<link linkend='sdk-dev-environment'>Application Development SDK</link>"
681 sections.
682 </para>
683 </section>
684
685 <section id='structure-build-tmp-deploy-deb'>
686 <title><filename>build/tmp/deploy/deb/</filename></title>
687
688 <para>
689 This directory receives any <filename>.deb</filename> packages produced by
690 the build process.
691 The packages are sorted into feeds for different architecture types.
692 </para>
693 </section>
694
695 <section id='structure-build-tmp-deploy-rpm'>
696 <title><filename>build/tmp/deploy/rpm/</filename></title>
697
698 <para>
699 This directory receives any <filename>.rpm</filename> packages produced by
700 the build process.
701 The packages are sorted into feeds for different architecture types.
702 </para>
703 </section>
704
705 <section id='structure-build-tmp-deploy-ipk'>
706 <title><filename>build/tmp/deploy/ipk/</filename></title>
707
708 <para>
709 This directory receives <filename>.ipk</filename> packages produced by
710 the build process.
711 </para>
712 </section>
713
714 <section id='structure-build-tmp-deploy-licenses'>
715 <title><filename>build/tmp/deploy/licenses/</filename></title>
716
717 <para>
718 This directory receives package licensing information.
719 For example, the directory contains sub-directories for <filename>bash</filename>,
720 <filename>busybox</filename>, and <filename>glibc</filename> (among others) that in turn
721 contain appropriate <filename>COPYING</filename> license files with other licensing information.
722 For information on licensing, see the
723 "<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>"
724 section.
725 </para>
726 </section>
727
728 <section id='structure-build-tmp-deploy-images'>
729 <title><filename>build/tmp/deploy/images/</filename></title>
730
731 <para>
732 This directory receives complete filesystem images.
733 If you want to flash the resulting image from a build onto a device, look here for the image.
734 </para>
735
736 <para>
737 Be careful when deleting files in this directory.
738 You can safely delete old images from this directory (e.g.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500739 <filename>core-image-*</filename>).
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500740 However, the kernel (<filename>*zImage*</filename>, <filename>*uImage*</filename>, etc.),
741 bootloader and other supplementary files might be deployed here prior to building an
742 image.
743 Because these files are not directly produced from the image, if you
744 delete them they will not be automatically re-created when you build the image again.
745 </para>
746
747 <para>
748 If you do accidentally delete files here, you will need to force them to be
749 re-created.
750 In order to do that, you will need to know the target that produced them.
751 For example, these commands rebuild and re-create the kernel files:
752 <literallayout class='monospaced'>
753 $ bitbake -c clean virtual/kernel
754 $ bitbake virtual/kernel
755 </literallayout>
756 </para>
757 </section>
758
759 <section id='structure-build-tmp-deploy-sdk'>
760 <title><filename>build/tmp/deploy/sdk/</filename></title>
761
762 <para>
763 The OpenEmbedded build system creates this directory to hold
764 toolchain installer scripts, which when executed, install the
765 sysroot that matches your target hardware.
766 You can find out more about these installers in the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500767 "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-building-an-sdk-installer'>Building an SDK Installer</ulink>"
768 section in the Yocto Project Software Development Kit (SDK) Developer's Guide.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500769 </para>
770 </section>
771
772 <section id='structure-build-tmp-sstate-control'>
773 <title><filename>build/tmp/sstate-control/</filename></title>
774
775 <para>
776 The OpenEmbedded build system uses this directory for the
777 shared state manifest files.
778 The shared state code uses these files to record the files
779 installed by each sstate task so that the files can be removed
780 when cleaning the recipe or when a newer version is about to
781 be installed.
782 The build system also uses the manifests to detect and produce
783 a warning when files from one task are overwriting those from
784 another.
785 </para>
786 </section>
787
788 <section id='structure-build-tmp-sysroots'>
789 <title><filename>build/tmp/sysroots/</filename></title>
790
791 <para>
792 This directory contains shared header files and libraries as well as other shared
793 data.
794 Packages that need to share output with other packages do so within this directory.
795 The directory is subdivided by architecture so multiple builds can run within
796 the one Build Directory.
797 </para>
798 </section>
799
800 <section id='structure-build-tmp-stamps'>
801 <title><filename>build/tmp/stamps/</filename></title>
802
803 <para>
804 This directory holds information that BitBake uses for accounting purposes
805 to track what tasks have run and when they have run.
806 The directory is sub-divided by architecture, package name, and
807 version.
808 Following is an example:
809 <literallayout class='monospaced'>
810 stamps/all-poky-linux/distcc-config/1.0-r0.do_build-2fdd....2do
811 </literallayout>
812 Although the files in the directory are empty of data,
813 BitBake uses the filenames and timestamps for tracking purposes.
814 </para>
815 </section>
816
817 <section id='structure-build-tmp-log'>
818 <title><filename>build/tmp/log/</filename></title>
819
820 <para>
821 This directory contains general logs that are not otherwise placed using the
822 package's <filename><link linkend='var-WORKDIR'>WORKDIR</link></filename>.
823 Examples of logs are the output from the
824 <filename>do_check_pkg</filename> or
825 <filename>do_distro_check</filename> tasks.
826 Running a build does not necessarily mean this directory is created.
827 </para>
828 </section>
829
830 <section id='structure-build-tmp-work'>
831 <title><filename>build/tmp/work/</filename></title>
832
833 <para>
834 This directory contains architecture-specific work sub-directories
835 for packages built by BitBake.
836 All tasks execute from the appropriate work directory.
837 For example, the source for a particular package is unpacked,
838 patched, configured and compiled all within its own work directory.
839 Within the work directory, organization is based on the package group
840 and version for which the source is being compiled
841 as defined by the
842 <link linkend='var-WORKDIR'><filename>WORKDIR</filename></link>.
843 </para>
844
845 <para>
846 It is worth considering the structure of a typical work directory.
847 As an example, consider <filename>linux-yocto-kernel-3.0</filename>
848 on the machine <filename>qemux86</filename>
849 built within the Yocto Project.
850 For this package, a work directory of
851 <filename>tmp/work/qemux86-poky-linux/linux-yocto/3.0+git1+&lt;.....&gt;</filename>,
852 referred to as the
853 <filename><link linkend='var-WORKDIR'>WORKDIR</link></filename>, is created.
854 Within this directory, the source is unpacked to
855 <filename>linux-qemux86-standard-build</filename> and then patched by Quilt.
856 (See the
857 "<ulink url='&YOCTO_DOCS_DEV_URL;#using-a-quilt-workflow'>Using Quilt in Your Workflow</ulink>"
858 section in the Yocto Project Development Manual for more information.)
859 Within the <filename>linux-qemux86-standard-build</filename> directory,
860 standard Quilt directories <filename>linux-3.0/patches</filename>
861 and <filename>linux-3.0/.pc</filename> are created,
862 and standard Quilt commands can be used.
863 </para>
864
865 <para>
866 There are other directories generated within <filename>WORKDIR</filename>.
867 The most important directory is <filename>WORKDIR/temp/</filename>,
868 which has log files for each task (<filename>log.do_*.pid</filename>)
869 and contains the scripts BitBake runs for each task
870 (<filename>run.do_*.pid</filename>).
871 The <filename>WORKDIR/image/</filename> directory is where "make
872 install" places its output that is then split into sub-packages
873 within <filename>WORKDIR/packages-split/</filename>.
874 </para>
875 </section>
876
877 <section id='structure-build-work-shared'>
878 <title><filename>build/tmp/work-shared/</filename></title>
879
880 <para>
881 For efficiency, the OpenEmbedded build system creates and uses
882 this directory to hold recipes that share a work directory with
883 other recipes.
884 In practice, this is only used for <filename>gcc</filename>
885 and its variants (e.g. <filename>gcc-cross</filename>,
886 <filename>libgcc</filename>, <filename>gcc-runtime</filename>,
887 and so forth).
888 </para>
889 </section>
890</section>
891
892<section id='structure-meta'>
893 <title>The Metadata - <filename>meta/</filename></title>
894
895 <para>
896 As mentioned previously,
897 <ulink url='&YOCTO_DOCS_DEV_URL;#metadata'>Metadata</ulink> is the core
898 of the Yocto Project.
899 Metadata has several important subdivisions:
900 </para>
901
902 <section id='structure-meta-classes'>
903 <title><filename>meta/classes/</filename></title>
904
905 <para>
906 This directory contains the <filename>*.bbclass</filename> files.
907 Class files are used to abstract common code so it can be reused by multiple
908 packages.
909 Every package inherits the <filename>base.bbclass</filename> file.
910 Examples of other important classes are <filename>autotools.bbclass</filename>, which
911 in theory allows any Autotool-enabled package to work with the Yocto Project with minimal effort.
912 Another example is <filename>kernel.bbclass</filename> that contains common code and functions
913 for working with the Linux kernel.
914 Functions like image generation or packaging also have their specific class files
915 such as <filename>image.bbclass</filename>, <filename>rootfs_*.bbclass</filename> and
916 <filename>package*.bbclass</filename>.
917 </para>
918
919 <para>
920 For reference information on classes, see the
921 "<link linkend='ref-classes'>Classes</link>" chapter.
922 </para>
923 </section>
924
925 <section id='structure-meta-conf'>
926 <title><filename>meta/conf/</filename></title>
927
928 <para>
929 This directory contains the core set of configuration files that start from
930 <filename>bitbake.conf</filename> and from which all other configuration
931 files are included.
932 See the include statements at the end of the
933 <filename>bitbake.conf</filename> file and you will note that even
934 <filename>local.conf</filename> is loaded from there.
935 While <filename>bitbake.conf</filename> sets up the defaults, you can often override
936 these by using the (<filename>local.conf</filename>) file, machine file or
937 the distribution configuration file.
938 </para>
939 </section>
940
941 <section id='structure-meta-conf-machine'>
942 <title><filename>meta/conf/machine/</filename></title>
943
944 <para>
945 This directory contains all the machine configuration files.
946 If you set <filename>MACHINE = "qemux86"</filename>,
947 the OpenEmbedded build system looks for a <filename>qemux86.conf</filename> file in this
948 directory.
949 The <filename>include</filename> directory contains various data common to multiple machines.
950 If you want to add support for a new machine to the Yocto Project, look in this directory.
951 </para>
952 </section>
953
954 <section id='structure-meta-conf-distro'>
955 <title><filename>meta/conf/distro/</filename></title>
956
957 <para>
958 The contents of this directory controls any distribution-specific
959 configurations.
960 For the Yocto Project, the <filename>defaultsetup.conf</filename> is the main file here.
961 This directory includes the versions and the
962 <filename>SRCDATE</filename> definitions for applications that are configured here.
963 An example of an alternative configuration might be <filename>poky-bleeding.conf</filename>.
964 Although this file mainly inherits its configuration from Poky.
965 </para>
966 </section>
967
968 <section id='structure-meta-conf-machine-sdk'>
969 <title><filename>meta/conf/machine-sdk/</filename></title>
970
971 <para>
972 The OpenEmbedded build system searches this directory for
973 configuration files that correspond to the value of
974 <link linkend='var-SDKMACHINE'><filename>SDKMACHINE</filename></link>.
975 By default, 32-bit and 64-bit x86 files ship with the Yocto
976 Project that support some SDK hosts.
977 However, it is possible to extend that support to other SDK hosts
978 by adding additional configuration files in this subdirectory
979 within another layer.
980 </para>
981 </section>
982
983 <section id='structure-meta-files'>
984 <title><filename>meta/files/</filename></title>
985
986 <para>
987 This directory contains common license files and several text files
988 used by the build system.
989 The text files contain minimal device information and
990 lists of files and directories with known permissions.
991 </para>
992 </section>
993
994 <section id='structure-meta-lib'>
995 <title><filename>meta/lib/</filename></title>
996
997 <para>
998 This directory contains OpenEmbedded Python library code
999 used during the build process.
1000 </para>
1001 </section>
1002
1003 <section id='structure-meta-recipes-bsp'>
1004 <title><filename>meta/recipes-bsp/</filename></title>
1005
1006 <para>
1007 This directory contains anything linking to specific hardware or hardware
1008 configuration information such as "u-boot" and "grub".
1009 </para>
1010 </section>
1011
1012 <section id='structure-meta-recipes-connectivity'>
1013 <title><filename>meta/recipes-connectivity/</filename></title>
1014
1015 <para>
1016 This directory contains libraries and applications related to communication with other devices.
1017 </para>
1018 </section>
1019
1020 <section id='structure-meta-recipes-core'>
1021 <title><filename>meta/recipes-core/</filename></title>
1022
1023 <para>
1024 This directory contains what is needed to build a basic working Linux image
1025 including commonly used dependencies.
1026 </para>
1027 </section>
1028
1029 <section id='structure-meta-recipes-devtools'>
1030 <title><filename>meta/recipes-devtools/</filename></title>
1031
1032 <para>
1033 This directory contains tools that are primarily used by the build system.
1034 The tools, however, can also be used on targets.
1035 </para>
1036 </section>
1037
1038 <section id='structure-meta-recipes-extended'>
1039 <title><filename>meta/recipes-extended/</filename></title>
1040
1041 <para>
1042 This directory contains non-essential applications that add features compared to the
1043 alternatives in core.
1044 You might need this directory for full tool functionality or for Linux Standard Base (LSB)
1045 compliance.
1046 </para>
1047 </section>
1048
1049 <section id='structure-meta-recipes-gnome'>
1050 <title><filename>meta/recipes-gnome/</filename></title>
1051
1052 <para>
1053 This directory contains all things related to the GTK+ application framework.
1054 </para>
1055 </section>
1056
1057 <section id='structure-meta-recipes-graphics'>
1058 <title><filename>meta/recipes-graphics/</filename></title>
1059
1060 <para>
1061 This directory contains X and other graphically related system libraries
1062 </para>
1063 </section>
1064
1065 <section id='structure-meta-recipes-kernel'>
1066 <title><filename>meta/recipes-kernel/</filename></title>
1067
1068 <para>
1069 This directory contains the kernel and generic applications and libraries that
1070 have strong kernel dependencies.
1071 </para>
1072 </section>
1073
1074 <section id='structure-meta-recipes-lsb4'>
1075 <title><filename>meta/recipes-lsb4/</filename></title>
1076
1077 <para>
1078 This directory contains recipes specifically added to support
1079 the Linux Standard Base (LSB) version 4.x.
1080 </para>
1081 </section>
1082
1083 <section id='structure-meta-recipes-multimedia'>
1084 <title><filename>meta/recipes-multimedia/</filename></title>
1085
1086 <para>
1087 This directory contains codecs and support utilities for audio, images and video.
1088 </para>
1089 </section>
1090
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001091 <section id='structure-meta-recipes-rt'>
1092 <title><filename>meta/recipes-rt/</filename></title>
1093
1094 <para>
1095 This directory contains package and image recipes for using and testing
1096 the <filename>PREEMPT_RT</filename> kernel.
1097 </para>
1098 </section>
1099
1100 <section id='structure-meta-recipes-sato'>
1101 <title><filename>meta/recipes-sato/</filename></title>
1102
1103 <para>
1104 This directory contains the Sato demo/reference UI/UX and its associated applications
1105 and configuration data.
1106 </para>
1107 </section>
1108
1109 <section id='structure-meta-recipes-support'>
1110 <title><filename>meta/recipes-support/</filename></title>
1111
1112 <para>
1113 This directory contains recipes used by other recipes, but that are
1114 not directly included in images (i.e. dependencies of other
1115 recipes).
1116 </para>
1117 </section>
1118
1119 <section id='structure-meta-site'>
1120 <title><filename>meta/site/</filename></title>
1121
1122 <para>
1123 This directory contains a list of cached results for various architectures.
1124 Because certain "autoconf" test results cannot be determined when cross-compiling due to
1125 the tests not able to run on a live system, the information in this directory is
1126 passed to "autoconf" for the various architectures.
1127 </para>
1128 </section>
1129
1130 <section id='structure-meta-recipes-txt'>
1131 <title><filename>meta/recipes.txt</filename></title>
1132
1133 <para>
1134 This file is a description of the contents of <filename>recipes-*</filename>.
1135 </para>
1136 </section>
1137</section>
1138
1139</chapter>
1140<!--
1141vim: expandtab tw=80 ts=4
1142-->