blob: 11dfc5b13e6b63ada40756dc8b8a8f62f752fe76 [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='faq'>
6<title>FAQ</title>
7<qandaset>
8 <qandaentry>
9 <question>
10 <para>
11 How does Poky differ from <ulink url='&OE_HOME_URL;'>OpenEmbedded</ulink>?
12 </para>
13 </question>
14 <answer>
15 <para>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050016 The term "<link link='poky'>Poky</link>"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017 refers to the specific reference build system that
18 the Yocto Project provides.
Brad Bishopd7bf8c12018-02-25 22:55:05 -050019 Poky is based on <link linkend='oe-core'>OE-Core</link>
20 and <link linkend='bitbake-term'>BitBake</link>.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021 Thus, the generic term used here for the build system is
22 the "OpenEmbedded build system."
23 Development in the Yocto Project using Poky is closely tied to OpenEmbedded, with
24 changes always being merged to OE-Core or BitBake first before being pulled back
25 into Poky.
26 This practice benefits both projects immediately.
27 </para>
28 </answer>
29 </qandaentry>
30
31 <qandaentry>
32 <question>
33 <para id='faq-not-meeting-requirements'>
34 My development system does not meet the
35 required Git, tar, and Python versions.
Patrick Williamsc0f7c042017-02-23 20:41:17 -060036 In particular, I do not have Python 3.4.0 or greater.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050037 Can I still use the Yocto Project?
38 </para>
39 </question>
40 <answer>
41 <para>
42 You can get the required tools on your host development
43 system a couple different ways (i.e. building a tarball or
44 downloading a tarball).
45 See the
46 "<link linkend='required-git-tar-and-python-versions'>Required Git, tar, and Python Versions</link>"
47 section for steps on how to update your build tools.
48 </para>
49 </answer>
50 </qandaentry>
51
52 <qandaentry>
53 <question>
54 <para>
55 How can you claim Poky / OpenEmbedded-Core is stable?
56 </para>
57 </question>
58 <answer>
59 <para>
60 There are three areas that help with stability;
61 <itemizedlist>
62 <listitem><para>The Yocto Project team keeps
Brad Bishopd7bf8c12018-02-25 22:55:05 -050063 <link linkend='oe-core'>OE-Core</link> small
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064 and focused, containing around 830 recipes as opposed to the thousands
65 available in other OpenEmbedded community layers.
66 Keeping it small makes it easy to test and maintain.</para></listitem>
67 <listitem><para>The Yocto Project team runs manual and automated tests
68 using a small, fixed set of reference hardware as well as emulated
69 targets.</para></listitem>
70 <listitem><para>The Yocto Project uses an autobuilder,
71 which provides continuous build and integration tests.</para></listitem>
72 </itemizedlist>
73 </para>
74 </answer>
75 </qandaentry>
76
77 <qandaentry>
78 <question>
79 <para>
80 How do I get support for my board added to the Yocto Project?
81 </para>
82 </question>
83 <answer>
84 <para>
85 Support for an additional board is added by creating a
86 Board Support Package (BSP) layer for it.
87 For more information on how to create a BSP layer, see the
88 "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers</ulink>"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050089 section in the Yocto Project Development Tasks Manual and the
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090 <ulink url='&YOCTO_DOCS_BSP_URL;'>Yocto Project Board Support Package (BSP) Developer's Guide</ulink>.
91 </para>
92 <para>
93 Usually, if the board is not completely exotic, adding support in
94 the Yocto Project is fairly straightforward.
95 </para>
96 </answer>
97 </qandaentry>
98
99 <qandaentry>
100 <question>
101 <para>
102 Are there any products built using the OpenEmbedded build system?
103 </para>
104 </question>
105 <answer>
106 <para>
107 The software running on the <ulink url='http://vernier.com/labquest/'>Vernier LabQuest</ulink>
108 is built using the OpenEmbedded build system.
109 See the <ulink url='http://www.vernier.com/products/interfaces/labq/'>Vernier LabQuest</ulink>
110 website for more information.
111 There are a number of pre-production devices using the OpenEmbedded build system
112 and the Yocto Project team
113 announces them as soon as they are released.
114 </para>
115 </answer>
116 </qandaentry>
117
118 <qandaentry>
119 <question>
120 <para>
121 What does the OpenEmbedded build system produce as output?
122 </para>
123 </question>
124 <answer>
125 <para>
126 Because you can use the same set of recipes to create output of
127 various formats, the output of an OpenEmbedded build depends on
128 how you start it.
129 Usually, the output is a flashable image ready for the target
130 device.
131 </para>
132 </answer>
133 </qandaentry>
134
135 <qandaentry>
136 <question>
137 <para>
138 How do I add my package to the Yocto Project?
139 </para>
140 </question>
141 <answer>
142 <para>
143 To add a package, you need to create a BitBake recipe.
144 For information on how to create a BitBake recipe, see the
145 "<ulink url='&YOCTO_DOCS_DEV_URL;#new-recipe-writing-a-new-recipe'>Writing a New Recipe</ulink>"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500146 in the Yocto Project Development Tasks Manual.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500147 </para>
148 </answer>
149 </qandaentry>
150
151 <qandaentry>
152 <question>
153 <para>
154 Do I have to reflash my entire board with a new Yocto Project image when recompiling
155 a package?
156 </para>
157 </question>
158 <answer>
159 <para>
160 The OpenEmbedded build system can build packages in various
161 formats such as IPK for OPKG, Debian package
162 (<filename>.deb</filename>), or RPM.
163 You can then upgrade the packages using the package tools on
164 the device, much like on a desktop distribution such as
165 Ubuntu or Fedora.
166 However, package management on the target is entirely optional.
167 </para>
168 </answer>
169 </qandaentry>
170
171 <qandaentry>
172 <question>
173 <para>
174 I see the error '<filename>chmod: XXXXX new permissions are r-xrwxrwx, not r-xr-xr-x</filename>'.
175 What is wrong?
176 </para>
177 </question>
178 <answer>
179 <para>
180 You are probably running the build on an NTFS filesystem.
181 Use <filename>ext2</filename>, <filename>ext3</filename>, or <filename>ext4</filename> instead.
182 </para>
183 </answer>
184 </qandaentry>
185
186<!-- <qandaentry>
187 <question>
188 <para>
189 How do I make the Yocto Project work in RHEL/CentOS?
190 </para>
191 </question>
192 <answer>
193 <para>
194 To get the Yocto Project working under RHEL/CentOS 5.1 you need to first
195 install some required packages.
196 The standard CentOS packages needed are:
197 <itemizedlist>
198 <listitem><para>"Development tools" (selected during installation)</para></listitem>
199 <listitem><para><filename>texi2html</filename></para></listitem>
200 <listitem><para><filename>compat-gcc-34</filename></para></listitem>
201 </itemizedlist>
202 On top of these, you need the following external packages:
203 <itemizedlist>
204 <listitem><para><filename>python-sqlite2</filename> from
205 <ulink url='http://dag.wieers.com/rpm/packages/python-sqlite2/'>DAG repository</ulink>
206 </para></listitem>
207 <listitem><para><filename>help2man</filename> from
208 <ulink url='http://centos.karan.org/el4/extras/stable/x86_64/RPMS/repodata/repoview/help2man-0-1.33.1-2.html'>Karan repository</ulink></para></listitem>
209 </itemizedlist>
210 </para>
211
212 <para>
213 Once these packages are installed, the OpenEmbedded build system will be able
214 to build standard images.
215 However, there might be a problem with the QEMU emulator segfaulting.
216 You can either disable the generation of binary locales by setting
217 <filename><link linkend='var-ENABLE_BINARY_LOCALE_GENERATION'>ENABLE_BINARY_LOCALE_GENERATION</link>
218 </filename> to "0" or by removing the <filename>linux-2.6-execshield.patch</filename>
219 from the kernel and rebuilding it since that is the patch that causes the problems with QEMU.
220 </para>
221
222 <note>
223 <para>For information on distributions that the Yocto Project
224 uses during validation, see the
225 <ulink url='&YOCTO_WIKI_URL;/wiki/Distribution_Support'>Distribution Support</ulink>
226 Wiki page.</para>
227 <para>For notes about using the Yocto Project on a RHEL 4-based
228 host, see the
229 <ulink url='&YOCTO_WIKI_URL;/wiki/BuildingOnRHEL4'>Building on RHEL4</ulink>
230 Wiki page.</para>
231 </note>
232 </answer>
233 </qandaentry> -->
234
235 <qandaentry>
236 <question>
237 <para>
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500238 I see lots of 404 responses for files when the OpenEmbedded
239 build system is trying to download sources.
240 Is something wrong?
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500241 </para>
242 </question>
243 <answer>
244 <para>
245 Nothing is wrong.
246 The OpenEmbedded build system checks any configured source mirrors before downloading
247 from the upstream sources.
248 The build system does this searching for both source archives and
249 pre-checked out versions of SCM-managed software.
250 These checks help in large installations because it can reduce load on the SCM servers
251 themselves.
252 The address above is one of the default mirrors configured into the
253 build system.
254 Consequently, if an upstream source disappears, the team
255 can place sources there so builds continue to work.
256 </para>
257 </answer>
258 </qandaentry>
259
260 <qandaentry>
261 <question>
262 <para>
263 I have machine-specific data in a package for one machine only but the package is
264 being marked as machine-specific in all cases, how do I prevent this?
265 </para>
266 </question>
267 <answer>
268 <para>
269 Set <filename><link linkend='var-SRC_URI_OVERRIDES_PACKAGE_ARCH'>SRC_URI_OVERRIDES_PACKAGE_ARCH</link>
270 </filename> = "0" in the <filename>.bb</filename> file but make sure the package is
271 manually marked as
272 machine-specific for the case that needs it.
273 The code that handles
274 <filename>SRC_URI_OVERRIDES_PACKAGE_ARCH</filename> is in
275 the <filename>meta/classes/base.bbclass</filename> file.
276 </para>
277 </answer>
278 </qandaentry>
279
280 <qandaentry>
281 <question>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500282 <para id='i-am-behind-a-firewall-and-need-to-use-a-proxy-server'>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500283 I'm behind a firewall and need to use a proxy server. How do I do that?
284 </para>
285 </question>
286 <answer>
287 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500288 Most source fetching by the OpenEmbedded build system is done
289 by <filename>wget</filename> and you therefore need to specify
290 the proxy settings in a <filename>.wgetrc</filename> file,
291 which can be in your home directory if you are a single user
292 or can be in <filename>/usr/local/etc/wgetrc</filename> as
293 a global user file.
294 </para>
295
296 <para>
297 Following is the applicable code for setting various proxy
298 types in the <filename>.wgetrc</filename> file.
299 By default, these settings are disabled with comments.
300 To use them, remove the comments:
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500301 <literallayout class='monospaced'>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500302 # You can set the default proxies for Wget to use for http, https, and ftp.
303 # They will override the value in the environment.
304 #https_proxy = http://proxy.yoyodyne.com:18023/
305 #http_proxy = http://proxy.yoyodyne.com:18023/
306 #ftp_proxy = http://proxy.yoyodyne.com:18023/
307
308 # If you do not want to use proxy at all, set this to off.
309 #use_proxy = on
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500310 </literallayout>
311 The Yocto Project also includes a
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500312 <filename>meta-poky/conf/site.conf.sample</filename> file that
313 shows how to configure CVS and Git proxy servers if needed.
314 For more information on setting up various proxy types and
315 configuring proxy servers, see the
316 "<ulink url='&YOCTO_WIKI_URL;/wiki/Working_Behind_a_Network_Proxy'>Working Behind a Network Proxy</ulink>"
317 Wiki page.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500318 </para>
319 </answer>
320 </qandaentry>
321
322 <qandaentry>
323 <question>
324 <para>
325 What’s the difference between <replaceable>target</replaceable> and <replaceable>target</replaceable><filename>-native</filename>?
326 </para>
327 </question>
328 <answer>
329 <para>
330 The <filename>*-native</filename> targets are designed to run on the system
331 being used for the build.
332 These are usually tools that are needed to assist the build in some way such as
333 <filename>quilt-native</filename>, which is used to apply patches.
334 The non-native version is the one that runs on the target device.
335 </para>
336 </answer>
337 </qandaentry>
338
339 <qandaentry>
340 <question>
341 <para>
342 I'm seeing random build failures. Help?!
343 </para>
344 </question>
345 <answer>
346 <para>
347 If the same build is failing in totally different and random
348 ways, the most likely explanation is:
349 <itemizedlist>
350 <listitem><para>The hardware you are running the build on
351 has some problem.</para></listitem>
352 <listitem><para>You are running the build under
353 virtualization, in which case the virtualization
354 probably has bugs.</para></listitem>
355 </itemizedlist>
356 The OpenEmbedded build system processes a massive amount of
357 data that causes lots of network, disk and CPU activity and
358 is sensitive to even single-bit failures in any of these areas.
359 True random failures have always been traced back to hardware
360 or virtualization issues.
361 </para>
362 </answer>
363 </qandaentry>
364
365 <qandaentry>
366 <question>
367 <para>
368 When I try to build a native recipe, the build fails with <filename>iconv.h</filename> problems.
369 </para>
370 </question>
371 <answer>
372 <para>
373 If you get an error message that indicates GNU
374 <filename>libiconv</filename> is not in use but
375 <filename>iconv.h</filename> has been included from
376 <filename>libiconv</filename>, you need to check to see if
377 you have a previously installed version of the header file
378 in <filename>/usr/local/include</filename>.
379 <literallayout class='monospaced'>
380 #error GNU libiconv not in use but included iconv.h is from libiconv
381 </literallayout>
382 If you find a previously installed file, you should either
383 uninstall it or temporarily rename it and try the build again.
384 </para>
385
386 <para>
387 This issue is just a single manifestation of "system
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500388 leakage" issues caused when the OpenEmbedded build system
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500389 finds and uses previously installed files during a native
390 build.
391 This type of issue might not be limited to
392 <filename>iconv.h</filename>.
393 Be sure that leakage cannot occur from
394 <filename>/usr/local/include</filename> and
395 <filename>/opt</filename> locations.
396 </para>
397 </answer>
398 </qandaentry>
399
400 <qandaentry>
401 <question>
402 <para>
403 What do we need to ship for license compliance?
404 </para>
405 </question>
406 <answer>
407 <para>
408 This is a difficult question and you need to consult your lawyer
409 for the answer for your specific case.
410 It is worth bearing in mind that for GPL compliance, there needs
411 to be enough information shipped to allow someone else to
412 rebuild and produce the same end result you are shipping.
413 This means sharing the source code, any patches applied to it,
414 and also any configuration information about how that package
415 was configured and built.
416 </para>
417
418 <para>
419 You can find more information on licensing in the
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500420 "<link linkend='licensing'>Licensing</link>" section and in the
421 "<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>"
422 section, which is in the Yocto Project Development Tasks
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500423 Manual.
424 </para>
425 </answer>
426 </qandaentry>
427
428 <qandaentry>
429 <question>
430 <para>
431 How do I disable the cursor on my touchscreen device?
432 </para>
433 </question>
434 <answer>
435 <para>
436 You need to create a form factor file as described in the
437 "<ulink url='&YOCTO_DOCS_BSP_URL;#bsp-filelayout-misc-recipes'>Miscellaneous BSP-Specific Recipe Files</ulink>"
438 section in the Yocto Project Board Support Packages (BSP)
439 Developer's Guide.
440 Set the <filename>HAVE_TOUCHSCREEN</filename> variable equal to
441 one as follows:
442 <literallayout class='monospaced'>
443 HAVE_TOUCHSCREEN=1
444 </literallayout>
445 </para>
446 </answer>
447 </qandaentry>
448
449 <qandaentry>
450 <question>
451 <para>
452 How do I make sure connected network interfaces are brought up by default?
453 </para>
454 </question>
455 <answer>
456 <para>
457 The default interfaces file provided by the netbase recipe does not
458 automatically bring up network interfaces.
459 Therefore, you will need to add a BSP-specific netbase that includes an interfaces
460 file.
461 See the "<ulink url='&YOCTO_DOCS_BSP_URL;#bsp-filelayout-misc-recipes'>Miscellaneous BSP-Specific Recipe Files</ulink>"
462 section in the Yocto Project Board Support Packages (BSP)
463 Developer's Guide for information on creating these types of
464 miscellaneous recipe files.
465 </para>
466 <para>
467 For example, add the following files to your layer:
468 <literallayout class='monospaced'>
469 meta-MACHINE/recipes-bsp/netbase/netbase/MACHINE/interfaces
470 meta-MACHINE/recipes-bsp/netbase/netbase_5.0.bbappend
471 </literallayout>
472 </para>
473 </answer>
474 </qandaentry>
475
476 <qandaentry>
477 <question>
478 <para>
479 How do I create images with more free space?
480 </para>
481 </question>
482 <answer>
483 <para>
484 By default, the OpenEmbedded build system creates images
485 that are 1.3 times the size of the populated root filesystem.
486 To affect the image size, you need to set various
487 configurations:
488 <itemizedlist>
489 <listitem><para><emphasis>Image Size:</emphasis>
490 The OpenEmbedded build system uses the
491 <link linkend='var-IMAGE_ROOTFS_SIZE'><filename>IMAGE_ROOTFS_SIZE</filename></link>
492 variable to define the size of the image in Kbytes.
493 The build system determines the size by taking into
494 account the initial root filesystem size before any
495 modifications such as requested size for the image and
496 any requested additional free disk space to be
497 added to the image.</para></listitem>
498 <listitem><para><emphasis>Overhead:</emphasis>
499 Use the
500 <link linkend='var-IMAGE_OVERHEAD_FACTOR'><filename>IMAGE_OVERHEAD_FACTOR</filename></link>
501 variable to define the multiplier that the build system
502 applies to the initial image size, which is 1.3 by
503 default.</para></listitem>
504 <listitem><para><emphasis>Additional Free Space:</emphasis>
505 Use the
506 <link linkend='var-IMAGE_ROOTFS_EXTRA_SPACE'><filename>IMAGE_ROOTFS_EXTRA_SPACE</filename></link>
507 variable to add additional free space to the image.
508 The build system adds this space to the image after
509 it determines its
510 <filename>IMAGE_ROOTFS_SIZE</filename>.
511 </para></listitem>
512 </itemizedlist>
513 </para>
514 </answer>
515 </qandaentry>
516
517 <qandaentry>
518 <question>
519 <para>
520 Why don't you support directories with spaces in the pathnames?
521 </para>
522 </question>
523 <answer>
524 <para>
525 The Yocto Project team has tried to do this before but too
526 many of the tools the OpenEmbedded build system depends on,
527 such as <filename>autoconf</filename>, break when they find
528 spaces in pathnames.
529 Until that situation changes, the team will not support spaces
530 in pathnames.
531 </para>
532 </answer>
533 </qandaentry>
534
535 <qandaentry>
536 <question>
537 <para>
538 How do I use an external toolchain?
539 </para>
540 </question>
541 <answer>
542 <para>
543 The toolchain configuration is very flexible and customizable.
544 It is primarily controlled with the
545 <filename><link linkend='var-TCMODE'>TCMODE</link></filename>
546 variable.
547 This variable controls which <filename>tcmode-*.inc</filename>
548 file to include from the
549 <filename>meta/conf/distro/include</filename> directory within
550 the
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500551 <link linkend='source-directory'>Source Directory</link>.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500552 </para>
553
554 <para>
555 The default value of <filename>TCMODE</filename> is "default",
556 which tells the OpenEmbedded build system to use its internally
557 built toolchain (i.e. <filename>tcmode-default.inc</filename>).
558 However, other patterns are accepted.
559 In particular, "external-*" refers to external toolchains.
560 One example is the Sourcery G++ Toolchain.
561 The support for this toolchain resides in the separate
562 <filename>meta-sourcery</filename> layer at
563 <ulink url='http://github.com/MentorEmbedded/meta-sourcery/'></ulink>.
564 </para>
565
566 <para>
567 In addition to the toolchain configuration, you also need a
568 corresponding toolchain recipe file.
569 This recipe file needs to package up any pre-built objects in
570 the toolchain such as <filename>libgcc</filename>,
571 <filename>libstdcc++</filename>, any locales, and
572 <filename>libc</filename>.
573 </para>
574 </answer>
575 </qandaentry>
576
577 <qandaentry>
578 <question>
579 <para id='how-does-the-yocto-project-obtain-source-code-and-will-it-work-behind-my-firewall-or-proxy-server'>
580 How does the OpenEmbedded build system obtain source code and
581 will it work behind my firewall or proxy server?
582 </para>
583 </question>
584 <answer>
585 <para>
586 The way the build system obtains source code is highly
587 configurable.
588 You can setup the build system to get source code in most
589 environments if HTTP transport is available.
590 </para>
591 <para>
592 When the build system searches for source code, it first
593 tries the local download directory.
594 If that location fails, Poky tries
595 <link linkend='var-PREMIRRORS'><filename>PREMIRRORS</filename></link>,
596 the upstream source, and then
597 <link linkend='var-MIRRORS'><filename>MIRRORS</filename></link>
598 in that order.
599 </para>
600 <para>
601 Assuming your distribution is "poky", the OpenEmbedded build
602 system uses the Yocto Project source
603 <filename>PREMIRRORS</filename> by default for SCM-based
604 sources, upstreams for normal tarballs, and then falls back
605 to a number of other mirrors including the Yocto Project
606 source mirror if those fail.
607 </para>
608 <para>
609 As an example, you could add a specific server for the
610 build system to attempt before any others by adding something
611 like the following to the <filename>local.conf</filename>
612 configuration file:
613 <literallayout class='monospaced'>
614 PREMIRRORS_prepend = "\
615 git://.*/.* http://www.yoctoproject.org/sources/ \n \
616 ftp://.*/.* http://www.yoctoproject.org/sources/ \n \
617 http://.*/.* http://www.yoctoproject.org/sources/ \n \
618 https://.*/.* http://www.yoctoproject.org/sources/ \n"
619 </literallayout>
620 </para>
621 <para>
622 These changes cause the build system to intercept Git, FTP,
623 HTTP, and HTTPS requests and direct them to the
624 <filename>http://</filename> sources mirror.
625 You can use <filename>file://</filename> URLs to point to
626 local directories or network shares as well.
627 </para>
628 <para>
629 Aside from the previous technique, these options also exist:
630 <literallayout class='monospaced'>
631 BB_NO_NETWORK = "1"
632 </literallayout>
633 This statement tells BitBake to issue an error instead of
634 trying to access the Internet.
635 This technique is useful if you want to ensure code builds
636 only from local sources.
637 </para>
638 <para>
639 Here is another technique:
640 <literallayout class='monospaced'>
641 BB_FETCH_PREMIRRORONLY = "1"
642 </literallayout>
643 This statement limits the build system to pulling source
644 from the <filename>PREMIRRORS</filename> only.
645 Again, this technique is useful for reproducing builds.
646 </para>
647 <para>
648 Here is another technique:
649 <literallayout class='monospaced'>
650 BB_GENERATE_MIRROR_TARBALLS = "1"
651 </literallayout>
652 This statement tells the build system to generate mirror
653 tarballs.
654 This technique is useful if you want to create a mirror server.
655 If not, however, the technique can simply waste time during
656 the build.
657 </para>
658 <para>
659 Finally, consider an example where you are behind an
660 HTTP-only firewall.
661 You could make the following changes to the
662 <filename>local.conf</filename> configuration file as long as
663 the <filename>PREMIRRORS</filename> server is current:
664 <literallayout class='monospaced'>
665 PREMIRRORS_prepend = "\
666 ftp://.*/.* http://www.yoctoproject.org/sources/ \n \
667 http://.*/.* http://www.yoctoproject.org/sources/ \n \
668 https://.*/.* http://www.yoctoproject.org/sources/ \n"
669 BB_FETCH_PREMIRRORONLY = "1"
670 </literallayout>
671 These changes would cause the build system to successfully
672 fetch source over HTTP and any network accesses to anything
673 other than the <filename>PREMIRRORS</filename> would fail.
674 </para>
675 <para>
676 The build system also honors the standard shell environment
677 variables <filename>http_proxy</filename>,
678 <filename>ftp_proxy</filename>,
679 <filename>https_proxy</filename>, and
680 <filename>all_proxy</filename> to redirect requests through
681 proxy servers.
682 </para>
683 <note>
684 You can find more information on the
685 "<ulink url='&YOCTO_WIKI_URL;/wiki/Working_Behind_a_Network_Proxy'>Working Behind a Network Proxy</ulink>"
686 Wiki page.
687 </note>
688 </answer>
689 </qandaentry>
690
691 <qandaentry>
692 <question>
693 <para>
694 Can I get rid of build output so I can start over?
695 </para>
696 </question>
697 <answer>
698 <para>
699 Yes - you can easily do this.
700 When you use BitBake to build an image, all the build output
701 goes into the directory created when you run the
702 build environment setup script (i.e.
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500703 <link linkend='structure-core-script'><filename>&OE_INIT_FILE;</filename></link>).
704 By default, this
705 <link linkend='build-directory'>Build Directory</link>
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500706 is named <filename>build</filename> but can be named
707 anything you want.
708 </para>
709
710 <para>
711 Within the Build Directory, is the <filename>tmp</filename>
712 directory.
713 To remove all the build output yet preserve any source code or
714 downloaded files from previous builds, simply remove the
715 <filename>tmp</filename> directory.
716 </para>
717 </answer>
718 </qandaentry>
719
720 <qandaentry>
721 <question>
722 <para>
723 Why do <filename>${bindir}</filename> and <filename>${libdir}</filename> have strange values for <filename>-native</filename> recipes?
724 </para>
725 </question>
726 <answer>
727 <para>
728 Executables and libraries might need to be used from a
729 directory other than the directory into which they were
730 initially installed.
731 Complicating this situation is the fact that sometimes these
732 executables and libraries are compiled with the expectation
733 of being run from that initial installation target directory.
734 If this is the case, moving them causes problems.
735 </para>
736
737 <para>
738 This scenario is a fundamental problem for package maintainers
739 of mainstream Linux distributions as well as for the
740 OpenEmbedded build system.
741 As such, a well-established solution exists.
742 Makefiles, Autotools configuration scripts, and other build
743 systems are expected to respect environment variables such as
744 <filename>bindir</filename>, <filename>libdir</filename>,
745 and <filename>sysconfdir</filename> that indicate where
746 executables, libraries, and data reside when a program is
747 actually run.
748 They are also expected to respect a
749 <filename>DESTDIR</filename> environment variable, which is
750 prepended to all the other variables when the build system
751 actually installs the files.
752 It is understood that the program does not actually run from
753 within <filename>DESTDIR</filename>.
754 </para>
755
756 <para>
757 When the OpenEmbedded build system uses a recipe to build a
758 target-architecture program (i.e. one that is intended for
759 inclusion on the image being built), that program eventually
760 runs from the root file system of that image.
761 Thus, the build system provides a value of "/usr/bin" for
762 <filename>bindir</filename>, a value of "/usr/lib" for
763 <filename>libdir</filename>, and so forth.
764 </para>
765
766 <para>
767 Meanwhile, <filename>DESTDIR</filename> is a path within the
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500768 <link linkend='build-directory'>Build Directory</link>.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500769 However, when the recipe builds a native program (i.e. one
770 that is intended to run on the build machine), that program
771 is never installed directly to the build machine's root
772 file system.
773 Consequently, the build system uses paths within the Build
774 Directory for <filename>DESTDIR</filename>,
775 <filename>bindir</filename> and related variables.
776 To better understand this, consider the following two paths
777 where the first is relatively normal and the second is not:
778 <note>
779 Due to these lengthy examples, the paths are artificially
780 broken across lines for readability.
781 </note>
782 <literallayout class='monospaced'>
783 /home/maxtothemax/poky-bootchart2/build/tmp/work/i586-poky-linux/zlib/
784 1.2.8-r0/sysroot-destdir/usr/bin
785
786 /home/maxtothemax/poky-bootchart2/build/tmp/work/x86_64-linux/
787 zlib-native/1.2.8-r0/sysroot-destdir/home/maxtothemax/poky-bootchart2/
788 build/tmp/sysroots/x86_64-linux/usr/bin
789 </literallayout>
790 Even if the paths look unusual, they both are correct -
791 the first for a target and the second for a native recipe.
792 These paths are a consequence of the
793 <filename>DESTDIR</filename> mechanism and while they
794 appear strange, they are correct and in practice very effective.
795 </para>
796 </answer>
797 </qandaentry>
798
799 <qandaentry>
800 <question>
801 <para>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500802 The files provided by my <filename>*-native</filename> recipe do
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500803 not appear to be available to other recipes.
804 Files are missing from the native sysroot, my recipe is
805 installing to the wrong place, or I am getting permissions
806 errors during the do_install task in my recipe! What is wrong?
807 </para>
808 </question>
809 <answer>
810 <para>
811 This situation results when a build system does
812 not recognize the environment variables supplied to it by
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500813 <link linkend='bitbake-term'>BitBake</link>.
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500814 The incident that prompted this FAQ entry involved a Makefile
815 that used an environment variable named
816 <filename>BINDIR</filename> instead of the more standard
817 variable <filename>bindir</filename>.
818 The makefile's hardcoded default value of "/usr/bin" worked
819 most of the time, but not for the recipe's
820 <filename>-native</filename> variant.
821 For another example, permissions errors might be caused
822 by a Makefile that ignores <filename>DESTDIR</filename> or uses
823 a different name for that environment variable.
824 Check the the build system to see if these kinds of
825 issues exist.
826 </para>
827 </answer>
828 </qandaentry>
829
830</qandaset>
831</chapter>
832<!--
833vim: expandtab tw=80 ts=4
834-->