dev-manual-model.xml 124 KB

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