Patrick Williams | c124f4f | 2015-09-15 14:41:29 -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 | <chapter id='adt-prepare'> |
| 6 | |
| 7 | <title>Preparing for Application Development</title> |
| 8 | |
| 9 | <para> |
| 10 | In order to develop applications, you need set up your host development system. |
| 11 | Several ways exist that allow you to install cross-development tools, QEMU, the |
| 12 | Eclipse Yocto Plug-in, and other tools. |
| 13 | This chapter describes how to prepare for application development. |
| 14 | </para> |
| 15 | |
| 16 | <section id='installing-the-adt'> |
| 17 | <title>Installing the ADT and Toolchains</title> |
| 18 | |
| 19 | <para> |
| 20 | The following list describes installation methods that set up varying |
| 21 | degrees of tool availability on your system. |
| 22 | Regardless of the installation method you choose, |
| 23 | you must <filename>source</filename> the cross-toolchain |
| 24 | environment setup script, which establishes several key |
| 25 | environment variables, before you use a toolchain. |
| 26 | See the |
| 27 | "<link linkend='setting-up-the-cross-development-environment'>Setting Up the Cross-Development Environment</link>" |
| 28 | section for more information. |
| 29 | </para> |
| 30 | |
| 31 | <note> |
| 32 | <para> |
| 33 | Avoid mixing installation methods when installing toolchains for |
| 34 | different architectures. |
| 35 | For example, avoid using the ADT Installer to install some |
| 36 | toolchains and then hand-installing cross-development toolchains |
| 37 | by running the toolchain installer for different architectures. |
| 38 | Mixing installation methods can result in situations where the |
| 39 | ADT Installer becomes unreliable and might not install the |
| 40 | toolchain. |
| 41 | </para> |
| 42 | |
| 43 | <para> |
| 44 | If you must mix installation methods, you might avoid problems by |
| 45 | deleting <filename>/var/lib/opkg</filename>, thus purging the |
| 46 | <filename>opkg</filename> package metadata. |
| 47 | </para> |
| 48 | </note> |
| 49 | |
| 50 | <para> |
| 51 | <itemizedlist> |
| 52 | <listitem><para><emphasis>Use the ADT installer script:</emphasis> |
| 53 | This method is the recommended way to install the ADT because it |
| 54 | automates much of the process for you. |
| 55 | For example, you can configure the installation to install the QEMU emulator |
| 56 | and the user-space NFS, specify which root filesystem profiles to download, |
| 57 | and define the target sysroot location.</para></listitem> |
| 58 | <listitem><para><emphasis>Use an existing toolchain:</emphasis> |
| 59 | Using this method, you select and download an architecture-specific |
| 60 | toolchain installer and then run the script to hand-install the toolchain. |
| 61 | If you use this method, you just get the cross-toolchain and QEMU - you do not |
| 62 | get any of the other mentioned benefits had you run the ADT Installer script.</para></listitem> |
| 63 | <listitem><para><emphasis>Use the toolchain from within the Build Directory:</emphasis> |
| 64 | If you already have a |
| 65 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>, |
| 66 | you can build the cross-toolchain within the directory. |
| 67 | However, like the previous method mentioned, you only get the cross-toolchain and QEMU - you |
| 68 | do not get any of the other benefits without taking separate steps.</para></listitem> |
| 69 | </itemizedlist> |
| 70 | </para> |
| 71 | |
| 72 | <section id='using-the-adt-installer'> |
| 73 | <title>Using the ADT Installer</title> |
| 74 | |
| 75 | <para> |
| 76 | To run the ADT Installer, you need to get the ADT Installer tarball, be sure |
| 77 | you have the necessary host development packages that support the ADT Installer, |
| 78 | and then run the ADT Installer Script. |
| 79 | </para> |
| 80 | |
| 81 | <para> |
| 82 | For a list of the host packages needed to support ADT installation and use, see the |
| 83 | "ADT Installer Extras" lists in the |
| 84 | "<ulink url='&YOCTO_DOCS_REF_URL;#required-packages-for-the-host-development-system'>Required Packages for the Host Development System</ulink>" section |
| 85 | of the Yocto Project Reference Manual. |
| 86 | </para> |
| 87 | |
| 88 | <section id='getting-the-adt-installer-tarball'> |
| 89 | <title>Getting the ADT Installer Tarball</title> |
| 90 | |
| 91 | <para> |
| 92 | The ADT Installer is contained in the ADT Installer tarball. |
| 93 | You can get the tarball using either of these methods: |
| 94 | <itemizedlist> |
| 95 | <listitem><para><emphasis>Download the Tarball:</emphasis> |
| 96 | You can download the tarball from |
| 97 | <ulink url='&YOCTO_ADTINSTALLER_DL_URL;'></ulink> into |
| 98 | any directory.</para></listitem> |
| 99 | <listitem><para><emphasis>Build the Tarball:</emphasis> |
| 100 | You can use |
| 101 | <ulink url='&YOCTO_DOCS_DEV_URL;#bitbake-term'>BitBake</ulink> |
| 102 | to generate the tarball inside an existing |
| 103 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>. |
| 104 | </para> |
| 105 | <para>If you use BitBake to generate the ADT Installer |
| 106 | tarball, you must <filename>source</filename> the |
| 107 | environment setup script |
| 108 | (<ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink> |
| 109 | or |
| 110 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink>) |
| 111 | located in the Source Directory before running the |
| 112 | <filename>bitbake</filename> command that creates the |
| 113 | tarball.</para> |
| 114 | <para>The following example commands establish |
| 115 | the |
| 116 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>, |
| 117 | check out the current release branch, set up the |
| 118 | build environment while also creating the default |
| 119 | Build Directory, and run the |
| 120 | <filename>bitbake</filename> command that results in the |
| 121 | tarball |
| 122 | <filename>poky/build/tmp/deploy/sdk/adt_installer.tar.bz2</filename>: |
| 123 | <note> |
| 124 | Before using BitBake to build the ADT tarball, be |
| 125 | sure to make sure your |
| 126 | <filename>local.conf</filename> file is properly |
| 127 | configured. |
| 128 | See the |
| 129 | "<ulink url='&YOCTO_DOCS_REF_URL;#user-configuration'>User Configuration</ulink>" |
| 130 | section in the Yocto Project Reference Manual for |
| 131 | general configuration information. |
| 132 | </note> |
| 133 | <literallayout class='monospaced'> |
| 134 | $ cd ~ |
| 135 | $ git clone git://git.yoctoproject.org/poky |
| 136 | $ cd poky |
| 137 | $ git checkout -b &DISTRO_NAME; origin/&DISTRO_NAME; |
| 138 | $ source &OE_INIT_FILE; |
| 139 | $ bitbake adt-installer |
| 140 | </literallayout></para></listitem> |
| 141 | </itemizedlist> |
| 142 | </para> |
| 143 | </section> |
| 144 | |
| 145 | <section id='configuring-and-running-the-adt-installer-script'> |
| 146 | <title>Configuring and Running the ADT Installer Script</title> |
| 147 | |
| 148 | <para> |
| 149 | Before running the ADT Installer script, you need to unpack the tarball. |
| 150 | You can unpack the tarball in any directory you wish. |
| 151 | For example, this command copies the ADT Installer tarball from where |
| 152 | it was built into the home directory and then unpacks the tarball into |
| 153 | a top-level directory named <filename>adt-installer</filename>: |
| 154 | <literallayout class='monospaced'> |
| 155 | $ cd ~ |
| 156 | $ cp poky/build/tmp/deploy/sdk/adt_installer.tar.bz2 $HOME |
| 157 | $ tar -xjf adt_installer.tar.bz2 |
| 158 | </literallayout> |
| 159 | Unpacking it creates the directory <filename>adt-installer</filename>, |
| 160 | which contains the ADT Installer script (<filename>adt_installer</filename>) |
| 161 | and its configuration file (<filename>adt_installer.conf</filename>). |
| 162 | </para> |
| 163 | |
| 164 | <para> |
| 165 | Before you run the script, however, you should examine the ADT Installer configuration |
| 166 | file and be sure you are going to get what you want. |
| 167 | Your configurations determine which kernel and filesystem image are downloaded. |
| 168 | </para> |
| 169 | |
| 170 | <para> |
| 171 | The following list describes the configurations you can define for the ADT Installer. |
| 172 | For configuration values and restrictions, see the comments in |
| 173 | the <filename>adt-installer.conf</filename> file: |
| 174 | |
| 175 | <itemizedlist> |
| 176 | <listitem><para><filename>YOCTOADT_REPO</filename>: This area |
| 177 | includes the IPKG-based packages and the root filesystem upon which |
| 178 | the installation is based. |
| 179 | If you want to set up your own IPKG repository pointed to by |
| 180 | <filename>YOCTOADT_REPO</filename>, you need to be sure that the |
| 181 | directory structure follows the same layout as the reference directory |
| 182 | set up at <ulink url='http://adtrepo.yoctoproject.org'></ulink>. |
| 183 | Also, your repository needs to be accessible through HTTP.</para></listitem> |
| 184 | <listitem><para><filename>YOCTOADT_TARGETS</filename>: The machine |
| 185 | target architectures for which you want to set up cross-development |
| 186 | environments.</para></listitem> |
| 187 | <listitem><para><filename>YOCTOADT_QEMU</filename>: Indicates whether |
| 188 | or not to install the emulator QEMU.</para></listitem> |
| 189 | <listitem><para><filename>YOCTOADT_NFS_UTIL</filename>: Indicates whether |
| 190 | or not to install user-mode NFS. |
| 191 | If you plan to use the Eclipse IDE Yocto plug-in against QEMU, |
| 192 | you should install NFS. |
| 193 | <note>To boot QEMU images using our userspace NFS server, you need |
| 194 | to be running <filename>portmap</filename> or <filename>rpcbind</filename>. |
| 195 | If you are running <filename>rpcbind</filename>, you will also need to add the |
| 196 | <filename>-i</filename> option when <filename>rpcbind</filename> starts up. |
| 197 | Please make sure you understand the security implications of doing this. |
| 198 | You might also have to modify your firewall settings to allow |
| 199 | NFS booting to work.</note></para></listitem> |
| 200 | <listitem><para><filename>YOCTOADT_ROOTFS_</filename><replaceable>arch</replaceable>: The root |
| 201 | filesystem images you want to download from the |
| 202 | <filename>YOCTOADT_IPKG_REPO</filename> repository.</para></listitem> |
| 203 | <listitem><para><filename>YOCTOADT_TARGET_SYSROOT_IMAGE_</filename><replaceable>arch</replaceable>: The |
| 204 | particular root filesystem used to extract and create the target sysroot. |
| 205 | The value of this variable must have been specified with |
| 206 | <filename>YOCTOADT_ROOTFS_</filename><replaceable>arch</replaceable>. |
| 207 | For example, if you downloaded both <filename>minimal</filename> and |
| 208 | <filename>sato-sdk</filename> images by setting |
| 209 | <filename>YOCTOADT_ROOTFS_</filename><replaceable>arch</replaceable> |
| 210 | to "minimal sato-sdk", then <filename>YOCTOADT_ROOTFS_</filename><replaceable>arch</replaceable> |
| 211 | must be set to either "minimal" or "sato-sdk". |
| 212 | </para></listitem> |
| 213 | <listitem><para><filename>YOCTOADT_TARGET_SYSROOT_LOC_</filename><replaceable>arch</replaceable>: The |
| 214 | location on the development host where the target sysroot is created. |
| 215 | </para></listitem> |
| 216 | </itemizedlist> |
| 217 | </para> |
| 218 | |
| 219 | <para> |
| 220 | After you have configured the <filename>adt_installer.conf</filename> file, |
| 221 | run the installer using the following command: |
| 222 | <literallayout class='monospaced'> |
| 223 | $ cd adt-installer |
| 224 | $ ./adt_installer |
| 225 | </literallayout> |
| 226 | Once the installer begins to run, you are asked to enter the |
| 227 | location for cross-toolchain installation. |
| 228 | The default location is |
| 229 | <filename>/opt/poky/</filename><replaceable>release</replaceable>. |
| 230 | After either accepting the default location or selecting your |
| 231 | own location, you are prompted to run the installation script |
| 232 | interactively or in silent mode. |
| 233 | If you want to closely monitor the installation, |
| 234 | choose “I” for interactive mode rather than “S” for silent mode. |
| 235 | Follow the prompts from the script to complete the installation. |
| 236 | </para> |
| 237 | |
| 238 | <para> |
| 239 | Once the installation completes, the ADT, which includes the |
| 240 | cross-toolchain, is installed in the selected installation |
| 241 | directory. |
| 242 | You will notice environment setup files for the cross-toolchain |
| 243 | in the installation directory, and image tarballs in the |
| 244 | <filename>adt-installer</filename> directory according to your |
| 245 | installer configurations, and the target sysroot located |
| 246 | according to the |
| 247 | <filename>YOCTOADT_TARGET_SYSROOT_LOC_</filename><replaceable>arch</replaceable> |
| 248 | variable also in your configuration file. |
| 249 | </para> |
| 250 | </section> |
| 251 | </section> |
| 252 | |
| 253 | <section id='using-an-existing-toolchain-tarball'> |
| 254 | <title>Using a Cross-Toolchain Tarball</title> |
| 255 | |
| 256 | <para> |
| 257 | If you want to simply install a cross-toolchain by hand, you can |
| 258 | do so by running the toolchain installer. |
| 259 | The installer includes the pre-built cross-toolchain, the |
| 260 | <filename>runqemu</filename> script, and support files. |
| 261 | If you use this method to install the cross-toolchain, you |
| 262 | might still need to install the target sysroot by installing and |
| 263 | extracting it separately. |
| 264 | For information on how to install the sysroot, see the |
| 265 | "<link linkend='extracting-the-root-filesystem'>Extracting the Root Filesystem</link>" section. |
| 266 | </para> |
| 267 | |
| 268 | <para> |
| 269 | Follow these steps: |
| 270 | <orderedlist> |
| 271 | <listitem><para><emphasis>Get your toolchain installer using one of the following methods:</emphasis> |
| 272 | <itemizedlist> |
| 273 | <listitem><para>Go to |
| 274 | <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'></ulink> |
| 275 | and find the folder that matches your host |
| 276 | development system (i.e. <filename>i686</filename> |
| 277 | for 32-bit machines or <filename>x86_64</filename> |
| 278 | for 64-bit machines).</para> |
| 279 | <para>Go into that folder and download the toolchain |
| 280 | installer whose name includes the appropriate target |
| 281 | architecture. |
| 282 | The toolchains provided by the Yocto Project |
| 283 | are based off of the |
| 284 | <filename>core-image-sato</filename> image and |
| 285 | contain libraries appropriate for developing |
| 286 | against that image. |
| 287 | For example, if your host development system is a |
| 288 | 64-bit x86 system and you are going to use |
| 289 | your cross-toolchain for a 32-bit x86 |
| 290 | target, go into the <filename>x86_64</filename> |
| 291 | folder and download the following installer: |
| 292 | <literallayout class='monospaced'> |
| 293 | poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh |
| 294 | </literallayout></para></listitem> |
| 295 | <listitem><para>Build your own toolchain installer. |
| 296 | For cases where you cannot use an installer |
| 297 | from the download area, you can build your own as |
| 298 | described in the |
| 299 | "<link linkend='optionally-building-a-toolchain-installer'>Optionally Building a Toolchain Installer</link>" |
| 300 | section.</para></listitem> |
| 301 | </itemizedlist></para></listitem> |
| 302 | <listitem><para><emphasis>Once you have the installer, run it to install the toolchain:</emphasis> |
| 303 | <note> |
| 304 | You must change the permissions on the toolchain |
| 305 | installer script so that it is executable. |
| 306 | </note></para> |
| 307 | <para>The following command shows how to run the installer |
| 308 | given a toolchain tarball for a 64-bit x86 development host |
| 309 | system and a 32-bit x86 target architecture. |
| 310 | The example assumes the toolchain installer is located |
| 311 | in <filename>~/Downloads/</filename>. |
| 312 | <literallayout class='monospaced'> |
| 313 | $ ~/Downloads/poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh |
| 314 | </literallayout> |
| 315 | The first thing the installer prompts you for is the |
| 316 | directory into which you want to install the toolchain. |
| 317 | The default directory used is |
| 318 | <filename>/opt/poky/&DISTRO;</filename>. |
| 319 | If you do not have write permissions for the directory |
| 320 | into which you are installing the toolchain, the |
| 321 | toolchain installer notifies you and exits. |
| 322 | Be sure you have write permissions in the directory and |
| 323 | run the installer again.</para> |
| 324 | <para>When the script finishes, the cross-toolchain is |
| 325 | installed. |
| 326 | You will notice environment setup files for the |
| 327 | cross-toolchain in the installation directory. |
| 328 | </para></listitem> |
| 329 | </orderedlist> |
| 330 | </para> |
| 331 | </section> |
| 332 | |
| 333 | <section id='using-the-toolchain-from-within-the-build-tree'> |
| 334 | <title>Using BitBake and the Build Directory</title> |
| 335 | |
| 336 | <para> |
| 337 | A final way of making the cross-toolchain available is to use BitBake |
| 338 | to generate the toolchain within an existing |
| 339 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>. |
| 340 | This method does not install the toolchain into the default |
| 341 | <filename>/opt</filename> directory. |
| 342 | As with the previous method, if you need to install the target sysroot, you must |
| 343 | do that separately as well. |
| 344 | </para> |
| 345 | |
| 346 | <para> |
| 347 | Follow these steps to generate the toolchain into the Build Directory: |
| 348 | <orderedlist> |
| 349 | <listitem><para><emphasis>Set up the Build Environment:</emphasis> |
| 350 | Source the OpenEmbedded build environment setup |
| 351 | script (i.e. |
| 352 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink> |
| 353 | or |
| 354 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink>) |
| 355 | located in the |
| 356 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>. |
| 357 | </para></listitem> |
| 358 | <listitem><para><emphasis>Check your Local Configuration File:</emphasis> |
| 359 | At this point, you should be sure that the |
| 360 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> variable |
| 361 | in the <filename>local.conf</filename> file found in the |
| 362 | <filename>conf</filename> directory of the Build Directory |
| 363 | is set for the target architecture. |
| 364 | Comments within the <filename>local.conf</filename> file |
| 365 | list the values you can use for the |
| 366 | <filename>MACHINE</filename> variable. |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 367 | If you do not change the <filename>MACHINE</filename> |
| 368 | variable, the OpenEmbedded build system uses |
| 369 | <filename>qemux86</filename> as the default target |
| 370 | machine when building the cross-toolchain. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 371 | <note> |
| 372 | You can populate the Build Directory with the |
| 373 | cross-toolchains for more than a single architecture. |
| 374 | You just need to edit the <filename>MACHINE</filename> |
| 375 | variable in the <filename>local.conf</filename> file and |
| 376 | re-run the <filename>bitbake</filename> command. |
| 377 | </note></para></listitem> |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 378 | <listitem><para><emphasis>Make Sure Your Layers are Enabled:</emphasis> |
| 379 | Examine the <filename>conf/bblayers.conf</filename> file |
| 380 | and make sure that you have enabled all the compatible |
| 381 | layers for your target machine. |
| 382 | The OpenEmbedded build system needs to be aware of each |
| 383 | layer you want included when building images and |
| 384 | cross-toolchains. |
| 385 | For information on how to enable a layer, see the |
| 386 | "<ulink url='&YOCTO_DOCS_DEV_URL;#enabling-your-layer'>Enabling Your Layer</ulink>" |
| 387 | section in the Yocto Project Development Manual. |
| 388 | </para></listitem> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 389 | <listitem><para><emphasis>Generate the Cross-Toolchain:</emphasis> |
| 390 | Run <filename>bitbake meta-ide-support</filename> to |
| 391 | complete the cross-toolchain generation. |
| 392 | Once the <filename>bitbake</filename> command finishes, |
| 393 | the cross-toolchain is |
| 394 | generated and populated within the Build Directory. |
| 395 | You will notice environment setup files for the |
| 396 | cross-toolchain that contain the string |
| 397 | "<filename>environment-setup</filename>" in the |
| 398 | Build Directory's <filename>tmp</filename> folder.</para> |
| 399 | <para>Be aware that when you use this method to install the |
| 400 | toolchain, you still need to separately extract and install |
| 401 | the sysroot filesystem. |
| 402 | For information on how to do this, see the |
| 403 | "<link linkend='extracting-the-root-filesystem'>Extracting the Root Filesystem</link>" section. |
| 404 | </para></listitem> |
| 405 | </orderedlist> |
| 406 | </para> |
| 407 | </section> |
| 408 | </section> |
| 409 | |
| 410 | <section id='setting-up-the-cross-development-environment'> |
| 411 | <title>Setting Up the Cross-Development Environment</title> |
| 412 | |
| 413 | <para> |
| 414 | Before you can develop using the cross-toolchain, you need to set up the |
| 415 | cross-development environment by sourcing the toolchain's environment setup script. |
| 416 | If you used the ADT Installer or hand-installed cross-toolchain, |
| 417 | then you can find this script in the directory you chose for installation. |
| 418 | For this release, the default installation directory is |
| 419 | <filename>&YOCTO_ADTPATH_DIR;</filename>. |
| 420 | If you installed the toolchain in the |
| 421 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>, |
| 422 | you can find the environment setup |
| 423 | script for the toolchain in the Build Directory's <filename>tmp</filename> directory. |
| 424 | </para> |
| 425 | |
| 426 | <para> |
| 427 | Be sure to run the environment setup script that matches the |
| 428 | architecture for which you are developing. |
| 429 | Environment setup scripts begin with the string |
| 430 | "<filename>environment-setup</filename>" and include as part of their |
| 431 | name the architecture. |
| 432 | For example, the toolchain environment setup script for a 64-bit |
| 433 | IA-based architecture installed in the default installation directory |
| 434 | would be the following: |
| 435 | <literallayout class='monospaced'> |
| 436 | &YOCTO_ADTPATH_DIR;/environment-setup-x86_64-poky-linux |
| 437 | </literallayout> |
| 438 | When you run the setup script, many environment variables are |
| 439 | defined: |
| 440 | <literallayout class='monospaced'> |
| 441 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SDKTARGETSYSROOT'><filename>SDKTARGETSYSROOT</filename></ulink> - The path to the sysroot used for cross-compilation |
| 442 | <ulink url='&YOCTO_DOCS_REF_URL;#var-PKG_CONFIG_PATH'><filename>PKG_CONFIG_PATH</filename></ulink> - The path to the target pkg-config files |
| 443 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CONFIG_SITE'><filename>CONFIG_SITE</filename></ulink> - A GNU autoconf site file preconfigured for the target |
| 444 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'><filename>CC</filename></ulink> - The minimal command and arguments to run the C compiler |
| 445 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CXX'><filename>CXX</filename></ulink> - The minimal command and arguments to run the C++ compiler |
| 446 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CPP'><filename>CPP</filename></ulink> - The minimal command and arguments to run the C preprocessor |
| 447 | <ulink url='&YOCTO_DOCS_REF_URL;#var-AS'><filename>AS</filename></ulink> - The minimal command and arguments to run the assembler |
| 448 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'><filename>LD</filename></ulink> - The minimal command and arguments to run the linker |
| 449 | <ulink url='&YOCTO_DOCS_REF_URL;#var-GDB'><filename>GDB</filename></ulink> - The minimal command and arguments to run the GNU Debugger |
| 450 | <ulink url='&YOCTO_DOCS_REF_URL;#var-STRIP'><filename>STRIP</filename></ulink> - The minimal command and arguments to run 'strip', which strips symbols |
| 451 | <ulink url='&YOCTO_DOCS_REF_URL;#var-RANLIB'><filename>RANLIB</filename></ulink> - The minimal command and arguments to run 'ranlib' |
| 452 | <ulink url='&YOCTO_DOCS_REF_URL;#var-OBJCOPY'><filename>OBJCOPY</filename></ulink> - The minimal command and arguments to run 'objcopy' |
| 453 | <ulink url='&YOCTO_DOCS_REF_URL;#var-OBJDUMP'><filename>OBJDUMP</filename></ulink> - The minimal command and arguments to run 'objdump' |
| 454 | <ulink url='&YOCTO_DOCS_REF_URL;#var-AR'><filename>AR</filename></ulink> - The minimal command and arguments to run 'ar' |
| 455 | <ulink url='&YOCTO_DOCS_REF_URL;#var-NM'><filename>NM</filename></ulink> - The minimal command and arguments to run 'nm' |
| 456 | <ulink url='&YOCTO_DOCS_REF_URL;#var-TARGET_PREFIX'><filename>TARGET_PREFIX</filename></ulink> - The toolchain binary prefix for the target tools |
| 457 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CROSS_COMPILE'><filename>CROSS_COMPILE</filename></ulink> - The toolchain binary prefix for the target tools |
| 458 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CONFIGURE_FLAGS'><filename>CONFIGURE_FLAGS</filename></ulink> - The minimal arguments for GNU configure |
| 459 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CFLAGS'><filename>CFLAGS</filename></ulink> - Suggested C flags |
| 460 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CXXFLAGS'><filename>CXXFLAGS</filename></ulink> - Suggested C++ flags |
| 461 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LDFLAGS'><filename>LDFLAGS</filename></ulink> - Suggested linker flags when you use CC to link |
| 462 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CPPFLAGS'><filename>CPPFLAGS</filename></ulink> - Suggested preprocessor flags |
| 463 | </literallayout> |
| 464 | </para> |
| 465 | </section> |
| 466 | |
| 467 | <section id='securing-kernel-and-filesystem-images'> |
| 468 | <title>Securing Kernel and Filesystem Images</title> |
| 469 | |
| 470 | <para> |
| 471 | You will need to have a kernel and filesystem image to boot using your |
| 472 | hardware or the QEMU emulator. |
| 473 | Furthermore, if you plan on booting your image using NFS or you want to use the root filesystem |
| 474 | as the target sysroot, you need to extract the root filesystem. |
| 475 | </para> |
| 476 | |
| 477 | <section id='getting-the-images'> |
| 478 | <title>Getting the Images</title> |
| 479 | |
| 480 | <para> |
| 481 | To get the kernel and filesystem images, you either have to build them or download |
| 482 | pre-built versions. |
| 483 | For an example of how to build these images, see the |
| 484 | "<ulink url='&YOCTO_DOCS_QS_URL;#qs-buiding-images'>Buiding Images</ulink>" |
| 485 | section of the Yocto Project Quick Start. |
| 486 | For an example of downloading pre-build versions, see the |
| 487 | "<link linkend='using-pre-built'>Example Using Pre-Built Binaries and QEMU</link>" |
| 488 | section. |
| 489 | </para> |
| 490 | |
| 491 | <para> |
| 492 | The Yocto Project ships basic kernel and filesystem images for several |
| 493 | architectures (<filename>x86</filename>, <filename>x86-64</filename>, |
| 494 | <filename>mips</filename>, <filename>powerpc</filename>, and <filename>arm</filename>) |
| 495 | that you can use unaltered in the QEMU emulator. |
| 496 | These kernel images reside in the release |
| 497 | area - <ulink url='&YOCTO_MACHINES_DL_URL;'></ulink> |
| 498 | and are ideal for experimentation using Yocto Project. |
| 499 | For information on the image types you can build using the OpenEmbedded build system, |
| 500 | see the |
| 501 | "<ulink url='&YOCTO_DOCS_REF_URL;#ref-images'>Images</ulink>" |
| 502 | chapter in the Yocto Project Reference Manual. |
| 503 | </para> |
| 504 | |
| 505 | <para> |
| 506 | If you are planning on developing against your image and you are not |
| 507 | building or using one of the Yocto Project development images |
| 508 | (e.g. <filename>core-image-*-dev</filename>), you must be sure to |
| 509 | include the development packages as part of your image recipe. |
| 510 | </para> |
| 511 | |
| 512 | <para> |
| 513 | If you plan on remotely deploying and debugging your |
| 514 | application from within the Eclipse IDE, you must have an image |
| 515 | that contains the Yocto Target Communication Framework (TCF) agent |
| 516 | (<filename>tcf-agent</filename>). |
| 517 | You can do this by including the <filename>eclipse-debug</filename> |
| 518 | image feature. |
| 519 | <note> |
| 520 | See the |
| 521 | "<ulink url='&YOCTO_DOCS_REF_URL;#ref-features-image'>Image Features</ulink>" |
| 522 | section in the Yocto Project Reference Manual for information on |
| 523 | image features. |
| 524 | </note> |
| 525 | To include the <filename>eclipse-debug</filename> image feature, |
| 526 | modify your <filename>local.conf</filename> file in the |
| 527 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink> |
| 528 | so that the |
| 529 | <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_IMAGE_FEATURES'><filename>EXTRA_IMAGE_FEATURES</filename></ulink> |
| 530 | variable includes the "eclipse-debug" feature. |
| 531 | After modifying the configuration file, you can rebuild the image. |
| 532 | Once the image is rebuilt, the <filename>tcf-agent</filename> |
| 533 | will be included in the image and is launched automatically after |
| 534 | the boot. |
| 535 | </para> |
| 536 | </section> |
| 537 | |
| 538 | <section id='extracting-the-root-filesystem'> |
| 539 | <title>Extracting the Root Filesystem</title> |
| 540 | |
| 541 | <para> |
| 542 | If you install your toolchain by hand or build it using BitBake and |
| 543 | you need a root filesystem, you need to extract it separately. |
| 544 | If you use the ADT Installer to install the ADT, the root |
| 545 | filesystem is automatically extracted and installed. |
| 546 | </para> |
| 547 | |
| 548 | <para> |
| 549 | Here are some cases where you need to extract the root filesystem: |
| 550 | <itemizedlist> |
| 551 | <listitem><para>You want to boot the image using NFS. |
| 552 | </para></listitem> |
| 553 | <listitem><para>You want to use the root filesystem as the |
| 554 | target sysroot. |
| 555 | For example, the Eclipse IDE environment with the Eclipse |
| 556 | Yocto Plug-in installed allows you to use QEMU to boot |
| 557 | under NFS.</para></listitem> |
| 558 | <listitem><para>You want to develop your target application |
| 559 | using the root filesystem as the target sysroot. |
| 560 | </para></listitem> |
| 561 | </itemizedlist> |
| 562 | </para> |
| 563 | |
| 564 | <para> |
| 565 | To extract the root filesystem, first <filename>source</filename> |
| 566 | the cross-development environment setup script to establish |
| 567 | necessary environment variables. |
| 568 | If you built the toolchain in the Build Directory, you will find |
| 569 | the toolchain environment script in the |
| 570 | <filename>tmp</filename> directory. |
| 571 | If you installed the toolchain by hand, the environment setup |
| 572 | script is located in <filename>/opt/poky/&DISTRO;</filename>. |
| 573 | </para> |
| 574 | |
| 575 | <para> |
| 576 | After sourcing the environment script, use the |
| 577 | <filename>runqemu-extract-sdk</filename> command and provide the |
| 578 | filesystem image. |
| 579 | </para> |
| 580 | |
| 581 | <para> |
| 582 | Following is an example. |
| 583 | The second command sets up the environment. |
| 584 | In this case, the setup script is located in the |
| 585 | <filename>/opt/poky/&DISTRO;</filename> directory. |
| 586 | The third command extracts the root filesystem from a previously |
| 587 | built filesystem that is located in the |
| 588 | <filename>~/Downloads</filename> directory. |
| 589 | Furthermore, this command extracts the root filesystem into the |
| 590 | <filename>qemux86-sato</filename> directory: |
| 591 | <literallayout class='monospaced'> |
| 592 | $ cd ~ |
| 593 | $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux |
| 594 | $ runqemu-extract-sdk \ |
| 595 | ~/Downloads/core-image-sato-sdk-qemux86-2011091411831.rootfs.tar.bz2 \ |
| 596 | $HOME/qemux86-sato |
| 597 | </literallayout> |
| 598 | You could now point to the target sysroot at |
| 599 | <filename>qemux86-sato</filename>. |
| 600 | </para> |
| 601 | </section> |
| 602 | </section> |
| 603 | |
| 604 | <section id='optionally-building-a-toolchain-installer'> |
| 605 | <title>Optionally Building a Toolchain Installer</title> |
| 606 | |
| 607 | <para> |
| 608 | As an alternative to locating and downloading a toolchain installer, |
| 609 | you can build the toolchain installer if you have a |
| 610 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>. |
| 611 | <note> |
| 612 | Although not the preferred method, it is also possible to use |
| 613 | <filename>bitbake meta-toolchain</filename> to build the toolchain |
| 614 | installer. |
| 615 | If you do use this method, you must separately install and extract |
| 616 | the target sysroot. |
| 617 | For information on how to install the sysroot, see the |
| 618 | "<link linkend='extracting-the-root-filesystem'>Extracting the Root Filesystem</link>" |
| 619 | section. |
| 620 | </note> |
| 621 | </para> |
| 622 | |
| 623 | <para> |
| 624 | To build the toolchain installer and populate the SDK image, use the |
| 625 | following command: |
| 626 | <literallayout class='monospaced'> |
| 627 | $ bitbake <replaceable>image</replaceable> -c populate_sdk |
| 628 | </literallayout> |
| 629 | The command results in a toolchain installer that contains the sysroot |
| 630 | that matches your target root filesystem. |
| 631 | </para> |
| 632 | |
| 633 | <para> |
| 634 | Another powerful feature is that the toolchain is completely |
| 635 | self-contained. |
| 636 | The binaries are linked against their own copy of |
| 637 | <filename>libc</filename>, which results in no dependencies |
| 638 | on the target system. |
| 639 | To achieve this, the pointer to the dynamic loader is |
| 640 | configured at install time since that path cannot be dynamically |
| 641 | altered. |
| 642 | This is the reason for a wrapper around the |
| 643 | <filename>populate_sdk</filename> archive. |
| 644 | </para> |
| 645 | |
| 646 | <para> |
| 647 | Another feature is that only one set of cross-canadian toolchain |
| 648 | binaries are produced per architecture. |
| 649 | This feature takes advantage of the fact that the target hardware can |
| 650 | be passed to <filename>gcc</filename> as a set of compiler options. |
| 651 | Those options are set up by the environment script and contained in |
| 652 | variables such as |
| 653 | <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'><filename>CC</filename></ulink> |
| 654 | and |
| 655 | <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'><filename>LD</filename></ulink>. |
| 656 | This reduces the space needed for the tools. |
| 657 | Understand, however, that a sysroot is still needed for every target |
| 658 | since those binaries are target-specific. |
| 659 | </para> |
| 660 | |
| 661 | <para> |
| 662 | Remember, before using any BitBake command, you |
| 663 | must source the build environment setup script |
| 664 | (i.e. |
| 665 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink> |
| 666 | or |
| 667 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink>) |
| 668 | located in the Source Directory and you must make sure your |
| 669 | <filename>conf/local.conf</filename> variables are correct. |
| 670 | In particular, you need to be sure the |
| 671 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> |
| 672 | variable matches the architecture for which you are building and that |
| 673 | the |
| 674 | <ulink url='&YOCTO_DOCS_REF_URL;#var-SDKMACHINE'><filename>SDKMACHINE</filename></ulink> |
| 675 | variable is correctly set if you are building a toolchain designed to |
| 676 | run on an architecture that differs from your current development host |
| 677 | machine (i.e. the build machine). |
| 678 | </para> |
| 679 | |
| 680 | <para> |
| 681 | When the <filename>bitbake</filename> command completes, the toolchain |
| 682 | installer will be in |
| 683 | <filename>tmp/deploy/sdk</filename> in the Build Directory. |
| 684 | <note> |
| 685 | By default, this toolchain does not build static binaries. |
| 686 | If you want to use the toolchain to build these types of libraries, |
| 687 | you need to be sure your image has the appropriate static |
| 688 | development libraries. |
| 689 | Use the |
| 690 | <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'><filename>IMAGE_INSTALL</filename></ulink> |
| 691 | variable inside your <filename>local.conf</filename> file to |
| 692 | install the appropriate library packages. |
| 693 | Following is an example using <filename>glibc</filename> static |
| 694 | development libraries: |
| 695 | <literallayout class='monospaced'> |
| 696 | IMAGE_INSTALL_append = " glibc-staticdev" |
| 697 | </literallayout> |
| 698 | </note> |
| 699 | </para> |
| 700 | </section> |
| 701 | |
| 702 | <section id='optionally-using-an-external-toolchain'> |
| 703 | <title>Optionally Using an External Toolchain</title> |
| 704 | |
| 705 | <para> |
| 706 | You might want to use an external toolchain as part of your |
| 707 | development. |
| 708 | If this is the case, the fundamental steps you need to accomplish |
| 709 | are as follows: |
| 710 | <itemizedlist> |
| 711 | <listitem><para> |
| 712 | Understand where the installed toolchain resides. |
| 713 | For cases where you need to build the external toolchain, you |
| 714 | would need to take separate steps to build and install the |
| 715 | toolchain. |
| 716 | </para></listitem> |
| 717 | <listitem><para> |
| 718 | Make sure you add the layer that contains the toolchain to |
| 719 | your <filename>bblayers.conf</filename> file through the |
| 720 | <ulink url='&YOCTO_DOCS_REF_URL;#var-BBLAYERS'><filename>BBLAYERS</filename></ulink> |
| 721 | variable. |
| 722 | </para></listitem> |
| 723 | <listitem><para> |
| 724 | Set the |
| 725 | <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTERNAL_TOOLCHAIN'><filename>EXTERNAL_TOOLCHAIN</filename></ulink> |
| 726 | variable in your <filename>local.conf</filename> file |
| 727 | to the location in which you installed the toolchain. |
| 728 | </para></listitem> |
| 729 | </itemizedlist> |
| 730 | A good example of an external toolchain used with the Yocto Project |
| 731 | is <trademark class='registered'>Mentor Graphics</trademark> |
| 732 | Sourcery G++ Toolchain. |
| 733 | You can see information on how to use that particular layer in the |
| 734 | <filename>README</filename> file at |
| 735 | <ulink url='http://github.com/MentorEmbedded/meta-sourcery/'></ulink>. |
| 736 | You can find further information by reading about the |
| 737 | <ulink url='&YOCTO_DOCS_REF_URL;#var-TCMODE'><filename>TCMODE</filename></ulink> |
| 738 | variable in the Yocto Project Reference Manual's variable glossary. |
| 739 | </para> |
| 740 | </section> |
| 741 | |
| 742 | <section id='using-pre-built'> |
| 743 | <title>Example Using Pre-Built Binaries and QEMU</title> |
| 744 | |
| 745 | <para> |
| 746 | If hardware, libraries and services are stable, you can get started by using a pre-built binary |
| 747 | of the filesystem image, kernel, and toolchain and run it using the QEMU emulator. |
| 748 | This scenario is useful for developing application software. |
| 749 | </para> |
| 750 | |
| 751 | <mediaobject> |
| 752 | <imageobject> |
| 753 | <imagedata fileref="figures/using-a-pre-built-image.png" format="PNG" align='center' scalefit='1'/> |
| 754 | </imageobject> |
| 755 | <caption> |
| 756 | <para>Using a Pre-Built Image</para> |
| 757 | </caption> |
| 758 | </mediaobject> |
| 759 | |
| 760 | <para> |
| 761 | For this scenario, you need to do several things: |
| 762 | </para> |
| 763 | |
| 764 | <itemizedlist> |
| 765 | <listitem><para>Install the appropriate stand-alone toolchain tarball.</para></listitem> |
| 766 | <listitem><para>Download the pre-built image that will boot with QEMU. |
| 767 | You need to be sure to get the QEMU image that matches your target machine’s |
| 768 | architecture (e.g. x86, ARM, etc.).</para></listitem> |
| 769 | <listitem><para>Download the filesystem image for your target machine's architecture. |
| 770 | </para></listitem> |
| 771 | <listitem><para>Set up the environment to emulate the hardware and then start the QEMU emulator. |
| 772 | </para></listitem> |
| 773 | </itemizedlist> |
| 774 | |
| 775 | <section id='installing-the-toolchain'> |
| 776 | <title>Installing the Toolchain</title> |
| 777 | |
| 778 | <para> |
| 779 | You can download a tarball installer, which includes the |
| 780 | pre-built toolchain, the <filename>runqemu</filename> |
| 781 | script, and support files from the appropriate directory under |
| 782 | <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'></ulink>. |
| 783 | Toolchains are available for 32-bit and 64-bit x86 development |
| 784 | systems from the <filename>i686</filename> and |
| 785 | <filename>x86_64</filename> directories, respectively. |
| 786 | The toolchains the Yocto Project provides are based off the |
| 787 | <filename>core-image-sato</filename> image and contain |
| 788 | libraries appropriate for developing against that image. |
| 789 | Each type of development system supports five or more target |
| 790 | architectures. |
| 791 | </para> |
| 792 | |
| 793 | <para> |
| 794 | The names of the tarball installer scripts are such that a |
| 795 | string representing the host system appears first in the |
| 796 | filename and then is immediately followed by a string |
| 797 | representing the target architecture. |
| 798 | </para> |
| 799 | |
| 800 | <literallayout class='monospaced'> |
| 801 | poky-glibc-<replaceable>host_system</replaceable>-<replaceable>image_type</replaceable>-<replaceable>arch</replaceable>-toolchain-<replaceable>release_version</replaceable>.sh |
| 802 | |
| 803 | Where: |
| 804 | <replaceable>host_system</replaceable> is a string representing your development system: |
| 805 | |
| 806 | i686 or x86_64. |
| 807 | |
| 808 | <replaceable>image_type</replaceable> is a string representing the image you wish to |
| 809 | develop a Software Development Toolkit (SDK) for use against. |
| 810 | The Yocto Project builds toolchain installers using the |
| 811 | following BitBake command: |
| 812 | |
| 813 | bitbake core-image-sato -c populate_sdk |
| 814 | |
| 815 | <replaceable>arch</replaceable> is a string representing the tuned target architecture: |
| 816 | |
| 817 | i586, x86_64, powerpc, mips, armv7a or armv5te |
| 818 | |
| 819 | <replaceable>release_version</replaceable> is a string representing the release number of the |
| 820 | Yocto Project: |
| 821 | |
| 822 | &DISTRO;, &DISTRO;+snapshot |
| 823 | </literallayout> |
| 824 | |
| 825 | <para> |
| 826 | For example, the following toolchain installer is for a 64-bit |
| 827 | development host system and a i586-tuned target architecture |
| 828 | based off the SDK for <filename>core-image-sato</filename>: |
| 829 | <literallayout class='monospaced'> |
| 830 | poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh |
| 831 | </literallayout> |
| 832 | </para> |
| 833 | |
| 834 | <para> |
| 835 | Toolchains are self-contained and by default are installed into |
| 836 | <filename>/opt/poky</filename>. |
| 837 | However, when you run the toolchain installer, you can choose an |
| 838 | installation directory. |
| 839 | </para> |
| 840 | |
| 841 | <para> |
| 842 | The following command shows how to run the installer given a toolchain tarball |
| 843 | for a 64-bit x86 development host system and a 32-bit x86 target architecture. |
| 844 | You must change the permissions on the toolchain |
| 845 | installer script so that it is executable. |
| 846 | </para> |
| 847 | |
| 848 | <para> |
| 849 | The example assumes the toolchain installer is located in <filename>~/Downloads/</filename>. |
| 850 | <note> |
| 851 | If you do not have write permissions for the directory into which you are installing |
| 852 | the toolchain, the toolchain installer notifies you and exits. |
| 853 | Be sure you have write permissions in the directory and run the installer again. |
| 854 | </note> |
| 855 | </para> |
| 856 | |
| 857 | <para> |
| 858 | <literallayout class='monospaced'> |
| 859 | $ ~/Downloads/poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh |
| 860 | </literallayout> |
| 861 | </para> |
| 862 | |
| 863 | <para> |
| 864 | For more information on how to install tarballs, see the |
| 865 | "<ulink url='&YOCTO_DOCS_ADT_URL;#using-an-existing-toolchain-tarball'>Using a Cross-Toolchain Tarball</ulink>" and |
| 866 | "<ulink url='&YOCTO_DOCS_ADT_URL;#using-the-toolchain-from-within-the-build-tree'>Using BitBake and the Build Directory</ulink>" sections in the Yocto Project Application Developer's Guide. |
| 867 | </para> |
| 868 | </section> |
| 869 | |
| 870 | <section id='downloading-the-pre-built-linux-kernel'> |
| 871 | <title>Downloading the Pre-Built Linux Kernel</title> |
| 872 | |
| 873 | <para> |
| 874 | You can download the pre-built Linux kernel suitable for running in the QEMU emulator from |
| 875 | <ulink url='&YOCTO_QEMU_DL_URL;'></ulink>. |
| 876 | Be sure to use the kernel that matches the architecture you want to simulate. |
| 877 | Download areas exist for the five supported machine architectures: |
| 878 | <filename>qemuarm</filename>, <filename>qemumips</filename>, <filename>qemuppc</filename>, |
| 879 | <filename>qemux86</filename>, and <filename>qemux86-64</filename>. |
| 880 | </para> |
| 881 | |
| 882 | <para> |
| 883 | Most kernel files have one of the following forms: |
| 884 | <literallayout class='monospaced'> |
| 885 | *zImage-qemu<replaceable>arch</replaceable>.bin |
| 886 | vmlinux-qemu<replaceable>arch</replaceable>.bin |
| 887 | |
| 888 | Where: |
| 889 | <replaceable>arch</replaceable> is a string representing the target architecture: |
| 890 | x86, x86-64, ppc, mips, or arm. |
| 891 | </literallayout> |
| 892 | </para> |
| 893 | |
| 894 | <para> |
| 895 | You can learn more about downloading a Yocto Project kernel in the |
| 896 | "<ulink url='&YOCTO_DOCS_DEV_URL;#local-kernel-files'>Yocto Project Kernel</ulink>" |
| 897 | bulleted item in the Yocto Project Development Manual. |
| 898 | </para> |
| 899 | </section> |
| 900 | |
| 901 | <section id='downloading-the-filesystem'> |
| 902 | <title>Downloading the Filesystem</title> |
| 903 | |
| 904 | <para> |
| 905 | You can also download the filesystem image suitable for your target architecture from |
| 906 | <ulink url='&YOCTO_QEMU_DL_URL;'></ulink>. |
| 907 | Again, be sure to use the filesystem that matches the architecture you want |
| 908 | to simulate. |
| 909 | </para> |
| 910 | |
| 911 | <para> |
| 912 | The filesystem image has two tarball forms: <filename>ext3</filename> and |
| 913 | <filename>tar</filename>. |
| 914 | You must use the <filename>ext3</filename> form when booting an image using the |
| 915 | QEMU emulator. |
| 916 | The <filename>tar</filename> form can be flattened out in your host development system |
| 917 | and used for build purposes with the Yocto Project. |
| 918 | <literallayout class='monospaced'> |
| 919 | core-image-<replaceable>profile</replaceable>-qemu<replaceable>arch</replaceable>.ext3 |
| 920 | core-image-<replaceable>profile</replaceable>-qemu<replaceable>arch</replaceable>.tar.bz2 |
| 921 | |
| 922 | Where: |
| 923 | <replaceable>profile</replaceable> is the filesystem image's profile: |
| 924 | lsb, lsb-dev, lsb-sdk, lsb-qt3, minimal, minimal-dev, sato, |
| 925 | sato-dev, or sato-sdk. For information on these types of image |
| 926 | profiles, see the "<ulink url='&YOCTO_DOCS_REF_URL;#ref-images'>Images</ulink>" |
| 927 | chapter in the Yocto Project Reference Manual. |
| 928 | |
| 929 | <replaceable>arch</replaceable> is a string representing the target architecture: |
| 930 | x86, x86-64, ppc, mips, or arm. |
| 931 | </literallayout> |
| 932 | </para> |
| 933 | </section> |
| 934 | |
| 935 | <section id='setting-up-the-environment-and-starting-the-qemu-emulator'> |
| 936 | <title>Setting Up the Environment and Starting the QEMU Emulator</title> |
| 937 | |
| 938 | <para> |
| 939 | Before you start the QEMU emulator, you need to set up the emulation environment. |
| 940 | The following command form sets up the emulation environment. |
| 941 | <literallayout class='monospaced'> |
| 942 | $ source &YOCTO_ADTPATH_DIR;/environment-setup-<replaceable>arch</replaceable>-poky-linux-<replaceable>if</replaceable> |
| 943 | |
| 944 | Where: |
| 945 | <replaceable>arch</replaceable> is a string representing the target architecture: |
| 946 | i586, x86_64, ppc603e, mips, or armv5te. |
| 947 | |
| 948 | <replaceable>if</replaceable> is a string representing an embedded application binary interface. |
| 949 | Not all setup scripts include this string. |
| 950 | </literallayout> |
| 951 | </para> |
| 952 | |
| 953 | <para> |
| 954 | Finally, this command form invokes the QEMU emulator |
| 955 | <literallayout class='monospaced'> |
| 956 | $ runqemu <replaceable>qemuarch</replaceable> <replaceable>kernel-image</replaceable> <replaceable>filesystem-image</replaceable> |
| 957 | |
| 958 | Where: |
| 959 | <replaceable>qemuarch</replaceable> is a string representing the target architecture: qemux86, qemux86-64, |
| 960 | qemuppc, qemumips, or qemuarm. |
| 961 | |
| 962 | <replaceable>kernel-image</replaceable> is the architecture-specific kernel image. |
| 963 | |
| 964 | <replaceable>filesystem-image</replaceable> is the .ext3 filesystem image. |
| 965 | |
| 966 | </literallayout> |
| 967 | </para> |
| 968 | |
| 969 | <para> |
| 970 | Continuing with the example, the following two commands setup the emulation |
| 971 | environment and launch QEMU. |
| 972 | This example assumes the root filesystem (<filename>.ext3</filename> file) and |
| 973 | the pre-built kernel image file both reside in your home directory. |
| 974 | The kernel and filesystem are for a 32-bit target architecture. |
| 975 | <literallayout class='monospaced'> |
| 976 | $ cd $HOME |
| 977 | $ source &YOCTO_ADTPATH_DIR;/environment-setup-i586-poky-linux |
| 978 | $ runqemu qemux86 bzImage-qemux86.bin \ |
| 979 | core-image-sato-qemux86.ext3 |
| 980 | </literallayout> |
| 981 | </para> |
| 982 | |
| 983 | <para> |
| 984 | The environment in which QEMU launches varies depending on the filesystem image and on the |
| 985 | target architecture. |
| 986 | For example, if you source the environment for the ARM target |
| 987 | architecture and then boot the minimal QEMU image, the emulator comes up in a new |
| 988 | shell in command-line mode. |
| 989 | However, if you boot the SDK image, QEMU comes up with a GUI. |
| 990 | <note>Booting the PPC image results in QEMU launching in the same shell in |
| 991 | command-line mode.</note> |
| 992 | </para> |
| 993 | </section> |
| 994 | </section> |
| 995 | |
| 996 | </chapter> |
| 997 | <!-- |
| 998 | vim: expandtab tw=80 ts=4 |
| 999 | --> |