faq.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. ***
  3. FAQ
  4. ***
  5. **Q:** How does Poky differ from `OpenEmbedded <http://www.openembedded.org/>`__?
  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 3.5.0 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 "`Required Git, tar, Python and gcc
  20. Versions <#required-git-tar-python-and-gcc-versions>`__" section for
  21. 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/dev-manual-common-tasks:understanding and creating layers`"
  37. section in the Yocto Project Development Tasks Manual and the
  38. :doc:`../bsp-guide/bsp-guide`.
  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 <http://vernier.com/labquest/>`__ is built using the
  44. OpenEmbedded build system. See the `Vernier
  45. LabQuest <http://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/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 ``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. ``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 </wiki/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/overview-manual-development-environment:licensing`"
  154. section in the Yocto
  155. Project Overview and Concepts Manual and also in the
  156. ":ref:`dev-manual/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-filelayout-misc-recipes`" 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. ::
  164. HAVE_TOUCHSCREEN=1
  165. **Q:** How do I make sure connected network interfaces are brought up by
  166. default?
  167. **A:** The default interfaces file provided by the netbase recipe does
  168. not automatically bring up network interfaces. Therefore, you will need
  169. to add a BSP-specific netbase that includes an interfaces file. See the
  170. ":ref:`bsp-filelayout-misc-recipes`" section in
  171. the Yocto Project Board Support Packages (BSP) Developer's Guide for
  172. information on creating these types of miscellaneous recipe files.
  173. For example, add the following files to your layer: ::
  174. meta-MACHINE/recipes-bsp/netbase/netbase/MACHINE/interfaces
  175. meta-MACHINE/recipes-bsp/netbase/netbase_5.0.bbappend
  176. **Q:** How do I create images with more free space?
  177. **A:** By default, the OpenEmbedded build system creates images that are
  178. 1.3 times the size of the populated root filesystem. To affect the image
  179. size, you need to set various configurations:
  180. - *Image Size:* The OpenEmbedded build system uses the
  181. :term:`IMAGE_ROOTFS_SIZE` variable to define
  182. the size of the image in Kbytes. The build system determines the size
  183. by taking into account the initial root filesystem size before any
  184. modifications such as requested size for the image and any requested
  185. additional free disk space to be added to the image.
  186. - *Overhead:* Use the
  187. :term:`IMAGE_OVERHEAD_FACTOR` variable
  188. to define the multiplier that the build system applies to the initial
  189. image size, which is 1.3 by default.
  190. - *Additional Free Space:* Use the
  191. :term:`IMAGE_ROOTFS_EXTRA_SPACE`
  192. variable to add additional free space to the image. The build system
  193. adds this space to the image after it determines its
  194. ``IMAGE_ROOTFS_SIZE``.
  195. **Q:** Why don't you support directories with spaces in the pathnames?
  196. **A:** The Yocto Project team has tried to do this before but too many
  197. of the tools the OpenEmbedded build system depends on, such as
  198. ``autoconf``, break when they find spaces in pathnames. Until that
  199. situation changes, the team will not support spaces in pathnames.
  200. **Q:** How do I use an external toolchain?
  201. **A:** The toolchain configuration is very flexible and customizable. It
  202. is primarily controlled with the ``TCMODE`` variable. This variable
  203. controls which ``tcmode-*.inc`` file to include from the
  204. ``meta/conf/distro/include`` directory within the :term:`Source Directory`.
  205. The default value of ``TCMODE`` is "default", which tells the
  206. OpenEmbedded build system to use its internally built toolchain (i.e.
  207. ``tcmode-default.inc``). However, other patterns are accepted. In
  208. particular, "external-\*" refers to external toolchains. One example is
  209. the Sourcery G++ Toolchain. The support for this toolchain resides in
  210. the separate ``meta-sourcery`` layer at
  211. http://github.com/MentorEmbedded/meta-sourcery/.
  212. In addition to the toolchain configuration, you also need a
  213. corresponding toolchain recipe file. This recipe file needs to package
  214. up any pre-built objects in the toolchain such as ``libgcc``,
  215. ``libstdcc++``, any locales, and ``libc``.
  216. **Q:** How does the OpenEmbedded build system obtain source code and
  217. will it work behind my firewall or proxy server?
  218. **A:** The way the build system obtains source code is highly
  219. configurable. You can setup the build system to get source code in most
  220. environments if HTTP transport is available.
  221. When the build system searches for source code, it first tries the local
  222. download directory. If that location fails, Poky tries
  223. :term:`PREMIRRORS`, the upstream source, and then
  224. :term:`MIRRORS` in that order.
  225. Assuming your distribution is "poky", the OpenEmbedded build system uses
  226. the Yocto Project source ``PREMIRRORS`` by default for SCM-based
  227. sources, upstreams for normal tarballs, and then falls back to a number
  228. of other mirrors including the Yocto Project source mirror if those
  229. fail.
  230. As an example, you could add a specific server for the build system to
  231. attempt before any others by adding something like the following to the
  232. ``local.conf`` configuration file: ::
  233. PREMIRRORS_prepend = "\
  234. git://.*/.* http://www.yoctoproject.org/sources/ \n \
  235. ftp://.*/.* http://www.yoctoproject.org/sources/ \n \
  236. http://.*/.* http://www.yoctoproject.org/sources/ \n \
  237. https://.*/.* http://www.yoctoproject.org/sources/ \n"
  238. These changes cause the build system to intercept Git, FTP, HTTP, and
  239. HTTPS requests and direct them to the ``http://`` sources mirror. You
  240. can use ``file://`` URLs to point to local directories or network shares
  241. as well.
  242. Aside from the previous technique, these options also exist:
  243. ::
  244. BB_NO_NETWORK = "1"
  245. This statement tells BitBake to issue an error
  246. instead of trying to access the Internet. This technique is useful if
  247. you want to ensure code builds only from local sources.
  248. Here is another technique:
  249. ::
  250. BB_FETCH_PREMIRRORONLY = "1"
  251. This statement
  252. limits the build system to pulling source from the ``PREMIRRORS`` only.
  253. Again, this technique is useful for reproducing builds.
  254. Here is another technique:
  255. ::
  256. BB_GENERATE_MIRROR_TARBALLS = "1"
  257. This
  258. statement tells the build system to generate mirror tarballs. This
  259. technique is useful if you want to create a mirror server. If not,
  260. however, the technique can simply waste time during the build.
  261. Finally, consider an example where you are behind an HTTP-only firewall.
  262. You could make the following changes to the ``local.conf`` configuration
  263. file as long as the ``PREMIRRORS`` server is current: ::
  264. PREMIRRORS_prepend = "\
  265. ftp://.*/.* http://www.yoctoproject.org/sources/ \n \
  266. http://.*/.* http://www.yoctoproject.org/sources/ \n \
  267. https://.*/.* http://www.yoctoproject.org/sources/ \n"
  268. BB_FETCH_PREMIRRORONLY = "1"
  269. These changes would cause the build system to successfully fetch source
  270. over HTTP and any network accesses to anything other than the
  271. ``PREMIRRORS`` would fail.
  272. The build system also honors the standard shell environment variables
  273. ``http_proxy``, ``ftp_proxy``, ``https_proxy``, and ``all_proxy`` to
  274. redirect requests through proxy servers.
  275. .. note::
  276. You can find more information on the
  277. ":yocto_wiki:`Working Behind a Network Proxy </wiki/Working_Behind_a_Network_Proxy>`"
  278. Wiki page.
  279. **Q:** Can I get rid of build output so I can start over?
  280. **A:** Yes - you can easily do this. When you use BitBake to build an
  281. image, all the build output goes into the directory created when you run
  282. the build environment setup script (i.e.
  283. ````` <#structure-core-script>`__). By default, this :term:`Build Directory`
  284. is named ``build`` but can be named
  285. anything you want.
  286. Within the Build Directory, is the ``tmp`` directory. To remove all the
  287. build output yet preserve any source code or downloaded files from
  288. previous builds, simply remove the ``tmp`` directory.
  289. **Q:** Why do ``${bindir}`` and ``${libdir}`` have strange values for
  290. ``-native`` recipes?
  291. **A:** Executables and libraries might need to be used from a directory
  292. other than the directory into which they were initially installed.
  293. Complicating this situation is the fact that sometimes these executables
  294. and libraries are compiled with the expectation of being run from that
  295. initial installation target directory. If this is the case, moving them
  296. causes problems.
  297. This scenario is a fundamental problem for package maintainers of
  298. mainstream Linux distributions as well as for the OpenEmbedded build
  299. system. As such, a well-established solution exists. Makefiles,
  300. Autotools configuration scripts, and other build systems are expected to
  301. respect environment variables such as ``bindir``, ``libdir``, and
  302. ``sysconfdir`` that indicate where executables, libraries, and data
  303. reside when a program is actually run. They are also expected to respect
  304. a ``DESTDIR`` environment variable, which is prepended to all the other
  305. variables when the build system actually installs the files. It is
  306. understood that the program does not actually run from within
  307. ``DESTDIR``.
  308. When the OpenEmbedded build system uses a recipe to build a
  309. target-architecture program (i.e. one that is intended for inclusion on
  310. the image being built), that program eventually runs from the root file
  311. system of that image. Thus, the build system provides a value of
  312. "/usr/bin" for ``bindir``, a value of "/usr/lib" for ``libdir``, and so
  313. forth.
  314. Meanwhile, ``DESTDIR`` is a path within the :term:`Build Directory`.
  315. However, when the recipe builds a
  316. native program (i.e. one that is intended to run on the build machine),
  317. that program is never installed directly to the build machine's root
  318. file system. Consequently, the build system uses paths within the Build
  319. Directory for ``DESTDIR``, ``bindir`` and related variables. To better
  320. understand this, consider the following two paths where the first is
  321. relatively normal and the second is not: ::
  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. .. note::
  328. Due to these lengthy examples, the paths are artificially broken
  329. across lines for readability.
  330. Even if the paths look unusual,
  331. they both are correct - the first for a target and the second for a
  332. native recipe. These paths are a consequence of the ``DESTDIR``
  333. mechanism and while they appear strange, they are correct and in
  334. practice very effective.
  335. **Q:** The files provided by my ``*-native`` recipe do not appear to be
  336. available to other recipes. Files are missing from the native sysroot,
  337. my recipe is installing to the wrong place, or I am getting permissions
  338. errors during the do_install task in my recipe! What is wrong?
  339. **A:** This situation results when a build system does not recognize the
  340. environment variables supplied to it by :term:`BitBake`. The
  341. incident that prompted this FAQ entry involved a Makefile that used an
  342. environment variable named ``BINDIR`` instead of the more standard
  343. variable ``bindir``. The makefile's hardcoded default value of
  344. "/usr/bin" worked most of the time, but not for the recipe's ``-native``
  345. variant. For another example, permissions errors might be caused by a
  346. Makefile that ignores ``DESTDIR`` or uses a different name for that
  347. environment variable. Check the the build system to see if these kinds
  348. of issues exist.