blob: 99d5a52a0f547acf4cd5544686768d295566d9a1 [file] [log] [blame]
Patrick Williamsc0f7c042017-02-23 20:41:17 -06001<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3[<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
4
5<chapter id='ref-devtool-reference'>
6 <title><filename>devtool</filename> Quick Reference</title>
7
8 <para>
9 The <filename>devtool</filename> command-line tool provides a number
10 of features that help you build, test, and package software.
11 This command is available alongside the <filename>bitbake</filename>
12 command.
13 Additionally, the <filename>devtool</filename> command is a key
14 part of the extensible SDK.
15 </para>
16
17 <para>
18 This chapter provides a Quick Reference for the
19 <filename>devtool</filename> command.
20 For more information on how to apply the command when using the
21 extensible SDK, see the
22 "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-extensible'>Using the Extensible SDK</ulink>"
23 section in the Yocto Project Software Development Kit (SDK) Developer's
24 Guide.
25 </para>
26
27 <section id='devtool-getting-help'>
28 <title>Getting Help</title>
29
30 <para>
31 The <filename>devtool</filename> command line is organized
32 similarly to Git in that it has a number of sub-commands for
33 each function.
34 You can run <filename>devtool --help</filename> to see all
35 the commands:
36 <literallayout class='monospaced'>
37 $ devtool --help
38 usage: devtool [--basepath BASEPATH] [--bbpath BBPATH] [-d] [-q]
39 [--color COLOR] [-h]
40 &lt;subcommand&gt; ...
41
42 OpenEmbedded development tool
43
44 options:
45 --basepath BASEPATH Base directory of SDK / build directory
46 --bbpath BBPATH Explicitly specify the BBPATH, rather than getting it
47 from the metadata
48 -d, --debug Enable debug output
49 -q, --quiet Print only errors
50 --color COLOR Colorize output (where COLOR is auto, always, never)
51 -h, --help show this help message and exit
52
53 subcommands:
54 Beginning work on a recipe:
55 add Add a new recipe
56 modify Modify the source for an existing recipe
57 upgrade Upgrade an existing recipe
58 Getting information:
59 status Show workspace status
60 search Search available recipes
61 Working on a recipe in the workspace:
62 edit-recipe Edit a recipe file in your workspace
63 configure-help Get help on configure script options
64 build Build a recipe
65 update-recipe Apply changes from external source tree to recipe
66 reset Remove a recipe from your workspace
67 finish Finish working on a recipe in your workspace
68 Testing changes on target:
69 deploy-target Deploy recipe output files to live target machine
70 undeploy-target Undeploy recipe output files in live target machine
71 build-image Build image including workspace recipe packages
72 Advanced:
73 create-workspace Set up workspace in an alternative location
74 extract Extract the source for an existing recipe
75 sync Synchronize the source tree for an existing recipe
76 Use devtool &lt;subcommand&gt; --help to get help on a specific command
77 </literallayout>
78 </para>
79
80 <para>
81 As directed in the general help output, you can get more
82 syntax on a specific command by providing the command
83 name and using <filename>--help</filename>:
84 <literallayout class='monospaced'>
85 $ devtool add --help
86 usage: devtool add [-h] [--same-dir | --no-same-dir] [--fetch URI]
87 [--version VERSION] [--no-git] [--autorev] [--binary]
88 [--also-native] [--src-subdir SUBDIR]
89 [recipename] [srctree] [fetchuri]
90
91 Adds a new recipe to the workspace to build a specified source tree. Can
92 optionally fetch a remote URI and unpack it to create the source tree.
93
94 arguments:
95 recipename Name for new recipe to add (just name - no version,
96 path or extension). If not specified, will attempt to
97 auto-detect it.
98 srctree Path to external source tree. If not specified, a
99 subdirectory of
100 /home/scottrif/poky/build/workspace/sources will be
101 used.
102 fetchuri Fetch the specified URI and extract it to create the
103 source tree
104
105 options:
106 -h, --help show this help message and exit
107 --same-dir, -s Build in same directory as source
108 --no-same-dir Force build in a separate build directory
109 --fetch URI, -f URI Fetch the specified URI and extract it to create the
110 source tree (deprecated - pass as positional argument
111 instead)
112 --version VERSION, -V VERSION
113 Version to use within recipe (PV)
114 --no-git, -g If fetching source, do not set up source tree as a git
115 repository
116 --autorev, -a When fetching from a git repository, set SRCREV in the
117 recipe to a floating revision instead of fixed
118 --binary, -b Treat the source tree as something that should be
119 installed verbatim (no compilation, same directory
120 structure). Useful with binary packages e.g. RPMs.
121 --also-native Also add native variant (i.e. support building recipe
122 for the build host as well as the target machine)
123 --src-subdir SUBDIR Specify subdirectory within source tree to use
124 </literallayout>
125 </para>
126 </section>
127
128 <section id='devtool-the-workspace-layer-structure'>
129 <title>The Workspace Layer Structure</title>
130
131 <para>
132 <filename>devtool</filename> uses a "Workspace" layer
133 in which to accomplish builds.
134 This layer is not specific to any single
135 <filename>devtool</filename> command but is rather a common
136 working area used across the tool.
137 </para>
138
139 <para>
140 The following figure shows the workspace structure:
141 </para>
142
143 <para>
144 <imagedata fileref="figures/build-workspace-directory.png"
145 width="6in" depth="5in" align="left" scale="70" />
146 </para>
147
148 <para>
149 <literallayout class='monospaced'>
150 attic - A directory created if devtool believes it preserve
151 anything when you run "devtool reset". For example, if you
152 run "devtool add", make changes to the recipe, and then
153 run "devtool reset", devtool takes notice that the file has
154 been changed and moves it into the attic should you still
155 want the recipe.
156
157 README - Provides information on what is in workspace layer and how to
158 manage it.
159
160 .devtool_md5 - A checksum file used by devtool.
161
162 appends - A directory that contains *.bbappend files, which point to
163 external source.
164
165 conf - A configuration directory that contains the layer.conf file.
166
167 recipes - A directory containing recipes. This directory contains a
168 folder for each directory added whose name matches that of the
169 added recipe. devtool places the <replaceable>recipe</replaceable>.bb file
170 within that sub-directory.
171
172 sources - A directory containing a working copy of the source files used
173 when building the recipe. This is the default directory used
174 as the location of the source tree when you do not provide a
175 source tree path. This directory contains a folder for each
176 set of source files matched to a corresponding recipe.
177 </literallayout>
178 </para>
179 </section>
180
181 <section id='devtool-adding-a-new-recipe-to-the-workspace'>
182 <title>Adding a New Recipe to the Workspace Layer</title>
183
184 <para>
185 Use the <filename>devtool add</filename> command to add a new recipe
186 to the workspace layer.
187 The recipe you add should not exist -
188 <filename>devtool</filename> creates it for you.
189 The source files the recipe uses should exist in an external
190 area.
191 </para>
192
193 <para>
194 The following example creates and adds a new recipe named
195 <filename>jackson</filename> to a workspace layer the tool creates.
196 The source code built by the recipes resides in
197 <filename>/home/scottrif/sources/jackson</filename>:
198 <literallayout class='monospaced'>
199 $ devtool add jackson /home/scottrif/sources/jackson
200 </literallayout>
201 </para>
202
203 <para>
204 If you add a recipe and the workspace layer does not exist,
205 the command creates the layer and populates it as
206 described in
207 "<link linkend='devtool-the-workspace-layer-structure'>The Workspace Layer Structure</link>"
208 section.
209 </para>
210
211 <para>
212 Running <filename>devtool add</filename> when the
213 workspace layer exists causes the tool to add the recipe,
214 append files, and source files into the existing workspace layer.
215 The <filename>.bbappend</filename> file is created to point
216 to the external source tree.
217 </para>
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500218
219 <note>
220 If your recipe has runtime dependencies defined, you must be sure
221 that these packages exist on the target hardware before attempting
222 to run your application.
223 If dependent packages (e.g. libraries) do not exist on the target,
224 your application, when run, will fail to find those functions.
225 For more information, see the
226 "<link linkend='devtool-deploying-your-software-on-the-target-machine'>Deploying Your Software on the Target Machine</link>"
227 section.
228 </note>
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600229 </section>
230
231 <section id='devtool-extracting-the-source-for-an-existing-recipe'>
232 <title>Extracting the Source for an Existing Recipe</title>
233
234 <para>
235 Use the <filename>devtool extract</filename> command to
236 extract the source for an existing recipe.
237 When you use this command, you must supply the root name
238 of the recipe (i.e. no version, paths, or extensions), and
239 you must supply the directory to which you want the source
240 extracted.
241 </para>
242
243 <para>
244 Additional command options let you control the name of a
245 development branch into which you can checkout the source
246 and whether or not to keep a temporary directory, which is
247 useful for debugging.
248 </para>
249 </section>
250
251 <section id='devtool-synchronizing-a-recipes-extracted-source-tree'>
252 <title>Synchronizing a Recipe's Extracted Source Tree</title>
253
254 <para>
255 Use the <filename>devtool sync</filename> command to
256 synchronize a previously extracted source tree for an
257 existing recipe.
258 When you use this command, you must supply the root name
259 of the recipe (i.e. no version, paths, or extensions), and
260 you must supply the directory to which you want the source
261 extracted.
262 </para>
263
264 <para>
265 Additional command options let you control the name of a
266 development branch into which you can checkout the source
267 and whether or not to keep a temporary directory, which is
268 useful for debugging.
269 </para>
270 </section>
271
272 <section id='devtool-modifying-a-recipe'>
273 <title>Modifying an Existing Recipe</title>
274
275 <para>
276 Use the <filename>devtool modify</filename> command to begin
277 modifying the source of an existing recipe.
278 This command is very similar to the
279 <ulink url='&YOCTO_DOCS_DEV_URL;#devtool-adding-a-new-recipe-to-the-workspace'><filename>add</filename></ulink>
280 command except that it does not physically create the
281 recipe in the workspace layer because the recipe already
282 exists in an another layer.
283 </para>
284
285 <para>
286 The <filename>devtool modify</filename> command extracts the
287 source for a recipe, sets it up as a Git repository if the
288 source had not already been fetched from Git, checks out a
289 branch for development, and applies any patches from the recipe
290 as commits on top.
291 You can use the following command to checkout the source
292 files:
293 <literallayout class='monospaced'>
294 $ devtool modify <replaceable>recipe</replaceable>
295 </literallayout>
296 Using the above command form, <filename>devtool</filename> uses
297 the existing recipe's
298 <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
299 statement to locate the upstream source, extracts the source
300 into the default sources location in the workspace.
301 The default development branch used is "devtool".
302 </para>
303 </section>
304
305 <section id='devtool-edit-an-existing-recipe'>
306 <title>Edit an Existing Recipe</title>
307
308 <para>
309 Use the <filename>devtool edit-recipe</filename> command
310 to run the default editor, which is identified using the
311 <filename>EDITOR</filename> variable, on the specified recipe.
312 </para>
313
314 <para>
315 When you use the <filename>devtool edit-recipe</filename>
316 command, you must supply the root name of the recipe
317 (i.e. no version, paths, or extensions).
318 Also, the recipe file itself must reside in the workspace
319 as a result of the <filename>devtool add</filename> or
320 <filename>devtool upgrade</filename> commands.
321 However, you can override that requirement by using the
322 "-a" or "--any-recipe" option.
323 Using either of these options allows you to edit any recipe
324 regardless of its location.
325 </para>
326 </section>
327
328 <section id='devtool-updating-a-recipe'>
329 <title>Updating a Recipe</title>
330
331 <para>
332 Use the <filename>devtool update-recipe</filename> command to
333 update your recipe with patches that reflect changes you make
334 to the source files.
335 For example, if you know you are going to work on some
336 code, you could first use the
337 <ulink url='&YOCTO_DOCS_DEV_URL;#devtool-modifying-a-recipe'><filename>devtool modify</filename></ulink>
338 command to extract the code and set up the workspace.
339 After which, you could modify, compile, and test the code.
340 </para>
341
342 <para>
343 When you are satisfied with the results and you have committed
344 your changes to the Git repository, you can then
345 run the <filename>devtool update-recipe</filename> to create the
346 patches and update the recipe:
347 <literallayout class='monospaced'>
348 $ devtool update-recipe <replaceable>recipe</replaceable>
349 </literallayout>
350 If you run the <filename>devtool update-recipe</filename>
351 without committing your changes, the command ignores the
352 changes.
353 </para>
354
355 <para>
356 Often, you might want to apply customizations made to your
357 software in your own layer rather than apply them to the
358 original recipe.
359 If so, you can use the
360 <filename>-a</filename> or <filename>--append</filename>
361 option with the <filename>devtool update-recipe</filename>
362 command.
363 These options allow you to specify the layer into which to
364 write an append file:
365 <literallayout class='monospaced'>
366 $ devtool update-recipe <replaceable>recipe</replaceable> -a <replaceable>base-layer-directory</replaceable>
367 </literallayout>
368 The <filename>*.bbappend</filename> file is created at the
369 appropriate path within the specified layer directory, which
370 may or may not be in your <filename>bblayers.conf</filename>
371 file.
372 If an append file already exists, the command updates it
373 appropriately.
374 </para>
375 </section>
376
377 <section id='devtool-upgrading-a-recipe'>
378 <title>Upgrading a Recipe</title>
379
380 <para>
381 Use the <filename>devtool upgrade</filename> command
382 to upgrade an existing recipe to a new upstream version.
383 The command puts the upgraded recipe file into the
384 workspace along with any associated files, and extracts
385 the source tree to a specified location should patches
386 need rebased or added to as a result of the upgrade.
387 </para>
388
389 <para>
390 When you use the <filename>devtool upgrade</filename> command,
391 you must supply the root name of the recipe (i.e. no version,
392 paths, or extensions), and you must supply the directory
393 to which you want the source extracted.
394 Additional command options let you control things such as
395 the version number to which you want to upgrade (i.e. the
396 <link linkend='var-PV'><filename>PV</filename></link>),
397 the source revision to which you want to upgrade (i.e. the
398 <link linkend='var-SRCREV'><filename>SRCREV</filename></link>,
399 whether or not to apply patches, and so forth.
400 </para>
401 </section>
402
403 <section id='devtool-resetting-a-recipe'>
404 <title>Resetting a Recipe</title>
405
406 <para>
407 Use the <filename>devtool reset</filename> command to remove a
408 recipe and its configuration (e.g. the corresponding
409 <filename>.bbappend</filename> file) from the workspace layer.
410 Realize that this command deletes the recipe and the
411 append file.
412 The command does not physically move them for you.
413 Consequently, you must be sure to physically relocate your
414 updated recipe and the append file outside of the workspace
415 layer before running the <filename>devtool reset</filename>
416 command.
417 </para>
418
419 <para>
420 If the <filename>devtool reset</filename> command detects that
421 the recipe or the append files have been modified, the
422 command preserves the modified files in a separate "attic"
423 subdirectory under the workspace layer.
424 </para>
425
426 <para>
427 Here is an example that resets the workspace directory that
428 contains the <filename>mtr</filename> recipe:
429 <literallayout class='monospaced'>
430 $ devtool reset mtr
431 NOTE: Cleaning sysroot for recipe mtr...
432 NOTE: Leaving source tree /home/scottrif/poky/build/workspace/sources/mtr as-is; if you no
433 longer need it then please delete it manually
434 $
435 </literallayout>
436 </para>
437 </section>
438
439 <section id='devtool-building-your-recipe'>
440 <title>Building Your Recipe</title>
441
442 <para>
443 Use the <filename>devtool build</filename> command to cause the
444 OpenEmbedded build system to build your recipe.
445 The <filename>devtool build</filename> command is equivalent to
446 <filename>bitbake -c populate_sysroot</filename>.
447 </para>
448
449 <para>
450 When you use the <filename>devtool build</filename> command,
451 you must supply the root name of the recipe (i.e. no version,
452 paths, or extensions).
453 You can use either the "-s" or the "--disable-parallel-make"
454 option to disable parallel makes during the build.
455 Here is an example:
456 <literallayout class='monospaced'>
457 $ devtool build <replaceable>recipe</replaceable>
458 </literallayout>
459 </para>
460 </section>
461
462 <section id='devtool-building-your-image'>
463 <title>Building Your Image</title>
464
465 <para>
466 Use the <filename>devtool build-image</filename> command
467 to build an image, extending it to include packages from
468 recipes in the workspace.
469 Using this command is useful when you want an image that
470 ready for immediate deployment onto a device for testing.
471 For proper integration into a final image, you need to
472 edit your custom image recipe appropriately.
473 </para>
474
475 <para>
476 When you use the <filename>devtool build-image</filename>
477 command, you must supply the name of the image.
478 This command has no command line options:
479 <literallayout class='monospaced'>
480 $ devtool build-image <replaceable>image</replaceable>
481 </literallayout>
482 </para>
483 </section>
484
485 <section id='devtool-deploying-your-software-on-the-target-machine'>
486 <title>Deploying Your Software on the Target Machine</title>
487
488 <para>
489 Use the <filename>devtool deploy-target</filename> command to
490 deploy the recipe's build output to the live target machine:
491 <literallayout class='monospaced'>
492 $ devtool deploy-target <replaceable>recipe</replaceable>&nbsp;<replaceable>target</replaceable>
493 </literallayout>
494 The <replaceable>target</replaceable> is the address of the
495 target machine, which must be running an SSH server (i.e.
496 <filename>user@hostname[:destdir]</filename>).
497 </para>
498
499 <para>
500 This command deploys all files installed during the
501 <link linkend='ref-tasks-install'><filename>do_install</filename></link>
502 task.
503 Furthermore, you do not need to have package management enabled
504 within the target machine.
505 If you do, the package manager is bypassed.
506 <note><title>Notes</title>
507 <para>
508 The <filename>deploy-target</filename>
509 functionality is for development only.
510 You should never use it to update an image that will be
511 used in production.
512 </para>
513 </note>
514 </para>
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500515
516 <para>
517 Some conditions exist that could prevent a deployed application
518 from behaving as expected.
519 When both of the following conditions exist, your application has
520 the potential to not behave correctly when run on the target:
521 <itemizedlist>
522 <listitem><para>
523 You are deploying a new application to the target and
524 the recipe you used to build the application had
525 correctly defined runtime dependencies.
526 </para></listitem>
527 <listitem><para>
528 The target does not physically have the packages on which
529 the application depends installed.
530 </para></listitem>
531 </itemizedlist>
532 If both of these conditions exist, your application will not
533 behave as expected.
534 The reason for this misbehavior is because the
535 <filename>devtool deploy-target</filename> command does not deploy
536 the packages (e.g. libraries) on which your new application
537 depends.
538 The assumption is that the packages are already on the target.
539 Consequently, when a runtime call is made in the application
540 for a dependent function (e.g. a library call), the function
541 cannot be found.
542 </para>
543
544 <para>
545 To be sure you have all the dependencies local to the target, you
546 need to be sure that the packages are pre-deployed (installed)
547 on the target before attempting to run your application.
548 </para>
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600549 </section>
550
551 <section id='devtool-removing-your-software-from-the-target-machine'>
552 <title>Removing Your Software from the Target Machine</title>
553
554 <para>
555 Use the <filename>devtool undeploy-target</filename> command to
556 remove deployed build output from the target machine.
557 For the <filename>devtool undeploy-target</filename> command to
558 work, you must have previously used the
559 <ulink url='&YOCTO_DOCS_DEV_URL;#devtool-deploying-your-software-on-the-target-machine'><filename>devtool deploy-target</filename></ulink>
560 command.
561 <literallayout class='monospaced'>
562 $ devtool undeploy-target <replaceable>recipe</replaceable>&nbsp;<replaceable>target</replaceable>
563 </literallayout>
564 The <replaceable>target</replaceable> is the address of the
565 target machine, which must be running an SSH server (i.e.
566 <filename>user@hostname</filename>).
567 </para>
568 </section>
569
570 <section id='devtool-creating-the-workspace'>
571 <title>Creating the Workspace Layer in an Alternative Location</title>
572
573 <para>
574 Use the <filename>devtool create-workspace</filename> command to
575 create a new workspace layer in your
576 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>.
577 When you create a new workspace layer, it is populated with the
578 <filename>README</filename> file and the
579 <filename>conf</filename> directory only.
580 </para>
581
582 <para>
583 The following example creates a new workspace layer in your
584 current working and by default names the workspace layer
585 "workspace":
586 <literallayout class='monospaced'>
587 $ devtool create-workspace
588 </literallayout>
589 </para>
590
591 <para>
592 You can create a workspace layer anywhere by supplying
593 a pathname with the command.
594 The following command creates a new workspace layer named
595 "new-workspace":
596 <literallayout class='monospaced'>
597 $ devtool create-workspace /home/scottrif/new-workspace
598 </literallayout>
599 </para>
600 </section>
601
602 <section id='devtool-get-the-status-of-the-recipes-in-your-workspace'>
603 <title>Get the Status of the Recipes in Your Workspace</title>
604
605 <para>
606 Use the <filename>devtool status</filename> command to
607 list the recipes currently in your workspace.
608 Information includes the paths to their respective
609 external source trees.
610 </para>
611
612 <para>
613 The <filename>devtool status</filename> command has no
614 command-line options:
615 <literallayout class='monospaced'>
616 $ devtool status
617 </literallayout>
618 Following is sample output after using
619 <ulink url='&YOCTO_DOCS_DEV_URL;#devtool-adding-a-new-recipe-to-the-workspace'><filename>devtool add</filename></ulink>
620 to create and add the <filename>mtr_0.86.bb</filename> recipe
621 to the <filename>workspace</filename> directory:
622 <literallayout class='monospaced'>
623 $ devtool status
624 mtr: /home/scottrif/poky/build/workspace/sources/mtr (/home/scottrif/poky/build/workspace/recipes/mtr/mtr_0.86.bb)
625 $
626 </literallayout>
627 </para>
628 </section>
629
630 <section id='devtool-search-for-available-target-recipes'>
631 <title>Search for Available Target Recipes</title>
632
633 <para>
634 Use the <filename>devtool search</filename> command to
635 search for available target recipes.
636 The command matches the recipe name, package name,
637 description, and installed files.
638 The command displays the recipe name as a result of a
639 match.
640 </para>
641
642 <para>
643 When you use the <filename>devtool search</filename> command,
644 you must supply a <replaceable>keyword</replaceable>.
645 The command uses the <replaceable>keyword</replaceable> when
646 searching for a match.
647 </para>
648 </section>
649</chapter>
650<!--
651vim: expandtab tw=80 ts=4
652-->