diff options
Diffstat (limited to 'documentation/sdk-manual/appendix-customizing.rst')
| -rw-r--r-- | documentation/sdk-manual/appendix-customizing.rst | 358 |
1 files changed, 0 insertions, 358 deletions
diff --git a/documentation/sdk-manual/appendix-customizing.rst b/documentation/sdk-manual/appendix-customizing.rst deleted file mode 100644 index e08630dce0..0000000000 --- a/documentation/sdk-manual/appendix-customizing.rst +++ /dev/null | |||
| @@ -1,358 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK | ||
| 2 | |||
| 3 | *************************************************** | ||
| 4 | Customizing the Extensible SDK standalone installer | ||
| 5 | *************************************************** | ||
| 6 | |||
| 7 | This appendix describes customizations you can apply to the extensible | ||
| 8 | SDK when using in the standalone installer version. | ||
| 9 | |||
| 10 | .. note:: | ||
| 11 | |||
| 12 | It is also possible to use the Extensible SDK functionality directly in a | ||
| 13 | Yocto build, avoiding separate installer artefacts. Please refer to | ||
| 14 | ":ref:`sdk-manual/extensible:Installing the Extensible SDK`" | ||
| 15 | |||
| 16 | Configuring the Extensible SDK | ||
| 17 | ============================== | ||
| 18 | |||
| 19 | The extensible SDK primarily consists of a pre-configured copy of the | ||
| 20 | OpenEmbedded build system from which it was produced. Thus, the SDK's | ||
| 21 | configuration is derived using that build system and the filters shown | ||
| 22 | in the following list. When these filters are present, the OpenEmbedded | ||
| 23 | build system applies them against ``local.conf`` and ``auto.conf``: | ||
| 24 | |||
| 25 | - Variables whose values start with "/" are excluded since the | ||
| 26 | assumption is that those values are paths that are likely to be | ||
| 27 | specific to the :term:`Build Host`. | ||
| 28 | |||
| 29 | - Variables listed in | ||
| 30 | :term:`ESDK_LOCALCONF_REMOVE` | ||
| 31 | are excluded. These variables are not allowed through from the | ||
| 32 | OpenEmbedded build system configuration into the extensible SDK | ||
| 33 | configuration. Typically, these variables are specific to the machine | ||
| 34 | on which the build system is running and could be problematic as part | ||
| 35 | of the extensible SDK configuration. | ||
| 36 | |||
| 37 | For a list of the variables excluded by default, see the | ||
| 38 | :term:`ESDK_LOCALCONF_REMOVE` | ||
| 39 | in the glossary of the Yocto Project Reference Manual. | ||
| 40 | |||
| 41 | - Variables listed in | ||
| 42 | :term:`ESDK_LOCALCONF_ALLOW` | ||
| 43 | are included. Including a variable in the value of | ||
| 44 | :term:`ESDK_LOCALCONF_ALLOW` overrides either of the previous two | ||
| 45 | filters. The default value is blank. | ||
| 46 | |||
| 47 | - Classes inherited globally with :term:`INHERIT` that are listed in | ||
| 48 | :term:`ESDK_CLASS_INHERIT_DISABLE` are disabled. Using | ||
| 49 | :term:`ESDK_CLASS_INHERIT_DISABLE` to disable these classes is the typical | ||
| 50 | method to disable classes that are problematic or unnecessary in the SDK | ||
| 51 | context. The default value disables the :ref:`ref-classes-buildhistory` | ||
| 52 | class. | ||
| 53 | |||
| 54 | Additionally, the contents of ``conf/sdk-extra.conf``, when present, are | ||
| 55 | appended to the end of ``conf/local.conf`` within the produced SDK, | ||
| 56 | without any filtering. The ``sdk-extra.conf`` file is particularly | ||
| 57 | useful if you want to set a variable value just for the SDK and not the | ||
| 58 | OpenEmbedded build system used to create the SDK. | ||
| 59 | |||
| 60 | Adjusting the Extensible SDK to Suit Your Build Host's Setup | ||
| 61 | ============================================================ | ||
| 62 | |||
| 63 | In most cases, the extensible SDK defaults should work with your :term:`Build | ||
| 64 | Host`'s setup. However, there are cases when you might consider making | ||
| 65 | adjustments: | ||
| 66 | |||
| 67 | - If your SDK configuration inherits additional classes using the | ||
| 68 | :term:`INHERIT` variable and you | ||
| 69 | do not need or want those classes enabled in the SDK, you can | ||
| 70 | disable them by adding them to the :term:`ESDK_CLASS_INHERIT_DISABLE` | ||
| 71 | variable as described in the previous section. | ||
| 72 | |||
| 73 | .. note:: | ||
| 74 | |||
| 75 | The default value of :term:`ESDK_CLASS_INHERIT_DISABLE` | ||
| 76 | is set using the "?=" operator. Consequently, you will need to | ||
| 77 | either define the entire list by using the "=" operator, or you | ||
| 78 | will need to append a value using either ":append" or the "+=" | ||
| 79 | operator. You can learn more about these operators in the | ||
| 80 | ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:basic syntax`" | ||
| 81 | section of the BitBake User Manual. | ||
| 82 | |||
| 83 | - If you have classes or recipes that add additional tasks to the | ||
| 84 | standard build flow (i.e. the tasks execute as the recipe builds as | ||
| 85 | opposed to being called explicitly), then you need to do one of the | ||
| 86 | following: | ||
| 87 | |||
| 88 | - After ensuring the tasks are :ref:`shared | ||
| 89 | state <overview-manual/concepts:shared state cache>` tasks (i.e. the | ||
| 90 | output of the task is saved to and can be restored from the shared | ||
| 91 | state cache) or ensuring the tasks are able to be produced quickly | ||
| 92 | from a task that is a shared state task, add the task name to the | ||
| 93 | value of | ||
| 94 | :term:`SDK_RECRDEP_TASKS`. | ||
| 95 | |||
| 96 | - Disable the tasks if they are added by a class and you do not need | ||
| 97 | the functionality the class provides in the extensible SDK. To | ||
| 98 | disable the tasks, add the class to the :term:`ESDK_CLASS_INHERIT_DISABLE` | ||
| 99 | variable as described in the previous section. | ||
| 100 | |||
| 101 | - Generally, you want to have a shared state mirror set up so users of | ||
| 102 | the SDK can add additional items to the SDK after installation | ||
| 103 | without needing to build the items from source. See the | ||
| 104 | ":ref:`sdk-manual/appendix-customizing:providing additional installable extensible sdk content`" | ||
| 105 | section for information. | ||
| 106 | |||
| 107 | - If you want users of the SDK to be able to easily update the SDK, you | ||
| 108 | need to set the | ||
| 109 | :term:`SDK_UPDATE_URL` | ||
| 110 | variable. For more information, see the | ||
| 111 | ":ref:`sdk-manual/appendix-customizing:providing updates to the extensible sdk after installation`" | ||
| 112 | section. | ||
| 113 | |||
| 114 | - If you have adjusted the list of files and directories that appear in | ||
| 115 | :term:`COREBASE` (other than | ||
| 116 | layers that are enabled through ``bblayers.conf``), then you must | ||
| 117 | list these files in | ||
| 118 | :term:`COREBASE_FILES` so | ||
| 119 | that the files are copied into the SDK. | ||
| 120 | |||
| 121 | - If your OpenEmbedded build system setup uses a different environment | ||
| 122 | setup script other than | ||
| 123 | :ref:`structure-core-script`, then you must | ||
| 124 | set | ||
| 125 | :term:`OE_INIT_ENV_SCRIPT` | ||
| 126 | to point to the environment setup script you use. | ||
| 127 | |||
| 128 | .. note:: | ||
| 129 | |||
| 130 | You must also reflect this change in the value used for the | ||
| 131 | :term:`COREBASE_FILES` variable as previously described. | ||
| 132 | |||
| 133 | Changing the Extensible SDK Installer Title | ||
| 134 | =========================================== | ||
| 135 | |||
| 136 | You can change the displayed title for the SDK installer by setting the | ||
| 137 | :term:`SDK_TITLE` variable and then | ||
| 138 | rebuilding the SDK installer. For information on how to build an SDK | ||
| 139 | installer, see the ":ref:`sdk-manual/appendix-obtain:building an sdk installer`" | ||
| 140 | section. | ||
| 141 | |||
| 142 | By default, this title is derived from | ||
| 143 | :term:`DISTRO_NAME` when it is | ||
| 144 | set. If the :term:`DISTRO_NAME` variable is not set, the title is derived | ||
| 145 | from the :term:`DISTRO` variable. | ||
| 146 | |||
| 147 | The | ||
| 148 | :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` | ||
| 149 | class defines the default value of the :term:`SDK_TITLE` variable as | ||
| 150 | follows:: | ||
| 151 | |||
| 152 | SDK_TITLE ??= "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} SDK" | ||
| 153 | |||
| 154 | While there are several ways of changing this variable, an efficient method is | ||
| 155 | to set the variable in your distribution's configuration file. Doing so | ||
| 156 | creates an SDK installer title that applies across your distribution. As | ||
| 157 | an example, assume you have your own layer for your distribution named | ||
| 158 | "meta-mydistro" and you are using the same type of file hierarchy as | ||
| 159 | does the default "poky" distribution. If so, you could update the | ||
| 160 | :term:`SDK_TITLE` variable in the | ||
| 161 | ``~/meta-mydistro/conf/distro/mydistro.conf`` file using the following | ||
| 162 | form:: | ||
| 163 | |||
| 164 | SDK_TITLE = "your_title" | ||
| 165 | |||
| 166 | Providing Updates to the Extensible SDK After Installation | ||
| 167 | ========================================================== | ||
| 168 | |||
| 169 | When you make changes to your configuration or to the metadata and if | ||
| 170 | you want those changes to be reflected in installed SDKs, you need to | ||
| 171 | perform additional steps. These steps make it possible for anyone using | ||
| 172 | the installed SDKs to update the installed SDKs by using the | ||
| 173 | ``devtool sdk-update`` command: | ||
| 174 | |||
| 175 | #. Create a directory that can be shared over HTTP or HTTPS. You can do | ||
| 176 | this by setting up a web server such as an :wikipedia:`Apache HTTP Server | ||
| 177 | <Apache_HTTP_Server>` or :wikipedia:`Nginx <Nginx>` server in the cloud | ||
| 178 | to host the directory. This directory must contain the published SDK. | ||
| 179 | |||
| 180 | #. Set the | ||
| 181 | :term:`SDK_UPDATE_URL` | ||
| 182 | variable to point to the corresponding HTTP or HTTPS URL. Setting | ||
| 183 | this variable causes any SDK built to default to that URL and thus, | ||
| 184 | the user does not have to pass the URL to the ``devtool sdk-update`` | ||
| 185 | command as described in the | ||
| 186 | ":ref:`sdk-manual/extensible:applying updates to an installed extensible sdk`" | ||
| 187 | section. | ||
| 188 | |||
| 189 | #. Build the extensible SDK normally (i.e., use the | ||
| 190 | ``bitbake -c populate_sdk_ext`` imagename command). | ||
| 191 | |||
| 192 | #. Publish the SDK using the following command:: | ||
| 193 | |||
| 194 | $ oe-publish-sdk some_path/sdk-installer.sh path_to_shared_http_directory | ||
| 195 | |||
| 196 | You must | ||
| 197 | repeat this step each time you rebuild the SDK with changes that you | ||
| 198 | want to make available through the update mechanism. | ||
| 199 | |||
| 200 | Completing the above steps allows users of the existing installed SDKs | ||
| 201 | to simply run ``devtool sdk-update`` to retrieve and apply the latest | ||
| 202 | updates. See the | ||
| 203 | ":ref:`sdk-manual/extensible:applying updates to an installed extensible sdk`" | ||
| 204 | section for further information. | ||
| 205 | |||
| 206 | Changing the Default SDK Installation Directory | ||
| 207 | =============================================== | ||
| 208 | |||
| 209 | When you build the installer for the Extensible SDK, the default | ||
| 210 | installation directory for the SDK is based on the | ||
| 211 | :term:`DISTRO` and | ||
| 212 | :term:`SDKEXTPATH` variables from | ||
| 213 | within the | ||
| 214 | :ref:`populate_sdk_base <ref-classes-populate-sdk-*>` | ||
| 215 | class as follows:: | ||
| 216 | |||
| 217 | SDKEXTPATH ??= "~/${@d.getVar('DISTRO')}_sdk" | ||
| 218 | |||
| 219 | You can | ||
| 220 | change this default installation directory by specifically setting the | ||
| 221 | :term:`SDKEXTPATH` variable. | ||
| 222 | |||
| 223 | While there are several ways of setting this variable, | ||
| 224 | the method that makes the most sense is to set the variable in your | ||
| 225 | distribution's configuration file. Doing so creates an SDK installer | ||
| 226 | default directory that applies across your distribution. As an example, | ||
| 227 | assume you have your own layer for your distribution named | ||
| 228 | "meta-mydistro" and you are using the same type of file hierarchy as | ||
| 229 | does the default "poky" distribution. If so, you could update the | ||
| 230 | :term:`SDKEXTPATH` variable in the | ||
| 231 | ``~/meta-mydistro/conf/distro/mydistro.conf`` file using the following | ||
| 232 | form:: | ||
| 233 | |||
| 234 | SDKEXTPATH = "some_path_for_your_installed_sdk" | ||
| 235 | |||
| 236 | After building your installer, running it prompts the user for | ||
| 237 | acceptance of the some_path_for_your_installed_sdk directory as the | ||
| 238 | default location to install the Extensible SDK. | ||
| 239 | |||
| 240 | Providing Additional Installable Extensible SDK Content | ||
| 241 | ======================================================= | ||
| 242 | |||
| 243 | If you want the users of an extensible SDK you build to be able to add | ||
| 244 | items to the SDK without requiring the users to build the items from | ||
| 245 | source, you need to do a number of things: | ||
| 246 | |||
| 247 | #. Ensure the additional items you want the user to be able to install | ||
| 248 | are already built: | ||
| 249 | |||
| 250 | - Build the items explicitly. You could use one or more "meta" | ||
| 251 | recipes that depend on lists of other recipes. | ||
| 252 | |||
| 253 | - Build the "world" target and set | ||
| 254 | ``EXCLUDE_FROM_WORLD:pn-``\ recipename for the recipes you do not | ||
| 255 | want built. See the | ||
| 256 | :term:`EXCLUDE_FROM_WORLD` | ||
| 257 | variable for additional information. | ||
| 258 | |||
| 259 | #. Expose the ``sstate-cache`` directory produced by the build. | ||
| 260 | Typically, you expose this directory by making it available through | ||
| 261 | an :wikipedia:`Apache HTTP Server <Apache_HTTP_Server>` or | ||
| 262 | :wikipedia:`Nginx <Nginx>` server. | ||
| 263 | |||
| 264 | #. Set the appropriate configuration so that the produced SDK knows how | ||
| 265 | to find the configuration. The variable you need to set is | ||
| 266 | :term:`SSTATE_MIRRORS`:: | ||
| 267 | |||
| 268 | SSTATE_MIRRORS = "file://.* https://example.com/some_path/sstate-cache/PATH" | ||
| 269 | |||
| 270 | You can set the :term:`SSTATE_MIRRORS` variable in two different places: | ||
| 271 | |||
| 272 | - If the mirror value you are setting is appropriate to be set for | ||
| 273 | both the OpenEmbedded build system that is actually building the | ||
| 274 | SDK and the SDK itself (i.e. the mirror is accessible in both | ||
| 275 | places or it will fail quickly on the OpenEmbedded build system | ||
| 276 | side, and its contents will not interfere with the build), then | ||
| 277 | you can set the variable in your ``local.conf`` or custom distro | ||
| 278 | configuration file. You can then pass the variable to the SDK by | ||
| 279 | adding the following:: | ||
| 280 | |||
| 281 | ESDK_LOCALCONF_ALLOW = "SSTATE_MIRRORS" | ||
| 282 | |||
| 283 | - Alternatively, if you just want to set the :term:`SSTATE_MIRRORS` | ||
| 284 | variable's value for the SDK alone, create a ``conf/sdk-extra.conf`` | ||
| 285 | file either in your :term:`Build Directory` or within any | ||
| 286 | layer and put your :term:`SSTATE_MIRRORS` setting within that file. | ||
| 287 | |||
| 288 | .. note:: | ||
| 289 | |||
| 290 | This second option is the safest option should you have any | ||
| 291 | doubts as to which method to use when setting | ||
| 292 | :term:`SSTATE_MIRRORS` | ||
| 293 | |||
| 294 | Minimizing the Size of the Extensible SDK Installer Download | ||
| 295 | ============================================================ | ||
| 296 | |||
| 297 | By default, the extensible SDK bundles the shared state artifacts for | ||
| 298 | everything needed to reconstruct the image for which the SDK was built. | ||
| 299 | This bundling can lead to an SDK installer file that is a Gigabyte or | ||
| 300 | more in size. If the size of this file causes a problem, you can build | ||
| 301 | an SDK that has just enough in it to install and provide access to the | ||
| 302 | ``devtool command`` by setting the following in your configuration:: | ||
| 303 | |||
| 304 | SDK_EXT_TYPE = "minimal" | ||
| 305 | |||
| 306 | Setting | ||
| 307 | :term:`SDK_EXT_TYPE` to | ||
| 308 | "minimal" produces an SDK installer that is around 35 Mbytes in size, | ||
| 309 | which downloads and installs quickly. You need to realize, though, that | ||
| 310 | the minimal installer does not install any libraries or tools out of the | ||
| 311 | box. These libraries and tools must be installed either "on the fly" or | ||
| 312 | through actions you perform using ``devtool`` or explicitly with the | ||
| 313 | ``devtool sdk-install`` command. | ||
| 314 | |||
| 315 | In most cases, when building a minimal SDK you need to also enable | ||
| 316 | bringing in the information on a wider range of packages produced by the | ||
| 317 | system. Requiring this wider range of information is particularly true | ||
| 318 | so that ``devtool add`` is able to effectively map dependencies it | ||
| 319 | discovers in a source tree to the appropriate recipes. Additionally, the | ||
| 320 | information enables the ``devtool search`` command to return useful | ||
| 321 | results. | ||
| 322 | |||
| 323 | To facilitate this wider range of information, you would need to set the | ||
| 324 | following:: | ||
| 325 | |||
| 326 | SDK_INCLUDE_PKGDATA = "1" | ||
| 327 | |||
| 328 | See the :term:`SDK_INCLUDE_PKGDATA` variable for additional information. | ||
| 329 | |||
| 330 | Setting the :term:`SDK_INCLUDE_PKGDATA` variable as shown causes the "world" | ||
| 331 | target to be built so that information for all of the recipes included | ||
| 332 | within it are available. Having these recipes available increases build | ||
| 333 | time significantly and increases the size of the SDK installer by 30-80 | ||
| 334 | Mbytes depending on how many recipes are included in your configuration. | ||
| 335 | |||
| 336 | You can use ``EXCLUDE_FROM_WORLD:pn-``\ recipename for recipes you want | ||
| 337 | to exclude. However, it is assumed that you would need to be building | ||
| 338 | the "world" target if you want to provide additional items to the SDK. | ||
| 339 | Consequently, building for "world" should not represent undue overhead | ||
| 340 | in most cases. | ||
| 341 | |||
| 342 | .. note:: | ||
| 343 | |||
| 344 | If you set | ||
| 345 | SDK_EXT_TYPE | ||
| 346 | to "minimal", then providing a shared state mirror is mandatory so | ||
| 347 | that items can be installed as needed. See the | ||
| 348 | :ref:`sdk-manual/appendix-customizing:providing additional installable extensible sdk content` | ||
| 349 | section for more information. | ||
| 350 | |||
| 351 | You can explicitly control whether or not to include the toolchain when | ||
| 352 | you build an SDK by setting the | ||
| 353 | :term:`SDK_INCLUDE_TOOLCHAIN` | ||
| 354 | variable to "1". In particular, it is useful to include the toolchain | ||
| 355 | when you have set :term:`SDK_EXT_TYPE` to "minimal", which by default, | ||
| 356 | excludes the toolchain. Also, it is helpful if you are building a small | ||
| 357 | SDK for use with an IDE or some other tool where you do not want to take | ||
| 358 | extra steps to install a toolchain. | ||
