| 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 | <chapter id='sdk-using-the-standard-sdk'> | 
 | 6 |  | 
 | 7 | <title>Using the Standard SDK</title> | 
 | 8 |  | 
 | 9 | <para> | 
 | 10 |     This chapter describes the standard SDK and how to use it. | 
 | 11 |     Information covers the pieces of the SDK, how to install it, and presents | 
 | 12 |     several task-based procedures common for developing with a standard SDK. | 
 | 13 |     <note> | 
 | 14 |         The tasks you can perform using a standard SDK are also applicable | 
 | 15 |         when you are using an extensible SDK. | 
 | 16 |         For information on the differences when using an extensible SDK as | 
 | 17 |         compared to an extensible SDK, see the | 
 | 18 |         "<link linkend='sdk-extensible'>Using the Extensible SDK</link>" | 
 | 19 |         chapter. | 
 | 20 |     </note> | 
 | 21 | </para> | 
 | 22 |  | 
 | 23 | <section id='sdk-standard-sdk-intro'> | 
 | 24 |     <title>Why use the Standard SDK and What is in It?</title> | 
 | 25 |  | 
 | 26 |     <para> | 
 | 27 |         The Standard SDK provides a cross-development toolchain and libraries | 
 | 28 |         tailored to the contents of a specific image. | 
 | 29 |         You would use the Standard SDK if you want a more traditional toolchain | 
 | 30 |         experience. | 
 | 31 |     </para> | 
 | 32 |  | 
 | 33 |     <para> | 
 | 34 |         The installed Standard SDK consists of several files and directories. | 
 | 35 |         Basically, it contains an SDK environment setup script, some | 
 | 36 |         configuration files, and host and target root filesystems to support | 
 | 37 |         usage. | 
 | 38 |         You can see the directory structure in the | 
 | 39 |         "<link linkend='sdk-installed-standard-sdk-directory-structure'>Installed Standard SDK Directory Structure</link>" | 
 | 40 |         section. | 
 | 41 |     </para> | 
 | 42 | </section> | 
 | 43 |  | 
 | 44 | <section id='sdk-installing-the-sdk'> | 
 | 45 |     <title>Installing the SDK</title> | 
 | 46 |  | 
 | 47 |     <para> | 
 | 48 |         The first thing you need to do is install the SDK on your host | 
 | 49 |         development machine by running the <filename>.sh</filename> | 
 | 50 |         installation script. | 
 | 51 |     </para> | 
 | 52 |  | 
 | 53 |     <para> | 
 | 54 |         You can download a tarball installer, which includes the | 
 | 55 |         pre-built toolchain, the <filename>runqemu</filename> | 
 | 56 |         script, and support files from the appropriate directory under | 
 | 57 |         <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'></ulink>. | 
 | 58 |         Toolchains are available for 32-bit and 64-bit x86 development | 
 | 59 |         systems from the <filename>i686</filename> and | 
 | 60 |         <filename>x86_64</filename> directories, respectively. | 
 | 61 |         The toolchains the Yocto Project provides are based off the | 
 | 62 |         <filename>core-image-sato</filename> image and contain | 
 | 63 |         libraries appropriate for developing against that image. | 
 | 64 |         Each type of development system supports five or more target | 
 | 65 |         architectures. | 
 | 66 |     </para> | 
 | 67 |  | 
 | 68 |     <para> | 
 | 69 |         The names of the tarball installer scripts are such that a | 
 | 70 |         string representing the host system appears first in the | 
 | 71 |         filename and then is immediately followed by a string | 
 | 72 |         representing the target architecture. | 
 | 73 |         <literallayout class='monospaced'> | 
 | 74 |      poky-glibc-<replaceable>host_system</replaceable>-<replaceable>image_type</replaceable>-<replaceable>arch</replaceable>-toolchain-<replaceable>release_version</replaceable>.sh | 
 | 75 |  | 
 | 76 |      Where: | 
 | 77 |          <replaceable>host_system</replaceable> is a string representing your development system: | 
 | 78 |  | 
 | 79 |                     i686 or x86_64. | 
 | 80 |  | 
 | 81 |          <replaceable>image_type</replaceable> is the image for which the SDK was built. | 
 | 82 |  | 
 | 83 |          <replaceable>arch</replaceable> is a string representing the tuned target architecture: | 
 | 84 |  | 
 | 85 |                     i586, x86_64, powerpc, mips, armv7a or armv5te | 
 | 86 |  | 
 | 87 |          <replaceable>release_version</replaceable> is a string representing the release number of the | 
 | 88 |                 Yocto Project: | 
 | 89 |  | 
 | 90 |                     &DISTRO;, &DISTRO;+snapshot | 
 | 91 |         </literallayout> | 
 | 92 |         For example, the following toolchain installer is for a 64-bit | 
 | 93 |         development host system and a i586-tuned target architecture | 
 | 94 |         based off the SDK for <filename>core-image-sato</filename> and | 
 | 95 |         using the current &DISTRO; snapshot: | 
 | 96 |         <literallayout class='monospaced'> | 
 | 97 |      poky-glibc-x86_64-core-image-sato-i586-toolchain-&DISTRO;.sh | 
 | 98 |         </literallayout> | 
 | 99 |     </para> | 
 | 100 |  | 
 | 101 |     <para> | 
 | 102 |         The SDK and toolchains are self-contained and by default are installed | 
 | 103 |         into <filename>/opt/poky</filename>. | 
 | 104 |         However, when you run the SDK installer, you can choose an | 
 | 105 |         installation directory. | 
 | 106 |         <note> | 
 | 107 |             You must change the permissions on the toolchain | 
 | 108 |             installer script so that it is executable: | 
 | 109 |             <literallayout class='monospaced'> | 
 | 110 |      $ chmod +x poky-glibc-x86_64-core-image-sato-i586-toolchain-2.1.sh | 
 | 111 |             </literallayout> | 
 | 112 |         </note> | 
 | 113 |     </para> | 
 | 114 |  | 
 | 115 |     <para> | 
 | 116 |         The following command shows how to run the installer given a | 
 | 117 |         toolchain tarball for a 64-bit x86 development host system and | 
 | 118 |         a 32-bit x86 target architecture. | 
 | 119 |         The example assumes the toolchain installer is located in | 
 | 120 |         <filename>~/Downloads/</filename>. | 
 | 121 |         <note> | 
 | 122 |             If you do not have write permissions for the directory | 
 | 123 |             into which you are installing the SDK, the installer | 
 | 124 |             notifies you and exits. | 
 | 125 |             Be sure you have write permissions in the directory and | 
 | 126 |             run the installer again. | 
 | 127 |         </note> | 
 | 128 |         <literallayout class='monospaced'> | 
 | 129 |      $ ./poky-glibc-x86_64-core-image-sato-i586-toolchain-2.1.sh | 
 | 130 |      Poky (Yocto Project Reference Distro) SDK installer version 2.0 | 
 | 131 |      =============================================================== | 
 | 132 |      Enter target directory for SDK (default: /opt/poky/2.1): | 
 | 133 |      You are about to install the SDK to "/opt/poky/2.1". Proceed[Y/n]? Y | 
 | 134 |      Extracting SDK.......................................................................done | 
 | 135 |      Setting it up...done | 
 | 136 |      SDK has been successfully set up and is ready to be used. | 
 | 137 |      Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. | 
 | 138 |       $ . /opt/poky/2.1/environment-setup-i586-poky-linux | 
 | 139 |         </literallayout> | 
 | 140 |     </para> | 
 | 141 |  | 
 | 142 |     <para> | 
 | 143 |         Again, reference the | 
 | 144 |         "<link linkend='sdk-installed-standard-sdk-directory-structure'>Installed Standard SDK Directory Structure</link>" | 
 | 145 |         section for more details on the resulting directory structure of | 
 | 146 |         the installed SDK. | 
 | 147 |     </para> | 
 | 148 | </section> | 
 | 149 |  | 
 | 150 | <section id='sdk-running-the-sdk-environment-setup-script'> | 
 | 151 |     <title>Running the SDK Environment Setup Script</title> | 
 | 152 |  | 
 | 153 |     <para> | 
 | 154 |         Once you have the SDK installed, you must run the SDK environment | 
 | 155 |         setup script before you can actually use it. | 
 | 156 |         This setup script resides in the directory you chose when you installed | 
 | 157 |         the SDK. | 
 | 158 |         For information on where this setup script can reside, see the | 
 | 159 |         "<link linkend='sdk-appendix-obtain'>Obtaining the SDK</link>" | 
 | 160 |         Appendix. | 
 | 161 |     </para> | 
 | 162 |  | 
 | 163 |     <para> | 
 | 164 |         Before running the script, be sure it is the one that matches the | 
 | 165 |         architecture for which you are developing. | 
 | 166 |         Environment setup scripts begin with the string | 
 | 167 |         "<filename>environment-setup</filename>" and include as part of their | 
 | 168 |         name the tuned target architecture. | 
 | 169 |         For example, the command to source a setup script for an IA-based | 
 | 170 |         target machine using i586 tuning and located in the default SDK | 
 | 171 |         installation directory is as follows: | 
 | 172 |         <literallayout class='monospaced'> | 
 | 173 |      $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux | 
 | 174 |         </literallayout> | 
 | 175 |         When you run the setup script, many environment variables are | 
 | 176 |         defined: | 
 | 177 |         <literallayout class='monospaced'> | 
 | 178 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-SDKTARGETSYSROOT'><filename>SDKTARGETSYSROOT</filename></ulink> - The path to the sysroot used for cross-compilation | 
 | 179 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-PKG_CONFIG_PATH'><filename>PKG_CONFIG_PATH</filename></ulink> - The path to the target pkg-config files | 
 | 180 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CONFIG_SITE'><filename>CONFIG_SITE</filename></ulink> - A GNU autoconf site file preconfigured for the target | 
 | 181 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'><filename>CC</filename></ulink> - The minimal command and arguments to run the C compiler | 
 | 182 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CXX'><filename>CXX</filename></ulink> - The minimal command and arguments to run the C++ compiler | 
 | 183 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CPP'><filename>CPP</filename></ulink> - The minimal command and arguments to run the C preprocessor | 
 | 184 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-AS'><filename>AS</filename></ulink> - The minimal command and arguments to run the assembler | 
 | 185 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'><filename>LD</filename></ulink> - The minimal command and arguments to run the linker | 
 | 186 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-GDB'><filename>GDB</filename></ulink> - The minimal command and arguments to run the GNU Debugger | 
 | 187 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-STRIP'><filename>STRIP</filename></ulink> - The minimal command and arguments to run 'strip', which strips symbols | 
 | 188 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-RANLIB'><filename>RANLIB</filename></ulink> - The minimal command and arguments to run 'ranlib' | 
 | 189 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-OBJCOPY'><filename>OBJCOPY</filename></ulink> - The minimal command and arguments to run 'objcopy' | 
 | 190 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-OBJDUMP'><filename>OBJDUMP</filename></ulink> - The minimal command and arguments to run 'objdump' | 
 | 191 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-AR'><filename>AR</filename></ulink> - The minimal command and arguments to run 'ar' | 
 | 192 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-NM'><filename>NM</filename></ulink> - The minimal command and arguments to run 'nm' | 
 | 193 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-TARGET_PREFIX'><filename>TARGET_PREFIX</filename></ulink> - The toolchain binary prefix for the target tools | 
 | 194 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CROSS_COMPILE'><filename>CROSS_COMPILE</filename></ulink> - The toolchain binary prefix for the target tools | 
 | 195 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CONFIGURE_FLAGS'><filename>CONFIGURE_FLAGS</filename></ulink> - The minimal arguments for GNU configure | 
 | 196 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CFLAGS'><filename>CFLAGS</filename></ulink> - Suggested C flags | 
 | 197 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CXXFLAGS'><filename>CXXFLAGS</filename></ulink> - Suggested C++ flags | 
 | 198 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-LDFLAGS'><filename>LDFLAGS</filename></ulink> - Suggested linker flags when you use CC to link | 
 | 199 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CPPFLAGS'><filename>CPPFLAGS</filename></ulink> - Suggested preprocessor flags | 
 | 200 |         </literallayout> | 
 | 201 |     </para> | 
 | 202 | </section> | 
 | 203 |  | 
 | 204 | <section id='autotools-based-projects'> | 
 | 205 |     <title>Autotools-Based Projects</title> | 
 | 206 |  | 
 | 207 |     <para> | 
 | 208 |         Once you have a suitable cross-toolchain installed, it is very easy to | 
 | 209 |         develop a project outside of the OpenEmbedded build system. | 
 | 210 |         This section presents a simple "Helloworld" example that shows how | 
 | 211 |         to set up, compile, and run the project. | 
 | 212 |     </para> | 
 | 213 |  | 
 | 214 |     <section id='creating-and-running-a-project-based-on-gnu-autotools'> | 
 | 215 |         <title>Creating and Running a Project Based on GNU Autotools</title> | 
 | 216 |  | 
 | 217 |         <para> | 
 | 218 |             Follow these steps to create a simple Autotools-based project: | 
 | 219 |             <orderedlist> | 
 | 220 |                 <listitem><para><emphasis>Create your directory:</emphasis> | 
 | 221 |                     Create a clean directory for your project and then make | 
 | 222 |                     that directory your working location: | 
 | 223 |                     <literallayout class='monospaced'> | 
 | 224 |      $ mkdir $HOME/helloworld | 
 | 225 |      $ cd $HOME/helloworld | 
 | 226 |                     </literallayout></para></listitem> | 
 | 227 |                 <listitem><para><emphasis>Populate the directory:</emphasis> | 
 | 228 |                     Create <filename>hello.c</filename>, <filename>Makefile.am</filename>, | 
 | 229 |                     and <filename>configure.in</filename> files as follows: | 
 | 230 |                     <itemizedlist> | 
 | 231 |                         <listitem><para>For <filename>hello.c</filename>, include | 
 | 232 |                             these lines: | 
 | 233 |                             <literallayout class='monospaced'> | 
 | 234 |      #include <stdio.h> | 
 | 235 |  | 
 | 236 |      main() | 
 | 237 |         { | 
 | 238 |            printf("Hello World!\n"); | 
 | 239 |         } | 
 | 240 |                             </literallayout></para></listitem> | 
 | 241 |                         <listitem><para>For <filename>Makefile.am</filename>, | 
 | 242 |                             include these lines: | 
 | 243 |                             <literallayout class='monospaced'> | 
 | 244 |      bin_PROGRAMS = hello | 
 | 245 |      hello_SOURCES = hello.c | 
 | 246 |                             </literallayout></para></listitem> | 
 | 247 |                         <listitem><para>For <filename>configure.in</filename>, | 
 | 248 |                             include these lines: | 
 | 249 |                             <literallayout class='monospaced'> | 
 | 250 |      AC_INIT(hello.c) | 
 | 251 |      AM_INIT_AUTOMAKE(hello,0.1) | 
 | 252 |      AC_PROG_CC | 
 | 253 |      AC_PROG_INSTALL | 
 | 254 |      AC_OUTPUT(Makefile) | 
 | 255 |                             </literallayout></para></listitem> | 
 | 256 |                     </itemizedlist></para></listitem> | 
 | 257 |                 <listitem><para><emphasis>Source the cross-toolchain | 
 | 258 |                     environment setup file:</emphasis> | 
 | 259 |                     Installation of the cross-toolchain creates a cross-toolchain | 
 | 260 |                     environment setup script in the directory that the SDK | 
 | 261 |                     was installed. | 
 | 262 |                     Before you can use the tools to develop your project, you must | 
 | 263 |                     source this setup script. | 
 | 264 |                     The script begins with the string "environment-setup" and contains | 
 | 265 |                     the machine architecture, which is followed by the string | 
 | 266 |                     "poky-linux". | 
 | 267 |                     Here is an example that sources a script from the | 
 | 268 |                     default SDK installation directory that uses the | 
 | 269 |                     32-bit Intel x86 Architecture and the | 
 | 270 |                     &DISTRO_NAME; Yocto Project release: | 
 | 271 |                     <literallayout class='monospaced'> | 
 | 272 |      $ source /opt/poky/&DISTRO;/environment-setup-i586-poky-linux | 
 | 273 |                     </literallayout></para></listitem> | 
 | 274 |                 <listitem><para><emphasis>Generate the local aclocal.m4 | 
 | 275 |                     files and create the configure script:</emphasis> | 
 | 276 |                     The following GNU Autotools generate the local | 
 | 277 |                     <filename>aclocal.m4</filename> files and create the | 
 | 278 |                     configure script: | 
 | 279 |                     <literallayout class='monospaced'> | 
 | 280 |      $ aclocal | 
 | 281 |      $ autoconf | 
 | 282 |                     </literallayout></para></listitem> | 
 | 283 |                 <listitem><para><emphasis>Generate files needed by GNU | 
 | 284 |                     coding standards:</emphasis> | 
 | 285 |                     GNU coding standards require certain files in order for the | 
 | 286 |                     project to be compliant. | 
 | 287 |                     This command creates those files: | 
 | 288 |                     <literallayout class='monospaced'> | 
 | 289 |      $ touch NEWS README AUTHORS ChangeLog | 
 | 290 |                     </literallayout></para></listitem> | 
 | 291 |                 <listitem><para><emphasis>Generate the configure | 
 | 292 |                     file:</emphasis> | 
 | 293 |                     This command generates the <filename>configure</filename>: | 
 | 294 |                     <literallayout class='monospaced'> | 
 | 295 |      $ automake -a | 
 | 296 |                     </literallayout></para></listitem> | 
 | 297 |                 <listitem><para><emphasis>Cross-compile the project:</emphasis> | 
 | 298 |                     This command compiles the project using the cross-compiler. | 
 | 299 |                     The | 
 | 300 |                     <ulink url='&YOCTO_DOCS_REF_URL;#var-CONFIGURE_FLAGS'><filename>CONFIGURE_FLAGS</filename></ulink> | 
 | 301 |                     environment variable provides the minimal arguments for | 
 | 302 |                     GNU configure: | 
 | 303 |                     <literallayout class='monospaced'> | 
 | 304 |      $ ./configure ${CONFIGURE_FLAGS} | 
 | 305 |                     </literallayout></para></listitem> | 
 | 306 |                 <listitem><para><emphasis>Make and install the project:</emphasis> | 
 | 307 |                     These two commands generate and install the project into the | 
 | 308 |                     destination directory: | 
 | 309 |                     <literallayout class='monospaced'> | 
 | 310 |      $ make | 
 | 311 |      $ make install DESTDIR=./tmp | 
 | 312 |                     </literallayout></para></listitem> | 
 | 313 |                 <listitem><para><emphasis>Verify the installation:</emphasis> | 
 | 314 |                     This command is a simple way to verify the installation | 
 | 315 |                     of your project. | 
 | 316 |                     Running the command prints the architecture on which | 
 | 317 |                     the binary file can run. | 
 | 318 |                     This architecture should be the same architecture that | 
 | 319 |                     the installed cross-toolchain supports. | 
 | 320 |                     <literallayout class='monospaced'> | 
 | 321 |      $ file ./tmp/usr/local/bin/hello | 
 | 322 |                     </literallayout></para></listitem> | 
 | 323 |                 <listitem><para><emphasis>Execute your project:</emphasis> | 
 | 324 |                     To execute the project in the shell, simply enter the name. | 
 | 325 |                     You could also copy the binary to the actual target hardware | 
 | 326 |                     and run the project there as well: | 
 | 327 |                     <literallayout class='monospaced'> | 
 | 328 |      $ ./hello | 
 | 329 |                     </literallayout> | 
 | 330 |                     As expected, the project displays the "Hello World!" message. | 
 | 331 |                     </para></listitem> | 
 | 332 |             </orderedlist> | 
 | 333 |         </para> | 
 | 334 |     </section> | 
 | 335 |  | 
 | 336 |     <section id='passing-host-options'> | 
 | 337 |         <title>Passing Host Options</title> | 
 | 338 |  | 
 | 339 |         <para> | 
 | 340 |             For an Autotools-based project, you can use the cross-toolchain by just | 
 | 341 |             passing the appropriate host option to <filename>configure.sh</filename>. | 
 | 342 |             The host option you use is derived from the name of the environment setup | 
 | 343 |             script found in the directory in which you installed the cross-toolchain. | 
 | 344 |             For example, the host option for an ARM-based target that uses the GNU EABI | 
 | 345 |             is <filename>armv5te-poky-linux-gnueabi</filename>. | 
 | 346 |             You will notice that the name of the script is | 
 | 347 |             <filename>environment-setup-armv5te-poky-linux-gnueabi</filename>. | 
 | 348 |             Thus, the following command works to update your project and | 
 | 349 |             rebuild it using the appropriate cross-toolchain tools: | 
 | 350 |             <literallayout class='monospaced'> | 
 | 351 |      $ ./configure --host=armv5te-poky-linux-gnueabi \ | 
 | 352 |         --with-libtool-sysroot=<replaceable>sysroot_dir</replaceable> | 
 | 353 |             </literallayout> | 
 | 354 |             <note> | 
 | 355 |                 If the <filename>configure</filename> script results in problems recognizing the | 
 | 356 |                 <filename>--with-libtool-sysroot=</filename><replaceable>sysroot-dir</replaceable> option, | 
 | 357 |                 regenerate the script to enable the support by doing the following and then | 
 | 358 |                 run the script again: | 
 | 359 |                 <literallayout class='monospaced'> | 
 | 360 |      $ libtoolize --automake | 
 | 361 |      $ aclocal -I ${OECORE_NATIVE_SYSROOT}/usr/share/aclocal \ | 
 | 362 |         [-I <replaceable>dir_containing_your_project-specific_m4_macros</replaceable>] | 
 | 363 |      $ autoconf | 
 | 364 |      $ autoheader | 
 | 365 |      $ automake -a | 
 | 366 |                 </literallayout> | 
 | 367 |             </note> | 
 | 368 |         </para> | 
 | 369 |     </section> | 
 | 370 | </section> | 
 | 371 |  | 
 | 372 | <section id='makefile-based-projects'> | 
 | 373 |     <title>Makefile-Based Projects</title> | 
 | 374 |  | 
 | 375 |     <para> | 
 | 376 |         For Makefile-based projects, the cross-toolchain environment variables | 
 | 377 |         established by running the cross-toolchain environment setup script | 
 | 378 |         are subject to general <filename>make</filename> rules. | 
 | 379 |     </para> | 
 | 380 |  | 
 | 381 |     <para> | 
 | 382 |         To illustrate this, consider the following four cross-toolchain | 
 | 383 |         environment variables: | 
 | 384 |         <literallayout class='monospaced'> | 
 | 385 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'>CC</ulink>=i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/1.8/sysroots/i586-poky-linux | 
 | 386 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-LD'>LD</ulink>=i586-poky-linux-ld --sysroot=/opt/poky/1.8/sysroots/i586-poky-linux | 
 | 387 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CFLAGS'>CFLAGS</ulink>=-O2 -pipe -g -feliminate-unused-debug-types | 
 | 388 |      <ulink url='&YOCTO_DOCS_REF_URL;#var-CXXFLAGS'>CXXFLAGS</ulink>=-O2 -pipe -g -feliminate-unused-debug-types | 
 | 389 |         </literallayout> | 
 | 390 |         Now, consider the following three cases: | 
 | 391 |         <itemizedlist> | 
 | 392 |             <listitem><para><emphasis>Case 1 - No Variables Set in the <filename>Makefile</filename>:</emphasis> | 
 | 393 |                 Because these variables are not specifically set in the | 
 | 394 |                 <filename>Makefile</filename>, the variables retain their | 
 | 395 |                 values based on the environment. | 
 | 396 |                 </para></listitem> | 
 | 397 |             <listitem><para><emphasis>Case 2 - Variables Set in the <filename>Makefile</filename>:</emphasis> | 
 | 398 |                 Specifically setting variables in the | 
 | 399 |                 <filename>Makefile</filename> during the build results in the | 
 | 400 |                 environment settings of the variables being overwritten. | 
 | 401 |                 </para></listitem> | 
 | 402 |             <listitem><para><emphasis>Case 3 - Variables Set when the <filename>Makefile</filename> is Executed from the Command Line:</emphasis> | 
 | 403 |                 Executing the <filename>Makefile</filename> from the command | 
 | 404 |                 line results in the variables being overwritten with | 
 | 405 |                 command-line content regardless of what is being set in the | 
 | 406 |                 <filename>Makefile</filename>. | 
 | 407 |                 In this case, environment variables are not considered unless | 
 | 408 |                 you use the "-e" flag during the build: | 
 | 409 |                 <literallayout class='monospaced'> | 
 | 410 |      $ make -e <replaceable>file</replaceable> | 
 | 411 |                 </literallayout> | 
 | 412 |                 If you use this flag, then the environment values of the | 
 | 413 |                 variables override any variables specifically set in the | 
 | 414 |                 <filename>Makefile</filename>. | 
 | 415 |                 </para></listitem> | 
 | 416 |         </itemizedlist> | 
 | 417 |         <note> | 
 | 418 |             For the list of variables set up by the cross-toolchain environment | 
 | 419 |             setup script, see the | 
 | 420 |             "<link linkend='sdk-running-the-sdk-environment-setup-script'>Running the SDK Environment Setup Script</link>" | 
 | 421 |             section. | 
 | 422 |         </note> | 
 | 423 |     </para> | 
 | 424 | </section> | 
 | 425 |  | 
 | 426 | <section id='sdk-developing-applications-using-eclipse'> | 
 | 427 |     <title>Developing Applications Using <trademark class='trade'>Eclipse</trademark></title> | 
 | 428 |  | 
 | 429 |     <para> | 
 | 430 |         If you are familiar with the popular Eclipse IDE, you can use an | 
 | 431 |         Eclipse Yocto Plug-in to allow you to develop, deploy, and test your | 
 | 432 |         application all from within Eclipse. | 
 | 433 |         This section describes general workflow using the SDK and Eclipse | 
 | 434 |         and how to configure and set up Eclipse. | 
 | 435 |     </para> | 
 | 436 |  | 
 | 437 |     <section id='workflow-using-eclipse'> | 
 | 438 |  | 
 | 439 |         <title>Workflow Using <trademark class='trade'>Eclipse</trademark></title> | 
 | 440 |  | 
 | 441 |         <para> | 
 | 442 |             The following figure and supporting list summarize the application | 
 | 443 |             development general workflow that employs both the SDK Eclipse. | 
 | 444 |         </para> | 
 | 445 |  | 
 | 446 |         <para> | 
 | 447 |             <imagedata fileref="figures/sdk-eclipse-dev-flow.png" | 
 | 448 |                 width="7in" depth="7in" align="center" scale="100" /> | 
 | 449 |         </para> | 
 | 450 |  | 
 | 451 |         <para> | 
 | 452 |             <orderedlist> | 
 | 453 |                 <listitem><para><emphasis>Prepare the host system for the Yocto Project</emphasis>: | 
 | 454 |                     See | 
 | 455 |                     "<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>" | 
 | 456 |                     and | 
 | 457 |                     "<ulink url='&YOCTO_DOCS_REF_URL;#required-packages-for-the-host-development-system'>Required Packages for the Host Development System</ulink>" sections both | 
 | 458 |                     in the Yocto Project Reference Manual for requirements. | 
 | 459 |                     In particular, be sure your host system has the | 
 | 460 |                     <filename>xterm</filename> package installed. | 
 | 461 |                     </para></listitem> | 
 | 462 |                 <listitem><para><emphasis>Secure the Yocto Project kernel target image</emphasis>: | 
 | 463 |                     You must have a target kernel image that has been built using the OpenEmbedded | 
 | 464 |                     build system.</para> | 
 | 465 |                     <para>Depending on whether the Yocto Project has a pre-built image that matches your target | 
 | 466 |                     architecture and where you are going to run the image while you develop your application | 
 | 467 |                     (QEMU or real hardware), the area from which you get the image differs. | 
 | 468 |                         <itemizedlist> | 
 | 469 |                             <listitem><para>Download the image from | 
 | 470 |                                 <ulink url='&YOCTO_MACHINES_DL_URL;'><filename>machines</filename></ulink> | 
 | 471 |                                 if your target architecture is supported and you are going to develop | 
 | 472 |                                 and test your application on actual hardware.</para></listitem> | 
 | 473 |                             <listitem><para>Download the image from | 
 | 474 |                                 <ulink url='&YOCTO_QEMU_DL_URL;'> | 
 | 475 |                                 <filename>machines/qemu</filename></ulink> if your target architecture is supported | 
 | 476 |                                 and you are going to develop and test your application using the QEMU | 
 | 477 |                                 emulator.</para></listitem> | 
 | 478 |                             <listitem><para>Build your image if you cannot find a pre-built image that matches | 
 | 479 |                                 your target architecture. | 
 | 480 |                                 If your target architecture is similar to a supported architecture, you can | 
 | 481 |                                 modify the kernel image before you build it. | 
 | 482 |                                 See the | 
 | 483 |                                 "<ulink url='&YOCTO_DOCS_DEV_URL;#patching-the-kernel'>Patching the Kernel</ulink>" | 
 | 484 |                                 section in the Yocto Project Development | 
 | 485 |                                 manual for an example.</para></listitem> | 
 | 486 |                         </itemizedlist></para> | 
 | 487 |                     <para>For information on pre-built kernel image naming schemes for images | 
 | 488 |                     that can run on the QEMU emulator, see the | 
 | 489 |                     <ulink url='&YOCTO_DOCS_SDK_URL;#sdk-manual'>Yocto Project Software Development Kit (SDK) Developer's Guide</ulink>. | 
 | 490 |                     </para></listitem> | 
 | 491 |                 <listitem><para><emphasis>Install the SDK</emphasis>: | 
 | 492 |                     The SDK provides a target-specific cross-development toolchain, the root filesystem, | 
 | 493 |                     the QEMU emulator, and other tools that can help you develop your application. | 
 | 494 |                     For information on how to install the SDK, see the | 
 | 495 |                     "<link linkend='sdk-installing-the-sdk'>Installing the SDK</link>" | 
 | 496 |                     section. | 
 | 497 |                     </para></listitem> | 
 | 498 |                 <listitem><para><emphasis>Secure the target root filesystem | 
 | 499 |                     and the Cross-development toolchain</emphasis>: | 
 | 500 |                     You need to find and download the appropriate root filesystem and | 
 | 501 |                     the cross-development toolchain.</para> | 
 | 502 |                     <para>You can find the tarballs for the root filesystem in the same area used | 
 | 503 |                     for the kernel image. | 
 | 504 |                     Depending on the type of image you are running, the root filesystem you need differs. | 
 | 505 |                     For example, if you are developing an application that runs on an image that | 
 | 506 |                     supports Sato, you need to get a root filesystem that supports Sato.</para> | 
 | 507 |                     <para>You can find the cross-development toolchains at | 
 | 508 |                     <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'><filename>toolchains</filename></ulink>. | 
 | 509 |                     Be sure to get the correct toolchain for your development host and your | 
 | 510 |                     target architecture. | 
 | 511 |                     See the "<link linkend='sdk-locating-pre-built-sdk-installers'>Locating Pre-Built SDK Installers</link>" | 
 | 512 |                     section for information and the | 
 | 513 |                     "<link linkend='sdk-installing-the-sdk'>Installing the SDK</link>" | 
 | 514 |                     section for installation information. | 
 | 515 |                     </para></listitem> | 
 | 516 |                 <listitem><para><emphasis>Create and build your application</emphasis>: | 
 | 517 |                     At this point, you need to have source files for your application. | 
 | 518 |                     Once you have the files, you can use the Eclipse IDE to import them and build the | 
 | 519 |                     project. | 
 | 520 |                     If you are not using Eclipse, you need to use the cross-development tools you have | 
 | 521 |                     installed to create the image.</para></listitem> | 
 | 522 |                 <listitem><para><emphasis>Deploy the image with the application</emphasis>: | 
 | 523 |                     If you are using the Eclipse IDE, you can deploy your image to the hardware or to | 
 | 524 |                     QEMU through the project's preferences. | 
 | 525 |                     If you are not using the Eclipse IDE, then you need to deploy the application | 
 | 526 |                     to the hardware using other methods. | 
 | 527 |                     Or, if you are using QEMU, you need to use that tool and | 
 | 528 |                     load your image in for testing. | 
 | 529 |                     See the | 
 | 530 |                     "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-qemu'>Using the Quick EMUlator (QEMU)</ulink>" | 
 | 531 |                     chapter in the Yocto Project Development Manual | 
 | 532 |                     for information on using QEMU. | 
 | 533 |                     </para></listitem> | 
 | 534 |                 <listitem><para><emphasis>Test and debug the application</emphasis>: | 
 | 535 |                     Once your application is deployed, you need to test it. | 
 | 536 |                     Within the Eclipse IDE, you can use the debugging environment along with the | 
 | 537 |                     set of installed user-space tools to debug your application. | 
 | 538 |                     Of course, the same user-space tools are available separately if you choose | 
 | 539 |                     not to use the Eclipse IDE.</para></listitem> | 
 | 540 |            </orderedlist> | 
 | 541 |         </para> | 
 | 542 |     </section> | 
 | 543 |  | 
 | 544 |     <section id='adt-eclipse'> | 
 | 545 |         <title>Working Within Eclipse</title> | 
 | 546 |  | 
 | 547 |         <para> | 
 | 548 |             The Eclipse IDE is a popular development environment and it fully | 
 | 549 |             supports development using the Yocto Project. | 
 | 550 |             <note> | 
 | 551 |                 This release of the Yocto Project supports both the Luna | 
 | 552 |                 and Kepler versions of the Eclipse IDE. | 
 | 553 |                 Thus, the following information provides setup information for | 
 | 554 |                 both versions. | 
 | 555 |             </note> | 
 | 556 |         </para> | 
 | 557 |  | 
 | 558 |         <para> | 
 | 559 |             When you install and configure the Eclipse Yocto Project Plug-in | 
 | 560 |             into the Eclipse IDE, you maximize your Yocto Project experience. | 
 | 561 |             Installing and configuring the Plug-in results in an environment | 
 | 562 |             that has extensions specifically designed to let you more easily | 
 | 563 |             develop software. | 
 | 564 |             These extensions allow for cross-compilation, deployment, and | 
 | 565 |             execution of your output into a QEMU emulation session as well as | 
 | 566 |             actual target hardware. | 
 | 567 |             You can also perform cross-debugging and profiling. | 
 | 568 |             The environment also supports a suite of tools that allows you | 
 | 569 |             to perform remote profiling, tracing, collection of power data, | 
 | 570 |             collection of latency data, and collection of performance data. | 
 | 571 |         </para> | 
 | 572 |  | 
 | 573 |         <para> | 
 | 574 |             This section describes how to install and configure the Eclipse IDE | 
 | 575 |             Yocto Plug-in and how to use it to develop your application. | 
 | 576 |         </para> | 
 | 577 |  | 
 | 578 |         <section id='setting-up-the-eclipse-ide'> | 
 | 579 |             <title>Setting Up the Eclipse IDE</title> | 
 | 580 |  | 
 | 581 |             <para> | 
 | 582 |                 To develop within the Eclipse IDE, you need to do the following: | 
 | 583 |                 <orderedlist> | 
 | 584 |                     <listitem><para>Install the optimal version of the Eclipse | 
 | 585 |                        IDE.</para></listitem> | 
 | 586 |                     <listitem><para>Configure the Eclipse IDE. | 
 | 587 |                        </para></listitem> | 
 | 588 |                     <listitem><para>Install the Eclipse Yocto Plug-in. | 
 | 589 |                        </para></listitem> | 
 | 590 |                     <listitem><para>Configure the Eclipse Yocto Plug-in. | 
 | 591 |                        </para></listitem> | 
 | 592 |                 </orderedlist> | 
 | 593 |                 <note> | 
 | 594 |                     Do not install Eclipse from your distribution's package | 
 | 595 |                     repository. | 
 | 596 |                     Be sure to install Eclipse from the official Eclipse | 
 | 597 |                     download site as directed in the next section. | 
 | 598 |                 </note> | 
 | 599 |             </para> | 
 | 600 |  | 
 | 601 |             <section id='installing-eclipse-ide'> | 
 | 602 |                 <title>Installing the Eclipse IDE</title> | 
 | 603 |  | 
 | 604 |                 <para> | 
 | 605 |                     It is recommended that you have the Luna SR2 (4.4.2) | 
 | 606 |                     version of the Eclipse IDE installed on your development | 
 | 607 |                     system. | 
 | 608 |                     However, if you currently have the Kepler 4.3.2 version | 
 | 609 |                     installed and you do not want to upgrade the IDE, you can | 
 | 610 |                     configure Kepler to work with the Yocto Project. | 
 | 611 |                 </para> | 
 | 612 |  | 
 | 613 |                 <para> | 
 | 614 |                     If you do not have the Luna SR2 (4.4.2) Eclipse IDE | 
 | 615 |                     installed, you can find the tarball at | 
 | 616 |                     <ulink url='&ECLIPSE_MAIN_URL;'></ulink>. | 
 | 617 |                     From that site, choose the appropriate download from the | 
 | 618 |                     "Eclipse IDE for C/C++ Developers". | 
 | 619 |                     This version contains the Eclipse Platform, the Java | 
 | 620 |                     Development Tools (JDT), and the Plug-in Development | 
 | 621 |                     Environment. | 
 | 622 |                 </para> | 
 | 623 |  | 
 | 624 |                 <para> | 
 | 625 |                     Once you have downloaded the tarball, extract it into a | 
 | 626 |                     clean directory. | 
 | 627 |                     For example, the following commands unpack and install the | 
 | 628 |                     downloaded Eclipse IDE tarball into a clean directory | 
 | 629 |                     using the default name <filename>eclipse</filename>: | 
 | 630 |                     <literallayout class='monospaced'> | 
 | 631 |      $ cd ~ | 
 | 632 |      $ tar -xzvf ~/Downloads/eclipse-cpp-luna-SR2-linux-gtk-x86_64.tar.gz | 
 | 633 |                     </literallayout> | 
 | 634 |                 </para> | 
 | 635 |             </section> | 
 | 636 |  | 
 | 637 |             <section id='configuring-the-eclipse-ide'> | 
 | 638 |                 <title>Configuring the Eclipse IDE</title> | 
 | 639 |  | 
 | 640 |                 <para> | 
 | 641 |                     This section presents the steps needed to configure the | 
 | 642 |                     Eclipse IDE. | 
 | 643 |                 </para> | 
 | 644 |  | 
 | 645 |                 <para> | 
 | 646 |                     Before installing and configuring the Eclipse Yocto Plug-in, | 
 | 647 |                     you need to configure the Eclipse IDE. | 
 | 648 |                     Follow these general steps: | 
 | 649 |                     <orderedlist> | 
 | 650 |                         <listitem><para>Start the Eclipse IDE.</para></listitem> | 
 | 651 |                         <listitem><para>Make sure you are in your Workbench and | 
 | 652 |                             select "Install New Software" from the "Help" | 
 | 653 |                             pull-down menu.</para></listitem> | 
 | 654 |                         <listitem><para>Select | 
 | 655 |                             <filename>Luna - &ECLIPSE_LUNA_URL;</filename> | 
 | 656 |                             from the "Work with:" pull-down menu. | 
 | 657 |                             <note> | 
 | 658 |                                 For Kepler, select | 
 | 659 |                                 <filename>Kepler - &ECLIPSE_KEPLER_URL;</filename> | 
 | 660 |                             </note> | 
 | 661 |                             </para></listitem> | 
 | 662 |                         <listitem><para>Expand the box next to "Linux Tools" | 
 | 663 |                             and select the | 
 | 664 |                             <filename>Linux Tools LTTng Tracer Control</filename>, | 
 | 665 |                             <filename>Linux Tools LTTng Userspace Analysis</filename>, | 
 | 666 |                             and | 
 | 667 |                             <filename>LTTng Kernel Analysis</filename> boxes. | 
 | 668 |                             If these selections do not appear in the list, | 
 | 669 |                             that means the items are already installed. | 
 | 670 |                             <note> | 
 | 671 |                                 For Kepler, select | 
 | 672 |                                 <filename>LTTng - Linux Tracing Toolkit</filename> | 
 | 673 |                                 box. | 
 | 674 |                             </note> | 
 | 675 |                             </para></listitem> | 
 | 676 |                         <listitem><para>Expand the box next to "Mobile and | 
 | 677 |                             Device Development" and select the following boxes. | 
 | 678 |                             Again, if any of the following items are not | 
 | 679 |                             available for selection, that means the items are | 
 | 680 |                             already installed: | 
 | 681 |                             <itemizedlist> | 
 | 682 |                                 <listitem><para><filename>C/C++ Remote Launch (Requires RSE Remote System Explorer)</filename></para></listitem> | 
 | 683 |                                 <listitem><para><filename>Remote System Explorer End-user Runtime</filename></para></listitem> | 
 | 684 |                                 <listitem><para><filename>Remote System Explorer User Actions</filename></para></listitem> | 
 | 685 |                                 <listitem><para><filename>Target Management Terminal (Core SDK)</filename></para></listitem> | 
 | 686 |                                 <listitem><para><filename>TCF Remote System Explorer add-in</filename></para></listitem> | 
 | 687 |                                 <listitem><para><filename>TCF Target Explorer</filename></para></listitem> | 
 | 688 |                             </itemizedlist></para></listitem> | 
 | 689 |                         <listitem><para>Expand the box next to "Programming | 
 | 690 |                             Languages" and select the | 
 | 691 |                             <filename>C/C++ Autotools Support</filename> | 
 | 692 |                             and <filename>C/C++ Development Tools</filename> | 
 | 693 |                             boxes. | 
 | 694 |                             For Luna, these items do not appear on the list | 
 | 695 |                             as they are already installed. | 
 | 696 |                             </para></listitem> | 
 | 697 |                         <listitem><para>Complete the installation and restart | 
 | 698 |                             the Eclipse IDE.</para></listitem> | 
 | 699 |                     </orderedlist> | 
 | 700 |                 </para> | 
 | 701 |             </section> | 
 | 702 |  | 
 | 703 |             <section id='installing-the-eclipse-yocto-plug-in'> | 
 | 704 |                 <title>Installing or Accessing the Eclipse Yocto Plug-in</title> | 
 | 705 |  | 
 | 706 |                 <para> | 
 | 707 |                     You can install the Eclipse Yocto Plug-in into the Eclipse | 
 | 708 |                     IDE one of two ways:  use the Yocto Project's Eclipse | 
 | 709 |                     Update site to install the pre-built plug-in or build and | 
 | 710 |                     install the plug-in from the latest source code. | 
 | 711 |                 </para> | 
 | 712 |  | 
 | 713 |                 <section id='new-software'> | 
 | 714 |                     <title>Installing the Pre-built Plug-in from the Yocto Project Eclipse Update Site</title> | 
 | 715 |  | 
 | 716 |                     <para> | 
 | 717 |                         To install the Eclipse Yocto Plug-in from the update | 
 | 718 |                         site, follow these steps: | 
 | 719 |                         <orderedlist> | 
 | 720 |                             <listitem><para>Start up the Eclipse IDE. | 
 | 721 |                                 </para></listitem> | 
 | 722 |                             <listitem><para>In Eclipse, select "Install New | 
 | 723 |                                 Software" from the "Help" menu. | 
 | 724 |                                 </para></listitem> | 
 | 725 |                             <listitem><para>Click "Add..." in the "Work with:" | 
 | 726 |                                 area.</para></listitem> | 
 | 727 |                            <listitem><para>Enter | 
 | 728 |                                 <filename>&ECLIPSE_DL_PLUGIN_URL;/luna</filename> | 
 | 729 |                                 in the URL field and provide a meaningful name | 
 | 730 |                                 in the "Name" field. | 
 | 731 |                                 <note> | 
 | 732 |                                     If you are using Kepler, use | 
 | 733 |                                     <filename>&ECLIPSE_DL_PLUGIN_URL;/kepler</filename> | 
 | 734 |                                     in the URL field. | 
 | 735 |                                 </note></para></listitem> | 
 | 736 |                             <listitem><para>Click "OK" to have the entry added | 
 | 737 |                                 to the "Work with:" drop-down list. | 
 | 738 |                                 </para></listitem> | 
 | 739 |                             <listitem><para>Select the entry for the plug-in | 
 | 740 |                                 from the "Work with:" drop-down list. | 
 | 741 |                                 </para></listitem> | 
 | 742 |                             <listitem><para>Check the boxes next to | 
 | 743 |                                 <filename>Yocto Project ADT Plug-in</filename>, | 
 | 744 |                                 <filename>Yocto Project Bitbake Commander Plug-in</filename>, | 
 | 745 |                                 and | 
 | 746 |                                 <filename>Yocto Project Documentation plug-in</filename>. | 
 | 747 |                                 </para></listitem> | 
 | 748 |                             <listitem><para>Complete the remaining software | 
 | 749 |                                 installation steps and then restart the Eclipse | 
 | 750 |                                 IDE to finish the installation of the plug-in. | 
 | 751 |                                 <note> | 
 | 752 |                                     You can click "OK" when prompted about | 
 | 753 |                                     installing software that contains unsigned | 
 | 754 |                                     content. | 
 | 755 |                                 </note> | 
 | 756 |                                 </para></listitem> | 
 | 757 |                         </orderedlist> | 
 | 758 |                     </para> | 
 | 759 |                 </section> | 
 | 760 |  | 
 | 761 |                <section id='zip-file-method'> | 
 | 762 |                    <title>Installing the Plug-in Using the Latest Source Code</title> | 
 | 763 |  | 
 | 764 |                    <para> | 
 | 765 |                         To install the Eclipse Yocto Plug-in from the latest | 
 | 766 |                         source code, follow these steps: | 
 | 767 |                         <orderedlist> | 
 | 768 |                             <listitem><para>Be sure your development system | 
 | 769 |                                 is not using OpenJDK to build the plug-in | 
 | 770 |                                 by doing the following: | 
 | 771 |                                 <orderedlist> | 
 | 772 |                                     <listitem><para>Use the Oracle JDK. | 
 | 773 |                                         If you don't have that, go to | 
 | 774 |                                         <ulink url='http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html'></ulink> | 
 | 775 |                                         and download the latest appropriate | 
 | 776 |                                         Java SE Development Kit tarball for | 
 | 777 |                                         your development system and | 
 | 778 |                                         extract it into your home directory. | 
 | 779 |                                         </para></listitem> | 
 | 780 |                                     <listitem><para>In the shell you are going | 
 | 781 |                                         to do your work, export the location of | 
 | 782 |                                         the Oracle Java. | 
 | 783 |                                         The previous step creates a new folder | 
 | 784 |                                         for the extracted software. | 
 | 785 |                                         You need to use the following | 
 | 786 |                                         <filename>export</filename> command | 
 | 787 |                                         and provide the specific location: | 
 | 788 |                                         <literallayout class='monospaced'> | 
 | 789 |      export PATH=~/<replaceable>extracted_jdk_location</replaceable>/bin:$PATH | 
 | 790 |                                         </literallayout> | 
 | 791 |                                         </para></listitem> | 
 | 792 |                                 </orderedlist> | 
 | 793 |                                 </para></listitem> | 
 | 794 |                             <listitem><para>In the same shell, create a Git | 
 | 795 |                                 repository with: | 
 | 796 |                                 <literallayout class='monospaced'> | 
 | 797 |      $ cd ~ | 
 | 798 |      $ git clone git://git.yoctoproject.org/eclipse-poky | 
 | 799 |                                 </literallayout> | 
 | 800 |                                 </para></listitem> | 
 | 801 |                             <listitem><para>Be sure to checkout the correct | 
 | 802 |                                 tag. | 
 | 803 |                                 For example, if you are using Luna, do the | 
 | 804 |                                 following: | 
 | 805 |                                 <literallayout class='monospaced'> | 
 | 806 |      $ git checkout luna/yocto-&DISTRO; | 
 | 807 |                                 </literallayout> | 
 | 808 |                                 This puts you in a detached HEAD state, which | 
 | 809 |                                 is fine since you are only going to be building | 
 | 810 |                                 and not developing. | 
 | 811 |                                 <note> | 
 | 812 |                                     If you are building kepler, checkout the | 
 | 813 |                                     <filename>kepler/yocto-&DISTRO;</filename> | 
 | 814 |                                     branch. | 
 | 815 |                                 </note> | 
 | 816 |                                 </para></listitem> | 
 | 817 |                             <listitem><para>Change to the | 
 | 818 |                                 <filename>scripts</filename> | 
 | 819 |                                 directory within the Git repository: | 
 | 820 |                                 <literallayout class='monospaced'> | 
 | 821 |      $ cd scripts | 
 | 822 |                                 </literallayout> | 
 | 823 |                                 </para></listitem> | 
 | 824 |                             <listitem><para>Set up the local build environment | 
 | 825 |                                 by running the setup script: | 
 | 826 |                                 <literallayout class='monospaced'> | 
 | 827 |      $ ./setup.sh | 
 | 828 |                                 </literallayout> | 
 | 829 |                                 </para></listitem> | 
 | 830 |                             <listitem><para>When the script finishes execution, | 
 | 831 |                                 it prompts you with instructions on how to run | 
 | 832 |                                 the <filename>build.sh</filename> script, which | 
 | 833 |                                 is also in the <filename>scripts</filename> | 
 | 834 |                                 directory of the Git repository created | 
 | 835 |                                 earlier. | 
 | 836 |                                 </para></listitem> | 
 | 837 |                             <listitem><para>Run the <filename>build.sh</filename> | 
 | 838 |                                 script as directed. | 
 | 839 |                                 Be sure to provide the tag name, documentation | 
 | 840 |                                 branch, and a release name. | 
 | 841 |                                 Here is an example that uses the | 
 | 842 |                                 <filename>luna/yocto-&DISTRO;</filename> tag, the | 
 | 843 |                                 <filename>master</filename> documentation | 
 | 844 |                                 branch, and | 
 | 845 |                                 <filename>&DISTRO_NAME_NO_CAP;</filename> for the | 
 | 846 |                                 release name: | 
 | 847 |                                 <literallayout class='monospaced'> | 
 | 848 |      $ ECLIPSE_HOME=/home/scottrif/eclipse-poky/scripts/eclipse ./build.sh luna/yocto-&DISTRO; master &DISTRO_NAME_NO_CAP; 2>&1 | tee -a build.log | 
 | 849 |                                 </literallayout> | 
 | 850 |                                 After running the script, the file | 
 | 851 |                                 <filename>org.yocto.sdk-</filename><replaceable>release</replaceable><filename>-</filename><replaceable>date</replaceable><filename>-archive.zip</filename> | 
 | 852 |                                 is in the current directory. | 
 | 853 |                                 </para></listitem> | 
 | 854 |                             <listitem><para>If necessary, start the Eclipse IDE | 
 | 855 |                                 and be sure you are in the Workbench. | 
 | 856 |                                 </para></listitem> | 
 | 857 |                             <listitem><para>Select "Install New Software" from | 
 | 858 |                                 the "Help" pull-down menu. | 
 | 859 |                                 </para></listitem> | 
 | 860 |                             <listitem><para>Click "Add".</para></listitem> | 
 | 861 |                             <listitem><para>Provide anything you want in the | 
 | 862 |                                 "Name" field. | 
 | 863 |                                 </para></listitem> | 
 | 864 |                             <listitem><para>Click "Archive" and browse to the | 
 | 865 |                                 ZIP file you built in step eight. | 
 | 866 |                                 This ZIP file should not be "unzipped", and must | 
 | 867 |                                 be the <filename>*archive.zip</filename> file | 
 | 868 |                                 created by running the | 
 | 869 |                                 <filename>build.sh</filename> script. | 
 | 870 |                                 </para></listitem> | 
 | 871 |                             <listitem><para>Click the "OK" button. | 
 | 872 |                                 </para></listitem> | 
 | 873 |                             <listitem><para>Check the boxes that appear in | 
 | 874 |                                 the installation window to install the | 
 | 875 |                                 <filename>Yocto Project ADT Plug-in</filename>, | 
 | 876 |                                 <filename>Yocto Project Bitbake Commander Plug-in</filename>, | 
 | 877 |                                 and the | 
 | 878 |                                 <filename>Yocto Project Documentation plug-in</filename>. | 
 | 879 |                                 </para></listitem> | 
 | 880 |                             <listitem><para>Finish the installation by clicking | 
 | 881 |                                 through the appropriate buttons. | 
 | 882 |                                 You can click "OK" when prompted about | 
 | 883 |                                 installing software that contains unsigned | 
 | 884 |                                 content. | 
 | 885 |                                 </para></listitem> | 
 | 886 |                             <listitem><para>Restart the Eclipse IDE if | 
 | 887 |                                 necessary. | 
 | 888 |                                 </para></listitem> | 
 | 889 |                         </orderedlist> | 
 | 890 |                     </para> | 
 | 891 |  | 
 | 892 |                     <para> | 
 | 893 |                         At this point you should be able to configure the | 
 | 894 |                         Eclipse Yocto Plug-in as described in the | 
 | 895 |                         "<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring the Eclipse Yocto Plug-in</link>" | 
 | 896 |                         section.</para> | 
 | 897 |                 </section> | 
 | 898 |             </section> | 
 | 899 |  | 
 | 900 |             <section id='configuring-the-eclipse-yocto-plug-in'> | 
 | 901 |                 <title>Configuring the Eclipse Yocto Plug-in</title> | 
 | 902 |  | 
 | 903 |                 <para> | 
 | 904 |                     Configuring the Eclipse Yocto Plug-in involves setting the | 
 | 905 |                     Cross Compiler options and the Target options. | 
 | 906 |                     The configurations you choose become the default settings | 
 | 907 |                     for all projects. | 
 | 908 |                     You do have opportunities to change them later when | 
 | 909 |                     you configure the project (see the following section). | 
 | 910 |                 </para> | 
 | 911 |  | 
 | 912 |                 <para> | 
 | 913 |                     To start, you need to do the following from within the | 
 | 914 |                     Eclipse IDE: | 
 | 915 |                     <itemizedlist> | 
 | 916 |                         <listitem><para>Choose "Preferences" from the | 
 | 917 |                             "Window" menu to display the Preferences Dialog. | 
 | 918 |                             </para></listitem> | 
 | 919 |                         <listitem><para>Click "Yocto Project ADT" to display | 
 | 920 |                             the configuration screen. | 
 | 921 |                             </para></listitem> | 
 | 922 |                     </itemizedlist> | 
 | 923 |                 </para> | 
 | 924 |  | 
 | 925 |                 <section id='configuring-the-cross-compiler-options'> | 
 | 926 |                     <title>Configuring the Cross-Compiler Options</title> | 
 | 927 |  | 
 | 928 |                     <para> | 
 | 929 |                         To configure the Cross Compiler Options, you must select | 
 | 930 |                         the type of toolchain, point to the toolchain, specify | 
 | 931 |                         the sysroot location, and select the target | 
 | 932 |                         architecture. | 
 | 933 |                         <itemizedlist> | 
 | 934 |                             <listitem><para><emphasis>Selecting the Toolchain Type:</emphasis> | 
 | 935 |                                 Choose between | 
 | 936 |                                 <filename>Standalone pre-built toolchain</filename> | 
 | 937 |                                 and | 
 | 938 |                                 <filename>Build system derived toolchain</filename> | 
 | 939 |                                 for Cross Compiler Options. | 
 | 940 |                                     <itemizedlist> | 
 | 941 |                                         <listitem><para><emphasis> | 
 | 942 |                                             <filename>Standalone Pre-built Toolchain:</filename></emphasis> | 
 | 943 |                                             Select this mode when you are using | 
 | 944 |                                             a stand-alone cross-toolchain. | 
 | 945 |                                             For example, suppose you are an | 
 | 946 |                                             application developer and do not | 
 | 947 |                                             need to build a target image. | 
 | 948 |                                             Instead, you just want to use an | 
 | 949 |                                             architecture-specific toolchain on | 
 | 950 |                                             an existing kernel and target root | 
 | 951 |                                             filesystem.</para></listitem> | 
 | 952 |                                        <listitem><para><emphasis> | 
 | 953 |                                             <filename>Build System Derived Toolchain:</filename></emphasis> | 
 | 954 |                                             Select this mode if the | 
 | 955 |                                             cross-toolchain has been installed | 
 | 956 |                                             and built as part of the | 
 | 957 |                                             <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>. | 
 | 958 |                                             When you select | 
 | 959 |                                             <filename>Build system derived toolchain</filename>, | 
 | 960 |                                             you are using the toolchain bundled | 
 | 961 |                                             inside the Build Directory. | 
 | 962 |                                             </para></listitem> | 
 | 963 |                                     </itemizedlist> | 
 | 964 |                                 </para></listitem> | 
 | 965 |                             <listitem><para><emphasis>Point to the Toolchain:</emphasis> | 
 | 966 |                                 If you are using a stand-alone pre-built | 
 | 967 |                                 toolchain, you should be pointing to where it is | 
 | 968 |                                 installed. | 
 | 969 |                                 See the | 
 | 970 |                                 "<link linkend='sdk-installing-the-sdk'>Installing the SDK</link>" | 
 | 971 |                                 section for information about how the SDK is | 
 | 972 |                                 installed.</para> | 
 | 973 |                                 <para>If you are using a system-derived | 
 | 974 |                                 toolchain, the path you provide for the | 
 | 975 |                                 <filename>Toolchain Root Location</filename> | 
 | 976 |                                 field is the | 
 | 977 |                                 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>. | 
 | 978 |                                 See the | 
 | 979 |                                 "<link linkend='sdk-building-an-sdk-installer'>Building an SDK Installer</link>" | 
 | 980 |                                 section.</para></listitem> | 
 | 981 |                             <listitem><para><emphasis>Specify the Sysroot Location:</emphasis> | 
 | 982 |                                 This location is where the root filesystem for | 
 | 983 |                                 the target hardware resides. | 
 | 984 |                                 </para> | 
 | 985 |                                 <para>The location of | 
 | 986 |                                 the sysroot filesystem depends on where you | 
 | 987 |                                 separately extracted and installed the | 
 | 988 |                                 filesystem.</para> | 
 | 989 |                                 <para>For information on how to install the | 
 | 990 |                                 toolchain and on how to extract and install the | 
 | 991 |                                 sysroot filesystem, see the | 
 | 992 |                                 "<link linkend='sdk-building-an-sdk-installer'>Building an SDK Installer</link>" | 
 | 993 |                                 section. | 
 | 994 |                                 </para></listitem> | 
 | 995 |                             <listitem><para><emphasis>Select the Target Architecture:</emphasis> | 
 | 996 |                                 The target architecture is the type of hardware | 
 | 997 |                                 you are going to use or emulate. | 
 | 998 |                                 Use the pull-down | 
 | 999 |                                 <filename>Target Architecture</filename> menu | 
 | 1000 |                                 to make your selection. | 
 | 1001 |                                 The pull-down menu should have the supported | 
 | 1002 |                                 architectures. | 
 | 1003 |                                 If the architecture you need is not listed in | 
 | 1004 |                                 the menu, you will need to build the image. | 
 | 1005 |                                 See the | 
 | 1006 |                                 "<ulink url='&YOCTO_DOCS_QS_URL;#qs-building-images'>Building Images</ulink>" | 
 | 1007 |                                 section of the Yocto Project Quick Start for | 
 | 1008 |                                 more information.</para></listitem> | 
 | 1009 |                         </itemizedlist> | 
 | 1010 |                     </para> | 
 | 1011 |                 </section> | 
 | 1012 |  | 
 | 1013 |                 <section id='configuring-the-target-options'> | 
 | 1014 |                     <title>Configuring the Target Options</title> | 
 | 1015 |  | 
 | 1016 |                     <para> | 
 | 1017 |                         You can choose to emulate hardware using the QEMU | 
 | 1018 |                         emulator, or you can choose to run your image on actual | 
 | 1019 |                         hardware. | 
 | 1020 |                         <itemizedlist> | 
 | 1021 |                             <listitem><para><emphasis>QEMU:</emphasis> | 
 | 1022 |                                 Select this option if you will be using the | 
 | 1023 |                                 QEMU emulator. | 
 | 1024 |                                 If you are using the emulator, you also need to | 
 | 1025 |                                 locate the kernel and specify any custom | 
 | 1026 |                                 options.</para> | 
 | 1027 |                                 <para>If you selected | 
 | 1028 |                                 <filename>Build system derived toolchain</filename>, | 
 | 1029 |                                 the target kernel you built will be located in | 
 | 1030 |                                 the Build Directory in | 
 | 1031 |                                 <filename>tmp/deploy/images/<replaceable>machine</replaceable></filename> | 
 | 1032 |                                 directory. | 
 | 1033 |                                 If you selected | 
 | 1034 |                                 <filename>Standalone pre-built toolchain</filename>, | 
 | 1035 |                                 the pre-built image you downloaded is located | 
 | 1036 |                                 in the directory you specified when you | 
 | 1037 |                                 downloaded the image.</para> | 
 | 1038 |                                 <para>Most custom options are for advanced QEMU | 
 | 1039 |                                 users to further customize their QEMU instance. | 
 | 1040 |                                 These options are specified between paired | 
 | 1041 |                                 angled brackets. | 
 | 1042 |                                 Some options must be specified outside the | 
 | 1043 |                                 brackets. | 
 | 1044 |                                 In particular, the options | 
 | 1045 |                                 <filename>serial</filename>, | 
 | 1046 |                                 <filename>nographic</filename>, and | 
 | 1047 |                                 <filename>kvm</filename> must all be outside the | 
 | 1048 |                                 brackets. | 
 | 1049 |                                 Use the <filename>man qemu</filename> command | 
 | 1050 |                                 to get help on all the options and their use. | 
 | 1051 |                                 The following is an example: | 
 | 1052 |                                <literallayout class='monospaced'> | 
 | 1053 |     serial ‘<-m 256 -full-screen>’ | 
 | 1054 |                                 </literallayout></para> | 
 | 1055 |                                 <para> | 
 | 1056 |                                 Regardless of the mode, Sysroot is already | 
 | 1057 |                                 defined as part of the Cross-Compiler Options | 
 | 1058 |                                 configuration in the | 
 | 1059 |                                 <filename>Sysroot Location:</filename> field. | 
 | 1060 |                                 </para></listitem> | 
 | 1061 |                             <listitem><para><emphasis>External HW:</emphasis> | 
 | 1062 |                                 Select this option if you will be using actual | 
 | 1063 |                                 hardware.</para></listitem> | 
 | 1064 |                         </itemizedlist> | 
 | 1065 |                     </para> | 
 | 1066 |  | 
 | 1067 |                     <para> | 
 | 1068 |                         Click the "OK" to save your plug-in configurations. | 
 | 1069 |                     </para> | 
 | 1070 |                 </section> | 
 | 1071 |             </section> | 
 | 1072 |         </section> | 
 | 1073 |  | 
 | 1074 |         <section id='creating-the-project'> | 
 | 1075 |             <title>Creating the Project</title> | 
 | 1076 |  | 
 | 1077 |             <para> | 
 | 1078 |                 You can create two types of projects:  Autotools-based, or | 
 | 1079 |                 Makefile-based. | 
 | 1080 |                 This section describes how to create Autotools-based projects | 
 | 1081 |                 from within the Eclipse IDE. | 
 | 1082 |                 For information on creating Makefile-based projects in a | 
 | 1083 |                 terminal window, see the | 
 | 1084 |                 "<link linkend='makefile-based-projects'>Makefile-Based Projects</link>" | 
 | 1085 |                 section. | 
 | 1086 |                 <note> | 
 | 1087 |                     Do not use special characters in project names | 
 | 1088 |                     (e.g. spaces, underscores, etc.).  Doing so can | 
 | 1089 |                     cause configuration to fail. | 
 | 1090 |                 </note> | 
 | 1091 |             </para> | 
 | 1092 |  | 
 | 1093 |             <para> | 
 | 1094 |                 To create a project based on a Yocto template and then display | 
 | 1095 |                 the source code, follow these steps: | 
 | 1096 |                 <orderedlist> | 
 | 1097 |                     <listitem><para>Select "Project" from the "File -> New" menu. | 
 | 1098 |                         </para></listitem> | 
 | 1099 |                     <listitem><para>Double click <filename>CC++</filename>. | 
 | 1100 |                         </para></listitem> | 
 | 1101 |                     <listitem><para>Double click <filename>C Project</filename> | 
 | 1102 |                         to create the project.</para></listitem> | 
 | 1103 |                     <listitem><para>Expand <filename>Yocto Project ADT Autotools Project</filename>. | 
 | 1104 |                         </para></listitem> | 
 | 1105 |                     <listitem><para>Select <filename>Hello World ANSI C Autotools Project</filename>. | 
 | 1106 |                         This is an Autotools-based project based on a Yocto | 
 | 1107 |                         template.</para></listitem> | 
 | 1108 |                     <listitem><para>Put a name in the <filename>Project name:</filename> | 
 | 1109 |                         field. | 
 | 1110 |                         Do not use hyphens as part of the name. | 
 | 1111 |                         </para></listitem> | 
 | 1112 |                     <listitem><para>Click "Next".</para></listitem> | 
 | 1113 |                     <listitem><para>Add information in the | 
 | 1114 |                         <filename>Author</filename> and | 
 | 1115 |                         <filename>Copyright notice</filename> fields. | 
 | 1116 |                         </para></listitem> | 
 | 1117 |                     <listitem><para>Be sure the <filename>License</filename> | 
 | 1118 |                         field is correct.</para></listitem> | 
 | 1119 |                     <listitem><para>Click "Finish".</para></listitem> | 
 | 1120 |                     <listitem><para>If the "open perspective" prompt appears, | 
 | 1121 |                         click "Yes" so that you in the C/C++ perspective. | 
 | 1122 |                         </para></listitem> | 
 | 1123 |                     <listitem><para>The left-hand navigation pane shows your | 
 | 1124 |                         project. | 
 | 1125 |                         You can display your source by double clicking the | 
 | 1126 |                         project's source file.</para></listitem> | 
 | 1127 |                 </orderedlist> | 
 | 1128 |             </para> | 
 | 1129 |         </section> | 
 | 1130 |  | 
 | 1131 |         <section id='configuring-the-cross-toolchains'> | 
 | 1132 |             <title>Configuring the Cross-Toolchains</title> | 
 | 1133 |  | 
 | 1134 |             <para> | 
 | 1135 |                 The earlier section, | 
 | 1136 |                 "<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring the Eclipse Yocto Plug-in</link>", | 
 | 1137 |                 sets up the default project configurations. | 
 | 1138 |                 You can override these settings for a given project by following | 
 | 1139 |                 these steps: | 
 | 1140 |                 <orderedlist> | 
 | 1141 |                     <listitem><para>Select "Change Yocto Project Settings" from | 
 | 1142 |                         the "Project" menu. | 
 | 1143 |                         This selection brings up the Yocto Project Settings | 
 | 1144 |                         Dialog and allows you to make changes specific to an | 
 | 1145 |                         individual project.</para> | 
 | 1146 |                         <para>By default, the Cross Compiler Options and Target | 
 | 1147 |                         Options for a project are inherited from settings you | 
 | 1148 |                         provided using the Preferences Dialog as described | 
 | 1149 |                         earlier in the | 
 | 1150 |                         "<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring the Eclipse Yocto Plug-in</link>" section. | 
 | 1151 |                         The Yocto Project Settings Dialog allows you to override | 
 | 1152 |                         those default settings for a given project. | 
 | 1153 |                         </para></listitem> | 
 | 1154 |                     <listitem><para>Make your configurations for the project | 
 | 1155 |                         and click "OK". | 
 | 1156 |                         </para></listitem> | 
 | 1157 |                     <listitem><para>Right-click in the navigation pane and | 
 | 1158 |                         select "Reconfigure Project" from the pop-up menu. | 
 | 1159 |                         This selection reconfigures the project by running | 
 | 1160 |                         <filename>autogen.sh</filename> in the workspace for | 
 | 1161 |                         your project. | 
 | 1162 |                         The script also runs <filename>libtoolize</filename>, | 
 | 1163 |                         <filename>aclocal</filename>, | 
 | 1164 |                         <filename>autoconf</filename>, | 
 | 1165 |                         <filename>autoheader</filename>, | 
 | 1166 |                         <filename>automake --a</filename>, and | 
 | 1167 |                         <filename>./configure</filename>. | 
 | 1168 |                         Click on the "Console" tab beneath your source code to | 
 | 1169 |                         see the results of reconfiguring your project. | 
 | 1170 |                         </para></listitem> | 
 | 1171 |                 </orderedlist> | 
 | 1172 |             </para> | 
 | 1173 |         </section> | 
 | 1174 |  | 
 | 1175 |         <section id='building-the-project'> | 
 | 1176 |             <title>Building the Project</title> | 
 | 1177 |  | 
 | 1178 |             <para> | 
 | 1179 |                 To build the project select "Build Project" from the | 
 | 1180 |                 "Project" menu. | 
 | 1181 |                 The console should update and you can note the cross-compiler | 
 | 1182 |                 you are using. | 
 | 1183 |                 <note> | 
 | 1184 |                     When building "Yocto Project ADT Autotools" projects, the Eclipse | 
 | 1185 |                     IDE might display error messages for Functions/Symbols/Types | 
 | 1186 |                     that cannot be "resolved", even when the related include file | 
 | 1187 |                     is listed at the project navigator and when the project is | 
 | 1188 |                     able to build. | 
 | 1189 |                     For these cases only, it is recommended to add a new linked | 
 | 1190 |                     folder to the appropriate sysroot. | 
 | 1191 |                     Use these steps to add the linked folder: | 
 | 1192 |                     <orderedlist> | 
 | 1193 |                         <listitem><para> | 
 | 1194 |                             Select the project. | 
 | 1195 |                             </para></listitem> | 
 | 1196 |                         <listitem><para> | 
 | 1197 |                             Select "Folder" from the | 
 | 1198 |                             <filename>File > New</filename> menu. | 
 | 1199 |                             </para></listitem> | 
 | 1200 |                         <listitem><para> | 
 | 1201 |                             In the "New Folder" Dialog, select "Link to alternate | 
 | 1202 |                             location (linked folder)". | 
 | 1203 |                             </para></listitem> | 
 | 1204 |                         <listitem><para> | 
 | 1205 |                             Click "Browse" to navigate to the include folder inside | 
 | 1206 |                             the same sysroot location selected in the Yocto Project | 
 | 1207 |                             configuration preferences. | 
 | 1208 |                             </para></listitem> | 
 | 1209 |                         <listitem><para> | 
 | 1210 |                             Click "OK". | 
 | 1211 |                             </para></listitem> | 
 | 1212 |                         <listitem><para> | 
 | 1213 |                             Click "Finish" to save the linked folder. | 
 | 1214 |                             </para></listitem> | 
 | 1215 |                     </orderedlist> | 
 | 1216 |                 </note> | 
 | 1217 |             </para> | 
 | 1218 |         </section> | 
 | 1219 |  | 
 | 1220 |         <section id='starting-qemu-in-user-space-nfs-mode'> | 
 | 1221 |             <title>Starting QEMU in User-Space NFS Mode</title> | 
 | 1222 |  | 
 | 1223 |             <para> | 
 | 1224 |                 To start the QEMU emulator from within Eclipse, follow these | 
 | 1225 |                 steps: | 
 | 1226 |                 <note> | 
 | 1227 |                     See the | 
 | 1228 |                     "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-qemu'>Using the Quick EMUlator (QEMU)</ulink>" | 
 | 1229 |                     chapter in the Yocto Project Development Manual | 
 | 1230 |                     for more information on using QEMU. | 
 | 1231 |                 </note> | 
 | 1232 |                 <orderedlist> | 
 | 1233 |                     <listitem><para>Expose and select "External Tools" from | 
 | 1234 |                         the "Run" menu. | 
 | 1235 |                         Your image should appear as a selectable menu item. | 
 | 1236 |                         </para></listitem> | 
 | 1237 |                     <listitem><para>Select your image from the menu to launch | 
 | 1238 |                         the emulator in a new window. | 
 | 1239 |                         </para></listitem> | 
 | 1240 |                     <listitem><para>If needed, enter your host root password in | 
 | 1241 |                         the shell window at the prompt. | 
 | 1242 |                         This sets up a <filename>Tap 0</filename> connection | 
 | 1243 |                         needed for running in user-space NFS mode. | 
 | 1244 |                         </para></listitem> | 
 | 1245 |                     <listitem><para>Wait for QEMU to launch.</para></listitem> | 
 | 1246 |                     <listitem><para>Once QEMU launches, you can begin operating | 
 | 1247 |                         within that environment. | 
 | 1248 |                         One useful task at this point would be to determine the | 
 | 1249 |                         IP Address for the user-space NFS by using the | 
 | 1250 |                        <filename>ifconfig</filename> command. | 
 | 1251 |                        </para></listitem> | 
 | 1252 |                 </orderedlist> | 
 | 1253 |             </para> | 
 | 1254 |         </section> | 
 | 1255 |  | 
 | 1256 |         <section id='deploying-and-debugging-the-application'> | 
 | 1257 |             <title>Deploying and Debugging the Application</title> | 
 | 1258 |  | 
 | 1259 |             <para> | 
 | 1260 |                 Once the QEMU emulator is running the image, you can deploy | 
 | 1261 |                 your application using the Eclipse IDE and then use | 
 | 1262 |                 the emulator to perform debugging. | 
 | 1263 |                 Follow these steps to deploy the application. | 
 | 1264 |                 <note> | 
 | 1265 |                     Currently, Eclipse does not support SSH port forwarding. | 
 | 1266 |                     Consequently, if you need to run or debug a remote | 
 | 1267 |                     application using the host display, you must create a | 
 | 1268 |                     tunneling connection from outside Eclipse and keep | 
 | 1269 |                     that connection alive during your work. | 
 | 1270 |                     For example, in a new terminal, run the following: | 
 | 1271 |                     <literallayout class='monospaced'> | 
 | 1272 |      ssh -XY user_name@remote_host_ip | 
 | 1273 |                     </literallayout> | 
 | 1274 |                     After running the command, add the command to be executed | 
 | 1275 |                     in Eclipse's run configuration before the application | 
 | 1276 |                     as follows: | 
 | 1277 |                     <literallayout class='monospaced'> | 
 | 1278 |      export DISPLAY=:10.0 | 
 | 1279 |                     </literallayout> | 
 | 1280 |                 </note> | 
 | 1281 |                 <orderedlist> | 
 | 1282 |                     <listitem><para>Select "Debug Configurations..." from the | 
 | 1283 |                         "Run" menu.</para></listitem> | 
 | 1284 |                     <listitem><para>In the left area, expand | 
 | 1285 |                         <filename>C/C++Remote Application</filename>. | 
 | 1286 |                         </para></listitem> | 
 | 1287 |                     <listitem><para>Locate your project and select it to bring | 
 | 1288 |                         up a new tabbed view in the Debug Configurations Dialog. | 
 | 1289 |                         </para></listitem> | 
 | 1290 |                     <listitem><para>Enter the absolute path into which you want | 
 | 1291 |                         to deploy the application. | 
 | 1292 |                         Use the "Remote Absolute File Path for | 
 | 1293 |                         C/C++Application:" field. | 
 | 1294 |                         For example, enter | 
 | 1295 |                         <filename>/usr/bin/<replaceable>programname</replaceable></filename>. | 
 | 1296 |                         </para></listitem> | 
 | 1297 |                     <listitem><para>Click on the "Debugger" tab to see the | 
 | 1298 |                         cross-tool debugger you are using.</para></listitem> | 
 | 1299 |                     <listitem><para>Click on the "Main" tab.</para></listitem> | 
 | 1300 |                     <listitem><para>Create a new connection to the QEMU instance | 
 | 1301 |                         by clicking on "new".</para></listitem> | 
 | 1302 |                     <listitem><para>Select <filename>TCF</filename>, which means | 
 | 1303 |                         Target Communication Framework.</para></listitem> | 
 | 1304 |                     <listitem><para>Click "Next".</para></listitem> | 
 | 1305 |                     <listitem><para>Clear out the "host name" field and enter | 
 | 1306 |                         the IP Address determined earlier.</para></listitem> | 
 | 1307 |                     <listitem><para>Click "Finish" to close the | 
 | 1308 |                         New Connections Dialog.</para></listitem> | 
 | 1309 |                     <listitem><para>Use the drop-down menu now in the | 
 | 1310 |                         "Connection" field and pick the IP Address you entered. | 
 | 1311 |                          </para></listitem> | 
 | 1312 |                     <listitem><para>Click "Debug" to bring up a login screen | 
 | 1313 |                         and login.</para></listitem> | 
 | 1314 |                     <listitem><para>Accept the debug perspective. | 
 | 1315 |                         </para></listitem> | 
 | 1316 |                 </orderedlist> | 
 | 1317 |             </para> | 
 | 1318 |         </section> | 
 | 1319 |  | 
 | 1320 |         <section id='running-user-space-tools'> | 
 | 1321 |             <title>Running User-Space Tools</title> | 
 | 1322 |  | 
 | 1323 |             <para> | 
 | 1324 |                 As mentioned earlier in the manual, several tools exist that | 
 | 1325 |                 enhance your development experience. | 
 | 1326 |                 These tools are aids in developing and debugging applications | 
 | 1327 |                 and images. | 
 | 1328 |                 You can run these user-space tools from within the Eclipse | 
 | 1329 |                 IDE through the "YoctoProjectTools" menu. | 
 | 1330 |             </para> | 
 | 1331 |  | 
 | 1332 |             <para> | 
 | 1333 |                 Once you pick a tool, you need to configure it for the remote | 
 | 1334 |                 target. | 
 | 1335 |                 Every tool needs to have the connection configured. | 
 | 1336 |                 You must select an existing TCF-based RSE connection to the | 
 | 1337 |                 remote target. | 
 | 1338 |                 If one does not exist, click "New" to create one. | 
 | 1339 |             </para> | 
 | 1340 |  | 
 | 1341 |             <para> | 
 | 1342 |                 Here are some specifics about the remote tools: | 
 | 1343 |                 <itemizedlist> | 
 | 1344 |                     <listitem><para><emphasis><filename>Lttng2.0 trace import</filename>:</emphasis> | 
 | 1345 |                         Selecting this tool transfers the remote target's | 
 | 1346 |                         <filename>Lttng</filename> tracing data back to the | 
 | 1347 |                         local host machine and uses the Lttng Eclipse plug-in | 
 | 1348 |                         to graphically display the output. | 
 | 1349 |                         For information on how to use Lttng to trace an | 
 | 1350 |                         application, | 
 | 1351 |                         see <ulink url='http://lttng.org/documentation'></ulink> | 
 | 1352 |                         and the | 
 | 1353 |                         "<ulink url='&YOCTO_DOCS_PROF_URL;#lttng-linux-trace-toolkit-next-generation'>LTTng (Linux Trace Toolkit, next generation)</ulink>" | 
 | 1354 |                         section, which is in the Yocto Project Profiling and | 
 | 1355 |                         Tracing Manual. | 
 | 1356 |                         <note>Do not use | 
 | 1357 |                             <filename>Lttng-user space (legacy)</filename> tool. | 
 | 1358 |                             This tool no longer has any upstream support.</note> | 
 | 1359 |                         </para> | 
 | 1360 |                         <para>Before you use the | 
 | 1361 |                         <filename>Lttng2.0 trace import</filename> tool, | 
 | 1362 |                         you need to setup the Lttng Eclipse plug-in and create a | 
 | 1363 |                         Tracing project. | 
 | 1364 |                         Do the following: | 
 | 1365 |                         <orderedlist> | 
 | 1366 |                             <listitem><para>Select "Open Perspective" from the | 
 | 1367 |                                 "Window" menu and then select "Other..." to | 
 | 1368 |                                 bring up a menu of other perspectives. | 
 | 1369 |                                 Choose "Tracing". | 
 | 1370 |                                 </para></listitem> | 
 | 1371 |                             <listitem><para>Click "OK" to change the Eclipse | 
 | 1372 |                                 perspective into the Tracing perspective. | 
 | 1373 |                                 </para></listitem> | 
 | 1374 |                             <listitem><para>Create a new Tracing project by | 
 | 1375 |                                 selecting "Project" from the "File -> New" menu. | 
 | 1376 |                                 </para></listitem> | 
 | 1377 |                             <listitem><para>Choose "Tracing Project" from the | 
 | 1378 |                                 "Tracing" menu and click "Next". | 
 | 1379 |                                 </para></listitem> | 
 | 1380 |                             <listitem><para>Provide a name for your tracing | 
 | 1381 |                                 project and click "Finish". | 
 | 1382 |                                 </para></listitem> | 
 | 1383 |                             <listitem><para>Generate your tracing data on the | 
 | 1384 |                                 remote target.</para></listitem> | 
 | 1385 |                             <listitem><para>Select "Lttng2.0 trace import" | 
 | 1386 |                                 from the "Yocto Project Tools" menu to | 
 | 1387 |                                 start the data import process.</para></listitem> | 
 | 1388 |                             <listitem><para>Specify your remote connection name. | 
 | 1389 |                                 </para></listitem> | 
 | 1390 |                             <listitem><para>For the Ust directory path, specify | 
 | 1391 |                                 the location of your remote tracing data. | 
 | 1392 |                                 Make sure the location ends with | 
 | 1393 |                                 <filename>ust</filename> (e.g. | 
 | 1394 |                                 <filename>/usr/mysession/ust</filename>). | 
 | 1395 |                                 </para></listitem> | 
 | 1396 |                             <listitem><para>Click "OK" to complete the import | 
 | 1397 |                                 process. | 
 | 1398 |                                 The data is now in the local tracing project | 
 | 1399 |                                 you created.</para></listitem> | 
 | 1400 |                             <listitem><para>Right click on the data and then use | 
 | 1401 |                                 the menu to Select "Generic CTF Trace" from the | 
 | 1402 |                                 "Trace Type... -> Common Trace Format" menu to | 
 | 1403 |                                 map the tracing type.</para></listitem> | 
 | 1404 |                             <listitem><para>Right click the mouse and select | 
 | 1405 |                                 "Open" to bring up the Eclipse Lttng Trace | 
 | 1406 |                                 Viewer so you view the tracing data. | 
 | 1407 |                                 </para></listitem> | 
 | 1408 |                         </orderedlist></para></listitem> | 
 | 1409 |                     <listitem><para><emphasis><filename>PowerTOP</filename>:</emphasis> | 
 | 1410 |                         Selecting this tool runs PowerTOP on the remote target | 
 | 1411 |                         machine and displays the results in a new view called | 
 | 1412 |                         PowerTOP.</para> | 
 | 1413 |                         <para>The "Time to gather data(sec):" field is the time | 
 | 1414 |                         passed in seconds before data is gathered from the | 
 | 1415 |                         remote target for analysis.</para> | 
 | 1416 |                         <para>The "show pids in wakeups list:" field corresponds | 
 | 1417 |                         to the <filename>-p</filename> argument passed to | 
 | 1418 |                         <filename>PowerTOP</filename>.</para></listitem> | 
 | 1419 |                     <listitem><para><emphasis><filename>LatencyTOP and Perf</filename>:</emphasis> | 
 | 1420 |                         LatencyTOP identifies system latency, while | 
 | 1421 |                         Perf monitors the system's performance counter | 
 | 1422 |                         registers. | 
 | 1423 |                         Selecting either of these tools causes an RSE terminal | 
 | 1424 |                         view to appear from which you can run the tools. | 
 | 1425 |                         Both tools refresh the entire screen to display results | 
 | 1426 |                         while they run. | 
 | 1427 |                         For more information on setting up and using | 
 | 1428 |                         <filename>perf</filename>, see the | 
 | 1429 |                         "<ulink url='&YOCTO_DOCS_PROF_URL;#profile-manual-perf'>perf</ulink>" | 
 | 1430 |                         section in the Yocto Project Profiling and Tracing | 
 | 1431 |                         Manual. | 
 | 1432 |                         </para></listitem> | 
 | 1433 |                     <listitem><para><emphasis><filename>SystemTap</filename>:</emphasis> | 
 | 1434 |                         Systemtap is a tool that lets you create and reuse | 
 | 1435 |                         scripts to examine the activities of a live Linux | 
 | 1436 |                         system. | 
 | 1437 |                         You can easily extract, filter, and summarize data | 
 | 1438 |                         that helps you diagnose complex performance or | 
 | 1439 |                         functional problems. | 
 | 1440 |                         For more information on setting up and using | 
 | 1441 |                         <filename>SystemTap</filename>, see the | 
 | 1442 |                         <ulink url='https://sourceware.org/systemtap/documentation.html'>SystemTap Documentation</ulink>. | 
 | 1443 |                         </para></listitem> | 
 | 1444 |                     <listitem><para><emphasis><filename>yocto-bsp</filename>:</emphasis> | 
 | 1445 |                         The <filename>yocto-bsp</filename> tool lets you | 
 | 1446 |                         quickly set up a Board Support Package (BSP) layer. | 
 | 1447 |                         The tool requires a Metadata location, build location, | 
 | 1448 |                         BSP name, BSP output location, and a kernel | 
 | 1449 |                         architecture. | 
 | 1450 |                         For more information on the | 
 | 1451 |                         <filename>yocto-bsp</filename> tool outside of Eclipse, | 
 | 1452 |                         see the | 
 | 1453 |                         "<ulink url='&YOCTO_DOCS_BSP_URL;#creating-a-new-bsp-layer-using-the-yocto-bsp-script'>Creating a new BSP Layer Using the yocto-bsp Script</ulink>" | 
 | 1454 |                         section in the Yocto Project Board Support Package | 
 | 1455 |                         (BSP) Developer's Guide. | 
 | 1456 |                         </para></listitem> | 
 | 1457 |                 </itemizedlist> | 
 | 1458 |             </para> | 
 | 1459 |         </section> | 
 | 1460 |     </section> | 
 | 1461 | </section> | 
 | 1462 |  | 
 | 1463 | </chapter> | 
 | 1464 | <!-- | 
 | 1465 | vim: expandtab tw=80 ts=4 | 
 | 1466 | --> |