extensible.rst 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. ************************
  3. Using the Extensible SDK
  4. ************************
  5. This chapter describes the extensible SDK and how to install it.
  6. Information covers the pieces of the SDK, how to install it, and
  7. presents a look at using the ``devtool`` functionality. The extensible
  8. SDK makes it easy to add new applications and libraries to an image,
  9. modify the source for an existing component, test changes on the target
  10. hardware, and ease integration into the rest of the
  11. :term:`OpenEmbedded Build System`.
  12. .. note::
  13. For a side-by-side comparison of main features supported for an
  14. extensible SDK as compared to a standard SDK, see the
  15. :ref:`sdk-manual/intro:introduction` section.
  16. In addition to the functionality available through ``devtool``, you can
  17. alternatively make use of the toolchain directly, for example from
  18. Makefile and Autotools. See the
  19. ":ref:`sdk-manual/working-projects:using the sdk toolchain directly`" chapter
  20. for more information.
  21. Why use the Extensible SDK and What is in It?
  22. =============================================
  23. The extensible SDK provides a cross-development toolchain and libraries
  24. tailored to the contents of a specific image. You would use the
  25. Extensible SDK if you want a toolchain experience supplemented with the
  26. powerful set of ``devtool`` commands tailored for the Yocto Project
  27. environment.
  28. The installed extensible SDK consists of several files and directories.
  29. Basically, it contains an SDK environment setup script, some
  30. configuration files, an internal build system, and the ``devtool``
  31. functionality.
  32. Installing the Extensible SDK
  33. =============================
  34. Two ways to install the Extensible SDK
  35. --------------------------------------
  36. Extensible SDK can be installed in two different ways, and both have
  37. their own pros and cons:
  38. #. *Setting up the Extensible SDK environment directly in a Yocto build*. This
  39. avoids having to produce, test, distribute and maintain separate SDK installer
  40. archives, which can get very large. There is only one environment for the regular
  41. Yocto build and the SDK and less code paths where things can go not according to plan.
  42. It's easier to update the SDK: it simply means updating the Yocto layers with
  43. git fetch or layer management tooling. The SDK extensibility is better than in the
  44. second option: just run ``bitbake`` again to add more things to the sysroot, or add layers
  45. if even more things are required.
  46. #. *Setting up the Extensible SDK from a standalone installer*. This has the benefit of
  47. having a single, self-contained archive that includes all the needed binary artifacts.
  48. So nothing needs to be rebuilt, and there is no need to provide a well-functioning
  49. binary artefact cache over the network for developers with underpowered laptops.
  50. Setting up the Extensible SDK environment directly in a Yocto build
  51. -------------------------------------------------------------------
  52. #. Set up all the needed layers and a Yocto :term:`Build Directory`, e.g. a regular Yocto
  53. build where ``bitbake`` can be executed.
  54. #. Run:
  55. $ bitbake meta-ide-support
  56. $ bitbake -c populate_sysroot gtk+3
  57. (or any other target or native item that the application developer would need)
  58. $ bitbake build-sysroots
  59. Setting up the Extensible SDK from a standalone installer
  60. ---------------------------------------------------------
  61. The first thing you need to do is install the SDK on your :term:`Build
  62. Host` by running the ``*.sh`` installation script.
  63. You can download a tarball installer, which includes the pre-built
  64. toolchain, the ``runqemu`` script, the internal build system,
  65. ``devtool``, and support files from the appropriate
  66. :yocto_dl:`toolchain </releases/yocto/yocto-&DISTRO;/toolchain/>` directory within the Index of
  67. Releases. Toolchains are available for several 32-bit and 64-bit
  68. architectures with the ``x86_64`` directories, respectively. The
  69. toolchains the Yocto Project provides are based off the
  70. ``core-image-sato`` and ``core-image-minimal`` images and contain
  71. libraries appropriate for developing against that image.
  72. The names of the tarball installer scripts are such that a string
  73. representing the host system appears first in the filename and then is
  74. immediately followed by a string representing the target architecture.
  75. An extensible SDK has the string "-ext" as part of the name. Following
  76. is the general form::
  77. poky-glibc-host_system-image_type-arch-toolchain-ext-release_version.sh
  78. Where:
  79. host_system is a string representing your development system:
  80. i686 or x86_64.
  81. image_type is the image for which the SDK was built:
  82. core-image-sato or core-image-minimal
  83. arch is a string representing the tuned target architecture:
  84. aarch64, armv5e, core2-64, i586, mips32r2, mips64, ppc7400, or cortexa8hf-neon
  85. release_version is a string representing the release number of the Yocto Project:
  86. &DISTRO;, &DISTRO;+snapshot
  87. For example, the following SDK installer is for a 64-bit
  88. development host system and a i586-tuned target architecture based off
  89. the SDK for ``core-image-sato`` and using the current &DISTRO; snapshot::
  90. poky-glibc-x86_64-core-image-sato-i586-toolchain-ext-&DISTRO;.sh
  91. .. note::
  92. As an alternative to downloading an SDK, you can build the SDK
  93. installer. For information on building the installer, see the
  94. :ref:`sdk-manual/appendix-obtain:building an sdk installer`
  95. section.
  96. The SDK and toolchains are self-contained and by default are installed
  97. into the ``poky_sdk`` folder in your home directory. You can choose to
  98. install the extensible SDK in any location when you run the installer.
  99. However, because files need to be written under that directory during
  100. the normal course of operation, the location you choose for installation
  101. must be writable for whichever users need to use the SDK.
  102. The following command shows how to run the installer given a toolchain
  103. tarball for a 64-bit x86 development host system and a 64-bit x86 target
  104. architecture. The example assumes the SDK installer is located in
  105. ``~/Downloads/`` and has execution rights::
  106. $ ./Downloads/poky-glibc-x86_64-core-image-minimal-core2-64-toolchain-ext-2.5.sh
  107. Poky (Yocto Project Reference Distro) Extensible SDK installer version 2.5
  108. ==========================================================================
  109. Enter target directory for SDK (default: poky_sdk):
  110. You are about to install the SDK to "/home/scottrif/poky_sdk". Proceed [Y/n]? Y
  111. Extracting SDK..............done
  112. Setting it up...
  113. Extracting buildtools...
  114. Preparing build system...
  115. Parsing recipes: 100% |##################################################################| Time: 0:00:52
  116. Initialising tasks: 100% |###############################################################| Time: 0:00:00
  117. Checking sstate mirror object availability: 100% |#######################################| Time: 0:00:00
  118. Loading cache: 100% |####################################################################| Time: 0:00:00
  119. Initialising tasks: 100% |###############################################################| Time: 0:00:00
  120. done
  121. SDK has been successfully set up and is ready to be used.
  122. Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
  123. $ . /home/scottrif/poky_sdk/environment-setup-core2-64-poky-linux
  124. .. note::
  125. If you do not have write permissions for the directory into which you
  126. are installing the SDK, the installer notifies you and exits. For
  127. that case, set up the proper permissions in the directory and run the
  128. installer again.
  129. Running the Extensible SDK Environment Setup Script
  130. ===================================================
  131. Once you have the SDK installed, you must run the SDK environment setup
  132. script before you can actually use the SDK.
  133. When using a SDK directly in a Yocto build, you will find the script in
  134. ``tmp/deploy/images/qemux86-64/`` in your :term:`Build Directory`.
  135. When using a standalone SDK installer, this setup script resides in
  136. the directory you chose when you installed the SDK, which is either the
  137. default ``poky_sdk`` directory or the directory you chose during
  138. installation.
  139. Before running the script, be sure it is the one that matches the
  140. architecture for which you are developing. Environment setup scripts
  141. begin with the string "``environment-setup``" and include as part of
  142. their name the tuned target architecture. As an example, the following
  143. commands set the working directory to where the SDK was installed and
  144. then source the environment setup script. In this example, the setup
  145. script is for an IA-based target machine using i586 tuning::
  146. $ cd /home/scottrif/poky_sdk
  147. $ source environment-setup-core2-64-poky-linux
  148. SDK environment now set up; additionally you may now run devtool to perform development tasks.
  149. Run devtool --help for further details.
  150. When using the environment script directly in a Yocto build, it can
  151. be run similarly:
  152. $ source tmp/deploy/images/qemux86-64/environment-setup-core2-64-poky-linux
  153. Running the setup script defines many environment variables needed in
  154. order to use the SDK (e.g. ``PATH``,
  155. :term:`CC`,
  156. :term:`LD`, and so forth). If you want to
  157. see all the environment variables the script exports, examine the
  158. installation file itself.
  159. Using ``devtool`` in Your SDK Workflow
  160. ======================================
  161. The cornerstone of the extensible SDK is a command-line tool called
  162. ``devtool``. This tool provides a number of features that help you
  163. build, test and package software within the extensible SDK, and
  164. optionally integrate it into an image built by the OpenEmbedded build
  165. system.
  166. .. note::
  167. The use of
  168. devtool
  169. is not limited to the extensible SDK. You can use
  170. devtool
  171. to help you easily develop any project whose build output must be
  172. part of an image built using the build system.
  173. The ``devtool`` command line is organized similarly to
  174. :ref:`overview-manual/development-environment:git` in that it has a number of
  175. sub-commands for each function. You can run ``devtool --help`` to see
  176. all the commands.
  177. .. note::
  178. See the "
  179. devtool
  180.  Quick Reference
  181. " in the Yocto Project Reference Manual for a
  182. devtool
  183. quick reference.
  184. Three ``devtool`` subcommands provide entry-points into
  185. development:
  186. - *devtool add*: Assists in adding new software to be built.
  187. - *devtool modify*: Sets up an environment to enable you to modify
  188. the source of an existing component.
  189. - *devtool upgrade*: Updates an existing recipe so that you can
  190. build it for an updated set of source files.
  191. As with the build system, "recipes" represent software packages within
  192. ``devtool``. When you use ``devtool add``, a recipe is automatically
  193. created. When you use ``devtool modify``, the specified existing recipe
  194. is used in order to determine where to get the source code and how to
  195. patch it. In both cases, an environment is set up so that when you build
  196. the recipe a source tree that is under your control is used in order to
  197. allow you to make changes to the source as desired. By default, new
  198. recipes and the source go into a "workspace" directory under the SDK.
  199. The remainder of this section presents the ``devtool add``,
  200. ``devtool modify``, and ``devtool upgrade`` workflows.
  201. Use ``devtool add`` to Add an Application
  202. -----------------------------------------
  203. The ``devtool add`` command generates a new recipe based on existing
  204. source code. This command takes advantage of the
  205. :ref:`devtool-the-workspace-layer-structure`
  206. layer that many ``devtool`` commands use. The command is flexible enough
  207. to allow you to extract source code into both the workspace or a
  208. separate local Git repository and to use existing code that does not
  209. need to be extracted.
  210. Depending on your particular scenario, the arguments and options you use
  211. with ``devtool add`` form different combinations. The following diagram
  212. shows common development flows you would use with the ``devtool add``
  213. command:
  214. .. image:: figures/sdk-devtool-add-flow.png
  215. :width: 100%
  216. #. *Generating the New Recipe*: The top part of the flow shows three
  217. scenarios by which you could use ``devtool add`` to generate a recipe
  218. based on existing source code.
  219. In a shared development environment, it is typical for other
  220. developers to be responsible for various areas of source code. As a
  221. developer, you are probably interested in using that source code as
  222. part of your development within the Yocto Project. All you need is
  223. access to the code, a recipe, and a controlled area in which to do
  224. your work.
  225. Within the diagram, three possible scenarios feed into the
  226. ``devtool add`` workflow:
  227. - *Left*: The left scenario in the figure represents a common
  228. situation where the source code does not exist locally and needs
  229. to be extracted. In this situation, the source code is extracted
  230. to the default workspace --- you do not want the files in some
  231. specific location outside of the workspace. Thus, everything you
  232. need will be located in the workspace::
  233. $ devtool add recipe fetchuri
  234. With this command, ``devtool`` extracts the upstream
  235. source files into a local Git repository within the ``sources``
  236. folder. The command then creates a recipe named recipe and a
  237. corresponding append file in the workspace. If you do not provide
  238. recipe, the command makes an attempt to determine the recipe name.
  239. - *Middle*: The middle scenario in the figure also represents a
  240. situation where the source code does not exist locally. In this
  241. case, the code is again upstream and needs to be extracted to some
  242. local area --- this time outside of the default workspace.
  243. .. note::
  244. If required,
  245. devtool
  246. always creates a Git repository locally during the extraction.
  247. Furthermore, the first positional argument ``srctree`` in this case
  248. identifies where the ``devtool add`` command will locate the
  249. extracted code outside of the workspace. You need to specify an
  250. empty directory::
  251. $ devtool add recipe srctree fetchuri
  252. In summary,
  253. the source code is pulled from fetchuri and extracted into the
  254. location defined by ``srctree`` as a local Git repository.
  255. Within workspace, ``devtool`` creates a recipe named recipe along
  256. with an associated append file.
  257. - *Right*: The right scenario in the figure represents a situation
  258. where the ``srctree`` has been previously prepared outside of the
  259. ``devtool`` workspace.
  260. The following command provides a new recipe name and identifies
  261. the existing source tree location::
  262. $ devtool add recipe srctree
  263. The command examines the source code and creates a recipe named
  264. recipe for the code and places the recipe into the workspace.
  265. Because the extracted source code already exists, ``devtool`` does
  266. not try to relocate the source code into the workspace --- only the
  267. new recipe is placed in the workspace.
  268. Aside from a recipe folder, the command also creates an associated
  269. append folder and places an initial ``*.bbappend`` file within.
  270. #. *Edit the Recipe*: You can use ``devtool edit-recipe`` to open up the
  271. editor as defined by the ``$EDITOR`` environment variable and modify
  272. the file::
  273. $ devtool edit-recipe recipe
  274. From within the editor, you
  275. can make modifications to the recipe that take effect when you build
  276. it later.
  277. #. *Build the Recipe or Rebuild the Image*: The next step you take
  278. depends on what you are going to do with the new code.
  279. If you need to eventually move the build output to the target
  280. hardware, use the following ``devtool`` command:
  281. :;
  282. $ devtool build recipe
  283. On the other hand, if you want an image to contain the recipe's
  284. packages from the workspace for immediate deployment onto a device
  285. (e.g. for testing purposes), you can use the ``devtool build-image``
  286. command::
  287. $ devtool build-image image
  288. #. *Deploy the Build Output*: When you use the ``devtool build`` command
  289. to build out your recipe, you probably want to see if the resulting
  290. build output works as expected on the target hardware.
  291. .. note::
  292. This step assumes you have a previously built image that is
  293. already either running in QEMU or is running on actual hardware.
  294. Also, it is assumed that for deployment of the image to the
  295. target, SSH is installed in the image and, if the image is running
  296. on real hardware, you have network access to and from your
  297. development machine.
  298. You can deploy your build output to that target hardware by using the
  299. ``devtool deploy-target`` command: $ devtool deploy-target recipe
  300. target The target is a live target machine running as an SSH server.
  301. You can, of course, also deploy the image you build to actual
  302. hardware by using the ``devtool build-image`` command. However,
  303. ``devtool`` does not provide a specific command that allows you to
  304. deploy the image to actual hardware.
  305. #. *Finish Your Work With the Recipe*: The ``devtool finish`` command
  306. creates any patches corresponding to commits in the local Git
  307. repository, moves the new recipe to a more permanent layer, and then
  308. resets the recipe so that the recipe is built normally rather than
  309. from the workspace::
  310. $ devtool finish recipe layer
  311. .. note::
  312. Any changes you want to turn into patches must be committed to the
  313. Git repository in the source tree.
  314. As mentioned, the ``devtool finish`` command moves the final recipe
  315. to its permanent layer.
  316. As a final process of the ``devtool finish`` command, the state of
  317. the standard layers and the upstream source is restored so that you
  318. can build the recipe from those areas rather than the workspace.
  319. .. note::
  320. You can use the
  321. devtool reset
  322. command to put things back should you decide you do not want to
  323. proceed with your work. If you do use this command, realize that
  324. the source tree is preserved.
  325. Use ``devtool modify`` to Modify the Source of an Existing Component
  326. --------------------------------------------------------------------
  327. The ``devtool modify`` command prepares the way to work on existing code
  328. that already has a local recipe in place that is used to build the
  329. software. The command is flexible enough to allow you to extract code
  330. from an upstream source, specify the existing recipe, and keep track of
  331. and gather any patch files from other developers that are associated
  332. with the code.
  333. Depending on your particular scenario, the arguments and options you use
  334. with ``devtool modify`` form different combinations. The following
  335. diagram shows common development flows for the ``devtool modify``
  336. command:
  337. .. image:: figures/sdk-devtool-modify-flow.png
  338. :width: 100%
  339. #. *Preparing to Modify the Code*: The top part of the flow shows three
  340. scenarios by which you could use ``devtool modify`` to prepare to
  341. work on source files. Each scenario assumes the following:
  342. - The recipe exists locally in a layer external to the ``devtool``
  343. workspace.
  344. - The source files exist either upstream in an un-extracted state or
  345. locally in a previously extracted state.
  346. The typical situation is where another developer has created a layer
  347. for use with the Yocto Project and their recipe already resides in
  348. that layer. Furthermore, their source code is readily available
  349. either upstream or locally.
  350. - *Left*: The left scenario in the figure represents a common
  351. situation where the source code does not exist locally and it
  352. needs to be extracted from an upstream source. In this situation,
  353. the source is extracted into the default ``devtool`` workspace
  354. location. The recipe, in this scenario, is in its own layer
  355. outside the workspace (i.e. ``meta-``\ layername).
  356. The following command identifies the recipe and, by default,
  357. extracts the source files::
  358. $ devtool modify recipe
  359. Once
  360. ``devtool``\ locates the recipe, ``devtool`` uses the recipe's
  361. :term:`SRC_URI` statements to
  362. locate the source code and any local patch files from other
  363. developers.
  364. With this scenario, there is no ``srctree`` argument. Consequently, the
  365. default behavior of the ``devtool modify`` command is to extract
  366. the source files pointed to by the :term:`SRC_URI` statements into a
  367. local Git structure. Furthermore, the location for the extracted
  368. source is the default area within the ``devtool`` workspace. The
  369. result is that the command sets up both the source code and an
  370. append file within the workspace while the recipe remains in its
  371. original location.
  372. Additionally, if you have any non-patch local files (i.e. files
  373. referred to with ``file://`` entries in :term:`SRC_URI` statement
  374. excluding ``*.patch/`` or ``*.diff``), these files are copied to
  375. an ``oe-local-files`` folder under the newly created source tree.
  376. Copying the files here gives you a convenient area from which you
  377. can modify the files. Any changes or additions you make to those
  378. files are incorporated into the build the next time you build the
  379. software just as are other changes you might have made to the
  380. source.
  381. - *Middle*: The middle scenario in the figure represents a situation
  382. where the source code also does not exist locally. In this case,
  383. the code is again upstream and needs to be extracted to some local
  384. area as a Git repository. The recipe, in this scenario, is again
  385. local and in its own layer outside the workspace.
  386. The following command tells ``devtool`` the recipe with which to
  387. work and, in this case, identifies a local area for the extracted
  388. source files that exists outside of the default ``devtool``
  389. workspace::
  390. $ devtool modify recipe srctree
  391. .. note::
  392. You cannot provide a URL for
  393. srctree
  394. using the
  395. devtool
  396. command.
  397. As with all extractions, the command uses the recipe's :term:`SRC_URI`
  398. statements to locate the source files and any associated patch
  399. files. Non-patch files are copied to an ``oe-local-files`` folder
  400. under the newly created source tree.
  401. Once the files are located, the command by default extracts them
  402. into ``srctree``.
  403. Within workspace, ``devtool`` creates an append file for the
  404. recipe. The recipe remains in its original location but the source
  405. files are extracted to the location you provide with ``srctree``.
  406. - *Right*: The right scenario in the figure represents a situation
  407. where the source tree (``srctree``) already exists locally as a
  408. previously extracted Git structure outside of the ``devtool``
  409. workspace. In this example, the recipe also exists elsewhere
  410. locally in its own layer.
  411. The following command tells ``devtool`` the recipe with which to
  412. work, uses the "-n" option to indicate source does not need to be
  413. extracted, and uses ``srctree`` to point to the previously extracted
  414. source files::
  415. $ devtool modify -n recipe srctree
  416. If an ``oe-local-files`` subdirectory happens to exist and it
  417. contains non-patch files, the files are used. However, if the
  418. subdirectory does not exist and you run the ``devtool finish``
  419. command, any non-patch files that might exist next to the recipe
  420. are removed because it appears to ``devtool`` that you have
  421. deleted those files.
  422. Once the ``devtool modify`` command finishes, it creates only an
  423. append file for the recipe in the ``devtool`` workspace. The
  424. recipe and the source code remain in their original locations.
  425. #. *Edit the Source*: Once you have used the ``devtool modify`` command,
  426. you are free to make changes to the source files. You can use any
  427. editor you like to make and save your source code modifications.
  428. #. *Build the Recipe or Rebuild the Image*: The next step you take
  429. depends on what you are going to do with the new code.
  430. If you need to eventually move the build output to the target
  431. hardware, use the following ``devtool`` command::
  432. $ devtool build recipe
  433. On the other hand, if you want an image to contain the recipe's
  434. packages from the workspace for immediate deployment onto a device
  435. (e.g. for testing purposes), you can use the ``devtool build-image``
  436. command: $ devtool build-image image
  437. #. *Deploy the Build Output*: When you use the ``devtool build`` command
  438. to build out your recipe, you probably want to see if the resulting
  439. build output works as expected on target hardware.
  440. .. note::
  441. This step assumes you have a previously built image that is
  442. already either running in QEMU or running on actual hardware.
  443. Also, it is assumed that for deployment of the image to the
  444. target, SSH is installed in the image and if the image is running
  445. on real hardware that you have network access to and from your
  446. development machine.
  447. You can deploy your build output to that target hardware by using the
  448. ``devtool deploy-target`` command::
  449. $ devtool deploy-target recipe target
  450. The target is a live target machine running as an SSH server.
  451. You can, of course, use other methods to deploy the image you built
  452. using the ``devtool build-image`` command to actual hardware.
  453. ``devtool`` does not provide a specific command to deploy the image
  454. to actual hardware.
  455. #. *Finish Your Work With the Recipe*: The ``devtool finish`` command
  456. creates any patches corresponding to commits in the local Git
  457. repository, updates the recipe to point to them (or creates a
  458. ``.bbappend`` file to do so, depending on the specified destination
  459. layer), and then resets the recipe so that the recipe is built
  460. normally rather than from the workspace::
  461. $ devtool finish recipe layer
  462. .. note::
  463. Any changes you want to turn into patches must be staged and
  464. committed within the local Git repository before you use the
  465. devtool finish
  466. command.
  467. Because there is no need to move the recipe, ``devtool finish``
  468. either updates the original recipe in the original layer or the
  469. command creates a ``.bbappend`` file in a different layer as provided
  470. by layer. Any work you did in the ``oe-local-files`` directory is
  471. preserved in the original files next to the recipe during the
  472. ``devtool finish`` command.
  473. As a final process of the ``devtool finish`` command, the state of
  474. the standard layers and the upstream source is restored so that you
  475. can build the recipe from those areas rather than from the workspace.
  476. .. note::
  477. You can use the
  478. devtool reset
  479. command to put things back should you decide you do not want to
  480. proceed with your work. If you do use this command, realize that
  481. the source tree is preserved.
  482. Use ``devtool upgrade`` to Create a Version of the Recipe that Supports a Newer Version of the Software
  483. -------------------------------------------------------------------------------------------------------
  484. The ``devtool upgrade`` command upgrades an existing recipe to that of a
  485. more up-to-date version found upstream. Throughout the life of software,
  486. recipes continually undergo version upgrades by their upstream
  487. publishers. You can use the ``devtool upgrade`` workflow to make sure
  488. your recipes you are using for builds are up-to-date with their upstream
  489. counterparts.
  490. .. note::
  491. Several methods exist by which you can upgrade recipes -
  492. ``devtool upgrade``
  493. happens to be one. You can read about all the methods by which you
  494. can upgrade recipes in the
  495. :ref:`dev-manual/upgrading-recipes:upgrading recipes` section
  496. of the Yocto Project Development Tasks Manual.
  497. The ``devtool upgrade`` command is flexible enough to allow you to
  498. specify source code revision and versioning schemes, extract code into
  499. or out of the ``devtool``
  500. :ref:`devtool-the-workspace-layer-structure`,
  501. and work with any source file forms that the
  502. :ref:`bitbake:bitbake-user-manual/bitbake-user-manual-fetching:fetchers` support.
  503. The following diagram shows the common development flow used with the
  504. ``devtool upgrade`` command:
  505. .. image:: figures/sdk-devtool-upgrade-flow.png
  506. :width: 100%
  507. #. *Initiate the Upgrade*: The top part of the flow shows the typical
  508. scenario by which you use the ``devtool upgrade`` command. The
  509. following conditions exist:
  510. - The recipe exists in a local layer external to the ``devtool``
  511. workspace.
  512. - The source files for the new release exist in the same location
  513. pointed to by :term:`SRC_URI`
  514. in the recipe (e.g. a tarball with the new version number in the
  515. name, or as a different revision in the upstream Git repository).
  516. A common situation is where third-party software has undergone a
  517. revision so that it has been upgraded. The recipe you have access to
  518. is likely in your own layer. Thus, you need to upgrade the recipe to
  519. use the newer version of the software::
  520. $ devtool upgrade -V version recipe
  521. By default, the ``devtool upgrade`` command extracts source
  522. code into the ``sources`` directory in the
  523. :ref:`devtool-the-workspace-layer-structure`.
  524. If you want the code extracted to any other location, you need to
  525. provide the ``srctree`` positional argument with the command as follows::
  526. $ devtool upgrade -V version recipe srctree
  527. .. note::
  528. In this example, the "-V" option specifies the new version. If you
  529. don't use "-V", the command upgrades the recipe to the latest
  530. version.
  531. If the source files pointed to by the :term:`SRC_URI` statement in the
  532. recipe are in a Git repository, you must provide the "-S" option and
  533. specify a revision for the software.
  534. Once ``devtool`` locates the recipe, it uses the :term:`SRC_URI` variable
  535. to locate the source code and any local patch files from other
  536. developers. The result is that the command sets up the source code,
  537. the new version of the recipe, and an append file all within the
  538. workspace.
  539. Additionally, if you have any non-patch local files (i.e. files
  540. referred to with ``file://`` entries in :term:`SRC_URI` statement
  541. excluding ``*.patch/`` or ``*.diff``), these files are copied to an
  542. ``oe-local-files`` folder under the newly created source tree.
  543. Copying the files here gives you a convenient area from which you can
  544. modify the files. Any changes or additions you make to those files
  545. are incorporated into the build the next time you build the software
  546. just as are other changes you might have made to the source.
  547. #. *Resolve any Conflicts created by the Upgrade*: Conflicts could happen
  548. after upgrading the software to a new version. Conflicts occur
  549. if your recipe specifies some patch files in :term:`SRC_URI` that
  550. conflict with changes made in the new version of the software. For
  551. such cases, you need to resolve the conflicts by editing the source
  552. and following the normal ``git rebase`` conflict resolution process.
  553. Before moving onto the next step, be sure to resolve any such
  554. conflicts created through use of a newer or different version of the
  555. software.
  556. #. *Build the Recipe or Rebuild the Image*: The next step you take
  557. depends on what you are going to do with the new code.
  558. If you need to eventually move the build output to the target
  559. hardware, use the following ``devtool`` command::
  560. $ devtool build recipe
  561. On the other hand, if you want an image to contain the recipe's
  562. packages from the workspace for immediate deployment onto a device
  563. (e.g. for testing purposes), you can use the ``devtool build-image``
  564. command::
  565. $ devtool build-image image
  566. #. *Deploy the Build Output*: When you use the ``devtool build`` command
  567. or ``bitbake`` to build your recipe, you probably want to see if the
  568. resulting build output works as expected on target hardware.
  569. .. note::
  570. This step assumes you have a previously built image that is
  571. already either running in QEMU or running on actual hardware.
  572. Also, it is assumed that for deployment of the image to the
  573. target, SSH is installed in the image and if the image is running
  574. on real hardware that you have network access to and from your
  575. development machine.
  576. You can deploy your build output to that target hardware by using the
  577. ``devtool deploy-target`` command: $ devtool deploy-target recipe
  578. target The target is a live target machine running as an SSH server.
  579. You can, of course, also deploy the image you build using the
  580. ``devtool build-image`` command to actual hardware. However,
  581. ``devtool`` does not provide a specific command that allows you to do
  582. this.
  583. #. *Finish Your Work With the Recipe*: The ``devtool finish`` command
  584. creates any patches corresponding to commits in the local Git
  585. repository, moves the new recipe to a more permanent layer, and then
  586. resets the recipe so that the recipe is built normally rather than
  587. from the workspace.
  588. Any work you did in the ``oe-local-files`` directory is preserved in
  589. the original files next to the recipe during the ``devtool finish``
  590. command.
  591. If you specify a destination layer that is the same as the original
  592. source, then the old version of the recipe and associated files are
  593. removed prior to adding the new version::
  594. $ devtool finish recipe layer
  595. .. note::
  596. Any changes you want to turn into patches must be committed to the
  597. Git repository in the source tree.
  598. As a final process of the ``devtool finish`` command, the state of
  599. the standard layers and the upstream source is restored so that you
  600. can build the recipe from those areas rather than the workspace.
  601. .. note::
  602. You can use the
  603. devtool reset
  604. command to put things back should you decide you do not want to
  605. proceed with your work. If you do use this command, realize that
  606. the source tree is preserved.
  607. A Closer Look at ``devtool add``
  608. ================================
  609. The ``devtool add`` command automatically creates a recipe based on the
  610. source tree you provide with the command. Currently, the command has
  611. support for the following:
  612. - Autotools (``autoconf`` and ``automake``)
  613. - CMake
  614. - Scons
  615. - ``qmake``
  616. - Plain ``Makefile``
  617. - Out-of-tree kernel module
  618. - Binary package (i.e. "-b" option)
  619. - Node.js module
  620. - Python modules that use ``setuptools`` or ``distutils``
  621. Apart from binary packages, the determination of how a source tree
  622. should be treated is automatic based on the files present within that
  623. source tree. For example, if a ``CMakeLists.txt`` file is found, then
  624. the source tree is assumed to be using CMake and is treated accordingly.
  625. .. note::
  626. In most cases, you need to edit the automatically generated recipe in
  627. order to make it build properly. Typically, you would go through
  628. several edit and build cycles until the recipe successfully builds.
  629. Once the recipe builds, you could use possible further iterations to
  630. test the recipe on the target device.
  631. The remainder of this section covers specifics regarding how parts of
  632. the recipe are generated.
  633. Name and Version
  634. ----------------
  635. If you do not specify a name and version on the command line,
  636. ``devtool add`` uses various metadata within the source tree in an
  637. attempt to determine the name and version of the software being built.
  638. Based on what the tool determines, ``devtool`` sets the name of the
  639. created recipe file accordingly.
  640. If ``devtool`` cannot determine the name and version, the command prints
  641. an error. For such cases, you must re-run the command and provide the
  642. name and version, just the name, or just the version as part of the
  643. command line.
  644. Sometimes the name or version determined from the source tree might be
  645. incorrect. For such a case, you must reset the recipe::
  646. $ devtool reset -n recipename
  647. After running the ``devtool reset`` command, you need to
  648. run ``devtool add`` again and provide the name or the version.
  649. Dependency Detection and Mapping
  650. --------------------------------
  651. The ``devtool add`` command attempts to detect build-time dependencies
  652. and map them to other recipes in the system. During this mapping, the
  653. command fills in the names of those recipes as part of the
  654. :term:`DEPENDS` variable within the
  655. recipe. If a dependency cannot be mapped, ``devtool`` places a comment
  656. in the recipe indicating such. The inability to map a dependency can
  657. result from naming not being recognized or because the dependency simply
  658. is not available. For cases where the dependency is not available, you
  659. must use the ``devtool add`` command to add an additional recipe that
  660. satisfies the dependency. Once you add that recipe, you need to update
  661. the :term:`DEPENDS` variable in the original recipe to include the new
  662. recipe.
  663. If you need to add runtime dependencies, you can do so by adding the
  664. following to your recipe::
  665. RDEPENDS:${PN} += "dependency1 dependency2 ..."
  666. .. note::
  667. The
  668. devtool add
  669. command often cannot distinguish between mandatory and optional
  670. dependencies. Consequently, some of the detected dependencies might
  671. in fact be optional. When in doubt, consult the documentation or the
  672. configure script for the software the recipe is building for further
  673. details. In some cases, you might find you can substitute the
  674. dependency with an option that disables the associated functionality
  675. passed to the configure script.
  676. License Detection
  677. -----------------
  678. The ``devtool add`` command attempts to determine if the software you
  679. are adding is able to be distributed under a common, open-source
  680. license. If so, the command sets the
  681. :term:`LICENSE` value accordingly.
  682. You should double-check the value added by the command against the
  683. documentation or source files for the software you are building and, if
  684. necessary, update that :term:`LICENSE` value.
  685. The ``devtool add`` command also sets the
  686. :term:`LIC_FILES_CHKSUM`
  687. value to point to all files that appear to be license-related. Realize
  688. that license statements often appear in comments at the top of source
  689. files or within the documentation. In such cases, the command does not
  690. recognize those license statements. Consequently, you might need to
  691. amend the :term:`LIC_FILES_CHKSUM` variable to point to one or more of those
  692. comments if present. Setting :term:`LIC_FILES_CHKSUM` is particularly
  693. important for third-party software. The mechanism attempts to ensure
  694. correct licensing should you upgrade the recipe to a newer upstream
  695. version in future. Any change in licensing is detected and you receive
  696. an error prompting you to check the license text again.
  697. If the ``devtool add`` command cannot determine licensing information,
  698. ``devtool`` sets the :term:`LICENSE` value to "CLOSED" and leaves the
  699. :term:`LIC_FILES_CHKSUM` value unset. This behavior allows you to continue
  700. with development even though the settings are unlikely to be correct in
  701. all cases. You should check the documentation or source files for the
  702. software you are building to determine the actual license.
  703. Adding Makefile-Only Software
  704. -----------------------------
  705. The use of Make by itself is very common in both proprietary and
  706. open-source software. Unfortunately, Makefiles are often not written
  707. with cross-compilation in mind. Thus, ``devtool add`` often cannot do
  708. very much to ensure that these Makefiles build correctly. It is very
  709. common, for example, to explicitly call ``gcc`` instead of using the
  710. :term:`CC` variable. Usually, in a
  711. cross-compilation environment, ``gcc`` is the compiler for the build
  712. host and the cross-compiler is named something similar to
  713. ``arm-poky-linux-gnueabi-gcc`` and might require arguments (e.g. to
  714. point to the associated sysroot for the target machine).
  715. When writing a recipe for Makefile-only software, keep the following in
  716. mind:
  717. - You probably need to patch the Makefile to use variables instead of
  718. hardcoding tools within the toolchain such as ``gcc`` and ``g++``.
  719. - The environment in which Make runs is set up with various standard
  720. variables for compilation (e.g. :term:`CC`, :term:`CXX`, and so forth) in a
  721. similar manner to the environment set up by the SDK's environment
  722. setup script. One easy way to see these variables is to run the
  723. ``devtool build`` command on the recipe and then look in
  724. ``oe-logs/run.do_compile``. Towards the top of this file, there is
  725. a list of environment variables that are set. You can take
  726. advantage of these variables within the Makefile.
  727. - If the Makefile sets a default for a variable using "=", that default
  728. overrides the value set in the environment, which is usually not
  729. desirable. For this case, you can either patch the Makefile so it
  730. sets the default using the "?=" operator, or you can alternatively
  731. force the value on the ``make`` command line. To force the value on
  732. the command line, add the variable setting to
  733. :term:`EXTRA_OEMAKE` or
  734. :term:`PACKAGECONFIG_CONFARGS`
  735. within the recipe. Here is an example using :term:`EXTRA_OEMAKE`::
  736. EXTRA_OEMAKE += "'CC=${CC}' 'CXX=${CXX}'"
  737. In the above example,
  738. single quotes are used around the variable settings as the values are
  739. likely to contain spaces because required default options are passed
  740. to the compiler.
  741. - Hardcoding paths inside Makefiles is often problematic in a
  742. cross-compilation environment. This is particularly true because
  743. those hardcoded paths often point to locations on the build host and
  744. thus will either be read-only or will introduce contamination into
  745. the cross-compilation because they are specific to the build host
  746. rather than the target. Patching the Makefile to use prefix variables
  747. or other path variables is usually the way to handle this situation.
  748. - Sometimes a Makefile runs target-specific commands such as
  749. ``ldconfig``. For such cases, you might be able to apply patches that
  750. remove these commands from the Makefile.
  751. Adding Native Tools
  752. -------------------
  753. Often, you need to build additional tools that run on the :term:`Build
  754. Host` as opposed to
  755. the target. You should indicate this requirement by using one of the
  756. following methods when you run ``devtool add``:
  757. - Specify the name of the recipe such that it ends with "-native".
  758. Specifying the name like this produces a recipe that only builds for
  759. the build host.
  760. - Specify the "--also-native" option with the ``devtool add``
  761. command. Specifying this option creates a recipe file that still
  762. builds for the target but also creates a variant with a "-native"
  763. suffix that builds for the build host.
  764. .. note::
  765. If you need to add a tool that is shipped as part of a source tree
  766. that builds code for the target, you can typically accomplish this by
  767. building the native and target parts separately rather than within
  768. the same compilation process. Realize though that with the
  769. "--also-native" option, you can add the tool using just one
  770. recipe file.
  771. Adding Node.js Modules
  772. ----------------------
  773. You can use the ``devtool add`` command two different ways to add
  774. Node.js modules: 1) Through ``npm`` and, 2) from a repository or local
  775. source.
  776. Use the following form to add Node.js modules through ``npm``::
  777. $ devtool add "npm://registry.npmjs.org;name=forever;version=0.15.1"
  778. The name and
  779. version parameters are mandatory. Lockdown and shrinkwrap files are
  780. generated and pointed to by the recipe in order to freeze the version
  781. that is fetched for the dependencies according to the first time. This
  782. also saves checksums that are verified on future fetches. Together,
  783. these behaviors ensure the reproducibility and integrity of the build.
  784. .. note::
  785. - You must use quotes around the URL. The ``devtool add`` does not
  786. require the quotes, but the shell considers ";" as a splitter
  787. between multiple commands. Thus, without the quotes,
  788. ``devtool add`` does not receive the other parts, which results in
  789. several "command not found" errors.
  790. - In order to support adding Node.js modules, a ``nodejs`` recipe
  791. must be part of your SDK.
  792. As mentioned earlier, you can also add Node.js modules directly from a
  793. repository or local source tree. To add modules this way, use
  794. ``devtool add`` in the following form::
  795. $ devtool add https://github.com/diversario/node-ssdp
  796. In this example, ``devtool``
  797. fetches the specified Git repository, detects the code as Node.js code,
  798. fetches dependencies using ``npm``, and sets
  799. :term:`SRC_URI` accordingly.
  800. Working With Recipes
  801. ====================
  802. When building a recipe using the ``devtool build`` command, the typical
  803. build progresses as follows:
  804. #. Fetch the source
  805. #. Unpack the source
  806. #. Configure the source
  807. #. Compile the source
  808. #. Install the build output
  809. #. Package the installed output
  810. For recipes in the workspace, fetching and unpacking is disabled as the
  811. source tree has already been prepared and is persistent. Each of these
  812. build steps is defined as a function (task), usually with a "do\_" prefix
  813. (e.g. :ref:`ref-tasks-fetch`,
  814. :ref:`ref-tasks-unpack`, and so
  815. forth). These functions are typically shell scripts but can instead be
  816. written in Python.
  817. If you look at the contents of a recipe, you will see that the recipe
  818. does not include complete instructions for building the software.
  819. Instead, common functionality is encapsulated in classes inherited with
  820. the ``inherit`` directive. This technique leaves the recipe to describe
  821. just the things that are specific to the software being built. There is
  822. a :ref:`ref-classes-base` class that is implicitly inherited by all recipes
  823. and provides the functionality that most recipes typically need.
  824. The remainder of this section presents information useful when working
  825. with recipes.
  826. Finding Logs and Work Files
  827. ---------------------------
  828. After the first run of the ``devtool build`` command, recipes that were
  829. previously created using the ``devtool add`` command or whose sources
  830. were modified using the ``devtool modify`` command contain symbolic
  831. links created within the source tree:
  832. - ``oe-logs``: This link points to the directory in which log files and
  833. run scripts for each build step are created.
  834. - ``oe-workdir``: This link points to the temporary work area for the
  835. recipe. The following locations under ``oe-workdir`` are particularly
  836. useful:
  837. - ``image/``: Contains all of the files installed during the
  838. :ref:`ref-tasks-install` stage.
  839. Within a recipe, this directory is referred to by the expression
  840. ``${``\ :term:`D`\ ``}``.
  841. - ``sysroot-destdir/``: Contains a subset of files installed within
  842. :ref:`ref-tasks-install` that have been put into the shared sysroot. For
  843. more information, see the
  844. ":ref:`dev-manual/new-recipe:sharing files between recipes`" section.
  845. - ``packages-split/``: Contains subdirectories for each package
  846. produced by the recipe. For more information, see the
  847. ":ref:`sdk-manual/extensible:packaging`" section.
  848. You can use these links to get more information on what is happening at
  849. each build step.
  850. Setting Configure Arguments
  851. ---------------------------
  852. If the software your recipe is building uses GNU autoconf, then a fixed
  853. set of arguments is passed to it to enable cross-compilation plus any
  854. extras specified by
  855. :term:`EXTRA_OECONF` or
  856. :term:`PACKAGECONFIG_CONFARGS`
  857. set within the recipe. If you wish to pass additional options, add them
  858. to :term:`EXTRA_OECONF` or :term:`PACKAGECONFIG_CONFARGS`. Other supported build
  859. tools have similar variables (e.g.
  860. :term:`EXTRA_OECMAKE` for
  861. CMake, :term:`EXTRA_OESCONS`
  862. for Scons, and so forth). If you need to pass anything on the ``make``
  863. command line, you can use :term:`EXTRA_OEMAKE` or the
  864. :term:`PACKAGECONFIG_CONFARGS`
  865. variables to do so.
  866. You can use the ``devtool configure-help`` command to help you set the
  867. arguments listed in the previous paragraph. The command determines the
  868. exact options being passed, and shows them to you along with any custom
  869. arguments specified through :term:`EXTRA_OECONF` or
  870. :term:`PACKAGECONFIG_CONFARGS`. If applicable, the command also shows you
  871. the output of the configure script's "--help" option as a
  872. reference.
  873. Sharing Files Between Recipes
  874. -----------------------------
  875. Recipes often need to use files provided by other recipes on the
  876. :term:`Build Host`. For example,
  877. an application linking to a common library needs access to the library
  878. itself and its associated headers. The way this access is accomplished
  879. within the extensible SDK is through the sysroot. There is one sysroot per
  880. "machine" for which the SDK is being built. In practical terms, this
  881. means there is a sysroot for the target machine, and a sysroot for
  882. the build host.
  883. Recipes should never write files directly into the sysroot. Instead,
  884. files should be installed into standard locations during the
  885. :ref:`ref-tasks-install` task within
  886. the ``${``\ :term:`D`\ ``}`` directory. A
  887. subset of these files automatically goes into the sysroot. The reason
  888. for this limitation is that almost all files that go into the sysroot
  889. are cataloged in manifests in order to ensure they can be removed later
  890. when a recipe is modified or removed. Thus, the sysroot is able to
  891. remain free from stale files.
  892. Packaging
  893. ---------
  894. Packaging is not always particularly relevant within the extensible SDK.
  895. However, if you examine how build output gets into the final image on
  896. the target device, it is important to understand packaging because the
  897. contents of the image are expressed in terms of packages and not
  898. recipes.
  899. During the :ref:`ref-tasks-package`
  900. task, files installed during the
  901. :ref:`ref-tasks-install` task are
  902. split into one main package, which is almost always named the same as
  903. the recipe, and into several other packages. This separation exists
  904. because not all of those installed files are useful in every image. For
  905. example, you probably do not need any of the documentation installed in
  906. a production image. Consequently, for each recipe the documentation
  907. files are separated into a ``-doc`` package. Recipes that package
  908. software containing optional modules or plugins might undergo additional
  909. package splitting as well.
  910. After building a recipe, you can see where files have gone by looking in
  911. the ``oe-workdir/packages-split`` directory, which contains a
  912. subdirectory for each package. Apart from some advanced cases, the
  913. :term:`PACKAGES` and
  914. :term:`FILES` variables controls
  915. splitting. The :term:`PACKAGES` variable lists all of the packages to be
  916. produced, while the :term:`FILES` variable specifies which files to include
  917. in each package by using an override to specify the package. For
  918. example, ``FILES:${PN}`` specifies the files to go into the main package
  919. (i.e. the main package has the same name as the recipe and
  920. ``${``\ :term:`PN`\ ``}`` evaluates to the
  921. recipe name). The order of the :term:`PACKAGES` value is significant. For
  922. each installed file, the first package whose :term:`FILES` value matches the
  923. file is the package into which the file goes. Both the :term:`PACKAGES` and
  924. :term:`FILES` variables have default values. Consequently, you might find
  925. you do not even need to set these variables in your recipe unless the
  926. software the recipe is building installs files into non-standard
  927. locations.
  928. Restoring the Target Device to its Original State
  929. =================================================
  930. If you use the ``devtool deploy-target`` command to write a recipe's
  931. build output to the target, and you are working on an existing component
  932. of the system, then you might find yourself in a situation where you
  933. need to restore the original files that existed prior to running the
  934. ``devtool deploy-target`` command. Because the ``devtool deploy-target``
  935. command backs up any files it overwrites, you can use the
  936. ``devtool undeploy-target`` command to restore those files and remove
  937. any other files the recipe deployed. Consider the following example::
  938. $ devtool undeploy-target lighttpd root@192.168.7.2
  939. If you have deployed
  940. multiple applications, you can remove them all using the "-a" option
  941. thus restoring the target device to its original state::
  942. $ devtool undeploy-target -a root@192.168.7.2
  943. Information about files deployed to
  944. the target as well as any backed up files are stored on the target
  945. itself. This storage, of course, requires some additional space on the
  946. target machine.
  947. .. note::
  948. The
  949. devtool deploy-target
  950. and
  951. devtool undeploy-target
  952. commands do not currently interact with any package management system
  953. on the target device (e.g. RPM or OPKG). Consequently, you should not
  954. intermingle
  955. devtool deploy-target
  956. and package manager operations on the target device. Doing so could
  957. result in a conflicting set of files.
  958. Installing Additional Items Into the Extensible SDK
  959. ===================================================
  960. Out of the box the extensible SDK typically only comes with a small
  961. number of tools and libraries. A minimal SDK starts mostly empty and is
  962. populated on-demand. Sometimes you must explicitly install extra items
  963. into the SDK. If you need these extra items, you can first search for
  964. the items using the ``devtool search`` command. For example, suppose you
  965. need to link to libGL but you are not sure which recipe provides libGL.
  966. You can use the following command to find out::
  967. $ devtool search libGL mesa
  968. A free implementation of the OpenGL API
  969. Once you know the recipe
  970. (i.e. ``mesa`` in this example), you can install it.
  971. When using the extensible SDK directly in a Yocto build
  972. -------------------------------------------------------
  973. In this scenario, the Yocto build tooling, e.g. ``bitbake``
  974. is directly accessible to build additional items, and it
  975. can simply be executed directly:
  976. $ bitbake mesa
  977. $ bitbake build-sysroots
  978. When using a standalone installer for the Extensible SDK
  979. --------------------------------------------------------
  980. $ devtool sdk-install mesa
  981. By default, the ``devtool sdk-install`` command assumes
  982. the item is available in pre-built form from your SDK provider. If the
  983. item is not available and it is acceptable to build the item from
  984. source, you can add the "-s" option as follows::
  985. $ devtool sdk-install -s mesa
  986. It is important to remember that building the item from source
  987. takes significantly longer than installing the pre-built artifact. Also,
  988. if there is no recipe for the item you want to add to the SDK, you must
  989. instead add the item using the ``devtool add`` command.
  990. Applying Updates to an Installed Extensible SDK
  991. ===============================================
  992. If you are working with an installed extensible SDK that gets
  993. occasionally updated (e.g. a third-party SDK), then you will need to
  994. manually "pull down" the updates into the installed SDK.
  995. To update your installed SDK, use ``devtool`` as follows::
  996. $ devtool sdk-update
  997. The previous command assumes your SDK provider has set the
  998. default update URL for you through the :term:`SDK_UPDATE_URL`
  999. variable as described in the
  1000. ":ref:`sdk-manual/appendix-customizing:Providing Updates to the Extensible SDK After Installation`"
  1001. section. If the SDK provider has not set that default URL, you need to
  1002. specify it yourself in the command as follows: $ devtool sdk-update
  1003. path_to_update_directory
  1004. .. note::
  1005. The URL needs to point specifically to a published SDK and not to an
  1006. SDK installer that you would download and install.
  1007. Creating a Derivative SDK With Additional Components
  1008. ====================================================
  1009. You might need to produce an SDK that contains your own custom
  1010. libraries. A good example would be if you were a vendor with customers
  1011. that use your SDK to build their own platform-specific software and
  1012. those customers need an SDK that has custom libraries. In such a case,
  1013. you can produce a derivative SDK based on the currently installed SDK
  1014. fairly easily by following these steps:
  1015. #. If necessary, install an extensible SDK that you want to use as a
  1016. base for your derivative SDK.
  1017. #. Source the environment script for the SDK.
  1018. #. Add the extra libraries or other components you want by using the
  1019. ``devtool add`` command.
  1020. #. Run the ``devtool build-sdk`` command.
  1021. The previous steps take the recipes added to the workspace and construct
  1022. a new SDK installer that contains those recipes and the resulting binary
  1023. artifacts. The recipes go into their own separate layer in the
  1024. constructed derivative SDK, which leaves the workspace clean and ready
  1025. for users to add their own recipes.