xref: /OK3568_Linux_fs/yocto/poky/documentation/ref-manual/faq.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun***
4*4882a593SmuzhiyunFAQ
5*4882a593Smuzhiyun***
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun**Q:** How does Poky differ from :oe_home:`OpenEmbedded <>`?
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun**A:** The term ``Poky`` refers to the specific reference build
10*4882a593Smuzhiyunsystem that the Yocto Project provides. Poky is based on
11*4882a593Smuzhiyun:term:`OpenEmbedded-Core (OE-Core)` and :term:`BitBake`. Thus, the
12*4882a593Smuzhiyungeneric term used here for the build system is the "OpenEmbedded build
13*4882a593Smuzhiyunsystem." Development in the Yocto Project using Poky is closely tied to
14*4882a593SmuzhiyunOpenEmbedded, with changes always being merged to OE-Core or BitBake
15*4882a593Smuzhiyunfirst before being pulled back into Poky. This practice benefits both
16*4882a593Smuzhiyunprojects immediately.
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun**Q:** My development system does not meet the required Git, tar, and
19*4882a593SmuzhiyunPython versions. In particular, I do not have Python &MIN_PYTHON_VERSION; or greater.
20*4882a593SmuzhiyunCan I still use the Yocto Project?
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun**A:** You can get the required tools on your host development system a
23*4882a593Smuzhiyuncouple different ways (i.e. building a tarball or downloading a
24*4882a593Smuzhiyuntarball). See the
25*4882a593Smuzhiyun":ref:`ref-manual/system-requirements:required git, tar, python and gcc versions`"
26*4882a593Smuzhiyunsection for steps on how to update your build tools.
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun**Q:** How can you claim Poky / OpenEmbedded-Core is stable?
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun**A:** There are three areas that help with stability;
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun-  The Yocto Project team keeps :term:`OpenEmbedded-Core (OE-Core)` small and
33*4882a593Smuzhiyun   focused, containing around 830 recipes as opposed to the thousands
34*4882a593Smuzhiyun   available in other OpenEmbedded community layers. Keeping it small
35*4882a593Smuzhiyun   makes it easy to test and maintain.
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun-  The Yocto Project team runs manual and automated tests using a small,
38*4882a593Smuzhiyun   fixed set of reference hardware as well as emulated targets.
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun-  The Yocto Project uses an autobuilder, which provides continuous
41*4882a593Smuzhiyun   build and integration tests.
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun**Q:** How do I get support for my board added to the Yocto Project?
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun**A:** Support for an additional board is added by creating a Board
46*4882a593SmuzhiyunSupport Package (BSP) layer for it. For more information on how to
47*4882a593Smuzhiyuncreate a BSP layer, see the
48*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:understanding and creating layers`"
49*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual and the
50*4882a593Smuzhiyun:doc:`/bsp-guide/index`.
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunUsually, if the board is not completely exotic, adding support in the
53*4882a593SmuzhiyunYocto Project is fairly straightforward.
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun**Q:** Are there any products built using the OpenEmbedded build system?
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun**A:** The software running on the `Vernier
58*4882a593SmuzhiyunLabQuest <https://vernier.com/labquest/>`__ is built using the
59*4882a593SmuzhiyunOpenEmbedded build system. See the `Vernier
60*4882a593SmuzhiyunLabQuest <https://www.vernier.com/products/interfaces/labq/>`__ website
61*4882a593Smuzhiyunfor more information. There are a number of pre-production devices using
62*4882a593Smuzhiyunthe OpenEmbedded build system and the Yocto Project team announces them
63*4882a593Smuzhiyunas soon as they are released.
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun**Q:** What does the OpenEmbedded build system produce as output?
66*4882a593Smuzhiyun
67*4882a593Smuzhiyun**A:** Because you can use the same set of recipes to create output of
68*4882a593Smuzhiyunvarious formats, the output of an OpenEmbedded build depends on how you
69*4882a593Smuzhiyunstart it. Usually, the output is a flashable image ready for the target
70*4882a593Smuzhiyundevice.
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun**Q:** How do I add my package to the Yocto Project?
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun**A:** To add a package, you need to create a BitBake recipe. For
75*4882a593Smuzhiyuninformation on how to create a BitBake recipe, see the
76*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:writing a new recipe`"
77*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun**Q:** Do I have to reflash my entire board with a new Yocto Project
80*4882a593Smuzhiyunimage when recompiling a package?
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun**A:** The OpenEmbedded build system can build packages in various
83*4882a593Smuzhiyunformats such as IPK for OPKG, Debian package (``.deb``), or RPM. You can
84*4882a593Smuzhiyunthen upgrade the packages using the package tools on the device, much
85*4882a593Smuzhiyunlike on a desktop distribution such as Ubuntu or Fedora. However,
86*4882a593Smuzhiyunpackage management on the target is entirely optional.
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun**Q:** I see the error
89*4882a593Smuzhiyun'``chmod: XXXXX new permissions are r-xrwxrwx, not r-xr-xr-x``'. What is
90*4882a593Smuzhiyunwrong?
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun**A:** You are probably running the build on an NTFS filesystem. Use
93*4882a593Smuzhiyun``ext2``, ``ext3``, or ``ext4`` instead.
94*4882a593Smuzhiyun
95*4882a593Smuzhiyun**Q:** I see lots of 404 responses for files when the OpenEmbedded build
96*4882a593Smuzhiyunsystem is trying to download sources. Is something wrong?
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun**A:** Nothing is wrong. The OpenEmbedded build system checks any
99*4882a593Smuzhiyunconfigured source mirrors before downloading from the upstream sources.
100*4882a593SmuzhiyunThe build system does this searching for both source archives and
101*4882a593Smuzhiyunpre-checked out versions of SCM-managed software. These checks help in
102*4882a593Smuzhiyunlarge installations because it can reduce load on the SCM servers
103*4882a593Smuzhiyunthemselves. The address above is one of the default mirrors configured
104*4882a593Smuzhiyuninto the build system. Consequently, if an upstream source disappears,
105*4882a593Smuzhiyunthe team can place sources there so builds continue to work.
106*4882a593Smuzhiyun
107*4882a593Smuzhiyun**Q:** I have machine-specific data in a package for one machine only
108*4882a593Smuzhiyunbut the package is being marked as machine-specific in all cases, how do
109*4882a593SmuzhiyunI prevent this?
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun**A:** Set :term:`SRC_URI_OVERRIDES_PACKAGE_ARCH` = "0" in the ``.bb`` file
112*4882a593Smuzhiyunbut make sure the package is manually marked as machine-specific for the
113*4882a593Smuzhiyuncase that needs it. The code that handles
114*4882a593Smuzhiyun:term:`SRC_URI_OVERRIDES_PACKAGE_ARCH` is in the
115*4882a593Smuzhiyun``meta/classes/base.bbclass`` file.
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun**Q:** I'm behind a firewall and need to use a proxy server. How do I do
118*4882a593Smuzhiyunthat?
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun**A:** Most source fetching by the OpenEmbedded build system is done by
121*4882a593Smuzhiyun``wget`` and you therefore need to specify the proxy settings in a
122*4882a593Smuzhiyun``.wgetrc`` file, which can be in your home directory if you are a
123*4882a593Smuzhiyunsingle user or can be in ``/usr/local/etc/wgetrc`` as a global user
124*4882a593Smuzhiyunfile.
125*4882a593Smuzhiyun
126*4882a593SmuzhiyunFollowing is the applicable code for setting various proxy types in the
127*4882a593Smuzhiyun``.wgetrc`` file. By default, these settings are disabled with comments.
128*4882a593SmuzhiyunTo use them, remove the comments::
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun   # You can set the default proxies for Wget to use for http, https, and ftp.
131*4882a593Smuzhiyun   # They will override the value in the environment.
132*4882a593Smuzhiyun   #https_proxy = http://proxy.yoyodyne.com:18023/
133*4882a593Smuzhiyun   #http_proxy = http://proxy.yoyodyne.com:18023/
134*4882a593Smuzhiyun   #ftp_proxy = http://proxy.yoyodyne.com:18023/
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun   # If you do not want to use proxy at all, set this to off.
137*4882a593Smuzhiyun   #use_proxy = on
138*4882a593Smuzhiyun
139*4882a593SmuzhiyunThe Yocto Project also includes a
140*4882a593Smuzhiyun``meta-poky/conf/site.conf.sample`` file that shows how to configure CVS
141*4882a593Smuzhiyunand Git proxy servers if needed. For more information on setting up
142*4882a593Smuzhiyunvarious proxy types and configuring proxy servers, see the
143*4882a593Smuzhiyun":yocto_wiki:`Working Behind a Network Proxy </Working_Behind_a_Network_Proxy>`"
144*4882a593SmuzhiyunWiki page.
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun**Q:** What's the difference between ``target`` and ``target-native``?
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun**A:** The ``*-native`` targets are designed to run on the system being
149*4882a593Smuzhiyunused for the build. These are usually tools that are needed to assist
150*4882a593Smuzhiyunthe build in some way such as ``quilt-native``, which is used to apply
151*4882a593Smuzhiyunpatches. The non-native version is the one that runs on the target
152*4882a593Smuzhiyundevice.
153*4882a593Smuzhiyun
154*4882a593Smuzhiyun**Q:** I'm seeing random build failures. Help?!
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun**A:** If the same build is failing in totally different and random
157*4882a593Smuzhiyunways, the most likely explanation is:
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun-  The hardware you are running the build on has some problem.
160*4882a593Smuzhiyun
161*4882a593Smuzhiyun-  You are running the build under virtualization, in which case the
162*4882a593Smuzhiyun   virtualization probably has bugs.
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunThe OpenEmbedded build system processes a massive amount of data that
165*4882a593Smuzhiyuncauses lots of network, disk and CPU activity and is sensitive to even
166*4882a593Smuzhiyunsingle-bit failures in any of these areas. True random failures have
167*4882a593Smuzhiyunalways been traced back to hardware or virtualization issues.
168*4882a593Smuzhiyun
169*4882a593Smuzhiyun**Q:** When I try to build a native recipe, the build fails with
170*4882a593Smuzhiyun``iconv.h`` problems.
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun**A:** If you get an error message that indicates GNU ``libiconv`` is
173*4882a593Smuzhiyunnot in use but ``iconv.h`` has been included from ``libiconv``, you need
174*4882a593Smuzhiyunto check to see if you have a previously installed version of the header
175*4882a593Smuzhiyunfile in ``/usr/local/include``.
176*4882a593Smuzhiyun::
177*4882a593Smuzhiyun
178*4882a593Smuzhiyun   #error GNU libiconv not in use but included iconv.h is from libiconv
179*4882a593Smuzhiyun
180*4882a593SmuzhiyunIf you find a previously installed
181*4882a593Smuzhiyunfile, you should either uninstall it or temporarily rename it and try
182*4882a593Smuzhiyunthe build again.
183*4882a593Smuzhiyun
184*4882a593SmuzhiyunThis issue is just a single manifestation of "system leakage" issues
185*4882a593Smuzhiyuncaused when the OpenEmbedded build system finds and uses previously
186*4882a593Smuzhiyuninstalled files during a native build. This type of issue might not be
187*4882a593Smuzhiyunlimited to ``iconv.h``. Be sure that leakage cannot occur from
188*4882a593Smuzhiyun``/usr/local/include`` and ``/opt`` locations.
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun**Q:** What do we need to ship for license compliance?
191*4882a593Smuzhiyun
192*4882a593Smuzhiyun**A:** This is a difficult question and you need to consult your lawyer
193*4882a593Smuzhiyunfor the answer for your specific case. It is worth bearing in mind that
194*4882a593Smuzhiyunfor GPL compliance, there needs to be enough information shipped to
195*4882a593Smuzhiyunallow someone else to rebuild and produce the same end result you are
196*4882a593Smuzhiyunshipping. This means sharing the source code, any patches applied to it,
197*4882a593Smuzhiyunand also any configuration information about how that package was
198*4882a593Smuzhiyunconfigured and built.
199*4882a593Smuzhiyun
200*4882a593SmuzhiyunYou can find more information on licensing in the
201*4882a593Smuzhiyun":ref:`overview-manual/development-environment:licensing`"
202*4882a593Smuzhiyunsection in the Yocto
203*4882a593SmuzhiyunProject Overview and Concepts Manual and also in the
204*4882a593Smuzhiyun":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`"
205*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun**Q:** How do I disable the cursor on my touchscreen device?
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun**A:** You need to create a form factor file as described in the
210*4882a593Smuzhiyun":ref:`bsp-guide/bsp:miscellaneous bsp-specific recipe files`" section in
211*4882a593Smuzhiyunthe Yocto Project Board Support Packages (BSP) Developer's Guide. Set
212*4882a593Smuzhiyunthe ``HAVE_TOUCHSCREEN`` variable equal to one as follows::
213*4882a593Smuzhiyun
214*4882a593Smuzhiyun   HAVE_TOUCHSCREEN=1
215*4882a593Smuzhiyun
216*4882a593Smuzhiyun**Q:** How do I make sure connected network interfaces are brought up by
217*4882a593Smuzhiyundefault?
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun**A:** The default interfaces file provided by the netbase recipe does
220*4882a593Smuzhiyunnot automatically bring up network interfaces. Therefore, you will need
221*4882a593Smuzhiyunto add a BSP-specific netbase that includes an interfaces file. See the
222*4882a593Smuzhiyun":ref:`bsp-guide/bsp:miscellaneous bsp-specific recipe files`" section in
223*4882a593Smuzhiyunthe Yocto Project Board Support Packages (BSP) Developer's Guide for
224*4882a593Smuzhiyuninformation on creating these types of miscellaneous recipe files.
225*4882a593Smuzhiyun
226*4882a593SmuzhiyunFor example, add the following files to your layer::
227*4882a593Smuzhiyun
228*4882a593Smuzhiyun   meta-MACHINE/recipes-bsp/netbase/netbase/MACHINE/interfaces
229*4882a593Smuzhiyun   meta-MACHINE/recipes-bsp/netbase/netbase_5.0.bbappend
230*4882a593Smuzhiyun
231*4882a593Smuzhiyun**Q:** How do I create images with more free space?
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun**A:** By default, the OpenEmbedded build system creates images that are
234*4882a593Smuzhiyun1.3 times the size of the populated root filesystem. To affect the image
235*4882a593Smuzhiyunsize, you need to set various configurations:
236*4882a593Smuzhiyun
237*4882a593Smuzhiyun-  *Image Size:* The OpenEmbedded build system uses the
238*4882a593Smuzhiyun   :term:`IMAGE_ROOTFS_SIZE` variable to define
239*4882a593Smuzhiyun   the size of the image in Kbytes. The build system determines the size
240*4882a593Smuzhiyun   by taking into account the initial root filesystem size before any
241*4882a593Smuzhiyun   modifications such as requested size for the image and any requested
242*4882a593Smuzhiyun   additional free disk space to be added to the image.
243*4882a593Smuzhiyun
244*4882a593Smuzhiyun-  *Overhead:* Use the
245*4882a593Smuzhiyun   :term:`IMAGE_OVERHEAD_FACTOR` variable
246*4882a593Smuzhiyun   to define the multiplier that the build system applies to the initial
247*4882a593Smuzhiyun   image size, which is 1.3 by default.
248*4882a593Smuzhiyun
249*4882a593Smuzhiyun-  *Additional Free Space:* Use the
250*4882a593Smuzhiyun   :term:`IMAGE_ROOTFS_EXTRA_SPACE`
251*4882a593Smuzhiyun   variable to add additional free space to the image. The build system
252*4882a593Smuzhiyun   adds this space to the image after it determines its
253*4882a593Smuzhiyun   :term:`IMAGE_ROOTFS_SIZE`.
254*4882a593Smuzhiyun
255*4882a593Smuzhiyun**Q:** Why don't you support directories with spaces in the pathnames?
256*4882a593Smuzhiyun
257*4882a593Smuzhiyun**A:** The Yocto Project team has tried to do this before but too many
258*4882a593Smuzhiyunof the tools the OpenEmbedded build system depends on, such as
259*4882a593Smuzhiyun``autoconf``, break when they find spaces in pathnames. Until that
260*4882a593Smuzhiyunsituation changes, the team will not support spaces in pathnames.
261*4882a593Smuzhiyun
262*4882a593Smuzhiyun**Q:** How do I use an external toolchain?
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun**A:** The toolchain configuration is very flexible and customizable. It
265*4882a593Smuzhiyunis primarily controlled with the :term:`TCMODE` variable. This variable
266*4882a593Smuzhiyuncontrols which ``tcmode-*.inc`` file to include from the
267*4882a593Smuzhiyun``meta/conf/distro/include`` directory within the :term:`Source Directory`.
268*4882a593Smuzhiyun
269*4882a593SmuzhiyunThe default value of :term:`TCMODE` is "default", which tells the
270*4882a593SmuzhiyunOpenEmbedded build system to use its internally built toolchain (i.e.
271*4882a593Smuzhiyun``tcmode-default.inc``). However, other patterns are accepted. In
272*4882a593Smuzhiyunparticular, "external-\*" refers to external toolchains. One example is
273*4882a593Smuzhiyunthe Sourcery G++ Toolchain. The support for this toolchain resides in
274*4882a593Smuzhiyunthe separate ``meta-sourcery`` layer at
275*4882a593Smuzhiyunhttps://github.com/MentorEmbedded/meta-sourcery/.
276*4882a593Smuzhiyun
277*4882a593SmuzhiyunIn addition to the toolchain configuration, you also need a
278*4882a593Smuzhiyuncorresponding toolchain recipe file. This recipe file needs to package
279*4882a593Smuzhiyunup any pre-built objects in the toolchain such as ``libgcc``,
280*4882a593Smuzhiyun``libstdcc++``, any locales, and ``libc``.
281*4882a593Smuzhiyun
282*4882a593Smuzhiyun**Q:** How does the OpenEmbedded build system obtain source code and
283*4882a593Smuzhiyunwill it work behind my firewall or proxy server?
284*4882a593Smuzhiyun
285*4882a593Smuzhiyun**A:** The way the build system obtains source code is highly
286*4882a593Smuzhiyunconfigurable. You can setup the build system to get source code in most
287*4882a593Smuzhiyunenvironments if HTTP transport is available.
288*4882a593Smuzhiyun
289*4882a593SmuzhiyunWhen the build system searches for source code, it first tries the local
290*4882a593Smuzhiyundownload directory. If that location fails, Poky tries
291*4882a593Smuzhiyun:term:`PREMIRRORS`, the upstream source, and then
292*4882a593Smuzhiyun:term:`MIRRORS` in that order.
293*4882a593Smuzhiyun
294*4882a593SmuzhiyunAssuming your distribution is "poky", the OpenEmbedded build system uses
295*4882a593Smuzhiyunthe Yocto Project source :term:`PREMIRRORS` by default for SCM-based
296*4882a593Smuzhiyunsources, upstreams for normal tarballs, and then falls back to a number
297*4882a593Smuzhiyunof other mirrors including the Yocto Project source mirror if those
298*4882a593Smuzhiyunfail.
299*4882a593Smuzhiyun
300*4882a593SmuzhiyunAs an example, you could add a specific server for the build system to
301*4882a593Smuzhiyunattempt before any others by adding something like the following to the
302*4882a593Smuzhiyun``local.conf`` configuration file::
303*4882a593Smuzhiyun
304*4882a593Smuzhiyun   PREMIRRORS:prepend = "\
305*4882a593Smuzhiyun       git://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
306*4882a593Smuzhiyun       ftp://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
307*4882a593Smuzhiyun       http://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
308*4882a593Smuzhiyun       https://.*/.* &YOCTO_DL_URL;/mirror/sources/"
309*4882a593Smuzhiyun
310*4882a593SmuzhiyunThese changes cause the build system to intercept Git, FTP, HTTP, and
311*4882a593SmuzhiyunHTTPS requests and direct them to the ``http://`` sources mirror. You
312*4882a593Smuzhiyuncan use ``file://`` URLs to point to local directories or network shares
313*4882a593Smuzhiyunas well.
314*4882a593Smuzhiyun
315*4882a593SmuzhiyunHere are other options::
316*4882a593Smuzhiyun
317*4882a593Smuzhiyun   BB_NO_NETWORK = "1"
318*4882a593Smuzhiyun
319*4882a593SmuzhiyunThis statement tells BitBake to issue an error
320*4882a593Smuzhiyuninstead of trying to access the Internet. This technique is useful if
321*4882a593Smuzhiyunyou want to ensure code builds only from local sources.
322*4882a593Smuzhiyun
323*4882a593SmuzhiyunHere is another technique::
324*4882a593Smuzhiyun
325*4882a593Smuzhiyun   BB_FETCH_PREMIRRORONLY = "1"
326*4882a593Smuzhiyun
327*4882a593SmuzhiyunThis statement
328*4882a593Smuzhiyunlimits the build system to pulling source from the :term:`PREMIRRORS` only.
329*4882a593SmuzhiyunAgain, this technique is useful for reproducing builds.
330*4882a593Smuzhiyun
331*4882a593SmuzhiyunHere is another technique::
332*4882a593Smuzhiyun
333*4882a593Smuzhiyun   BB_GENERATE_MIRROR_TARBALLS = "1"
334*4882a593Smuzhiyun
335*4882a593SmuzhiyunThis
336*4882a593Smuzhiyunstatement tells the build system to generate mirror tarballs. This
337*4882a593Smuzhiyuntechnique is useful if you want to create a mirror server. If not,
338*4882a593Smuzhiyunhowever, the technique can simply waste time during the build.
339*4882a593Smuzhiyun
340*4882a593SmuzhiyunFinally, consider an example where you are behind an HTTP-only firewall.
341*4882a593SmuzhiyunYou could make the following changes to the ``local.conf`` configuration
342*4882a593Smuzhiyunfile as long as the :term:`PREMIRRORS` server is current::
343*4882a593Smuzhiyun
344*4882a593Smuzhiyun   PREMIRRORS:prepend = "\
345*4882a593Smuzhiyun       git://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
346*4882a593Smuzhiyun       ftp://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
347*4882a593Smuzhiyun       http://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
348*4882a593Smuzhiyun       https://.*/.* &YOCTO_DL_URL;/mirror/sources/"
349*4882a593Smuzhiyun   BB_FETCH_PREMIRRORONLY = "1"
350*4882a593Smuzhiyun
351*4882a593SmuzhiyunThese changes would cause the build system to successfully fetch source
352*4882a593Smuzhiyunover HTTP and any network accesses to anything other than the
353*4882a593Smuzhiyun:term:`PREMIRRORS` would fail.
354*4882a593Smuzhiyun
355*4882a593SmuzhiyunThe build system also honors the standard shell environment variables
356*4882a593Smuzhiyun``http_proxy``, ``ftp_proxy``, ``https_proxy``, and ``all_proxy`` to
357*4882a593Smuzhiyunredirect requests through proxy servers.
358*4882a593Smuzhiyun
359*4882a593Smuzhiyun.. note::
360*4882a593Smuzhiyun
361*4882a593Smuzhiyun   You can find more information on the
362*4882a593Smuzhiyun   ":yocto_wiki:`Working Behind a Network Proxy </Working_Behind_a_Network_Proxy>`"
363*4882a593Smuzhiyun   Wiki page.
364*4882a593Smuzhiyun
365*4882a593Smuzhiyun**Q:** Can I get rid of build output so I can start over?
366*4882a593Smuzhiyun
367*4882a593Smuzhiyun**A:** Yes - you can easily do this. When you use BitBake to build an
368*4882a593Smuzhiyunimage, all the build output goes into the directory created when you run
369*4882a593Smuzhiyunthe build environment setup script (i.e.
370*4882a593Smuzhiyun:ref:`structure-core-script`). By default, this :term:`Build Directory`
371*4882a593Smuzhiyunis named ``build`` but can be named
372*4882a593Smuzhiyunanything you want.
373*4882a593Smuzhiyun
374*4882a593SmuzhiyunWithin the Build Directory, is the ``tmp`` directory. To remove all the
375*4882a593Smuzhiyunbuild output yet preserve any source code or downloaded files from
376*4882a593Smuzhiyunprevious builds, simply remove the ``tmp`` directory.
377*4882a593Smuzhiyun
378*4882a593Smuzhiyun**Q:** Why do ``${bindir}`` and ``${libdir}`` have strange values for
379*4882a593Smuzhiyun``-native`` recipes?
380*4882a593Smuzhiyun
381*4882a593Smuzhiyun**A:** Executables and libraries might need to be used from a directory
382*4882a593Smuzhiyunother than the directory into which they were initially installed.
383*4882a593SmuzhiyunComplicating this situation is the fact that sometimes these executables
384*4882a593Smuzhiyunand libraries are compiled with the expectation of being run from that
385*4882a593Smuzhiyuninitial installation target directory. If this is the case, moving them
386*4882a593Smuzhiyuncauses problems.
387*4882a593Smuzhiyun
388*4882a593SmuzhiyunThis scenario is a fundamental problem for package maintainers of
389*4882a593Smuzhiyunmainstream Linux distributions as well as for the OpenEmbedded build
390*4882a593Smuzhiyunsystem. As such, a well-established solution exists. Makefiles,
391*4882a593SmuzhiyunAutotools configuration scripts, and other build systems are expected to
392*4882a593Smuzhiyunrespect environment variables such as ``bindir``, ``libdir``, and
393*4882a593Smuzhiyun``sysconfdir`` that indicate where executables, libraries, and data
394*4882a593Smuzhiyunreside when a program is actually run. They are also expected to respect
395*4882a593Smuzhiyuna ``DESTDIR`` environment variable, which is prepended to all the other
396*4882a593Smuzhiyunvariables when the build system actually installs the files. It is
397*4882a593Smuzhiyununderstood that the program does not actually run from within
398*4882a593Smuzhiyun``DESTDIR``.
399*4882a593Smuzhiyun
400*4882a593SmuzhiyunWhen the OpenEmbedded build system uses a recipe to build a
401*4882a593Smuzhiyuntarget-architecture program (i.e. one that is intended for inclusion on
402*4882a593Smuzhiyunthe image being built), that program eventually runs from the root file
403*4882a593Smuzhiyunsystem of that image. Thus, the build system provides a value of
404*4882a593Smuzhiyun"/usr/bin" for ``bindir``, a value of "/usr/lib" for ``libdir``, and so
405*4882a593Smuzhiyunforth.
406*4882a593Smuzhiyun
407*4882a593SmuzhiyunMeanwhile, ``DESTDIR`` is a path within the :term:`Build Directory`.
408*4882a593SmuzhiyunHowever, when the recipe builds a
409*4882a593Smuzhiyunnative program (i.e. one that is intended to run on the build machine),
410*4882a593Smuzhiyunthat program is never installed directly to the build machine's root
411*4882a593Smuzhiyunfile system. Consequently, the build system uses paths within the Build
412*4882a593SmuzhiyunDirectory for ``DESTDIR``, ``bindir`` and related variables. To better
413*4882a593Smuzhiyununderstand this, consider the following two paths where the first is
414*4882a593Smuzhiyunrelatively normal and the second is not:
415*4882a593Smuzhiyun
416*4882a593Smuzhiyun.. note::
417*4882a593Smuzhiyun
418*4882a593Smuzhiyun   Due to these lengthy examples, the paths are artificially broken
419*4882a593Smuzhiyun   across lines for readability.
420*4882a593Smuzhiyun
421*4882a593Smuzhiyun::
422*4882a593Smuzhiyun
423*4882a593Smuzhiyun   /home/maxtothemax/poky-bootchart2/build/tmp/work/i586-poky-linux/zlib/
424*4882a593Smuzhiyun      1.2.8-r0/sysroot-destdir/usr/bin
425*4882a593Smuzhiyun
426*4882a593Smuzhiyun   /home/maxtothemax/poky-bootchart2/build/tmp/work/x86_64-linux/
427*4882a593Smuzhiyun      zlib-native/1.2.8-r0/sysroot-destdir/home/maxtothemax/poky-bootchart2/
428*4882a593Smuzhiyun      build/tmp/sysroots/x86_64-linux/usr/bin
429*4882a593Smuzhiyun
430*4882a593SmuzhiyunEven if the paths look unusual,
431*4882a593Smuzhiyunthey both are correct - the first for a target and the second for a
432*4882a593Smuzhiyunnative recipe. These paths are a consequence of the ``DESTDIR``
433*4882a593Smuzhiyunmechanism and while they appear strange, they are correct and in
434*4882a593Smuzhiyunpractice very effective.
435*4882a593Smuzhiyun
436*4882a593Smuzhiyun**Q:** The files provided by my ``*-native`` recipe do not appear to be
437*4882a593Smuzhiyunavailable to other recipes. Files are missing from the native sysroot,
438*4882a593Smuzhiyunmy recipe is installing to the wrong place, or I am getting permissions
439*4882a593Smuzhiyunerrors during the do_install task in my recipe! What is wrong?
440*4882a593Smuzhiyun
441*4882a593Smuzhiyun**A:** This situation results when a build system does not recognize the
442*4882a593Smuzhiyunenvironment variables supplied to it by :term:`BitBake`. The
443*4882a593Smuzhiyunincident that prompted this FAQ entry involved a Makefile that used an
444*4882a593Smuzhiyunenvironment variable named ``BINDIR`` instead of the more standard
445*4882a593Smuzhiyunvariable ``bindir``. The makefile's hardcoded default value of
446*4882a593Smuzhiyun"/usr/bin" worked most of the time, but not for the recipe's ``-native``
447*4882a593Smuzhiyunvariant. For another example, permissions errors might be caused by a
448*4882a593SmuzhiyunMakefile that ignores ``DESTDIR`` or uses a different name for that
449*4882a593Smuzhiyunenvironment variable. Check the build system to see if these kinds
450*4882a593Smuzhiyunof issues exist.
451*4882a593Smuzhiyun
452*4882a593Smuzhiyun**Q:** I'm adding a binary in a recipe but it's different in the image, what is
453*4882a593Smuzhiyunchanging it?
454*4882a593Smuzhiyun
455*4882a593Smuzhiyun**A:** The first most obvious change is the system stripping debug symbols from
456*4882a593Smuzhiyunit. Setting :term:`INHIBIT_PACKAGE_STRIP` to stop debug symbols being stripped and/or
457*4882a593Smuzhiyun:term:`INHIBIT_PACKAGE_DEBUG_SPLIT` to stop debug symbols being split into a separate
458*4882a593Smuzhiyunfile will ensure the binary is unchanged.
459