| 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 | Using the Extensible SDK | 
|  | 5 | ************************ | 
|  | 6 |  | 
|  | 7 | This chapter describes the extensible SDK and how to install it. | 
|  | 8 | Information covers the pieces of the SDK, how to install it, and | 
|  | 9 | presents a look at using the ``devtool`` functionality. The extensible | 
|  | 10 | SDK makes it easy to add new applications and libraries to an image, | 
|  | 11 | modify the source for an existing component, test changes on the target | 
|  | 12 | hardware, and ease integration into the rest of the | 
|  | 13 | :term:`OpenEmbedded Build System`. | 
|  | 14 |  | 
|  | 15 | .. note:: | 
|  | 16 |  | 
|  | 17 | For a side-by-side comparison of main features supported for an | 
|  | 18 | extensible SDK as compared to a standard SDK, see the " | 
|  | 19 | Introduction | 
|  | 20 | " section. | 
|  | 21 |  | 
|  | 22 | In addition to the functionality available through ``devtool``, you can | 
|  | 23 | alternatively make use of the toolchain directly, for example from | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame^] | 24 | Makefile and Autotools. See the | 
|  | 25 | ":ref:`sdk-manual/working-projects:using the sdk toolchain directly`" chapter | 
|  | 26 | for more information. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 27 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 28 | Why use the Extensible SDK and What is in It? | 
|  | 29 | ============================================= | 
|  | 30 |  | 
|  | 31 | The extensible SDK provides a cross-development toolchain and libraries | 
|  | 32 | tailored to the contents of a specific image. You would use the | 
|  | 33 | Extensible SDK if you want a toolchain experience supplemented with the | 
|  | 34 | powerful set of ``devtool`` commands tailored for the Yocto Project | 
|  | 35 | environment. | 
|  | 36 |  | 
|  | 37 | The installed extensible SDK consists of several files and directories. | 
|  | 38 | Basically, it contains an SDK environment setup script, some | 
|  | 39 | configuration files, an internal build system, and the ``devtool`` | 
|  | 40 | functionality. | 
|  | 41 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 42 | Installing the Extensible SDK | 
|  | 43 | ============================= | 
|  | 44 |  | 
|  | 45 | The first thing you need to do is install the SDK on your :term:`Build | 
|  | 46 | Host` by running the ``*.sh`` installation script. | 
|  | 47 |  | 
|  | 48 | You can download a tarball installer, which includes the pre-built | 
|  | 49 | toolchain, the ``runqemu`` script, the internal build system, | 
|  | 50 | ``devtool``, and support files from the appropriate | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 51 | :yocto_dl:`toolchain </releases/yocto/yocto-&DISTRO;/toolchain/>` directory within the Index of | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 52 | Releases. Toolchains are available for several 32-bit and 64-bit | 
|  | 53 | architectures with the ``x86_64`` directories, respectively. The | 
|  | 54 | toolchains the Yocto Project provides are based off the | 
|  | 55 | ``core-image-sato`` and ``core-image-minimal`` images and contain | 
|  | 56 | libraries appropriate for developing against that image. | 
|  | 57 |  | 
|  | 58 | The names of the tarball installer scripts are such that a string | 
|  | 59 | representing the host system appears first in the filename and then is | 
|  | 60 | immediately followed by a string representing the target architecture. | 
|  | 61 | An extensible SDK has the string "-ext" as part of the name. Following | 
|  | 62 | is the general form: | 
|  | 63 | :: | 
|  | 64 |  | 
|  | 65 | poky-glibc-host_system-image_type-arch-toolchain-ext-release_version.sh | 
|  | 66 |  | 
|  | 67 | Where: | 
|  | 68 | host_system is a string representing your development system: | 
|  | 69 |  | 
|  | 70 | i686 or x86_64. | 
|  | 71 |  | 
|  | 72 | image_type is the image for which the SDK was built: | 
|  | 73 |  | 
|  | 74 | core-image-sato or core-image-minimal | 
|  | 75 |  | 
|  | 76 | arch is a string representing the tuned target architecture: | 
|  | 77 |  | 
|  | 78 | aarch64, armv5e, core2-64, i586, mips32r2, mips64, ppc7400, or cortexa8hf-neon | 
|  | 79 |  | 
|  | 80 | release_version is a string representing the release number of the Yocto Project: | 
|  | 81 |  | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 82 | &DISTRO;, &DISTRO;+snapshot | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 83 |  | 
|  | 84 | For example, the following SDK installer is for a 64-bit | 
|  | 85 | development host system and a i586-tuned target architecture based off | 
| Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 86 | the SDK for ``core-image-sato`` and using the current &DISTRO; snapshot: | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 87 | :: | 
|  | 88 |  | 
| Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 89 | poky-glibc-x86_64-core-image-sato-i586-toolchain-ext-&DISTRO;.sh | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 90 |  | 
|  | 91 | .. note:: | 
|  | 92 |  | 
|  | 93 | As an alternative to downloading an SDK, you can build the SDK | 
|  | 94 | installer. For information on building the installer, see the " | 
|  | 95 | Building an SDK Installer | 
|  | 96 | " section. | 
|  | 97 |  | 
|  | 98 | The SDK and toolchains are self-contained and by default are installed | 
|  | 99 | into the ``poky_sdk`` folder in your home directory. You can choose to | 
|  | 100 | install the extensible SDK in any location when you run the installer. | 
|  | 101 | However, because files need to be written under that directory during | 
|  | 102 | the normal course of operation, the location you choose for installation | 
|  | 103 | must be writable for whichever users need to use the SDK. | 
|  | 104 |  | 
|  | 105 | The following command shows how to run the installer given a toolchain | 
|  | 106 | tarball for a 64-bit x86 development host system and a 64-bit x86 target | 
|  | 107 | architecture. The example assumes the SDK installer is located in | 
|  | 108 | ``~/Downloads/`` and has execution rights. | 
|  | 109 |  | 
|  | 110 | .. note:: | 
|  | 111 |  | 
|  | 112 | If you do not have write permissions for the directory into which you | 
|  | 113 | are installing the SDK, the installer notifies you and exits. For | 
|  | 114 | that case, set up the proper permissions in the directory and run the | 
|  | 115 | installer again. | 
|  | 116 |  | 
|  | 117 | :: | 
|  | 118 |  | 
|  | 119 | $ ./Downloads/poky-glibc-x86_64-core-image-minimal-core2-64-toolchain-ext-2.5.sh | 
|  | 120 | Poky (Yocto Project Reference Distro) Extensible SDK installer version 2.5 | 
|  | 121 | ========================================================================== | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 122 | Enter target directory for SDK (default: poky_sdk): | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 123 | You are about to install the SDK to "/home/scottrif/poky_sdk". Proceed [Y/n]? Y | 
|  | 124 | Extracting SDK..............done | 
|  | 125 | Setting it up... | 
|  | 126 | Extracting buildtools... | 
|  | 127 | Preparing build system... | 
|  | 128 | Parsing recipes: 100% |##################################################################| Time: 0:00:52 | 
|  | 129 | Initialising tasks: 100% |###############################################################| Time: 0:00:00 | 
|  | 130 | Checking sstate mirror object availability: 100% |#######################################| Time: 0:00:00 | 
|  | 131 | Loading cache: 100% |####################################################################| Time: 0:00:00 | 
|  | 132 | Initialising tasks: 100% |###############################################################| Time: 0:00:00 | 
|  | 133 | done | 
|  | 134 | SDK has been successfully set up and is ready to be used. | 
|  | 135 | Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. | 
|  | 136 | $ . /home/scottrif/poky_sdk/environment-setup-core2-64-poky-linux | 
|  | 137 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 138 | Running the Extensible SDK Environment Setup Script | 
|  | 139 | =================================================== | 
|  | 140 |  | 
|  | 141 | Once you have the SDK installed, you must run the SDK environment setup | 
|  | 142 | script before you can actually use the SDK. This setup script resides in | 
|  | 143 | the directory you chose when you installed the SDK, which is either the | 
|  | 144 | default ``poky_sdk`` directory or the directory you chose during | 
|  | 145 | installation. | 
|  | 146 |  | 
|  | 147 | Before running the script, be sure it is the one that matches the | 
|  | 148 | architecture for which you are developing. Environment setup scripts | 
|  | 149 | begin with the string "``environment-setup``" and include as part of | 
|  | 150 | their name the tuned target architecture. As an example, the following | 
|  | 151 | commands set the working directory to where the SDK was installed and | 
|  | 152 | then source the environment setup script. In this example, the setup | 
|  | 153 | script is for an IA-based target machine using i586 tuning: | 
|  | 154 | :: | 
|  | 155 |  | 
|  | 156 | $ cd /home/scottrif/poky_sdk | 
|  | 157 | $ source environment-setup-core2-64-poky-linux | 
|  | 158 | SDK environment now set up; additionally you may now run devtool to perform development tasks. | 
|  | 159 | Run devtool --help for further details. | 
|  | 160 |  | 
|  | 161 | Running the setup script defines many environment variables needed in | 
|  | 162 | order to use the SDK (e.g. ``PATH``, | 
|  | 163 | :term:`CC`, | 
|  | 164 | :term:`LD`, and so forth). If you want to | 
|  | 165 | see all the environment variables the script exports, examine the | 
|  | 166 | installation file itself. | 
|  | 167 |  | 
|  | 168 | Using ``devtool`` in Your SDK Workflow | 
|  | 169 | ====================================== | 
|  | 170 |  | 
|  | 171 | The cornerstone of the extensible SDK is a command-line tool called | 
|  | 172 | ``devtool``. This tool provides a number of features that help you | 
|  | 173 | build, test and package software within the extensible SDK, and | 
|  | 174 | optionally integrate it into an image built by the OpenEmbedded build | 
|  | 175 | system. | 
|  | 176 |  | 
|  | 177 | .. note:: | 
|  | 178 |  | 
|  | 179 | The use of | 
|  | 180 | devtool | 
|  | 181 | is not limited to the extensible SDK. You can use | 
|  | 182 | devtool | 
|  | 183 | to help you easily develop any project whose build output must be | 
|  | 184 | part of an image built using the build system. | 
|  | 185 |  | 
|  | 186 | The ``devtool`` command line is organized similarly to | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 187 | :ref:`overview-manual/development-environment:git` in that it has a number of | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 188 | sub-commands for each function. You can run ``devtool --help`` to see | 
|  | 189 | all the commands. | 
|  | 190 |  | 
|  | 191 | .. note:: | 
|  | 192 |  | 
|  | 193 | See the " | 
|  | 194 | devtool | 
|  | 195 |  Quick Reference | 
|  | 196 | " in the Yocto Project Reference Manual for a | 
|  | 197 | devtool | 
|  | 198 | quick reference. | 
|  | 199 |  | 
|  | 200 | Three ``devtool`` subcommands exist that provide entry-points into | 
|  | 201 | development: | 
|  | 202 |  | 
|  | 203 | -  *devtool add*: Assists in adding new software to be built. | 
|  | 204 |  | 
|  | 205 | -  *devtool modify*: Sets up an environment to enable you to modify | 
|  | 206 | the source of an existing component. | 
|  | 207 |  | 
|  | 208 | -  *devtool upgrade*: Updates an existing recipe so that you can | 
|  | 209 | build it for an updated set of source files. | 
|  | 210 |  | 
|  | 211 | As with the build system, "recipes" represent software packages within | 
|  | 212 | ``devtool``. When you use ``devtool add``, a recipe is automatically | 
|  | 213 | created. When you use ``devtool modify``, the specified existing recipe | 
|  | 214 | is used in order to determine where to get the source code and how to | 
|  | 215 | patch it. In both cases, an environment is set up so that when you build | 
|  | 216 | the recipe a source tree that is under your control is used in order to | 
|  | 217 | allow you to make changes to the source as desired. By default, new | 
|  | 218 | recipes and the source go into a "workspace" directory under the SDK. | 
|  | 219 |  | 
|  | 220 | The remainder of this section presents the ``devtool add``, | 
|  | 221 | ``devtool modify``, and ``devtool upgrade`` workflows. | 
|  | 222 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 223 | Use ``devtool add`` to Add an Application | 
|  | 224 | ----------------------------------------- | 
|  | 225 |  | 
|  | 226 | The ``devtool add`` command generates a new recipe based on existing | 
|  | 227 | source code. This command takes advantage of the | 
|  | 228 | :ref:`devtool-the-workspace-layer-structure` | 
|  | 229 | layer that many ``devtool`` commands use. The command is flexible enough | 
|  | 230 | to allow you to extract source code into both the workspace or a | 
|  | 231 | separate local Git repository and to use existing code that does not | 
|  | 232 | need to be extracted. | 
|  | 233 |  | 
|  | 234 | Depending on your particular scenario, the arguments and options you use | 
|  | 235 | with ``devtool add`` form different combinations. The following diagram | 
|  | 236 | shows common development flows you would use with the ``devtool add`` | 
|  | 237 | command: | 
|  | 238 |  | 
|  | 239 | .. image:: figures/sdk-devtool-add-flow.png | 
|  | 240 | :align: center | 
|  | 241 |  | 
|  | 242 | 1. *Generating the New Recipe*: The top part of the flow shows three | 
|  | 243 | scenarios by which you could use ``devtool add`` to generate a recipe | 
|  | 244 | based on existing source code. | 
|  | 245 |  | 
|  | 246 | In a shared development environment, it is typical for other | 
|  | 247 | developers to be responsible for various areas of source code. As a | 
|  | 248 | developer, you are probably interested in using that source code as | 
|  | 249 | part of your development within the Yocto Project. All you need is | 
|  | 250 | access to the code, a recipe, and a controlled area in which to do | 
|  | 251 | your work. | 
|  | 252 |  | 
|  | 253 | Within the diagram, three possible scenarios feed into the | 
|  | 254 | ``devtool add`` workflow: | 
|  | 255 |  | 
|  | 256 | -  *Left*: The left scenario in the figure represents a common | 
|  | 257 | situation where the source code does not exist locally and needs | 
|  | 258 | to be extracted. In this situation, the source code is extracted | 
|  | 259 | to the default workspace - you do not want the files in some | 
|  | 260 | specific location outside of the workspace. Thus, everything you | 
|  | 261 | need will be located in the workspace: | 
|  | 262 | :: | 
|  | 263 |  | 
|  | 264 | $ devtool add recipe fetchuri | 
|  | 265 |  | 
|  | 266 | With this command, ``devtool`` extracts the upstream | 
|  | 267 | source files into a local Git repository within the ``sources`` | 
|  | 268 | folder. The command then creates a recipe named recipe and a | 
|  | 269 | corresponding append file in the workspace. If you do not provide | 
|  | 270 | recipe, the command makes an attempt to determine the recipe name. | 
|  | 271 |  | 
|  | 272 | -  *Middle*: The middle scenario in the figure also represents a | 
|  | 273 | situation where the source code does not exist locally. In this | 
|  | 274 | case, the code is again upstream and needs to be extracted to some | 
|  | 275 | local area - this time outside of the default workspace. | 
|  | 276 |  | 
|  | 277 | .. note:: | 
|  | 278 |  | 
|  | 279 | If required, | 
|  | 280 | devtool | 
|  | 281 | always creates a Git repository locally during the extraction. | 
|  | 282 |  | 
|  | 283 | Furthermore, the first positional argument srctree in this case | 
|  | 284 | identifies where the ``devtool add`` command will locate the | 
|  | 285 | extracted code outside of the workspace. You need to specify an | 
|  | 286 | empty directory: | 
|  | 287 | :: | 
|  | 288 |  | 
|  | 289 | $ devtool add recipe srctree fetchuri | 
|  | 290 |  | 
|  | 291 | In summary, | 
|  | 292 | the source code is pulled from fetchuri and extracted into the | 
|  | 293 | location defined by srctree as a local Git repository. | 
|  | 294 |  | 
|  | 295 | Within workspace, ``devtool`` creates a recipe named recipe along | 
|  | 296 | with an associated append file. | 
|  | 297 |  | 
|  | 298 | -  *Right*: The right scenario in the figure represents a situation | 
|  | 299 | where the srctree has been previously prepared outside of the | 
|  | 300 | ``devtool`` workspace. | 
|  | 301 |  | 
|  | 302 | The following command provides a new recipe name and identifies | 
|  | 303 | the existing source tree location: | 
|  | 304 | :: | 
|  | 305 |  | 
|  | 306 | $ devtool add recipe srctree | 
|  | 307 |  | 
|  | 308 | The command examines the source code and creates a recipe named | 
|  | 309 | recipe for the code and places the recipe into the workspace. | 
|  | 310 |  | 
|  | 311 | Because the extracted source code already exists, ``devtool`` does | 
|  | 312 | not try to relocate the source code into the workspace - only the | 
|  | 313 | new recipe is placed in the workspace. | 
|  | 314 |  | 
|  | 315 | Aside from a recipe folder, the command also creates an associated | 
|  | 316 | append folder and places an initial ``*.bbappend`` file within. | 
|  | 317 |  | 
|  | 318 | 2. *Edit the Recipe*: You can use ``devtool edit-recipe`` to open up the | 
|  | 319 | editor as defined by the ``$EDITOR`` environment variable and modify | 
|  | 320 | the file: | 
|  | 321 | :: | 
|  | 322 |  | 
|  | 323 | $ devtool edit-recipe recipe | 
|  | 324 |  | 
|  | 325 | From within the editor, you | 
|  | 326 | can make modifications to the recipe that take affect when you build | 
|  | 327 | it later. | 
|  | 328 |  | 
|  | 329 | 3. *Build the Recipe or Rebuild the Image*: The next step you take | 
|  | 330 | depends on what you are going to do with the new code. | 
|  | 331 |  | 
|  | 332 | If you need to eventually move the build output to the target | 
|  | 333 | hardware, use the following ``devtool`` command: | 
|  | 334 | :; | 
|  | 335 |  | 
|  | 336 | $ devtool build recipe | 
|  | 337 |  | 
|  | 338 | On the other hand, if you want an image to contain the recipe's | 
|  | 339 | packages from the workspace for immediate deployment onto a device | 
|  | 340 | (e.g. for testing purposes), you can use the ``devtool build-image`` | 
|  | 341 | command: | 
|  | 342 | :: | 
|  | 343 |  | 
|  | 344 | $ devtool build-image image | 
|  | 345 |  | 
|  | 346 | 4. *Deploy the Build Output*: When you use the ``devtool build`` command | 
|  | 347 | to build out your recipe, you probably want to see if the resulting | 
|  | 348 | build output works as expected on the target hardware. | 
|  | 349 |  | 
|  | 350 | .. note:: | 
|  | 351 |  | 
|  | 352 | This step assumes you have a previously built image that is | 
|  | 353 | already either running in QEMU or is running on actual hardware. | 
|  | 354 | Also, it is assumed that for deployment of the image to the | 
|  | 355 | target, SSH is installed in the image and, if the image is running | 
|  | 356 | on real hardware, you have network access to and from your | 
|  | 357 | development machine. | 
|  | 358 |  | 
|  | 359 | You can deploy your build output to that target hardware by using the | 
|  | 360 | ``devtool deploy-target`` command: $ devtool deploy-target recipe | 
|  | 361 | target The target is a live target machine running as an SSH server. | 
|  | 362 |  | 
|  | 363 | You can, of course, also deploy the image you build to actual | 
|  | 364 | hardware by using the ``devtool build-image`` command. However, | 
|  | 365 | ``devtool`` does not provide a specific command that allows you to | 
|  | 366 | deploy the image to actual hardware. | 
|  | 367 |  | 
|  | 368 | 5. *Finish Your Work With the Recipe*: The ``devtool finish`` command | 
|  | 369 | creates any patches corresponding to commits in the local Git | 
|  | 370 | repository, moves the new recipe to a more permanent layer, and then | 
|  | 371 | resets the recipe so that the recipe is built normally rather than | 
|  | 372 | from the workspace. | 
|  | 373 | :: | 
|  | 374 |  | 
|  | 375 | $ devtool finish recipe layer | 
|  | 376 |  | 
|  | 377 | .. note:: | 
|  | 378 |  | 
|  | 379 | Any changes you want to turn into patches must be committed to the | 
|  | 380 | Git repository in the source tree. | 
|  | 381 |  | 
|  | 382 | As mentioned, the ``devtool finish`` command moves the final recipe | 
|  | 383 | to its permanent layer. | 
|  | 384 |  | 
|  | 385 | As a final process of the ``devtool finish`` command, the state of | 
|  | 386 | the standard layers and the upstream source is restored so that you | 
|  | 387 | can build the recipe from those areas rather than the workspace. | 
|  | 388 |  | 
|  | 389 | .. note:: | 
|  | 390 |  | 
|  | 391 | You can use the | 
|  | 392 | devtool reset | 
|  | 393 | command to put things back should you decide you do not want to | 
|  | 394 | proceed with your work. If you do use this command, realize that | 
|  | 395 | the source tree is preserved. | 
|  | 396 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 397 | Use ``devtool modify`` to Modify the Source of an Existing Component | 
|  | 398 | -------------------------------------------------------------------- | 
|  | 399 |  | 
|  | 400 | The ``devtool modify`` command prepares the way to work on existing code | 
|  | 401 | that already has a local recipe in place that is used to build the | 
|  | 402 | software. The command is flexible enough to allow you to extract code | 
|  | 403 | from an upstream source, specify the existing recipe, and keep track of | 
|  | 404 | and gather any patch files from other developers that are associated | 
|  | 405 | with the code. | 
|  | 406 |  | 
|  | 407 | Depending on your particular scenario, the arguments and options you use | 
|  | 408 | with ``devtool modify`` form different combinations. The following | 
|  | 409 | diagram shows common development flows for the ``devtool modify`` | 
|  | 410 | command: | 
|  | 411 |  | 
|  | 412 | .. image:: figures/sdk-devtool-modify-flow.png | 
|  | 413 | :align: center | 
|  | 414 |  | 
|  | 415 | 1. *Preparing to Modify the Code*: The top part of the flow shows three | 
|  | 416 | scenarios by which you could use ``devtool modify`` to prepare to | 
|  | 417 | work on source files. Each scenario assumes the following: | 
|  | 418 |  | 
|  | 419 | -  The recipe exists locally in a layer external to the ``devtool`` | 
|  | 420 | workspace. | 
|  | 421 |  | 
|  | 422 | -  The source files exist either upstream in an un-extracted state or | 
|  | 423 | locally in a previously extracted state. | 
|  | 424 |  | 
|  | 425 | The typical situation is where another developer has created a layer | 
|  | 426 | for use with the Yocto Project and their recipe already resides in | 
|  | 427 | that layer. Furthermore, their source code is readily available | 
|  | 428 | either upstream or locally. | 
|  | 429 |  | 
|  | 430 | -  *Left*: The left scenario in the figure represents a common | 
|  | 431 | situation where the source code does not exist locally and it | 
|  | 432 | needs to be extracted from an upstream source. In this situation, | 
|  | 433 | the source is extracted into the default ``devtool`` workspace | 
|  | 434 | location. The recipe, in this scenario, is in its own layer | 
|  | 435 | outside the workspace (i.e. ``meta-``\ layername). | 
|  | 436 |  | 
|  | 437 | The following command identifies the recipe and, by default, | 
|  | 438 | extracts the source files: | 
|  | 439 | :: | 
|  | 440 |  | 
|  | 441 | $ devtool modify recipe | 
|  | 442 |  | 
|  | 443 | Once | 
|  | 444 | ``devtool``\ locates the recipe, ``devtool`` uses the recipe's | 
|  | 445 | :term:`SRC_URI` statements to | 
|  | 446 | locate the source code and any local patch files from other | 
|  | 447 | developers. | 
|  | 448 |  | 
|  | 449 | With this scenario, no srctree argument exists. Consequently, the | 
|  | 450 | default behavior of the ``devtool modify`` command is to extract | 
|  | 451 | the source files pointed to by the ``SRC_URI`` statements into a | 
|  | 452 | local Git structure. Furthermore, the location for the extracted | 
|  | 453 | source is the default area within the ``devtool`` workspace. The | 
|  | 454 | result is that the command sets up both the source code and an | 
|  | 455 | append file within the workspace while the recipe remains in its | 
|  | 456 | original location. | 
|  | 457 |  | 
|  | 458 | Additionally, if you have any non-patch local files (i.e. files | 
|  | 459 | referred to with ``file://`` entries in ``SRC_URI`` statement | 
|  | 460 | excluding ``*.patch/`` or ``*.diff``), these files are copied to | 
|  | 461 | an ``oe-local-files`` folder under the newly created source tree. | 
|  | 462 | Copying the files here gives you a convenient area from which you | 
|  | 463 | can modify the files. Any changes or additions you make to those | 
|  | 464 | files are incorporated into the build the next time you build the | 
|  | 465 | software just as are other changes you might have made to the | 
|  | 466 | source. | 
|  | 467 |  | 
|  | 468 | -  *Middle*: The middle scenario in the figure represents a situation | 
|  | 469 | where the source code also does not exist locally. In this case, | 
|  | 470 | the code is again upstream and needs to be extracted to some local | 
|  | 471 | area as a Git repository. The recipe, in this scenario, is again | 
|  | 472 | local and in its own layer outside the workspace. | 
|  | 473 |  | 
|  | 474 | The following command tells ``devtool`` the recipe with which to | 
|  | 475 | work and, in this case, identifies a local area for the extracted | 
|  | 476 | source files that exists outside of the default ``devtool`` | 
|  | 477 | workspace: | 
|  | 478 | :: | 
|  | 479 |  | 
|  | 480 | $ devtool modify recipe srctree | 
|  | 481 |  | 
|  | 482 | .. note:: | 
|  | 483 |  | 
|  | 484 | You cannot provide a URL for | 
|  | 485 | srctree | 
|  | 486 | using the | 
|  | 487 | devtool | 
|  | 488 | command. | 
|  | 489 |  | 
|  | 490 | As with all extractions, the command uses the recipe's ``SRC_URI`` | 
|  | 491 | statements to locate the source files and any associated patch | 
|  | 492 | files. Non-patch files are copied to an ``oe-local-files`` folder | 
|  | 493 | under the newly created source tree. | 
|  | 494 |  | 
|  | 495 | Once the files are located, the command by default extracts them | 
|  | 496 | into srctree. | 
|  | 497 |  | 
|  | 498 | Within workspace, ``devtool`` creates an append file for the | 
|  | 499 | recipe. The recipe remains in its original location but the source | 
|  | 500 | files are extracted to the location you provide with srctree. | 
|  | 501 |  | 
|  | 502 | -  *Right*: The right scenario in the figure represents a situation | 
|  | 503 | where the source tree (srctree) already exists locally as a | 
|  | 504 | previously extracted Git structure outside of the ``devtool`` | 
|  | 505 | workspace. In this example, the recipe also exists elsewhere | 
|  | 506 | locally in its own layer. | 
|  | 507 |  | 
|  | 508 | The following command tells ``devtool`` the recipe with which to | 
|  | 509 | work, uses the "-n" option to indicate source does not need to be | 
|  | 510 | extracted, and uses srctree to point to the previously extracted | 
|  | 511 | source files: | 
|  | 512 | :: | 
|  | 513 |  | 
|  | 514 | $ devtool modify -n recipe srctree | 
|  | 515 |  | 
|  | 516 | If an ``oe-local-files`` subdirectory happens to exist and it | 
|  | 517 | contains non-patch files, the files are used. However, if the | 
|  | 518 | subdirectory does not exist and you run the ``devtool finish`` | 
|  | 519 | command, any non-patch files that might exist next to the recipe | 
|  | 520 | are removed because it appears to ``devtool`` that you have | 
|  | 521 | deleted those files. | 
|  | 522 |  | 
|  | 523 | Once the ``devtool modify`` command finishes, it creates only an | 
|  | 524 | append file for the recipe in the ``devtool`` workspace. The | 
|  | 525 | recipe and the source code remain in their original locations. | 
|  | 526 |  | 
|  | 527 | 2. *Edit the Source*: Once you have used the ``devtool modify`` command, | 
|  | 528 | you are free to make changes to the source files. You can use any | 
|  | 529 | editor you like to make and save your source code modifications. | 
|  | 530 |  | 
|  | 531 | 3. *Build the Recipe or Rebuild the Image*: The next step you take | 
|  | 532 | depends on what you are going to do with the new code. | 
|  | 533 |  | 
|  | 534 | If you need to eventually move the build output to the target | 
|  | 535 | hardware, use the following ``devtool`` command: | 
|  | 536 | :: | 
|  | 537 |  | 
|  | 538 | $ devtool build recipe | 
|  | 539 |  | 
|  | 540 | On the other hand, if you want an image to contain the recipe's | 
|  | 541 | packages from the workspace for immediate deployment onto a device | 
|  | 542 | (e.g. for testing purposes), you can use the ``devtool build-image`` | 
|  | 543 | command: $ devtool build-image image | 
|  | 544 |  | 
|  | 545 | 4. *Deploy the Build Output*: When you use the ``devtool build`` command | 
|  | 546 | to build out your recipe, you probably want to see if the resulting | 
|  | 547 | build output works as expected on target hardware. | 
|  | 548 |  | 
|  | 549 | .. note:: | 
|  | 550 |  | 
|  | 551 | This step assumes you have a previously built image that is | 
|  | 552 | already either running in QEMU or running on actual hardware. | 
|  | 553 | Also, it is assumed that for deployment of the image to the | 
|  | 554 | target, SSH is installed in the image and if the image is running | 
|  | 555 | on real hardware that you have network access to and from your | 
|  | 556 | development machine. | 
|  | 557 |  | 
|  | 558 | You can deploy your build output to that target hardware by using the | 
|  | 559 | ``devtool deploy-target`` command: | 
|  | 560 | :: | 
|  | 561 |  | 
|  | 562 | $ devtool deploy-target recipe target | 
|  | 563 |  | 
|  | 564 | The target is a live target machine running as an SSH server. | 
|  | 565 |  | 
|  | 566 | You can, of course, use other methods to deploy the image you built | 
|  | 567 | using the ``devtool build-image`` command to actual hardware. | 
|  | 568 | ``devtool`` does not provide a specific command to deploy the image | 
|  | 569 | to actual hardware. | 
|  | 570 |  | 
|  | 571 | 5. *Finish Your Work With the Recipe*: The ``devtool finish`` command | 
|  | 572 | creates any patches corresponding to commits in the local Git | 
|  | 573 | repository, updates the recipe to point to them (or creates a | 
|  | 574 | ``.bbappend`` file to do so, depending on the specified destination | 
|  | 575 | layer), and then resets the recipe so that the recipe is built | 
|  | 576 | normally rather than from the workspace. | 
|  | 577 | :: | 
|  | 578 |  | 
|  | 579 | $ devtool finish recipe layer | 
|  | 580 |  | 
|  | 581 | .. note:: | 
|  | 582 |  | 
|  | 583 | Any changes you want to turn into patches must be staged and | 
|  | 584 | committed within the local Git repository before you use the | 
|  | 585 | devtool finish | 
|  | 586 | command. | 
|  | 587 |  | 
|  | 588 | Because there is no need to move the recipe, ``devtool finish`` | 
|  | 589 | either updates the original recipe in the original layer or the | 
|  | 590 | command creates a ``.bbappend`` file in a different layer as provided | 
|  | 591 | by layer. Any work you did in the ``oe-local-files`` directory is | 
|  | 592 | preserved in the original files next to the recipe during the | 
|  | 593 | ``devtool finish`` command. | 
|  | 594 |  | 
|  | 595 | As a final process of the ``devtool finish`` command, the state of | 
|  | 596 | the standard layers and the upstream source is restored so that you | 
|  | 597 | can build the recipe from those areas rather than from the workspace. | 
|  | 598 |  | 
|  | 599 | .. note:: | 
|  | 600 |  | 
|  | 601 | You can use the | 
|  | 602 | devtool reset | 
|  | 603 | command to put things back should you decide you do not want to | 
|  | 604 | proceed with your work. If you do use this command, realize that | 
|  | 605 | the source tree is preserved. | 
|  | 606 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 607 | Use ``devtool upgrade`` to Create a Version of the Recipe that Supports a Newer Version of the Software | 
|  | 608 | ------------------------------------------------------------------------------------------------------- | 
|  | 609 |  | 
|  | 610 | The ``devtool upgrade`` command upgrades an existing recipe to that of a | 
|  | 611 | more up-to-date version found upstream. Throughout the life of software, | 
|  | 612 | recipes continually undergo version upgrades by their upstream | 
|  | 613 | publishers. You can use the ``devtool upgrade`` workflow to make sure | 
|  | 614 | your recipes you are using for builds are up-to-date with their upstream | 
|  | 615 | counterparts. | 
|  | 616 |  | 
|  | 617 | .. note:: | 
|  | 618 |  | 
|  | 619 | Several methods exist by which you can upgrade recipes - | 
|  | 620 | devtool upgrade | 
|  | 621 | happens to be one. You can read about all the methods by which you | 
|  | 622 | can upgrade recipes in the " | 
|  | 623 | Upgrading Recipes | 
|  | 624 | " section of the Yocto Project Development Tasks Manual. | 
|  | 625 |  | 
|  | 626 | The ``devtool upgrade`` command is flexible enough to allow you to | 
|  | 627 | specify source code revision and versioning schemes, extract code into | 
|  | 628 | or out of the ``devtool`` | 
|  | 629 | :ref:`devtool-the-workspace-layer-structure`, | 
|  | 630 | and work with any source file forms that the | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 631 | :ref:`fetchers <bitbake:bitbake-user-manual/bitbake-user-manual-fetching:fetchers>` support. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 632 |  | 
|  | 633 | The following diagram shows the common development flow used with the | 
|  | 634 | ``devtool upgrade`` command: | 
|  | 635 |  | 
|  | 636 | .. image:: figures/sdk-devtool-upgrade-flow.png | 
|  | 637 | :align: center | 
|  | 638 |  | 
|  | 639 | 1. *Initiate the Upgrade*: The top part of the flow shows the typical | 
|  | 640 | scenario by which you use the ``devtool upgrade`` command. The | 
|  | 641 | following conditions exist: | 
|  | 642 |  | 
|  | 643 | -  The recipe exists in a local layer external to the ``devtool`` | 
|  | 644 | workspace. | 
|  | 645 |  | 
|  | 646 | -  The source files for the new release exist in the same location | 
|  | 647 | pointed to by :term:`SRC_URI` | 
|  | 648 | in the recipe (e.g. a tarball with the new version number in the | 
|  | 649 | name, or as a different revision in the upstream Git repository). | 
|  | 650 |  | 
|  | 651 | A common situation is where third-party software has undergone a | 
|  | 652 | revision so that it has been upgraded. The recipe you have access to | 
|  | 653 | is likely in your own layer. Thus, you need to upgrade the recipe to | 
|  | 654 | use the newer version of the software: | 
|  | 655 | :: | 
|  | 656 |  | 
|  | 657 | $ devtool upgrade -V version recipe | 
|  | 658 |  | 
|  | 659 | By default, the ``devtool upgrade`` command extracts source | 
|  | 660 | code into the ``sources`` directory in the | 
|  | 661 | :ref:`devtool-the-workspace-layer-structure`. | 
|  | 662 | If you want the code extracted to any other location, you need to | 
|  | 663 | provide the srctree positional argument with the command as follows: | 
|  | 664 | $ devtool upgrade -V version recipe srctree | 
|  | 665 |  | 
|  | 666 | .. note:: | 
|  | 667 |  | 
|  | 668 | In this example, the "-V" option specifies the new version. If you | 
|  | 669 | don't use "-V", the command upgrades the recipe to the latest | 
|  | 670 | version. | 
|  | 671 |  | 
|  | 672 | If the source files pointed to by the ``SRC_URI`` statement in the | 
|  | 673 | recipe are in a Git repository, you must provide the "-S" option and | 
|  | 674 | specify a revision for the software. | 
|  | 675 |  | 
|  | 676 | Once ``devtool`` locates the recipe, it uses the ``SRC_URI`` variable | 
|  | 677 | to locate the source code and any local patch files from other | 
|  | 678 | developers. The result is that the command sets up the source code, | 
|  | 679 | the new version of the recipe, and an append file all within the | 
|  | 680 | workspace. | 
|  | 681 |  | 
|  | 682 | Additionally, if you have any non-patch local files (i.e. files | 
|  | 683 | referred to with ``file://`` entries in ``SRC_URI`` statement | 
|  | 684 | excluding ``*.patch/`` or ``*.diff``), these files are copied to an | 
|  | 685 | ``oe-local-files`` folder under the newly created source tree. | 
|  | 686 | Copying the files here gives you a convenient area from which you can | 
|  | 687 | modify the files. Any changes or additions you make to those files | 
|  | 688 | are incorporated into the build the next time you build the software | 
|  | 689 | just as are other changes you might have made to the source. | 
|  | 690 |  | 
|  | 691 | 2. *Resolve any Conflicts created by the Upgrade*: Conflicts could exist | 
|  | 692 | due to the software being upgraded to a new version. Conflicts occur | 
|  | 693 | if your recipe specifies some patch files in ``SRC_URI`` that | 
|  | 694 | conflict with changes made in the new version of the software. For | 
|  | 695 | such cases, you need to resolve the conflicts by editing the source | 
|  | 696 | and following the normal ``git rebase`` conflict resolution process. | 
|  | 697 |  | 
|  | 698 | Before moving onto the next step, be sure to resolve any such | 
|  | 699 | conflicts created through use of a newer or different version of the | 
|  | 700 | software. | 
|  | 701 |  | 
|  | 702 | 3. *Build the Recipe or Rebuild the Image*: The next step you take | 
|  | 703 | depends on what you are going to do with the new code. | 
|  | 704 |  | 
|  | 705 | If you need to eventually move the build output to the target | 
|  | 706 | hardware, use the following ``devtool`` command: | 
|  | 707 | :: | 
|  | 708 |  | 
|  | 709 | $ devtool build recipe | 
|  | 710 |  | 
|  | 711 | On the other hand, if you want an image to contain the recipe's | 
|  | 712 | packages from the workspace for immediate deployment onto a device | 
|  | 713 | (e.g. for testing purposes), you can use the ``devtool build-image`` | 
|  | 714 | command: | 
|  | 715 | :: | 
|  | 716 |  | 
|  | 717 | $ devtool build-image image | 
|  | 718 |  | 
|  | 719 | 4. *Deploy the Build Output*: When you use the ``devtool build`` command | 
|  | 720 | or ``bitbake`` to build your recipe, you probably want to see if the | 
|  | 721 | resulting build output works as expected on target hardware. | 
|  | 722 |  | 
|  | 723 | .. note:: | 
|  | 724 |  | 
|  | 725 | This step assumes you have a previously built image that is | 
|  | 726 | already either running in QEMU or running on actual hardware. | 
|  | 727 | Also, it is assumed that for deployment of the image to the | 
|  | 728 | target, SSH is installed in the image and if the image is running | 
|  | 729 | on real hardware that you have network access to and from your | 
|  | 730 | development machine. | 
|  | 731 |  | 
|  | 732 | You can deploy your build output to that target hardware by using the | 
|  | 733 | ``devtool deploy-target`` command: $ devtool deploy-target recipe | 
|  | 734 | target The target is a live target machine running as an SSH server. | 
|  | 735 |  | 
|  | 736 | You can, of course, also deploy the image you build using the | 
|  | 737 | ``devtool build-image`` command to actual hardware. However, | 
|  | 738 | ``devtool`` does not provide a specific command that allows you to do | 
|  | 739 | this. | 
|  | 740 |  | 
|  | 741 | 5. *Finish Your Work With the Recipe*: The ``devtool finish`` command | 
|  | 742 | creates any patches corresponding to commits in the local Git | 
|  | 743 | repository, moves the new recipe to a more permanent layer, and then | 
|  | 744 | resets the recipe so that the recipe is built normally rather than | 
|  | 745 | from the workspace. | 
|  | 746 |  | 
|  | 747 | Any work you did in the ``oe-local-files`` directory is preserved in | 
|  | 748 | the original files next to the recipe during the ``devtool finish`` | 
|  | 749 | command. | 
|  | 750 |  | 
|  | 751 | If you specify a destination layer that is the same as the original | 
|  | 752 | source, then the old version of the recipe and associated files are | 
|  | 753 | removed prior to adding the new version. | 
|  | 754 | :: | 
|  | 755 |  | 
|  | 756 | $ devtool finish recipe layer | 
|  | 757 |  | 
|  | 758 | .. note:: | 
|  | 759 |  | 
|  | 760 | Any changes you want to turn into patches must be committed to the | 
|  | 761 | Git repository in the source tree. | 
|  | 762 |  | 
|  | 763 | As a final process of the ``devtool finish`` command, the state of | 
|  | 764 | the standard layers and the upstream source is restored so that you | 
|  | 765 | can build the recipe from those areas rather than the workspace. | 
|  | 766 |  | 
|  | 767 | .. note:: | 
|  | 768 |  | 
|  | 769 | You can use the | 
|  | 770 | devtool reset | 
|  | 771 | command to put things back should you decide you do not want to | 
|  | 772 | proceed with your work. If you do use this command, realize that | 
|  | 773 | the source tree is preserved. | 
|  | 774 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 775 | A Closer Look at ``devtool add`` | 
|  | 776 | ================================ | 
|  | 777 |  | 
|  | 778 | The ``devtool add`` command automatically creates a recipe based on the | 
|  | 779 | source tree you provide with the command. Currently, the command has | 
|  | 780 | support for the following: | 
|  | 781 |  | 
|  | 782 | -  Autotools (``autoconf`` and ``automake``) | 
|  | 783 |  | 
|  | 784 | -  CMake | 
|  | 785 |  | 
|  | 786 | -  Scons | 
|  | 787 |  | 
|  | 788 | -  ``qmake`` | 
|  | 789 |  | 
|  | 790 | -  Plain ``Makefile`` | 
|  | 791 |  | 
|  | 792 | -  Out-of-tree kernel module | 
|  | 793 |  | 
|  | 794 | -  Binary package (i.e. "-b" option) | 
|  | 795 |  | 
|  | 796 | -  Node.js module | 
|  | 797 |  | 
|  | 798 | -  Python modules that use ``setuptools`` or ``distutils`` | 
|  | 799 |  | 
|  | 800 | Apart from binary packages, the determination of how a source tree | 
|  | 801 | should be treated is automatic based on the files present within that | 
|  | 802 | source tree. For example, if a ``CMakeLists.txt`` file is found, then | 
|  | 803 | the source tree is assumed to be using CMake and is treated accordingly. | 
|  | 804 |  | 
|  | 805 | .. note:: | 
|  | 806 |  | 
|  | 807 | In most cases, you need to edit the automatically generated recipe in | 
|  | 808 | order to make it build properly. Typically, you would go through | 
|  | 809 | several edit and build cycles until the recipe successfully builds. | 
|  | 810 | Once the recipe builds, you could use possible further iterations to | 
|  | 811 | test the recipe on the target device. | 
|  | 812 |  | 
|  | 813 | The remainder of this section covers specifics regarding how parts of | 
|  | 814 | the recipe are generated. | 
|  | 815 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 816 | Name and Version | 
|  | 817 | ---------------- | 
|  | 818 |  | 
|  | 819 | If you do not specify a name and version on the command line, | 
|  | 820 | ``devtool add`` uses various metadata within the source tree in an | 
|  | 821 | attempt to determine the name and version of the software being built. | 
|  | 822 | Based on what the tool determines, ``devtool`` sets the name of the | 
|  | 823 | created recipe file accordingly. | 
|  | 824 |  | 
|  | 825 | If ``devtool`` cannot determine the name and version, the command prints | 
|  | 826 | an error. For such cases, you must re-run the command and provide the | 
|  | 827 | name and version, just the name, or just the version as part of the | 
|  | 828 | command line. | 
|  | 829 |  | 
|  | 830 | Sometimes the name or version determined from the source tree might be | 
|  | 831 | incorrect. For such a case, you must reset the recipe: | 
|  | 832 | :: | 
|  | 833 |  | 
|  | 834 | $ devtool reset -n recipename | 
|  | 835 |  | 
|  | 836 | After running the ``devtool reset`` command, you need to | 
|  | 837 | run ``devtool add`` again and provide the name or the version. | 
|  | 838 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 839 | Dependency Detection and Mapping | 
|  | 840 | -------------------------------- | 
|  | 841 |  | 
|  | 842 | The ``devtool add`` command attempts to detect build-time dependencies | 
|  | 843 | and map them to other recipes in the system. During this mapping, the | 
|  | 844 | command fills in the names of those recipes as part of the | 
|  | 845 | :term:`DEPENDS` variable within the | 
|  | 846 | recipe. If a dependency cannot be mapped, ``devtool`` places a comment | 
|  | 847 | in the recipe indicating such. The inability to map a dependency can | 
|  | 848 | result from naming not being recognized or because the dependency simply | 
|  | 849 | is not available. For cases where the dependency is not available, you | 
|  | 850 | must use the ``devtool add`` command to add an additional recipe that | 
|  | 851 | satisfies the dependency. Once you add that recipe, you need to update | 
|  | 852 | the ``DEPENDS`` variable in the original recipe to include the new | 
|  | 853 | recipe. | 
|  | 854 |  | 
|  | 855 | If you need to add runtime dependencies, you can do so by adding the | 
|  | 856 | following to your recipe: | 
|  | 857 | :: | 
|  | 858 |  | 
|  | 859 | RDEPENDS_${PN} += "dependency1 dependency2 ..." | 
|  | 860 |  | 
|  | 861 | .. note:: | 
|  | 862 |  | 
|  | 863 | The | 
|  | 864 | devtool add | 
|  | 865 | command often cannot distinguish between mandatory and optional | 
|  | 866 | dependencies. Consequently, some of the detected dependencies might | 
|  | 867 | in fact be optional. When in doubt, consult the documentation or the | 
|  | 868 | configure script for the software the recipe is building for further | 
|  | 869 | details. In some cases, you might find you can substitute the | 
|  | 870 | dependency with an option that disables the associated functionality | 
|  | 871 | passed to the configure script. | 
|  | 872 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 873 | License Detection | 
|  | 874 | ----------------- | 
|  | 875 |  | 
|  | 876 | The ``devtool add`` command attempts to determine if the software you | 
|  | 877 | are adding is able to be distributed under a common, open-source | 
|  | 878 | license. If so, the command sets the | 
|  | 879 | :term:`LICENSE` value accordingly. | 
|  | 880 | You should double-check the value added by the command against the | 
|  | 881 | documentation or source files for the software you are building and, if | 
|  | 882 | necessary, update that ``LICENSE`` value. | 
|  | 883 |  | 
|  | 884 | The ``devtool add`` command also sets the | 
|  | 885 | :term:`LIC_FILES_CHKSUM` | 
|  | 886 | value to point to all files that appear to be license-related. Realize | 
|  | 887 | that license statements often appear in comments at the top of source | 
|  | 888 | files or within the documentation. In such cases, the command does not | 
|  | 889 | recognize those license statements. Consequently, you might need to | 
|  | 890 | amend the ``LIC_FILES_CHKSUM`` variable to point to one or more of those | 
|  | 891 | comments if present. Setting ``LIC_FILES_CHKSUM`` is particularly | 
|  | 892 | important for third-party software. The mechanism attempts to ensure | 
|  | 893 | correct licensing should you upgrade the recipe to a newer upstream | 
|  | 894 | version in future. Any change in licensing is detected and you receive | 
|  | 895 | an error prompting you to check the license text again. | 
|  | 896 |  | 
|  | 897 | If the ``devtool add`` command cannot determine licensing information, | 
|  | 898 | ``devtool`` sets the ``LICENSE`` value to "CLOSED" and leaves the | 
|  | 899 | ``LIC_FILES_CHKSUM`` value unset. This behavior allows you to continue | 
|  | 900 | with development even though the settings are unlikely to be correct in | 
|  | 901 | all cases. You should check the documentation or source files for the | 
|  | 902 | software you are building to determine the actual license. | 
|  | 903 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 904 | Adding Makefile-Only Software | 
|  | 905 | ----------------------------- | 
|  | 906 |  | 
|  | 907 | The use of Make by itself is very common in both proprietary and | 
|  | 908 | open-source software. Unfortunately, Makefiles are often not written | 
|  | 909 | with cross-compilation in mind. Thus, ``devtool add`` often cannot do | 
|  | 910 | very much to ensure that these Makefiles build correctly. It is very | 
|  | 911 | common, for example, to explicitly call ``gcc`` instead of using the | 
|  | 912 | :term:`CC` variable. Usually, in a | 
|  | 913 | cross-compilation environment, ``gcc`` is the compiler for the build | 
|  | 914 | host and the cross-compiler is named something similar to | 
|  | 915 | ``arm-poky-linux-gnueabi-gcc`` and might require arguments (e.g. to | 
|  | 916 | point to the associated sysroot for the target machine). | 
|  | 917 |  | 
|  | 918 | When writing a recipe for Makefile-only software, keep the following in | 
|  | 919 | mind: | 
|  | 920 |  | 
|  | 921 | -  You probably need to patch the Makefile to use variables instead of | 
|  | 922 | hardcoding tools within the toolchain such as ``gcc`` and ``g++``. | 
|  | 923 |  | 
|  | 924 | -  The environment in which Make runs is set up with various standard | 
|  | 925 | variables for compilation (e.g. ``CC``, ``CXX``, and so forth) in a | 
|  | 926 | similar manner to the environment set up by the SDK's environment | 
|  | 927 | setup script. One easy way to see these variables is to run the | 
|  | 928 | ``devtool build`` command on the recipe and then look in | 
|  | 929 | ``oe-logs/run.do_compile``. Towards the top of this file, a list of | 
|  | 930 | environment variables exists that are being set. You can take | 
|  | 931 | advantage of these variables within the Makefile. | 
|  | 932 |  | 
|  | 933 | -  If the Makefile sets a default for a variable using "=", that default | 
|  | 934 | overrides the value set in the environment, which is usually not | 
|  | 935 | desirable. For this case, you can either patch the Makefile so it | 
|  | 936 | sets the default using the "?=" operator, or you can alternatively | 
|  | 937 | force the value on the ``make`` command line. To force the value on | 
|  | 938 | the command line, add the variable setting to | 
|  | 939 | :term:`EXTRA_OEMAKE` or | 
|  | 940 | :term:`PACKAGECONFIG_CONFARGS` | 
|  | 941 | within the recipe. Here is an example using ``EXTRA_OEMAKE``: | 
|  | 942 | :: | 
|  | 943 |  | 
|  | 944 | EXTRA_OEMAKE += "'CC=${CC}' 'CXX=${CXX}'" | 
|  | 945 |  | 
|  | 946 | In the above example, | 
|  | 947 | single quotes are used around the variable settings as the values are | 
|  | 948 | likely to contain spaces because required default options are passed | 
|  | 949 | to the compiler. | 
|  | 950 |  | 
|  | 951 | -  Hardcoding paths inside Makefiles is often problematic in a | 
|  | 952 | cross-compilation environment. This is particularly true because | 
|  | 953 | those hardcoded paths often point to locations on the build host and | 
|  | 954 | thus will either be read-only or will introduce contamination into | 
|  | 955 | the cross-compilation because they are specific to the build host | 
|  | 956 | rather than the target. Patching the Makefile to use prefix variables | 
|  | 957 | or other path variables is usually the way to handle this situation. | 
|  | 958 |  | 
|  | 959 | -  Sometimes a Makefile runs target-specific commands such as | 
|  | 960 | ``ldconfig``. For such cases, you might be able to apply patches that | 
|  | 961 | remove these commands from the Makefile. | 
|  | 962 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 963 | Adding Native Tools | 
|  | 964 | ------------------- | 
|  | 965 |  | 
|  | 966 | Often, you need to build additional tools that run on the :term:`Build | 
|  | 967 | Host` as opposed to | 
|  | 968 | the target. You should indicate this requirement by using one of the | 
|  | 969 | following methods when you run ``devtool add``: | 
|  | 970 |  | 
|  | 971 | -  Specify the name of the recipe such that it ends with "-native". | 
|  | 972 | Specifying the name like this produces a recipe that only builds for | 
|  | 973 | the build host. | 
|  | 974 |  | 
|  | 975 | -  Specify the "DASHDASHalso-native" option with the ``devtool add`` | 
|  | 976 | command. Specifying this option creates a recipe file that still | 
|  | 977 | builds for the target but also creates a variant with a "-native" | 
|  | 978 | suffix that builds for the build host. | 
|  | 979 |  | 
|  | 980 | .. note:: | 
|  | 981 |  | 
|  | 982 | If you need to add a tool that is shipped as part of a source tree | 
|  | 983 | that builds code for the target, you can typically accomplish this by | 
|  | 984 | building the native and target parts separately rather than within | 
|  | 985 | the same compilation process. Realize though that with the | 
|  | 986 | "DASHDASHalso-native" option, you can add the tool using just one | 
|  | 987 | recipe file. | 
|  | 988 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 989 | Adding Node.js Modules | 
|  | 990 | ---------------------- | 
|  | 991 |  | 
|  | 992 | You can use the ``devtool add`` command two different ways to add | 
|  | 993 | Node.js modules: 1) Through ``npm`` and, 2) from a repository or local | 
|  | 994 | source. | 
|  | 995 |  | 
|  | 996 | Use the following form to add Node.js modules through ``npm``: | 
|  | 997 | :: | 
|  | 998 |  | 
|  | 999 | $ devtool add "npm://registry.npmjs.org;name=forever;version=0.15.1" | 
|  | 1000 |  | 
|  | 1001 | The name and | 
|  | 1002 | version parameters are mandatory. Lockdown and shrinkwrap files are | 
|  | 1003 | generated and pointed to by the recipe in order to freeze the version | 
|  | 1004 | that is fetched for the dependencies according to the first time. This | 
|  | 1005 | also saves checksums that are verified on future fetches. Together, | 
|  | 1006 | these behaviors ensure the reproducibility and integrity of the build. | 
|  | 1007 |  | 
|  | 1008 | .. note:: | 
|  | 1009 |  | 
|  | 1010 | -  You must use quotes around the URL. The ``devtool add`` does not | 
|  | 1011 | require the quotes, but the shell considers ";" as a splitter | 
|  | 1012 | between multiple commands. Thus, without the quotes, | 
|  | 1013 | ``devtool add`` does not receive the other parts, which results in | 
|  | 1014 | several "command not found" errors. | 
|  | 1015 |  | 
|  | 1016 | -  In order to support adding Node.js modules, a ``nodejs`` recipe | 
|  | 1017 | must be part of your SDK. | 
|  | 1018 |  | 
|  | 1019 | As mentioned earlier, you can also add Node.js modules directly from a | 
|  | 1020 | repository or local source tree. To add modules this way, use | 
|  | 1021 | ``devtool add`` in the following form: | 
|  | 1022 | :: | 
|  | 1023 |  | 
|  | 1024 | $ devtool add https://github.com/diversario/node-ssdp | 
|  | 1025 |  | 
|  | 1026 | In this example, ``devtool`` | 
|  | 1027 | fetches the specified Git repository, detects the code as Node.js code, | 
|  | 1028 | fetches dependencies using ``npm``, and sets | 
|  | 1029 | :term:`SRC_URI` accordingly. | 
|  | 1030 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1031 | Working With Recipes | 
|  | 1032 | ==================== | 
|  | 1033 |  | 
|  | 1034 | When building a recipe using the ``devtool build`` command, the typical | 
|  | 1035 | build progresses as follows: | 
|  | 1036 |  | 
|  | 1037 | 1. Fetch the source | 
|  | 1038 |  | 
|  | 1039 | 2. Unpack the source | 
|  | 1040 |  | 
|  | 1041 | 3. Configure the source | 
|  | 1042 |  | 
|  | 1043 | 4. Compile the source | 
|  | 1044 |  | 
|  | 1045 | 5. Install the build output | 
|  | 1046 |  | 
|  | 1047 | 6. Package the installed output | 
|  | 1048 |  | 
|  | 1049 | For recipes in the workspace, fetching and unpacking is disabled as the | 
|  | 1050 | source tree has already been prepared and is persistent. Each of these | 
|  | 1051 | build steps is defined as a function (task), usually with a "do\_" prefix | 
|  | 1052 | (e.g. :ref:`ref-tasks-fetch`, | 
|  | 1053 | :ref:`ref-tasks-unpack`, and so | 
|  | 1054 | forth). These functions are typically shell scripts but can instead be | 
|  | 1055 | written in Python. | 
|  | 1056 |  | 
|  | 1057 | If you look at the contents of a recipe, you will see that the recipe | 
|  | 1058 | does not include complete instructions for building the software. | 
|  | 1059 | Instead, common functionality is encapsulated in classes inherited with | 
|  | 1060 | the ``inherit`` directive. This technique leaves the recipe to describe | 
|  | 1061 | just the things that are specific to the software being built. A | 
|  | 1062 | :ref:`base <ref-classes-base>` class exists that | 
|  | 1063 | is implicitly inherited by all recipes and provides the functionality | 
|  | 1064 | that most recipes typically need. | 
|  | 1065 |  | 
|  | 1066 | The remainder of this section presents information useful when working | 
|  | 1067 | with recipes. | 
|  | 1068 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1069 | Finding Logs and Work Files | 
|  | 1070 | --------------------------- | 
|  | 1071 |  | 
|  | 1072 | After the first run of the ``devtool build`` command, recipes that were | 
|  | 1073 | previously created using the ``devtool add`` command or whose sources | 
|  | 1074 | were modified using the ``devtool modify`` command contain symbolic | 
|  | 1075 | links created within the source tree: | 
|  | 1076 |  | 
|  | 1077 | -  ``oe-logs``: This link points to the directory in which log files and | 
|  | 1078 | run scripts for each build step are created. | 
|  | 1079 |  | 
|  | 1080 | -  ``oe-workdir``: This link points to the temporary work area for the | 
|  | 1081 | recipe. The following locations under ``oe-workdir`` are particularly | 
|  | 1082 | useful: | 
|  | 1083 |  | 
|  | 1084 | -  ``image/``: Contains all of the files installed during the | 
|  | 1085 | :ref:`ref-tasks-install` stage. | 
|  | 1086 | Within a recipe, this directory is referred to by the expression | 
|  | 1087 | ``${``\ :term:`D`\ ``}``. | 
|  | 1088 |  | 
|  | 1089 | -  ``sysroot-destdir/``: Contains a subset of files installed within | 
|  | 1090 | ``do_install`` that have been put into the shared sysroot. For | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame^] | 1091 | more information, see the | 
|  | 1092 | ":ref:`dev-manual/common-tasks:sharing files between recipes`" section. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1093 |  | 
|  | 1094 | -  ``packages-split/``: Contains subdirectories for each package | 
|  | 1095 | produced by the recipe. For more information, see the | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame^] | 1096 | ":ref:`sdk-manual/extensible:packaging`" section. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1097 |  | 
|  | 1098 | You can use these links to get more information on what is happening at | 
|  | 1099 | each build step. | 
|  | 1100 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1101 | Setting Configure Arguments | 
|  | 1102 | --------------------------- | 
|  | 1103 |  | 
|  | 1104 | If the software your recipe is building uses GNU autoconf, then a fixed | 
|  | 1105 | set of arguments is passed to it to enable cross-compilation plus any | 
|  | 1106 | extras specified by | 
|  | 1107 | :term:`EXTRA_OECONF` or | 
|  | 1108 | :term:`PACKAGECONFIG_CONFARGS` | 
|  | 1109 | set within the recipe. If you wish to pass additional options, add them | 
|  | 1110 | to ``EXTRA_OECONF`` or ``PACKAGECONFIG_CONFARGS``. Other supported build | 
|  | 1111 | tools have similar variables (e.g. | 
|  | 1112 | :term:`EXTRA_OECMAKE` for | 
|  | 1113 | CMake, :term:`EXTRA_OESCONS` | 
|  | 1114 | for Scons, and so forth). If you need to pass anything on the ``make`` | 
|  | 1115 | command line, you can use ``EXTRA_OEMAKE`` or the | 
|  | 1116 | :term:`PACKAGECONFIG_CONFARGS` | 
|  | 1117 | variables to do so. | 
|  | 1118 |  | 
|  | 1119 | You can use the ``devtool configure-help`` command to help you set the | 
|  | 1120 | arguments listed in the previous paragraph. The command determines the | 
|  | 1121 | exact options being passed, and shows them to you along with any custom | 
|  | 1122 | arguments specified through ``EXTRA_OECONF`` or | 
|  | 1123 | ``PACKAGECONFIG_CONFARGS``. If applicable, the command also shows you | 
|  | 1124 | the output of the configure script's "DASHDASHhelp" option as a | 
|  | 1125 | reference. | 
|  | 1126 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1127 | Sharing Files Between Recipes | 
|  | 1128 | ----------------------------- | 
|  | 1129 |  | 
|  | 1130 | Recipes often need to use files provided by other recipes on the | 
|  | 1131 | :term:`Build Host`. For example, | 
|  | 1132 | an application linking to a common library needs access to the library | 
|  | 1133 | itself and its associated headers. The way this access is accomplished | 
|  | 1134 | within the extensible SDK is through the sysroot. One sysroot exists per | 
|  | 1135 | "machine" for which the SDK is being built. In practical terms, this | 
|  | 1136 | means a sysroot exists for the target machine, and a sysroot exists for | 
|  | 1137 | the build host. | 
|  | 1138 |  | 
|  | 1139 | Recipes should never write files directly into the sysroot. Instead, | 
|  | 1140 | files should be installed into standard locations during the | 
|  | 1141 | :ref:`ref-tasks-install` task within | 
|  | 1142 | the ``${``\ :term:`D`\ ``}`` directory. A | 
|  | 1143 | subset of these files automatically goes into the sysroot. The reason | 
|  | 1144 | for this limitation is that almost all files that go into the sysroot | 
|  | 1145 | are cataloged in manifests in order to ensure they can be removed later | 
|  | 1146 | when a recipe is modified or removed. Thus, the sysroot is able to | 
|  | 1147 | remain free from stale files. | 
|  | 1148 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1149 | Packaging | 
|  | 1150 | --------- | 
|  | 1151 |  | 
|  | 1152 | Packaging is not always particularly relevant within the extensible SDK. | 
|  | 1153 | However, if you examine how build output gets into the final image on | 
|  | 1154 | the target device, it is important to understand packaging because the | 
|  | 1155 | contents of the image are expressed in terms of packages and not | 
|  | 1156 | recipes. | 
|  | 1157 |  | 
|  | 1158 | During the :ref:`ref-tasks-package` | 
|  | 1159 | task, files installed during the | 
|  | 1160 | :ref:`ref-tasks-install` task are | 
|  | 1161 | split into one main package, which is almost always named the same as | 
|  | 1162 | the recipe, and into several other packages. This separation exists | 
|  | 1163 | because not all of those installed files are useful in every image. For | 
|  | 1164 | example, you probably do not need any of the documentation installed in | 
|  | 1165 | a production image. Consequently, for each recipe the documentation | 
|  | 1166 | files are separated into a ``-doc`` package. Recipes that package | 
|  | 1167 | software containing optional modules or plugins might undergo additional | 
|  | 1168 | package splitting as well. | 
|  | 1169 |  | 
|  | 1170 | After building a recipe, you can see where files have gone by looking in | 
|  | 1171 | the ``oe-workdir/packages-split`` directory, which contains a | 
|  | 1172 | subdirectory for each package. Apart from some advanced cases, the | 
|  | 1173 | :term:`PACKAGES` and | 
|  | 1174 | :term:`FILES` variables controls | 
|  | 1175 | splitting. The ``PACKAGES`` variable lists all of the packages to be | 
|  | 1176 | produced, while the ``FILES`` variable specifies which files to include | 
|  | 1177 | in each package by using an override to specify the package. For | 
|  | 1178 | example, ``FILES_${PN}`` specifies the files to go into the main package | 
|  | 1179 | (i.e. the main package has the same name as the recipe and | 
|  | 1180 | ``${``\ :term:`PN`\ ``}`` evaluates to the | 
|  | 1181 | recipe name). The order of the ``PACKAGES`` value is significant. For | 
|  | 1182 | each installed file, the first package whose ``FILES`` value matches the | 
|  | 1183 | file is the package into which the file goes. Defaults exist for both | 
|  | 1184 | the ``PACKAGES`` and ``FILES`` variables. Consequently, you might find | 
|  | 1185 | you do not even need to set these variables in your recipe unless the | 
|  | 1186 | software the recipe is building installs files into non-standard | 
|  | 1187 | locations. | 
|  | 1188 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1189 | Restoring the Target Device to its Original State | 
|  | 1190 | ================================================= | 
|  | 1191 |  | 
|  | 1192 | If you use the ``devtool deploy-target`` command to write a recipe's | 
|  | 1193 | build output to the target, and you are working on an existing component | 
|  | 1194 | of the system, then you might find yourself in a situation where you | 
|  | 1195 | need to restore the original files that existed prior to running the | 
|  | 1196 | ``devtool deploy-target`` command. Because the ``devtool deploy-target`` | 
|  | 1197 | command backs up any files it overwrites, you can use the | 
|  | 1198 | ``devtool undeploy-target`` command to restore those files and remove | 
|  | 1199 | any other files the recipe deployed. Consider the following example: | 
|  | 1200 | :: | 
|  | 1201 |  | 
|  | 1202 | $ devtool undeploy-target lighttpd root@192.168.7.2 | 
|  | 1203 |  | 
|  | 1204 | If you have deployed | 
|  | 1205 | multiple applications, you can remove them all using the "-a" option | 
|  | 1206 | thus restoring the target device to its original state: | 
|  | 1207 | :: | 
|  | 1208 |  | 
|  | 1209 | $ devtool undeploy-target -a root@192.168.7.2 | 
|  | 1210 |  | 
|  | 1211 | Information about files deployed to | 
|  | 1212 | the target as well as any backed up files are stored on the target | 
|  | 1213 | itself. This storage, of course, requires some additional space on the | 
|  | 1214 | target machine. | 
|  | 1215 |  | 
|  | 1216 | .. note:: | 
|  | 1217 |  | 
|  | 1218 | The | 
|  | 1219 | devtool deploy-target | 
|  | 1220 | and | 
|  | 1221 | devtool undeploy-target | 
|  | 1222 | commands do not currently interact with any package management system | 
|  | 1223 | on the target device (e.g. RPM or OPKG). Consequently, you should not | 
|  | 1224 | intermingle | 
|  | 1225 | devtool deploy-target | 
|  | 1226 | and package manager operations on the target device. Doing so could | 
|  | 1227 | result in a conflicting set of files. | 
|  | 1228 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1229 | Installing Additional Items Into the Extensible SDK | 
|  | 1230 | =================================================== | 
|  | 1231 |  | 
|  | 1232 | Out of the box the extensible SDK typically only comes with a small | 
|  | 1233 | number of tools and libraries. A minimal SDK starts mostly empty and is | 
|  | 1234 | populated on-demand. Sometimes you must explicitly install extra items | 
|  | 1235 | into the SDK. If you need these extra items, you can first search for | 
|  | 1236 | the items using the ``devtool search`` command. For example, suppose you | 
|  | 1237 | need to link to libGL but you are not sure which recipe provides libGL. | 
|  | 1238 | You can use the following command to find out: | 
|  | 1239 | :: | 
|  | 1240 |  | 
|  | 1241 | $ devtool search libGL mesa | 
|  | 1242 |  | 
|  | 1243 | A free implementation of the OpenGL API Once you know the recipe | 
|  | 1244 | (i.e. ``mesa`` in this example), you can install it: | 
|  | 1245 | :: | 
|  | 1246 |  | 
|  | 1247 | $ devtool sdk-install mesa | 
|  | 1248 |  | 
|  | 1249 | By default, the ``devtool sdk-install`` command assumes | 
|  | 1250 | the item is available in pre-built form from your SDK provider. If the | 
|  | 1251 | item is not available and it is acceptable to build the item from | 
|  | 1252 | source, you can add the "-s" option as follows: | 
|  | 1253 | :: | 
|  | 1254 |  | 
|  | 1255 | $ devtool sdk-install -s mesa | 
|  | 1256 |  | 
|  | 1257 | It is important to remember that building the item from source | 
|  | 1258 | takes significantly longer than installing the pre-built artifact. Also, | 
|  | 1259 | if no recipe exists for the item you want to add to the SDK, you must | 
|  | 1260 | instead add the item using the ``devtool add`` command. | 
|  | 1261 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1262 | Applying Updates to an Installed Extensible SDK | 
|  | 1263 | =============================================== | 
|  | 1264 |  | 
|  | 1265 | If you are working with an installed extensible SDK that gets | 
|  | 1266 | occasionally updated (e.g. a third-party SDK), then you will need to | 
|  | 1267 | manually "pull down" the updates into the installed SDK. | 
|  | 1268 |  | 
|  | 1269 | To update your installed SDK, use ``devtool`` as follows: | 
|  | 1270 | :: | 
|  | 1271 |  | 
|  | 1272 | $ devtool sdk-update | 
|  | 1273 |  | 
|  | 1274 | The previous command assumes your SDK provider has set the | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame^] | 1275 | default update URL for you through the :term:`SDK_UPDATE_URL` | 
|  | 1276 | variable as described in the | 
|  | 1277 | ":ref:`sdk-manual/appendix-customizing:Providing Updates to the Extensible SDK After Installation`" | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1278 | section. If the SDK provider has not set that default URL, you need to | 
|  | 1279 | specify it yourself in the command as follows: $ devtool sdk-update | 
|  | 1280 | path_to_update_directory | 
|  | 1281 |  | 
|  | 1282 | .. note:: | 
|  | 1283 |  | 
|  | 1284 | The URL needs to point specifically to a published SDK and not to an | 
|  | 1285 | SDK installer that you would download and install. | 
|  | 1286 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1287 | Creating a Derivative SDK With Additional Components | 
|  | 1288 | ==================================================== | 
|  | 1289 |  | 
|  | 1290 | You might need to produce an SDK that contains your own custom | 
|  | 1291 | libraries. A good example would be if you were a vendor with customers | 
|  | 1292 | that use your SDK to build their own platform-specific software and | 
|  | 1293 | those customers need an SDK that has custom libraries. In such a case, | 
|  | 1294 | you can produce a derivative SDK based on the currently installed SDK | 
|  | 1295 | fairly easily by following these steps: | 
|  | 1296 |  | 
|  | 1297 | 1. If necessary, install an extensible SDK that you want to use as a | 
|  | 1298 | base for your derivative SDK. | 
|  | 1299 |  | 
|  | 1300 | 2. Source the environment script for the SDK. | 
|  | 1301 |  | 
|  | 1302 | 3. Add the extra libraries or other components you want by using the | 
|  | 1303 | ``devtool add`` command. | 
|  | 1304 |  | 
|  | 1305 | 4. Run the ``devtool build-sdk`` command. | 
|  | 1306 |  | 
|  | 1307 | The previous steps take the recipes added to the workspace and construct | 
|  | 1308 | a new SDK installer that contains those recipes and the resulting binary | 
|  | 1309 | artifacts. The recipes go into their own separate layer in the | 
|  | 1310 | constructed derivative SDK, which leaves the workspace clean and ready | 
|  | 1311 | for users to add their own recipes. |