development.xml 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  1. <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  2. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
  3. <chapter id="platdev">
  4. <title>Platform Development with Poky</title>
  5. <section id="platdev-appdev">
  6. <title>Software development</title>
  7. <para>
  8. Poky supports several methods of software development. You can use the method that is
  9. best for you. This chapter describes each development method.
  10. </para>
  11. <section id="platdev-appdev-external-sdk">
  12. <title>External Development Using the Application Development Toolkit (ADT)</title>
  13. <para>
  14. The meta-toolchain and meta-toolchain-sdk targets build tarballs that contain toolchains and
  15. libraries suitable for application development outside of Poky.
  16. For information on these targets see the <ulink linkend='ref-images'>Reference: Images</ulink>
  17. appendix.
  18. </para>
  19. <para>
  20. These tarballs unpack into the
  21. <filename class="directory">/opt/poky</filename> directory and contain
  22. a setup script (e.g.
  23. <filename>/opt/poky/environment-setup-i586-poky-linux</filename>), from which
  24. you can source to initialize a suitable environment. Sourcing these files adds the
  25. compiler, QEMU scripts, QEMU binary, a special version of pkgconfig and other
  26. useful utilities to the PATH variable. Variables to assist pkgconfig and
  27. autotools are also defined so that, for example, configure can find pre-generated test
  28. results for tests that need target hardware on which to run.
  29. </para>
  30. <para>
  31. Using the toolchain with autotool-enabled packages is straightforward - just pass the
  32. appropriate host option to configure.
  33. Following is an example:
  34. <literallayout class='monospaced'>
  35. $ ./configure --host=arm-poky-linux-gnueabi
  36. </literallayout>
  37. For other projects it is usually a case of ensuring the cross tools are used:
  38. <literallayout class='monospaced'>
  39. CC=arm-poky-linux-gnueabi-gcc and LD=arm-poky-linux-gnueabi-ld
  40. </literallayout>
  41. </para>
  42. </section>
  43. <section id="using-the-eclipse-and-anjuta-plug-ins">
  44. <title>Using the Eclipse Plug-in</title>
  45. <para>
  46. The current release of the Yocto Project supports the Eclipse IDE plug-in
  47. to make developing software easier for the application developer.
  48. The plug-in provides capability extensions to the graphical IDE to allow
  49. for cross compilation, deployment and execution of the output in a QEMU
  50. emulation session.
  51. Support of the Eclipse plug-in also allows for cross debugging and
  52. profiling.
  53. Additionally, the Eclipse plug-in provides a suite of tools
  54. that allows the developer to perform remote profiling, tracing, collection of
  55. power data, collection of latency data and collection of performance data.
  56. </para>
  57. <note>
  58. The current release of the Yocto Project no longer supports the Anjuta plug-in.
  59. However, the Poky Anjuta Plug-in is available to download directly from the Poky
  60. Git repository located through the web interface at
  61. <ulink url="http://git.yoctoproject.org/"></ulink> under IDE Plugins.
  62. The community is free to continue supporting it beyond the Yocto Project 0.9
  63. Release.
  64. </note>
  65. <para>
  66. To use the Eclipse plug-in you need the Eclipse Framework (Helios 3.6.1) along
  67. with other plug-ins installed into the Eclipse IDE.
  68. Once you have your environment setup you need to configure the Eclipse plug-in.
  69. For information on how to install and configure the Eclipse plug-in, see the
  70. <ulink url='http://www.yoctoproject.org/docs/adt-manual/adt-manual.html#adt-eclipse'>
  71. "Working Within Eclipse"</ulink> chapter in the
  72. <ulink url='http://www.yoctoproject.org/docs/adt-manual/adt-manual.html'>
  73. "Application Development Toolkit (ADT) User's Guide."</ulink>
  74. </para>
  75. <!--
  76. <section id="the-eclipse-plug-in">
  77. <title>The Eclipse Plug-in</title>
  78. <para>
  79. To use the Eclipse plug-in, a toolchain and SDK built by Poky is required along with
  80. the Eclipse Framework (Helios 3.6.1).
  81. To install the plug-in you need to be in the Eclipse IDE and select
  82. the following menu:
  83. <literallayout class='monospaced'>
  84. Help -> Install New Software
  85. </literallayout>
  86. Specify the target URL as
  87. <ulink url='http://www.yoctoproject.org/downloads/eclipse-plugin/'></ulink>.
  88. </para>
  89. <para>
  90. If you want to download the source code for the plug-in you can find it in the Poky
  91. git repository, which has a web interface, and is located at
  92. <ulink url="http://git.yoctoproject.org"></ulink> under IDE Plugins.
  93. </para>
  94. <section id="installing-and-setting-up-the-eclipse-ide">
  95. <title>Installing and Setting up the Eclipse IDE</title>
  96. <para>
  97. If you don't have the Eclipse IDE (Helios 3.6.1) on your system you need to
  98. download and install it from <ulink url="http://www.eclipse.org/downloads"></ulink>.
  99. Choose the Eclipse Classic, which contains the Eclipse Platform, Java Development
  100. Tools (JDT), and the Plug-in Development Environment.
  101. </para>
  102. <note>
  103. <para>
  104. Due to the Java Virtual Machine's garbage collection (GC) process the
  105. permanent generation space (PermGen) is not cleaned up. This space stores
  106. meta-data descriptions of classes. The default value is set too small
  107. and it could trigger an out-of-memory error like the following:
  108. <literallayout class='monospaced'>
  109. Java.lang.OutOfMemoryError: PermGen space
  110. </literallayout>
  111. This error causes the applications to hang.
  112. </para>
  113. </note>
  114. <para>
  115. To fix this issue you can use the <filename>-vmargs</filename>
  116. option when you start Eclipse to increase the size of the permanent generation space:
  117. <literallayout class='monospaced'>
  118. Eclipse -vmargs -XX:PermSize=256M
  119. </literallayout>
  120. </para>
  121. </section>
  122. <section id="installing-the-yocto-plug-in">
  123. <title>Installing the Yocto Plug-in</title>
  124. <para>
  125. Once you have the Eclipse IDE installed and configured you need to install the
  126. Yocto plug-in. You do this similar to installing the Eclipse plug-ins in the
  127. previous section.
  128. </para>
  129. <para>
  130. Do the following to install the Yocto plug-in into the Eclipse IDE:
  131. <orderedlist>
  132. <listitem><para>Select the "Help -> Install New Software" item.</para></listitem>
  133. <listitem><para>In the "Work with:" area click "Add..." and enter the URL for
  134. the Yocto plug-in, which is
  135. <ulink url='http://www.yoctoproject.org/downloads/eclipse-plugin/'></ulink></para></listitem>
  136. <listitem><para>Finish out the installation of the update similar to any other
  137. Eclipse plug-in.</para></listitem>
  138. </orderedlist>
  139. </para>
  140. </section>
  141. <section id="configuring-yocto-eclipse-plug-in">
  142. <title>Configuring Yocto Eclipse plug-in</title>
  143. <para>
  144. To configure the Yocto Eclipse plug-in you need to select the mode and the
  145. architecture with which you will be working. Start by selecting "Preferences"
  146. from the "Window" menu and then select "Yocto SDK".
  147. </para>
  148. <para>
  149. If you normally will use an installed Yocto
  150. SDK (under <filename>/opt/poky</filename>) select “SDK Root Mode”. Otherwise, if your crosstool chain
  151. and sysroot are within your poky tree, select “Poky Tree Mode”.
  152. If you are in SDK Root Mode you need to provide your poky tree path, for
  153. example, <filename>$&lt;Poky_tree&gt;/build/</filename>.
  154. </para>
  155. <para>
  156. Next, you need to select the architecture.
  157. Use the drop down list and select the architecture that you’ll be primarily
  158. working against.
  159. For target option, select your typical target QEMU vs External hardware. If you
  160. choose QEMU, you’ll need to specify your QEMU kernel file with full path and the
  161. rootfs mount point. Yocto QEMU boots off user mode NFS.
  162. See the <link linkend='platdev-appdev-qemu'>Developing Externally in QEMU</link> section for
  163. how to set it up.
  164. </para>
  165. <para>
  166. To make your settings the defaults for every new Yocto project created using
  167. the Eclipse IDE, simply save the settings.
  168. </para>
  169. </section>
  170. <section id="using-the-yocto-eclipse-plug-in">
  171. <title>Using the Yocto Eclipse Plug-in</title>
  172. <para>
  173. As an example, this section shows you how to cross-compile a Yocto C project that
  174. is autotools-based, deploy the project into QEMU, and then run the debugger against it.
  175. You need to configure the project, trigger the <filename> autogen.sh</filename>, build
  176. the image, start QEMU, and then debug.
  177. </para>
  178. <para>
  179. The following steps show how to create a Yocto autotools-based project using a given template:
  180. </para>
  181. <orderedlist>
  182. <listitem><para>Select "File -> New -> Project" to start the wizard.</para></listitem>
  183. <listitem><para>Expand "C/C++" and select "C Project".</para></listitem>
  184. <listitem><para>Click "Next" and select a template (e.g. "Hello World ANSI C Project").</para></listitem>
  185. <listitem><para>Complete the steps to create the new Yocto autotools-based project using
  186. your chosen template.</para></listitem>
  187. </orderedlist>
  188. <para>
  189. By default, the project uses the Yocto preferences settings as defined using the procedure in
  190. <link linkend="configuring-yocto-eclipse-plug-in">the previous section</link>.
  191. If there are any specific setup requirements for the newly created project
  192. you need to reconfigure the Yocto plug-in through the menu selection by doing the following:
  193. </para>
  194. <orderedlist>
  195. <listitem><para>Select the "Project -> Invoke Yocto Tools -> Reconfigure Yocto" menu item.</para></listitem>
  196. <listitem><para>Complete the dialogue to specify the specific toolchain and QEMU setup information.</para></listitem>
  197. </orderedlist>
  198. <para>
  199. To build the project follow these steps:
  200. </para>
  201. <orderedlist>
  202. <listitem><para>Select "Project -> Reconfigure Project" to trigger the
  203. <filename>autogen.sh</filename> command.</para></listitem>
  204. <listitem><para>Select "Project -> Build" to build the project.</para></listitem>
  205. </orderedlist>
  206. <para>
  207. To start QEMU follow these steps:
  208. </para>
  209. <orderedlist>
  210. <listitem><para>Select "Run -> External Tools" and see if there is
  211. a QEMU instance for the desired target.
  212. If one exists, click on the instance to start QEMU.
  213. If your target does not exist, click "External Tools Configuration" and
  214. you should find an instance of QEMU for your architecture
  215. under the entry under "Program".</para></listitem>
  216. <listitem><para>Wait for the boot to complete.</para></listitem>
  217. </orderedlist>
  218. <para>
  219. To deploy your project and start debugging follow these steps:
  220. </para>
  221. <orderedlist>
  222. <listitem><para>Highlight your project in the project explorer.</para></listitem>
  223. <listitem><para>Select "Run -> Debug Configurations" to bring up your remote debugging configuration
  224. in the right-hand window.</para></listitem>
  225. <listitem><para>Expand “C/C++ Remote Application”.</para></listitem>
  226. <listitem><para>Select "projectname_ gdb_target-poky-linux".
  227. You need to be sure there is an entry for the remote target.
  228. If no entry exists, click "New..." to bring up the wizard.
  229. Use the wizard to select TCF and enter the IP address of you remote target in the
  230. “Host name:” field.
  231. Back in the Remote Debug Configure window, specify in the
  232. “Remote Absolute File Path for C/C++ Application” field the absolute path for the program on
  233. the remote target.
  234. By default, the program deploys into the remote target.
  235. If you don't want this behavior then check “Skip download to target path”.</para></listitem>
  236. <listitem><para>Click "Debug” to start the remote debugging session.</para></listitem>
  237. </orderedlist>
  238. </section>
  239. <section id="using-yocto-eclipse-plug-in-remote-tools-suite">
  240. <title>Using Yocto Eclipse plug-in Remote Tools Suite</title>
  241. <para>
  242. Remote tools allow you to perform system profiling, kernel tracing,
  243. examine power consumption, and so forth. To see and access the remote tools use the
  244. "Window -> YoctoTools" menu.
  245. </para>
  246. <para>
  247. Once you pick a tool you need to configure it for the remote target. Every tool
  248. needs to have the connection configured. You must select an existing TCF-based
  249. RSE connection to the remote target. If one does not exist, click "New" to create one.
  250. </para>
  251. <para>
  252. Here are some specifics about the remote tools:
  253. <itemizedlist>
  254. <listitem><para>OProfile: Selecting this tool causes the oprofile-server on the remote
  255. target to launch on the local host machine. The oprofile-viewer
  256. must be installed on the local host machine and the oprofile-server must be
  257. installed on the remote target, respectively, in order to use .</para></listitem>
  258. <listitem><para>lttng: Selecting this tool runs "usttrace" on the remote target, transfers
  259. the output data back to the local host machine and uses "lttv-gui" to graphically
  260. display the output. The "lttv-gui" must be installed on the
  261. local host machine to use this tool.
  262. For information on how to use "lttng" to trace an
  263. application, see <ulink url="http://lttng.org/files/ust/manual/ust.html"></ulink>.
  264. <para>
  265. For "Application" you must supply the absolute path name of the application to
  266. be traced by user mode lttng. For example, typing <filename>/path/to/foo"
  267. </filename> triggers "usttrace /path/to/foo" on the
  268. remote target to trace the program <filename>/path/to/foo</filename>.
  269. </para>
  270. <para>
  271. "Argument" is passed to "usttrace" running on the remote target.
  272. </para></para>
  273. </listitem>
  274. <listitem><para>powertop: Selecting this tool runs "powertop" on the
  275. remote target machine and displays the results in a new view called "powertop".
  276. <para>
  277. "Time to gather data(sec):" is the time passed in seconds before data is
  278. gathered from the remote target for analysis.
  279. </para>
  280. <para>
  281. "show pids in wakeups list:" corresponds to the <filename>-p</filename>
  282. argument passed to "powertop".
  283. </para></para>
  284. </listitem>
  285. <listitem><para>latencytop and perf: "latencytop" identifies
  286. system latency, while "perf" monitors the system's performance
  287. counter registers. Selecting either of these tools causes an RSE
  288. terminal view to appear from which you can run the tools. Both tools refresh the
  289. entire screen to display results while they run.</para></listitem>
  290. </itemizedlist>
  291. </para>
  292. </section>
  293. </section>
  294. <section id="the-anjuta-plug-in">
  295. <title>The Anjuta Plug-in</title>
  296. <note>
  297. <para>
  298. Support for the Anjuta plug-in ends after Yocto project 0.9 Release.
  299. However, the source code can be downloaded from the git repository listed later in
  300. this section.
  301. The community is free to continue supporting it post 0.9 Release.
  302. </para>
  303. </note>
  304. <para>
  305. An Anjuta IDE plug-in exists to make developing software within the Poky framework
  306. easier for the application developer familiar with that environment.
  307. The plug-in presents a graphical IDE that allows you to cross-compile, cross-debug,
  308. profile, deploy, and execute an application.
  309. </para>
  310. <para>
  311. To use the plug-in, a toolchain and SDK built by Poky, Anjuta, its development headers and the Anjuta
  312. Plug-in are all required.
  313. The Poky Anjuta Plug-in is available to download as a tarball at the OpenedHand
  314. labs <ulink url="http://labs.o-hand.com/anjuta-poky-sdk-plugin/"></ulink> page or
  315. directly from the Poky Git repository located at git://git.yoctoproject.org/anjuta-poky.
  316. You can access the source code from a web interface to the repository at
  317. <ulink url="http://git.yoctoproject.org/"></ulink> under IDE Plugins.
  318. </para>
  319. <para>
  320. See the README file contained in the project for more information on
  321. Anjuta dependencies and building the plug-in.
  322. If you want to disable remote gdb debugging, pass the "&dash;&dash;disable-gdb-integration" switch when
  323. you configure the plug-in.
  324. </para>
  325. <section id="setting-up-the-anjuta-plugin">
  326. <title>Setting Up the Anjuta Plug-in</title>
  327. <para>
  328. Follow these steps to set up the plug-in:
  329. <orderedlist>
  330. <listitem><para>Extract the tarball for the toolchain into / as root.
  331. The toolchain will be installed into <filename>/opt/poky</filename>.</para></listitem>
  332. <listitem><para>To use the plug-in, first open or create an existing project.
  333. If you are creating a new project, the "C GTK+"
  334. project type will allow itself to be cross-compiled.
  335. However, you should be aware that this type uses "glade" for the UI.</para></listitem>
  336. <listitem><para>To activate the plug-in, select "Edit -> Preferences" and then choose
  337. "General" from the left hand side.
  338. Choose the "Installed plug-ins" tab, scroll down to "Poky SDK" and
  339. check the box.</para></listitem>
  340. </orderedlist>
  341. The plug-in is now activated but not configured.
  342. </para>
  343. </section>
  344. <section id="configuring-the-anjuta-plugin">
  345. <title>Configuring the Anjuta Plug-in</title>
  346. <para>
  347. You can find the configuration options for the SDK by choosing the Poky
  348. SDK icon from the left hand side.
  349. You need to define the following options:
  350. <itemizedlist>
  351. <listitem><para>SDK root: If you use an external toolchain you need to set
  352. SDK root, which is the root directory of the SDK's sysroot.
  353. For an i586 SDK directory is <filename>/opt/poky/</filename>.
  354. This directory will contain "bin", "include", "var" and so forth under your
  355. selected target architecture subdirectory
  356. <filename>/opt/poky/sysroot/i586-poky-linux/</filename>.
  357. The cross-compile tools you need are in
  358. <filename>/opt/poky/sysroot/i586-pokysdk-linux/</filename>.</para></listitem>
  359. <listitem><para>Poky root: If you have a local Poky build tree, you need to
  360. set the Poky root, which is the root directory of the poky build tree.
  361. If you build your i586 target architecture under the subdirectory of
  362. <filename>build_x86</filename> within your Poky tree, the Poky root directory
  363. should be <filename>$&lt;poky_tree&gt;/build_x86/</filename>.</para></listitem>
  364. <listitem><para>Target Architecture: This is the cross compile triplet,
  365. for example, "i586-poky-linux".
  366. This target triplet is the prefix extracted from the set up script file's name.
  367. For example, if the script file name is
  368. <filename>/opt/poky/environment-setup-i586-poky-linux</filename> then the extracted target
  369. triplet is "i586-poky-linux".</para></listitem>
  370. <listitem><para>Kernel: Use the file chooser to select the kernel used with QEMU.</para></listitem>
  371. <listitem><para>Root filesystem: Use the file chooser to select the root
  372. filesystem directory. This directory is where you use "poky-extract-sdk" to extract the
  373. poky-image-sdk tarball.</para></listitem>
  374. </itemizedlist>
  375. </para>
  376. </section>
  377. <section id="using-the-anjuta-plug-in">
  378. <title>Using the Anjuta Plug-in</title>
  379. <para>
  380. The steps in this section show how to cross-compile a project, deploy it into
  381. QEMU, run a debugger against it and then perform a system-wide profile.
  382. <orderedlist>
  383. <listitem><para>Choose "Build -> Run Configure" or "Build -> Run Autogenerate" to run
  384. "configure" or "autogen", respectively for the project.
  385. Either command passes command-line arguments to instruct the
  386. cross-compile.</para></listitem>
  387. <listitem><para>Choose "Build -> Build Project" to build and compile the project.
  388. If you have previously built the project in the same tree without using
  389. the cross-compiler you might find that your project fails to link.
  390. If this is the case, simply select "Build -> Clean Project" to remove the
  391. old binaries.
  392. After you clean the project you can then try building it again.</para></listitem>
  393. <listitem><para>Choose "Tools -> Start QEMU" to start QEMU.
  394. After QEMU starts any error messages will appear in the message view.
  395. Once Poky has fully booted within QEMU you can deploy the project
  396. into it.</para></listitem>
  397. <listitem><para>Once the project is built and you have QEMU running choose
  398. "Tools -> Deploy" to install the package into a temporary
  399. directory and then copy it using "rsync" over SSH into the target.
  400. A progress bar and appropriate messages appear in the message view.</para></listitem>
  401. <listitem><para>To debug a program installed onto the target choose
  402. "Tools -> Debug remote".
  403. Choosing this menu item causes prompts to appear to define the local binary
  404. for debugging and also for the command line used to run on the target.
  405. When you provide the command line be sure to include the full path to the to binary
  406. installed in the target.
  407. When the command line runs a "gdbserver" over SSH is started on the target and
  408. an instance of "cross-gdb" starts in a local terminal.
  409. The instance of "cross-gdb" will be preloaded to connect to the server and use the SDK root to
  410. find symbols.
  411. It also connects to the target and loads in various libraries as well as the
  412. target program.
  413. You should define any breakpoints or watchpoints at this point in the process since you might not
  414. be able to interrupt the execution later.
  415. To stop the debugger on the target choose "Tools -> Stop debugger".</para></listitem>
  416. <listitem><para>It is also possible to execute a command in the target over SSH.
  417. Doing so causes the appropriate environment to be established for execution.
  418. To execute a command choose "Choose Tools -> Run remote".
  419. This selection opens a terminal with the SSH command inside.</para></listitem>
  420. <listitem><para>To perform a system-wide profile against the system running in QEMU choose
  421. "Tools -> Profile remote".
  422. This choice starts up "OProfileUI" with the appropriate parameters to
  423. connect to the server running inside QEMU and also supplies the path
  424. for debug information necessary to get a useful profile.</para></listitem>
  425. </orderedlist>
  426. </para>
  427. </section>
  428. </section>
  429. -->
  430. </section>
  431. <section id="platdev-appdev-qemu">
  432. <title>Developing Externally in QEMU</title>
  433. <para>
  434. Running Poky QEMU images is covered in the
  435. <ulink url="http://www.yoctoproject.org/docs/yocto-quick-start/yocto-project-qs.html">
  436. Yocto Project Quick Start</ulink> in the "A Quick Test Run" section.
  437. </para>
  438. <para>
  439. Poky's QEMU images contain a complete native toolchain. This means
  440. you can develop applications within QEMU similar to the way you would in a normal system.
  441. Using qemux86 on an x86 machine is fast since the
  442. guest and host architectures match.
  443. On the other hand, using qemuarm can be slower but gives
  444. faithful emulation of ARM-specific issues. To speed things up, these
  445. images support using "distcc" to call a cross-compiler outside the
  446. emulated system. If "runqemu" was used to start
  447. QEMU, and "distccd" is present on the host system, any Bitbake cross-compiling
  448. toolchain available from the build system is automatically
  449. used from within QEMU simply by calling "distcc". You can accomplish this by defining the
  450. cross-compiler variable (e.g. <filename>export CC="distcc"</filename>).
  451. Alternatively, if a suitable SDK/toolchain is present in
  452. <filename>/opt/poky</filename> it is also
  453. automatically be used.
  454. </para>
  455. <para>
  456. There are several options for connecting into the emulated system.
  457. QEMU provides a framebuffer interface that has standard consoles
  458. available. There is also a serial connection available that has a
  459. console to the system running on it and uses standard IP networking.
  460. The images have a dropbear ssh server running with the root password
  461. disabled to allow standard ssh and scp commands to work. The images
  462. also contain an NFS server that exports the guest's root filesystem, which
  463. allows it to be made available to the host.
  464. </para>
  465. </section>
  466. <section id="platdev-appdev-insitu">
  467. <title>Developing in Poky Directly</title>
  468. <para>
  469. Working directly in Poky is a fast and effective development technique.
  470. The idea is that you can directly edit files in
  471. <glossterm><link linkend='var-WORKDIR'>WORKDIR</link></glossterm>
  472. or the source directory <glossterm><link linkend='var-S'>S</link></glossterm>
  473. and then force specific tasks to rerun in order to test the changes.
  474. An example session working on the matchbox-desktop package might
  475. look like this:
  476. </para>
  477. <para>
  478. <literallayout class='monospaced'>
  479. $ bitbake matchbox-desktop
  480. $ sh
  481. $ cd tmp/work/armv5te-poky-linux-gnueabi/matchbox-desktop-2.0+svnr1708-r0/
  482. $ cd matchbox-desktop-2
  483. $ vi src/main.c
  484. $ exit
  485. $ bitbake matchbox-desktop -c compile -f
  486. $ bitbake matchbox-desktop
  487. </literallayout>
  488. </para>
  489. <para>
  490. This example builds the package, changes into the work directory for the package,
  491. changes a file, then recompiles the package. Instead of using "sh" as it is in the example,
  492. you can also use two different terminals. However, the risk of using two terminals
  493. is that a command like "unpack" could destroy the changes you've made to the
  494. work directory. Consequently, you need to work carefully.
  495. </para>
  496. <para>
  497. It is useful when making changes directly to the work directory files to do
  498. so using "quilt" as detailed in the <link linkend='usingpoky-modifying-packages-quilt'>
  499. modifying packages with quilt</link> section. You can copy the resulting patches
  500. into the recipe directory and use them directly in the <glossterm><link
  501. linkend='var-SRC_URI'>SRC_URI</link></glossterm>.
  502. </para>
  503. <para>
  504. For a review of the skills used in this section see the <link
  505. linkend="usingpoky-components-bitbake">Bitbake</link> and <link
  506. linkend="usingpoky-debugging-taskrunning">Running Specific Tasks</link> Sections.
  507. </para>
  508. </section>
  509. <section id="platdev-appdev-devshell">
  510. <title>Developing with 'devshell'</title>
  511. <para>
  512. When debugging certain commands or even when just editing packages, the
  513. 'devshell' can be a useful tool.
  514. Use a command like the following to start this tool.
  515. </para>
  516. <para>
  517. <literallayout class='monospaced'>
  518. $ bitbake matchbox-desktop -c devshell
  519. </literallayout>
  520. </para>
  521. <para>
  522. This command opens a terminal with a shell prompt within the Poky
  523. environment. Consequently, the following occurs:
  524. <itemizedlist>
  525. <listitem><para>The PATH variable includes the cross toolchain.</para></listitem>
  526. <listitem><para>The pkgconfig variables find the correct <filename>.pc</filename> files.</para></listitem>
  527. <listitem><para>"configure" finds the Poky site files as well as any other necessary files.</para></listitem>
  528. </itemizedlist>
  529. Within this environment, you can run "configure" or "compile" commands as if they
  530. were being run by Poky itself.
  531. The working directory also automatically changes to the (<glossterm><link linkend='var-S'>S</link></glossterm>)
  532. directory.
  533. When you are finished, you just exit the shell or close the terminal window.
  534. </para>
  535. <para>
  536. The default shell used by "devshell" is the gnome-terminal.
  537. You can use other forms of terminal can by setting the <glossterm>
  538. <link linkend='var-TERMCMD'>TERMCMD</link></glossterm> and <glossterm>
  539. <link linkend='var-TERMCMDRUN'>TERMCMDRUN</link></glossterm> variables
  540. in <filename>local.conf</filename>.
  541. For examples of the other options available, see
  542. <filename>meta/conf/bitbake.conf</filename>.
  543. </para>
  544. <para>
  545. An external shell is launched rather than opening directly into the original terminal
  546. window.
  547. This allows easier interaction with Bitbake's multiple threads as well as
  548. for a future client/server split.
  549. Note that "devshell" will still work over X11 forwarding or similar situations.
  550. </para>
  551. <para>
  552. It is worth remembering that inside "devshell" you need to use the full
  553. compiler name such as <filename>arm-poky-linux-gnueabi-gcc</filename>
  554. instead of just <filename>gcc</filename>.
  555. The same applies to other applications such as gcc, bintuils, libtool and so forth.
  556. Poky will have setup environmental variables such as CC to assist applications, such as make,
  557. find the correct tools.
  558. </para>
  559. </section>
  560. <section id="platdev-appdev-srcrev">
  561. <title>Developing within Poky with an External SCM-based Package</title>
  562. <para>
  563. If you're working on a recipe that pulls from an external SCM it
  564. is possible to have Poky notice new changes added to the
  565. SCM and then build the latest version using them.
  566. This only works for SCMs from which it is possible to get a sensible revision number for changes.
  567. Currently it works for svn, git and bzr repositories.
  568. </para>
  569. <para>
  570. To enable this behavior simply add <glossterm>
  571. <link linkend='var-SRCREV'>SRCREV</link></glossterm>_pn-<glossterm>
  572. <link linkend='var-PN'>PN</link></glossterm> = "${AUTOREV}" to
  573. <filename>local.conf</filename>, where <glossterm><link linkend='var-PN'>PN</link></glossterm>
  574. is the name of the package for which you want to enable automatic source
  575. revision updating.
  576. </para>
  577. </section>
  578. </section>
  579. <section id="platdev-gdb-remotedebug">
  580. <title>Debugging with GDB Remotely</title>
  581. <para>
  582. GNU Project Debugger (GDB)
  583. allows you to examine running programs to understand and fix problems and
  584. also to perform post-mortem style analysis of program crashes.
  585. GDB is available as a package within Poky and by default is installed in sdk images.
  586. See <ulink url="http://sourceware.org/gdb/"/> for the GDB source.
  587. </para>
  588. <tip><para>
  589. For best results install <filename>-dbg</filename> packages for the applications
  590. you are going to debug.
  591. Doing so makes available extra debug symbols that will give you more meaningful output.
  592. </para></tip>
  593. <para>
  594. Sometimes, due to memory or disk space constraints, it is not possible
  595. to use GDB directly on the remote target to debug applications.
  596. These constraints arise because GDB needs to load the debugging information and the
  597. binaries of the process being debugged.
  598. Additionally, GDB needs to perform many computations to locate information such as function
  599. names, variable names and values, stack traces and so forth - even before starting the
  600. debugging process.
  601. These extra computations place more load on the target system and can alter the
  602. characteristics of the program being debugged.
  603. </para>
  604. <para>
  605. To help get past these constraints you can use GDBSERVER.
  606. It runs on the remote target and does not load any debugging information
  607. from the debugged process.
  608. Instead, a GDB instance processes the debugging information that is run on a
  609. remote computer - the host GDB.
  610. The host GDB then sends control commands to GDBSERVER to make it stop or start the debugged
  611. program, as well as read or write memory regions of that debugged
  612. program.
  613. All the debugging information loaded and processed as well
  614. as all the heavy debugging is done by the host GDB.
  615. Offloading these processes gives the GDBSERVER running on the target a chance to remain
  616. small and fast.
  617. </para>
  618. <para>
  619. Because the host GDB is responsible for loading the debugging information and
  620. for doing the necessary processing to make actual debugging happen, the
  621. user has to make sure the host can access the unstripped binaries complete
  622. with their debugging information and also compiled with no optimizations.
  623. The host GDB must also have local access to all the libraries used by the
  624. debugged program.
  625. Because GDBSERVER does not need any local debugging information the binaries on
  626. the remote target can remain stripped.
  627. However, the binaries must also be compiled without optimization
  628. so they match the host's binaries.
  629. </para>
  630. <para>
  631. To remain consistent with GDB documentation and terminology the binary being debugged
  632. on the remote target machine is referred to as the 'inferior' binary.
  633. For documentation on GDB see the GDB site at
  634. <ulink url="http://sourceware.org/gdb/documentation/">on their site</ulink>.
  635. </para>
  636. <section id="platdev-gdb-remotedebug-launch-gdbserver">
  637. <title>Launching GDBSERVER on the Target</title>
  638. <para>
  639. First, make sure GDBSERVER is installed on the target. If not,
  640. install the package <filename>gdbserver</filename>, which needs the
  641. <filename>libthread-db1</filename> package.
  642. </para>
  643. <para>
  644. As an example, to launch GDBSERVER on the target and make it ready to "debug" a
  645. program located at <filename>/path/to/inferior</filename>, connect
  646. to the target and launch:
  647. <literallayout class='monospaced'>
  648. $ gdbserver localhost:2345 /path/to/inferior
  649. </literallayout>
  650. GDBSERVER should now be listening on port 2345 for debugging
  651. commands coming from a remote GDB process that is running on the host computer.
  652. Communication between GDBSERVER and the host GDB are done using TCP.
  653. To use other communication protocols please refer to the GDBSERVER documentation.
  654. </para>
  655. </section>
  656. <section id="platdev-gdb-remotedebug-launch-gdb">
  657. <title>Launching GDB on the Host Computer</title>
  658. <para>
  659. Running GDB on the host computer takes a number of stages.
  660. This section describes those stages.
  661. </para>
  662. <section id="platdev-gdb-remotedebug-launch-gdb-buildcross">
  663. <title>Building the Cross-GDB Package</title>
  664. <para>
  665. A suitable GDB cross-binary is required that runs on your host computer but
  666. also knows about the the ABI of the remote target.
  667. You can get this binary from the the Poky toolchain - for example:
  668. <programlisting>
  669. /usr/local/poky/eabi-glibc/arm/bin/arm-poky-linux-gnueabi-gdb
  670. </programlisting>
  671. where "arm" is the target architecture and "linux-gnueabi" the target ABI.
  672. </para>
  673. <para>
  674. Alternatively, Poky can build the <filename>gdb-cross</filename> binary.
  675. For example, the following command builds it:
  676. <literallayout class='monospaced'>
  677. $ bitbake gdb-cross
  678. </literallayout>
  679. Once the binary is built you can find it here:
  680. <programlisting>
  681. tmp/sysroots/&lt;host-arch&gt;/usr/bin/&lt;target-abi&gt;-gdb
  682. </programlisting>
  683. </para>
  684. </section>
  685. <section id="platdev-gdb-remotedebug-launch-gdb-inferiorbins">
  686. <title>Making the Inferior Binaries Available</title>
  687. <para>
  688. The inferior binary (complete with all debugging symbols) as well as any
  689. libraries (and their debugging symbols) on which the inferior binary depends
  690. need to be available.
  691. There are a number of ways you can make these available.
  692. </para>
  693. <para>
  694. Perhaps the easiest is to have an 'sdk' image that corresponds to the plain
  695. image installed on the device.
  696. In the case of 'poky-image-sato', 'poky-image-sdk' would contain suitable symbols.
  697. Because the sdk images already have the debugging symbols installed it is just a
  698. question of expanding the archive to some location and then informing GDB.
  699. </para>
  700. <para>
  701. Alternatively, Poky can build a custom directory of files for a specific
  702. debugging purpose by reusing its <filename>tmp/rootfs</filename> directory.
  703. This directory contains the contents of the last built image.
  704. This process assumes two things:
  705. <itemizedlist>
  706. <listitem><para>The image running on the target was the last image to
  707. be built by Poky.</para></listitem>
  708. <listitem><para>The package (<filename>foo</filename> in the following
  709. example) that contains the inferior binary to be debugged has been built
  710. without optimization and has debugging information available.</para></listitem>
  711. </itemizedlist>
  712. </para>
  713. <para>
  714. These steps show how to build the custom directory of files:
  715. </para>
  716. <orderedlist>
  717. <listitem><para>Install the package (<filename>foo</filename> in this case) to
  718. <filename>tmp/rootfs</filename>:
  719. <programlisting>
  720. tmp/sysroots/i686-linux/usr/bin/opkg-cl -f \
  721. tmp/work/&lt;target-abi&gt;/poky-image-sato-1.0-r0/temp/opkg.conf -o \
  722. tmp/rootfs/ update
  723. </programlisting></para></listitem>
  724. <listitem><para>Install the debugging information:
  725. <programlisting>
  726. tmp/sysroots/i686-linux/usr/bin/opkg-cl -f \
  727. tmp/work/&lt;target-abi&gt;/poky-image-sato-1.0-r0/temp/opkg.conf \
  728. -o tmp/rootfs install foo
  729. tmp/sysroots/i686-linux/usr/bin/opkg-cl -f \
  730. tmp/work/&lt;target-abi&gt;/poky-image-sato-1.0-r0/temp/opkg.conf \
  731. -o tmp/rootfs install foo-dbg
  732. </programlisting></para></listitem>
  733. </orderedlist>
  734. </section>
  735. <section id="platdev-gdb-remotedebug-launch-gdb-launchhost">
  736. <title>Launch the Host GDB</title>
  737. <para>
  738. To launch the host GDB, you run the cross-gdb binary and provide the inferior
  739. binary as part of the command line.
  740. For example, the following command form continues with the example used in
  741. the previous section.
  742. This command form loads the <filename>foo</filename> binary
  743. as well as the debugging information:
  744. <literallayout class='monospaced'>
  745. $ &lt;target-abi&gt;-gdb rootfs/usr/bin/foo
  746. </literallayout>
  747. Once the GDB prompt appears, you must instruct GDB to load all the libraries
  748. of the inferior binary from <filename>tmp/rootfs</filename> as follows:
  749. <literallayout class='monospaced'>
  750. $ set solib-absolute-prefix /path/to/tmp/rootfs
  751. </literallayout>
  752. The pathname <filename>/path/to/tmp/rootfs</filename> must either be
  753. the absolute path to <filename>tmp/rootfs</filename> or the location at which
  754. binaries with debugging information reside.
  755. </para>
  756. <para>
  757. At this point you can have GDB connect to the GDBSERVER that is running
  758. on the remote target by using the following command form:
  759. <literallayout class='monospaced'>
  760. $ target remote remote-target-ip-address:2345
  761. </literallayout>
  762. The <filename>remote-target-ip-address</filename> is the IP address of the
  763. remote target where the GDBSERVER is running.
  764. Port 2345 is the port on which the GDBSERVER is running.
  765. </para>
  766. </section>
  767. <section id="platdev-gdb-remotedebug-launch-gdb-using">
  768. <title>Using the Debugger</title>
  769. <para>
  770. You can now proceed with debugging as normal - as if you were debugging
  771. on the local machine.
  772. For example, to instruct GDB to break in the "main" function and then
  773. continue with execution of the inferior binary use the following commands
  774. from within GDB:
  775. <literallayout class='monospaced'>
  776. (gdb) break main
  777. (gdb) continue
  778. </literallayout>
  779. </para>
  780. <para>
  781. For more information about using GDB, see the project's online documentation at
  782. <ulink url="http://sourceware.org/gdb/download/onlinedocs/"/>.
  783. </para>
  784. </section>
  785. </section>
  786. </section>
  787. <section id="platdev-oprofile">
  788. <title>Profiling with OProfile</title>
  789. <para>
  790. <ulink url="http://oprofile.sourceforge.net/">OProfile</ulink> is a
  791. statistical profiler well suited for finding performance
  792. bottlenecks in both userspace software and in the kernel.
  793. This profiler provides answers to questions like "Which functions does my application spend
  794. the most time in when doing X?"
  795. Because Poky is well integrated with OProfile it makes profiling applications on target
  796. hardware straightforward.
  797. </para>
  798. <para>
  799. To use OProfile you need an image that has OProfile installed.
  800. The easiest way to do this is with "tools-profile" in
  801. <glossterm><link linkend='var-IMAGE_FEATURES'>IMAGE_FEATURES</link></glossterm>.
  802. You also need debugging symbols to be available on the system where the analysis
  803. takes place.
  804. You can gain access to the symbols by using "dbg-pkgs" in
  805. <glossterm><link linkend='var-IMAGE_FEATURES'>IMAGE_FEATURES</link></glossterm> or by
  806. installing the appropriate <filename>-dbg</filename> packages.
  807. </para>
  808. <para>
  809. For successful call graph analysis the binaries must preserve the frame
  810. pointer register and should also be compiled with the
  811. "-fno-omit-framepointer" flag.
  812. In Poky you can achieve this by setting
  813. <glossterm><link linkend='var-SELECTED_OPTIMIZATION'>SELECTED_OPTIMIZATION
  814. </link></glossterm> to "-fexpensive-optimizations -fno-omit-framepointer
  815. -frename-registers -O2".
  816. You can also achieve it by setting
  817. <glossterm><link linkend='var-DEBUG_BUILD'>DEBUG_BUILD</link></glossterm> to "1" in
  818. <filename>local.conf</filename>.
  819. If you use the DEBUG_BUILD variable you will also add extra debug information
  820. that can make the debug packages large.
  821. </para>
  822. <section id="platdev-oprofile-target">
  823. <title>Profiling on the Target</title>
  824. <para>
  825. Using OProfile you can perform all the profiling work on the target device.
  826. A simple OProfile session might look like the following:
  827. </para>
  828. <para>
  829. <literallayout class='monospaced'>
  830. # opcontrol --reset
  831. # opcontrol --start --separate=lib --no-vmlinux -c 5
  832. [do whatever is being profiled]
  833. # opcontrol --stop
  834. $ opreport -cl
  835. </literallayout>
  836. </para>
  837. <para>
  838. In this example, the reset command clears any previously profiled data.
  839. The next command starts OProfile.
  840. The options used when starting the profiler separate dynamic library data
  841. within applications, disable kernel profiling, and enable callgraphing up to
  842. five levels deep.
  843. </para>
  844. <note><para>
  845. To profile the kernel, you would specify the
  846. <parameter>--vmlinux=/path/to/vmlinux</parameter> option.
  847. The vmlinux file is usually in <filename class="directory">/boot/</filename>
  848. in Poky and must match the running kernel.
  849. </para></note>
  850. <para>
  851. After you perform your profiling tasks, the next command stops the profiler.
  852. After that you can view results with the "opreport" command with options
  853. to see the separate library symbols and callgraph information.
  854. </para>
  855. <para>
  856. Callgraphing logs information about time spent in functions and about a function's
  857. calling function (parent) and called functions (children).
  858. The higher the callgraphing depth,
  859. the more accurate the results.
  860. However, higher depths also increase the logging
  861. overhead.
  862. Consequently, you should take care when setting the callgraphing depth.
  863. </para>
  864. <note><para>
  865. On ARM, binaries need to have the frame pointer enabled for callgraphing to work.
  866. To accomplish this use the <filename>-fno-omit-framepointer</filename> option
  867. with <filename>gcc</filename>.
  868. </para></note>
  869. <para>
  870. For more information on using OProfile, see the OProfile
  871. online documentation at
  872. <ulink url="http://oprofile.sourceforge.net/docs/"/>.
  873. </para>
  874. </section>
  875. <section id="platdev-oprofile-oprofileui">
  876. <title>Using OProfileUI</title>
  877. <para>
  878. A graphical user interface for OProfile is also available.
  879. You can download and build it from the Yocto Project at
  880. <ulink url="http://git.yoctoproject.org/cgit.cgi/oprofileui/"></ulink>.
  881. If the "tools-profile" image feature is selected, all necessary binaries
  882. are installed onto the target device for OProfileUI interaction.
  883. </para>
  884. <!-- DISABLED, Need a more 'contextual' shot?
  885. <screenshot>
  886. <mediaobject>
  887. <imageobject>
  888. <imagedata fileref="screenshots/ss-oprofile-viewer.png" format="PNG"/>
  889. </imageobject>
  890. <caption>
  891. <para>OProfileUI Viewer showing an application being profiled on a remote device</para>
  892. </caption>
  893. </mediaobject>
  894. </screenshot>
  895. <para>
  896. In order to convert the data in the sample format from the target
  897. to the host you need the <filename>opimport</filename> program.
  898. This program is not included in standard Debian OProfile packages.
  899. However, an OProfile package with this addition is available from the
  900. <ulink url='http://debian.o-hand.com/'>OpenedHand repository</ulink>.
  901. We recommend using OProfile 0.9.3 or greater.
  902. </para>
  903. -->
  904. <para>
  905. Even though Poky usually includes all needed patches on the target device, you
  906. might find you need other OProfile patches for recent OProfileUI features.
  907. If so, see the <ulink url='http://git.yoctoproject.org/cgit.cgi/oprofileui/tree/README'>
  908. OProfileUI README</ulink> for the most recent information.
  909. </para>
  910. <section id="platdev-oprofile-oprofileui-online">
  911. <title>Online Mode</title>
  912. <para>
  913. Using OProfile in online mode assumes a working network connection with the target
  914. hardware.
  915. With this connection, you just need to run "oprofile-server" on the device.
  916. By default OProfile listens on port 4224.
  917. </para>
  918. <note><para>
  919. You can change the port using the <filename>--port</filename> command-line
  920. option.
  921. </para></note>
  922. <para>
  923. The client program is called "oprofile-viewer" and its UI is relatively
  924. straightforward.
  925. You access key functionality through the buttons on the toolbar, which
  926. are duplicated in the menus.
  927. The buttons are:
  928. </para>
  929. <itemizedlist>
  930. <listitem>
  931. <para>
  932. Connect - Connects to the remote host.
  933. You can also supply the IP address or hostname.
  934. </para>
  935. </listitem>
  936. <listitem>
  937. <para>
  938. Disconnect - Disconnects from the target.
  939. </para>
  940. </listitem>
  941. <listitem>
  942. <para>
  943. Start - Starts profiling on the device.
  944. </para>
  945. </listitem>
  946. <listitem>
  947. <para>
  948. Stop - Stops profiling on the device and downloads the data to the local
  949. host.
  950. Stopping the profiler generates the profile and displays it in the viewer.
  951. </para>
  952. </listitem>
  953. <listitem>
  954. <para>
  955. Download - Downloads the data from the target and generates the profile,
  956. which appears in the viewer.
  957. </para>
  958. </listitem>
  959. <listitem>
  960. <para>
  961. Reset - Resets the sample data on the device.
  962. Resetting the data removes sample information collected from previous
  963. sampling runs.
  964. Be sure you reset the data if you do not want to include old sample information.
  965. </para>
  966. </listitem>
  967. <listitem>
  968. <para>
  969. Save - Saves the data downloaded from the target to another directory for later
  970. examination.
  971. </para>
  972. </listitem>
  973. <listitem>
  974. <para>
  975. Open - Loads previously saved data.
  976. </para>
  977. </listitem>
  978. </itemizedlist>
  979. <para>
  980. The client downloads the complete 'profile archive' from
  981. the target to the host for processing.
  982. This archive is a directory that contains the sample data, the object files
  983. and the debug information for the object files.
  984. The archive is then converted using the "oparchconv" script, which is
  985. included in this distribution.
  986. The script uses "opimport" to convert the archive from
  987. the target to something that can be processed on the host.
  988. </para>
  989. <para>
  990. Downloaded archives reside in <filename>/tmp</filename> and are cleared up
  991. when they are no longer in use.
  992. </para>
  993. <para>
  994. If you wish to perform kernel profiling you need to be sure
  995. a "vmlinux" file that matches the running kernel is available.
  996. In Poky, that file is usually located in
  997. <filename>/boot/vmlinux-KERNELVERSION</filename>, where KERNEL-version is the
  998. version of the kernel.
  999. Poky generates separate vmlinux packages for each kernel
  1000. it builds so it should be a question of just making sure a matching package is
  1001. installed - for example: <filename>opkg install kernel-vmlinux</filename>.
  1002. The files are automatically installed into development and profiling images
  1003. alongside OProfile.
  1004. There is a configuration option within the OProfileUI settings page where
  1005. you can enter the location of the vmlinux file.
  1006. </para>
  1007. <para>
  1008. Waiting for debug symbols to transfer from the device can be slow, and it
  1009. is not always necessary to actually have them on the device for OProfile use.
  1010. All that is needed is a copy of the filesystem with the debug symbols present
  1011. on the viewer system.
  1012. The "<link linkend='platdev-gdb-remotedebug-launch-gdb'>Launching GDB
  1013. on the Host Computer</link>" section covers how to create such a directory with Poky and
  1014. how to use the OProfileUI Settings dialog to specify the location.
  1015. If you specify the directory, it will be used when the file checksums
  1016. match those on the system you are profiling.
  1017. </para>
  1018. </section>
  1019. <section id="platdev-oprofile-oprofileui-offline">
  1020. <title>Offline Mode</title>
  1021. <para>
  1022. If network access to the target is unavailable, you can generate
  1023. an archive for processing in "oprofile-viewer" as follows:
  1024. </para>
  1025. <para>
  1026. <literallayout class='monospaced'>
  1027. # opcontrol --reset
  1028. # opcontrol --start --separate=lib --no-vmlinux -c 5
  1029. [do whatever is being profiled]
  1030. # opcontrol --stop
  1031. # oparchive -o my_archive
  1032. </literallayout>
  1033. </para>
  1034. <para>
  1035. In the above example <filename>my_archive</filename> is the name of the
  1036. archive directory where you would like the profile archive to be kept.
  1037. After the directory is created, you can copy it to another host and load it
  1038. using "oprofile-viewer" open functionality.
  1039. If necessary, the archive is converted.
  1040. </para>
  1041. </section>
  1042. </section>
  1043. </section>
  1044. </chapter>
  1045. <!--
  1046. vim: expandtab tw=80 ts=4
  1047. -->