extensible.rst 53 KB

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