blob: a570c40e7dd6edd9cb0068707a242f0bb2e7ad8e [file] [log] [blame]
Andrew Geisslerf0343792020-11-18 10:42:21 -06001.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
Andrew Geisslerc9f78652020-09-18 14:11:35 -05002
3***
4FAQ
5***
6
Patrick Williams975a06f2022-10-21 14:42:47 -05007.. contents::
Andrew Geisslerc9f78652020-09-18 14:11:35 -05008
Patrick Williams975a06f2022-10-21 14:42:47 -05009General questions
10=================
11
12How does Poky differ from OpenEmbedded?
13---------------------------------------
14
15The term ``Poky`` refers to the specific reference build
Andrew Geisslerc9f78652020-09-18 14:11:35 -050016system that the Yocto Project provides. Poky is based on
17:term:`OpenEmbedded-Core (OE-Core)` and :term:`BitBake`. Thus, the
18generic term used here for the build system is the "OpenEmbedded build
19system." Development in the Yocto Project using Poky is closely tied to
20OpenEmbedded, with changes always being merged to OE-Core or BitBake
21first before being pulled back into Poky. This practice benefits both
22projects immediately.
23
Patrick Williams975a06f2022-10-21 14:42:47 -050024How can you claim Poky / OpenEmbedded-Core is stable?
25-----------------------------------------------------
Andrew Geisslerc9f78652020-09-18 14:11:35 -050026
Patrick Williams975a06f2022-10-21 14:42:47 -050027There are three areas that help with stability;
Andrew Geisslerc9f78652020-09-18 14:11:35 -050028
29- The Yocto Project team keeps :term:`OpenEmbedded-Core (OE-Core)` small and
30 focused, containing around 830 recipes as opposed to the thousands
31 available in other OpenEmbedded community layers. Keeping it small
32 makes it easy to test and maintain.
33
34- The Yocto Project team runs manual and automated tests using a small,
35 fixed set of reference hardware as well as emulated targets.
36
Patrick Williams975a06f2022-10-21 14:42:47 -050037- The Yocto Project uses an :yocto_ab:`autobuilder <>`, which provides
38 continuous build and integration tests.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050039
Patrick Williams975a06f2022-10-21 14:42:47 -050040Are there any products built using the OpenEmbedded build system?
41-----------------------------------------------------------------
Andrew Geisslerc9f78652020-09-18 14:11:35 -050042
Patrick Williams975a06f2022-10-21 14:42:47 -050043See :yocto_wiki:`Products that use the Yocto Project
Patrick Williams2194f502022-10-16 14:26:09 -050044</Project_Users#Products_that_use_the_Yocto_Project>` in the Yocto Project
45Wiki. Don't hesitate to contribute to this page if you know other such
46products.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050047
Patrick Williams975a06f2022-10-21 14:42:47 -050048Building environment
49====================
Andrew Geisslerc9f78652020-09-18 14:11:35 -050050
Patrick Williams975a06f2022-10-21 14:42:47 -050051Missing dependencies on the development system?
52-----------------------------------------------
Andrew Geisslerc9f78652020-09-18 14:11:35 -050053
Patrick Williams975a06f2022-10-21 14:42:47 -050054If your development system does not meet the required Git, tar, and
55Python versions, you can get the required tools on your host development
56system in different ways (i.e. building a tarball or downloading a
57tarball). See the ":ref:`ref-manual/system-requirements:required git, tar, python, make and gcc versions`"
58section for steps on how to update your build tools.
Andrew Geisslerc9f78652020-09-18 14:11:35 -050059
Patrick Williams975a06f2022-10-21 14:42:47 -050060How does OpenEmbedded fetch source code? Will it work through a firewall or proxy server?
61-----------------------------------------------------------------------------------------
Andrew Geisslerc9f78652020-09-18 14:11:35 -050062
Patrick Williams975a06f2022-10-21 14:42:47 -050063The way the build system obtains source code is highly
Andrew Geisslerc9f78652020-09-18 14:11:35 -050064configurable. You can setup the build system to get source code in most
65environments if HTTP transport is available.
66
67When the build system searches for source code, it first tries the local
68download directory. If that location fails, Poky tries
69:term:`PREMIRRORS`, the upstream source, and then
70:term:`MIRRORS` in that order.
71
72Assuming your distribution is "poky", the OpenEmbedded build system uses
Andrew Geissler5f350902021-07-23 13:09:54 -040073the Yocto Project source :term:`PREMIRRORS` by default for SCM-based
Andrew Geisslerc9f78652020-09-18 14:11:35 -050074sources, upstreams for normal tarballs, and then falls back to a number
75of other mirrors including the Yocto Project source mirror if those
76fail.
77
78As an example, you could add a specific server for the build system to
79attempt before any others by adding something like the following to the
Andrew Geisslerc926e172021-05-07 16:11:35 -050080``local.conf`` configuration file::
Andrew Geisslerc9f78652020-09-18 14:11:35 -050081
Patrick Williams0ca19cc2021-08-16 14:03:13 -050082 PREMIRRORS:prepend = "\
Andrew Geissler595f6302022-01-24 19:11:47 +000083 git://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
84 ftp://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
85 http://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
86 https://.*/.* &YOCTO_DL_URL;/mirror/sources/"
Andrew Geisslerc9f78652020-09-18 14:11:35 -050087
88These changes cause the build system to intercept Git, FTP, HTTP, and
89HTTPS requests and direct them to the ``http://`` sources mirror. You
90can use ``file://`` URLs to point to local directories or network shares
91as well.
92
William A. Kennington IIIac69b482021-06-02 12:28:27 -070093Here are other options::
Andrew Geisslerc9f78652020-09-18 14:11:35 -050094
95 BB_NO_NETWORK = "1"
96
97This statement tells BitBake to issue an error
98instead of trying to access the Internet. This technique is useful if
99you want to ensure code builds only from local sources.
100
Andrew Geisslerc926e172021-05-07 16:11:35 -0500101Here is another technique::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500102
103 BB_FETCH_PREMIRRORONLY = "1"
104
Patrick Williams975a06f2022-10-21 14:42:47 -0500105This statement limits the build system to pulling source from the
106:term:`PREMIRRORS` only. Again, this technique is useful for reproducing
107builds.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500108
Andrew Geisslerc926e172021-05-07 16:11:35 -0500109Here is another technique::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500110
111 BB_GENERATE_MIRROR_TARBALLS = "1"
112
Patrick Williams975a06f2022-10-21 14:42:47 -0500113This statement tells the build system to generate mirror tarballs. This
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500114technique is useful if you want to create a mirror server. If not,
115however, the technique can simply waste time during the build.
116
117Finally, consider an example where you are behind an HTTP-only firewall.
118You could make the following changes to the ``local.conf`` configuration
Andrew Geissler09036742021-06-25 14:25:14 -0500119file as long as the :term:`PREMIRRORS` server is current::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500120
Patrick Williams0ca19cc2021-08-16 14:03:13 -0500121 PREMIRRORS:prepend = "\
Andrew Geissler595f6302022-01-24 19:11:47 +0000122 git://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
123 ftp://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
124 http://.*/.* &YOCTO_DL_URL;/mirror/sources/ \
125 https://.*/.* &YOCTO_DL_URL;/mirror/sources/"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500126 BB_FETCH_PREMIRRORONLY = "1"
127
128These changes would cause the build system to successfully fetch source
129over HTTP and any network accesses to anything other than the
Andrew Geissler09036742021-06-25 14:25:14 -0500130:term:`PREMIRRORS` would fail.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500131
Patrick Williams975a06f2022-10-21 14:42:47 -0500132Most source fetching by the OpenEmbedded build system is done by
133``wget`` and you therefore need to specify the proxy settings in a
134``.wgetrc`` file, which can be in your home directory if you are a
135single user or can be in ``/usr/local/etc/wgetrc`` as a global user
136file.
137
138Following is the applicable code for setting various proxy types in the
139``.wgetrc`` file. By default, these settings are disabled with comments.
140To use them, remove the comments::
141
142 # You can set the default proxies for Wget to use for http, https, and ftp.
143 # They will override the value in the environment.
144 #https_proxy = http://proxy.yoyodyne.com:18023/
145 #http_proxy = http://proxy.yoyodyne.com:18023/
146 #ftp_proxy = http://proxy.yoyodyne.com:18023/
147
148 # If you do not want to use proxy at all, set this to off.
149 #use_proxy = on
150
151The build system also accepts ``http_proxy``, ``ftp_proxy``, ``https_proxy``,
152and ``all_proxy`` set as to standard shell environment variables to redirect
153requests through proxy servers.
154
155The Yocto Project also includes a
156``meta-poky/conf/templates/default/site.conf.sample`` file that shows
157how to configure CVS and Git proxy servers if needed.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500158
159.. note::
160
161 You can find more information on the
Andrew Geissler09209ee2020-12-13 08:44:15 -0600162 ":yocto_wiki:`Working Behind a Network Proxy </Working_Behind_a_Network_Proxy>`"
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500163 Wiki page.
164
Patrick Williams975a06f2022-10-21 14:42:47 -0500165Using the OpenEmbedded Build system
166===================================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500167
Patrick Williams975a06f2022-10-21 14:42:47 -0500168How do I use an external toolchain?
169-----------------------------------
170
171The toolchain configuration is very flexible and customizable. It
172is primarily controlled with the :term:`TCMODE` variable. This variable
173controls which ``tcmode-*.inc`` file to include from the
174``meta/conf/distro/include`` directory within the :term:`Source Directory`.
175
176The default value of :term:`TCMODE` is "default", which tells the
177OpenEmbedded build system to use its internally built toolchain (i.e.
178``tcmode-default.inc``). However, other patterns are accepted. In
179particular, "external-\*" refers to external toolchains. One example is
180the Sourcery G++ Toolchain. The support for this toolchain resides in
181the separate ``meta-sourcery`` layer at
182https://github.com/MentorEmbedded/meta-sourcery/.
183
184In addition to the toolchain configuration, you also need a
185corresponding toolchain recipe file. This recipe file needs to package
186up any pre-built objects in the toolchain such as ``libgcc``,
187``libstdcc++``, any locales, and ``libc``.
188
189Why do I get chmod permission issues?
190-------------------------------------
191
192If you see the error
193``chmod: XXXXX new permissions are r-xrwxrwx, not r-xr-xr-x``,
194you are probably running the build on an NTFS filesystem. Instead,
195run the build system on a partition with a modern Linux filesystem such as
196``ext4``, ``btrfs`` or ``xfs``.
197
198I see many 404 errors trying to download sources. Is anything wrong?
199--------------------------------------------------------------------
200
201Nothing is wrong. The OpenEmbedded build system checks any
202configured source mirrors before downloading from the upstream sources.
203The build system does this searching for both source archives and
204pre-checked out versions of SCM-managed software. These checks help in
205large installations because it can reduce load on the SCM servers
206themselves. This can also allow builds to continue to work if an
207upstream source disappears.
208
209Why do I get random build failures?
210-----------------------------------
211
212If the same build is failing in totally different and random
213ways, the most likely explanation is:
214
215- The hardware you are running the build on has some problem.
216
217- You are running the build under virtualization, in which case the
218 virtualization probably has bugs.
219
220The OpenEmbedded build system processes a massive amount of data that
221causes lots of network, disk and CPU activity and is sensitive to even
222single-bit failures in any of these areas. True random failures have
223always been traced back to hardware or virtualization issues.
224
225Why does the build fail with ``iconv.h`` problems?
226--------------------------------------------------
227
228When you try to build a native recipe, you may get an error message that
229indicates that GNU ``libiconv`` is not in use but ``iconv.h`` has been
230included from ``libiconv``::
231
232 #error GNU libiconv not in use but included iconv.h is from libiconv
233
234When this happens, you need to check whether you have a previously
235installed version of the header file in ``/usr/local/include/``.
236If that's the case, you should either uninstall it or temporarily rename
237it and try the build again.
238
239This issue is just a single manifestation of "system leakage" issues
240caused when the OpenEmbedded build system finds and uses previously
241installed files during a native build. This type of issue might not be
242limited to ``iconv.h``. Make sure that leakage cannot occur from
243``/usr/local/include`` and ``/opt`` locations.
244
245Why don't other recipes find the files provided by my ``*-native`` recipe?
246--------------------------------------------------------------------------
247
248Files provided by your native recipe could be missing from the native
249sysroot, your recipe could also be installing to the wrong place, or you
250could be getting permission errors during the :ref:`ref-tasks-install`
251task in your recipe.
252
253This situation happens when the build system used by a package does not
254recognize the environment variables supplied to it by :term:`BitBake`. The
255incident that prompted this FAQ entry involved a Makefile that used an
256environment variable named ``BINDIR`` instead of the more standard
257variable ``bindir``. The makefile's hardcoded default value of
258"/usr/bin" worked most of the time, but not for the recipe's ``-native``
259variant. For another example, permission errors might be caused by a
260Makefile that ignores ``DESTDIR`` or uses a different name for that
261environment variable. Check the build system of the package to see if
262these kinds of issues exist.
263
264Can I get rid of build output so I can start over?
265--------------------------------------------------
266
267Yes --- you can easily do this. When you use BitBake to build an
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500268image, all the build output goes into the directory created when you run
Patrick Williams975a06f2022-10-21 14:42:47 -0500269the build environment setup script (i.e. :ref:`structure-core-script`).
270By default, this :term:`Build Directory` is named ``build`` but can be named
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500271anything you want.
272
273Within the Build Directory, is the ``tmp`` directory. To remove all the
274build output yet preserve any source code or downloaded files from
275previous builds, simply remove the ``tmp`` directory.
276
Patrick Williams975a06f2022-10-21 14:42:47 -0500277Customizing generated images
278============================
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500279
Patrick Williams975a06f2022-10-21 14:42:47 -0500280What does the OpenEmbedded build system produce as output?
281----------------------------------------------------------
282
283Because you can use the same set of recipes to create output of
284various formats, the output of an OpenEmbedded build depends on how you
285start it. Usually, the output is a flashable image ready for the target
286device.
287
288How do I make the Yocto Project support my board?
289-------------------------------------------------
290
291Support for an additional board is added by creating a Board
292Support Package (BSP) layer for it. For more information on how to
293create a BSP layer, see the
294":ref:`dev-manual/common-tasks:understanding and creating layers`"
295section in the Yocto Project Development Tasks Manual and the
296:doc:`/bsp-guide/index`.
297
298Usually, if the board is not completely exotic, adding support in the
299Yocto Project is fairly straightforward.
300
301How do I make the Yocto Project support my package?
302---------------------------------------------------
303
304To add a package, you need to create a BitBake recipe. For
305information on how to create a BitBake recipe, see the
306":ref:`dev-manual/common-tasks:writing a new recipe`"
307section in the Yocto Project Development Tasks Manual.
308
309What do I need to ship for license compliance?
310----------------------------------------------
311
312This is a difficult question and you need to consult your lawyer
313for the answer for your specific case. It is worth bearing in mind that
314for GPL compliance, there needs to be enough information shipped to
315allow someone else to rebuild and produce the same end result you are
316shipping. This means sharing the source code, any patches applied to it,
317and also any configuration information about how that package was
318configured and built.
319
320You can find more information on licensing in the
321":ref:`overview-manual/development-environment:licensing`"
322section in the Yocto Project Overview and Concepts Manual and also in the
323":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`"
324section in the Yocto Project Development Tasks Manual.
325
326Do I have to make a full reflash after recompiling one package?
327---------------------------------------------------------------
328
329The OpenEmbedded build system can build packages in various
330formats such as IPK for OPKG, Debian package (``.deb``), or RPM. You can
331then upgrade only the modified packages using the package tools on the device,
332much like on a desktop distribution such as Ubuntu or Fedora. However,
333package management on the target is entirely optional.
334
335How to prevent my package from being marked as machine specific?
336----------------------------------------------------------------
337
338If you have machine-specific data in a package for one machine only
339but the package is being marked as machine-specific in all cases,
340you can set :term:`SRC_URI_OVERRIDES_PACKAGE_ARCH` = "0" in the ``.bb`` file.
341However, but make sure the package is manually marked as machine-specific for the
342case that needs it. The code that handles :term:`SRC_URI_OVERRIDES_PACKAGE_ARCH`
343is in the ``meta/classes-global/base.bbclass`` file.
344
345What's the difference between ``target`` and ``target-native``?
346---------------------------------------------------------------
347
348The ``*-native`` targets are designed to run on the system being
349used for the build. These are usually tools that are needed to assist
350the build in some way such as ``quilt-native``, which is used to apply
351patches. The non-native version is the one that runs on the target
352device.
353
354Why do ``${bindir}`` and ``${libdir}`` have strange values for ``-native`` recipes?
355-----------------------------------------------------------------------------------
356
357Executables and libraries might need to be used from a directory
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500358other than the directory into which they were initially installed.
359Complicating this situation is the fact that sometimes these executables
360and libraries are compiled with the expectation of being run from that
361initial installation target directory. If this is the case, moving them
362causes problems.
363
364This scenario is a fundamental problem for package maintainers of
365mainstream Linux distributions as well as for the OpenEmbedded build
366system. As such, a well-established solution exists. Makefiles,
367Autotools configuration scripts, and other build systems are expected to
368respect environment variables such as ``bindir``, ``libdir``, and
369``sysconfdir`` that indicate where executables, libraries, and data
370reside when a program is actually run. They are also expected to respect
371a ``DESTDIR`` environment variable, which is prepended to all the other
372variables when the build system actually installs the files. It is
373understood that the program does not actually run from within
374``DESTDIR``.
375
376When the OpenEmbedded build system uses a recipe to build a
377target-architecture program (i.e. one that is intended for inclusion on
378the image being built), that program eventually runs from the root file
379system of that image. Thus, the build system provides a value of
380"/usr/bin" for ``bindir``, a value of "/usr/lib" for ``libdir``, and so
381forth.
382
383Meanwhile, ``DESTDIR`` is a path within the :term:`Build Directory`.
384However, when the recipe builds a
385native program (i.e. one that is intended to run on the build machine),
386that program is never installed directly to the build machine's root
387file system. Consequently, the build system uses paths within the Build
388Directory for ``DESTDIR``, ``bindir`` and related variables. To better
Patrick Williams975a06f2022-10-21 14:42:47 -0500389understand this, consider the following two paths (artificially broken
390across lines for readability) where the first is relatively normal and
391the second is not::
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500392
393 /home/maxtothemax/poky-bootchart2/build/tmp/work/i586-poky-linux/zlib/
394 1.2.8-r0/sysroot-destdir/usr/bin
395
396 /home/maxtothemax/poky-bootchart2/build/tmp/work/x86_64-linux/
397 zlib-native/1.2.8-r0/sysroot-destdir/home/maxtothemax/poky-bootchart2/
398 build/tmp/sysroots/x86_64-linux/usr/bin
399
Patrick Williams975a06f2022-10-21 14:42:47 -0500400Even if the paths look unusual, they both are correct --- the first for
401a target and the second for a native recipe. These paths are a consequence
402of the ``DESTDIR`` mechanism and while they appear strange, they are correct
403and in practice very effective.
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500404
Patrick Williams975a06f2022-10-21 14:42:47 -0500405How do I create images with more free space?
406--------------------------------------------
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500407
Patrick Williams975a06f2022-10-21 14:42:47 -0500408By default, the OpenEmbedded build system creates images that are
4091.3 times the size of the populated root filesystem. To affect the image
410size, you need to set various configurations:
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600411
Patrick Williams975a06f2022-10-21 14:42:47 -0500412- *Image Size:* The OpenEmbedded build system uses the
413 :term:`IMAGE_ROOTFS_SIZE` variable to define
414 the size of the image in Kbytes. The build system determines the size
415 by taking into account the initial root filesystem size before any
416 modifications such as requested size for the image and any requested
417 additional free disk space to be added to the image.
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600418
Patrick Williams975a06f2022-10-21 14:42:47 -0500419- *Overhead:* Use the
420 :term:`IMAGE_OVERHEAD_FACTOR` variable
421 to define the multiplier that the build system applies to the initial
422 image size, which is 1.3 by default.
423
424- *Additional Free Space:* Use the
425 :term:`IMAGE_ROOTFS_EXTRA_SPACE`
426 variable to add additional free space to the image. The build system
427 adds this space to the image after it determines its
428 :term:`IMAGE_ROOTFS_SIZE`.
429
430Why aren't spaces in path names supported?
431------------------------------------------
432
433The Yocto Project team has tried to do this before but too many
434of the tools the OpenEmbedded build system depends on, such as
435``autoconf``, break when they find spaces in pathnames. Until that
436situation changes, the team will not support spaces in pathnames.
437
438I'm adding a binary in a recipe. Why is it different in the image?
439------------------------------------------------------------------
440
441The first most obvious change is the system stripping debug symbols from
442it. Setting :term:`INHIBIT_PACKAGE_STRIP` to stop debug symbols being
443stripped and/or :term:`INHIBIT_PACKAGE_DEBUG_SPLIT` to stop debug symbols
444being split into a separate file will ensure the binary is unchanged.
445
446Issues on the running system
447============================
448
449How do I disable the cursor on my touchscreen device?
450-----------------------------------------------------
451
452You need to create a form factor file as described in the
453":ref:`bsp-guide/bsp:miscellaneous bsp-specific recipe files`" section in
454the Yocto Project Board Support Packages (BSP) Developer's Guide. Set
455the ``HAVE_TOUCHSCREEN`` variable equal to one as follows::
456
457 HAVE_TOUCHSCREEN=1
458
459How to always bring up connected network interfaces?
460----------------------------------------------------
461
462The default interfaces file provided by the netbase recipe does
463not automatically bring up network interfaces. Therefore, you will need
464to add a BSP-specific netbase that includes an interfaces file. See the
465":ref:`bsp-guide/bsp:miscellaneous bsp-specific recipe files`" section in
466the Yocto Project Board Support Packages (BSP) Developer's Guide for
467information on creating these types of miscellaneous recipe files.
468
469For example, add the following files to your layer::
470
471 meta-MACHINE/recipes-bsp/netbase/netbase/MACHINE/interfaces
472 meta-MACHINE/recipes-bsp/netbase/netbase_5.0.bbappend