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 Standard SDK |
| 5 | ********************** |
| 6 | |
| 7 | This chapter describes the standard SDK and how to install it. |
| 8 | Information includes unique installation and setup aspects for the |
| 9 | standard SDK. |
| 10 | |
| 11 | .. note:: |
| 12 | |
| 13 | For a side-by-side comparison of main features supported for a |
| 14 | standard SDK as compared to an extensible SDK, see the " |
| 15 | Introduction |
| 16 | " section. |
| 17 | |
| 18 | You can use a standard SDK to work on Makefile and Autotools-based |
| 19 | projects. See the "`Using the SDK Toolchain |
| 20 | Directly <#sdk-working-projects>`__" chapter for more information. |
| 21 | |
| 22 | .. _sdk-standard-sdk-intro: |
| 23 | |
| 24 | Why use the Standard SDK and What is in It? |
| 25 | =========================================== |
| 26 | |
| 27 | The Standard SDK provides a cross-development toolchain and libraries |
| 28 | tailored to the contents of a specific image. You would use the Standard |
| 29 | SDK if you want a more traditional toolchain experience as compared to |
| 30 | the extensible SDK, which provides an internal build system and the |
| 31 | ``devtool`` functionality. |
| 32 | |
| 33 | The installed Standard SDK consists of several files and directories. |
| 34 | Basically, it contains an SDK environment setup script, some |
| 35 | configuration files, and host and target root filesystems to support |
| 36 | usage. You can see the directory structure in the "`Installed Standard |
| 37 | SDK Directory |
| 38 | Structure <#sdk-installed-standard-sdk-directory-structure>`__" section. |
| 39 | |
| 40 | .. _sdk-installing-the-sdk: |
| 41 | |
| 42 | Installing the 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, and support files from the |
Andrew Geissler | c3d88e4 | 2020-10-02 09:45:00 -0500 | [diff] [blame] | 50 | appropriate :yocto_dl:`toolchain </releases/yocto/yocto-3.1.2/toolchain/>` directory within |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 51 | the Index of Releases. Toolchains are available for several 32-bit and |
| 52 | 64-bit architectures with the ``x86_64`` directories, respectively. The |
| 53 | toolchains the Yocto Project provides are based off the |
| 54 | ``core-image-sato`` and ``core-image-minimal`` images and contain |
| 55 | libraries appropriate for developing against that image. |
| 56 | |
| 57 | The names of the tarball installer scripts are such that a string |
| 58 | representing the host system appears first in the filename and then is |
| 59 | immediately followed by a string representing the target architecture. |
| 60 | :: |
| 61 | |
| 62 | poky-glibc-host_system-image_type-arch-toolchain-release_version.sh |
| 63 | |
| 64 | Where: |
| 65 | host_system is a string representing your development system: |
| 66 | |
| 67 | i686 or x86_64. |
| 68 | |
| 69 | image_type is the image for which the SDK was built: |
| 70 | |
| 71 | core-image-minimal or core-image-sato. |
| 72 | |
| 73 | arch is a string representing the tuned target architecture: |
| 74 | |
| 75 | aarch64, armv5e, core2-64, i586, mips32r2, mips64, ppc7400, or cortexa8hf-neon. |
| 76 | |
| 77 | release_version is a string representing the release number of the Yocto Project: |
| 78 | |
| 79 | 3.1.2, 3.1.2+snapshot |
| 80 | |
| 81 | For example, the following SDK installer is for a 64-bit |
| 82 | development host system and a i586-tuned target architecture based off |
| 83 | the SDK for ``core-image-sato`` and using the current DISTRO snapshot: |
| 84 | :: |
| 85 | |
| 86 | poky-glibc-x86_64-core-image-sato-i586-toolchain-DISTRO.sh |
| 87 | |
| 88 | .. note:: |
| 89 | |
| 90 | As an alternative to downloading an SDK, you can build the SDK |
| 91 | installer. For information on building the installer, see the " |
| 92 | Building an SDK Installer |
| 93 | " section. |
| 94 | |
| 95 | The SDK and toolchains are self-contained and by default are installed |
| 96 | into the ``poky_sdk`` folder in your home directory. You can choose to |
| 97 | install the extensible SDK in any location when you run the installer. |
| 98 | However, because files need to be written under that directory during |
| 99 | the normal course of operation, the location you choose for installation |
| 100 | must be writable for whichever users need to use the SDK. |
| 101 | |
| 102 | The following command shows how to run the installer given a toolchain |
| 103 | tarball for a 64-bit x86 development host system and a 64-bit x86 target |
| 104 | architecture. The example assumes the SDK installer is located in |
| 105 | ``~/Downloads/`` and has execution rights. |
| 106 | |
| 107 | .. note:: |
| 108 | |
| 109 | If you do not have write permissions for the directory into which you |
| 110 | are installing the SDK, the installer notifies you and exits. For |
| 111 | that case, set up the proper permissions in the directory and run the |
| 112 | installer again. |
| 113 | |
| 114 | :: |
| 115 | |
| 116 | $ ./Downloads/poky-glibc-x86_64-core-image-sato-i586-toolchain-3.1.2.sh |
| 117 | Poky (Yocto Project Reference Distro) SDK installer version 3.1.2 |
| 118 | =============================================================== |
| 119 | Enter target directory for SDK (default: /opt/poky/3.1.2): |
| 120 | You are about to install the SDK to "/opt/poky/3.1.2". Proceed [Y/n]? Y |
| 121 | Extracting SDK........................................ ..............................done |
| 122 | Setting it up...done |
| 123 | SDK has been successfully set up and is ready to be used. |
| 124 | Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. |
| 125 | $ . /opt/poky/3.1.2/environment-setup-i586-poky-linux |
| 126 | |
| 127 | Again, reference the "`Installed Standard SDK Directory |
| 128 | Structure <#sdk-installed-standard-sdk-directory-structure>`__" section |
| 129 | for more details on the resulting directory structure of the installed |
| 130 | SDK. |
| 131 | |
| 132 | .. _sdk-running-the-sdk-environment-setup-script: |
| 133 | |
| 134 | Running the SDK Environment Setup Script |
| 135 | ======================================== |
| 136 | |
| 137 | Once you have the SDK installed, you must run the SDK environment setup |
| 138 | script before you can actually use the SDK. This setup script resides in |
| 139 | the directory you chose when you installed the SDK, which is either the |
| 140 | default ``/opt/poky/3.1.2`` directory or the directory you chose during |
| 141 | installation. |
| 142 | |
| 143 | Before running the script, be sure it is the one that matches the |
| 144 | architecture for which you are developing. Environment setup scripts |
| 145 | begin with the string "``environment-setup``" and include as part of |
| 146 | their name the tuned target architecture. As an example, the following |
| 147 | commands set the working directory to where the SDK was installed and |
| 148 | then source the environment setup script. In this example, the setup |
| 149 | script is for an IA-based target machine using i586 tuning: |
| 150 | :: |
| 151 | |
| 152 | $ source /opt/poky/3.1.2/environment-setup-i586-poky-linux |
| 153 | |
| 154 | When you run the |
| 155 | setup script, the same environment variables are defined as are when you |
| 156 | run the setup script for an extensible SDK. See the "`Running the |
| 157 | Extensible SDK Environment Setup |
| 158 | Script <#sdk-running-the-extensible-sdk-environment-setup-script>`__" |
| 159 | section for more information. |