sdk-extensible.xml 67 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333
  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='sdk-extensible'>
  5. <title>Using the Extensible SDK</title>
  6. <para>
  7. This chapter describes the extensible SDK and how to use it.
  8. The extensible SDK makes it easy to add new applications and libraries
  9. to an image, modify the source for an existing component, test
  10. changes on the target hardware, and ease integration into the rest of the
  11. <ulink url='&YOCTO_DOCS_DEV_URL;#build-system-term'>OpenEmbedded build system</ulink>.
  12. </para>
  13. <para>
  14. Information in this chapter covers features that are not part of the
  15. standard SDK.
  16. In other words, the chapter presents information unique to the
  17. extensible SDK only.
  18. For information on how to use the standard SDK, see the
  19. "<link linkend='sdk-using-the-standard-sdk'>Using the Standard SDK</link>"
  20. chapter.
  21. </para>
  22. <section id='sdk-setting-up-to-use-the-extensible-sdk'>
  23. <title>Setting Up to Use the Extensible SDK</title>
  24. <para>
  25. Getting set up to use the extensible SDK is identical to getting set
  26. up to use the standard SDK.
  27. You still need to locate and run the installer and then run the
  28. environment setup script.
  29. See the
  30. "<link linkend='sdk-installing-the-sdk'>Installing the SDK</link>"
  31. and the
  32. "<link linkend='sdk-running-the-sdk-environment-setup-script'>Running the SDK Environment Setup Script</link>"
  33. sections for general information.
  34. The following items highlight the only differences between getting
  35. set up to use the extensible SDK as compared to the standard SDK:
  36. <itemizedlist>
  37. <listitem><para><emphasis>Default Installation Directory:</emphasis>
  38. By default, the extensible SDK installs into the
  39. <filename>poky_sdk</filename> folder of your home directory.
  40. As with the standard SDK, you can choose to install the
  41. extensible SDK in any location when you run the installer.
  42. However, unlike the standard SDK, the location you choose needs
  43. to be writable for whichever users need to use the SDK,
  44. since files will need to be written under that directory during
  45. the normal course of operation.
  46. </para></listitem>
  47. <listitem><para><emphasis>Build Tools and Build System:</emphasis>
  48. The extensible SDK installer performs additional tasks as
  49. compared to the standard SDK installer.
  50. to the SDK and the installer also prepares the internal build
  51. system within the SDK.
  52. You can find pre-built extensible SDK installers in the same
  53. <ulink url='http://downloads.yoctoproject.org/releases/yocto/yocto-&DISTRO;/toolchain/'>toolchain</ulink>
  54. location as the pre-built standard SDK installers.
  55. For extensible SDK installers, the
  56. <filename>ext</filename> string is part of the name.
  57. Here is an example:
  58. <literallayout class='monospaced'>
  59. poky-glibc-x86_64-core-image-sato-core2-64-toolchain-ext-&DISTRO;.sh
  60. </literallayout>
  61. <note>
  62. As an alternative to downloading an SDK, you can build the toolchain
  63. installer.
  64. For information on building the installer, see the
  65. "<link linkend='sdk-building-an-sdk-installer'>Building an SDK Installer</link>"
  66. section.
  67. Another helpful resource for building an installer is the
  68. <ulink url='https://wiki.yoctoproject.org/wiki/TipsAndTricks/RunningEclipseAgainstBuiltImage'>Cookbook guide to Making an Eclipse Debug Capable Image</ulink>
  69. wiki page.
  70. </note>
  71. Here is example output for running the extensible SDK
  72. installer:
  73. <literallayout class='monospaced'>
  74. $ ./poky-glibc-x86_64-core-image-minimal-core2-64-toolchain-ext-&DISTRO;.sh
  75. Poky (Yocto Project Reference Distro) Extensible SDK installer version &DISTRO;
  76. ===================================================================================
  77. Enter target directory for SDK (default: ~/poky_sdk):
  78. You are about to install the SDK to "/home/scottrif/poky_sdk". Proceed[Y/n]? Y
  79. Extracting SDK......................................................................done
  80. Setting it up...
  81. Extracting buildtools...
  82. Preparing build system...
  83. done
  84. SDK has been successfully set up and is ready to be used.
  85. Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
  86. $ . /home/scottrif/poky_sdk/environment-setup-core2-64-poky-linux
  87. </literallayout>
  88. </para></listitem>
  89. </itemizedlist>
  90. </para>
  91. <para>
  92. After installing the SDK, you need to run the SDK environment setup
  93. script.
  94. Here is the output from an example run:
  95. <literallayout class='monospaced'>
  96. $ cd /home/scottrif/poky_sdk
  97. $ source environment-setup-core2-64-poky-linux
  98. SDK environment now set up; additionally you may now run devtool to perform development tasks.
  99. Run devtool --help for further details.
  100. </literallayout>
  101. Once you run the environment setup script, you have
  102. <filename>devtool</filename> available.
  103. </para>
  104. </section>
  105. <section id='using-devtool-in-your-sdk-workflow'>
  106. <title>Using <filename>devtool</filename> in Your SDK Workflow</title>
  107. <para>
  108. The cornerstone of the extensible SDK is a command-line tool
  109. called <filename>devtool</filename>.
  110. This tool provides a number of features that help
  111. you build, test and package software within the extensible SDK, and
  112. optionally integrate it into an image built by the OpenEmbedded build
  113. system.
  114. </para>
  115. <para>
  116. The <filename>devtool</filename> command line is organized similarly
  117. to
  118. <ulink url='&YOCTO_DOCS_DEV_URL;#git'>Git</ulink> in that it has a
  119. number of sub-commands for each function.
  120. You can run <filename>devtool --help</filename> to see all the
  121. commands.
  122. </para>
  123. <para>
  124. Two <filename>devtool</filename> subcommands that provide
  125. entry-points into development are:
  126. <itemizedlist>
  127. <listitem><para><emphasis><filename>devtool add</filename></emphasis>:
  128. Assists in adding new software to be built.
  129. </para></listitem>
  130. <listitem><para><emphasis><filename>devtool modify</filename></emphasis>:
  131. Sets up an environment to enable you to modify the source of
  132. an existing component.
  133. </para></listitem>
  134. </itemizedlist>
  135. As with the OpenEmbedded build system, "recipes" represent software
  136. packages within <filename>devtool</filename>.
  137. When you use <filename>devtool add</filename>, a recipe is
  138. automatically created.
  139. When you use <filename>devtool modify</filename>, the specified
  140. existing recipe is used in order to determine where to get the source
  141. code and how to patch it.
  142. In both cases, an environment is set up so that when you build the
  143. recipe a source tree that is under your control is used in order to
  144. allow you to make changes to the source as desired.
  145. By default, both new recipes and the source go into a "workspace"
  146. directory under the SDK.
  147. </para>
  148. <para>
  149. The remainder of this section presents the
  150. <filename>devtool add</filename> and
  151. <filename>devtool modify</filename> workflows.
  152. </para>
  153. <section id='sdk-use-devtool-to-add-an-application'>
  154. <title>Use <filename>devtool add</filename> to Add an Application</title>
  155. <para>
  156. The <filename>devtool add</filename> command generates
  157. a new recipe based on existing source code.
  158. This command takes advantage of the
  159. <ulink url='&YOCTO_DOCS_DEV_URL;#devtool-the-workspace-layer-structure'>workspace</ulink>
  160. layer that many <filename>devtool</filename> commands
  161. use.
  162. The command is flexible enough to allow you to extract source
  163. code into both the workspace or a separate local Git repository
  164. and to use existing code that does not need to be extracted.
  165. </para>
  166. <para>
  167. Depending on your particular scenario, the arguments and options
  168. you use with <filename>devtool add</filename> form different
  169. combinations.
  170. The following diagram shows common development flows
  171. you would use with the <filename>devtool add</filename>
  172. command:
  173. </para>
  174. <para>
  175. <imagedata fileref="figures/sdk-devtool-add-flow.png" align="center" />
  176. </para>
  177. <para>
  178. <orderedlist>
  179. <listitem><para><emphasis>Generating the New Recipe</emphasis>:
  180. The top part of the flow shows three scenarios by which
  181. you could use <filename>devtool add</filename> to
  182. generate a recipe based on existing source code.</para>
  183. <para>In a shared development environment, it is
  184. typical where other developers are responsible for
  185. various areas of source code.
  186. As a developer, you are probably interested in using
  187. that source code as part of your development using
  188. the Yocto Project.
  189. All you need is access to the code, a recipe, and a
  190. controlled area in which to do your work.</para>
  191. <para>Within the diagram, three possible scenarios
  192. feed into the <filename>devtool add</filename> workflow:
  193. <itemizedlist>
  194. <listitem><para><emphasis>Left</emphasis>:
  195. The left scenario represents a common situation
  196. where the source code does not exist locally
  197. and needs to be extracted.
  198. In this situation, you just let it get
  199. extracted to the default workspace - you do not
  200. want it in some specific location outside of the
  201. workspace.
  202. Thus, everything you need will be located in the
  203. workspace:
  204. <literallayout class='monospaced'>
  205. $ devtool add <replaceable>recipe fetchuri</replaceable>
  206. </literallayout>
  207. With this command, <filename>devtool</filename>
  208. creates a recipe and an append file in the
  209. workspace as well as extracts the upstream
  210. source files into a local Git repository also
  211. within the <filename>sources</filename> folder.
  212. </para></listitem>
  213. <listitem><para><emphasis>Middle</emphasis>:
  214. The middle scenario also represents a situation where
  215. the source code does not exist locally.
  216. In this case, the code is again upstream
  217. and needs to be extracted to some
  218. local area - this time outside of the default
  219. workspace.
  220. If required, <filename>devtool</filename>
  221. always creates
  222. a Git repository locally during the extraction.
  223. Furthermore, the first positional argument
  224. <replaceable>srctree</replaceable> in this case
  225. identifies where the
  226. <filename>devtool add</filename> command
  227. will locate the extracted code outside of the
  228. workspace:
  229. <literallayout class='monospaced'>
  230. $ devtool add <replaceable>recipe srctree fetchuri</replaceable>
  231. </literallayout>
  232. In summary, the source code is pulled from
  233. <replaceable>fetchuri</replaceable> and extracted
  234. into the location defined by
  235. <replaceable>srctree</replaceable> as a local
  236. Git repository.</para>
  237. <para>Within workspace, <filename>devtool</filename>
  238. creates both the recipe and an append file
  239. for the recipe.
  240. </para></listitem>
  241. <listitem><para><emphasis>Right</emphasis>:
  242. The right scenario represents a situation
  243. where the source tree (srctree) has been
  244. previously prepared outside of the
  245. <filename>devtool</filename> workspace.
  246. </para>
  247. <para>The following command names the recipe
  248. and identifies where the existing source tree
  249. is located:
  250. <literallayout class='monospaced'>
  251. $ devtool add <replaceable>recipe srctree</replaceable>
  252. </literallayout>
  253. The command examines the source code and creates
  254. a recipe for it placing the recipe into the
  255. workspace.</para>
  256. <para>Because the extracted source code already exists,
  257. <filename>devtool</filename> does not try to
  258. relocate it into the workspace - just the new
  259. the recipe is placed in the workspace.</para>
  260. <para>Aside from a recipe folder, the command
  261. also creates an append folder and places an initial
  262. <filename>*.bbappend</filename> within.
  263. </para></listitem>
  264. </itemizedlist>
  265. </para></listitem>
  266. <listitem><para><emphasis>Edit the Recipe</emphasis>:
  267. At this point, you can use <filename>devtool edit-recipe</filename>
  268. to open up the editor as defined by the
  269. <filename>$EDITOR</filename> environment variable
  270. and modify the file:
  271. <literallayout class='monospaced'>
  272. $ devtool edit-recipe <replaceable>recipe</replaceable>
  273. </literallayout>
  274. From within the editor, you can make modifications to the
  275. recipe that take affect when you build it later.
  276. </para></listitem>
  277. <listitem><para><emphasis>Build the Recipe or Rebuild the Image</emphasis>:
  278. At this point in the flow, the next step you
  279. take depends on what you are going to do with
  280. the new code.</para>
  281. <para>If you need to take the build output and eventually
  282. move it to the target hardware, you would use
  283. <filename>devtool build</filename>:
  284. <literallayout class='monospaced'>
  285. $ devtool build <replaceable>recipe</replaceable>
  286. </literallayout></para>
  287. <para>On the other hand, if you want an image to
  288. contain the recipe's packages for immediate deployment
  289. onto a device (e.g. for testing purposes), you can use
  290. the <filename>devtool build-image</filename> command:
  291. <literallayout class='monospaced'>
  292. $ devtool build-image <replaceable>image</replaceable>
  293. </literallayout>
  294. </para></listitem>
  295. <listitem><para><emphasis>Deploy the Build Output</emphasis>:
  296. When you use the <filename>devtool build</filename>
  297. command to build out your recipe, you probably want to
  298. see if the resulting build output works as expected on target
  299. hardware.
  300. <note>
  301. This step assumes you have a previously built
  302. image that is already either running in QEMU or
  303. running on actual hardware.
  304. Also, it is assumed that for deployment of the image
  305. to the target, SSH is installed in the image and if
  306. the image is running on real hardware that you have
  307. network access to and from your development machine.
  308. </note>
  309. You can deploy your build output to that target hardware by
  310. using the <filename>devtool deploy-target</filename> command:
  311. <literallayout class='monospaced'>
  312. $ devtool deploy-target <replaceable>recipe target</replaceable>
  313. </literallayout>
  314. The <replaceable>target</replaceable> is a live target machine
  315. running as an SSH server.</para>
  316. <para>You can, of course, also deploy the image you build
  317. using the <filename>devtool build-image</filename> command
  318. to actual hardware.
  319. However, <filename>devtool</filename> does not provide a
  320. specific command that allows you to do this.
  321. </para></listitem>
  322. <listitem><para><emphasis>Optionally Update the Recipe With Patch Files</emphasis>:
  323. Once you are satisfied with the recipe, if you have made
  324. any changes to the source tree that you want to have
  325. applied by the recipe, you need to generate patches
  326. from those changes.
  327. You do this before moving the recipe
  328. to its final layer and cleaning up the workspace area
  329. <filename>devtool</filename> uses.
  330. This optional step is especially relevant if you are
  331. using or adding third-party software.</para>
  332. <para>To convert commits created using Git to patch files,
  333. use the <filename>devtool update-recipe</filename> command.
  334. <note>
  335. Any changes you want to turn into patches must be
  336. committed to the Git repository in the source tree.
  337. </note>
  338. <literallayout class='monospaced'>
  339. $ devtool update-recipe <replaceable>recipe</replaceable>
  340. </literallayout>
  341. </para></listitem>
  342. <listitem><para><emphasis>Move the Recipe to its Permanent Layer</emphasis>:
  343. Before cleaning up the workspace, you need to move the
  344. final recipe to its permanent layer.
  345. You must do this before using the
  346. <filename>devtool reset</filename> command if you want to
  347. retain the recipe.
  348. </para></listitem>
  349. <listitem><para><emphasis>Reset the Recipe</emphasis>:
  350. As a final step, you can restore the state such that
  351. standard layers and the upstream source is used to build
  352. the recipe rather than data in the workspace.
  353. To reset the recipe, use the <filename>devtool reset</filename>
  354. command:
  355. <literallayout class='monospaced'>
  356. $ devtool reset <replaceable>recipe</replaceable>
  357. </literallayout>
  358. </para></listitem>
  359. </orderedlist>
  360. </para>
  361. </section>
  362. <section id='sdk-devtool-use-devtool-modify-to-modify-the-source-of-an-existing-component'>
  363. <title>Use <filename>devtool modify</filename> to Modify the Source of an Existing Component</title>
  364. <para>
  365. The <filename>devtool modify</filename> command prepares the
  366. way to work on existing code that already has a recipe in
  367. place.
  368. The command is flexible enough to allow you to extract code,
  369. specify the existing recipe, and keep track of and gather any
  370. patch files from other developers that are
  371. associated with the code.
  372. </para>
  373. <para>
  374. Depending on your particular scenario, the arguments and options
  375. you use with <filename>devtool modify</filename> form different
  376. combinations.
  377. The following diagram shows common development flows
  378. you would use with the <filename>devtool modify</filename>
  379. command:
  380. </para>
  381. <para>
  382. <imagedata fileref="figures/sdk-devtool-modify-flow.png" align="center" />
  383. </para>
  384. <para>
  385. <orderedlist>
  386. <listitem><para><emphasis>Preparing to Modify the Code</emphasis>:
  387. The top part of the flow shows three scenarios by which
  388. you could use <filename>devtool modify</filename> to
  389. prepare to work on source files.
  390. Each scenario assumes the following:
  391. <itemizedlist>
  392. <listitem><para>The recipe exists in some layer external
  393. to the <filename>devtool</filename> workspace.
  394. </para></listitem>
  395. <listitem><para>The source files exist upstream in an
  396. un-extracted state or locally in a previously
  397. extracted state.
  398. </para></listitem>
  399. </itemizedlist>
  400. The typical situation is where another developer has
  401. created some layer for use with the Yocto Project and
  402. their recipe already resides in that layer.
  403. Furthermore, their source code is readily available
  404. either upstream or locally.
  405. <itemizedlist>
  406. <listitem><para><emphasis>Left</emphasis>:
  407. The left scenario represents a common situation
  408. where the source code does not exist locally
  409. and needs to be extracted.
  410. In this situation, the source is extracted
  411. into the default workspace location.
  412. The recipe, in this scenario, is in its own
  413. layer outside the workspace
  414. (i.e.
  415. <filename>meta-</filename><replaceable>layername</replaceable>).
  416. </para>
  417. <para>The following command identifies the recipe
  418. and by default extracts the source files:
  419. <literallayout class='monospaced'>
  420. $ devtool modify <replaceable>recipe</replaceable>
  421. </literallayout>
  422. Once <filename>devtool</filename>locates the recipe,
  423. it uses the
  424. <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink>
  425. variable to locate the source code and
  426. any local patch files from other developers are
  427. located.
  428. <note>
  429. You cannot provide an URL for
  430. <replaceable>srctree</replaceable> when using the
  431. <filename>devtool modify</filename> command.
  432. </note>
  433. With this scenario, however, since no
  434. <replaceable>srctree</replaceable> argument exists, the
  435. <filename>devtool modify</filename> command by default
  436. extracts the source files to a Git structure.
  437. Furthermore, the location for the extracted source is the
  438. default area within the workspace.
  439. The result is that the command sets up both the source
  440. code and an append file within the workspace with the
  441. recipe remaining in its original location.
  442. </para></listitem>
  443. <listitem><para><emphasis>Middle</emphasis>:
  444. The middle scenario represents a situation where
  445. the source code also does not exist locally.
  446. In this case, the code is again upstream
  447. and needs to be extracted to some
  448. local area as a Git repository.
  449. The recipe, in this scenario, is again in its own
  450. layer outside the workspace.</para>
  451. <para>The following command tells
  452. <filename>devtool</filename> what recipe with
  453. which to work and, in this case, identifies a local
  454. area for the extracted source files that is outside
  455. of the default workspace:
  456. <literallayout class='monospaced'>
  457. $ devtool modify <replaceable>recipe srctree</replaceable>
  458. </literallayout>
  459. As with all extractions, the command uses
  460. the recipe's <filename>SRC_URI</filename> to locate the
  461. source files.
  462. Once the files are located, the command by default
  463. extracts them.
  464. Providing the <replaceable>srctree</replaceable>
  465. argument instructs <filename>devtool</filename> where
  466. place the extracted source.</para>
  467. <para>Within workspace, <filename>devtool</filename>
  468. creates an append file for the recipe.
  469. The recipe remains in its original location but
  470. the source files are extracted to the location you
  471. provided with <replaceable>srctree</replaceable>.
  472. </para></listitem>
  473. <listitem><para><emphasis>Right</emphasis>:
  474. The right scenario represents a situation
  475. where the source tree
  476. (<replaceable>srctree</replaceable>) exists as a
  477. previously extracted Git structure outside of
  478. the <filename>devtool</filename> workspace.
  479. In this example, the recipe also exists
  480. elsewhere in its own layer.
  481. </para>
  482. <para>The following command tells
  483. <filename>devtool</filename> the recipe
  484. with which to work, uses the "-n" option to indicate
  485. source does not need to be extracted, and uses
  486. <replaceable>srctree</replaceable> to point to the
  487. previously extracted source files:
  488. <literallayout class='monospaced'>
  489. $ devtool modify -n <replaceable>recipe srctree</replaceable>
  490. </literallayout>
  491. </para>
  492. <para>Once the command finishes, it creates only
  493. an append file for the recipe in the workspace.
  494. The recipe and the source code remain in their
  495. original locations.
  496. </para></listitem>
  497. </itemizedlist>
  498. </para></listitem>
  499. <listitem><para><emphasis>Edit the Source</emphasis>:
  500. Once you have used the <filename>devtool modify</filename>
  501. command, you are free to make changes to the source
  502. files.
  503. You can use any editor you like to make and save
  504. your source code modifications.
  505. </para></listitem>
  506. <listitem><para><emphasis>Build the Recipe</emphasis>:
  507. Once you have updated the source files, you can build
  508. the recipe.
  509. </para></listitem>
  510. <listitem><para><emphasis>Deploy the Build Output</emphasis>:
  511. When you use the <filename>devtool build</filename>
  512. command to build out your recipe, you probably want to see
  513. if the resulting build output works as expected on target
  514. hardware.
  515. <note>
  516. This step assumes you have a previously built
  517. image that is already either running in QEMU or
  518. running on actual hardware.
  519. Also, it is assumed that for deployment of the image
  520. to the target, SSH is installed in the image and if
  521. the image is running on real hardware that you have
  522. network access to and from your development machine.
  523. </note>
  524. You can deploy your build output to that target hardware by
  525. using the <filename>devtool deploy-target</filename> command:
  526. <literallayout class='monospaced'>
  527. $ devtool deploy-target <replaceable>recipe target</replaceable>
  528. </literallayout>
  529. The <replaceable>target</replaceable> is a live target machine
  530. running as an SSH server.</para>
  531. <para>You can, of course, also deploy the image you build
  532. using the <filename>devtool build-image</filename> command
  533. to actual hardware.
  534. However, <filename>devtool</filename> does not provide a
  535. specific command that allows you to do this.
  536. </para></listitem>
  537. <listitem><para><emphasis>Optionally Create Patch Files for Your Changes</emphasis>:
  538. After you have debugged your changes, you can
  539. use <filename>devtool update-recipe</filename> to
  540. generate patch files for all the commits you have
  541. made.
  542. <note>
  543. Patch files are generated only for changes
  544. you have committed.
  545. </note>
  546. <literallayout class='monospaced'>
  547. $ devtool update-recipe <replaceable>recipe</replaceable>
  548. </literallayout>
  549. By default, the
  550. <filename>devtool update-recipe</filename> command
  551. creates the patch files in a folder named the same
  552. as the recipe beneath the folder in which the recipe
  553. resides, and updates the recipe's
  554. <ulink url='&YOCTO_DOCS_REF_URL;#var-SRC_URI'><filename>SRC_URI</filename></ulink>
  555. statement to point to the generated patch files.
  556. <note>
  557. You can use the
  558. "--append <replaceable>LAYERDIR</replaceable>"
  559. option to cause the command to create append files
  560. in a specific layer rather than the default
  561. recipe layer.
  562. </note>
  563. </para></listitem>
  564. <listitem><para><emphasis>Restore the Workspace</emphasis>:
  565. The <filename>devtool reset</filename> restores the
  566. state so that standard layers and upstream sources are
  567. used to build the recipe rather than what is in the
  568. workspace.
  569. <literallayout class='monospaced'>
  570. $ devtool reset <replaceable>recipe</replaceable>
  571. </literallayout>
  572. </para></listitem>
  573. </orderedlist>
  574. </para>
  575. </section>
  576. </section>
  577. <section id='sdk-a-closer-look-at-devtool-add'>
  578. <title>A Closer Look at <filename>devtool add</filename></title>
  579. <para>
  580. The <filename>devtool add</filename> command automatically creates a
  581. recipe based on the source tree with which you provide it.
  582. Currently, the command has support for the following:
  583. <itemizedlist>
  584. <listitem><para>
  585. Autotools (<filename>autoconf</filename> and
  586. <filename>automake</filename>)
  587. </para></listitem>
  588. <listitem><para>
  589. CMake
  590. </para></listitem>
  591. <listitem><para>
  592. Scons
  593. </para></listitem>
  594. <listitem><para>
  595. <filename>qmake</filename>
  596. </para></listitem>
  597. <listitem><para>
  598. Plain <filename>Makefile</filename>
  599. </para></listitem>
  600. <listitem><para>
  601. Out-of-tree kernel module
  602. </para></listitem>
  603. <listitem><para>
  604. Binary package (i.e. "-b" option)
  605. </para></listitem>
  606. <listitem><para>
  607. Node.js module through
  608. <filename>npm</filename>
  609. </para></listitem>
  610. <listitem><para>
  611. Python modules that use <filename>setuptools</filename>
  612. or <filename>distutils</filename>
  613. </para></listitem>
  614. </itemizedlist>
  615. </para>
  616. <para>
  617. Apart from binary packages, the determination of how a source tree
  618. should be treated is automatic based on the files present within
  619. that source tree.
  620. For example, if a <filename>CMakeLists.txt</filename> file is found,
  621. then the source tree is assumed to be using
  622. CMake and is treated accordingly.
  623. <note>
  624. In most cases, you need to edit the automatically generated
  625. recipe in order to make it build properly.
  626. Typically, you would go through several edit and build cycles
  627. until you can build the recipe.
  628. Once the recipe can be built, you could use possible further
  629. iterations to test the recipe on the target device.
  630. </note>
  631. </para>
  632. <para>
  633. The remainder of this section covers specifics regarding how parts
  634. of the recipe are generated.
  635. </para>
  636. <section id='sdk-name-and-version'>
  637. <title>Name and Version</title>
  638. <para>
  639. If you do not specify a name and version on the command
  640. line, <filename>devtool add</filename> attempts to determine
  641. the name and version of the software being built from
  642. various metadata within the source tree.
  643. Furthermore, the command sets the name of the created recipe
  644. file accordingly.
  645. If the name or version cannot be determined, the
  646. <filename>devtool add</filename> command prints an error and
  647. you must re-run the command with both the name and version
  648. or just the name or version specified.
  649. </para>
  650. <para>
  651. Sometimes the name or version determined from the source tree
  652. might be incorrect.
  653. For such a case, you must reset the recipe:
  654. <literallayout class='monospaced'>
  655. $ devtool reset -n <replaceable>recipename</replaceable>
  656. </literallayout>
  657. After running the <filename>devtool reset</filename> command,
  658. you need to run <filename>devtool add</filename> again and
  659. provide the name or the version.
  660. </para>
  661. </section>
  662. <section id='sdk-dependency-detection-and-mapping'>
  663. <title>Dependency Detection and Mapping</title>
  664. <para>
  665. The <filename>devtool add</filename> command attempts to
  666. detect build-time dependencies and map them to other recipes
  667. in the system.
  668. During this mapping, the command fills in the names of those
  669. recipes in the
  670. <ulink url='&YOCTO_DOCS_REF_URL;#var-DEPENDS'><filename>DEPENDS</filename></ulink>
  671. value within the recipe.
  672. If a dependency cannot be mapped, then a comment is placed in
  673. the recipe indicating such.
  674. The inability to map a dependency might be caused because the
  675. naming is not recognized or because the dependency simply is
  676. not available.
  677. For cases where the dependency is not available, you must use
  678. the <filename>devtool add</filename> command to add an
  679. additional recipe to satisfy the dependency and then come
  680. back to the first recipe and add its name to
  681. <filename>DEPENDS</filename>.
  682. </para>
  683. <para>
  684. If you need to add runtime dependencies, you can do so by
  685. adding the following to your recipe:
  686. <literallayout class='monospaced'>
  687. RDEPENDS_${PN} += "dependency1 dependency2 ..."
  688. </literallayout>
  689. <note>
  690. The <filename>devtool add</filename> command often cannot
  691. distinguish between mandatory and optional dependencies.
  692. Consequently, some of the detected dependencies might
  693. in fact be optional.
  694. When in doubt, consult the documentation or the configure
  695. script for the software the recipe is building for further
  696. details.
  697. In some cases, you might find you can substitute the
  698. dependency for an option to disable the associated
  699. functionality passed to the configure script.
  700. </note>
  701. </para>
  702. </section>
  703. <section id='sdk-license-detection'>
  704. <title>License Detection</title>
  705. <para>
  706. The <filename>devtool add</filename> command attempts to
  707. determine if the software you are adding is able to be
  708. distributed under a common open-source license and sets the
  709. <ulink url='&YOCTO_DOCS_REF_URL;#var-LICENSE'><filename>LICENSE</filename></ulink>
  710. value accordingly.
  711. You should double-check this value against the documentation
  712. or source files for the software you are building and update
  713. that <filename>LICENSE</filename> value if necessary.
  714. </para>
  715. <para>
  716. The <filename>devtool add</filename> command also sets the
  717. <ulink url='&YOCTO_DOCS_REF_URL;#var-LIC_FILES_CHKSUM'><filename>LIC_FILES_CHKSUM</filename></ulink>
  718. value to point to all files that appear to be license-related.
  719. However, license statements often appear in comments at the top
  720. of source files or within documentation.
  721. Consequently, you might need to amend the
  722. <filename>LIC_FILES_CHKSUM</filename> variable to point to one
  723. or more of those comments if present.
  724. Setting <filename>LIC_FILES_CHKSUM</filename> is particularly
  725. important for third-party software.
  726. The mechanism attempts to ensure correct licensing should you
  727. upgrade the recipe to a newer upstream version in future.
  728. Any change in licensing is detected and you receive an error
  729. prompting you to check the license text again.
  730. </para>
  731. <para>
  732. If the <filename>devtool add</filename> command cannot
  733. determine licensing information, the
  734. <filename>LICENSE</filename> value is set to "CLOSED" and the
  735. <filename>LIC_FILES_CHKSUM</filename> vaule remains unset.
  736. This behavior allows you to continue with development but is
  737. unlikely to be correct in all cases.
  738. Consequently, you should check the documentation or source
  739. files for the software you are building to determine the actual
  740. license.
  741. </para>
  742. </section>
  743. <section id='sdk-adding-makefile-only-software'>
  744. <title>Adding Makefile-Only Software</title>
  745. <para>
  746. The use of <filename>make</filename> by itself is very common
  747. in both proprietary and open source software.
  748. Unfortunately, Makefiles are often not written with
  749. cross-compilation in mind.
  750. Thus, <filename>devtool add</filename> often cannot do very
  751. much to ensure that these Makefiles build correctly.
  752. It is very common, for example, to explicitly call
  753. <filename>gcc</filename> instead of using the
  754. <ulink url='&YOCTO_DOCS_REF_URL;#var-CC'><filename>CC</filename></ulink>
  755. variable.
  756. Usually, in a cross-compilation environment,
  757. <filename>gcc</filename> is the compiler for the build host
  758. and the cross-compiler is named something similar to
  759. <filename>arm-poky-linux-gnueabi-gcc</filename> and might
  760. require some arguments (e.g. to point to the associated sysroot
  761. for the target machine).
  762. </para>
  763. <para>
  764. When writing a recipe for Makefile-only software, keep the
  765. following in mind:
  766. <itemizedlist>
  767. <listitem><para>
  768. You probably need to patch the Makefile to use
  769. variables instead of hardcoding tools within the
  770. toolchain such as <filename>gcc</filename> and
  771. <filename>g++</filename>.
  772. </para></listitem>
  773. <listitem><para>
  774. The environment in which <filename>make</filename> runs
  775. is set up with various standard variables for
  776. compilation (e.g. <filename>CC</filename>,
  777. <filename>CXX</filename>, and so forth) in a similar
  778. manner to the environment set up by the SDK's
  779. environment setup script.
  780. One easy way to see these variables is to run the
  781. <filename>devtool build</filename> command on the
  782. recipe and then look in
  783. <filename>oe-logs/run.do_compile</filename>.
  784. Towards the top of this file you will see a list of
  785. environment variables that are being set.
  786. You can take advantage of these variables within the
  787. Makefile.
  788. </para></listitem>
  789. <listitem><para>
  790. If the Makefile sets a default for a variable using "=",
  791. that default overrides the value set in the environment,
  792. which is usually not desirable.
  793. In this situation, you can either patch the Makefile
  794. so it sets the default using the "?=" operator, or
  795. you can alternatively force the value on the
  796. <filename>make</filename> command line.
  797. To force the value on the command line, add the
  798. variable setting to
  799. <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_OEMAKE'><filename>EXTRA_OEMAKE</filename></ulink>
  800. or
  801. <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGECONFIG_CONFARGS'><filename>PACKAGECONFIG_CONFARGS</filename></ulink>
  802. within the recipe.
  803. Here is an example using <filename>EXTRA_OEMAKE</filename>:
  804. <literallayout class='monospaced'>
  805. EXTRA_OEMAKE += "'CC=${CC}' 'CXX=${CXX}'"
  806. </literallayout>
  807. In the above example, single quotes are used around the
  808. variable settings as the values are likely to contain
  809. spaces because required default options are passed to
  810. the compiler.
  811. </para></listitem>
  812. <listitem><para>
  813. Hardcoding paths inside Makefiles is often problematic
  814. in a cross-compilation environment.
  815. This is particularly true because those hardcoded paths
  816. often point to locations on the build host and thus
  817. will either be read-only or will introduce
  818. contamination into the cross-compilation by virtue of
  819. being specific to the build host rather than the target.
  820. Patching the Makefile to use prefix variables or other
  821. path variables is usually the way to handle this.
  822. </para></listitem>
  823. <listitem><para>
  824. Sometimes a Makefile runs target-specific commands such
  825. as <filename>ldconfig</filename>.
  826. For such cases, you might be able to simply apply
  827. patches that remove these commands from the Makefile.
  828. </para></listitem>
  829. </itemizedlist>
  830. </para>
  831. </section>
  832. <section id='sdk-adding-native-tools'>
  833. <title>Adding Native Tools</title>
  834. <para>
  835. Often, you need to build additional tools that run on the
  836. build host system as opposed to the target.
  837. You should indicate this using one of the following methods
  838. when you run <filename>devtool add</filename>:
  839. <itemizedlist>
  840. <listitem><para>
  841. Specify the name of the recipe such that it ends
  842. with "-native".
  843. Specifying the name like this produces a recipe that
  844. only builds for the build host.
  845. </para></listitem>
  846. <listitem><para>
  847. Specify the "&dash;&dash;also-native" option with the
  848. <filename>devtool add</filename> command.
  849. Specifying this option creates a recipe file that still
  850. builds for the target but also creates a variant with
  851. a "-native" suffix that builds for the build host.
  852. </para></listitem>
  853. </itemizedlist>
  854. <note>
  855. If you need to add a tool that is shipped as part of a
  856. source tree that builds code for the target, you can
  857. typically accomplish this by building the native and target
  858. parts separately rather than within the same compilation
  859. process.
  860. Realize though that with the "&dash;&dash;also-native" option, you
  861. can add the tool using just one recipe file.
  862. </note>
  863. </para>
  864. </section>
  865. <section id='sdk-adding-node-js-modules'>
  866. <title>Adding Node.js Modules</title>
  867. <para>
  868. You can use the <filename>devtool add</filename> command in the
  869. following form to add Node.js modules:
  870. <literallayout class='monospaced'>
  871. $ devtool add "npm://registry.npmjs.org;name=forever;version=0.15.1"
  872. </literallayout>
  873. The name and version parameters are mandatory.
  874. Lockdown and shrinkwrap files are generated and pointed to by
  875. the recipe in order to freeze the version that is fetched for
  876. the dependencies according to the first time.
  877. This also saves checksums that are verified on future fetches.
  878. Together, these behaviors ensure the reproducibility and
  879. integrity of the build.
  880. <note><title>Notes</title>
  881. <itemizedlist>
  882. <listitem><para>
  883. You must use quotes around the URL.
  884. The <filename>devtool add</filename> does not require
  885. the quotes, but the shell considers ";" as a splitter
  886. between multiple commands.
  887. Thus, without the quotes,
  888. <filename>devtool add</filename> does not receive the
  889. other parts, which results in several "command not
  890. found" errors.
  891. </para></listitem>
  892. <listitem><para>
  893. In order to support adding
  894. Node.js modules, a
  895. <filename>nodejs</filename> recipe must be part of your
  896. SDK in order to provide Node.js
  897. itself.
  898. </para></listitem>
  899. </itemizedlist>
  900. </note>
  901. </para>
  902. </section>
  903. </section>
  904. <section id='sdk-working-with-recipes'>
  905. <title>Working With Recipes</title>
  906. <para>
  907. When building a recipe with <filename>devtool build</filename> the
  908. typical build progression is as follows:
  909. <orderedlist>
  910. <listitem><para>
  911. Fetch the source
  912. </para></listitem>
  913. <listitem><para>
  914. Unpack the source
  915. </para></listitem>
  916. <listitem><para>
  917. Configure the source
  918. </para></listitem>
  919. <listitem><para>
  920. Compiling the source
  921. </para></listitem>
  922. <listitem><para>
  923. Install the build output
  924. </para></listitem>
  925. <listitem><para>
  926. Package the installed output
  927. </para></listitem>
  928. </orderedlist>
  929. For recipes in the workspace, fetching and unpacking is disabled
  930. as the source tree has already been prepared and is persistent.
  931. Each of these build steps is defined as a function, usually with a
  932. "do_" prefix.
  933. These functions are typically shell scripts but can instead be written
  934. in Python.
  935. </para>
  936. <para>
  937. If you look at the contents of a recipe, you will see that the
  938. recipe does not include complete instructions for building the
  939. software.
  940. Instead, common functionality is encapsulated in classes inherited
  941. with the <filename>inherit</filename> directive, leaving the recipe
  942. to describe just the things that are specific to the software to be
  943. built.
  944. A <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-base'><filename>base</filename></ulink>
  945. class exists that is implicitly inherited by all recipes and provides
  946. the functionality that most typical recipes need.
  947. </para>
  948. <para>
  949. The remainder of this section presents information useful when
  950. working with recipes.
  951. </para>
  952. <section id='sdk-finding-logs-and-work-files'>
  953. <title>Finding Logs and Work Files</title>
  954. <para>
  955. When you are debugging a recipe that you previously created using
  956. <filename>devtool add</filename> or whose source you are modifying
  957. by using the <filename>devtool modify</filename> command, after
  958. the first run of <filename>devtool build</filename>, you will
  959. find some symbolic links created within the source tree:
  960. <filename>oe-logs</filename>, which points to the directory in
  961. which log files and run scripts for each build step are created
  962. and <filename>oe-workdir</filename>, which points to the temporary
  963. work area for the recipe.
  964. You can use these links to get more information on what is
  965. happening at each build step.
  966. </para>
  967. <para>
  968. These locations under <filename>oe-workdir</filename> are
  969. particularly useful:
  970. <itemizedlist>
  971. <listitem><para><filename>image/</filename>:
  972. Contains all of the files installed at the
  973. <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink>
  974. stage.
  975. Within a recipe, this directory is referred to by the
  976. expression
  977. <filename>${</filename><ulink url='&YOCTO_DOCS_REF_URL;#var-D'><filename>D</filename></ulink><filename>}</filename>.
  978. </para></listitem>
  979. <listitem><para><filename>sysroot-destdir/</filename>:
  980. Contains a subset of files installed within
  981. <filename>do_install</filename> that have been put into the
  982. shared sysroot.
  983. For more information, see the
  984. "<link linkend='sdk-sharing-files-between-recipes'>Sharing Files Between Recipes</link>"
  985. section.
  986. </para></listitem>
  987. <listitem><para><filename>packages-split/</filename>:
  988. Contains subdirectories for each package produced by the
  989. recipe.
  990. For more information, see the
  991. "<link linkend='sdk-packaging'>Packaging</link>" section.
  992. </para></listitem>
  993. </itemizedlist>
  994. </para>
  995. </section>
  996. <section id='sdk-setting-configure-arguments'>
  997. <title>Setting Configure Arguments</title>
  998. <para>
  999. If the software your recipe is building uses GNU autoconf,
  1000. then a fixed set of arguments is passed to it to enable
  1001. cross-compilation plus any extras specified by
  1002. <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_OECONF'><filename>EXTRA_OECONF</filename></ulink>
  1003. or
  1004. <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGECONFIG_CONFARGS'><filename>PACKAGECONFIG_CONFARGS</filename></ulink>
  1005. set within the recipe.
  1006. If you wish to pass additional options, add them to
  1007. <filename>EXTRA_OECONF</filename> or
  1008. <filename>PACKAGECONFIG_CONFARGS</filename>.
  1009. Other supported build tools have similar variables
  1010. (e.g.
  1011. <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_OECMAKE'><filename>EXTRA_OECMAKE</filename></ulink>
  1012. for CMake,
  1013. <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_OESCONS'><filename>EXTRA_OESCONS</filename></ulink>
  1014. for Scons, and so forth).
  1015. If you need to pass anything on the <filename>make</filename>
  1016. command line, you can use <filename>EXTRA_OEMAKE</filename> or the
  1017. <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGECONFIG_CONFARGS'><filename>PACKAGECONFIG_CONFARGS</filename></ulink>
  1018. variables to do so.
  1019. </para>
  1020. <para>
  1021. You can use the <filename>devtool configure-help</filename> command
  1022. to help you set the arguments listed in the previous paragraph.
  1023. The command determines the exact options being passed, and shows
  1024. them to you along with any custom arguments specified through
  1025. <filename>EXTRA_OECONF</filename> or
  1026. <filename>PACKAGECONFIG_CONFARGS</filename>.
  1027. If applicable, the command also shows you the output of the
  1028. configure script's "&dash;&dash;help" option as a reference.
  1029. </para>
  1030. </section>
  1031. <section id='sdk-sharing-files-between-recipes'>
  1032. <title>Sharing Files Between Recipes</title>
  1033. <para>
  1034. Recipes often need to use files provided by other recipes on
  1035. the build host.
  1036. For example, an application linking to a common library needs
  1037. access to the library itself and its associated headers.
  1038. The way this access is accomplished within the extensible SDK is
  1039. through the sysroot.
  1040. One sysroot exists per "machine" for which the SDK is being built.
  1041. In practical terms, this means a sysroot exists for the target
  1042. machine, and a sysroot exists for the build host.
  1043. </para>
  1044. <para>
  1045. Recipes should never write files directly into the sysroot.
  1046. Instead, files should be installed into standard locations
  1047. during the
  1048. <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink>
  1049. task within the
  1050. <filename>${</filename><ulink url='&YOCTO_DOCS_REF_URL;#var-D'><filename>D</filename></ulink><filename>}</filename>
  1051. directory.
  1052. A subset of these files automatically go into the sysroot.
  1053. The reason for this limitation is that almost all files that go
  1054. into the sysroot are cataloged in manifests in order to ensure
  1055. they can be removed later when a recipe is modified or removed.
  1056. Thus, the sysroot is able to remain free from stale files.
  1057. </para>
  1058. </section>
  1059. <section id='sdk-packaging'>
  1060. <title>Packaging</title>
  1061. <para>
  1062. Packaging is not always particularly relevant within the
  1063. extensible SDK.
  1064. However, if you examine how build output gets into the final image
  1065. on the target device, it is important to understand packaging
  1066. because the contents of the image are expressed in terms of
  1067. packages and not recipes.
  1068. </para>
  1069. <para>
  1070. During the
  1071. <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-package'><filename>do_package</filename></ulink>
  1072. task, files installed during the
  1073. <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks-install'><filename>do_install</filename></ulink>
  1074. task are split into one main package, which is almost always named
  1075. the same as the recipe, and several other packages.
  1076. This separation is done because not all of those installed files
  1077. are always useful in every image.
  1078. For example, you probably do not need any of the documentation
  1079. installed in a production image.
  1080. Consequently, for each recipe the documentation files are separated
  1081. into a <filename>-doc</filename> package.
  1082. Recipes that package software that has optional modules or
  1083. plugins might do additional package splitting as well.
  1084. </para>
  1085. <para>
  1086. After building a recipe you can see where files have gone by
  1087. looking in the <filename>oe-workdir/packages-split</filename>
  1088. directory, which contains a subdirectory for each package.
  1089. Apart from some advanced cases, the
  1090. <ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGES'><filename>PACKAGES</filename></ulink>
  1091. and
  1092. <ulink url='&YOCTO_DOCS_REF_URL;#var-FILES'><filename>FILES</filename></ulink>
  1093. variables controls splitting.
  1094. The <filename>PACKAGES</filename> variable lists all of the
  1095. packages to be produced, while the <filename>FILES</filename>
  1096. variable specifies which files to include in each package,
  1097. using an override to specify the package.
  1098. For example, <filename>FILES_${PN}</filename> specifies the files
  1099. to go into the main package (i.e. the main package is named the
  1100. same as the recipe and
  1101. <filename>${</filename><ulink url='&YOCTO_DOCS_REF_URL;#var-PN'><filename>PN</filename></ulink><filename>}</filename>
  1102. evaluates to the recipe name).
  1103. The order of the <filename>PACKAGES</filename> value is significant.
  1104. For each installed file, the first package whose
  1105. <filename>FILES</filename> value matches the file is the package
  1106. into which the file goes.
  1107. Defaults exist for both the <filename>PACKAGES</filename> and
  1108. <filename>FILES</filename> variables.
  1109. Consequently, you might find you do not even need to set these
  1110. variables in your recipe unless the software the recipe is
  1111. building installs files into non-standard locations.
  1112. </para>
  1113. </section>
  1114. </section>
  1115. <section id='sdk-restoring-the-target-device-to-its-original-state'>
  1116. <title>Restoring the Target Device to its Original State</title>
  1117. <para>
  1118. If you use the <filename>devtool deploy-target</filename>
  1119. command to write a recipe's build output to the target, and
  1120. you are working on an existing component of the system, then you
  1121. might find yourself in a situation where you need to restore the
  1122. original files that existed prior to running the
  1123. <filename>devtool deploy-target</filename> command.
  1124. Because the <filename>devtool deploy-target</filename> command
  1125. backs up any files it overwrites, you can use the
  1126. <filename>devtool undeploy-target</filename> to restore those files
  1127. and remove any other files the recipe deployed.
  1128. Consider the following example:
  1129. <literallayout class='monospaced'>
  1130. $ devtool undeploy-target lighttpd root@192.168.7.2
  1131. </literallayout>
  1132. If you have deployed multiple applications, you can remove them
  1133. all at once thus restoring the target device back to its
  1134. original state:
  1135. <literallayout class='monospaced'>
  1136. $ devtool undeploy-target -a root@192.168.7.2
  1137. </literallayout>
  1138. Information about files deployed to the target as well as any
  1139. backed up files are stored on the target itself.
  1140. This storage of course requires some additional space
  1141. on the target machine.
  1142. <note>
  1143. The <filename>devtool deploy-target</filename> and
  1144. <filename>devtool undeploy-target</filename> command do not
  1145. currently interact with any package management system on the
  1146. target device (e.g. RPM or OPKG).
  1147. Consequently, you should not intermingle operations
  1148. <filename>devtool deploy-target</filename> and the package
  1149. manager operations on the target device.
  1150. Doing so could result in a conflicting set of files.
  1151. </note>
  1152. </para>
  1153. </section>
  1154. <section id='sdk-installing-additional-items-into-the-extensible-sdk'>
  1155. <title>Installing Additional Items Into the Extensible SDK</title>
  1156. <para>
  1157. The extensible SDK typically only comes with a small number of tools
  1158. and libraries out of the box.
  1159. If you have a minimal SDK, then it starts mostly empty and is
  1160. populated on-demand.
  1161. However, sometimes you will need to explicitly install extra items
  1162. into the SDK.
  1163. If you need these extra items, you can first search for the items
  1164. using the <filename>devtool search</filename> command.
  1165. For example, suppose you need to link to libGL but you are not sure
  1166. which recipe provides it.
  1167. You can use the following command to find out:
  1168. <literallayout class='monospaced'>
  1169. $ devtool search libGL
  1170. mesa A free implementation of the OpenGL API
  1171. </literallayout>
  1172. Once you know the recipe (i.e. <filename>mesa</filename> in this
  1173. example), you can install it:
  1174. <literallayout class='monospaced'>
  1175. $ devtool sdk-install mesa
  1176. </literallayout>
  1177. By default, the <filename>devtool sdk-install</filename> assumes the
  1178. item is available in pre-built form from your SDK provider.
  1179. If the item is not available and it is acceptable to build the item
  1180. from source, you can add the "-s" option as follows:
  1181. <literallayout class='monospaced'>
  1182. $ devtool sdk-install -s mesa
  1183. </literallayout>
  1184. It is important to remember that building the item from source takes
  1185. significantly longer than installing the pre-built artifact.
  1186. Also, if no recipe exists for the item you want to add to the SDK, you
  1187. must instead add it using the <filename>devtool add</filename> command.
  1188. </para>
  1189. </section>
  1190. <section id='sdk-updating-the-extensible-sdk'>
  1191. <title>Updating the Extensible SDK</title>
  1192. <para>
  1193. If you are working with an extensible SDK that gets occasionally
  1194. updated (e.g. typically when that SDK has been provided to you by
  1195. another party), then you will need to manually pull down those
  1196. updates to your installed SDK.
  1197. </para>
  1198. <para>
  1199. To update your installed SDK, run the following:
  1200. <literallayout class='monospaced'>
  1201. $ devtool sdk-update
  1202. </literallayout>
  1203. The previous command assumes your SDK provider has set the default
  1204. update URL for you.
  1205. If that URL has not been set, you need to specify it yourself as
  1206. follows:
  1207. <literallayout class='monospaced'>
  1208. $ devtool sdk-update <replaceable>path_to_update_directory</replaceable>
  1209. </literallayout>
  1210. <note>
  1211. The URL needs to point specifically to a published SDK and not an
  1212. SDK installer that you would download and install.
  1213. </note>
  1214. </para>
  1215. </section>
  1216. <section id='sdk-creating-a-derivative-sdk-with-additional-components'>
  1217. <title>Creating a Derivative SDK With Additional Components</title>
  1218. <para>
  1219. You might need to produce an SDK that contains your own custom
  1220. libraries for sending to a third party (e.g., if you are a vendor with
  1221. customers needing to build their own software for the target platform).
  1222. If that is the case, then you can produce a derivative SDK based on
  1223. the currently installed SDK fairly easily.
  1224. Use these steps:
  1225. <orderedlist>
  1226. <listitem><para>If necessary, install an extensible SDK that
  1227. you want to use as a base for your derivative SDK.
  1228. </para></listitem>
  1229. <listitem><para>Source the environment script for the SDK.
  1230. </para></listitem>
  1231. <listitem><para>Add the extra libraries or other components
  1232. you want by using the <filename>devtool add</filename>
  1233. command.
  1234. </para></listitem>
  1235. <listitem><para>Run the <filename>devtool build-sdk</filename>
  1236. command.
  1237. </para></listitem>
  1238. </orderedlist>
  1239. The above procedure takes the recipes added to the workspace and
  1240. constructs a new SDK installer containing those recipes and the
  1241. resulting binary artifacts.
  1242. The recipes go into their own separate layer in the constructed
  1243. derivative SDK, leaving the workspace clean and ready for users
  1244. to add their own recipes.
  1245. </para>
  1246. </section>
  1247. </chapter>
  1248. <!--
  1249. vim: expandtab tw=80 ts=4
  1250. -->