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