Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
| 2 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" |
| 3 | [<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] > |
| 4 | |
| 5 | <appendix id='sdk-appendix-obtain'> |
| 6 | |
| 7 | <title>Obtaining the SDK</title> |
| 8 | |
| 9 | <section id='sdk-locating-pre-built-sdk-installers'> |
| 10 | <title>Locating Pre-Built SDK Installers</title> |
| 11 | |
| 12 | <para> |
| 13 | You can use existing, pre-built toolchains by locating and running |
| 14 | an SDK installer script that ships with the Yocto Project. |
| 15 | Using this method, you select and download an architecture-specific |
| 16 | toolchain installer and then run the script to hand-install the |
| 17 | toolchain. |
| 18 | </para> |
| 19 | |
| 20 | <para> |
| 21 | You can find SDK installers here: |
| 22 | <itemizedlist> |
| 23 | <listitem><para><emphasis>Standard SDK Installers</emphasis> |
| 24 | Go to <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'></ulink> |
| 25 | and find the folder that matches your host development system |
| 26 | (i.e. <filename>i686</filename> for 32-bit machines or |
| 27 | <filename>x86_64</filename> for 64-bit machines).</para> |
| 28 | |
| 29 | <para>Go into that folder and download the toolchain installer |
| 30 | whose name includes the appropriate target architecture. |
| 31 | The toolchains provided by the Yocto Project are based off of |
| 32 | the <filename>core-image-sato</filename> image and contain |
| 33 | libraries appropriate for developing against that image. |
| 34 | For example, if your host development system is a 64-bit x86 |
| 35 | system and you are going to use your cross-toolchain for a |
| 36 | 32-bit x86 target, go into the <filename>x86_64</filename> |
| 37 | folder and download the following installer: |
| 38 | <literallayout class='monospaced'> |
| 39 | poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh |
| 40 | </literallayout> |
| 41 | </para></listitem> |
| 42 | <listitem><para><emphasis>Extensible SDK Installers</emphasis> |
| 43 | Installers for the extensible SDK are in |
| 44 | <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'></ulink>. |
| 45 | </para></listitem> |
| 46 | </itemizedlist> |
| 47 | </para> |
| 48 | </section> |
| 49 | |
| 50 | <section id='sdk-building-an-sdk-installer'> |
| 51 | <title>Building an SDK Installer</title> |
| 52 | |
| 53 | <para> |
| 54 | As an alternative to locating and downloading a toolchain installer, |
| 55 | you can build the toolchain installer assuming you have first sourced |
| 56 | the environment setup script. |
| 57 | See the |
| 58 | "<ulink url='&YOCTO_DOCS_QS_URL;#qs-building-images'>Building Images</ulink>" |
| 59 | section in the Yocto Project Quick Start for steps that show you |
| 60 | how to set up the Yocto Project environment. |
| 61 | In particular, you need to be sure the |
| 62 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> |
| 63 | variable matches the architecture for which you are building and that |
| 64 | the |
| 65 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SDKMACHINE'><filename>SDKMACHINE</filename></ulink> |
| 66 | variable is correctly set if you are building a toolchain designed to |
| 67 | run on an architecture that differs from your current development host |
| 68 | machine (i.e. the build machine). |
| 69 | </para> |
| 70 | |
| 71 | <para> |
| 72 | To build the toolchain installer for a standard SDK and populate |
| 73 | the SDK image, use the following command: |
| 74 | <literallayout class='monospaced'> |
| 75 | $ bitbake <replaceable>image</replaceable> -c populate_sdk |
| 76 | </literallayout> |
| 77 | You can do the same for the extensible SDK using this command: |
| 78 | <literallayout class='monospaced'> |
| 79 | $ bitbake <replaceable>image</replaceable> -c populate_sdk_ext |
| 80 | </literallayout> |
| 81 | These commands result in a toolchain installer that contains the sysroot |
| 82 | that matches your target root filesystem. |
| 83 | </para> |
| 84 | |
| 85 | <para> |
| 86 | When the <filename>bitbake</filename> command completes, the toolchain |
| 87 | installer will be in |
| 88 | <filename>tmp/deploy/sdk</filename> in the Build Directory. |
| 89 | <note> |
| 90 | By default, this toolchain does not build static binaries. |
| 91 | If you want to use the toolchain to build these types of libraries, |
| 92 | you need to be sure your image has the appropriate static |
| 93 | development libraries. |
| 94 | Use the |
| 95 | <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'><filename>IMAGE_INSTALL</filename></ulink> |
| 96 | variable inside your <filename>local.conf</filename> file to |
| 97 | install the appropriate library packages. |
| 98 | Following is an example using <filename>glibc</filename> static |
| 99 | development libraries: |
| 100 | <literallayout class='monospaced'> |
| 101 | IMAGE_INSTALL_append = " glibc-staticdev" |
| 102 | </literallayout> |
| 103 | </note> |
| 104 | </para> |
| 105 | </section> |
| 106 | |
| 107 | <section id='sdk-extracting-the-root-filesystem'> |
| 108 | <title>Extracting the Root Filesystem</title> |
| 109 | |
| 110 | <para> |
| 111 | After installing the toolchain, for some use cases you |
| 112 | might need to separately extract a root filesystem: |
| 113 | <itemizedlist> |
| 114 | <listitem><para>You want to boot the image using NFS. |
| 115 | </para></listitem> |
| 116 | <listitem><para>You want to use the root filesystem as the |
| 117 | target sysroot. |
| 118 | For example, the Eclipse IDE environment with the Eclipse |
| 119 | Yocto Plug-in installed allows you to use QEMU to boot |
| 120 | under NFS.</para></listitem> |
| 121 | <listitem><para>You want to develop your target application |
| 122 | using the root filesystem as the target sysroot. |
| 123 | </para></listitem> |
| 124 | </itemizedlist> |
| 125 | </para> |
| 126 | |
| 127 | <para> |
| 128 | To extract the root filesystem, first <filename>source</filename> |
| 129 | the cross-development environment setup script to establish |
| 130 | necessary environment variables. |
| 131 | If you built the toolchain in the Build Directory, you will find |
| 132 | the toolchain environment script in the |
| 133 | <filename>tmp</filename> directory. |
| 134 | If you installed the toolchain by hand, the environment setup |
| 135 | script is located in <filename>/opt/poky/&DISTRO;</filename>. |
| 136 | </para> |
| 137 | |
| 138 | <para> |
| 139 | After sourcing the environment script, use the |
| 140 | <filename>runqemu-extract-sdk</filename> command and provide the |
| 141 | filesystem image. |
| 142 | </para> |
| 143 | |
| 144 | <para> |
| 145 | Following is an example. |
| 146 | The second command sets up the environment. |
| 147 | In this case, the setup script is located in the |
| 148 | <filename>/opt/poky/&DISTRO;</filename> directory. |
| 149 | The third command extracts the root filesystem from a previously |
| 150 | built filesystem that is located in the |
| 151 | <filename>~/Downloads</filename> directory. |
| 152 | Furthermore, this command extracts the root filesystem into the |
| 153 | <filename>qemux86-sato</filename> directory: |
| 154 | <literallayout class='monospaced'> |
| 155 | $ cd ~ |
| 156 | $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux |
| 157 | $ runqemu-extract-sdk \ |
| 158 | ~/Downloads/core-image-sato-sdk-qemux86-2011091411831.rootfs.tar.bz2 \ |
| 159 | $HOME/qemux86-sato |
| 160 | </literallayout> |
| 161 | You could now point to the target sysroot at |
| 162 | <filename>qemux86-sato</filename>. |
| 163 | </para> |
| 164 | </section> |
| 165 | |
| 166 | <section id='sdk-installed-standard-sdk-directory-structure'> |
| 167 | <title>Installed Standard SDK Directory Structure</title> |
| 168 | |
| 169 | <para> |
| 170 | The following figure shows the resulting directory structure after |
| 171 | you install the Standard SDK by running the <filename>.sh</filename> |
| 172 | SDK installation script: |
| 173 | </para> |
| 174 | |
| 175 | <para> |
| 176 | <imagedata fileref="figures/sdk-installed-standard-sdk-directory.png" scale="60" align="center" /> |
| 177 | </para> |
| 178 | |
| 179 | <para> |
| 180 | The installed SDK consists of an environment setup script for the SDK, |
| 181 | a configuration file for the target, a version file for the target, |
| 182 | and the root filesystem (<filename>sysroots</filename>) needed to |
| 183 | develop objects for the target system. |
| 184 | </para> |
| 185 | |
| 186 | <para> |
| 187 | Within the figure, italicized text is used to indicate replaceable |
| 188 | portions of the file or directory name. |
| 189 | For example, |
| 190 | <replaceable>install_dir</replaceable>/<replaceable>version</replaceable> |
| 191 | is the directory where the SDK is installed. |
| 192 | By default, this directory is <filename>/opt/poky/</filename>. |
| 193 | And, <replaceable>version</replaceable> represents the specific |
| 194 | snapshot of the SDK (e.g. <filename>&DISTRO;+snapshot</filename>). |
| 195 | Furthermore, <replaceable>target</replaceable> represents the target |
| 196 | architecture (e.g. <filename>i586</filename>) and |
| 197 | <replaceable>host</replaceable> represents the development system's |
| 198 | architecture (e.g. <filename>x86_64</filename>). |
| 199 | Thus, the complete names of the two directories within the |
| 200 | <filename>sysroots</filename> could be |
| 201 | <filename>i586-poky-linux</filename> and |
| 202 | <filename>x86_64-pokysdk-linux</filename> for the target and host, |
| 203 | respectively. |
| 204 | </para> |
| 205 | </section> |
| 206 | |
| 207 | <section id='sdk-installed-extensible-sdk-directory-structure'> |
| 208 | <title>Installed Extensible SDK Directory Structure</title> |
| 209 | |
| 210 | <para> |
| 211 | The following figure shows the resulting directory structure after |
| 212 | you install the Extensible SDK by running the <filename>.sh</filename> |
| 213 | SDK installation script: |
| 214 | </para> |
| 215 | |
| 216 | <para> |
| 217 | <imagedata fileref="figures/sdk-installed-extensible-sdk-directory.png" scale="60" align="center" /> |
| 218 | </para> |
| 219 | |
| 220 | <para> |
| 221 | The installed directory structure for the extensible SDK is quite |
| 222 | different than the installed structure for the standard SDK. |
| 223 | The extensible SDK does not separate host and target parts in the |
| 224 | same manner as does the standard SDK. |
| 225 | The extensible SDK uses an embedded copy of the OpenEmbedded |
| 226 | build system, which has its own sysroots. |
| 227 | </para> |
| 228 | |
| 229 | <para> |
| 230 | Of note in the directory structure are an environment setup script |
| 231 | for the SDK, a configuration file for the target, a version file for |
| 232 | the target, and a log file for the OpenEmbedded build system |
| 233 | preparation script run by the installer. |
| 234 | </para> |
| 235 | |
| 236 | <para> |
| 237 | Within the figure, italicized text is used to indicate replaceable |
| 238 | portions of the file or directory name. |
| 239 | For example, |
| 240 | <replaceable>install_dir</replaceable> is the directory where the SDK |
| 241 | is installed, which is <filename>poky_sdk</filename> by default. |
| 242 | <replaceable>target</replaceable> represents the target |
| 243 | architecture (e.g. <filename>i586</filename>) and |
| 244 | <replaceable>host</replaceable> represents the development system's |
| 245 | architecture (e.g. <filename>x86_64</filename>). |
| 246 | </para> |
| 247 | </section> |
| 248 | |
| 249 | </appendix> |
| 250 | <!-- |
| 251 | vim: expandtab tw=80 ts=4 |
| 252 | --> |