blob: 1764f0196f6d30c9b3dc2f31d87a28366d220307 [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>
218 </section>
219
220 <section id='devtool-extracting-the-source-for-an-existing-recipe'>
221 <title>Extracting the Source for an Existing Recipe</title>
222
223 <para>
224 Use the <filename>devtool extract</filename> command to
225 extract the source for an existing recipe.
226 When you use this command, you must supply the root name
227 of the recipe (i.e. no version, paths, or extensions), and
228 you must supply the directory to which you want the source
229 extracted.
230 </para>
231
232 <para>
233 Additional command options let you control the name of a
234 development branch into which you can checkout the source
235 and whether or not to keep a temporary directory, which is
236 useful for debugging.
237 </para>
238 </section>
239
240 <section id='devtool-synchronizing-a-recipes-extracted-source-tree'>
241 <title>Synchronizing a Recipe's Extracted Source Tree</title>
242
243 <para>
244 Use the <filename>devtool sync</filename> command to
245 synchronize a previously extracted source tree for an
246 existing recipe.
247 When you use this command, you must supply the root name
248 of the recipe (i.e. no version, paths, or extensions), and
249 you must supply the directory to which you want the source
250 extracted.
251 </para>
252
253 <para>
254 Additional command options let you control the name of a
255 development branch into which you can checkout the source
256 and whether or not to keep a temporary directory, which is
257 useful for debugging.
258 </para>
259 </section>
260
261 <section id='devtool-modifying-a-recipe'>
262 <title>Modifying an Existing Recipe</title>
263
264 <para>
265 Use the <filename>devtool modify</filename> command to begin
266 modifying the source of an existing recipe.
267 This command is very similar to the
268 <ulink url='&YOCTO_DOCS_DEV_URL;#devtool-adding-a-new-recipe-to-the-workspace'><filename>add</filename></ulink>
269 command except that it does not physically create the
270 recipe in the workspace layer because the recipe already
271 exists in an another layer.
272 </para>
273
274 <para>
275 The <filename>devtool modify</filename> command extracts the
276 source for a recipe, sets it up as a Git repository if the
277 source had not already been fetched from Git, checks out a
278 branch for development, and applies any patches from the recipe
279 as commits on top.
280 You can use the following command to checkout the source
281 files:
282 <literallayout class='monospaced'>
283 $ devtool modify <replaceable>recipe</replaceable>
284 </literallayout>
285 Using the above command form, <filename>devtool</filename> uses
286 the existing recipe's
287 <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
288 statement to locate the upstream source, extracts the source
289 into the default sources location in the workspace.
290 The default development branch used is "devtool".
291 </para>
292 </section>
293
294 <section id='devtool-edit-an-existing-recipe'>
295 <title>Edit an Existing Recipe</title>
296
297 <para>
298 Use the <filename>devtool edit-recipe</filename> command
299 to run the default editor, which is identified using the
300 <filename>EDITOR</filename> variable, on the specified recipe.
301 </para>
302
303 <para>
304 When you use the <filename>devtool edit-recipe</filename>
305 command, you must supply the root name of the recipe
306 (i.e. no version, paths, or extensions).
307 Also, the recipe file itself must reside in the workspace
308 as a result of the <filename>devtool add</filename> or
309 <filename>devtool upgrade</filename> commands.
310 However, you can override that requirement by using the
311 "-a" or "--any-recipe" option.
312 Using either of these options allows you to edit any recipe
313 regardless of its location.
314 </para>
315 </section>
316
317 <section id='devtool-updating-a-recipe'>
318 <title>Updating a Recipe</title>
319
320 <para>
321 Use the <filename>devtool update-recipe</filename> command to
322 update your recipe with patches that reflect changes you make
323 to the source files.
324 For example, if you know you are going to work on some
325 code, you could first use the
326 <ulink url='&YOCTO_DOCS_DEV_URL;#devtool-modifying-a-recipe'><filename>devtool modify</filename></ulink>
327 command to extract the code and set up the workspace.
328 After which, you could modify, compile, and test the code.
329 </para>
330
331 <para>
332 When you are satisfied with the results and you have committed
333 your changes to the Git repository, you can then
334 run the <filename>devtool update-recipe</filename> to create the
335 patches and update the recipe:
336 <literallayout class='monospaced'>
337 $ devtool update-recipe <replaceable>recipe</replaceable>
338 </literallayout>
339 If you run the <filename>devtool update-recipe</filename>
340 without committing your changes, the command ignores the
341 changes.
342 </para>
343
344 <para>
345 Often, you might want to apply customizations made to your
346 software in your own layer rather than apply them to the
347 original recipe.
348 If so, you can use the
349 <filename>-a</filename> or <filename>--append</filename>
350 option with the <filename>devtool update-recipe</filename>
351 command.
352 These options allow you to specify the layer into which to
353 write an append file:
354 <literallayout class='monospaced'>
355 $ devtool update-recipe <replaceable>recipe</replaceable> -a <replaceable>base-layer-directory</replaceable>
356 </literallayout>
357 The <filename>*.bbappend</filename> file is created at the
358 appropriate path within the specified layer directory, which
359 may or may not be in your <filename>bblayers.conf</filename>
360 file.
361 If an append file already exists, the command updates it
362 appropriately.
363 </para>
364 </section>
365
366 <section id='devtool-upgrading-a-recipe'>
367 <title>Upgrading a Recipe</title>
368
369 <para>
370 Use the <filename>devtool upgrade</filename> command
371 to upgrade an existing recipe to a new upstream version.
372 The command puts the upgraded recipe file into the
373 workspace along with any associated files, and extracts
374 the source tree to a specified location should patches
375 need rebased or added to as a result of the upgrade.
376 </para>
377
378 <para>
379 When you use the <filename>devtool upgrade</filename> command,
380 you must supply the root name of the recipe (i.e. no version,
381 paths, or extensions), and you must supply the directory
382 to which you want the source extracted.
383 Additional command options let you control things such as
384 the version number to which you want to upgrade (i.e. the
385 <link linkend='var-PV'><filename>PV</filename></link>),
386 the source revision to which you want to upgrade (i.e. the
387 <link linkend='var-SRCREV'><filename>SRCREV</filename></link>,
388 whether or not to apply patches, and so forth.
389 </para>
390 </section>
391
392 <section id='devtool-resetting-a-recipe'>
393 <title>Resetting a Recipe</title>
394
395 <para>
396 Use the <filename>devtool reset</filename> command to remove a
397 recipe and its configuration (e.g. the corresponding
398 <filename>.bbappend</filename> file) from the workspace layer.
399 Realize that this command deletes the recipe and the
400 append file.
401 The command does not physically move them for you.
402 Consequently, you must be sure to physically relocate your
403 updated recipe and the append file outside of the workspace
404 layer before running the <filename>devtool reset</filename>
405 command.
406 </para>
407
408 <para>
409 If the <filename>devtool reset</filename> command detects that
410 the recipe or the append files have been modified, the
411 command preserves the modified files in a separate "attic"
412 subdirectory under the workspace layer.
413 </para>
414
415 <para>
416 Here is an example that resets the workspace directory that
417 contains the <filename>mtr</filename> recipe:
418 <literallayout class='monospaced'>
419 $ devtool reset mtr
420 NOTE: Cleaning sysroot for recipe mtr...
421 NOTE: Leaving source tree /home/scottrif/poky/build/workspace/sources/mtr as-is; if you no
422 longer need it then please delete it manually
423 $
424 </literallayout>
425 </para>
426 </section>
427
428 <section id='devtool-building-your-recipe'>
429 <title>Building Your Recipe</title>
430
431 <para>
432 Use the <filename>devtool build</filename> command to cause the
433 OpenEmbedded build system to build your recipe.
434 The <filename>devtool build</filename> command is equivalent to
435 <filename>bitbake -c populate_sysroot</filename>.
436 </para>
437
438 <para>
439 When you use the <filename>devtool build</filename> command,
440 you must supply the root name of the recipe (i.e. no version,
441 paths, or extensions).
442 You can use either the "-s" or the "--disable-parallel-make"
443 option to disable parallel makes during the build.
444 Here is an example:
445 <literallayout class='monospaced'>
446 $ devtool build <replaceable>recipe</replaceable>
447 </literallayout>
448 </para>
449 </section>
450
451 <section id='devtool-building-your-image'>
452 <title>Building Your Image</title>
453
454 <para>
455 Use the <filename>devtool build-image</filename> command
456 to build an image, extending it to include packages from
457 recipes in the workspace.
458 Using this command is useful when you want an image that
459 ready for immediate deployment onto a device for testing.
460 For proper integration into a final image, you need to
461 edit your custom image recipe appropriately.
462 </para>
463
464 <para>
465 When you use the <filename>devtool build-image</filename>
466 command, you must supply the name of the image.
467 This command has no command line options:
468 <literallayout class='monospaced'>
469 $ devtool build-image <replaceable>image</replaceable>
470 </literallayout>
471 </para>
472 </section>
473
474 <section id='devtool-deploying-your-software-on-the-target-machine'>
475 <title>Deploying Your Software on the Target Machine</title>
476
477 <para>
478 Use the <filename>devtool deploy-target</filename> command to
479 deploy the recipe's build output to the live target machine:
480 <literallayout class='monospaced'>
481 $ devtool deploy-target <replaceable>recipe</replaceable>&nbsp;<replaceable>target</replaceable>
482 </literallayout>
483 The <replaceable>target</replaceable> is the address of the
484 target machine, which must be running an SSH server (i.e.
485 <filename>user@hostname[:destdir]</filename>).
486 </para>
487
488 <para>
489 This command deploys all files installed during the
490 <link linkend='ref-tasks-install'><filename>do_install</filename></link>
491 task.
492 Furthermore, you do not need to have package management enabled
493 within the target machine.
494 If you do, the package manager is bypassed.
495 <note><title>Notes</title>
496 <para>
497 The <filename>deploy-target</filename>
498 functionality is for development only.
499 You should never use it to update an image that will be
500 used in production.
501 </para>
502 </note>
503 </para>
504 </section>
505
506 <section id='devtool-removing-your-software-from-the-target-machine'>
507 <title>Removing Your Software from the Target Machine</title>
508
509 <para>
510 Use the <filename>devtool undeploy-target</filename> command to
511 remove deployed build output from the target machine.
512 For the <filename>devtool undeploy-target</filename> command to
513 work, you must have previously used the
514 <ulink url='&YOCTO_DOCS_DEV_URL;#devtool-deploying-your-software-on-the-target-machine'><filename>devtool deploy-target</filename></ulink>
515 command.
516 <literallayout class='monospaced'>
517 $ devtool undeploy-target <replaceable>recipe</replaceable>&nbsp;<replaceable>target</replaceable>
518 </literallayout>
519 The <replaceable>target</replaceable> is the address of the
520 target machine, which must be running an SSH server (i.e.
521 <filename>user@hostname</filename>).
522 </para>
523 </section>
524
525 <section id='devtool-creating-the-workspace'>
526 <title>Creating the Workspace Layer in an Alternative Location</title>
527
528 <para>
529 Use the <filename>devtool create-workspace</filename> command to
530 create a new workspace layer in your
531 <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>.
532 When you create a new workspace layer, it is populated with the
533 <filename>README</filename> file and the
534 <filename>conf</filename> directory only.
535 </para>
536
537 <para>
538 The following example creates a new workspace layer in your
539 current working and by default names the workspace layer
540 "workspace":
541 <literallayout class='monospaced'>
542 $ devtool create-workspace
543 </literallayout>
544 </para>
545
546 <para>
547 You can create a workspace layer anywhere by supplying
548 a pathname with the command.
549 The following command creates a new workspace layer named
550 "new-workspace":
551 <literallayout class='monospaced'>
552 $ devtool create-workspace /home/scottrif/new-workspace
553 </literallayout>
554 </para>
555 </section>
556
557 <section id='devtool-get-the-status-of-the-recipes-in-your-workspace'>
558 <title>Get the Status of the Recipes in Your Workspace</title>
559
560 <para>
561 Use the <filename>devtool status</filename> command to
562 list the recipes currently in your workspace.
563 Information includes the paths to their respective
564 external source trees.
565 </para>
566
567 <para>
568 The <filename>devtool status</filename> command has no
569 command-line options:
570 <literallayout class='monospaced'>
571 $ devtool status
572 </literallayout>
573 Following is sample output after using
574 <ulink url='&YOCTO_DOCS_DEV_URL;#devtool-adding-a-new-recipe-to-the-workspace'><filename>devtool add</filename></ulink>
575 to create and add the <filename>mtr_0.86.bb</filename> recipe
576 to the <filename>workspace</filename> directory:
577 <literallayout class='monospaced'>
578 $ devtool status
579 mtr: /home/scottrif/poky/build/workspace/sources/mtr (/home/scottrif/poky/build/workspace/recipes/mtr/mtr_0.86.bb)
580 $
581 </literallayout>
582 </para>
583 </section>
584
585 <section id='devtool-search-for-available-target-recipes'>
586 <title>Search for Available Target Recipes</title>
587
588 <para>
589 Use the <filename>devtool search</filename> command to
590 search for available target recipes.
591 The command matches the recipe name, package name,
592 description, and installed files.
593 The command displays the recipe name as a result of a
594 match.
595 </para>
596
597 <para>
598 When you use the <filename>devtool search</filename> command,
599 you must supply a <replaceable>keyword</replaceable>.
600 The command uses the <replaceable>keyword</replaceable> when
601 searching for a match.
602 </para>
603 </section>
604</chapter>
605<!--
606vim: expandtab tw=80 ts=4
607-->