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