faq.xml 37 KB

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