faq.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. ***
  3. FAQ
  4. ***
  5. **Q:** How does Poky differ from :oe_home:`OpenEmbedded <>`?
  6. **A:** The term ``Poky`` refers to the specific reference build
  7. system that the Yocto Project provides. Poky is based on
  8. :term:`OpenEmbedded-Core (OE-Core)` and :term:`BitBake`. Thus, the
  9. generic term used here for the build system is the "OpenEmbedded build
  10. system." Development in the Yocto Project using Poky is closely tied to
  11. OpenEmbedded, with changes always being merged to OE-Core or BitBake
  12. first before being pulled back into Poky. This practice benefits both
  13. projects immediately.
  14. **Q:** My development system does not meet the required Git, tar, and
  15. Python versions. In particular, I do not have Python &MIN_PYTHON_VERSION; or greater.
  16. Can I still use the Yocto Project?
  17. **A:** You can get the required tools on your host development system a
  18. couple different ways (i.e. building a tarball or downloading a
  19. tarball). See the
  20. ":ref:`ref-manual/system-requirements:required git, tar, python and gcc versions`"
  21. section for steps on how to update your build tools.
  22. **Q:** How can you claim Poky / OpenEmbedded-Core is stable?
  23. **A:** There are three areas that help with stability;
  24. - The Yocto Project team keeps :term:`OpenEmbedded-Core (OE-Core)` small and
  25. focused, containing around 830 recipes as opposed to the thousands
  26. available in other OpenEmbedded community layers. Keeping it small
  27. makes it easy to test and maintain.
  28. - The Yocto Project team runs manual and automated tests using a small,
  29. fixed set of reference hardware as well as emulated targets.
  30. - The Yocto Project uses an autobuilder, which provides continuous
  31. build and integration tests.
  32. **Q:** How do I get support for my board added to the Yocto Project?
  33. **A:** Support for an additional board is added by creating a Board
  34. Support Package (BSP) layer for it. For more information on how to
  35. create a BSP layer, see the
  36. ":ref:`dev-manual/common-tasks:understanding and creating layers`"
  37. section in the Yocto Project Development Tasks Manual and the
  38. :doc:`/bsp-guide/index`.
  39. Usually, if the board is not completely exotic, adding support in the
  40. Yocto Project is fairly straightforward.
  41. **Q:** Are there any products built using the OpenEmbedded build system?
  42. **A:** The software running on the `Vernier
  43. LabQuest <https://vernier.com/labquest/>`__ is built using the
  44. OpenEmbedded build system. See the `Vernier
  45. LabQuest <https://www.vernier.com/products/interfaces/labq/>`__ website
  46. for more information. There are a number of pre-production devices using
  47. the OpenEmbedded build system and the Yocto Project team announces them
  48. as soon as they are released.
  49. **Q:** What does the OpenEmbedded build system produce as output?
  50. **A:** Because you can use the same set of recipes to create output of
  51. various formats, the output of an OpenEmbedded build depends on how you
  52. start it. Usually, the output is a flashable image ready for the target
  53. device.
  54. **Q:** How do I add my package to the Yocto Project?
  55. **A:** To add a package, you need to create a BitBake recipe. For
  56. information on how to create a BitBake recipe, see the
  57. ":ref:`dev-manual/common-tasks:writing a new recipe`"
  58. section in the Yocto Project Development Tasks Manual.
  59. **Q:** Do I have to reflash my entire board with a new Yocto Project
  60. image when recompiling a package?
  61. **A:** The OpenEmbedded build system can build packages in various
  62. formats such as IPK for OPKG, Debian package (``.deb``), or RPM. You can
  63. then upgrade the packages using the package tools on the device, much
  64. like on a desktop distribution such as Ubuntu or Fedora. However,
  65. package management on the target is entirely optional.
  66. **Q:** I see the error
  67. '``chmod: XXXXX new permissions are r-xrwxrwx, not r-xr-xr-x``'. What is
  68. wrong?
  69. **A:** You are probably running the build on an NTFS filesystem. Use
  70. ``ext2``, ``ext3``, or ``ext4`` instead.
  71. **Q:** I see lots of 404 responses for files when the OpenEmbedded build
  72. system is trying to download sources. Is something wrong?
  73. **A:** Nothing is wrong. The OpenEmbedded build system checks any
  74. configured source mirrors before downloading from the upstream sources.
  75. The build system does this searching for both source archives and
  76. pre-checked out versions of SCM-managed software. These checks help in
  77. large installations because it can reduce load on the SCM servers
  78. themselves. The address above is one of the default mirrors configured
  79. into the build system. Consequently, if an upstream source disappears,
  80. the team can place sources there so builds continue to work.
  81. **Q:** I have machine-specific data in a package for one machine only
  82. but the package is being marked as machine-specific in all cases, how do
  83. I prevent this?
  84. **A:** Set :term:`SRC_URI_OVERRIDES_PACKAGE_ARCH` = "0" in the ``.bb`` file
  85. but make sure the package is manually marked as machine-specific for the
  86. case that needs it. The code that handles
  87. :term:`SRC_URI_OVERRIDES_PACKAGE_ARCH` is in the
  88. ``meta/classes/base.bbclass`` file.
  89. **Q:** I'm behind a firewall and need to use a proxy server. How do I do
  90. that?
  91. **A:** Most source fetching by the OpenEmbedded build system is done by
  92. ``wget`` and you therefore need to specify the proxy settings in a
  93. ``.wgetrc`` file, which can be in your home directory if you are a
  94. single user or can be in ``/usr/local/etc/wgetrc`` as a global user
  95. file.
  96. Following is the applicable code for setting various proxy types in the
  97. ``.wgetrc`` file. By default, these settings are disabled with comments.
  98. To use them, remove the comments::
  99. # You can set the default proxies for Wget to use for http, https, and ftp.
  100. # They will override the value in the environment.
  101. #https_proxy = http://proxy.yoyodyne.com:18023/
  102. #http_proxy = http://proxy.yoyodyne.com:18023/
  103. #ftp_proxy = http://proxy.yoyodyne.com:18023/
  104. # If you do not want to use proxy at all, set this to off.
  105. #use_proxy = on
  106. The Yocto Project also includes a
  107. ``meta-poky/conf/site.conf.sample`` file that shows how to configure CVS
  108. and Git proxy servers if needed. For more information on setting up
  109. various proxy types and configuring proxy servers, see the
  110. ":yocto_wiki:`Working Behind a Network Proxy </Working_Behind_a_Network_Proxy>`"
  111. Wiki page.
  112. **Q:** What's the difference between target and target\ ``-native``?
  113. **A:** The ``*-native`` targets are designed to run on the system being
  114. used for the build. These are usually tools that are needed to assist
  115. the build in some way such as ``quilt-native``, which is used to apply
  116. patches. The non-native version is the one that runs on the target
  117. device.
  118. **Q:** I'm seeing random build failures. Help?!
  119. **A:** If the same build is failing in totally different and random
  120. ways, the most likely explanation is:
  121. - The hardware you are running the build on has some problem.
  122. - You are running the build under virtualization, in which case the
  123. virtualization probably has bugs.
  124. The OpenEmbedded build system processes a massive amount of data that
  125. causes lots of network, disk and CPU activity and is sensitive to even
  126. single-bit failures in any of these areas. True random failures have
  127. always been traced back to hardware or virtualization issues.
  128. **Q:** When I try to build a native recipe, the build fails with
  129. ``iconv.h`` problems.
  130. **A:** If you get an error message that indicates GNU ``libiconv`` is
  131. not in use but ``iconv.h`` has been included from ``libiconv``, you need
  132. to check to see if you have a previously installed version of the header
  133. file in ``/usr/local/include``.
  134. ::
  135. #error GNU libiconv not in use but included iconv.h is from libiconv
  136. If you find a previously installed
  137. file, you should either uninstall it or temporarily rename it and try
  138. the build again.
  139. This issue is just a single manifestation of "system leakage" issues
  140. caused when the OpenEmbedded build system finds and uses previously
  141. installed files during a native build. This type of issue might not be
  142. limited to ``iconv.h``. Be sure that leakage cannot occur from
  143. ``/usr/local/include`` and ``/opt`` locations.
  144. **Q:** What do we need to ship for license compliance?
  145. **A:** This is a difficult question and you need to consult your lawyer
  146. for the answer for your specific case. It is worth bearing in mind that
  147. for GPL compliance, there needs to be enough information shipped to
  148. allow someone else to rebuild and produce the same end result you are
  149. shipping. This means sharing the source code, any patches applied to it,
  150. and also any configuration information about how that package was
  151. configured and built.
  152. You can find more information on licensing in the
  153. ":ref:`overview-manual/development-environment:licensing`"
  154. section in the Yocto
  155. Project Overview and Concepts Manual and also in the
  156. ":ref:`dev-manual/common-tasks:maintaining open source license compliance during your product's lifecycle`"
  157. section in the Yocto Project Development Tasks Manual.
  158. **Q:** How do I disable the cursor on my touchscreen device?
  159. **A:** You need to create a form factor file as described in the
  160. ":ref:`bsp-guide/bsp:miscellaneous bsp-specific recipe files`" section in
  161. the Yocto Project Board Support Packages (BSP) Developer's Guide. Set
  162. the ``HAVE_TOUCHSCREEN`` variable equal to one as follows::
  163. HAVE_TOUCHSCREEN=1
  164. **Q:** How do I make sure connected network interfaces are brought up by
  165. default?
  166. **A:** The default interfaces file provided by the netbase recipe does
  167. not automatically bring up network interfaces. Therefore, you will need
  168. to add a BSP-specific netbase that includes an interfaces file. See the
  169. ":ref:`bsp-guide/bsp:miscellaneous bsp-specific recipe files`" section in
  170. the Yocto Project Board Support Packages (BSP) Developer's Guide for
  171. information on creating these types of miscellaneous recipe files.
  172. For example, add the following files to your layer::
  173. meta-MACHINE/recipes-bsp/netbase/netbase/MACHINE/interfaces
  174. meta-MACHINE/recipes-bsp/netbase/netbase_5.0.bbappend
  175. **Q:** How do I create images with more free space?
  176. **A:** By default, the OpenEmbedded build system creates images that are
  177. 1.3 times the size of the populated root filesystem. To affect the image
  178. size, you need to set various configurations:
  179. - *Image Size:* The OpenEmbedded build system uses the
  180. :term:`IMAGE_ROOTFS_SIZE` variable to define
  181. the size of the image in Kbytes. The build system determines the size
  182. by taking into account the initial root filesystem size before any
  183. modifications such as requested size for the image and any requested
  184. additional free disk space to be added to the image.
  185. - *Overhead:* Use the
  186. :term:`IMAGE_OVERHEAD_FACTOR` variable
  187. to define the multiplier that the build system applies to the initial
  188. image size, which is 1.3 by default.
  189. - *Additional Free Space:* Use the
  190. :term:`IMAGE_ROOTFS_EXTRA_SPACE`
  191. variable to add additional free space to the image. The build system
  192. adds this space to the image after it determines its
  193. :term:`IMAGE_ROOTFS_SIZE`.
  194. **Q:** Why don't you support directories with spaces in the pathnames?
  195. **A:** The Yocto Project team has tried to do this before but too many
  196. of the tools the OpenEmbedded build system depends on, such as
  197. ``autoconf``, break when they find spaces in pathnames. Until that
  198. situation changes, the team will not support spaces in pathnames.
  199. **Q:** How do I use an external toolchain?
  200. **A:** The toolchain configuration is very flexible and customizable. It
  201. is primarily controlled with the :term:`TCMODE` variable. This variable
  202. controls which ``tcmode-*.inc`` file to include from the
  203. ``meta/conf/distro/include`` directory within the :term:`Source Directory`.
  204. The default value of :term:`TCMODE` is "default", which tells the
  205. OpenEmbedded build system to use its internally built toolchain (i.e.
  206. ``tcmode-default.inc``). However, other patterns are accepted. In
  207. particular, "external-\*" refers to external toolchains. One example is
  208. the Sourcery G++ Toolchain. The support for this toolchain resides in
  209. the separate ``meta-sourcery`` layer at
  210. https://github.com/MentorEmbedded/meta-sourcery/.
  211. In addition to the toolchain configuration, you also need a
  212. corresponding toolchain recipe file. This recipe file needs to package
  213. up any pre-built objects in the toolchain such as ``libgcc``,
  214. ``libstdcc++``, any locales, and ``libc``.
  215. **Q:** How does the OpenEmbedded build system obtain source code and
  216. will it work behind my firewall or proxy server?
  217. **A:** The way the build system obtains source code is highly
  218. configurable. You can setup the build system to get source code in most
  219. environments if HTTP transport is available.
  220. When the build system searches for source code, it first tries the local
  221. download directory. If that location fails, Poky tries
  222. :term:`PREMIRRORS`, the upstream source, and then
  223. :term:`MIRRORS` in that order.
  224. Assuming your distribution is "poky", the OpenEmbedded build system uses
  225. the Yocto Project source :term:`PREMIRRORS` by default for SCM-based
  226. sources, upstreams for normal tarballs, and then falls back to a number
  227. of other mirrors including the Yocto Project source mirror if those
  228. fail.
  229. As an example, you could add a specific server for the build system to
  230. attempt before any others by adding something like the following to the
  231. ``local.conf`` configuration file::
  232. PREMIRRORS_prepend = "\
  233. git://.*/.* http://www.yoctoproject.org/sources/ \n \
  234. ftp://.*/.* http://www.yoctoproject.org/sources/ \n \
  235. http://.*/.* http://www.yoctoproject.org/sources/ \n \
  236. https://.*/.* http://www.yoctoproject.org/sources/ \n"
  237. These changes cause the build system to intercept Git, FTP, HTTP, and
  238. HTTPS requests and direct them to the ``http://`` sources mirror. You
  239. can use ``file://`` URLs to point to local directories or network shares
  240. as well.
  241. Here are other options::
  242. BB_NO_NETWORK = "1"
  243. This statement tells BitBake to issue an error
  244. instead of trying to access the Internet. This technique is useful if
  245. you want to ensure code builds only from local sources.
  246. Here is another technique::
  247. BB_FETCH_PREMIRRORONLY = "1"
  248. This statement
  249. limits the build system to pulling source from the :term:`PREMIRRORS` only.
  250. Again, this technique is useful for reproducing builds.
  251. Here is another technique::
  252. BB_GENERATE_MIRROR_TARBALLS = "1"
  253. This
  254. statement tells the build system to generate mirror tarballs. This
  255. technique is useful if you want to create a mirror server. If not,
  256. however, the technique can simply waste time during the build.
  257. Finally, consider an example where you are behind an HTTP-only firewall.
  258. You could make the following changes to the ``local.conf`` configuration
  259. file as long as the :term:`PREMIRRORS` server is current::
  260. PREMIRRORS_prepend = "\
  261. ftp://.*/.* http://www.yoctoproject.org/sources/ \n \
  262. http://.*/.* http://www.yoctoproject.org/sources/ \n \
  263. https://.*/.* http://www.yoctoproject.org/sources/ \n"
  264. BB_FETCH_PREMIRRORONLY = "1"
  265. These changes would cause the build system to successfully fetch source
  266. over HTTP and any network accesses to anything other than the
  267. :term:`PREMIRRORS` would fail.
  268. The build system also honors the standard shell environment variables
  269. ``http_proxy``, ``ftp_proxy``, ``https_proxy``, and ``all_proxy`` to
  270. redirect requests through proxy servers.
  271. .. note::
  272. You can find more information on the
  273. ":yocto_wiki:`Working Behind a Network Proxy </Working_Behind_a_Network_Proxy>`"
  274. Wiki page.
  275. **Q:** Can I get rid of build output so I can start over?
  276. **A:** Yes - you can easily do this. When you use BitBake to build an
  277. image, all the build output goes into the directory created when you run
  278. the build environment setup script (i.e.
  279. :ref:`structure-core-script`). By default, this :term:`Build Directory`
  280. is named ``build`` but can be named
  281. anything you want.
  282. Within the Build Directory, is the ``tmp`` directory. To remove all the
  283. build output yet preserve any source code or downloaded files from
  284. previous builds, simply remove the ``tmp`` directory.
  285. **Q:** Why do ``${bindir}`` and ``${libdir}`` have strange values for
  286. ``-native`` recipes?
  287. **A:** Executables and libraries might need to be used from a directory
  288. other than the directory into which they were initially installed.
  289. Complicating this situation is the fact that sometimes these executables
  290. and libraries are compiled with the expectation of being run from that
  291. initial installation target directory. If this is the case, moving them
  292. causes problems.
  293. This scenario is a fundamental problem for package maintainers of
  294. mainstream Linux distributions as well as for the OpenEmbedded build
  295. system. As such, a well-established solution exists. Makefiles,
  296. Autotools configuration scripts, and other build systems are expected to
  297. respect environment variables such as ``bindir``, ``libdir``, and
  298. ``sysconfdir`` that indicate where executables, libraries, and data
  299. reside when a program is actually run. They are also expected to respect
  300. a ``DESTDIR`` environment variable, which is prepended to all the other
  301. variables when the build system actually installs the files. It is
  302. understood that the program does not actually run from within
  303. ``DESTDIR``.
  304. When the OpenEmbedded build system uses a recipe to build a
  305. target-architecture program (i.e. one that is intended for inclusion on
  306. the image being built), that program eventually runs from the root file
  307. system of that image. Thus, the build system provides a value of
  308. "/usr/bin" for ``bindir``, a value of "/usr/lib" for ``libdir``, and so
  309. forth.
  310. Meanwhile, ``DESTDIR`` is a path within the :term:`Build Directory`.
  311. However, when the recipe builds a
  312. native program (i.e. one that is intended to run on the build machine),
  313. that program is never installed directly to the build machine's root
  314. file system. Consequently, the build system uses paths within the Build
  315. Directory for ``DESTDIR``, ``bindir`` and related variables. To better
  316. understand this, consider the following two paths where the first is
  317. relatively normal and the second is not:
  318. .. note::
  319. Due to these lengthy examples, the paths are artificially broken
  320. across lines for readability.
  321. ::
  322. /home/maxtothemax/poky-bootchart2/build/tmp/work/i586-poky-linux/zlib/
  323. 1.2.8-r0/sysroot-destdir/usr/bin
  324. /home/maxtothemax/poky-bootchart2/build/tmp/work/x86_64-linux/
  325. zlib-native/1.2.8-r0/sysroot-destdir/home/maxtothemax/poky-bootchart2/
  326. build/tmp/sysroots/x86_64-linux/usr/bin
  327. Even if the paths look unusual,
  328. they both are correct - the first for a target and the second for a
  329. native recipe. These paths are a consequence of the ``DESTDIR``
  330. mechanism and while they appear strange, they are correct and in
  331. practice very effective.
  332. **Q:** The files provided by my ``*-native`` recipe do not appear to be
  333. available to other recipes. Files are missing from the native sysroot,
  334. my recipe is installing to the wrong place, or I am getting permissions
  335. errors during the do_install task in my recipe! What is wrong?
  336. **A:** This situation results when a build system does not recognize the
  337. environment variables supplied to it by :term:`BitBake`. The
  338. incident that prompted this FAQ entry involved a Makefile that used an
  339. environment variable named ``BINDIR`` instead of the more standard
  340. variable ``bindir``. The makefile's hardcoded default value of
  341. "/usr/bin" worked most of the time, but not for the recipe's ``-native``
  342. variant. For another example, permissions errors might be caused by a
  343. Makefile that ignores ``DESTDIR`` or uses a different name for that
  344. environment variable. Check the build system to see if these kinds
  345. of issues exist.
  346. **Q:** I'm adding a binary in a recipe but it's different in the image, what is
  347. changing it?
  348. **A:** The first most obvious change is the system stripping debug symbols from
  349. it. Setting :term:`INHIBIT_PACKAGE_STRIP` to stop debug symbols being stripped and/or
  350. :term:`INHIBIT_PACKAGE_DEBUG_SPLIT` to stop debug symbols being split into a separate
  351. file will ensure the binary is unchanged. The other less obvious thing that can
  352. happen is prelinking of the image. This is set by default in local.conf via
  353. :term:`USER_CLASSES` which can contain 'image-prelink'. If you remove that, the
  354. image will not be prelinked meaning the binaries would be unchanged.