path: root/documentation/dev-manual/dev-manual-model.xml
diff options
Diffstat (limited to 'documentation/dev-manual/dev-manual-model.xml')
1 files changed, 2069 insertions, 0 deletions
diff --git a/documentation/dev-manual/dev-manual-model.xml b/documentation/dev-manual/dev-manual-model.xml
new file mode 100644
index 0000000..4fd4c4e
--- /dev/null
+++ b/documentation/dev-manual/dev-manual-model.xml
@@ -0,0 +1,2069 @@
1<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3[<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
5<chapter id='dev-manual-model'>
7<title>Common Development Models</title>
10 Many development models exist for which you can use the Yocto Project.
11 This chapter overviews simple methods that use tools provided by the
12 Yocto Project:
13 <itemizedlist>
14 <listitem><para><emphasis>System Development:</emphasis>
15 System Development covers Board Support Package (BSP) development and kernel
16 modification or configuration.
17 For an example on how to create a BSP, see the
18 "<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>"
19 section in the Yocto Project Board Support Package (BSP) Developer's Guide.
20 For more complete information on how to work with the kernel, see the
21 <ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;'>Yocto Project Linux Kernel
22 Development Manual</ulink>.
23 </para></listitem>
24 <listitem><para><emphasis>User Application Development:</emphasis>
25 User Application Development covers development of applications that you intend
26 to run on target hardware.
27 For information on how to set up your host development system for user-space
28 application development, see the
29 <ulink url='&YOCTO_DOCS_ADT_URL;'>Yocto Project Application Developer's Guide</ulink>.
30 For a simple example of user-space application development using the
31 <trademark class='trade'>Eclipse</trademark> IDE, see the
32 "<link linkend='application-development-workflow'>Application
33 Development Workflow</link>" section.
34 </para></listitem>
35 <listitem><para><emphasis>Temporary Source Code Modification:</emphasis>
36 Direct modification of temporary source code is a convenient development model
37 to quickly iterate and develop towards a solution.
38 Once you implement the solution, you should of course take steps to
39 get the changes upstream and applied in the affected recipes.</para></listitem>
40 <listitem><para><emphasis>Image Development using Hob:</emphasis>
41 You can use the <ulink url='&YOCTO_HOME_URL;/tools-resources/projects/hob'>Hob</ulink> to build
42 custom operating system images within the build environment.
43 Hob provides an efficient interface to the OpenEmbedded build system.</para></listitem>
44 <listitem><para><emphasis>Using a Development Shell:</emphasis>
45 You can use a <filename>devshell</filename> to efficiently debug commands or simply
46 edit packages.
47 Working inside a development shell is a quick way to set up the OpenEmbedded build
48 environment to work on parts of a project.</para></listitem>
49 </itemizedlist>
52<section id='system-development-model'>
53 <title>System Development Workflow</title>
55 <para>
56 System development involves modification or creation of an image that you want to run on
57 a specific hardware target.
58 Usually, when you want to create an image that runs on embedded hardware, the image does
59 not require the same number of features that a full-fledged Linux distribution provides.
60 Thus, you can create a much smaller image that is designed to use only the
61 features for your particular hardware.
62 </para>
64 <para>
65 To help you understand how system development works in the Yocto Project, this section
66 covers two types of image development: BSP creation and kernel modification or
67 configuration.
68 </para>
70 <section id='developing-a-board-support-package-bsp'>
71 <title>Developing a Board Support Package (BSP)</title>
73 <para>
74 A BSP is a package of recipes that, when applied during a build, results in
75 an image that you can run on a particular board.
76 Thus, the package when compiled into the new image, supports the operation of the board.
77 </para>
79 <note>
80 For a brief list of terms used when describing the development process in the Yocto Project,
81 see the "<link linkend='yocto-project-terms'>Yocto Project Terms</link>" section.
82 </note>
84 <para>
85 The remainder of this section presents the basic
86 steps used to create a BSP using the Yocto Project's
87 <ulink url='&YOCTO_DOCS_BSP_URL;#using-the-yocto-projects-bsp-tools'>BSP Tools</ulink>.
88 Although not required for BSP creation, the
89 <filename>meta-intel</filename> repository, which contains
90 many BSPs supported by the Yocto Project, is part of the example.
91 </para>
93 <para>
94 For an example that shows how to create a new layer using the tools, see the
95 "<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>"
96 section in the Yocto Project Board Support Package (BSP) Developer's Guide.
97 </para>
99 <para>
100 The following illustration and list summarize the BSP creation general workflow.
101 </para>
103 <para>
104 <imagedata fileref="figures/bsp-dev-flow.png" width="6in" depth="7in" align="center" scalefit="1" />
105 </para>
107 <para>
108 <orderedlist>
109 <listitem><para><emphasis>Set up your host development system to support
110 development using the Yocto Project</emphasis>: See the
111 "<ulink url='&YOCTO_DOCS_QS_URL;#the-linux-distro'>The Linux Distribution</ulink>"
112 and the
113 "<ulink url='&YOCTO_DOCS_QS_URL;#packages'>The Packages</ulink>" sections both
114 in the Yocto Project Quick Start for requirements.</para></listitem>
115 <listitem><para><emphasis>Establish a local copy of the project files on your
116 system</emphasis>: You need this <link linkend='source-directory'>Source
117 Directory</link> available on your host system.
118 Having these files on your system gives you access to the build
119 process and to the tools you need.
120 For information on how to set up the Source Directory,
121 see the
122 "<link linkend='getting-setup'>Getting Set Up</link>" section.</para></listitem>
123 <listitem><para><emphasis>Establish the <filename>meta-intel</filename>
124 repository on your system</emphasis>: Having local copies
125 of these supported BSP layers on your system gives you
126 access to layers you might be able to build on or modify
127 to create your BSP.
128 For information on how to get these files, see the
129 "<link linkend='getting-setup'>Getting Set Up</link>" section.</para></listitem>
130 <listitem><para><emphasis>Create your own BSP layer using the
131 <ulink url='&YOCTO_DOCS_BSP_URL;#creating-a-new-bsp-layer-using-the-yocto-bsp-script'><filename>yocto-bsp</filename></ulink> script</emphasis>:
132 Layers are ideal for
133 isolating and storing work for a given piece of hardware.
134 A layer is really just a location or area in which you place
135 the recipes and configurations for your BSP.
136 In fact, a BSP is, in itself, a special type of layer.
137 The simplest way to create a new BSP layer that is compliant with the
138 Yocto Project is to use the <filename>yocto-bsp</filename> script.
139 For information about that script, see the
140 "<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>"
141 section in the Yocto Project Board Support (BSP) Developer's Guide.
142 </para>
143 <para>
144 Another example that illustrates a layer is an application.
145 Suppose you are creating an application that has library or other dependencies in
146 order for it to compile and run.
147 The layer, in this case, would be where all the recipes that define those dependencies
148 are kept.
149 The key point for a layer is that it is an isolated area that contains
150 all the relevant information for the project that the OpenEmbedded build
151 system knows about.
152 For more information on layers, see the
153 "<link linkend='understanding-and-creating-layers'>Understanding and Creating Layers</link>"
154 section.
155 For more information on BSP layers, see the
156 "<ulink url='&YOCTO_DOCS_BSP_URL;#bsp-layers'>BSP Layers</ulink>" section in the
157 Yocto Project Board Support Package (BSP) Developer's Guide.</para>
158 <note>Five BSPs exist that are part of the
159 Yocto Project release: <filename>genericx86</filename>, <filename>genericx86-64</filename>,
160 <filename>beaglebone</filename>,
161 <filename>mpc8315e</filename>, and <filename>edgerouter</filename>.
162 The recipes and configurations for these five BSPs are located and dispersed
163 within the <link linkend='source-directory'>Source Directory</link>.
164 On the other hand, BSP layers for Crown Bay,
165 Crystal Forest, Emenlow, Fish River Island 2, Haswell,
166 Jasper Forest, NUC DC3217IYE,
167 Romley, Sugar Bay, and tlk exist in their own separate layers
168 within the larger <filename>meta-intel</filename> layer.</note>
169 <para>When you set up a layer for a new BSP, you should follow a standard layout.
170 This layout is described in the
171 "<ulink url='&YOCTO_DOCS_BSP_URL;#bsp-filelayout'>Example Filesystem Layout</ulink>"
172 section of the Board Support Package (BSP) Development Guide.
173 In the standard layout, you will notice a suggested structure for recipes and
174 configuration information.
175 You can see the standard layout for a BSP by examining
176 any supported BSP found in the <filename>meta-intel</filename> layer inside
177 the Source Directory.</para></listitem>
178 <listitem><para><emphasis>Make configuration changes to your new BSP
179 layer</emphasis>: The standard BSP layer structure organizes the files you need
180 to edit in <filename>conf</filename> and several <filename>recipes-*</filename>
181 directories within the BSP layer.
182 Configuration changes identify where your new layer is on the local system
183 and identify which kernel you are going to use.
184 When you run the <filename>yocto-bsp</filename> script, you are able to interactively
185 configure many things for the BSP (e.g. keyboard, touchscreen, and so forth).
186 </para></listitem>
187 <listitem><para><emphasis>Make recipe changes to your new BSP layer</emphasis>: Recipe
188 changes include altering recipes (<filename>.bb</filename> files), removing
189 recipes you do not use, and adding new recipes or append files
190 (<filename>.bbappend</filename>) that you need to support your hardware.
191 </para></listitem>
192 <listitem><para><emphasis>Prepare for the build</emphasis>: Once you have made all the
193 changes to your BSP layer, there remains a few things
194 you need to do for the OpenEmbedded build system in order for it to create your image.
195 You need to get the build environment ready by sourcing an environment setup script
196 (i.e. <filename>oe-init-build-env</filename> or
197 <filename>oe-init-build-env-memres</filename>)
198 and you need to be sure two key configuration files are configured appropriately:
199 the <filename>conf/local.conf</filename> and the
200 <filename>conf/bblayers.conf</filename> file.
201 You must make the OpenEmbedded build system aware of your new layer.
202 See the
203 "<link linkend='enabling-your-layer'>Enabling Your Layer</link>" section
204 for information on how to let the build system know about your new layer.</para>
205 <para>The entire process for building an image is overviewed in the section
206 "<ulink url='&YOCTO_DOCS_QS_URL;#building-image'>Building an Image</ulink>" section
207 of the Yocto Project Quick Start.
208 You might want to reference this information.</para></listitem>
209 <listitem><para><emphasis>Build the image</emphasis>: The OpenEmbedded build system
210 uses the BitBake tool to build images based on the type of image you want to create.
211 You can find more information about BitBake in the
212 <ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
213 </para>
214 <para>The build process supports several types of images to satisfy different needs.
215 See the
216 "<ulink url='&YOCTO_DOCS_REF_URL;#ref-images'>Images</ulink>" chapter
217 in the Yocto Project Reference Manual for information on
218 supported images.</para></listitem>
219 </orderedlist>
220 </para>
222 <para>
223 You can view a video presentation on "Building Custom Embedded Images with Yocto"
224 at <ulink url=''>Free Electrons</ulink>.
225 After going to the page, just search for "Embedded".
226 You can also find supplemental information in the
227 <ulink url='&YOCTO_DOCS_BSP_URL;'>
228 Yocto Project Board Support Package (BSP) Developer's Guide</ulink>.
229 Finally, there is a wiki page write up of the example also located
230 <ulink url='&YOCTO_WIKI_URL;/wiki/Transcript:_creating_one_generic_Atom_BSP_from_another'>
231 here</ulink> that you might find helpful.
232 </para>
233 </section>
235 <section id='modifying-the-kernel'>
236 <title><anchor id='kernel-spot' />Modifying the Kernel</title>
238 <para>
239 Kernel modification involves changing the Yocto Project kernel, which could involve changing
240 configuration options as well as adding new kernel recipes.
241 Configuration changes can be added in the form of configuration fragments, while recipe
242 modification comes through the kernel's <filename>recipes-kernel</filename> area
243 in a kernel layer you create.
244 </para>
246 <para>
247 The remainder of this section presents a high-level overview of the Yocto Project
248 kernel architecture and the steps to modify the kernel.
249 You can reference the
250 "<link linkend='patching-the-kernel'>Patching the Kernel</link>" section
251 for an example that changes the source code of the kernel.
252 For information on how to configure the kernel, see the
253 "<link linkend='configuring-the-kernel'>Configuring the Kernel</link>" section.
254 For more information on the kernel and on modifying the kernel, see the
255 <ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;'>Yocto Project Linux Kernel Development Manual</ulink>.
256 </para>
258 <section id='kernel-overview'>
259 <title>Kernel Overview</title>
261 <para>
262 Traditionally, when one thinks of a patched kernel, they think of a base kernel
263 source tree and a fixed structure that contains kernel patches.
264 The Yocto Project, however, employs mechanisms that, in a sense, result in a kernel source
265 generator.
266 By the end of this section, this analogy will become clearer.
267 </para>
269 <para>
270 You can find a web interface to the Yocto Project kernel source repositories at
271 <ulink url='&YOCTO_GIT_URL;'></ulink>.
272 If you look at the interface, you will see to the left a grouping of
273 Git repositories titled "Yocto Linux Kernel."
274 Within this group, you will find several kernels supported by
275 the Yocto Project:
276 <itemizedlist>
277 <listitem><para><emphasis><filename>linux-yocto-3.4</filename></emphasis> - The
278 stable Yocto Project kernel to use with the Yocto Project Release 1.3. This kernel
279 is based on the Linux 3.4 released kernel.</para></listitem>
280 <listitem><para><emphasis><filename>linux-yocto-3.8</filename></emphasis> - The
281 stable Yocto Project kernel to use with the Yocto Project Release 1.4. This kernel
282 is based on the Linux 3.8 released kernel.</para></listitem>
283 <listitem><para><emphasis><filename>linux-yocto-3.10</filename></emphasis> - The
284 stable Yocto Project kernel to use with the Yocto Project Release 1.5. This kernel
285 is based on the Linux 3.10 released kernel.</para></listitem>
286 <listitem><para><emphasis><filename>linux-yocto-3.14</filename></emphasis> - The
287 stable Yocto Project kernel to use with the Yocto Project Release 1.6. This kernel
288 is based on the Linux 3.14 released kernel.</para></listitem>
289 <listitem><para><emphasis><filename>linux-yocto-dev</filename></emphasis> - A development
290 kernel based on the latest upstream release candidate available.</para></listitem>
291 </itemizedlist>
292 </para>
294 <para>
295 The kernels are maintained using the Git revision control system
296 that structures them using the familiar "tree", "branch", and "leaf" scheme.
297 Branches represent diversions from general code to more specific code, while leaves
298 represent the end-points for a complete and unique kernel whose source files,
299 when gathered from the root of the tree to the leaf, accumulate to create the files
300 necessary for a specific piece of hardware and its features.
301 The following figure displays this concept:
302 <para>
303 <imagedata fileref="figures/kernel-overview-1.png"
304 width="6in" depth="6in" align="center" scale="100" />
305 </para>
307 <para>
308 Within the figure, the " Branch Point" represents the point in the tree
309 where a supported base kernel is modified from the Linux kernel.
310 For example, this could be the branch point for the <filename>linux-yocto-3.4</filename>
311 kernel.
312 Thus, everything further to the right in the structure is based on the
313 <filename>linux-yocto-3.4</filename> kernel.
314 Branch points to right in the figure represent where the
315 <filename>linux-yocto-3.4</filename> kernel is modified for specific hardware
316 or types of kernels, such as real-time kernels.
317 Each leaf thus represents the end-point for a kernel designed to run on a specific
318 targeted device.
319 </para>
321 <para>
322 The overall result is a Git-maintained repository from which all the supported
323 kernel types can be derived for all the supported devices.
324 A big advantage to this scheme is the sharing of common features by keeping them in
325 "larger" branches within the tree.
326 This practice eliminates redundant storage of similar features shared among kernels.
327 </para>
329 <note>
330 Keep in mind the figure does not take into account all the supported Yocto
331 Project kernel types, but rather shows a single generic kernel just for conceptual purposes.
332 Also keep in mind that this structure represents the Yocto Project source repositories
333 that are either pulled from during the build or established on the host development system
334 prior to the build by either cloning a particular kernel's Git repository or by
335 downloading and unpacking a tarball.
336 </note>
338 <para>
339 Upstream storage of all the available kernel source code is one thing, while
340 representing and using the code on your host development system is another.
341 Conceptually, you can think of the kernel source repositories as all the
342 source files necessary for all the supported kernels.
343 As a developer, you are just interested in the source files for the kernel on
344 which you are working.
345 And, furthermore, you need them available on your host system.
346 </para>
348 <para>
349 Kernel source code is available on your host system a couple of different
350 ways.
351 If you are working in the kernel all the time, you probably would want
352 to set up your own local Git repository of the kernel tree.
353 If you just need to make some patches to the kernel, you can access
354 temporary kernel source files that were extracted and used
355 during a build.
356 We will just talk about working with the temporary source code.
357 For more information on how to get kernel source code onto your
358 host system, see the
359 "<link linkend='local-kernel-files'>Yocto Project Kernel</link>"
360 bulleted item earlier in the manual.
361 </para>
363 <para>
364 What happens during the build?
365 When you build the kernel on your development system, all files needed for the build
366 are taken from the source repositories pointed to by the
367 <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink> variable
368 and gathered in a temporary work area
369 where they are subsequently used to create the unique kernel.
370 Thus, in a sense, the process constructs a local source tree specific to your
371 kernel to generate the new kernel image - a source generator if you will.
372 </para>
373 The following figure shows the temporary file structure
374 created on your host system when the build occurs.
375 This
376 <link linkend='build-directory'>Build Directory</link> contains all the
377 source files used during the build.
378 </para>
380 <para>
381 <imagedata fileref="figures/kernel-overview-2-generic.png"
382 width="6in" depth="5in" align="center" scale="100" />
383 </para>
385 <para>
386 Again, for additional information on the Yocto Project kernel's
387 architecture and its branching strategy, see the
388 <ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;'>Yocto Project Linux Kernel Development Manual</ulink>.
389 You can also reference the
390 "<link linkend='patching-the-kernel'>Patching the Kernel</link>"
391 section for a detailed example that modifies the kernel.
392 </para>
393 </section>
395 <section id='kernel-modification-workflow'>
396 <title>Kernel Modification Workflow</title>
398 <para>
399 This illustration and the following list summarizes the kernel modification general workflow.
400 </para>
402 <para>
403 <imagedata fileref="figures/kernel-dev-flow.png"
404 width="6in" depth="5in" align="center" scalefit="1" />
405 </para>
407 <para>
408 <orderedlist>
409 <listitem><para><emphasis>Set up your host development system to support
410 development using the Yocto Project</emphasis>: See
411 "<ulink url='&YOCTO_DOCS_QS_URL;#the-linux-distro'>The Linux Distribution</ulink>" and
412 "<ulink url='&YOCTO_DOCS_QS_URL;#packages'>The Packages</ulink>" sections both
413 in the Yocto Project Quick Start for requirements.</para></listitem>
414 <listitem><para><emphasis>Establish a local copy of project files on your
415 system</emphasis>: Having the <link linkend='source-directory'>Source
416 Directory</link> on your system gives you access to the build process and tools
417 you need.
418 For information on how to get these files, see the bulleted item
419 "<link linkend='local-yp-release'>Yocto Project Release</link>" earlier in this manual.
420 </para></listitem>
421 <listitem><para><emphasis>Establish the temporary kernel source files</emphasis>:
422 Temporary kernel source files are kept in the
423 <link linkend='build-directory'>Build Directory</link>
424 created by the
425 OpenEmbedded build system when you run BitBake.
426 If you have never built the kernel in which you are
427 interested, you need to run an initial build to
428 establish local kernel source files.</para>
429 <para>If you are building an image for the first time, you need to get the build
430 environment ready by sourcing an environment setup script
431 (i.e. <filename>oe-init-build-env</filename> or
432 <filename>oe-init-build-env-memres</filename>).
433 You also need to be sure two key configuration files
434 (<filename>local.conf</filename> and <filename>bblayers.conf</filename>)
435 are configured appropriately.</para>
436 <para>The entire process for building an image is overviewed in the
437 "<ulink url='&YOCTO_DOCS_QS_URL;#building-image'>Building an Image</ulink>"
438 section of the Yocto Project Quick Start.
439 You might want to reference this information.
440 You can find more information on BitBake in the
441 <ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
442 </para>
443 <para>The build process supports several types of images to satisfy different needs.
444 See the "<ulink url='&YOCTO_DOCS_REF_URL;#ref-images'>Images</ulink>" chapter in
445 the Yocto Project Reference Manual for information on supported images.
446 </para></listitem>
447 <listitem><para><emphasis>Make changes to the kernel source code if
448 applicable</emphasis>: Modifying the kernel does not always mean directly
449 changing source files.
450 However, if you have to do this, you make the changes to the files in the
451 Build Directory.</para></listitem>
452 <listitem><para><emphasis>Make kernel configuration changes
453 if applicable</emphasis>:
454 If your situation calls for changing the kernel's configuration, you can
455 use the <filename>yocto-kernel</filename> script or <filename>menuconfig</filename>
456 to enable and disable kernel configurations.
457 Using the script lets you interactively set up kernel configurations.
458 Using <filename>menuconfig</filename> allows you to interactively develop and test the
459 configuration changes you are making to the kernel.
460 When saved, changes using <filename>menuconfig</filename> update the kernel's
461 <filename>.config</filename> file.
462 Try to resist the temptation of directly editing the <filename>.config</filename>
463 file found in the Build Directory at
464 <filename>tmp/sysroots/&lt;machine-name&gt;/kernel</filename>.
465 Doing so, can produce unexpected results when the OpenEmbedded build system
466 regenerates the configuration file.</para>
467 <para>Once you are satisfied with the configuration changes made using
468 <filename>menuconfig</filename>, you can directly compare the
469 <filename>.config</filename> file against a saved original and gather those
470 changes into a config fragment to be referenced from within the kernel's
471 <filename>.bbappend</filename> file.</para></listitem>
472 <listitem><para><emphasis>Rebuild the kernel image with your changes</emphasis>:
473 Rebuilding the kernel image applies your changes.</para></listitem>
474 </orderedlist>
475 </para>
476 </section>
477 </section>
480<section id='application-development-workflow'>
481 <title>Application Development Workflow</title>
483 <para>
484 Application development involves creating an application that you want
485 to run on your target hardware, which is running a kernel image created using the
486 OpenEmbedded build system.
487 The Yocto Project provides an
488 <ulink url='&YOCTO_DOCS_ADT_URL;#adt-intro'>Application Development Toolkit (ADT)</ulink>
489 and stand-alone
490 <ulink url='&YOCTO_DOCS_ADT_URL;#the-cross-development-toolchain'>cross-development toolchains</ulink>
491 that facilitate quick development and integration of your application into its runtime environment.
492 Using the ADT and toolchains, you can compile and link your application.
493 You can then deploy your application to the actual hardware or to the QEMU emulator for testing.
494 If you are familiar with the popular <trademark class='trade'>Eclipse</trademark> IDE,
495 you can use an Eclipse Yocto Plug-in to
496 allow you to develop, deploy, and test your application all from within Eclipse.
497 </para>
499 <para>
500 While we strongly suggest using the ADT to develop your application, this option might not
501 be best for you.
502 If this is the case, you can still use pieces of the Yocto Project for your development process.
503 However, because the process can vary greatly, this manual does not provide detail on the process.
504 </para>
506 <section id='workflow-using-the-adt-and-eclipse'>
507 <title>Workflow Using the ADT and <trademark class='trade'>Eclipse</trademark></title>
509 <para>
510 To help you understand how application development works using the ADT, this section
511 provides an overview of the general development process and a detailed example of the process
512 as it is used from within the Eclipse IDE.
513 </para>
515 <para>
516 The following illustration and list summarize the application development general workflow.
517 </para>
519 <para>
520 <imagedata fileref="figures/app-dev-flow.png"
521 width="7in" depth="8in" align="center" scale="100" />
522 </para>
524 <para>
525 <orderedlist>
526 <listitem><para><emphasis>Prepare the host system for the Yocto Project</emphasis>:
527 See
528 "<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>"
529 and
530 "<ulink url='&YOCTO_DOCS_REF_URL;#required-packages-for-the-host-development-system'>Required Packages for the Host Development System</ulink>" sections both
531 in the Yocto Project Reference Manual for requirements.
532 In particular, be sure your host system has the
533 <filename>xterm</filename> package installed.
534 </para></listitem>
535 <listitem><para><emphasis>Secure the Yocto Project kernel target image</emphasis>:
536 You must have a target kernel image that has been built using the OpenEmbedded
537 build system.</para>
538 <para>Depending on whether the Yocto Project has a pre-built image that matches your target
539 architecture and where you are going to run the image while you develop your application
540 (QEMU or real hardware), the area from which you get the image differs.
541 <itemizedlist>
542 <listitem><para>Download the image from
543 <ulink url='&YOCTO_MACHINES_DL_URL;'><filename>machines</filename></ulink>
544 if your target architecture is supported and you are going to develop
545 and test your application on actual hardware.</para></listitem>
546 <listitem><para>Download the image from
547 <ulink url='&YOCTO_QEMU_DL_URL;'>
548 <filename>machines/qemu</filename></ulink> if your target architecture is supported
549 and you are going to develop and test your application using the QEMU
550 emulator.</para></listitem>
551 <listitem><para>Build your image if you cannot find a pre-built image that matches
552 your target architecture.
553 If your target architecture is similar to a supported architecture, you can
554 modify the kernel image before you build it.
555 See the
556 "<link linkend='patching-the-kernel'>Patching the Kernel</link>"
557 section for an example.</para></listitem>
558 </itemizedlist></para>
559 <para>For information on pre-built kernel image naming schemes for images
560 that can run on the QEMU emulator, see the
561 "<ulink url='&YOCTO_DOCS_QS_URL;#downloading-the-pre-built-linux-kernel'>Downloading the Pre-Built Linux Kernel</ulink>"
562 section in the Yocto Project Quick Start.</para></listitem>
563 <listitem><para><emphasis>Install the ADT</emphasis>:
564 The ADT provides a target-specific cross-development toolchain, the root filesystem,
565 the QEMU emulator, and other tools that can help you develop your application.
566 While it is possible to get these pieces separately, the ADT Installer provides an
567 easy, inclusive method.
568 You can get these pieces by running an ADT installer script, which is configurable.
569 For information on how to install the ADT, see the
570 "<ulink url='&YOCTO_DOCS_ADT_URL;#using-the-adt-installer'>Using the ADT Installer</ulink>"
571 section
572 in the Yocto Project Application Developer's Guide.</para></listitem>
573 <listitem><para><emphasis>If applicable, secure the target root filesystem
574 and the Cross-development toolchain</emphasis>:
575 If you choose not to install the ADT using the ADT Installer,
576 you need to find and download the appropriate root filesystem and
577 the cross-development toolchain.</para>
578 <para>You can find the tarballs for the root filesystem in the same area used
579 for the kernel image.
580 Depending on the type of image you are running, the root filesystem you need differs.
581 For example, if you are developing an application that runs on an image that
582 supports Sato, you need to get a root filesystem that supports Sato.</para>
583 <para>You can find the cross-development toolchains at
584 <ulink url='&YOCTO_TOOLCHAIN_DL_URL;'><filename>toolchains</filename></ulink>.
585 Be sure to get the correct toolchain for your development host and your
586 target architecture.
587 See the "<ulink url='&YOCTO_DOCS_ADT_URL;#using-an-existing-toolchain-tarball'>Using a Cross-Toolchain Tarball</ulink>"
588 section in the Yocto Project Application Developer's Guide for information
589 and the
590 "<ulink url='&YOCTO_DOCS_QS_URL;#installing-the-toolchain'>Installing the Toolchain</ulink>"
591 in the Yocto Project Quick Start for information on finding and installing
592 the correct toolchain based on your host development system and your target
593 architecture.
594 </para></listitem>
595 <listitem><para><emphasis>Create and build your application</emphasis>:
596 At this point, you need to have source files for your application.
597 Once you have the files, you can use the Eclipse IDE to import them and build the
598 project.
599 If you are not using Eclipse, you need to use the cross-development tools you have
600 installed to create the image.</para></listitem>
601 <listitem><para><emphasis>Deploy the image with the application</emphasis>:
602 If you are using the Eclipse IDE, you can deploy your image to the hardware or to
603 QEMU through the project's preferences.
604 If you are not using the Eclipse IDE, then you need to deploy the application
605 to the hardware using other methods.
606 Or, if you are using QEMU, you need to use that tool and load your image in for testing.
607 </para></listitem>
608 <listitem><para><emphasis>Test and debug the application</emphasis>:
609 Once your application is deployed, you need to test it.
610 Within the Eclipse IDE, you can use the debugging environment along with the
611 set of user-space tools installed along with the ADT to debug your application.
612 Of course, the same user-space tools are available separately if you choose
613 not to use the Eclipse IDE.</para></listitem>
614 </orderedlist>
615 </para>
616 </section>
618 <section id='adt-eclipse'>
619 <title>Working Within Eclipse</title>
621 <para>
622 The Eclipse IDE is a popular development environment and it fully
623 supports development using the Yocto Project.
624 <note>
625 This release of the Yocto Project supports both the Kepler
626 and Juno versions of the Eclipse IDE.
627 Thus, the following information provides setup information for
628 both versions.
629 </note>
630 </para>
632 <para>
633 When you install and configure the Eclipse Yocto Project Plug-in
634 into the Eclipse IDE, you maximize your Yocto Project experience.
635 Installing and configuring the Plug-in results in an environment
636 that has extensions specifically designed to let you more easily
637 develop software.
638 These extensions allow for cross-compilation, deployment, and
639 execution of your output into a QEMU emulation session as well as
640 actual target hardware.
641 You can also perform cross-debugging and profiling.
642 The environment also supports a suite of tools that allows you
643 to perform remote profiling, tracing, collection of power data,
644 collection of latency data, and collection of performance data.
645 </para>
647 <para>
648 This section describes how to install and configure the Eclipse IDE
649 Yocto Plug-in and how to use it to develop your application.
650 </para>
652 <section id='setting-up-the-eclipse-ide'>
653 <title>Setting Up the Eclipse IDE</title>
655 <para>
656 To develop within the Eclipse IDE, you need to do the following:
657 <orderedlist>
658 <listitem><para>Install the optimal version of the Eclipse
659 IDE.</para></listitem>
660 <listitem><para>Configure the Eclipse IDE.
661 </para></listitem>
662 <listitem><para>Install the Eclipse Yocto Plug-in.
663 </para></listitem>
664 <listitem><para>Configure the Eclipse Yocto Plug-in.
665 </para></listitem>
666 </orderedlist>
667 <note>
668 Do not install Eclipse from your distribution's package
669 repository.
670 Be sure to install Eclipse from the official Eclipse
671 download site as directed in the next section.
672 </note>
673 </para>
675 <section id='installing-eclipse-ide'>
676 <title>Installing the Eclipse IDE</title>
678 <para>
679 It is recommended that you have the Kepler 4.3.2 version of
680 the Eclipse IDE installed on your development system.
681 However, if you currently have the Juno 4.2 version
682 installed and you do not want to upgrade the IDE, you can
683 configure Juno to work with the Yocto Project.
684 </para>
686 <para>
687 If you do not have the Kepler 4.3.2 Eclipse IDE installed,
688 you can find the tarball at
689 <ulink url='&ECLIPSE_MAIN_URL;'></ulink>.
690 From that site, choose the Eclipse Standard 4.3.2 version
691 particular to your development host.
692 This version contains the Eclipse Platform, the Java
693 Development Tools (JDT), and the Plug-in Development
694 Environment.
695 </para>
697 <para>
698 Once you have downloaded the tarball, extract it into a
699 clean directory.
700 For example, the following commands unpack and install the
701 downloaded Eclipse IDE tarball into a clean directory
702 using the default name <filename>eclipse</filename>:
703 <literallayout class='monospaced'>
704 $ cd ~
705 $ tar -xzvf ~/Downloads/eclipse-standard-kepler-SR2-linux-gtk-x86_64.tar.gz
706 </literallayout>
707 </para>
708 </section>
710 <section id='configuring-the-eclipse-ide'>
711 <title>Configuring the Eclipse IDE</title>
713 <para>
714 This section presents the steps needed to configure the
715 Eclipse IDE.
716 </para>
718 <para>
719 Before installing and configuring the Eclipse Yocto Plug-in,
720 you need to configure the Eclipse IDE.
721 Follow these general steps:
722 <orderedlist>
723 <listitem><para>Start the Eclipse IDE.</para></listitem>
724 <listitem><para>Make sure you are in your Workbench and
725 select "Install New Software" from the "Help"
726 pull-down menu.</para></listitem>
727 <listitem><para>Select
728 <filename>Kepler - &ECLIPSE_KEPLER_URL;</filename>
729 from the "Work with:" pull-down menu.
730 <note>
731 For Juno, select
732 <filename>Juno - &ECLIPSE_JUNO_URL;</filename>
733 </note>
734 </para></listitem>
735 <listitem><para>Expand the box next to "Linux Tools"
736 and select the
737 <filename>LTTng - Linux Tracing Toolkit</filename>
738 boxes.</para></listitem>
739 <listitem><para>Expand the box next to "Mobile and
740 Device Development" and select the following boxes:
741 <itemizedlist>
742 <listitem><para><filename>C/C++ Remote Launch (Requires RSE Remote System Explorer)</filename></para></listitem>
743 <listitem><para><filename>Remote System Explorer End-user Runtime</filename></para></listitem>
744 <listitem><para><filename>Remote System Explorer User Actions</filename></para></listitem>
745 <listitem><para><filename>Target Management Terminal</filename></para></listitem>
746 <listitem><para><filename>TCF Remote System Explorer add-in</filename></para></listitem>
747 <listitem><para><filename>TCF Target Explorer</filename></para></listitem>
748 </itemizedlist></para></listitem>
749 <listitem><para>Expand the box next to "Programming
750 Languages" and select the
751 <filename>C/C++ Autotools Support</filename>
752 and <filename>C/C++ Development Tools</filename>
753 boxes.</para></listitem>
754 <listitem><para>Complete the installation and restart
755 the Eclipse IDE.</para></listitem>
756 </orderedlist>
757 </para>
758 </section>
760 <section id='installing-the-eclipse-yocto-plug-in'>
761 <title>Installing or Accessing the Eclipse Yocto Plug-in</title>
763 <para>
764 You can install the Eclipse Yocto Plug-in into the Eclipse
765 IDE one of two ways: use the Yocto Project's Eclipse
766 Update site to install the pre-built plug-in or build and
767 install the plug-in from the latest source code.
768 </para>
770 <section id='new-software'>
771 <title>Installing the Pre-built Plug-in from the Yocto Project Eclipse Update Site</title>
773 <para>
774 To install the Eclipse Yocto Plug-in from the update
775 site, follow these steps:
776 <orderedlist>
777 <listitem><para>Start up the Eclipse IDE.
778 </para></listitem>
779 <listitem><para>In Eclipse, select "Install New
780 Software" from the "Help" menu.
781 </para></listitem>
782 <listitem><para>Click "Add..." in the "Work with:"
783 area.</para></listitem>
784 <listitem><para>Enter
785 <filename>&ECLIPSE_DL_PLUGIN_URL;/kepler</filename>
786 in the URL field and provide a meaningful name
787 in the "Name" field.
788 <note>
789 If you are using Juno, use
790 <filename>&ECLIPSE_DL_PLUGIN_URL;/juno</filename>
791 in the URL field.
792 </note></para></listitem>
793 <listitem><para>Click "OK" to have the entry added
794 to the "Work with:" drop-down list.
795 </para></listitem>
796 <listitem><para>Select the entry for the plug-in
797 from the "Work with:" drop-down list.
798 </para></listitem>
799 <listitem><para>Check the boxes next to
800 <filename>Yocto Project ADT Plug-in</filename>,
801 <filename>Yocto Project Bitbake Commander Plug-in</filename>,
802 and
803 <filename>Yocto Project Documentation plug-in</filename>.
804 </para></listitem>
805 <listitem><para>Complete the remaining software
806 installation steps and then restart the Eclipse
807 IDE to finish the installation of the plug-in.
808 </para></listitem>
809 </orderedlist>
810 </para>
811 </section>
813 <section id='zip-file-method'>
814 <title>Installing the Plug-in Using the Latest Source Code</title>
816 <para>
817 To install the Eclipse Yocto Plug-in from the latest
818 source code, follow these steps:
819 <orderedlist>
820 <listitem><para>Be sure your development system
821 is not using OpenJDK to build the plug-in
822 by doing the following:
823 <orderedlist>
824 <listitem><para>Use the Oracle JDK.
825 If you don't have that, go to
826 <ulink url=''></ulink>
827 and download the appropriate tarball
828 for your development system and
829 extract it into your home directory.
830 </para></listitem>
831 <listitem><para>In the shell you are going
832 to do your work, export the location of
833 the Oracle Java as follows:
834 <literallayout class='monospaced'>
835 export PATH=~/jdk1.7.0_40/bin:$PATH
836 </literallayout></para></listitem>
837 </orderedlist></para></listitem>
838 <listitem><para>In the same shell, create a Git
839 repository with:
840 <literallayout class='monospaced'>
841 $ cd ~
842 $ git clone git://
843 </literallayout>
844 <note>
845 If you are using Juno, the repository is
846 located at
847 <filename>git://</filename>.
848 </note>
849 For this example, the repository is named
850 <filename>~/eclipse-poky-kepler</filename>.
851 </para></listitem>
852 <listitem><para>Change to the directory where you
853 set up the Git repository:
854 <literallayout class='monospaced'>
855 $ cd ~/eclipse-poky-kepler
856 </literallayout></para></listitem>
857 <listitem><para>Be sure you are in the right branch
858 for your Git repository.
859 For this release set the branch to
860 <filename>&DISTRO_NAME;</filename>:
861 <literallayout class='monospaced'>
862 $ git checkout &DISTRO_NAME;
863 </literallayout></para></listitem>
864 <listitem><para>Change to the
865 <filename>scripts</filename>
866 directory within the Git repository:
867 <literallayout class='monospaced'>
868 $ cd scripts
869 </literallayout></para></listitem>
870 <listitem><para>Set up the local build environment
871 by running the setup script:
872 <literallayout class='monospaced'>
873 $ ./
874 </literallayout></para></listitem>
875 <listitem><para>When the script finishes execution,
876 it prompts you with instructions on how to run
877 the <filename></filename> script, which
878 is also in the <filename>scripts</filename>
879 directory of
880 the Git repository created earlier.
881 </para></listitem>
882 <listitem><para>Run the <filename></filename> script
883 as directed.
884 Be sure to provide the name of the Git branch
885 along with the Yocto Project release you are
886 using.
887 Here is an example that uses the
888 <filename>&DISTRO_NAME;</filename> branch:
889 <literallayout class='monospaced'>
890 $ ECLIPSE_HOME=/home/scottrif/eclipse-poky-kepler/scripts/eclipse ./ &DISTRO_NAME; &DISTRO_NAME;
891 </literallayout>
892 After running the script, the file
893 <filename>org.yocto.sdk-&lt;release&gt;-&lt;date&gt;</filename>
894 is in the current directory.</para></listitem>
895 <listitem><para>If necessary, start the Eclipse IDE
896 and be sure you are in the Workbench.
897 </para></listitem>
898 <listitem><para>Select "Install New Software" from the "Help" pull-down menu.
899 </para></listitem>
900 <listitem><para>Click "Add".</para></listitem>
901 <listitem><para>Provide anything you want in the
902 "Name" field.</para></listitem>
903 <listitem><para>Click "Archive" and browse to the
904 ZIP file you built in step eight.
905 This ZIP file should not be "unzipped", and must
906 be the <filename>*</filename> file
907 created by running the
908 <filename></filename> script.
909 </para></listitem>
910 <listitem><para>Click through the "Okay" buttons.
911 </para></listitem>
912 <listitem><para>Check the boxes
913 in the installation window and complete
914 the installation.</para></listitem>
915 <listitem><para>Restart the Eclipse IDE if
916 necessary.</para></listitem>
917 </orderedlist>
918 </para>
920 <para>
921 At this point you should be able to configure the
922 Eclipse Yocto Plug-in as described in the
923 "<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring the Eclipse Yocto Plug-in</link>"
924 section.</para>
925 </section>
926 </section>
928 <section id='configuring-the-eclipse-yocto-plug-in'>
929 <title>Configuring the Eclipse Yocto Plug-in</title>
931 <para>
932 Configuring the Eclipse Yocto Plug-in involves setting the
933 Cross Compiler options and the Target options.
934 The configurations you choose become the default settings
935 for all projects.
936 You do have opportunities to change them later when
937 you configure the project (see the following section).
938 </para>
940 <para>
941 To start, you need to do the following from within the
942 Eclipse IDE:
943 <itemizedlist>
944 <listitem><para>Choose "Preferences" from the
945 "Windows" menu to display the Preferences Dialog.
946 </para></listitem>
947 <listitem><para>Click "Yocto Project ADT".
948 </para></listitem>
949 </itemizedlist>
950 </para>
952 <section id='configuring-the-cross-compiler-options'>
953 <title>Configuring the Cross-Compiler Options</title>
955 <para>
956 To configure the Cross Compiler Options, you must select
957 the type of toolchain, point to the toolchain, specify
958 the sysroot location, and select the target
959 architecture.
960 <itemizedlist>
961 <listitem><para><emphasis>Selecting the Toolchain Type:</emphasis>
962 Choose between
963 <filename>Standalone pre-built toolchain</filename>
964 and
965 <filename>Build system derived toolchain</filename>
966 for Cross Compiler Options.
967 <itemizedlist>
968 <listitem><para><emphasis>
969 <filename>Standalone Pre-built Toolchain:</filename></emphasis>
970 Select this mode when you are using
971 a stand-alone cross-toolchain.
972 For example, suppose you are an
973 application developer and do not
974 need to build a target image.
975 Instead, you just want to use an
976 architecture-specific toolchain on
977 an existing kernel and target root
978 filesystem.</para></listitem>
979 <listitem><para><emphasis>
980 <filename>Build System Derived Toolchain:</filename></emphasis>
981 Select this mode if the
982 cross-toolchain has been installed
983 and built as part of the
984 <link linkend='build-directory'>Build Directory</link>.
985 When you select
986 <filename>Build system derived toolchain</filename>,
987 you are using the toolchain bundled
988 inside the Build Directory.
989 </para></listitem>
990 </itemizedlist>
991 </para></listitem>
992 <listitem><para><emphasis>Point to the Toolchain:</emphasis>
993 If you are using a stand-alone pre-built
994 toolchain, you should be pointing to where it is
995 installed.
996 If you used the ADT Installer script and
997 accepted the default installation directory, the
998 toolchain will be installed in the
999 <filename>&YOCTO_ADTPATH_DIR;</filename>
1000 directory.
1001 Sections "<ulink url='&YOCTO_DOCS_ADT_URL;#configuring-and-running-the-adt-installer-script'>Configuring and Running the ADT Installer Script</ulink>"
1002 and
1003 "<ulink url='&YOCTO_DOCS_ADT_URL;#using-an-existing-toolchain-tarball'>Using a Cross-Toolchain Tarball</ulink>"
1004 in the Yocto Project Application Developer's
1005 Guide describe how to install a stand-alone
1006 cross-toolchain.</para>
1007 <para>If you are using a system-derived
1008 toolchain, the path you provide for the
1009 <filename>Toolchain Root Location</filename>
1010 field is the
1011 <link linkend='build-directory'>Build Directory</link>.
1012 See the
1013 "<ulink url='&YOCTO_DOCS_ADT_URL;#using-the-toolchain-from-within-the-build-tree'>Using BitBake and the Build Directory</ulink>"
1014 section in the Yocto Project Application
1015 Developer's Guide for information on how to
1016 install the toolchain into the Build
1017 Directory.</para></listitem>
1018 <listitem><para><emphasis>Specify the Sysroot Location:</emphasis>
1019 This location is where the root filesystem for
1020 the target hardware resides.
1021 If you used the ADT Installer script and
1022 accepted the default installation directory,
1023 then the location is
1024 <filename>/opt/poky/&DISTRO;</filename>.
1025 Additionally, when you use the ADT Installer
1026 script, the same location is used for the QEMU
1027 user-space tools and the NFS boot process.
1028 </para>
1029 <para>If you used either of the other two
1030 methods to install the toolchain or did not
1031 accept the ADT Installer script's default
1032 installation directory, then the location of
1033 the sysroot filesystem depends on where you
1034 separately extracted and installed the
1035 filesystem.</para>
1036 <para>For information on how to install the
1037 toolchain and on how to extract and install the
1038 sysroot filesystem, see the
1039 "<ulink url='&YOCTO_DOCS_ADT_URL;#installing-the-adt'>Installing the ADT and Toolchains</ulink>"
1040 section in the Yocto Project Application
1041 Developer's Guide.
1042 </para></listitem>
1043 <listitem><para><emphasis>Select the Target Architecture:</emphasis>
1044 The target architecture is the type of hardware
1045 you are going to use or emulate.
1046 Use the pull-down
1047 <filename>Target Architecture</filename> menu
1048 to make your selection.
1049 The pull-down menu should have the supported
1050 architectures.
1051 If the architecture you need is not listed in
1052 the menu, you will need to build the image.
1053 See the
1054 "<ulink url='&YOCTO_DOCS_QS_URL;#building-image'>Building an Image</ulink>"
1055 section of the Yocto Project Quick Start for
1056 more information.</para></listitem>
1057 </itemizedlist>
1058 </para>
1059 </section>
1061 <section id='configuring-the-target-options'>
1062 <title>Configuring the Target Options</title>
1064 <para>
1065 You can choose to emulate hardware using the QEMU
1066 emulator, or you can choose to run your image on actual
1067 hardware.
1068 <itemizedlist>
1069 <listitem><para><emphasis>QEMU:</emphasis>
1070 Select this option if you will be using the
1071 QEMU emulator.
1072 If you are using the emulator, you also need to
1073 locate the kernel and specify any custom
1074 options.</para>
1075 <para>If you selected
1076 <filename>Build system derived toolchain</filename>,
1077 the target kernel you built will be located in
1078 the Build Directory in
1079 <filename>tmp/deploy/images/&lt;machine&gt;</filename>
1080 directory.
1081 If you selected
1082 <filename>Standalone pre-built toolchain</filename>,
1083 the pre-built image you downloaded is located
1084 in the directory you specified when you
1085 downloaded the image.</para>
1086 <para>Most custom options are for advanced QEMU
1087 users to further customize their QEMU instance.
1088 These options are specified between paired
1089 angled brackets.
1090 Some options must be specified outside the
1091 brackets.
1092 In particular, the options
1093 <filename>serial</filename>,
1094 <filename>nographic</filename>, and
1095 <filename>kvm</filename> must all be outside the
1096 brackets.
1097 Use the <filename>man qemu</filename> command
1098 to get help on all the options and their use.
1099 The following is an example:
1100 <literallayout class='monospaced'>
1101 serial ‘&lt;-m 256 -full-screen&gt;’
1102 </literallayout></para>
1103 <para>
1104 Regardless of the mode, Sysroot is already
1105 defined as part of the Cross-Compiler Options
1106 configuration in the
1107 <filename>Sysroot Location:</filename> field.
1108 </para></listitem>
1109 <listitem><para><emphasis>External HW:</emphasis>
1110 Select this option if you will be using actual
1111 hardware.</para></listitem>
1112 </itemizedlist>
1113 </para>
1115 <para>
1116 Click the "OK" to save your plug-in configurations.
1117 </para>
1118 </section>
1119 </section>
1120 </section>
1122 <section id='creating-the-project'>
1123 <title>Creating the Project</title>
1125 <para>
1126 You can create two types of projects: Autotools-based, or
1127 Makefile-based.
1128 This section describes how to create Autotools-based projects
1129 from within the Eclipse IDE.
1130 For information on creating Makefile-based projects in a
1131 terminal window, see the section
1132 "<ulink url='&YOCTO_DOCS_ADT_URL;#using-the-command-line'>Using the Command Line</ulink>"
1133 in the Yocto Project Application Developer's Guide.
1134 <note>
1135 Do not use special characters in project names
1136 (e.g. spaces, underscores, etc.). Doing so can
1137 cause configuration to fail.
1138 </note>
1139 </para>
1141 <para>
1142 To create a project based on a Yocto template and then display
1143 the source code, follow these steps:
1144 <orderedlist>
1145 <listitem><para>Select "Project" from the "File -> New" menu.
1146 </para></listitem>
1147 <listitem><para>Double click <filename>CC++</filename>.
1148 </para></listitem>
1149 <listitem><para>Double click <filename>C Project</filename>
1150 to create the project.</para></listitem>
1151 <listitem><para>Expand <filename>Yocto Project ADT Project</filename>.
1152 </para></listitem>
1153 <listitem><para>Select <filename>Hello World ANSI C Autotools Project</filename>.
1154 This is an Autotools-based project based on a Yocto
1155 template.</para></listitem>
1156 <listitem><para>Put a name in the <filename>Project name:</filename>
1157 field.
1158 Do not use hyphens as part of the name.
1159 </para></listitem>
1160 <listitem><para>Click "Next".</para></listitem>
1161 <listitem><para>Add information in the
1162 <filename>Author</filename> and
1163 <filename>Copyright notice</filename> fields.
1164 </para></listitem>
1165 <listitem><para>Be sure the <filename>License</filename>
1166 field is correct.</para></listitem>
1167 <listitem><para>Click "Finish".</para></listitem>
1168 <listitem><para>If the "open perspective" prompt appears,
1169 click "Yes" so that you in the C/C++ perspective.
1170 </para></listitem>
1171 <listitem><para>The left-hand navigation pane shows your
1172 project.
1173 You can display your source by double clicking the
1174 project's source file.</para></listitem>
1175 </orderedlist>
1176 </para>
1177 </section>
1179 <section id='configuring-the-cross-toolchains'>
1180 <title>Configuring the Cross-Toolchains</title>
1182 <para>
1183 The earlier section,
1184 "<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring the Eclipse Yocto Plug-in</link>",
1185 sets up the default project configurations.
1186 You can override these settings for a given project by following
1187 these steps:
1188 <orderedlist>
1189 <listitem><para>Select "Change Yocto Project Settings" from
1190 the "Project" menu.
1191 This selection brings up the Yocto Project Settings
1192 Dialog and allows you to make changes specific to an
1193 individual project.</para>
1194 <para>By default, the Cross Compiler Options and Target
1195 Options for a project are inherited from settings you
1196 provided using the Preferences Dialog as described
1197 earlier in the
1198 "<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring the Eclipse Yocto Plug-in</link>" section.
1199 The Yocto Project Settings Dialog allows you to override
1200 those default settings for a given project.
1201 </para></listitem>
1202 <listitem><para>Make your configurations for the project
1203 and click "OK".
1204 If you are running the Juno version of Eclipse, you can
1205 skip down to the next section where you build the
1206 project.
1207 If you are not working with Juno, you need to reconfigure the
1208 project as described in the next step.
1209 </para></listitem>
1210 <listitem><para>Select "Reconfigure Project" from the
1211 "Project" menu.
1212 This selection reconfigures the project by running
1213 <filename></filename> in the workspace for
1214 your project.
1215 The script also runs <filename>libtoolize</filename>,
1216 <filename>aclocal</filename>,
1217 <filename>autoconf</filename>,
1218 <filename>autoheader</filename>,
1219 <filename>automake --a</filename>, and
1220 <filename>./configure</filename>.
1221 Click on the "Console" tab beneath your source code to
1222 see the results of reconfiguring your project.
1223 </para></listitem>
1224 </orderedlist>
1225 </para>
1226 </section>
1228 <section id='building-the-project'>
1229 <title>Building the Project</title>
1231 <para>
1232 To build the project in Juno, right click on the project in
1233 the navigator pane and select "Build Project".
1234 If you are not running Juno, select "Build Project" from the
1235 "Project" menu.
1236 The console should update and you can note the cross-compiler
1237 you are using.
1238 </para>
1239 </section>
1241 <section id='starting-qemu-in-user-space-nfs-mode'>
1242 <title>Starting QEMU in User-Space NFS Mode</title>
1244 <para>
1245 To start the QEMU emulator from within Eclipse, follow these
1246 steps:
1247 <orderedlist>
1248 <listitem><para>Expose and select "External Tools" from
1249 the "Run" menu.
1250 Your image should appear as a selectable menu item.
1251 </para></listitem>
1252 <listitem><para>Select your image from the menu to launch
1253 the emulator in a new window.</para></listitem>
1254 <listitem><para>If needed, enter your host root password in
1255 the shell window at the prompt.
1256 This sets up a <filename>Tap 0</filename> connection
1257 needed for running in user-space NFS mode.
1258 </para></listitem>
1259 <listitem><para>Wait for QEMU to launch.</para></listitem>
1260 <listitem><para>Once QEMU launches, you can begin operating
1261 within that environment.
1262 For example, you could determine the IP Address
1263 for the user-space NFS by using the
1264 <filename>ifconfig</filename> command.</para></listitem>
1265 </orderedlist>
1266 </para>
1267 </section>
1269 <section id='deploying-and-debugging-the-application'>
1270 <title>Deploying and Debugging the Application</title>
1272 <para>
1273 Once the QEMU emulator is running the image, you can deploy
1274 your application using the Eclipse IDE and then use
1275 the emulator to perform debugging.
1276 Follow these steps to deploy the application.
1277 <orderedlist>
1278 <listitem><para>Select "Debug Configurations..." from the
1279 "Run" menu.</para></listitem>
1280 <listitem><para>In the left area, expand
1281 <filename>C/C++Remote Application</filename>.
1282 </para></listitem>
1283 <listitem><para>Locate your project and select it to bring
1284 up a new tabbed view in the Debug Configurations Dialog.
1285 </para></listitem>
1286 <listitem><para>Enter the absolute path into which you want
1287 to deploy the application.
1288 Use the "Remote Absolute File Path for
1289 C/C++Application:" field.
1290 For example, enter
1291 <filename>/usr/bin/&lt;programname&gt;</filename>.
1292 </para></listitem>
1293 <listitem><para>Click on the "Debugger" tab to see the
1294 cross-tool debugger you are using.</para></listitem>
1295 <listitem><para>Click on the "Main" tab.</para></listitem>
1296 <listitem><para>Create a new connection to the QEMU instance
1297 by clicking on "new".</para></listitem>
1298 <listitem><para>Select <filename>TCF</filename>, which means
1299 Target Communication Framework.</para></listitem>
1300 <listitem><para>Click "Next".</para></listitem>
1301 <listitem><para>Clear out the "host name" field and enter
1302 the IP Address determined earlier.</para></listitem>
1303 <listitem><para>Click "Finish" to close the
1304 New Connections Dialog.</para></listitem>
1305 <listitem><para>Use the drop-down menu now in the
1306 "Connection" field and pick the IP Address you entered.
1307 </para></listitem>
1308 <listitem><para>Click "Run" to bring up a login screen
1309 and login.</para></listitem>
1310 <listitem><para>Accept the debug perspective.
1311 </para></listitem>
1312 </orderedlist>
1313 </para>
1314 </section>
1316 <section id='running-user-space-tools'>
1317 <title>Running User-Space Tools</title>
1319 <para>
1320 As mentioned earlier in the manual, several tools exist that
1321 enhance your development experience.
1322 These tools are aids in developing and debugging applications
1323 and images.
1324 You can run these user-space tools from within the Eclipse
1325 IDE through the "YoctoTools" menu.
1326 </para>
1328 <para>
1329 Once you pick a tool, you need to configure it for the remote
1330 target.
1331 Every tool needs to have the connection configured.
1332 You must select an existing TCF-based RSE connection to the
1333 remote target.
1334 If one does not exist, click "New" to create one.
1335 </para>
1337 <para>
1338 Here are some specifics about the remote tools:
1339 <itemizedlist>
1340 <listitem><para><emphasis><filename>OProfile</filename>:</emphasis>
1341 Selecting this tool causes the
1342 <filename>oprofile-server</filename> on the remote
1343 target to launch on the local host machine.
1344 The <filename>oprofile-viewer</filename> must be
1345 installed on the local host machine and the
1346 <filename>oprofile-server</filename> must be installed
1347 on the remote target, respectively, in order to use.
1348 You must compile and install the
1349 <filename>oprofile-viewer</filename> from the source
1350 code on your local host machine.
1351 Furthermore, in order to convert the target's sample
1352 format data into a form that the host can use, you must
1353 have OProfile version 0.9.4 or greater installed on the
1354 host.</para>
1355 <para>You can locate both the viewer and server from
1356 <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/oprofileui/'></ulink>.
1357 You can also find more information on setting up and
1358 using this tool in the
1359 "<ulink url='&YOCTO_DOCS_PROF_URL;#profile-manual-oprofile'>oprofile</ulink>"
1360 section of the Yocto Project Profiling and Tracing
1361 Manual.
1362 <note>The <filename>oprofile-server</filename> is
1363 installed by default on the
1364 <filename>core-image-sato-sdk</filename> image.</note>
1365 </para></listitem>
1366 <listitem><para><emphasis><filename>Lttng2.0 ust trace import</filename>:</emphasis>
1367 Selecting this tool transfers the remote target's
1368 <filename>Lttng</filename> tracing data back to the
1369 local host machine and uses the Lttng Eclipse plug-in
1370 to graphically display the output.
1371 For information on how to use Lttng to trace an
1372 application,
1373 see <ulink url=''></ulink>
1374 and the
1375 "<ulink url='&YOCTO_DOCS_PROF_URL;#lttng-linux-trace-toolkit-next-generation'>LTTng (Linux Trace Toolkit, next generation)</ulink>"
1376 section, which is in the Yocto Project Profiling and
1377 Tracing Manual.
1378 <note>Do not use
1379 <filename>Lttng-user space (legacy)</filename> tool.
1380 This tool no longer has any upstream support.</note>
1381 </para>
1382 <para>Before you use the
1383 <filename>Lttng2.0 ust trace import</filename> tool,
1384 you need to setup the Lttng Eclipse plug-in and create a
1385 Tracing project.
1386 Do the following:
1387 <orderedlist>
1388 <listitem><para>Select "Open Perspective" from the
1389 "Window" menu and then select "Tracing".
1390 </para></listitem>
1391 <listitem><para>Click "OK" to change the Eclipse
1392 perspective into the Tracing perspective.
1393 </para></listitem>
1394 <listitem><para>Create a new Tracing project by
1395 selecting "Project" from the "File -> New" menu.
1396 </para></listitem>
1397 <listitem><para>Choose "Tracing Project" from the
1398 "Tracing" menu.
1399 </para></listitem>
1400 <listitem><para>Generate your tracing data on the
1401 remote target.</para></listitem>
1402 <listitem><para>Select "Lttng2.0 ust trace import"
1403 from the "Yocto Project Tools" menu to
1404 start the data import process.</para></listitem>
1405 <listitem><para>Specify your remote connection name.
1406 </para></listitem>
1407 <listitem><para>For the Ust directory path, specify
1408 the location of your remote tracing data.
1409 Make sure the location ends with
1410 <filename>ust</filename> (e.g.
1411 <filename>/usr/mysession/ust</filename>).
1412 </para></listitem>
1413 <listitem><para>Click "OK" to complete the import
1414 process.
1415 The data is now in the local tracing project
1416 you created.</para></listitem>
1417 <listitem><para>Right click on the data and then use
1418 the menu to Select "Generic CTF Trace" from the
1419 "Trace Type... -> Common Trace Format" menu to
1420 map the tracing type.</para></listitem>
1421 <listitem><para>Right click the mouse and select
1422 "Open" to bring up the Eclipse Lttng Trace
1423 Viewer so you view the tracing data.
1424 </para></listitem>
1425 </orderedlist></para></listitem>
1426 <listitem><para><emphasis><filename>PowerTOP</filename>:</emphasis>
1427 Selecting this tool runs PowerTOP on the remote target
1428 machine and displays the results in a new view called
1429 PowerTOP.</para>
1430 <para>The "Time to gather data(sec):" field is the time
1431 passed in seconds before data is gathered from the
1432 remote target for analysis.</para>
1433 <para>The "show pids in wakeups list:" field corresponds
1434 to the <filename>-p</filename> argument passed to
1435 <filename>PowerTOP</filename>.</para></listitem>
1436 <listitem><para><emphasis><filename>LatencyTOP and Perf</filename>:</emphasis>
1437 LatencyTOP identifies system latency, while
1438 Perf monitors the system's performance counter
1439 registers.
1440 Selecting either of these tools causes an RSE terminal
1441 view to appear from which you can run the tools.
1442 Both tools refresh the entire screen to display results
1443 while they run.
1444 For more information on setting up and using
1445 <filename>perf</filename>, see the
1446 "<ulink url='&YOCTO_DOCS_PROF_URL;#profile-manual-perf'>perf</ulink>"
1447 section in the Yocto Project Profiling and Tracing
1448 Manual.
1449 </para></listitem>
1450 </itemizedlist>
1451 </para>
1452 </section>
1454 <section id='customizing-an-image-using-a-bitbake-commander-project-and-hob'>
1455 <title>Customizing an Image Using a BitBake Commander Project and Hob</title>
1457 <para>
1458 Within the Eclipse IDE, you can create a Yocto BitBake Commander
1459 project, edit the <link linkend='metadata'>Metadata</link>, and
1460 then use
1461 <ulink url='&YOCTO_HOME_URL;/tools-resources/projects/hob'>Hob</ulink> to build a customized image all within one IDE.
1462 </para>
1464 <section id='creating-the-yocto-bitbake-commander-project'>
1465 <title>Creating the Yocto BitBake Commander Project</title>
1467 <para>
1468 To create a Yocto BitBake Commander project, follow these
1469 steps:
1470 <orderedlist>
1471 <listitem><para>Select "Other" from the
1472 "Window -> Open Perspective" menu
1473 and then choose "Bitbake Commander".
1474 </para></listitem>
1475 <listitem><para>Click "OK" to change the perspective to
1476 Bitbake Commander.</para></listitem>
1477 <listitem><para>Select "Project" from the "File -> New"
1478 menu to create a new Yocto
1479 Bitbake Commander project.</para></listitem>
1480 <listitem><para>Choose "New Yocto Project" from the
1481 "Yocto Project Bitbake Commander" menu and click
1482 "Next".</para></listitem>
1483 <listitem><para>Enter the Project Name and choose the
1484 Project Location.
1485 The Yocto project's Metadata files will be put under
1486 the directory
1487 <filename>&lt;project_location&gt;/&lt;project_name&gt;</filename>.
1488 If that directory does not exist, you need to check
1489 the "Clone from Yocto Git Repository" box, which
1490 would execute a <filename>git clone</filename>
1491 command to get the project's Metadata files.
1492 <note>
1493 Do not specify your BitBake Commander project
1494 location as your Eclipse workspace.
1495 Doing so causes an error indicating that the
1496 current project overlaps the location of
1497 another project.
1498 This error occurs even if no such project exits.
1499 </note></para></listitem>
1500 <listitem><para>Select <filename>Finish</filename> to
1501 create the project.</para></listitem>
1502 </orderedlist>
1503 </para>
1504 </section>
1506 <section id='editing-the-metadata'>
1507 <title>Editing the Metadata</title>
1509 <para>
1510 After you create the Yocto Bitbake Commander project, you
1511 can modify the <link linkend='metadata'>Metadata</link>
1512 files by opening them in the project.
1513 When editing recipe files (<filename>.bb</filename> files),
1514 you can view BitBake variable values and information by
1515 hovering the mouse pointer over the variable name and
1516 waiting a few seconds.
1517 </para>
1519 <para>
1520 To edit the Metadata, follow these steps:
1521 <orderedlist>
1522 <listitem><para>Select your Yocto Bitbake Commander
1523 project.</para></listitem>
1524 <listitem><para>Select "BitBake Recipe" from the
1525 "File -> New -> Yocto BitBake Commander" menu
1526 to open a new recipe wizard.</para></listitem>
1527 <listitem><para>Point to your source by filling in the
1528 "SRC_URL" field.
1529 For example, you can add a recipe to your
1530 <link linkend='source-directory'>Source Directory</link>
1531 by defining "SRC_URL" as follows:
1532 <literallayout class='monospaced'>
1534 </literallayout></para></listitem>
1535 <listitem><para>Click "Populate" to calculate the
1536 archive md5, sha256, license checksum values and to
1537 auto-generate the recipe filename.</para></listitem>
1538 <listitem><para>Fill in the "Description" field.
1539 </para></listitem>
1540 <listitem><para>Be sure values for all required
1541 fields exist.</para></listitem>
1542 <listitem><para>Click "Finish".</para></listitem>
1543 </orderedlist>
1544 </para>
1545 </section>
1547 <section id='biding-and-customizing-the-image-using-hob'>
1548 <title>Building and Customizing the Image Using Hob</title>
1550 <para>
1551 To build and customize the image using Hob from within the
1552 Eclipse IDE, follow these steps:
1553 <orderedlist>
1554 <listitem><para>Select your Yocto Bitbake Commander
1555 project.</para></listitem>
1556 <listitem><para>Select "Launch Hob" from the "Project"
1557 menu.</para></listitem>
1558 <listitem><para>Enter the
1559 <link linkend='build-directory'>Build Directory</link>
1560 where you want to put your final images.
1561 </para></listitem>
1562 <listitem><para>Click "OK" to launch Hob.
1563 </para></listitem>
1564 <listitem><para>Use Hob to customize and build your own
1565 images.
1566 For information on Hob, see the
1567 <ulink url='&YOCTO_HOME_URL;/tools-resources/projects/hob'>Hob Project Page</ulink>
1568 on the Yocto Project website.</para></listitem>
1569 </orderedlist>
1570 </para>
1571 </section>
1572 </section>
1573 </section>
1575 <section id='workflow-using-stand-alone-cross-development-toolchains'>
1576 <title>Workflow Using Stand-Alone Cross-Development Toolchains</title>
1578 <para>
1579 If you want to develop an application without prior installation
1580 of the ADT, you still can employ the
1581 <link linkend='cross-development-toolchain'>Cross Development Toolchain</link>,
1582 the QEMU emulator, and a number of supported target image files.
1583 You just need to follow these general steps:
1584 <orderedlist>
1585 <listitem><para><emphasis>Install the cross-development
1586 toolchain for your target hardware:</emphasis>
1587 For information on how to install the toolchain, see the
1588 "<ulink url='&YOCTO_DOCS_ADT_URL;#using-an-existing-toolchain-tarball'>Using a Cross-Toolchain Tarball</ulink>"
1589 section in the Yocto Project Application Developer's
1590 Guide.</para></listitem>
1591 <listitem><para><emphasis>Download the Target Image:</emphasis>
1592 The Yocto Project supports several target architectures
1593 and has many pre-built kernel images and root filesystem
1594 images.</para>
1595 <para>If you are going to develop your application on
1596 hardware, go to the
1597 <ulink url='&YOCTO_MACHINES_DL_URL;'><filename>machines</filename></ulink>
1598 download area and choose a target machine area
1599 from which to download the kernel image and root filesystem.
1600 This download area could have several files in it that
1601 support development using actual hardware.
1602 For example, the area might contain
1603 <filename>.hddimg</filename> files that combine the
1604 kernel image with the filesystem, boot loaders, and
1605 so forth.
1606 Be sure to get the files you need for your particular
1607 development process.</para>
1608 <para>If you are going to develop your application and
1609 then run and test it using the QEMU emulator, go to the
1610 <ulink url='&YOCTO_QEMU_DL_URL;'><filename>machines/qemu</filename></ulink>
1611 download area.
1612 From this area, go down into the directory for your
1613 target architecture (e.g. <filename>qemux86_64</filename>
1614 for an <trademark class='registered'>Intel</trademark>-based
1615 64-bit architecture).
1616 Download kernel, root filesystem, and any other files you
1617 need for your process.
1618 <note>In order to use the root filesystem in QEMU, you
1619 need to extract it.
1620 See the
1621 "<ulink url='&YOCTO_DOCS_ADT_URL;#extracting-the-root-filesystem'>Extracting the Root Filesystem</ulink>"
1622 section for information on how to extract the root
1623 filesystem.</note></para></listitem>
1624 <listitem><para><emphasis>Develop and Test your
1625 Application:</emphasis> At this point, you have the tools
1626 to develop your application.
1627 If you need to separately install and use the QEMU
1628 emulator, you can go to
1629 <ulink url=''>QEMU Home Page</ulink>
1630 to download and learn about the emulator.</para></listitem>
1631 </orderedlist>
1632 </para>
1633 </section>
1636<section id="modifying-temporary-source-code">
1637 <title>Modifying Temporary Source Code</title>
1639 <para>
1640 You might
1641 find it helpful during development to modify the temporary source code used by recipes
1642 to build packages.
1643 For example, suppose you are developing a patch and you need to experiment a bit
1644 to figure out your solution.
1645 After you have initially built the package, you can iteratively tweak the
1646 source code, which is located in the
1647 <link linkend='build-directory'>Build Directory</link>, and then
1648 you can force a re-compile and quickly test your altered code.
1649 Once you settle on a solution, you can then preserve your changes in the form of
1650 patches.
1651 You can accomplish these steps all within either a
1652 <ulink url=''>Quilt</ulink> or
1653 <link linkend='git'>Git</link> workflow.
1654 </para>
1656 <section id='finding-the-temporary-source-code'>
1657 <title>Finding the Temporary Source Code</title>
1659 <para>
1660 During a build, the unpacked temporary source code used by recipes
1661 to build packages is available in the Build Directory as
1662 defined by the
1663 <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-S'>S</ulink></filename> variable.
1664 Below is the default value for the <filename>S</filename> variable as defined in the
1665 <filename>meta/conf/bitbake.conf</filename> configuration file in the
1666 <link linkend='source-directory'>Source Directory</link>:
1667 <literallayout class='monospaced'>
1668 S = "${WORKDIR}/${BP}"
1669 </literallayout>
1670 You should be aware that many recipes override the <filename>S</filename> variable.
1671 For example, recipes that fetch their source from Git usually set
1672 <filename>S</filename> to <filename>${WORKDIR}/git</filename>.
1673 <note>
1674 The
1675 <ulink url='&YOCTO_DOCS_REF_URL;#var-BP'><filename>BP</filename></ulink>
1676 represents the base recipe name, which consists of the name and version:
1677 <literallayout class='monospaced'>
1678 BP = "${BPN}-${PV}"
1679 </literallayout>
1680 </note>
1681 </para>
1683 <para>
1684 The path to the work directory for the recipe
1685 (<ulink url='&YOCTO_DOCS_REF_URL;#var-WORKDIR'><filename>WORKDIR</filename></ulink>)
1686 is defined as follows:
1687 <literallayout class='monospaced'>
1689 </literallayout>
1690 The actual directory depends on several things:
1691 <itemizedlist>
1692 <listitem><ulink url='&YOCTO_DOCS_REF_URL;#var-TMPDIR'><filename>TMPDIR</filename></ulink>:
1693 The top-level build output directory</listitem>
1694 <listitem><ulink url='&YOCTO_DOCS_REF_URL;#var-MULTIMACH_TARGET_SYS'><filename>MULTIMACH_TARGET_SYS</filename></ulink>:
1695 The target system identifier</listitem>
1696 <listitem><ulink url='&YOCTO_DOCS_REF_URL;#var-PN'><filename>PN</filename></ulink>:
1697 The recipe name</listitem>
1698 <listitem><ulink url='&YOCTO_DOCS_REF_URL;#var-EXTENDPE'><filename>EXTENDPE</filename></ulink>:
1699 The epoch - (if
1700 <ulink url='&YOCTO_DOCS_REF_URL;#var-PE'><filename>PE</filename></ulink>
1701 is not specified, which is usually the case for most
1702 recipes, then <filename>EXTENDPE</filename> is blank)</listitem>
1703 <listitem><ulink url='&YOCTO_DOCS_REF_URL;#var-PV'><filename>PV</filename></ulink>:
1704 The recipe version</listitem>
1705 <listitem><ulink url='&YOCTO_DOCS_REF_URL;#var-PR'><filename>PR</filename></ulink>:
1706 The recipe revision</listitem>
1707 </itemizedlist>
1708 </para>
1710 <para>
1711 As an example, assume a Source Directory top-level folder
1712 name <filename>poky</filename>, a default Build Directory at
1713 <filename>poky/build</filename>, and a
1714 <filename>qemux86-poky-linux</filename> machine target
1715 system.
1716 Furthermore, suppose your recipe is named
1717 <filename></filename>.
1718 In this case, the work directory the build system uses to
1719 build the package would be as follows:
1720 <literallayout class='monospaced'>
1721 poky/build/tmp/work/qemux86-poky-linux/foo/1.3.0-r0
1722 </literallayout>
1723 </para>
1725 <para>
1726 Now that you know where to locate the directory that has the temporary source code,
1727 you can use a Quilt or Git workflow to make your edits, test the changes,
1728 and preserve the changes in the form of patches.
1729 </para>
1730 </section>
1732 <section id="using-a-quilt-workflow">
1733 <title>Using a Quilt Workflow</title>
1735 <para>
1736 <ulink url=''>Quilt</ulink>
1737 is a powerful tool that allows you to capture source code changes without having
1738 a clean source tree.
1739 This section outlines the typical workflow you can use to modify temporary source code,
1740 test changes, and then preserve the changes in the form of a patch all using Quilt.
1741 </para>
1743 <para>
1744 Follow these general steps:
1745 <orderedlist>
1746 <listitem><para><emphasis>Find the Source Code:</emphasis>
1747 The temporary source code used by the OpenEmbedded build system is kept in the
1748 Build Directory.
1749 See the
1750 "<link linkend='finding-the-temporary-source-code'>Finding the Temporary Source Code</link>"
1751 section to learn how to locate the directory that has the temporary source code for a
1752 particular package.</para></listitem>
1753 <listitem><para><emphasis>Change Your Working Directory:</emphasis>
1754 You need to be in the directory that has the temporary source code.
1755 That directory is defined by the
1756 <ulink url='&YOCTO_DOCS_REF_URL;#var-S'><filename>S</filename></ulink>
1757 variable.</para></listitem>
1758 <listitem><para><emphasis>Create a New Patch:</emphasis>
1759 Before modifying source code, you need to create a new patch.
1760 To create a new patch file, use <filename>quilt new</filename> as below:
1761 <literallayout class='monospaced'>
1762 $ quilt new my_changes.patch
1763 </literallayout></para></listitem>
1764 <listitem><para><emphasis>Notify Quilt and Add Files:</emphasis>
1765 After creating the patch, you need to notify Quilt about the files
1766 you plan to edit.
1767 You notify Quilt by adding the files to the patch you just created:
1768 <literallayout class='monospaced'>
1769 $ quilt add file1.c file2.c file3.c
1770 </literallayout>
1771 </para></listitem>
1772 <listitem><para><emphasis>Edit the Files:</emphasis>
1773 Make your changes in the temporary source code to the files you added
1774 to the patch.</para></listitem>
1775 <listitem><para><emphasis>Test Your Changes:</emphasis>
1776 Once you have modified the source code, the easiest way to test your changes
1777 is by calling the <filename>compile</filename> task as shown in the following example:
1778 <literallayout class='monospaced'>
1779 $ bitbake -c compile -f &lt;name_of_package&gt;
1780 </literallayout>
1781 The <filename>-f</filename> or <filename>--force</filename>
1782 option forces the specified task to execute.
1783 If you find problems with your code, you can just keep editing and
1784 re-testing iteratively until things work as expected.
1785 <note>All the modifications you make to the temporary source code
1786 disappear once you <filename>-c clean</filename> or
1787 <filename>-c cleanall</filename> with BitBake for the package.
1788 Modifications will also disappear if you use the <filename>rm_work</filename>
1789 feature as described in the
1790 "<ulink url='&YOCTO_DOCS_QS_URL;#building-image'>Building an Image</ulink>"
1791 section of the Yocto Project Quick Start.
1792 </note></para></listitem>
1793 <listitem><para><emphasis>Generate the Patch:</emphasis>
1794 Once your changes work as expected, you need to use Quilt to generate the final patch that
1795 contains all your modifications.
1796 <literallayout class='monospaced'>
1797 $ quilt refresh
1798 </literallayout>
1799 At this point, the <filename>my_changes.patch</filename> file has all your edits made
1800 to the <filename>file1.c</filename>, <filename>file2.c</filename>, and
1801 <filename>file3.c</filename> files.</para>
1802 <para>You can find the resulting patch file in the <filename>patches/</filename>
1803 subdirectory of the source (<filename>S</filename>) directory.</para></listitem>
1804 <listitem><para><emphasis>Copy the Patch File:</emphasis>
1805 For simplicity, copy the patch file into a directory named <filename>files</filename>,
1806 which you can create in the same directory that holds the recipe
1807 (<filename>.bb</filename>) file or the
1808 append (<filename>.bbappend</filename>) file.
1809 Placing the patch here guarantees that the OpenEmbedded build system will find
1810 the patch.
1811 Next, add the patch into the
1812 <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'>SRC_URI</ulink></filename>
1813 of the recipe.
1814 Here is an example:
1815 <literallayout class='monospaced'>
1816 SRC_URI += "file://my_changes.patch"
1817 </literallayout></para></listitem>
1818 <listitem><para><emphasis>Increment the Recipe Revision Number:</emphasis>
1819 Finally, don't forget to 'bump' the
1820 <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-PR'>PR</ulink></filename>
1821 value in the recipe since the resulting packages have changed.</para></listitem>
1822 </orderedlist>
1823 </para> </section>
1825 <section id='using-a-git-workflow'>
1826 <title>Using a Git Workflow</title>
1827 <para>
1828 Git is an even more powerful tool that allows you to capture source code changes without having
1829 a clean source tree.
1830 This section outlines the typical workflow you can use to modify temporary source code,
1831 test changes, and then preserve the changes in the form of a patch all using Git.
1832 For general information on Git as it is used in the Yocto Project, see the
1833 "<link linkend='git'>Git</link>" section.
1834 </para>
1836 <note>
1837 This workflow uses Git only for its ability to manage local changes to the source code
1838 and produce patches independent of any version control system used with the Yocto Project.
1839 </note>
1841 <para>
1842 Follow these general steps:
1843 <orderedlist>
1844 <listitem><para><emphasis>Find the Source Code:</emphasis>
1845 The temporary source code used by the OpenEmbedded build system is kept in the
1846 Build Directory.
1847 See the
1848 "<link linkend='finding-the-temporary-source-code'>Finding the Temporary Source Code</link>"
1849 section to learn how to locate the directory that has the temporary source code for a
1850 particular package.</para></listitem>
1851 <listitem><para><emphasis>Change Your Working Directory:</emphasis>
1852 You need to be in the directory that has the temporary source code.
1853 That directory is defined by the
1854 <ulink url='&YOCTO_DOCS_REF_URL;#var-S'><filename>S</filename></ulink>
1855 variable.</para></listitem>
1856 <listitem><para><emphasis>If needed, initialize a Git Repository:</emphasis>
1857 If the recipe you are working with does not use a Git fetcher,
1858 you need to set up a Git repository as follows:
1859 <literallayout class='monospaced'>
1860 $ git init
1861 $ git add *
1862 $ git commit -m "initial revision"
1863 </literallayout>
1864 The above Git commands initialize a Git repository that is based on the
1865 files in your current working directory, stage all the files, and commit
1866 the files.
1867 At this point, your Git repository is aware of all the source code files.
1868 Any edits you now make to files can be committed later and will be tracked by
1869 Git.</para></listitem>
1870 <listitem><para><emphasis>Edit the Files:</emphasis>
1871 Make your changes to the temporary source code.</para></listitem>
1872 <listitem><para><emphasis>Test Your Changes:</emphasis>
1873 Once you have modified the source code, the easiest way to test your changes
1874 is by calling the <filename>compile</filename> task as shown in the following example:
1875 <literallayout class='monospaced'>
1876 $ bitbake -c compile -f &lt;name_of_package&gt;
1877 </literallayout>
1878 The <filename>-f</filename> or <filename>--force</filename>
1879 option forces the specified task to execute.
1880 If you find problems with your code, you can just keep editing and
1881 re-testing iteratively until things work as expected.
1882 <note>All the modifications you make to the temporary source code
1883 disappear once you <filename>-c clean</filename>, <filename>-c cleansstate</filename>,
1884 or <filename>-c cleanall</filename> with BitBake for the package.
1885 Modifications will also disappear if you use the <filename>rm_work</filename>
1886 feature as described in the
1887 "<ulink url='&YOCTO_DOCS_QS_URL;#building-image'>Building an Image</ulink>"
1888 section of the Yocto Project Quick Start.
1889 </note></para></listitem>
1890 <listitem><para><emphasis>See the List of Files You Changed:</emphasis>
1891 Use the <filename>git status</filename> command to see what files you have actually edited.
1892 The ability to have Git track the files you have changed is an advantage that this
1893 workflow has over the Quilt workflow.
1894 Here is the Git command to list your changed files:
1895 <literallayout class='monospaced'>
1896 $ git status
1897 </literallayout></para></listitem>
1898 <listitem><para><emphasis>Stage the Modified Files:</emphasis>
1899 Use the <filename>git add</filename> command to stage the changed files so they
1900 can be committed as follows:
1901 <literallayout class='monospaced'>
1902 $ git add file1.c file2.c file3.c
1903 </literallayout></para></listitem>
1904 <listitem><para><emphasis>Commit the Staged Files and View Your Changes:</emphasis>
1905 Use the <filename>git commit</filename> command to commit the changes to the
1906 local repository.
1907 Once you have committed the files, you can use the <filename>git log</filename>
1908 command to see your changes:
1909 <literallayout class='monospaced'>
1910 $ git commit -m "&lt;commit-summary-message&gt;"
1911 $ git log
1912 </literallayout>
1913 <note>The name of the patch file created in the next step is based on your
1914 <filename>commit-summary-message</filename>.</note></para></listitem>
1915 <listitem><para><emphasis>Generate the Patch:</emphasis>
1916 Once the changes are committed, use the <filename>git format-patch</filename>
1917 command to generate a patch file:
1918 <literallayout class='monospaced'>
1919 $ git format-patch -1
1920 </literallayout>
1921 Specifying "-1" causes Git to generate the
1922 patch file for the most recent commit.</para>
1923 <para>At this point, the patch file has all your edits made
1924 to the <filename>file1.c</filename>, <filename>file2.c</filename>, and
1925 <filename>file3.c</filename> files.
1926 You can find the resulting patch file in the current directory and it
1927 is named according to the <filename>git commit</filename> summary line.
1928 The patch file ends with <filename>.patch</filename>.</para></listitem>
1929 <listitem><para><emphasis>Copy the Patch File:</emphasis>
1930 For simplicity, copy the patch file into a directory named <filename>files</filename>,
1931 which you can create in the same directory that holds the recipe
1932 (<filename>.bb</filename>) file or the
1933 append (<filename>.bbappend</filename>) file.
1934 Placing the patch here guarantees that the OpenEmbedded build system will find
1935 the patch.
1936 Next, add the patch into the
1937 <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'>SRC_URI</ulink></filename>
1938 of the recipe.
1939 Here is an example:
1940 <literallayout class='monospaced'>
1941 SRC_URI += "file://0001-&lt;commit-summary-message&gt;.patch"
1942 </literallayout></para></listitem>
1943 <listitem><para><emphasis>Increment the Recipe Revision Number:</emphasis>
1944 Finally, don't forget to 'bump' the
1945 <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-PR'>PR</ulink></filename>
1946 value in the recipe since the resulting packages have changed.</para></listitem>
1947 </orderedlist>
1948 </para>
1949 </section>
1952<section id='image-development-using-hob'>
1953 <title>Image Development Using Hob</title>
1955 <para>
1956 The <ulink url='&YOCTO_HOME_URL;/tools-resources/projects/hob'>Hob</ulink> is a graphical user interface for the
1957 OpenEmbedded build system, which is based on BitBake.
1958 You can use the Hob to build custom operating system images within the Yocto Project build environment.
1959 Hob simply provides a friendly interface over the build system used during development.
1960 In other words, building images with the Hob lets you take care of common build tasks more easily.
1961 </para>
1963 <para>
1964 For a better understanding of Hob, see the project page at
1965 <ulink url='&YOCTO_HOME_URL;/tools-resources/projects/hob'></ulink>
1966 on the Yocto Project website.
1967 If you follow the "Documentation" link from the Hob page, you will
1968 find a short introductory training video on Hob.
1969 The following lists some features of Hob:
1970 <itemizedlist>
1971 <listitem><para>You can setup and run Hob using these commands:
1972 <literallayout class='monospaced'>
1973 $ source oe-init-build-env
1974 $ hob
1975 </literallayout></para></listitem>
1976 <listitem><para>You can set the
1977 <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink>
1978 for which you are building the image.</para></listitem>
1979 <listitem><para>You can modify various policy settings such as the
1980 package format with which to build,
1981 the parallelism BitBake uses, whether or not to build an
1982 external toolchain, and which host to build against.
1983 </para></listitem>
1984 <listitem><para>You can manage
1985 <link linkend='understanding-and-creating-layers'>layers</link>.</para></listitem>
1986 <listitem><para>You can select a base image and then add extra packages for your custom build.
1987 </para></listitem>
1988 <listitem><para>You can launch and monitor the build from within Hob.</para></listitem>
1989 </itemizedlist>
1990 </para>
1993<section id="platdev-appdev-devshell">
1994 <title>Using a Development Shell</title>
1996 <para>
1997 When debugging certain commands or even when just editing packages,
1998 <filename>devshell</filename> can be a useful tool.
1999 When you invoke <filename>devshell</filename>, source files are
2000 extracted into your working directory and patches are applied.
2001 Then, a new terminal is opened and you are placed in the working directory.
2002 In the new terminal, all the OpenEmbedded build-related environment variables are
2003 still defined so you can use commands such as <filename>configure</filename> and
2004 <filename>make</filename>.
2005 The commands execute just as if the OpenEmbedded build system were executing them.
2006 Consequently, working this way can be helpful when debugging a build or preparing
2007 software to be used with the OpenEmbedded build system.
2008 </para>
2010 <para>
2011 Following is an example that uses <filename>devshell</filename> on a target named
2012 <filename>matchbox-desktop</filename>:
2013 <literallayout class='monospaced'>
2014 $ bitbake matchbox-desktop -c devshell
2015 </literallayout>
2016 </para>
2018 <para>
2019 This command spawns a terminal with a shell prompt within the OpenEmbedded build environment.
2020 The <ulink url='&YOCTO_DOCS_REF_URL;#var-OE_TERMINAL'><filename>OE_TERMINAL</filename></ulink>
2021 variable controls what type of shell is opened.
2022 </para>
2024 <para>
2025 For spawned terminals, the following occurs:
2026 <itemizedlist>
2027 <listitem><para>The <filename>PATH</filename> variable includes the
2028 cross-toolchain.</para></listitem>
2029 <listitem><para>The <filename>pkgconfig</filename> variables find the correct
2030 <filename>.pc</filename> files.</para></listitem>
2031 <listitem><para>The <filename>configure</filename> command finds the
2032 Yocto Project site files as well as any other necessary files.</para></listitem>
2033 </itemizedlist>
2034 </para>
2036 <para>
2037 Within this environment, you can run configure or compile
2038 commands as if they were being run by
2039 the OpenEmbedded build system itself.
2040 As noted earlier, the working directory also automatically changes to the
2041 Source Directory (<ulink url='&YOCTO_DOCS_REF_URL;#var-S'><filename>S</filename></ulink>).
2042 </para>
2044 <para>
2045 When you are finished, you just exit the shell or close the terminal window.
2046 </para>
2048 <note>
2049 <para>
2050 It is worth remembering that when using <filename>devshell</filename>
2051 you need to use the full compiler name such as <filename>arm-poky-linux-gnueabi-gcc</filename>
2052 instead of just using <filename>gcc</filename>.
2053 The same applies to other applications such as <filename>binutils</filename>,
2054 <filename>libtool</filename> and so forth.
2055 BitBake sets up environment variables such as <filename>CC</filename>
2056 to assist applications, such as <filename>make</filename> to find the correct tools.
2057 </para>
2059 <para>
2060 It is also worth noting that <filename>devshell</filename> still works over
2061 X11 forwarding and similar situations.
2062 </para>
2063 </note>
2068vim: expandtab tw=80 ts=4