blob: 84ff584badfe6d70219eb9d7eef6699a6bb23370 [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='closer-look'>
6<title>A Closer Look at the Yocto Project Development Environment</title>
7
8 <para>
9 This chapter takes a more detailed look at the Yocto Project
10 development environment.
11 The following diagram represents the development environment at a
12 high level.
13 The remainder of this chapter expands on the fundamental input, output,
14 process, and
15 <ulink url='&YOCTO_DOCS_DEV_URL;#metadata'>Metadata</ulink>) blocks
16 in the Yocto Project development environment.
17 </para>
18
19 <para id='general-yocto-environment-figure'>
20 <imagedata fileref="figures/yocto-environment-ref.png" align="center" width="8in" depth="4.25in" />
21 </para>
22
23 <para>
24 The generalized Yocto Project Development Environment consists of
25 several functional areas:
26 <itemizedlist>
27 <listitem><para><emphasis>User Configuration:</emphasis>
28 Metadata you can use to control the build process.
29 </para></listitem>
30 <listitem><para><emphasis>Metadata Layers:</emphasis>
31 Various layers that provide software, machine, and
32 distro Metadata.</para></listitem>
33 <listitem><para><emphasis>Source Files:</emphasis>
34 Upstream releases, local projects, and SCMs.</para></listitem>
35 <listitem><para><emphasis>Build System:</emphasis>
36 Processes under the control of
37 <ulink url='&YOCTO_DOCS_DEV_URL;#bitbake-term'>BitBake</ulink>.
38 This block expands on how BitBake fetches source, applies
39 patches, completes compilation, analyzes output for package
40 generation, creates and tests packages, generates images, and
41 generates cross-development tools.</para></listitem>
42 <listitem><para><emphasis>Package Feeds:</emphasis>
43 Directories containing output packages (RPM, DEB or IPK),
44 which are subsequently used in the construction of an image or
45 SDK, produced by the build system.
46 These feeds can also be copied and shared using a web server or
47 other means to facilitate extending or updating existing
48 images on devices at runtime if runtime package management is
49 enabled.</para></listitem>
50 <listitem><para><emphasis>Images:</emphasis>
51 Images produced by the development process.
52 </para></listitem>
53 <listitem><para><emphasis>Application Development SDK:</emphasis>
54 Cross-development tools that are produced along with an image
55 or separately with BitBake.</para></listitem>
56 </itemizedlist>
57 </para>
58
59 <section id="user-configuration">
60 <title>User Configuration</title>
61
62 <para>
63 User configuration helps define the build.
64 Through user configuration, you can tell BitBake the
65 target architecture for which you are building the image,
66 where to store downloaded source, and other build properties.
67 </para>
68
69 <para>
70 The following figure shows an expanded representation of the
71 "User Configuration" box of the
72 <link linkend='general-yocto-environment-figure'>general Yocto Project Development Environment figure</link>:
73 </para>
74
75 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050076 <imagedata fileref="figures/user-configuration.png" align="center" />
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077 </para>
78
79 <para>
80 BitBake needs some basic configuration files in order to complete
81 a build.
82 These files are <filename>*.conf</filename> files.
83 The minimally necessary ones reside as example files in the
84 <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>.
85 For simplicity, this section refers to the Source Directory as
86 the "Poky Directory."
87 </para>
88
89 <para>
90 When you clone the <filename>poky</filename> Git repository or you
91 download and unpack a Yocto Project release, you can set up the
92 Source Directory to be named anything you want.
93 For this discussion, the cloned repository uses the default
94 name <filename>poky</filename>.
95 <note>
96 The Poky repository is primarily an aggregation of existing
97 repositories.
98 It is not a canonical upstream source.
99 </note>
100 </para>
101
102 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500103 The <filename>meta-poky</filename> layer inside Poky contains
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104 a <filename>conf</filename> directory that has example
105 configuration files.
106 These example files are used as a basis for creating actual
107 configuration files when you source the build environment
108 script
109 (i.e.
110 <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>
111 or
112 <link linkend='structure-memres-core-script'><filename>oe-init-build-env-memres</filename></link>).
113 </para>
114
115 <para>
116 Sourcing the build environment script creates a
117 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>
118 if one does not already exist.
119 BitBake uses the Build Directory for all its work during builds.
120 The Build Directory has a <filename>conf</filename> directory that
121 contains default versions of your <filename>local.conf</filename>
122 and <filename>bblayers.conf</filename> configuration files.
123 These default configuration files are created only if versions
124 do not already exist in the Build Directory at the time you
125 source the build environment setup script.
126 </para>
127
128 <para>
129 Because the Poky repository is fundamentally an aggregation of
130 existing repositories, some users might be familiar with running
131 the <filename>&OE_INIT_FILE;</filename> or
132 <filename>oe-init-build-env-memres</filename> script in the context
133 of separate OpenEmbedded-Core and BitBake repositories rather than a
134 single Poky repository.
135 This discussion assumes the script is executed from within a cloned
136 or unpacked version of Poky.
137 </para>
138
139 <para>
140 Depending on where the script is sourced, different sub-scripts
141 are called to set up the Build Directory (Yocto or OpenEmbedded).
142 Specifically, the script
143 <filename>scripts/oe-setup-builddir</filename> inside the
144 poky directory sets up the Build Directory and seeds the directory
145 (if necessary) with configuration files appropriate for the
146 Yocto Project development environment.
147 <note>
148 The <filename>scripts/oe-setup-builddir</filename> script
149 uses the <filename>$TEMPLATECONF</filename> variable to
150 determine which sample configuration files to locate.
151 </note>
152 </para>
153
154 <para>
155 The <filename>local.conf</filename> file provides many
156 basic variables that define a build environment.
157 Here is a list of a few.
158 To see the default configurations in a <filename>local.conf</filename>
159 file created by the build environment script, see the
160 <filename>local.conf.sample</filename> in the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500161 <filename>meta-poky</filename> layer:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500162 <itemizedlist>
163 <listitem><para><emphasis>Parallelism Options:</emphasis>
164 Controlled by the
165 <link linkend='var-BB_NUMBER_THREADS'><filename>BB_NUMBER_THREADS</filename></link>,
166 <link linkend='var-PARALLEL_MAKE'><filename>PARALLEL_MAKE</filename></link>,
167 and
168 <ulink url='&YOCTO_DOCS_BB_URL;#var-BB_NUMBER_PARSE_THREADS'><filename>BB_NUMBER_PARSE_THREADS</filename></ulink>
169 variables.</para></listitem>
170 <listitem><para><emphasis>Target Machine Selection:</emphasis>
171 Controlled by the
172 <link linkend='var-MACHINE'><filename>MACHINE</filename></link>
173 variable.</para></listitem>
174 <listitem><para><emphasis>Download Directory:</emphasis>
175 Controlled by the
176 <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>
177 variable.</para></listitem>
178 <listitem><para><emphasis>Shared State Directory:</emphasis>
179 Controlled by the
180 <link linkend='var-SSTATE_DIR'><filename>SSTATE_DIR</filename></link>
181 variable.</para></listitem>
182 <listitem><para><emphasis>Build Output:</emphasis>
183 Controlled by the
184 <link linkend='var-TMPDIR'><filename>TMPDIR</filename></link>
185 variable.</para></listitem>
186 </itemizedlist>
187 <note>
188 Configurations set in the <filename>conf/local.conf</filename>
189 file can also be set in the
190 <filename>conf/site.conf</filename> and
191 <filename>conf/auto.conf</filename> configuration files.
192 </note>
193 </para>
194
195 <para>
196 The <filename>bblayers.conf</filename> file tells BitBake what
197 layers you want considered during the build.
198 By default, the layers listed in this file include layers
199 minimally needed by the build system.
200 However, you must manually add any custom layers you have created.
201 You can find more information on working with the
202 <filename>bblayers.conf</filename> file in the
203 "<ulink url='&YOCTO_DOCS_DEV_URL;#enabling-your-layer'>Enabling Your Layer</ulink>"
204 section in the Yocto Project Development Manual.
205 </para>
206
207 <para>
208 The files <filename>site.conf</filename> and
209 <filename>auto.conf</filename> are not created by the environment
210 initialization script.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500211 If you want the <filename>site.conf</filename> file, you need to
212 create that yourself.
213 The <filename>auto.conf</filename> file is typically created by
214 an autobuilder:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500215 <itemizedlist>
216 <listitem><para><emphasis><filename>site.conf</filename>:</emphasis>
217 You can use the <filename>conf/site.conf</filename>
218 configuration file to configure multiple build directories.
219 For example, suppose you had several build environments and
220 they shared some common features.
221 You can set these default build properties here.
222 A good example is perhaps the packaging format to use
223 through the
224 <link linkend='var-PACKAGE_CLASSES'><filename>PACKAGE_CLASSES</filename></link>
225 variable.</para>
226 <para>One useful scenario for using the
227 <filename>conf/site.conf</filename> file is to extend your
228 <link linkend='var-BBPATH'><filename>BBPATH</filename></link>
229 variable to include the path to a
230 <filename>conf/site.conf</filename>.
231 Then, when BitBake looks for Metadata using
232 <filename>BBPATH</filename>, it finds the
233 <filename>conf/site.conf</filename> file and applies your
234 common configurations found in the file.
235 To override configurations in a particular build directory,
236 alter the similar configurations within that build
237 directory's <filename>conf/local.conf</filename> file.
238 </para></listitem>
239 <listitem><para><emphasis><filename>auto.conf</filename>:</emphasis>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500240 The file is usually created and written to by
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500241 an autobuilder.
242 The settings put into the file are typically the same as
243 you would find in the <filename>conf/local.conf</filename>
244 or the <filename>conf/site.conf</filename> files.
245 </para></listitem>
246 </itemizedlist>
247 </para>
248
249 <para>
250 You can edit all configuration files to further define
251 any particular build environment.
252 This process is represented by the "User Configuration Edits"
253 box in the figure.
254 </para>
255
256 <para>
257 When you launch your build with the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500258 <filename>bitbake <replaceable>target</replaceable></filename>
259 command, BitBake sorts out the configurations to ultimately
260 define your build environment.
261 It is important to understand that the OpenEmbedded build system
262 reads the configuration files in a specific order:
263 <filename>site.conf</filename>, <filename>auto.conf</filename>,
264 and <filename>local.conf</filename>.
265 And, the build system applies the normal assignment statement
266 rules.
267 Because the files are parsed in a specific order, variable
268 assignments for the same variable could be affected.
269 For example, if the <filename>auto.conf</filename> file and
270 the <filename>local.conf</filename> set
271 <replaceable>variable1</replaceable> to different values, because
272 the build system parses <filename>local.conf</filename> after
273 <filename>auto.conf</filename>,
274 <replaceable>variable1</replaceable> is assigned the value from
275 the <filename>local.conf</filename> file.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500276 </para>
277 </section>
278
279 <section id="metadata-machine-configuration-and-policy-configuration">
280 <title>Metadata, Machine Configuration, and Policy Configuration</title>
281
282 <para>
283 The previous section described the user configurations that
284 define BitBake's global behavior.
285 This section takes a closer look at the layers the build system
286 uses to further control the build.
287 These layers provide Metadata for the software, machine, and
288 policy.
289 </para>
290
291 <para>
292 In general, three types of layer input exist:
293 <itemizedlist>
294 <listitem><para><emphasis>Policy Configuration:</emphasis>
295 Distribution Layers provide top-level or general
296 policies for the image or SDK being built.
297 For example, this layer would dictate whether BitBake
298 produces RPM or IPK packages.</para></listitem>
299 <listitem><para><emphasis>Machine Configuration:</emphasis>
300 Board Support Package (BSP) layers provide machine
301 configurations.
302 This type of information is specific to a particular
303 target architecture.</para></listitem>
304 <listitem><para><emphasis>Metadata:</emphasis>
305 Software layers contain user-supplied recipe files,
306 patches, and append files.
307 </para></listitem>
308 </itemizedlist>
309 </para>
310
311 <para>
312 The following figure shows an expanded representation of the
313 Metadata, Machine Configuration, and Policy Configuration input
314 (layers) boxes of the
315 <link linkend='general-yocto-environment-figure'>general Yocto Project Development Environment figure</link>:
316 </para>
317
318 <para>
319 <imagedata fileref="figures/layer-input.png" align="center" width="8in" depth="7.5in" />
320 </para>
321
322 <para>
323 In general, all layers have a similar structure.
324 They all contain a licensing file
325 (e.g. <filename>COPYING</filename>) if the layer is to be
326 distributed, a <filename>README</filename> file as good practice
327 and especially if the layer is to be distributed, a
328 configuration directory, and recipe directories.
329 </para>
330
331 <para>
332 The Yocto Project has many layers that can be used.
333 You can see a web-interface listing of them on the
334 <ulink url="http://git.yoctoproject.org/">Source Repositories</ulink>
335 page.
336 The layers are shown at the bottom categorized under
337 "Yocto Metadata Layers."
338 These layers are fundamentally a subset of the
339 <ulink url="http://layers.openembedded.org/layerindex/layers/">OpenEmbedded Metadata Index</ulink>,
340 which lists all layers provided by the OpenEmbedded community.
341 <note>
342 Layers exist in the Yocto Project Source Repositories that
343 cannot be found in the OpenEmbedded Metadata Index.
344 These layers are either deprecated or experimental in nature.
345 </note>
346 </para>
347
348 <para>
349 BitBake uses the <filename>conf/bblayers.conf</filename> file,
350 which is part of the user configuration, to find what layers it
351 should be using as part of the build.
352 </para>
353
354 <para>
355 For more information on layers, see the
356 "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers</ulink>"
357 section in the Yocto Project Development Manual.
358 </para>
359
360 <section id="distro-layer">
361 <title>Distro Layer</title>
362
363 <para>
364 The distribution layer provides policy configurations for your
365 distribution.
366 Best practices dictate that you isolate these types of
367 configurations into their own layer.
368 Settings you provide in
369 <filename>conf/distro/<replaceable>distro</replaceable>.conf</filename> override
370 similar
371 settings that BitBake finds in your
372 <filename>conf/local.conf</filename> file in the Build
373 Directory.
374 </para>
375
376 <para>
377 The following list provides some explanation and references
378 for what you typically find in the distribution layer:
379 <itemizedlist>
380 <listitem><para><emphasis>classes:</emphasis>
381 Class files (<filename>.bbclass</filename>) hold
382 common functionality that can be shared among
383 recipes in the distribution.
384 When your recipes inherit a class, they take on the
385 settings and functions for that class.
386 You can read more about class files in the
387 "<link linkend='ref-classes'>Classes</link>" section.
388 </para></listitem>
389 <listitem><para><emphasis>conf:</emphasis>
390 This area holds configuration files for the
391 layer (<filename>conf/layer.conf</filename>),
392 the distribution
393 (<filename>conf/distro/<replaceable>distro</replaceable>.conf</filename>),
394 and any distribution-wide include files.
395 </para></listitem>
396 <listitem><para><emphasis>recipes-*:</emphasis>
397 Recipes and append files that affect common
398 functionality across the distribution.
399 This area could include recipes and append files
400 to add distribution-specific configuration,
401 initialization scripts, custom image recipes,
402 and so forth.</para></listitem>
403 </itemizedlist>
404 </para>
405 </section>
406
407 <section id="bsp-layer">
408 <title>BSP Layer</title>
409
410 <para>
411 The BSP Layer provides machine configurations.
412 Everything in this layer is specific to the machine for which
413 you are building the image or the SDK.
414 A common structure or form is defined for BSP layers.
415 You can learn more about this structure in the
416 <ulink url='&YOCTO_DOCS_BSP_URL;'>Yocto Project Board Support Package (BSP) Developer's Guide</ulink>.
417 <note>
418 In order for a BSP layer to be considered compliant with the
419 Yocto Project, it must meet some structural requirements.
420 </note>
421 </para>
422
423 <para>
424 The BSP Layer's configuration directory contains
425 configuration files for the machine
426 (<filename>conf/machine/<replaceable>machine</replaceable>.conf</filename>) and,
427 of course, the layer (<filename>conf/layer.conf</filename>).
428 </para>
429
430 <para>
431 The remainder of the layer is dedicated to specific recipes
432 by function: <filename>recipes-bsp</filename>,
433 <filename>recipes-core</filename>,
434 <filename>recipes-graphics</filename>, and
435 <filename>recipes-kernel</filename>.
436 Metadata can exist for multiple formfactors, graphics
437 support systems, and so forth.
438 <note>
439 While the figure shows several <filename>recipes-*</filename>
440 directories, not all these directories appear in all
441 BSP layers.
442 </note>
443 </para>
444 </section>
445
446 <section id="software-layer">
447 <title>Software Layer</title>
448
449 <para>
450 The software layer provides the Metadata for additional
451 software packages used during the build.
452 This layer does not include Metadata that is specific to the
453 distribution or the machine, which are found in their
454 respective layers.
455 </para>
456
457 <para>
458 This layer contains any new recipes that your project needs
459 in the form of recipe files.
460 </para>
461 </section>
462 </section>
463
464 <section id="sources-dev-environment">
465 <title>Sources</title>
466
467 <para>
468 In order for the OpenEmbedded build system to create an image or
469 any target, it must be able to access source files.
470 The
471 <link linkend='general-yocto-environment-figure'>general Yocto Project Development Environment figure</link>
472 represents source files using the "Upstream Project Releases",
473 "Local Projects", and "SCMs (optional)" boxes.
474 The figure represents mirrors, which also play a role in locating
475 source files, with the "Source Mirror(s)" box.
476 </para>
477
478 <para>
479 The method by which source files are ultimately organized is
480 a function of the project.
481 For example, for released software, projects tend to use tarballs
482 or other archived files that can capture the state of a release
483 guaranteeing that it is statically represented.
484 On the other hand, for a project that is more dynamic or
485 experimental in nature, a project might keep source files in a
486 repository controlled by a Source Control Manager (SCM) such as
487 Git.
488 Pulling source from a repository allows you to control
489 the point in the repository (the revision) from which you want to
490 build software.
491 Finally, a combination of the two might exist, which would give the
492 consumer a choice when deciding where to get source files.
493 </para>
494
495 <para>
496 BitBake uses the
497 <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
498 variable to point to source files regardless of their location.
499 Each recipe must have a <filename>SRC_URI</filename> variable
500 that points to the source.
501 </para>
502
503 <para>
504 Another area that plays a significant role in where source files
505 come from is pointed to by the
506 <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>
507 variable.
508 This area is a cache that can hold previously downloaded source.
509 You can also instruct the OpenEmbedded build system to create
510 tarballs from Git repositories, which is not the default behavior,
511 and store them in the <filename>DL_DIR</filename> by using the
512 <link linkend='var-BB_GENERATE_MIRROR_TARBALLS'><filename>BB_GENERATE_MIRROR_TARBALLS</filename></link>
513 variable.
514 </para>
515
516 <para>
517 Judicious use of a <filename>DL_DIR</filename> directory can
518 save the build system a trip across the Internet when looking
519 for files.
520 A good method for using a download directory is to have
521 <filename>DL_DIR</filename> point to an area outside of your
522 Build Directory.
523 Doing so allows you to safely delete the Build Directory
524 if needed without fear of removing any downloaded source file.
525 </para>
526
527 <para>
528 The remainder of this section provides a deeper look into the
529 source files and the mirrors.
530 Here is a more detailed look at the source file area of the
531 base figure:
532 <imagedata fileref="figures/source-input.png" align="center" width="7in" depth="7.5in" />
533 </para>
534
535 <section id='upstream-project-releases'>
536 <title>Upstream Project Releases</title>
537
538 <para>
539 Upstream project releases exist anywhere in the form of an
540 archived file (e.g. tarball or zip file).
541 These files correspond to individual recipes.
542 For example, the figure uses specific releases each for
543 BusyBox, Qt, and Dbus.
544 An archive file can be for any released product that can be
545 built using a recipe.
546 </para>
547 </section>
548
549 <section id='local-projects'>
550 <title>Local Projects</title>
551
552 <para>
553 Local projects are custom bits of software the user provides.
554 These bits reside somewhere local to a project - perhaps
555 a directory into which the user checks in items (e.g.
556 a local directory containing a development source tree
557 used by the group).
558 </para>
559
560 <para>
561 The canonical method through which to include a local project
562 is to use the
563 <link linkend='ref-classes-externalsrc'><filename>externalsrc</filename></link>
564 class to include that local project.
565 You use either the <filename>local.conf</filename> or a
566 recipe's append file to override or set the
567 recipe to point to the local directory on your disk to pull
568 in the whole source tree.
569 </para>
570
571 <para>
572 For information on how to use the
573 <filename>externalsrc</filename> class, see the
574 "<link linkend='ref-classes-externalsrc'><filename>externalsrc.bbclass</filename></link>"
575 section.
576 </para>
577 </section>
578
579 <section id='scms'>
580 <title>Source Control Managers (Optional)</title>
581
582 <para>
583 Another place the build system can get source files from is
584 through an SCM such as Git or Subversion.
585 In this case, a repository is cloned or checked out.
586 The
587 <link linkend='ref-tasks-fetch'><filename>do_fetch</filename></link>
588 task inside BitBake uses
589 the <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
590 variable and the argument's prefix to determine the correct
591 fetcher module.
592 </para>
593
594 <note>
595 For information on how to have the OpenEmbedded build system
596 generate tarballs for Git repositories and place them in the
597 <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>
598 directory, see the
599 <link linkend='var-BB_GENERATE_MIRROR_TARBALLS'><filename>BB_GENERATE_MIRROR_TARBALLS</filename></link>
600 variable.
601 </note>
602
603 <para>
604 When fetching a repository, BitBake uses the
605 <link linkend='var-SRCREV'><filename>SRCREV</filename></link>
606 variable to determine the specific revision from which to
607 build.
608 </para>
609 </section>
610
611 <section id='source-mirrors'>
612 <title>Source Mirror(s)</title>
613
614 <para>
615 Two kinds of mirrors exist: pre-mirrors and regular mirrors.
616 The <link linkend='var-PREMIRRORS'><filename>PREMIRRORS</filename></link>
617 and
618 <link linkend='var-MIRRORS'><filename>MIRRORS</filename></link>
619 variables point to these, respectively.
620 BitBake checks pre-mirrors before looking upstream for any
621 source files.
622 Pre-mirrors are appropriate when you have a shared directory
623 that is not a directory defined by the
624 <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>
625 variable.
626 A Pre-mirror typically points to a shared directory that is
627 local to your organization.
628 </para>
629
630 <para>
631 Regular mirrors can be any site across the Internet that is
632 used as an alternative location for source code should the
633 primary site not be functioning for some reason or another.
634 </para>
635 </section>
636 </section>
637
638 <section id="package-feeds-dev-environment">
639 <title>Package Feeds</title>
640
641 <para>
642 When the OpenEmbedded build system generates an image or an SDK,
643 it gets the packages from a package feed area located in the
644 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>.
645 The
646 <link linkend='general-yocto-environment-figure'>general Yocto Project Development Environment figure</link>
647 shows this package feeds area in the upper-right corner.
648 </para>
649
650 <para>
651 This section looks a little closer into the package feeds area used
652 by the build system.
653 Here is a more detailed look at the area:
654 <imagedata fileref="figures/package-feeds.png" align="center" width="7in" depth="6in" />
655 </para>
656
657 <para>
658 Package feeds are an intermediary step in the build process.
659 The OpenEmbedded build system provides classes to generate
660 different package types, and you specify which classes to enable
661 through the
662 <link linkend='var-PACKAGE_CLASSES'><filename>PACKAGE_CLASSES</filename></link>
663 variable.
664 Before placing the packages into package feeds,
665 the build process validates them with generated output quality
666 assurance checks through the
667 <link linkend='ref-classes-insane'><filename>insane</filename></link>
668 class.
669 </para>
670
671 <para>
672 The package feed area resides in the Build Directory.
673 The directory the build system uses to temporarily store packages
674 is determined by a combination of variables and the particular
675 package manager in use.
676 See the "Package Feeds" box in the illustration and note the
677 information to the right of that area.
678 In particular, the following defines where package files are
679 kept:
680 <itemizedlist>
681 <listitem><para><link linkend='var-DEPLOY_DIR'><filename>DEPLOY_DIR</filename></link>:
682 Defined as <filename>tmp/deploy</filename> in the Build
683 Directory.
684 </para></listitem>
685 <listitem><para><filename>DEPLOY_DIR_*</filename>:
686 Depending on the package manager used, the package type
687 sub-folder.
688 Given RPM, IPK, or DEB packaging and tarball creation, the
689 <link linkend='var-DEPLOY_DIR_RPM'><filename>DEPLOY_DIR_RPM</filename></link>,
690 <link linkend='var-DEPLOY_DIR_IPK'><filename>DEPLOY_DIR_IPK</filename></link>,
691 <link linkend='var-DEPLOY_DIR_DEB'><filename>DEPLOY_DIR_DEB</filename></link>,
692 or
693 <link linkend='var-DEPLOY_DIR_TAR'><filename>DEPLOY_DIR_TAR</filename></link>,
694 variables are used, respectively.
695 </para></listitem>
696 <listitem><para><link linkend='var-PACKAGE_ARCH'><filename>PACKAGE_ARCH</filename></link>:
697 Defines architecture-specific sub-folders.
698 For example, packages could exist for the i586 or qemux86
699 architectures.
700 </para></listitem>
701 </itemizedlist>
702 </para>
703
704 <para>
705 BitBake uses the <filename>do_package_write_*</filename> tasks to
706 generate packages and place them into the package holding area (e.g.
707 <filename>do_package_write_ipk</filename> for IPK packages).
708 See the
709 "<link linkend='ref-tasks-package_write_deb'><filename>do_package_write_deb</filename></link>",
710 "<link linkend='ref-tasks-package_write_ipk'><filename>do_package_write_ipk</filename></link>",
711 "<link linkend='ref-tasks-package_write_rpm'><filename>do_package_write_rpm</filename></link>",
712 and
713 "<link linkend='ref-tasks-package_write_tar'><filename>do_package_write_tar</filename></link>"
714 sections for additional information.
715 As an example, consider a scenario where an IPK packaging manager
716 is being used and package architecture support for both i586
717 and qemux86 exist.
718 Packages for the i586 architecture are placed in
719 <filename>build/tmp/deploy/ipk/i586</filename>, while packages for
720 the qemux86 architecture are placed in
721 <filename>build/tmp/deploy/ipk/qemux86</filename>.
722 </para>
723 </section>
724
725 <section id='bitbake-dev-environment'>
726 <title>BitBake</title>
727
728 <para>
729 The OpenEmbedded build system uses
730 <ulink url='&YOCTO_DOCS_DEV_URL;#bitbake-term'>BitBake</ulink>
731 to produce images.
732 You can see from the
733 <link linkend='general-yocto-environment-figure'>general Yocto Project Development Environment figure</link>,
734 the BitBake area consists of several functional areas.
735 This section takes a closer look at each of those areas.
736 </para>
737
738 <para>
739 Separate documentation exists for the BitBake tool.
740 See the
741 <ulink url='&YOCTO_DOCS_BB_URL;#bitbake-user-manual'>BitBake User Manual</ulink>
742 for reference material on BitBake.
743 </para>
744
745 <section id='source-fetching-dev-environment'>
746 <title>Source Fetching</title>
747
748 <para>
749 The first stages of building a recipe are to fetch and unpack
750 the source code:
751 <imagedata fileref="figures/source-fetching.png" align="center" width="6.5in" depth="5in" />
752 </para>
753
754 <para>
755 The
756 <link linkend='ref-tasks-fetch'><filename>do_fetch</filename></link>
757 and
758 <link linkend='ref-tasks-unpack'><filename>do_unpack</filename></link>
759 tasks fetch the source files and unpack them into the work
760 directory.
761 <note>
762 For every local file (e.g. <filename>file://</filename>)
763 that is part of a recipe's
764 <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
765 statement, the OpenEmbedded build system takes a checksum
766 of the file for the recipe and inserts the checksum into
767 the signature for the <filename>do_fetch</filename>.
768 If any local file has been modified, the
769 <filename>do_fetch</filename> task and all tasks that
770 depend on it are re-executed.
771 </note>
772 By default, everything is accomplished in the
773 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>,
774 which has a defined structure.
775 For additional general information on the Build Directory,
776 see the
777 "<link linkend='structure-core-build'><filename>build/</filename></link>"
778 section.
779 </para>
780
781 <para>
782 Unpacked source files are pointed to by the
783 <link linkend='var-S'><filename>S</filename></link> variable.
784 Each recipe has an area in the Build Directory where the
785 unpacked source code resides.
786 The name of that directory for any given recipe is defined from
787 several different variables.
788 You can see the variables that define these directories
789 by looking at the figure:
790 <itemizedlist>
791 <listitem><para><link linkend='var-TMPDIR'><filename>TMPDIR</filename></link> -
792 The base directory where the OpenEmbedded build system
793 performs all its work during the build.
794 </para></listitem>
795 <listitem><para><link linkend='var-PACKAGE_ARCH'><filename>PACKAGE_ARCH</filename></link> -
796 The architecture of the built package or packages.
797 </para></listitem>
798 <listitem><para><link linkend='var-TARGET_OS'><filename>TARGET_OS</filename></link> -
799 The operating system of the target device.
800 </para></listitem>
801 <listitem><para><link linkend='var-PN'><filename>PN</filename></link> -
802 The name of the built package.
803 </para></listitem>
804 <listitem><para><link linkend='var-PV'><filename>PV</filename></link> -
805 The version of the recipe used to build the package.
806 </para></listitem>
807 <listitem><para><link linkend='var-PR'><filename>PR</filename></link> -
808 The revision of the recipe used to build the package.
809 </para></listitem>
810 <listitem><para><link linkend='var-WORKDIR'><filename>WORKDIR</filename></link> -
811 The location within <filename>TMPDIR</filename> where
812 a specific package is built.
813 </para></listitem>
814 <listitem><para><link linkend='var-S'><filename>S</filename></link> -
815 Contains the unpacked source files for a given recipe.
816 </para></listitem>
817 </itemizedlist>
818 </para>
819 </section>
820
821 <section id='patching-dev-environment'>
822 <title>Patching</title>
823
824 <para>
825 Once source code is fetched and unpacked, BitBake locates
826 patch files and applies them to the source files:
827 <imagedata fileref="figures/patching.png" align="center" width="6in" depth="5in" />
828 </para>
829
830 <para>
831 The
832 <link linkend='ref-tasks-patch'><filename>do_patch</filename></link>
833 task processes recipes by
834 using the
835 <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
836 variable to locate applicable patch files, which by default
837 are <filename>*.patch</filename> or
838 <filename>*.diff</filename> files, or any file if
839 "apply=yes" is specified for the file in
840 <filename>SRC_URI</filename>.
841 </para>
842
843 <para>
844 BitBake finds and applies multiple patches for a single recipe
845 in the order in which it finds the patches.
846 Patches are applied to the recipe's source files located in the
847 <link linkend='var-S'><filename>S</filename></link> directory.
848 </para>
849
850 <para>
851 For more information on how the source directories are
852 created, see the
853 "<link linkend='source-fetching-dev-environment'>Source Fetching</link>"
854 section.
855 </para>
856 </section>
857
858 <section id='configuration-and-compilation-dev-environment'>
859 <title>Configuration and Compilation</title>
860
861 <para>
862 After source code is patched, BitBake executes tasks that
863 configure and compile the source code:
864 <imagedata fileref="figures/configuration-compile-autoreconf.png" align="center" width="7in" depth="5in" />
865 </para>
866
867 <para>
868 This step in the build process consists of three tasks:
869 <itemizedlist>
870 <listitem><para><emphasis><filename>do_configure</filename>:</emphasis>
871 This task configures the source by enabling and
872 disabling any build-time and configuration options for
873 the software being built.
874 Configurations can come from the recipe itself as well
875 as from an inherited class.
876 Additionally, the software itself might configure itself
877 depending on the target for which it is being built.
878 </para>
879
880 <para>The configurations handled by the
881 <link linkend='ref-tasks-configure'><filename>do_configure</filename></link>
882 task are specific
883 to source code configuration for the source code
884 being built by the recipe.</para>
885
886 <para>If you are using the
887 <link linkend='ref-classes-autotools'><filename>autotools</filename></link>
888 class,
889 you can add additional configuration options by using
890 the <link linkend='var-EXTRA_OECONF'><filename>EXTRA_OECONF</filename></link>
891 variable.
892 For information on how this variable works within
893 that class, see the
894 <filename>meta/classes/autotools.bbclass</filename> file.
895 </para></listitem>
896 <listitem><para><emphasis><filename>do_compile</filename>:</emphasis>
897 Once a configuration task has been satisfied, BitBake
898 compiles the source using the
899 <link linkend='ref-tasks-compile'><filename>do_compile</filename></link>
900 task.
901 Compilation occurs in the directory pointed to by the
902 <link linkend='var-B'><filename>B</filename></link>
903 variable.
904 Realize that the <filename>B</filename> directory is, by
905 default, the same as the
906 <link linkend='var-S'><filename>S</filename></link>
907 directory.</para></listitem>
908 <listitem><para><emphasis><filename>do_install</filename>:</emphasis>
909 Once compilation is done, BitBake executes the
910 <link linkend='ref-tasks-install'><filename>do_install</filename></link>
911 task.
912 This task copies files from the <filename>B</filename>
913 directory and places them in a holding area pointed to
914 by the
915 <link linkend='var-D'><filename>D</filename></link>
916 variable.</para></listitem>
917 </itemizedlist>
918 </para>
919 </section>
920
921 <section id='package-splitting-dev-environment'>
922 <title>Package Splitting</title>
923
924 <para>
925 After source code is configured and compiled, the
926 OpenEmbedded build system analyzes
927 the results and splits the output into packages:
928 <imagedata fileref="figures/analysis-for-package-splitting.png" align="center" width="7in" depth="7in" />
929 </para>
930
931 <para>
932 The
933 <link linkend='ref-tasks-package'><filename>do_package</filename></link>
934 and
935 <link linkend='ref-tasks-packagedata'><filename>do_packagedata</filename></link>
936 tasks combine to analyze
937 the files found in the
938 <link linkend='var-D'><filename>D</filename></link> directory
939 and split them into subsets based on available packages and
940 files.
941 The analyzing process involves the following as well as other
942 items: splitting out debugging symbols,
943 looking at shared library dependencies between packages,
944 and looking at package relationships.
945 The <filename>do_packagedata</filename> task creates package
946 metadata based on the analysis such that the
947 OpenEmbedded build system can generate the final packages.
948 Working, staged, and intermediate results of the analysis
949 and package splitting process use these areas:
950 <itemizedlist>
951 <listitem><para><link linkend='var-PKGD'><filename>PKGD</filename></link> -
952 The destination directory for packages before they are
953 split.
954 </para></listitem>
955 <listitem><para><link linkend='var-PKGDATA_DIR'><filename>PKGDATA_DIR</filename></link> -
956 A shared, global-state directory that holds data
957 generated during the packaging process.
958 </para></listitem>
959 <listitem><para><link linkend='var-PKGDESTWORK'><filename>PKGDESTWORK</filename></link> -
960 A temporary work area used by the
961 <filename>do_package</filename> task.
962 </para></listitem>
963 <listitem><para><link linkend='var-PKGDEST'><filename>PKGDEST</filename></link> -
964 The parent directory for packages after they have
965 been split.
966 </para></listitem>
967 </itemizedlist>
968 The <link linkend='var-FILES'><filename>FILES</filename></link>
969 variable defines the files that go into each package in
970 <link linkend='var-PACKAGES'><filename>PACKAGES</filename></link>.
971 If you want details on how this is accomplished, you can
972 look at the
973 <link linkend='ref-classes-package'><filename>package</filename></link>
974 class.
975 </para>
976
977 <para>
978 Depending on the type of packages being created (RPM, DEB, or
979 IPK), the <filename>do_package_write_*</filename> task
980 creates the actual packages and places them in the
981 Package Feed area, which is
982 <filename>${TMPDIR}/deploy</filename>.
983 You can see the
984 "<link linkend='package-feeds-dev-environment'>Package Feeds</link>"
985 section for more detail on that part of the build process.
986 <note>
987 Support for creating feeds directly from the
988 <filename>deploy/*</filename> directories does not exist.
989 Creating such feeds usually requires some kind of feed
990 maintenance mechanism that would upload the new packages
991 into an official package feed (e.g. the
992 Ångström distribution).
993 This functionality is highly distribution-specific
994 and thus is not provided out of the box.
995 </note>
996 </para>
997 </section>
998
999 <section id='image-generation-dev-environment'>
1000 <title>Image Generation</title>
1001
1002 <para>
1003 Once packages are split and stored in the Package Feeds area,
1004 the OpenEmbedded build system uses BitBake to generate the
1005 root filesystem image:
1006 <imagedata fileref="figures/image-generation.png" align="center" width="6in" depth="7in" />
1007 </para>
1008
1009 <para>
1010 The image generation process consists of several stages and
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001011 depends on several tasks and variables.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001012 The
1013 <link linkend='ref-tasks-rootfs'><filename>do_rootfs</filename></link>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001014 task creates the root filesystem (file and directory structure)
1015 for an image.
1016 This task uses several key variables to help create the list
1017 of packages to actually install:
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001018 <itemizedlist>
1019 <listitem><para><link linkend='var-IMAGE_INSTALL'><filename>IMAGE_INSTALL</filename></link>:
1020 Lists out the base set of packages to install from
1021 the Package Feeds area.</para></listitem>
1022 <listitem><para><link linkend='var-PACKAGE_EXCLUDE'><filename>PACKAGE_EXCLUDE</filename></link>:
1023 Specifies packages that should not be installed.
1024 </para></listitem>
1025 <listitem><para><link linkend='var-IMAGE_FEATURES'><filename>IMAGE_FEATURES</filename></link>:
1026 Specifies features to include in the image.
1027 Most of these features map to additional packages for
1028 installation.</para></listitem>
1029 <listitem><para><link linkend='var-PACKAGE_CLASSES'><filename>PACKAGE_CLASSES</filename></link>:
1030 Specifies the package backend to use and consequently
1031 helps determine where to locate packages within the
1032 Package Feeds area.</para></listitem>
1033 <listitem><para><link linkend='var-IMAGE_LINGUAS'><filename>IMAGE_LINGUAS</filename></link>:
1034 Determines the language(s) for which additional
1035 language support packages are installed.
1036 </para></listitem>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001037 <listitem><para><link linkend='var-PACKAGE_INSTALL'><filename>PACKAGE_INSTALL</filename></link>:
1038 The final list of packages passed to the package manager
1039 for installation into the image.
1040 </para></listitem>
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001041 </itemizedlist>
1042 </para>
1043
1044 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001045 With
1046 <link linkend='var-IMAGE_ROOTFS'><filename>IMAGE_ROOTFS</filename></link>
1047 pointing to the location of the filesystem under construction and
1048 the <filename>PACKAGE_INSTALL</filename> variable providing the
1049 final list of packages to install, the root file system is
1050 created.
1051 </para>
1052
1053 <para>
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001054 Package installation is under control of the package manager
1055 (e.g. smart/rpm, opkg, or apt/dpkg) regardless of whether or
1056 not package management is enabled for the target.
1057 At the end of the process, if package management is not
1058 enabled for the target, the package manager's data files
1059 are deleted from the root filesystem.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001060 As part of the final stage of package installation, postinstall
1061 scripts that are part of the packages are run.
1062 Any scripts that fail to run
1063 on the build host are run on the target when the target system
1064 is first booted.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001065 If you are using a
1066 <ulink url='&YOCTO_DOCS_DEV_URL;#creating-a-read-only-root-filesystem'>read-only root filesystem</ulink>,
1067 all the post installation scripts must succeed during the
1068 package installation phase since the root filesystem is
1069 read-only.
1070 </para>
1071
1072 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001073 The final stages of the <filename>do_rootfs</filename> task
1074 handle post processing.
1075 Post processing includes creation of a manifest file and
1076 optimizations.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001077 </para>
1078
1079 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001080 The manifest file (<filename>.manifest</filename>) resides
1081 in the same directory as the root filesystem image.
1082 This file lists out, line-by-line, the installed packages.
1083 The manifest file is useful for the
Patrick Williamsf1e5d692016-03-30 15:21:19 -05001084 <link linkend='ref-classes-testimage*'><filename>testimage</filename></link>
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001085 class, for example, to determine whether or not to run
1086 specific tests.
1087 See the
1088 <link linkend='var-IMAGE_MANIFEST'><filename>IMAGE_MANIFEST</filename></link>
1089 variable for additional information.
1090 </para>
1091
1092 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001093 Optimizing processes run across the image include
1094 <filename>mklibs</filename>, <filename>prelink</filename>,
1095 and any other post-processing commands as defined by the
1096 <link linkend='var-ROOTFS_POSTPROCESS_COMMAND'><filename>ROOTFS_POSTPROCESS_COMMAND</filename></link>
1097 variable.
1098 The <filename>mklibs</filename> process optimizes the size
1099 of the libraries, while the
1100 <filename>prelink</filename> process optimizes the dynamic
1101 linking of shared libraries to reduce start up time of
1102 executables.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001103 </para>
1104
1105 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001106 After the root filesystem is built, processing begins on
1107 the image through the <filename>do_image</filename> task.
1108 The build system runs any pre-processing commands as defined
1109 by the
1110 <link linkend='var-IMAGE_PREPROCESS_COMMAND'><filename>IMAGE_PREPROCESS_COMMAND</filename></link>
1111 variable.
1112 This variable specifies a list of functions to call before
1113 the OpenEmbedded build system creates the final image output
1114 files.
1115 </para>
1116
1117 <para>
1118 The <filename>do_image</filename> task dynamically creates
1119 other <filename>do_image_*</filename> tasks as needed, which
1120 include compressing the root filesystem image to reduce the
1121 overall size of the image.
1122 The process turns everything into an image file or a set of
1123 image files.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001124 The formats used for the root filesystem depend on the
1125 <link linkend='var-IMAGE_FSTYPES'><filename>IMAGE_FSTYPES</filename></link>
1126 variable.
1127 </para>
1128
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001129 <para>
1130 The final task involved in image creation is the
1131 <filename>do_image_complete</filename> task.
1132 This task completes the image by applying any image
1133 post processing as defined through the
1134 <link linkend='var-IMAGE_POSTPROCESS_COMMAND'><filename>IMAGE_POSTPROCESS_COMMAND</filename></link>
1135 variable.
1136 The variable specifies a list of functions to call once the
1137 OpenEmbedded build system has created the final image output
1138 files.
1139 </para>
1140
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001141 <note>
1142 The entire image generation process is run under Pseudo.
1143 Running under Pseudo ensures that the files in the root
1144 filesystem have correct ownership.
1145 </note>
1146 </section>
1147
1148 <section id='sdk-generation-dev-environment'>
1149 <title>SDK Generation</title>
1150
1151 <para>
1152 The OpenEmbedded build system uses BitBake to generate the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001153 Software Development Kit (SDK) installer script for both the
1154 standard and extensible SDKs:
1155 <imagedata fileref="figures/sdk-generation.png" align="center" />
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001156 </para>
1157
1158 <note>
1159 For more information on the cross-development toolchain
1160 generation, see the
1161 "<link linkend='cross-development-toolchain-generation'>Cross-Development Toolchain Generation</link>"
1162 section.
1163 For information on advantages gained when building a
1164 cross-development toolchain using the
1165 <link linkend='ref-tasks-populate_sdk'><filename>do_populate_sdk</filename></link>
1166 task, see the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001167 "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-building-an-sdk-installer'>Building an SDK Installer</ulink>"
1168 section in the Yocto Project Software Development Kit (SDK)
1169 Developer's Guide.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001170 </note>
1171
1172 <para>
1173 Like image generation, the SDK script process consists of
1174 several stages and depends on many variables.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001175 The <filename>do_populate_sdk</filename> and
1176 <filename>do_populate_sdk_ext</filename> tasks use these
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001177 key variables to help create the list of packages to actually
1178 install.
1179 For information on the variables listed in the figure, see the
1180 "<link linkend='sdk-dev-environment'>Application Development SDK</link>"
1181 section.
1182 </para>
1183
1184 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001185 The <filename>do_populate_sdk</filename> task helps create
1186 the standard SDK and handles two parts: a target part and a
1187 host part.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001188 The target part is the part built for the target hardware and
1189 includes libraries and headers.
1190 The host part is the part of the SDK that runs on the
1191 <link linkend='var-SDKMACHINE'><filename>SDKMACHINE</filename></link>.
1192 </para>
1193
1194 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001195 The <filename>do_populate_sdk_ext</filename> task helps create
1196 the extensible SDK and handles host and target parts
1197 differently than its counter part does for the standard SDK.
1198 For the extensible SDK, the task encapsulates the build system,
1199 which includes everything needed (host and target) for the SDK.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001200 </para>
1201
1202 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001203 Regardless of the type of SDK being constructed, the
1204 tasks perform some cleanup after which a cross-development
1205 environment setup script and any needed configuration files
1206 are created.
1207 The final output is the Cross-development
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001208 toolchain installation script (<filename>.sh</filename> file),
1209 which includes the environment setup script.
1210 </para>
1211 </section>
1212 </section>
1213
1214 <section id='images-dev-environment'>
1215 <title>Images</title>
1216
1217 <para>
1218 The images produced by the OpenEmbedded build system
1219 are compressed forms of the
1220 root filesystem that are ready to boot on a target device.
1221 You can see from the
1222 <link linkend='general-yocto-environment-figure'>general Yocto Project Development Environment figure</link>
1223 that BitBake output, in part, consists of images.
1224 This section is going to look more closely at this output:
1225 <imagedata fileref="figures/images.png" align="center" width="5.5in" depth="5.5in" />
1226 </para>
1227
1228 <para>
1229 For a list of example images that the Yocto Project provides,
1230 see the
1231 "<link linkend='ref-images'>Images</link>" chapter.
1232 </para>
1233
1234 <para>
1235 Images are written out to the
1236 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>
1237 inside the <filename>tmp/deploy/images/<replaceable>machine</replaceable>/</filename>
1238 folder as shown in the figure.
1239 This folder contains any files expected to be loaded on the
1240 target device.
1241 The
1242 <link linkend='var-DEPLOY_DIR'><filename>DEPLOY_DIR</filename></link>
1243 variable points to the <filename>deploy</filename> directory,
1244 while the
1245 <link linkend='var-DEPLOY_DIR_IMAGE'><filename>DEPLOY_DIR_IMAGE</filename></link>
1246 variable points to the appropriate directory containing images for
1247 the current configuration.
1248 <itemizedlist>
1249 <listitem><para><filename><replaceable>kernel-image</replaceable></filename>:
1250 A kernel binary file.
1251 The <link linkend='var-KERNEL_IMAGETYPE'><filename>KERNEL_IMAGETYPE</filename></link>
1252 variable setting determines the naming scheme for the
1253 kernel image file.
1254 Depending on that variable, the file could begin with
1255 a variety of naming strings.
1256 The <filename>deploy/images/<replaceable>machine</replaceable></filename>
1257 directory can contain multiple image files for the
1258 machine.</para></listitem>
1259 <listitem><para><filename><replaceable>root-filesystem-image</replaceable></filename>:
1260 Root filesystems for the target device (e.g.
1261 <filename>*.ext3</filename> or <filename>*.bz2</filename>
1262 files).
1263 The <link linkend='var-IMAGE_FSTYPES'><filename>IMAGE_FSTYPES</filename></link>
1264 variable setting determines the root filesystem image
1265 type.
1266 The <filename>deploy/images/<replaceable>machine</replaceable></filename>
1267 directory can contain multiple root filesystems for the
1268 machine.</para></listitem>
1269 <listitem><para><filename><replaceable>kernel-modules</replaceable></filename>:
1270 Tarballs that contain all the modules built for the kernel.
1271 Kernel module tarballs exist for legacy purposes and
1272 can be suppressed by setting the
1273 <link linkend='var-MODULE_TARBALL_DEPLOY'><filename>MODULE_TARBALL_DEPLOY</filename></link>
1274 variable to "0".
1275 The <filename>deploy/images/<replaceable>machine</replaceable></filename>
1276 directory can contain multiple kernel module tarballs
1277 for the machine.</para></listitem>
1278 <listitem><para><filename><replaceable>bootloaders</replaceable></filename>:
1279 Bootloaders supporting the image, if applicable to the
1280 target machine.
1281 The <filename>deploy/images/<replaceable>machine</replaceable></filename>
1282 directory can contain multiple bootloaders for the
1283 machine.</para></listitem>
1284 <listitem><para><filename><replaceable>symlinks</replaceable></filename>:
1285 The <filename>deploy/images/<replaceable>machine</replaceable></filename>
1286 folder contains
1287 a symbolic link that points to the most recently built file
1288 for each machine.
1289 These links might be useful for external scripts that
1290 need to obtain the latest version of each file.
1291 </para></listitem>
1292 </itemizedlist>
1293 </para>
1294 </section>
1295
1296 <section id='sdk-dev-environment'>
1297 <title>Application Development SDK</title>
1298
1299 <para>
1300 In the
1301 <link linkend='general-yocto-environment-figure'>general Yocto Project Development Environment figure</link>,
1302 the output labeled "Application Development SDK" represents an
1303 SDK.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001304 The SDK generation process differs depending on whether you build
1305 a standard SDK
1306 (e.g. <filename>bitbake -c populate_sdk</filename> <replaceable>imagename</replaceable>)
1307 or an extensible SDK
1308 (e.g. <filename>bitbake -c populate_sdk_ext</filename> <replaceable>imagename</replaceable>).
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001309 This section is going to take a closer look at this output:
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001310 <imagedata fileref="figures/sdk.png" align="center" width="9in" depth="7.25in" />
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001311 </para>
1312
1313 <para>
1314 The specific form of this output is a self-extracting
1315 SDK installer (<filename>*.sh</filename>) that, when run,
1316 installs the SDK, which consists of a cross-development
1317 toolchain, a set of libraries and headers, and an SDK
1318 environment setup script.
1319 Running this installer essentially sets up your
1320 cross-development environment.
1321 You can think of the cross-toolchain as the "host"
1322 part because it runs on the SDK machine.
1323 You can think of the libraries and headers as the "target"
1324 part because they are built for the target hardware.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001325 The environment setup script is added so that you can initialize
1326 the environment before using the tools.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001327 </para>
1328
1329 <note>
1330 <para>
1331 The Yocto Project supports several methods by which you can
1332 set up this cross-development environment.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001333 These methods include downloading pre-built SDK installers
1334 or building and installing your own SDK installer.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001335 </para>
1336
1337 <para>
1338 For background information on cross-development toolchains
1339 in the Yocto Project development environment, see the
1340 "<link linkend='cross-development-toolchain-generation'>Cross-Development Toolchain Generation</link>"
1341 section.
1342 For information on setting up a cross-development
1343 environment, see the
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001344 <ulink url='&YOCTO_DOCS_SDK_URL;#sdk-manual'>Yocto Project Software Development Kit (SDK) Developer's Guide</ulink>.
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001345 </para>
1346 </note>
1347
1348 <para>
1349 Once built, the SDK installers are written out to the
1350 <filename>deploy/sdk</filename> folder inside the
1351 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>
1352 as shown in the figure at the beginning of this section.
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001353 Depending on the type of SDK, several variables exist that help
1354 configure these files.
1355 The following list shows the variables associated with a standard
1356 SDK:
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001357 <itemizedlist>
1358 <listitem><para><link linkend='var-DEPLOY_DIR'><filename>DEPLOY_DIR</filename></link>:
1359 Points to the <filename>deploy</filename>
1360 directory.</para></listitem>
1361 <listitem><para><link linkend='var-SDKMACHINE'><filename>SDKMACHINE</filename></link>:
1362 Specifies the architecture of the machine
1363 on which the cross-development tools are run to
1364 create packages for the target hardware.
1365 </para></listitem>
1366 <listitem><para><link linkend='var-SDKIMAGE_FEATURES'><filename>SDKIMAGE_FEATURES</filename></link>:
1367 Lists the features to include in the "target" part
1368 of the SDK.
1369 </para></listitem>
1370 <listitem><para><link linkend='var-TOOLCHAIN_HOST_TASK'><filename>TOOLCHAIN_HOST_TASK</filename></link>:
1371 Lists packages that make up the host
1372 part of the SDK (i.e. the part that runs on
1373 the <filename>SDKMACHINE</filename>).
1374 When you use
1375 <filename>bitbake -c populate_sdk <replaceable>imagename</replaceable></filename>
1376 to create the SDK, a set of default packages
1377 apply.
1378 This variable allows you to add more packages.
1379 </para></listitem>
1380 <listitem><para><link linkend='var-TOOLCHAIN_TARGET_TASK'><filename>TOOLCHAIN_TARGET_TASK</filename></link>:
1381 Lists packages that make up the target part
1382 of the SDK (i.e. the part built for the
1383 target hardware).
1384 </para></listitem>
1385 <listitem><para><link linkend='var-SDKPATH'><filename>SDKPATH</filename></link>:
1386 Defines the default SDK installation path offered by the
1387 installation script.
1388 </para></listitem>
1389 </itemizedlist>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05001390 This next list, shows the variables associated with an extensible
1391 SDK:
1392 <itemizedlist>
1393 <listitem><para><link linkend='var-DEPLOY_DIR'><filename>DEPLOY_DIR</filename></link>:
1394 Points to the <filename>deploy</filename> directory.
1395 </para></listitem>
1396 <listitem><para><link linkend='var-SDK_EXT_TYPE'><filename>SDK_EXT_TYPE</filename></link>:
1397 Controls whether or not shared state artifacts are copied
1398 into the extensible SDK.
1399 By default, all required shared state artifacts are copied
1400 into the SDK.
1401 </para></listitem>
1402 <listitem><para><link linkend='var-SDK_INCLUDE_PKGDATA'><filename>SDK_INCLUDE_PKGDATA</filename></link>:
1403 Specifies whether or not packagedata will be included in
1404 the extensible SDK for all recipes in the "world" target.
1405 </para></listitem>
1406 <listitem><para><link linkend='var-SDK_LOCAL_CONF_WHITELIST'><filename>SDK_LOCAL_CONF_WHITELIST</filename></link>:
1407 A list of variables allowed through from the build system
1408 configuration into the extensible SDK configuration.
1409 </para></listitem>
1410 <listitem><para><link linkend='var-SDK_LOCAL_CONF_BLACKLIST'><filename>SDK_LOCAL_CONF_BLACKLIST</filename></link>:
1411 A list of variables not allowed through from the build
1412 system configuration into the extensible SDK configuration.
1413 </para></listitem>
1414 <listitem><para><link linkend='var-SDK_INHERIT_BLACKLIST'><filename>SDK_INHERIT_BLACKLIST</filename></link>:
1415 A list of classes to remove from the
1416 <link linkend='var-INHERIT'><filename>INHERIT</filename></link>
1417 value globally within the extensible SDK configuration.
1418 </para></listitem>
1419 </itemizedlist>
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001420 </para>
1421 </section>
1422
1423</chapter>
1424<!--
1425vim: expandtab tw=80 ts=4
1426-->