Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2 | |
| 3 | *** |
| 4 | FAQ |
| 5 | *** |
| 6 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 7 | .. contents:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 8 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 9 | General questions |
| 10 | ================= |
| 11 | |
| 12 | How does Poky differ from OpenEmbedded? |
| 13 | --------------------------------------- |
| 14 | |
| 15 | The term ``Poky`` refers to the specific reference build |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 16 | system that the Yocto Project provides. Poky is based on |
| 17 | :term:`OpenEmbedded-Core (OE-Core)` and :term:`BitBake`. Thus, the |
| 18 | generic term used here for the build system is the "OpenEmbedded build |
| 19 | system." Development in the Yocto Project using Poky is closely tied to |
| 20 | OpenEmbedded, with changes always being merged to OE-Core or BitBake |
| 21 | first before being pulled back into Poky. This practice benefits both |
| 22 | projects immediately. |
| 23 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 24 | How can you claim Poky / OpenEmbedded-Core is stable? |
| 25 | ----------------------------------------------------- |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 26 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 27 | There are three areas that help with stability; |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 28 | |
| 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 Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 37 | - The Yocto Project uses an :yocto_ab:`autobuilder <>`, which provides |
| 38 | continuous build and integration tests. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 39 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 40 | Are there any products built using the OpenEmbedded build system? |
| 41 | ----------------------------------------------------------------- |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 42 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 43 | See :yocto_wiki:`Products that use the Yocto Project |
Patrick Williams | 2194f50 | 2022-10-16 14:26:09 -0500 | [diff] [blame] | 44 | </Project_Users#Products_that_use_the_Yocto_Project>` in the Yocto Project |
| 45 | Wiki. Don't hesitate to contribute to this page if you know other such |
| 46 | products. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 47 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 48 | Building environment |
| 49 | ==================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 50 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 51 | Missing dependencies on the development system? |
| 52 | ----------------------------------------------- |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 53 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 54 | If your development system does not meet the required Git, tar, and |
| 55 | Python versions, you can get the required tools on your host development |
| 56 | system in different ways (i.e. building a tarball or downloading a |
| 57 | tarball). See the ":ref:`ref-manual/system-requirements:required git, tar, python, make and gcc versions`" |
| 58 | section for steps on how to update your build tools. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 59 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 60 | How does OpenEmbedded fetch source code? Will it work through a firewall or proxy server? |
| 61 | ----------------------------------------------------------------------------------------- |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 62 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 63 | The way the build system obtains source code is highly |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 64 | configurable. You can setup the build system to get source code in most |
| 65 | environments if HTTP transport is available. |
| 66 | |
| 67 | When the build system searches for source code, it first tries the local |
| 68 | download directory. If that location fails, Poky tries |
| 69 | :term:`PREMIRRORS`, the upstream source, and then |
| 70 | :term:`MIRRORS` in that order. |
| 71 | |
| 72 | Assuming your distribution is "poky", the OpenEmbedded build system uses |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame] | 73 | the Yocto Project source :term:`PREMIRRORS` by default for SCM-based |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 74 | sources, upstreams for normal tarballs, and then falls back to a number |
| 75 | of other mirrors including the Yocto Project source mirror if those |
| 76 | fail. |
| 77 | |
| 78 | As an example, you could add a specific server for the build system to |
| 79 | attempt before any others by adding something like the following to the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 80 | ``local.conf`` configuration file:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 81 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 82 | PREMIRRORS:prepend = "\ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 83 | 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 Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 87 | |
| 88 | These changes cause the build system to intercept Git, FTP, HTTP, and |
| 89 | HTTPS requests and direct them to the ``http://`` sources mirror. You |
| 90 | can use ``file://`` URLs to point to local directories or network shares |
| 91 | as well. |
| 92 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 93 | Here are other options:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 94 | |
| 95 | BB_NO_NETWORK = "1" |
| 96 | |
| 97 | This statement tells BitBake to issue an error |
| 98 | instead of trying to access the Internet. This technique is useful if |
| 99 | you want to ensure code builds only from local sources. |
| 100 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 101 | Here is another technique:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 102 | |
| 103 | BB_FETCH_PREMIRRORONLY = "1" |
| 104 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 105 | This statement limits the build system to pulling source from the |
| 106 | :term:`PREMIRRORS` only. Again, this technique is useful for reproducing |
| 107 | builds. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 108 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 109 | Here is another technique:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 110 | |
| 111 | BB_GENERATE_MIRROR_TARBALLS = "1" |
| 112 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 113 | This statement tells the build system to generate mirror tarballs. This |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 114 | technique is useful if you want to create a mirror server. If not, |
| 115 | however, the technique can simply waste time during the build. |
| 116 | |
| 117 | Finally, consider an example where you are behind an HTTP-only firewall. |
| 118 | You could make the following changes to the ``local.conf`` configuration |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 119 | file as long as the :term:`PREMIRRORS` server is current:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 120 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 121 | PREMIRRORS:prepend = "\ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 122 | 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 Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 126 | BB_FETCH_PREMIRRORONLY = "1" |
| 127 | |
| 128 | These changes would cause the build system to successfully fetch source |
| 129 | over HTTP and any network accesses to anything other than the |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 130 | :term:`PREMIRRORS` would fail. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 131 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 132 | Most 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 |
| 135 | single user or can be in ``/usr/local/etc/wgetrc`` as a global user |
| 136 | file. |
| 137 | |
| 138 | Following is the applicable code for setting various proxy types in the |
| 139 | ``.wgetrc`` file. By default, these settings are disabled with comments. |
| 140 | To 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 | |
| 151 | The build system also accepts ``http_proxy``, ``ftp_proxy``, ``https_proxy``, |
| 152 | and ``all_proxy`` set as to standard shell environment variables to redirect |
| 153 | requests through proxy servers. |
| 154 | |
| 155 | The Yocto Project also includes a |
| 156 | ``meta-poky/conf/templates/default/site.conf.sample`` file that shows |
| 157 | how to configure CVS and Git proxy servers if needed. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 158 | |
| 159 | .. note:: |
| 160 | |
| 161 | You can find more information on the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 162 | ":yocto_wiki:`Working Behind a Network Proxy </Working_Behind_a_Network_Proxy>`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 163 | Wiki page. |
| 164 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 165 | Using the OpenEmbedded Build system |
| 166 | =================================== |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 167 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 168 | How do I use an external toolchain? |
| 169 | ----------------------------------- |
| 170 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 171 | See the ":ref:`dev-manual/external-toolchain:optionally using an external toolchain`" |
| 172 | section in the Development Task manual. |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 173 | |
| 174 | Why do I get chmod permission issues? |
| 175 | ------------------------------------- |
| 176 | |
| 177 | If you see the error |
| 178 | ``chmod: XXXXX new permissions are r-xrwxrwx, not r-xr-xr-x``, |
| 179 | you are probably running the build on an NTFS filesystem. Instead, |
| 180 | run the build system on a partition with a modern Linux filesystem such as |
| 181 | ``ext4``, ``btrfs`` or ``xfs``. |
| 182 | |
| 183 | I see many 404 errors trying to download sources. Is anything wrong? |
| 184 | -------------------------------------------------------------------- |
| 185 | |
| 186 | Nothing is wrong. The OpenEmbedded build system checks any |
| 187 | configured source mirrors before downloading from the upstream sources. |
| 188 | The build system does this searching for both source archives and |
| 189 | pre-checked out versions of SCM-managed software. These checks help in |
| 190 | large installations because it can reduce load on the SCM servers |
| 191 | themselves. This can also allow builds to continue to work if an |
| 192 | upstream source disappears. |
| 193 | |
| 194 | Why do I get random build failures? |
| 195 | ----------------------------------- |
| 196 | |
| 197 | If the same build is failing in totally different and random |
| 198 | ways, the most likely explanation is: |
| 199 | |
| 200 | - The hardware you are running the build on has some problem. |
| 201 | |
| 202 | - You are running the build under virtualization, in which case the |
| 203 | virtualization probably has bugs. |
| 204 | |
| 205 | The OpenEmbedded build system processes a massive amount of data that |
| 206 | causes lots of network, disk and CPU activity and is sensitive to even |
| 207 | single-bit failures in any of these areas. True random failures have |
| 208 | always been traced back to hardware or virtualization issues. |
| 209 | |
| 210 | Why does the build fail with ``iconv.h`` problems? |
| 211 | -------------------------------------------------- |
| 212 | |
| 213 | When you try to build a native recipe, you may get an error message that |
| 214 | indicates that GNU ``libiconv`` is not in use but ``iconv.h`` has been |
| 215 | included from ``libiconv``:: |
| 216 | |
| 217 | #error GNU libiconv not in use but included iconv.h is from libiconv |
| 218 | |
| 219 | When this happens, you need to check whether you have a previously |
| 220 | installed version of the header file in ``/usr/local/include/``. |
| 221 | If that's the case, you should either uninstall it or temporarily rename |
| 222 | it and try the build again. |
| 223 | |
| 224 | This issue is just a single manifestation of "system leakage" issues |
| 225 | caused when the OpenEmbedded build system finds and uses previously |
| 226 | installed files during a native build. This type of issue might not be |
| 227 | limited to ``iconv.h``. Make sure that leakage cannot occur from |
| 228 | ``/usr/local/include`` and ``/opt`` locations. |
| 229 | |
| 230 | Why don't other recipes find the files provided by my ``*-native`` recipe? |
| 231 | -------------------------------------------------------------------------- |
| 232 | |
| 233 | Files provided by your native recipe could be missing from the native |
| 234 | sysroot, your recipe could also be installing to the wrong place, or you |
| 235 | could be getting permission errors during the :ref:`ref-tasks-install` |
| 236 | task in your recipe. |
| 237 | |
| 238 | This situation happens when the build system used by a package does not |
| 239 | recognize the environment variables supplied to it by :term:`BitBake`. The |
| 240 | incident that prompted this FAQ entry involved a Makefile that used an |
| 241 | environment variable named ``BINDIR`` instead of the more standard |
| 242 | variable ``bindir``. The makefile's hardcoded default value of |
| 243 | "/usr/bin" worked most of the time, but not for the recipe's ``-native`` |
| 244 | variant. For another example, permission errors might be caused by a |
| 245 | Makefile that ignores ``DESTDIR`` or uses a different name for that |
| 246 | environment variable. Check the build system of the package to see if |
| 247 | these kinds of issues exist. |
| 248 | |
| 249 | Can I get rid of build output so I can start over? |
| 250 | -------------------------------------------------- |
| 251 | |
| 252 | Yes --- you can easily do this. When you use BitBake to build an |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 253 | image, all the build output goes into the directory created when you run |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 254 | the build environment setup script (i.e. :ref:`structure-core-script`). |
| 255 | By default, this :term:`Build Directory` is named ``build`` but can be named |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 256 | anything you want. |
| 257 | |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 258 | Within the :term:`Build Directory`, is the ``tmp`` directory. To remove all the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 259 | build output yet preserve any source code or downloaded files from |
| 260 | previous builds, simply remove the ``tmp`` directory. |
| 261 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 262 | Customizing generated images |
| 263 | ============================ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 264 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 265 | What does the OpenEmbedded build system produce as output? |
| 266 | ---------------------------------------------------------- |
| 267 | |
| 268 | Because you can use the same set of recipes to create output of |
| 269 | various formats, the output of an OpenEmbedded build depends on how you |
| 270 | start it. Usually, the output is a flashable image ready for the target |
| 271 | device. |
| 272 | |
| 273 | How do I make the Yocto Project support my board? |
| 274 | ------------------------------------------------- |
| 275 | |
| 276 | Support for an additional board is added by creating a Board |
| 277 | Support Package (BSP) layer for it. For more information on how to |
| 278 | create a BSP layer, see the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 279 | ":ref:`dev-manual/layers:understanding and creating layers`" |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 280 | section in the Yocto Project Development Tasks Manual and the |
| 281 | :doc:`/bsp-guide/index`. |
| 282 | |
| 283 | Usually, if the board is not completely exotic, adding support in the |
| 284 | Yocto Project is fairly straightforward. |
| 285 | |
| 286 | How do I make the Yocto Project support my package? |
| 287 | --------------------------------------------------- |
| 288 | |
| 289 | To add a package, you need to create a BitBake recipe. For |
| 290 | information on how to create a BitBake recipe, see the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 291 | ":ref:`dev-manual/new-recipe:writing a new recipe`" |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 292 | section in the Yocto Project Development Tasks Manual. |
| 293 | |
| 294 | What do I need to ship for license compliance? |
| 295 | ---------------------------------------------- |
| 296 | |
| 297 | This is a difficult question and you need to consult your lawyer |
| 298 | for the answer for your specific case. It is worth bearing in mind that |
| 299 | for GPL compliance, there needs to be enough information shipped to |
| 300 | allow someone else to rebuild and produce the same end result you are |
| 301 | shipping. This means sharing the source code, any patches applied to it, |
| 302 | and also any configuration information about how that package was |
| 303 | configured and built. |
| 304 | |
| 305 | You can find more information on licensing in the |
| 306 | ":ref:`overview-manual/development-environment:licensing`" |
| 307 | section in the Yocto Project Overview and Concepts Manual and also in the |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 308 | ":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`" |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 309 | section in the Yocto Project Development Tasks Manual. |
| 310 | |
| 311 | Do I have to make a full reflash after recompiling one package? |
| 312 | --------------------------------------------------------------- |
| 313 | |
| 314 | The OpenEmbedded build system can build packages in various |
| 315 | formats such as IPK for OPKG, Debian package (``.deb``), or RPM. You can |
| 316 | then upgrade only the modified packages using the package tools on the device, |
| 317 | much like on a desktop distribution such as Ubuntu or Fedora. However, |
| 318 | package management on the target is entirely optional. |
| 319 | |
| 320 | How to prevent my package from being marked as machine specific? |
| 321 | ---------------------------------------------------------------- |
| 322 | |
| 323 | If you have machine-specific data in a package for one machine only |
| 324 | but the package is being marked as machine-specific in all cases, |
| 325 | you can set :term:`SRC_URI_OVERRIDES_PACKAGE_ARCH` = "0" in the ``.bb`` file. |
| 326 | However, but make sure the package is manually marked as machine-specific for the |
| 327 | case that needs it. The code that handles :term:`SRC_URI_OVERRIDES_PACKAGE_ARCH` |
| 328 | is in the ``meta/classes-global/base.bbclass`` file. |
| 329 | |
| 330 | What's the difference between ``target`` and ``target-native``? |
| 331 | --------------------------------------------------------------- |
| 332 | |
| 333 | The ``*-native`` targets are designed to run on the system being |
| 334 | used for the build. These are usually tools that are needed to assist |
| 335 | the build in some way such as ``quilt-native``, which is used to apply |
| 336 | patches. The non-native version is the one that runs on the target |
| 337 | device. |
| 338 | |
| 339 | Why do ``${bindir}`` and ``${libdir}`` have strange values for ``-native`` recipes? |
| 340 | ----------------------------------------------------------------------------------- |
| 341 | |
| 342 | Executables and libraries might need to be used from a directory |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 343 | other than the directory into which they were initially installed. |
| 344 | Complicating this situation is the fact that sometimes these executables |
| 345 | and libraries are compiled with the expectation of being run from that |
| 346 | initial installation target directory. If this is the case, moving them |
| 347 | causes problems. |
| 348 | |
| 349 | This scenario is a fundamental problem for package maintainers of |
| 350 | mainstream Linux distributions as well as for the OpenEmbedded build |
| 351 | system. As such, a well-established solution exists. Makefiles, |
| 352 | Autotools configuration scripts, and other build systems are expected to |
| 353 | respect environment variables such as ``bindir``, ``libdir``, and |
| 354 | ``sysconfdir`` that indicate where executables, libraries, and data |
| 355 | reside when a program is actually run. They are also expected to respect |
| 356 | a ``DESTDIR`` environment variable, which is prepended to all the other |
| 357 | variables when the build system actually installs the files. It is |
| 358 | understood that the program does not actually run from within |
| 359 | ``DESTDIR``. |
| 360 | |
| 361 | When the OpenEmbedded build system uses a recipe to build a |
| 362 | target-architecture program (i.e. one that is intended for inclusion on |
| 363 | the image being built), that program eventually runs from the root file |
| 364 | system of that image. Thus, the build system provides a value of |
| 365 | "/usr/bin" for ``bindir``, a value of "/usr/lib" for ``libdir``, and so |
| 366 | forth. |
| 367 | |
| 368 | Meanwhile, ``DESTDIR`` is a path within the :term:`Build Directory`. |
Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 369 | However, when the recipe builds a native program (i.e. one that is |
| 370 | intended to run on the build machine), that program is never installed |
| 371 | directly to the build machine's root file system. Consequently, the build |
| 372 | system uses paths within the Build Directory for ``DESTDIR``, ``bindir`` |
| 373 | and related variables. To better understand this, consider the following |
| 374 | two paths (artificially broken across lines for readability) where the |
| 375 | first is relatively normal and the second is not:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 376 | |
| 377 | /home/maxtothemax/poky-bootchart2/build/tmp/work/i586-poky-linux/zlib/ |
| 378 | 1.2.8-r0/sysroot-destdir/usr/bin |
| 379 | |
| 380 | /home/maxtothemax/poky-bootchart2/build/tmp/work/x86_64-linux/ |
| 381 | zlib-native/1.2.8-r0/sysroot-destdir/home/maxtothemax/poky-bootchart2/ |
| 382 | build/tmp/sysroots/x86_64-linux/usr/bin |
| 383 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 384 | Even if the paths look unusual, they both are correct --- the first for |
| 385 | a target and the second for a native recipe. These paths are a consequence |
| 386 | of the ``DESTDIR`` mechanism and while they appear strange, they are correct |
| 387 | and in practice very effective. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 388 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 389 | How do I create images with more free space? |
| 390 | -------------------------------------------- |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 391 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 392 | By default, the OpenEmbedded build system creates images that are |
| 393 | 1.3 times the size of the populated root filesystem. To affect the image |
| 394 | size, you need to set various configurations: |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 395 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 396 | - *Image Size:* The OpenEmbedded build system uses the |
| 397 | :term:`IMAGE_ROOTFS_SIZE` variable to define |
| 398 | the size of the image in Kbytes. The build system determines the size |
| 399 | by taking into account the initial root filesystem size before any |
| 400 | modifications such as requested size for the image and any requested |
| 401 | additional free disk space to be added to the image. |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 402 | |
Patrick Williams | 975a06f | 2022-10-21 14:42:47 -0500 | [diff] [blame] | 403 | - *Overhead:* Use the |
| 404 | :term:`IMAGE_OVERHEAD_FACTOR` variable |
| 405 | to define the multiplier that the build system applies to the initial |
| 406 | image size, which is 1.3 by default. |
| 407 | |
| 408 | - *Additional Free Space:* Use the |
| 409 | :term:`IMAGE_ROOTFS_EXTRA_SPACE` |
| 410 | variable to add additional free space to the image. The build system |
| 411 | adds this space to the image after it determines its |
| 412 | :term:`IMAGE_ROOTFS_SIZE`. |
| 413 | |
| 414 | Why aren't spaces in path names supported? |
| 415 | ------------------------------------------ |
| 416 | |
| 417 | The Yocto Project team has tried to do this before but too many |
| 418 | of the tools the OpenEmbedded build system depends on, such as |
| 419 | ``autoconf``, break when they find spaces in pathnames. Until that |
| 420 | situation changes, the team will not support spaces in pathnames. |
| 421 | |
| 422 | I'm adding a binary in a recipe. Why is it different in the image? |
| 423 | ------------------------------------------------------------------ |
| 424 | |
| 425 | The first most obvious change is the system stripping debug symbols from |
| 426 | it. Setting :term:`INHIBIT_PACKAGE_STRIP` to stop debug symbols being |
| 427 | stripped and/or :term:`INHIBIT_PACKAGE_DEBUG_SPLIT` to stop debug symbols |
| 428 | being split into a separate file will ensure the binary is unchanged. |
| 429 | |
| 430 | Issues on the running system |
| 431 | ============================ |
| 432 | |
| 433 | How do I disable the cursor on my touchscreen device? |
| 434 | ----------------------------------------------------- |
| 435 | |
| 436 | You need to create a form factor file as described in the |
| 437 | ":ref:`bsp-guide/bsp:miscellaneous bsp-specific recipe files`" section in |
| 438 | the Yocto Project Board Support Packages (BSP) Developer's Guide. Set |
| 439 | the ``HAVE_TOUCHSCREEN`` variable equal to one as follows:: |
| 440 | |
| 441 | HAVE_TOUCHSCREEN=1 |
| 442 | |
| 443 | How to always bring up connected network interfaces? |
| 444 | ---------------------------------------------------- |
| 445 | |
| 446 | The default interfaces file provided by the netbase recipe does |
| 447 | not automatically bring up network interfaces. Therefore, you will need |
| 448 | to add a BSP-specific netbase that includes an interfaces file. See the |
| 449 | ":ref:`bsp-guide/bsp:miscellaneous bsp-specific recipe files`" section in |
| 450 | the Yocto Project Board Support Packages (BSP) Developer's Guide for |
| 451 | information on creating these types of miscellaneous recipe files. |
| 452 | |
| 453 | For example, add the following files to your layer:: |
| 454 | |
| 455 | meta-MACHINE/recipes-bsp/netbase/netbase/MACHINE/interfaces |
| 456 | meta-MACHINE/recipes-bsp/netbase/netbase_5.0.bbappend |