sdk-extensible.rst 54 KB

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