extensible.rst 53 KB

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