diff options
Diffstat (limited to 'documentation/sdk-manual/extensible.rst')
| -rw-r--r-- | documentation/sdk-manual/extensible.rst | 362 |
1 files changed, 0 insertions, 362 deletions
diff --git a/documentation/sdk-manual/extensible.rst b/documentation/sdk-manual/extensible.rst deleted file mode 100644 index e5e9e4a03b..0000000000 --- a/documentation/sdk-manual/extensible.rst +++ /dev/null | |||
| @@ -1,362 +0,0 @@ | |||
| 1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK | ||
| 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 | :ref:`sdk-manual/intro:introduction` section. | ||
| 20 | |||
| 21 | In addition to the functionality available through ``devtool``, you can | ||
| 22 | alternatively make use of the toolchain directly, for example from | ||
| 23 | Makefile and Autotools. See the | ||
| 24 | ":ref:`sdk-manual/working-projects:using the sdk toolchain directly`" chapter | ||
| 25 | for more information. | ||
| 26 | |||
| 27 | Why use the Extensible SDK and What is in It? | ||
| 28 | ============================================= | ||
| 29 | |||
| 30 | The extensible SDK provides a cross-development toolchain and libraries | ||
| 31 | tailored to the contents of a specific image. You would use the | ||
| 32 | Extensible SDK if you want a toolchain experience supplemented with the | ||
| 33 | powerful set of ``devtool`` commands tailored for the Yocto Project | ||
| 34 | environment. | ||
| 35 | |||
| 36 | The installed extensible SDK consists of several files and directories. | ||
| 37 | Basically, it contains an SDK environment setup script, some | ||
| 38 | configuration files, an internal build system, and the ``devtool`` | ||
| 39 | functionality. | ||
| 40 | |||
| 41 | Installing the Extensible SDK | ||
| 42 | ============================= | ||
| 43 | |||
| 44 | Two ways to install the Extensible SDK | ||
| 45 | -------------------------------------- | ||
| 46 | |||
| 47 | Extensible SDK can be installed in two different ways, and both have | ||
| 48 | their own pros and cons: | ||
| 49 | |||
| 50 | #. *Setting up the Extensible SDK environment directly in a Yocto build*. This | ||
| 51 | avoids having to produce, test, distribute and maintain separate SDK | ||
| 52 | installer archives, which can get very large. There is only one environment | ||
| 53 | for the regular Yocto build and the SDK and less code paths where things can | ||
| 54 | go not according to plan. It's easier to update the SDK: it simply means | ||
| 55 | updating the Yocto layers with git fetch or layer management tooling. The | ||
| 56 | SDK extensibility is better than in the second option: just run ``bitbake`` | ||
| 57 | again to add more things to the sysroot, or add layers if even more things | ||
| 58 | are required. | ||
| 59 | |||
| 60 | #. *Setting up the Extensible SDK from a standalone installer*. This has the | ||
| 61 | benefit of having a single, self-contained archive that includes all the | ||
| 62 | needed binary artifacts. So nothing needs to be rebuilt, and there is no | ||
| 63 | need to provide a well-functioning binary artefact cache over the network | ||
| 64 | for developers with underpowered laptops. | ||
| 65 | |||
| 66 | .. _setting_up_ext_sdk_in_build: | ||
| 67 | |||
| 68 | Setting up the Extensible SDK environment directly in a Yocto build | ||
| 69 | ------------------------------------------------------------------- | ||
| 70 | |||
| 71 | #. Set up all the needed layers and a Yocto :term:`Build Directory`, e.g. a regular Yocto | ||
| 72 | build where ``bitbake`` can be executed. | ||
| 73 | |||
| 74 | #. Run:: | ||
| 75 | |||
| 76 | $ bitbake meta-ide-support | ||
| 77 | $ bitbake -c populate_sysroot gtk+3 | ||
| 78 | # or any other target or native item that the application developer would need | ||
| 79 | $ bitbake build-sysroots -c build_native_sysroot && bitbake build-sysroots -c build_target_sysroot | ||
| 80 | |||
| 81 | Setting up the Extensible SDK from a standalone installer | ||
| 82 | --------------------------------------------------------- | ||
| 83 | |||
| 84 | The first thing you need to do is install the SDK on your :term:`Build | ||
| 85 | Host` by running the ``*.sh`` installation script. | ||
| 86 | |||
| 87 | You can download a tarball installer, which includes the pre-built | ||
| 88 | toolchain, the ``runqemu`` script, the internal build system, | ||
| 89 | ``devtool``, and support files from the appropriate | ||
| 90 | :yocto_dl:`toolchain </releases/yocto/&DISTRO_REL_LATEST_TAG;/toolchain/>` directory within the Index of | ||
| 91 | Releases. Toolchains are available for several 32-bit and 64-bit | ||
| 92 | architectures with the ``x86_64`` directories, respectively. The | ||
| 93 | toolchains the Yocto Project provides are based off the | ||
| 94 | ``core-image-sato`` and ``core-image-minimal`` images and contain | ||
| 95 | libraries appropriate for developing against that image. | ||
| 96 | |||
| 97 | The names of the tarball installer scripts are such that a string | ||
| 98 | representing the host system appears first in the filename and then is | ||
| 99 | immediately followed by a string representing the target architecture. | ||
| 100 | An extensible SDK has the string "-ext" as part of the name. Following | ||
| 101 | is the general form:: | ||
| 102 | |||
| 103 | poky-glibc-host_system-image_type-arch-toolchain-ext-release_version.sh | ||
| 104 | |||
| 105 | Where: | ||
| 106 | host_system is a string representing your development system: | ||
| 107 | |||
| 108 | i686 or x86_64. | ||
| 109 | |||
| 110 | image_type is the image for which the SDK was built: | ||
| 111 | |||
| 112 | core-image-sato or core-image-minimal | ||
| 113 | |||
| 114 | arch is a string representing the tuned target architecture: | ||
| 115 | |||
| 116 | aarch64, armv5e, core2-64, i586, mips32r2, mips64, ppc7400, or cortexa8hf-neon | ||
| 117 | |||
| 118 | release_version is a string representing the release number of the Yocto Project: | ||
| 119 | |||
| 120 | &DISTRO;, &DISTRO;+snapshot | ||
| 121 | |||
| 122 | For example, the following SDK installer is for a 64-bit | ||
| 123 | development host system and a i586-tuned target architecture based off | ||
| 124 | the SDK for ``core-image-sato`` and using the current &DISTRO; snapshot:: | ||
| 125 | |||
| 126 | poky-glibc-x86_64-core-image-sato-i586-toolchain-ext-&DISTRO;.sh | ||
| 127 | |||
| 128 | .. note:: | ||
| 129 | |||
| 130 | As an alternative to downloading an SDK, you can build the SDK | ||
| 131 | installer. For information on building the installer, see the | ||
| 132 | :ref:`sdk-manual/appendix-obtain:building an sdk installer` | ||
| 133 | section. | ||
| 134 | |||
| 135 | The SDK and toolchains are self-contained and by default are installed | ||
| 136 | into the ``poky_sdk`` folder in your home directory. You can choose to | ||
| 137 | install the extensible SDK in any location when you run the installer. | ||
| 138 | However, because files need to be written under that directory during | ||
| 139 | the normal course of operation, the location you choose for installation | ||
| 140 | must be writable for whichever users need to use the SDK. | ||
| 141 | |||
| 142 | The following command shows how to run the installer given a toolchain | ||
| 143 | tarball for a 64-bit x86 development host system and a 64-bit x86 target | ||
| 144 | architecture. The example assumes the SDK installer is located in | ||
| 145 | ``~/Downloads/`` and has execution rights:: | ||
| 146 | |||
| 147 | $ ./Downloads/poky-glibc-x86_64-core-image-minimal-core2-64-toolchain-ext-2.5.sh | ||
| 148 | Poky (Yocto Project Reference Distro) Extensible SDK installer version 2.5 | ||
| 149 | ========================================================================== | ||
| 150 | Enter target directory for SDK (default: poky_sdk): | ||
| 151 | You are about to install the SDK to "/home/scottrif/poky_sdk". Proceed [Y/n]? Y | ||
| 152 | Extracting SDK..............done | ||
| 153 | Setting it up... | ||
| 154 | Extracting buildtools... | ||
| 155 | Preparing build system... | ||
| 156 | Parsing recipes: 100% |##################################################################| Time: 0:00:52 | ||
| 157 | Initialising tasks: 100% |###############################################################| Time: 0:00:00 | ||
| 158 | Checking sstate mirror object availability: 100% |#######################################| Time: 0:00:00 | ||
| 159 | Loading cache: 100% |####################################################################| Time: 0:00:00 | ||
| 160 | Initialising tasks: 100% |###############################################################| Time: 0:00:00 | ||
| 161 | done | ||
| 162 | SDK has been successfully set up and is ready to be used. | ||
| 163 | Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. | ||
| 164 | $ . /home/scottrif/poky_sdk/environment-setup-core2-64-poky-linux | ||
| 165 | |||
| 166 | .. note:: | ||
| 167 | |||
| 168 | If you do not have write permissions for the directory into which you | ||
| 169 | are installing the SDK, the installer notifies you and exits. For | ||
| 170 | that case, set up the proper permissions in the directory and run the | ||
| 171 | installer again. | ||
| 172 | |||
| 173 | .. _running_the_ext_sdk_env: | ||
| 174 | |||
| 175 | Running the Extensible SDK Environment Setup Script | ||
| 176 | =================================================== | ||
| 177 | |||
| 178 | Once you have the SDK installed, you must run the SDK environment setup | ||
| 179 | script before you can actually use the SDK. | ||
| 180 | |||
| 181 | When using an SDK directly in a Yocto build, you will find the script in | ||
| 182 | ``tmp/deploy/images/qemux86-64/`` in your :term:`Build Directory`. | ||
| 183 | |||
| 184 | When using a standalone SDK installer, this setup script resides in | ||
| 185 | the directory you chose when you installed the SDK, which is either the | ||
| 186 | default ``poky_sdk`` directory or the directory you chose during | ||
| 187 | installation. | ||
| 188 | |||
| 189 | Before running the script, be sure it is the one that matches the | ||
| 190 | architecture for which you are developing. Environment setup scripts | ||
| 191 | begin with the string "``environment-setup``" and include as part of | ||
| 192 | their name the tuned target architecture. As an example, the following | ||
| 193 | commands set the working directory to where the SDK was installed and | ||
| 194 | then source the environment setup script. In this example, the setup | ||
| 195 | script is for an IA-based target machine using i586 tuning:: | ||
| 196 | |||
| 197 | $ cd /home/scottrif/poky_sdk | ||
| 198 | $ source environment-setup-core2-64-poky-linux | ||
| 199 | SDK environment now set up; additionally you may now run devtool to perform development tasks. | ||
| 200 | Run devtool --help for further details. | ||
| 201 | |||
| 202 | When using the environment script directly in a Yocto build, it can | ||
| 203 | be run similarly:: | ||
| 204 | |||
| 205 | $ source tmp/deploy/images/qemux86-64/environment-setup-core2-64-poky-linux | ||
| 206 | |||
| 207 | Running the setup script defines many environment variables needed in order to | ||
| 208 | use the SDK (e.g. ``PATH``, :term:`CC`, :term:`LD`, and so forth). If you want | ||
| 209 | to see all the environment variables the script exports, examine the | ||
| 210 | installation file itself. | ||
| 211 | |||
| 212 | .. _using_devtool: | ||
| 213 | |||
| 214 | Using ``devtool`` in Your SDK Workflow | ||
| 215 | ====================================== | ||
| 216 | |||
| 217 | The cornerstone of the extensible SDK is a command-line tool called | ||
| 218 | ``devtool``. This tool provides a number of features that help you | ||
| 219 | build, test and package software within the extensible SDK, and | ||
| 220 | optionally integrate it into an image built by the OpenEmbedded build | ||
| 221 | system. | ||
| 222 | |||
| 223 | .. note:: | ||
| 224 | |||
| 225 | The use of ``devtool`` is not limited to the extensible SDK. You can use | ||
| 226 | ``devtool`` to help you easily develop any project whose build output must be | ||
| 227 | part of an image built using the build system. | ||
| 228 | |||
| 229 | The ``devtool`` command line is organized similarly to | ||
| 230 | :ref:`overview-manual/development-environment:git` in that it has a number of | ||
| 231 | sub-commands for each function. You can run ``devtool --help`` to see | ||
| 232 | all the commands. | ||
| 233 | |||
| 234 | .. note:: | ||
| 235 | |||
| 236 | See the ":doc:`/ref-manual/devtool-reference`" | ||
| 237 | section in the Yocto Project Reference Manual. | ||
| 238 | |||
| 239 | ``devtool`` subcommands provide entry-points into development: | ||
| 240 | |||
| 241 | - *devtool add*: Assists in adding new software to be built. | ||
| 242 | |||
| 243 | - *devtool modify*: Sets up an environment to enable you to modify | ||
| 244 | the source of an existing component. | ||
| 245 | |||
| 246 | - *devtool ide-sdk*: Generates a configuration for an IDE. | ||
| 247 | |||
| 248 | - *devtool upgrade*: Updates an existing recipe so that you can | ||
| 249 | build it for an updated set of source files. | ||
| 250 | |||
| 251 | As with the build system, "recipes" represent software packages within | ||
| 252 | ``devtool``. When you use ``devtool add``, a recipe is automatically | ||
| 253 | created. When you use ``devtool modify``, the specified existing recipe | ||
| 254 | is used in order to determine where to get the source code and how to | ||
| 255 | patch it. In both cases, an environment is set up so that when you build | ||
| 256 | the recipe a source tree that is under your control is used in order to | ||
| 257 | allow you to make changes to the source as desired. By default, new | ||
| 258 | recipes and the source go into a "workspace" directory under the SDK. | ||
| 259 | |||
| 260 | To learn how to use ``devtool`` to add, modify, upgrade recipes and more, see | ||
| 261 | the :ref:`dev-manual/devtool:Using the \`\`devtool\`\` command-line tool` | ||
| 262 | section of the Yocto Project Development Tasks Manual. | ||
| 263 | |||
| 264 | Installing Additional Items Into the Extensible SDK | ||
| 265 | =================================================== | ||
| 266 | |||
| 267 | Out of the box the extensible SDK typically only comes with a small | ||
| 268 | number of tools and libraries. A minimal SDK starts mostly empty and is | ||
| 269 | populated on-demand. Sometimes you must explicitly install extra items | ||
| 270 | into the SDK. If you need these extra items, you can first search for | ||
| 271 | the items using the ``devtool search`` command. For example, suppose you | ||
| 272 | need to link to libGL but you are not sure which recipe provides libGL. | ||
| 273 | You can use the following command to find out:: | ||
| 274 | |||
| 275 | $ devtool search libGL mesa | ||
| 276 | A free implementation of the OpenGL API | ||
| 277 | |||
| 278 | Once you know the recipe | ||
| 279 | (i.e. ``mesa`` in this example), you can install it. | ||
| 280 | |||
| 281 | When using the extensible SDK directly in a Yocto build | ||
| 282 | ------------------------------------------------------- | ||
| 283 | |||
| 284 | In this scenario, the Yocto build tooling, e.g. ``bitbake`` | ||
| 285 | is directly accessible to build additional items, and it | ||
| 286 | can simply be executed directly:: | ||
| 287 | |||
| 288 | $ bitbake curl-native | ||
| 289 | # Add newly built native items to native sysroot | ||
| 290 | $ bitbake build-sysroots -c build_native_sysroot | ||
| 291 | $ bitbake mesa | ||
| 292 | # Add newly built target items to target sysroot | ||
| 293 | $ bitbake build-sysroots -c build_target_sysroot | ||
| 294 | |||
| 295 | When using a standalone installer for the Extensible SDK | ||
| 296 | -------------------------------------------------------- | ||
| 297 | |||
| 298 | :: | ||
| 299 | |||
| 300 | $ devtool sdk-install mesa | ||
| 301 | |||
| 302 | By default, the ``devtool sdk-install`` command assumes | ||
| 303 | the item is available in pre-built form from your SDK provider. If the | ||
| 304 | item is not available and it is acceptable to build the item from | ||
| 305 | source, you can add the "-s" option as follows:: | ||
| 306 | |||
| 307 | $ devtool sdk-install -s mesa | ||
| 308 | |||
| 309 | It is important to remember that building the item from source | ||
| 310 | takes significantly longer than installing the pre-built artifact. Also, | ||
| 311 | if there is no recipe for the item you want to add to the SDK, you must | ||
| 312 | instead add the item using the ``devtool add`` command. | ||
| 313 | |||
| 314 | Applying Updates to an Installed Extensible SDK | ||
| 315 | =============================================== | ||
| 316 | |||
| 317 | If you are working with an installed extensible SDK that gets | ||
| 318 | occasionally updated (e.g. a third-party SDK), then you will need to | ||
| 319 | manually "pull down" the updates into the installed SDK. | ||
| 320 | |||
| 321 | To update your installed SDK, use ``devtool`` as follows:: | ||
| 322 | |||
| 323 | $ devtool sdk-update | ||
| 324 | |||
| 325 | The previous command assumes your SDK provider has set the default update URL | ||
| 326 | for you through the :term:`SDK_UPDATE_URL` variable as described in the | ||
| 327 | ":ref:`sdk-manual/appendix-customizing:Providing Updates to the Extensible SDK After Installation`" | ||
| 328 | section. If the SDK provider has not set that default URL, you need to | ||
| 329 | specify it yourself in the command as follows:: | ||
| 330 | |||
| 331 | $ devtool sdk-update path_to_update_directory | ||
| 332 | |||
| 333 | .. note:: | ||
| 334 | |||
| 335 | The URL needs to point specifically to a published SDK and not to an | ||
| 336 | SDK installer that you would download and install. | ||
| 337 | |||
| 338 | Creating a Derivative SDK With Additional Components | ||
| 339 | ==================================================== | ||
| 340 | |||
| 341 | You might need to produce an SDK that contains your own custom | ||
| 342 | libraries. A good example would be if you were a vendor with customers | ||
| 343 | that use your SDK to build their own platform-specific software and | ||
| 344 | those customers need an SDK that has custom libraries. In such a case, | ||
| 345 | you can produce a derivative SDK based on the currently installed SDK | ||
| 346 | fairly easily by following these steps: | ||
| 347 | |||
| 348 | #. If necessary, install an extensible SDK that you want to use as a | ||
| 349 | base for your derivative SDK. | ||
| 350 | |||
| 351 | #. Source the environment script for the SDK. | ||
| 352 | |||
| 353 | #. Add the extra libraries or other components you want by using the | ||
| 354 | ``devtool add`` command. | ||
| 355 | |||
| 356 | #. Run the ``devtool build-sdk`` command. | ||
| 357 | |||
| 358 | The previous steps take the recipes added to the workspace and construct | ||
| 359 | a new SDK installer that contains those recipes and the resulting binary | ||
| 360 | artifacts. The recipes go into their own separate layer in the | ||
| 361 | constructed derivative SDK, which leaves the workspace clean and ready | ||
| 362 | for users to add their own recipes. | ||
