xref: /OK3568_Linux_fs/yocto/poky/documentation/ref-manual/devtool-reference.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun***************************
4*4882a593Smuzhiyun``devtool`` Quick Reference
5*4882a593Smuzhiyun***************************
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThe ``devtool`` command-line tool provides a number of features that
8*4882a593Smuzhiyunhelp you build, test, and package software. This command is available
9*4882a593Smuzhiyunalongside the ``bitbake`` command. Additionally, the ``devtool`` command
10*4882a593Smuzhiyunis a key part of the extensible SDK.
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunThis chapter provides a Quick Reference for the ``devtool`` command. For
13*4882a593Smuzhiyunmore information on how to apply the command when using the extensible
14*4882a593SmuzhiyunSDK, see the ":doc:`/sdk-manual/extensible`" chapter in the Yocto
15*4882a593SmuzhiyunProject Application Development and the Extensible Software Development
16*4882a593SmuzhiyunKit (eSDK) manual.
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. _devtool-getting-help:
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunGetting Help
21*4882a593Smuzhiyun============
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunThe ``devtool`` command line is organized similarly to Git in that it
24*4882a593Smuzhiyunhas a number of sub-commands for each function. You can run
25*4882a593Smuzhiyun``devtool --help`` to see all the commands::
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun   $ devtool -h
28*4882a593Smuzhiyun   NOTE: Starting bitbake server...
29*4882a593Smuzhiyun   usage: devtool [--basepath BASEPATH] [--bbpath BBPATH] [-d] [-q] [--color COLOR] [-h] <subcommand> ...
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun   OpenEmbedded development tool
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun   options:
34*4882a593Smuzhiyun     --basepath BASEPATH   Base directory of SDK / build directory
35*4882a593Smuzhiyun     --bbpath BBPATH       Explicitly specify the BBPATH, rather than getting it from the metadata
36*4882a593Smuzhiyun     -d, --debug           Enable debug output
37*4882a593Smuzhiyun     -q, --quiet           Print only errors
38*4882a593Smuzhiyun     --color COLOR         Colorize output (where COLOR is auto, always, never)
39*4882a593Smuzhiyun     -h, --help            show this help message and exit
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun   subcommands:
42*4882a593Smuzhiyun     Beginning work on a recipe:
43*4882a593Smuzhiyun       add                   Add a new recipe
44*4882a593Smuzhiyun       modify                Modify the source for an existing recipe
45*4882a593Smuzhiyun       upgrade               Upgrade an existing recipe
46*4882a593Smuzhiyun     Getting information:
47*4882a593Smuzhiyun       status                Show workspace status
48*4882a593Smuzhiyun       latest-version        Report the latest version of an existing recipe
49*4882a593Smuzhiyun       check-upgrade-status  Report upgradability for multiple (or all) recipes
50*4882a593Smuzhiyun       search                Search available recipes
51*4882a593Smuzhiyun     Working on a recipe in the workspace:
52*4882a593Smuzhiyun       build                 Build a recipe
53*4882a593Smuzhiyun       rename                Rename a recipe file in the workspace
54*4882a593Smuzhiyun       edit-recipe           Edit a recipe file
55*4882a593Smuzhiyun       find-recipe           Find a recipe file
56*4882a593Smuzhiyun       configure-help        Get help on configure script options
57*4882a593Smuzhiyun       update-recipe         Apply changes from external source tree to recipe
58*4882a593Smuzhiyun       reset                 Remove a recipe from your workspace
59*4882a593Smuzhiyun       finish                Finish working on a recipe in your workspace
60*4882a593Smuzhiyun     Testing changes on target:
61*4882a593Smuzhiyun       deploy-target         Deploy recipe output files to live target machine
62*4882a593Smuzhiyun       undeploy-target       Undeploy recipe output files in live target machine
63*4882a593Smuzhiyun       build-image           Build image including workspace recipe packages
64*4882a593Smuzhiyun     Advanced:
65*4882a593Smuzhiyun       create-workspace      Set up workspace in an alternative location
66*4882a593Smuzhiyun       extract               Extract the source for an existing recipe
67*4882a593Smuzhiyun       sync                  Synchronize the source tree for an existing recipe
68*4882a593Smuzhiyun       menuconfig            Alter build-time configuration for a recipe
69*4882a593Smuzhiyun       import                Import exported tar archive into workspace
70*4882a593Smuzhiyun       export                Export workspace into a tar archive
71*4882a593Smuzhiyun     other:
72*4882a593Smuzhiyun       selftest-reverse      Reverse value (for selftest)
73*4882a593Smuzhiyun       pluginfile            Print the filename of this plugin
74*4882a593Smuzhiyun       bbdir                 Print the BBPATH directory of this plugin
75*4882a593Smuzhiyun       count                 How many times have this plugin been registered.
76*4882a593Smuzhiyun       multiloaded           How many times have this plugin been initialized
77*4882a593Smuzhiyun   Use devtool <subcommand> --help to get help on a specific command
78*4882a593Smuzhiyun
79*4882a593SmuzhiyunAs directed in the general help output, you can
80*4882a593Smuzhiyunget more syntax on a specific command by providing the command name and
81*4882a593Smuzhiyunusing ``--help``::
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun   $ devtool add --help
84*4882a593Smuzhiyun   NOTE: Starting bitbake server...
85*4882a593Smuzhiyun   usage: devtool add [-h] [--same-dir | --no-same-dir] [--fetch URI] [--npm-dev] [--version VERSION] [--no-git] [--srcrev SRCREV | --autorev] [--srcbranch SRCBRANCH] [--binary] [--also-native] [--src-subdir SUBDIR] [--mirrors]
86*4882a593Smuzhiyun                      [--provides PROVIDES]
87*4882a593Smuzhiyun                      [recipename] [srctree] [fetchuri]
88*4882a593Smuzhiyun
89*4882a593Smuzhiyun   Adds a new recipe to the workspace to build a specified source tree. Can optionally fetch a remote URI and unpack it to create the source tree.
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun   arguments:
92*4882a593Smuzhiyun     recipename            Name for new recipe to add (just name - no version, path or extension). If not specified, will attempt to auto-detect it.
93*4882a593Smuzhiyun     srctree               Path to external source tree. If not specified, a subdirectory of /media/build1/poky/build/workspace/sources will be used.
94*4882a593Smuzhiyun     fetchuri              Fetch the specified URI and extract it to create the source tree
95*4882a593Smuzhiyun
96*4882a593Smuzhiyun   options:
97*4882a593Smuzhiyun     -h, --help            show this help message and exit
98*4882a593Smuzhiyun     --same-dir, -s        Build in same directory as source
99*4882a593Smuzhiyun     --no-same-dir         Force build in a separate build directory
100*4882a593Smuzhiyun     --fetch URI, -f URI   Fetch the specified URI and extract it to create the source tree (deprecated - pass as positional argument instead)
101*4882a593Smuzhiyun     --npm-dev             For npm, also fetch devDependencies
102*4882a593Smuzhiyun     --version VERSION, -V VERSION
103*4882a593Smuzhiyun                           Version to use within recipe (PV)
104*4882a593Smuzhiyun     --no-git, -g          If fetching source, do not set up source tree as a git repository
105*4882a593Smuzhiyun     --srcrev SRCREV, -S SRCREV
106*4882a593Smuzhiyun                           Source revision to fetch if fetching from an SCM such as git (default latest)
107*4882a593Smuzhiyun     --autorev, -a         When fetching from a git repository, set SRCREV in the recipe to a floating revision instead of fixed
108*4882a593Smuzhiyun     --srcbranch SRCBRANCH, -B SRCBRANCH
109*4882a593Smuzhiyun                           Branch in source repository if fetching from an SCM such as git (default master)
110*4882a593Smuzhiyun     --binary, -b          Treat the source tree as something that should be installed verbatim (no compilation, same directory structure). Useful with binary packages e.g. RPMs.
111*4882a593Smuzhiyun     --also-native         Also add native variant (i.e. support building recipe for the build host as well as the target machine)
112*4882a593Smuzhiyun     --src-subdir SUBDIR   Specify subdirectory within source tree to use
113*4882a593Smuzhiyun     --mirrors             Enable PREMIRRORS and MIRRORS for source tree fetching (disable by default).
114*4882a593Smuzhiyun     --provides PROVIDES, -p PROVIDES
115*4882a593Smuzhiyun                           Specify an alias for the item provided by the recipe. E.g. virtual/libgl
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun.. _devtool-the-workspace-layer-structure:
118*4882a593Smuzhiyun
119*4882a593SmuzhiyunThe Workspace Layer Structure
120*4882a593Smuzhiyun=============================
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun``devtool`` uses a "Workspace" layer in which to accomplish builds. This
123*4882a593Smuzhiyunlayer is not specific to any single ``devtool`` command but is rather a
124*4882a593Smuzhiyuncommon working area used across the tool.
125*4882a593Smuzhiyun
126*4882a593SmuzhiyunThe following figure shows the workspace structure:
127*4882a593Smuzhiyun
128*4882a593Smuzhiyun.. image:: figures/build-workspace-directory.png
129*4882a593Smuzhiyun   :align: center
130*4882a593Smuzhiyun   :scale: 70%
131*4882a593Smuzhiyun
132*4882a593Smuzhiyun.. code-block:: none
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun   attic - A directory created if devtool believes it must preserve
135*4882a593Smuzhiyun           anything when you run "devtool reset".  For example, if you
136*4882a593Smuzhiyun           run "devtool add", make changes to the recipe, and then
137*4882a593Smuzhiyun           run "devtool reset", devtool takes notice that the file has
138*4882a593Smuzhiyun           been changed and moves it into the attic should you still
139*4882a593Smuzhiyun           want the recipe.
140*4882a593Smuzhiyun
141*4882a593Smuzhiyun   README - Provides information on what is in workspace layer and how to
142*4882a593Smuzhiyun            manage it.
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun   .devtool_md5 - A checksum file used by devtool.
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun   appends - A directory that contains *.bbappend files, which point to
147*4882a593Smuzhiyun             external source.
148*4882a593Smuzhiyun
149*4882a593Smuzhiyun   conf - A configuration directory that contains the layer.conf file.
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun   recipes - A directory containing recipes.  This directory contains a
152*4882a593Smuzhiyun             folder for each directory added whose name matches that of the
153*4882a593Smuzhiyun             added recipe.  devtool places the recipe.bb file
154*4882a593Smuzhiyun             within that sub-directory.
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun   sources - A directory containing a working copy of the source files used
157*4882a593Smuzhiyun             when building the recipe.  This is the default directory used
158*4882a593Smuzhiyun             as the location of the source tree when you do not provide a
159*4882a593Smuzhiyun             source tree path.  This directory contains a folder for each
160*4882a593Smuzhiyun             set of source files matched to a corresponding recipe.
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun.. _devtool-adding-a-new-recipe-to-the-workspace:
163*4882a593Smuzhiyun
164*4882a593SmuzhiyunAdding a New Recipe to the Workspace Layer
165*4882a593Smuzhiyun==========================================
166*4882a593Smuzhiyun
167*4882a593SmuzhiyunUse the ``devtool add`` command to add a new recipe to the workspace
168*4882a593Smuzhiyunlayer. The recipe you add should not exist - ``devtool`` creates it for
169*4882a593Smuzhiyunyou. The source files the recipe uses should exist in an external area.
170*4882a593Smuzhiyun
171*4882a593SmuzhiyunThe following example creates and adds a new recipe named ``jackson`` to
172*4882a593Smuzhiyuna workspace layer the tool creates. The source code built by the recipes
173*4882a593Smuzhiyunresides in ``/home/user/sources/jackson``::
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun   $ devtool add jackson /home/user/sources/jackson
176*4882a593Smuzhiyun
177*4882a593SmuzhiyunIf you add a recipe and the workspace layer does not exist, the command
178*4882a593Smuzhiyuncreates the layer and populates it as described in
179*4882a593Smuzhiyun":ref:`devtool-the-workspace-layer-structure`" section.
180*4882a593Smuzhiyun
181*4882a593SmuzhiyunRunning ``devtool add`` when the workspace layer exists causes the tool
182*4882a593Smuzhiyunto add the recipe, append files, and source files into the existing
183*4882a593Smuzhiyunworkspace layer. The ``.bbappend`` file is created to point to the
184*4882a593Smuzhiyunexternal source tree.
185*4882a593Smuzhiyun
186*4882a593Smuzhiyun.. note::
187*4882a593Smuzhiyun
188*4882a593Smuzhiyun   If your recipe has runtime dependencies defined, you must be sure
189*4882a593Smuzhiyun   that these packages exist on the target hardware before attempting to
190*4882a593Smuzhiyun   run your application. If dependent packages (e.g. libraries) do not
191*4882a593Smuzhiyun   exist on the target, your application, when run, will fail to find
192*4882a593Smuzhiyun   those functions. For more information, see the
193*4882a593Smuzhiyun   ":ref:`ref-manual/devtool-reference:deploying your software on the target machine`"
194*4882a593Smuzhiyun   section.
195*4882a593Smuzhiyun
196*4882a593SmuzhiyunBy default, ``devtool add`` uses the latest revision (i.e. master) when
197*4882a593Smuzhiyununpacking files from a remote URI. In some cases, you might want to
198*4882a593Smuzhiyunspecify a source revision by branch, tag, or commit hash. You can
199*4882a593Smuzhiyunspecify these options when using the ``devtool add`` command:
200*4882a593Smuzhiyun
201*4882a593Smuzhiyun-  To specify a source branch, use the ``--srcbranch`` option::
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun      $ devtool add --srcbranch &DISTRO_NAME_NO_CAP; jackson /home/user/sources/jackson
204*4882a593Smuzhiyun
205*4882a593Smuzhiyun   In the previous example, you are checking out the &DISTRO_NAME_NO_CAP;
206*4882a593Smuzhiyun   branch.
207*4882a593Smuzhiyun
208*4882a593Smuzhiyun-  To specify a specific tag or commit hash, use the ``--srcrev``
209*4882a593Smuzhiyun   option::
210*4882a593Smuzhiyun
211*4882a593Smuzhiyun      $ devtool add --srcrev &DISTRO_REL_TAG; jackson /home/user/sources/jackson
212*4882a593Smuzhiyun      $ devtool add --srcrev some_commit_hash /home/user/sources/jackson
213*4882a593Smuzhiyun
214*4882a593Smuzhiyun   The previous examples check out the
215*4882a593Smuzhiyun   &DISTRO_REL_TAG; tag and the commit associated with the
216*4882a593Smuzhiyun   some_commit_hash hash.
217*4882a593Smuzhiyun
218*4882a593Smuzhiyun.. note::
219*4882a593Smuzhiyun
220*4882a593Smuzhiyun   If you prefer to use the latest revision every time the recipe is
221*4882a593Smuzhiyun   built, use the options ``--autorev`` or ``-a``.
222*4882a593Smuzhiyun
223*4882a593Smuzhiyun.. _devtool-extracting-the-source-for-an-existing-recipe:
224*4882a593Smuzhiyun
225*4882a593SmuzhiyunExtracting the Source for an Existing Recipe
226*4882a593Smuzhiyun============================================
227*4882a593Smuzhiyun
228*4882a593SmuzhiyunUse the ``devtool extract`` command to extract the source for an
229*4882a593Smuzhiyunexisting recipe. When you use this command, you must supply the root
230*4882a593Smuzhiyunname of the recipe (i.e. no version, paths, or extensions), and you must
231*4882a593Smuzhiyunsupply the directory to which you want the source extracted.
232*4882a593Smuzhiyun
233*4882a593SmuzhiyunAdditional command options let you control the name of a development
234*4882a593Smuzhiyunbranch into which you can checkout the source and whether or not to keep
235*4882a593Smuzhiyuna temporary directory, which is useful for debugging.
236*4882a593Smuzhiyun
237*4882a593Smuzhiyun.. _devtool-synchronizing-a-recipes-extracted-source-tree:
238*4882a593Smuzhiyun
239*4882a593SmuzhiyunSynchronizing a Recipe's Extracted Source Tree
240*4882a593Smuzhiyun==============================================
241*4882a593Smuzhiyun
242*4882a593SmuzhiyunUse the ``devtool sync`` command to synchronize a previously extracted
243*4882a593Smuzhiyunsource tree for an existing recipe. When you use this command, you must
244*4882a593Smuzhiyunsupply the root name of the recipe (i.e. no version, paths, or
245*4882a593Smuzhiyunextensions), and you must supply the directory to which you want the
246*4882a593Smuzhiyunsource extracted.
247*4882a593Smuzhiyun
248*4882a593SmuzhiyunAdditional command options let you control the name of a development
249*4882a593Smuzhiyunbranch into which you can checkout the source and whether or not to keep
250*4882a593Smuzhiyuna temporary directory, which is useful for debugging.
251*4882a593Smuzhiyun
252*4882a593Smuzhiyun.. _devtool-modifying-a-recipe:
253*4882a593Smuzhiyun
254*4882a593SmuzhiyunModifying an Existing Recipe
255*4882a593Smuzhiyun============================
256*4882a593Smuzhiyun
257*4882a593SmuzhiyunUse the ``devtool modify`` command to begin modifying the source of an
258*4882a593Smuzhiyunexisting recipe. This command is very similar to the
259*4882a593Smuzhiyun:ref:`add <devtool-adding-a-new-recipe-to-the-workspace>` command
260*4882a593Smuzhiyunexcept that it does not physically create the recipe in the workspace
261*4882a593Smuzhiyunlayer because the recipe already exists in an another layer.
262*4882a593Smuzhiyun
263*4882a593SmuzhiyunThe ``devtool modify`` command extracts the source for a recipe, sets it
264*4882a593Smuzhiyunup as a Git repository if the source had not already been fetched from
265*4882a593SmuzhiyunGit, checks out a branch for development, and applies any patches from
266*4882a593Smuzhiyunthe recipe as commits on top. You can use the following command to
267*4882a593Smuzhiyuncheckout the source files::
268*4882a593Smuzhiyun
269*4882a593Smuzhiyun   $ devtool modify recipe
270*4882a593Smuzhiyun
271*4882a593SmuzhiyunUsing the above command form, ``devtool`` uses the existing recipe's
272*4882a593Smuzhiyun:term:`SRC_URI` statement to locate the upstream source,
273*4882a593Smuzhiyunextracts the source into the default sources location in the workspace.
274*4882a593SmuzhiyunThe default development branch used is "devtool".
275*4882a593Smuzhiyun
276*4882a593Smuzhiyun.. _devtool-edit-an-existing-recipe:
277*4882a593Smuzhiyun
278*4882a593SmuzhiyunEdit an Existing Recipe
279*4882a593Smuzhiyun=======================
280*4882a593Smuzhiyun
281*4882a593SmuzhiyunUse the ``devtool edit-recipe`` command to run the default editor, which
282*4882a593Smuzhiyunis identified using the ``EDITOR`` variable, on the specified recipe.
283*4882a593Smuzhiyun
284*4882a593SmuzhiyunWhen you use the ``devtool edit-recipe`` command, you must supply the
285*4882a593Smuzhiyunroot name of the recipe (i.e. no version, paths, or extensions). Also,
286*4882a593Smuzhiyunthe recipe file itself must reside in the workspace as a result of the
287*4882a593Smuzhiyun``devtool add`` or ``devtool upgrade`` commands.
288*4882a593Smuzhiyun
289*4882a593Smuzhiyun.. _devtool-updating-a-recipe:
290*4882a593Smuzhiyun
291*4882a593SmuzhiyunUpdating a Recipe
292*4882a593Smuzhiyun=================
293*4882a593Smuzhiyun
294*4882a593SmuzhiyunUse the ``devtool update-recipe`` command to update your recipe with
295*4882a593Smuzhiyunpatches that reflect changes you make to the source files. For example,
296*4882a593Smuzhiyunif you know you are going to work on some code, you could first use the
297*4882a593Smuzhiyun:ref:`devtool modify <devtool-modifying-a-recipe>` command to extract
298*4882a593Smuzhiyunthe code and set up the workspace. After which, you could modify,
299*4882a593Smuzhiyuncompile, and test the code.
300*4882a593Smuzhiyun
301*4882a593SmuzhiyunWhen you are satisfied with the results and you have committed your
302*4882a593Smuzhiyunchanges to the Git repository, you can then run the
303*4882a593Smuzhiyun``devtool update-recipe`` to create the patches and update the recipe::
304*4882a593Smuzhiyun
305*4882a593Smuzhiyun   $ devtool update-recipe recipe
306*4882a593Smuzhiyun
307*4882a593SmuzhiyunIf you run the ``devtool update-recipe``
308*4882a593Smuzhiyunwithout committing your changes, the command ignores the changes.
309*4882a593Smuzhiyun
310*4882a593SmuzhiyunOften, you might want to apply customizations made to your software in
311*4882a593Smuzhiyunyour own layer rather than apply them to the original recipe. If so, you
312*4882a593Smuzhiyuncan use the ``-a`` or ``--append`` option with the
313*4882a593Smuzhiyun``devtool update-recipe`` command. These options allow you to specify
314*4882a593Smuzhiyunthe layer into which to write an append file::
315*4882a593Smuzhiyun
316*4882a593Smuzhiyun   $ devtool update-recipe recipe -a base-layer-directory
317*4882a593Smuzhiyun
318*4882a593SmuzhiyunThe ``*.bbappend`` file is created at the
319*4882a593Smuzhiyunappropriate path within the specified layer directory, which may or may
320*4882a593Smuzhiyunnot be in your ``bblayers.conf`` file. If an append file already exists,
321*4882a593Smuzhiyunthe command updates it appropriately.
322*4882a593Smuzhiyun
323*4882a593Smuzhiyun.. _devtool-checking-on-the-upgrade-status-of-a-recipe:
324*4882a593Smuzhiyun
325*4882a593SmuzhiyunChecking on the Upgrade Status of a Recipe
326*4882a593Smuzhiyun==========================================
327*4882a593Smuzhiyun
328*4882a593SmuzhiyunUpstream recipes change over time. Consequently, you might find that you
329*4882a593Smuzhiyunneed to determine if you can upgrade a recipe to a newer version.
330*4882a593Smuzhiyun
331*4882a593SmuzhiyunTo check on the upgrade status of a recipe, you can use the
332*4882a593Smuzhiyun``devtool latest-version recipe`` command, which quickly shows the current
333*4882a593Smuzhiyunversion and the latest version available upstream. To get a more global
334*4882a593Smuzhiyunpicture, use the ``devtool check-upgrade-status`` command, which takes a
335*4882a593Smuzhiyunlist of recipes as input, or no arguments, in which case it checks all
336*4882a593Smuzhiyunavailable recipes. This command will only print the recipes for which
337*4882a593Smuzhiyuna new upstream version is available. Each such recipe will have its current
338*4882a593Smuzhiyunversion and latest upstream version, as well as the email of the maintainer
339*4882a593Smuzhiyunand any additional information such as the commit hash or reason for not
340*4882a593Smuzhiyunbeing able to upgrade it, displayed in a table.
341*4882a593Smuzhiyun
342*4882a593SmuzhiyunThis upgrade checking mechanism relies on the optional :term:`UPSTREAM_CHECK_URI`,
343*4882a593Smuzhiyun:term:`UPSTREAM_CHECK_REGEX`, :term:`UPSTREAM_CHECK_GITTAGREGEX`,
344*4882a593Smuzhiyun:term:`UPSTREAM_CHECK_COMMITS` and :term:`UPSTREAM_VERSION_UNKNOWN`
345*4882a593Smuzhiyunvariables in package recipes.
346*4882a593Smuzhiyun
347*4882a593Smuzhiyun.. note::
348*4882a593Smuzhiyun
349*4882a593Smuzhiyun   -  Most of the time, the above variables are unnecessary. They are only
350*4882a593Smuzhiyun      required when upstream does something unusual, and default
351*4882a593Smuzhiyun      mechanisms cannot find the new upstream versions.
352*4882a593Smuzhiyun
353*4882a593Smuzhiyun   -  For the ``oe-core`` layer, recipe maintainers come from the
354*4882a593Smuzhiyun      :yocto_git:`maintainers.inc </poky/tree/meta/conf/distro/include/maintainers.inc>`
355*4882a593Smuzhiyun      file.
356*4882a593Smuzhiyun
357*4882a593Smuzhiyun   -  If the recipe is using the :ref:`bitbake:bitbake-user-manual/bitbake-user-manual-fetching:git fetcher (\`\`git://\`\`)`
358*4882a593Smuzhiyun      rather than a tarball, the commit hash points to the commit that matches
359*4882a593Smuzhiyun      the recipe's latest version tag, or in the absence of suitable tags,
360*4882a593Smuzhiyun      to the latest commit (when :term:`UPSTREAM_CHECK_COMMITS` set to ``1``
361*4882a593Smuzhiyun      in the recipe).
362*4882a593Smuzhiyun
363*4882a593SmuzhiyunAs with all ``devtool`` commands, you can get help on the individual
364*4882a593Smuzhiyuncommand::
365*4882a593Smuzhiyun
366*4882a593Smuzhiyun   $ devtool check-upgrade-status -h
367*4882a593Smuzhiyun   NOTE: Starting bitbake server...
368*4882a593Smuzhiyun   usage: devtool check-upgrade-status [-h] [--all] [recipe [recipe ...]]
369*4882a593Smuzhiyun
370*4882a593Smuzhiyun   Prints a table of recipes together with versions currently provided by recipes, and latest upstream versions, when there is a later version available
371*4882a593Smuzhiyun
372*4882a593Smuzhiyun   arguments:
373*4882a593Smuzhiyun     recipe      Name of the recipe to report (omit to report upgrade info for all recipes)
374*4882a593Smuzhiyun
375*4882a593Smuzhiyun   options:
376*4882a593Smuzhiyun     -h, --help  show this help message and exit
377*4882a593Smuzhiyun     --all, -a   Show all recipes, not just recipes needing upgrade
378*4882a593Smuzhiyun
379*4882a593SmuzhiyunUnless you provide a specific recipe name on the command line, the
380*4882a593Smuzhiyuncommand checks all recipes in all configured layers.
381*4882a593Smuzhiyun
382*4882a593SmuzhiyunFollowing is a partial example table that reports on all the recipes.
383*4882a593SmuzhiyunNotice the reported reason for not upgrading the ``base-passwd`` recipe.
384*4882a593SmuzhiyunIn this example, while a new version is available upstream, you do not
385*4882a593Smuzhiyunwant to use it because the dependency on ``cdebconf`` is not easily
386*4882a593Smuzhiyunsatisfied. Maintainers can explicit the reason that is shown by adding
387*4882a593Smuzhiyunthe :term:`RECIPE_NO_UPDATE_REASON` variable to the corresponding recipe.
388*4882a593SmuzhiyunSee :yocto_git:`base-passwd.bb </poky/tree/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb>`
389*4882a593Smuzhiyunfor an example.
390*4882a593Smuzhiyun
391*4882a593Smuzhiyun::
392*4882a593Smuzhiyun
393*4882a593Smuzhiyun   $ devtool check-upgrade-status
394*4882a593Smuzhiyun   ...
395*4882a593Smuzhiyun   INFO: bind                      9.16.20         9.16.21         Armin Kuster <akuster808@gmail.com>
396*4882a593Smuzhiyun   INFO: inetutils                 2.1             2.2             Tom Rini <trini@konsulko.com>
397*4882a593Smuzhiyun   INFO: iproute2                  5.13.0          5.14.0          Changhyeok Bae <changhyeok.bae@gmail.com>
398*4882a593Smuzhiyun   INFO: openssl                   1.1.1l          3.0.0           Alexander Kanavin <alex.kanavin@gmail.com>
399*4882a593Smuzhiyun   INFO: base-passwd               3.5.29          3.5.51          Anuj Mittal <anuj.mittal@intel.com>  cannot be updated due to: Version 3.5.38 requires cdebconf for update-passwd utility
400*4882a593Smuzhiyun   ...
401*4882a593Smuzhiyun
402*4882a593SmuzhiyunLast but not least, you may set :term:`UPSTREAM_VERSION_UNKNOWN` to ``1``
403*4882a593Smuzhiyunin a recipe when there's currently no way to determine its latest upstream
404*4882a593Smuzhiyunversion.
405*4882a593Smuzhiyun
406*4882a593Smuzhiyun.. _devtool-upgrading-a-recipe:
407*4882a593Smuzhiyun
408*4882a593SmuzhiyunUpgrading a Recipe
409*4882a593Smuzhiyun==================
410*4882a593Smuzhiyun
411*4882a593SmuzhiyunAs software matures, upstream recipes are upgraded to newer versions. As
412*4882a593Smuzhiyuna developer, you need to keep your local recipes up-to-date with the
413*4882a593Smuzhiyunupstream version releases. There are several ways of upgrading recipes.
414*4882a593SmuzhiyunYou can read about them in the ":ref:`dev-manual/common-tasks:upgrading recipes`"
415*4882a593Smuzhiyunsection of the Yocto Project Development Tasks Manual. This section
416*4882a593Smuzhiyunoverviews the ``devtool upgrade`` command.
417*4882a593Smuzhiyun
418*4882a593SmuzhiyunBefore you upgrade a recipe, you can check on its upgrade status. See
419*4882a593Smuzhiyunthe ":ref:`devtool-checking-on-the-upgrade-status-of-a-recipe`" section
420*4882a593Smuzhiyunfor more information.
421*4882a593Smuzhiyun
422*4882a593SmuzhiyunThe ``devtool upgrade`` command upgrades an existing recipe to a more
423*4882a593Smuzhiyunrecent version of the recipe upstream. The command puts the upgraded
424*4882a593Smuzhiyunrecipe file along with any associated files into a "workspace" and, if
425*4882a593Smuzhiyunnecessary, extracts the source tree to a specified location. During the
426*4882a593Smuzhiyunupgrade, patches associated with the recipe are rebased or added as
427*4882a593Smuzhiyunneeded.
428*4882a593Smuzhiyun
429*4882a593SmuzhiyunWhen you use the ``devtool upgrade`` command, you must supply the root
430*4882a593Smuzhiyunname of the recipe (i.e. no version, paths, or extensions), and you must
431*4882a593Smuzhiyunsupply the directory to which you want the source extracted. Additional
432*4882a593Smuzhiyuncommand options let you control things such as the version number to
433*4882a593Smuzhiyunwhich you want to upgrade (i.e. the :term:`PV`), the source
434*4882a593Smuzhiyunrevision to which you want to upgrade (i.e. the
435*4882a593Smuzhiyun:term:`SRCREV`), whether or not to apply patches, and so
436*4882a593Smuzhiyunforth.
437*4882a593Smuzhiyun
438*4882a593SmuzhiyunYou can read more on the ``devtool upgrade`` workflow in the
439*4882a593Smuzhiyun":ref:`sdk-manual/extensible:use \`\`devtool upgrade\`\` to create a version of the recipe that supports a newer version of the software`"
440*4882a593Smuzhiyunsection in the Yocto Project Application Development and the Extensible
441*4882a593SmuzhiyunSoftware Development Kit (eSDK) manual. You can also see an example of
442*4882a593Smuzhiyunhow to use ``devtool upgrade`` in the ":ref:`dev-manual/common-tasks:using \`\`devtool upgrade\`\``"
443*4882a593Smuzhiyunsection in the Yocto Project Development Tasks Manual.
444*4882a593Smuzhiyun
445*4882a593Smuzhiyun.. _devtool-resetting-a-recipe:
446*4882a593Smuzhiyun
447*4882a593SmuzhiyunResetting a Recipe
448*4882a593Smuzhiyun==================
449*4882a593Smuzhiyun
450*4882a593SmuzhiyunUse the ``devtool reset`` command to remove a recipe and its
451*4882a593Smuzhiyunconfiguration (e.g. the corresponding ``.bbappend`` file) from the
452*4882a593Smuzhiyunworkspace layer. Realize that this command deletes the recipe and the
453*4882a593Smuzhiyunappend file. The command does not physically move them for you.
454*4882a593SmuzhiyunConsequently, you must be sure to physically relocate your updated
455*4882a593Smuzhiyunrecipe and the append file outside of the workspace layer before running
456*4882a593Smuzhiyunthe ``devtool reset`` command.
457*4882a593Smuzhiyun
458*4882a593SmuzhiyunIf the ``devtool reset`` command detects that the recipe or the append
459*4882a593Smuzhiyunfiles have been modified, the command preserves the modified files in a
460*4882a593Smuzhiyunseparate "attic" subdirectory under the workspace layer.
461*4882a593Smuzhiyun
462*4882a593SmuzhiyunHere is an example that resets the workspace directory that contains the
463*4882a593Smuzhiyun``mtr`` recipe::
464*4882a593Smuzhiyun
465*4882a593Smuzhiyun   $ devtool reset mtr
466*4882a593Smuzhiyun   NOTE: Cleaning sysroot for recipe mtr...
467*4882a593Smuzhiyun   NOTE: Leaving source tree /home/scottrif/poky/build/workspace/sources/mtr as-is; if you no longer need it then please delete it manually
468*4882a593Smuzhiyun   $
469*4882a593Smuzhiyun
470*4882a593Smuzhiyun.. _devtool-building-your-recipe:
471*4882a593Smuzhiyun
472*4882a593SmuzhiyunBuilding Your Recipe
473*4882a593Smuzhiyun====================
474*4882a593Smuzhiyun
475*4882a593SmuzhiyunUse the ``devtool build`` command to build your recipe. The
476*4882a593Smuzhiyun``devtool build`` command is equivalent to the
477*4882a593Smuzhiyun``bitbake -c populate_sysroot`` command.
478*4882a593Smuzhiyun
479*4882a593SmuzhiyunWhen you use the ``devtool build`` command, you must supply the root
480*4882a593Smuzhiyunname of the recipe (i.e. do not provide versions, paths, or extensions).
481*4882a593SmuzhiyunYou can use either the ``-s`` or the ``--disable-parallel-make`` options to
482*4882a593Smuzhiyundisable parallel makes during the build. Here is an example::
483*4882a593Smuzhiyun
484*4882a593Smuzhiyun   $ devtool build recipe
485*4882a593Smuzhiyun
486*4882a593Smuzhiyun.. _devtool-building-your-image:
487*4882a593Smuzhiyun
488*4882a593SmuzhiyunBuilding Your Image
489*4882a593Smuzhiyun===================
490*4882a593Smuzhiyun
491*4882a593SmuzhiyunUse the ``devtool build-image`` command to build an image, extending it
492*4882a593Smuzhiyunto include packages from recipes in the workspace. Using this command is
493*4882a593Smuzhiyunuseful when you want an image that ready for immediate deployment onto a
494*4882a593Smuzhiyundevice for testing. For proper integration into a final image, you need
495*4882a593Smuzhiyunto edit your custom image recipe appropriately.
496*4882a593Smuzhiyun
497*4882a593SmuzhiyunWhen you use the ``devtool build-image`` command, you must supply the
498*4882a593Smuzhiyunname of the image. This command has no command line options::
499*4882a593Smuzhiyun
500*4882a593Smuzhiyun   $ devtool build-image image
501*4882a593Smuzhiyun
502*4882a593Smuzhiyun.. _devtool-deploying-your-software-on-the-target-machine:
503*4882a593Smuzhiyun
504*4882a593SmuzhiyunDeploying Your Software on the Target Machine
505*4882a593Smuzhiyun=============================================
506*4882a593Smuzhiyun
507*4882a593SmuzhiyunUse the ``devtool deploy-target`` command to deploy the recipe's build
508*4882a593Smuzhiyunoutput to the live target machine::
509*4882a593Smuzhiyun
510*4882a593Smuzhiyun   $ devtool deploy-target recipe target
511*4882a593Smuzhiyun
512*4882a593SmuzhiyunThe target is the address of the target machine, which must be running
513*4882a593Smuzhiyunan SSH server (i.e. ``user@hostname[:destdir]``).
514*4882a593Smuzhiyun
515*4882a593SmuzhiyunThis command deploys all files installed during the
516*4882a593Smuzhiyun:ref:`ref-tasks-install` task. Furthermore, you do not
517*4882a593Smuzhiyunneed to have package management enabled within the target machine. If
518*4882a593Smuzhiyunyou do, the package manager is bypassed.
519*4882a593Smuzhiyun
520*4882a593Smuzhiyun.. note::
521*4882a593Smuzhiyun
522*4882a593Smuzhiyun   The ``deploy-target`` functionality is for development only. You
523*4882a593Smuzhiyun   should never use it to update an image that will be used in
524*4882a593Smuzhiyun   production.
525*4882a593Smuzhiyun
526*4882a593SmuzhiyunSome conditions could prevent a deployed application from
527*4882a593Smuzhiyunbehaving as expected. When both of the following conditions are met, your
528*4882a593Smuzhiyunapplication has the potential to not behave correctly when run on the
529*4882a593Smuzhiyuntarget:
530*4882a593Smuzhiyun
531*4882a593Smuzhiyun-  You are deploying a new application to the target and the recipe you
532*4882a593Smuzhiyun   used to build the application had correctly defined runtime
533*4882a593Smuzhiyun   dependencies.
534*4882a593Smuzhiyun
535*4882a593Smuzhiyun-  The target does not physically have the packages on which the
536*4882a593Smuzhiyun   application depends installed.
537*4882a593Smuzhiyun
538*4882a593SmuzhiyunIf both of these conditions are met, your application will not behave as
539*4882a593Smuzhiyunexpected. The reason for this misbehavior is because the
540*4882a593Smuzhiyun``devtool deploy-target`` command does not deploy the packages (e.g.
541*4882a593Smuzhiyunlibraries) on which your new application depends. The assumption is that
542*4882a593Smuzhiyunthe packages are already on the target. Consequently, when a runtime
543*4882a593Smuzhiyuncall is made in the application for a dependent function (e.g. a library
544*4882a593Smuzhiyuncall), the function cannot be found.
545*4882a593Smuzhiyun
546*4882a593SmuzhiyunTo be sure you have all the dependencies local to the target, you need
547*4882a593Smuzhiyunto be sure that the packages are pre-deployed (installed) on the target
548*4882a593Smuzhiyunbefore attempting to run your application.
549*4882a593Smuzhiyun
550*4882a593Smuzhiyun.. _devtool-removing-your-software-from-the-target-machine:
551*4882a593Smuzhiyun
552*4882a593SmuzhiyunRemoving Your Software from the Target Machine
553*4882a593Smuzhiyun==============================================
554*4882a593Smuzhiyun
555*4882a593SmuzhiyunUse the ``devtool undeploy-target`` command to remove deployed build
556*4882a593Smuzhiyunoutput from the target machine. For the ``devtool undeploy-target``
557*4882a593Smuzhiyuncommand to work, you must have previously used the
558*4882a593Smuzhiyun":ref:`devtool deploy-target <ref-manual/devtool-reference:deploying your software on the target machine>`"
559*4882a593Smuzhiyuncommand.
560*4882a593Smuzhiyun::
561*4882a593Smuzhiyun
562*4882a593Smuzhiyun   $ devtool undeploy-target recipe target
563*4882a593Smuzhiyun
564*4882a593SmuzhiyunThe target is the
565*4882a593Smuzhiyunaddress of the target machine, which must be running an SSH server (i.e.
566*4882a593Smuzhiyun``user@hostname``).
567*4882a593Smuzhiyun
568*4882a593Smuzhiyun.. _devtool-creating-the-workspace:
569*4882a593Smuzhiyun
570*4882a593SmuzhiyunCreating the Workspace Layer in an Alternative Location
571*4882a593Smuzhiyun=======================================================
572*4882a593Smuzhiyun
573*4882a593SmuzhiyunUse the ``devtool create-workspace`` command to create a new workspace
574*4882a593Smuzhiyunlayer in your :term:`Build Directory`. When you create a
575*4882a593Smuzhiyunnew workspace layer, it is populated with the ``README`` file and the
576*4882a593Smuzhiyun``conf`` directory only.
577*4882a593Smuzhiyun
578*4882a593SmuzhiyunThe following example creates a new workspace layer in your current
579*4882a593Smuzhiyunworking and by default names the workspace layer "workspace"::
580*4882a593Smuzhiyun
581*4882a593Smuzhiyun   $ devtool create-workspace
582*4882a593Smuzhiyun
583*4882a593SmuzhiyunYou can create a workspace layer anywhere by supplying a pathname with
584*4882a593Smuzhiyunthe command. The following command creates a new workspace layer named
585*4882a593Smuzhiyun"new-workspace"::
586*4882a593Smuzhiyun
587*4882a593Smuzhiyun   $ devtool create-workspace /home/scottrif/new-workspace
588*4882a593Smuzhiyun
589*4882a593Smuzhiyun.. _devtool-get-the-status-of-the-recipes-in-your-workspace:
590*4882a593Smuzhiyun
591*4882a593SmuzhiyunGet the Status of the Recipes in Your Workspace
592*4882a593Smuzhiyun===============================================
593*4882a593Smuzhiyun
594*4882a593SmuzhiyunUse the ``devtool status`` command to list the recipes currently in your
595*4882a593Smuzhiyunworkspace. Information includes the paths to their respective external
596*4882a593Smuzhiyunsource trees.
597*4882a593Smuzhiyun
598*4882a593SmuzhiyunThe ``devtool status`` command has no command-line options::
599*4882a593Smuzhiyun
600*4882a593Smuzhiyun   $ devtool status
601*4882a593Smuzhiyun
602*4882a593SmuzhiyunFollowing is sample output after using
603*4882a593Smuzhiyun:ref:`devtool add <ref-manual/devtool-reference:adding a new recipe to the workspace layer>`
604*4882a593Smuzhiyunto create and add the ``mtr_0.86.bb`` recipe to the ``workspace`` directory::
605*4882a593Smuzhiyun
606*4882a593Smuzhiyun   $ devtool status
607*4882a593Smuzhiyun   mtr:/home/scottrif/poky/build/workspace/sources/mtr (/home/scottrif/poky/build/workspace/recipes/mtr/mtr_0.86.bb)
608*4882a593Smuzhiyun   $
609*4882a593Smuzhiyun
610*4882a593Smuzhiyun.. _devtool-search-for-available-target-recipes:
611*4882a593Smuzhiyun
612*4882a593SmuzhiyunSearch for Available Target Recipes
613*4882a593Smuzhiyun===================================
614*4882a593Smuzhiyun
615*4882a593SmuzhiyunUse the ``devtool search`` command to search for available target
616*4882a593Smuzhiyunrecipes. The command matches the recipe name, package name, description,
617*4882a593Smuzhiyunand installed files. The command displays the recipe name as a result of
618*4882a593Smuzhiyuna match.
619*4882a593Smuzhiyun
620*4882a593SmuzhiyunWhen you use the ``devtool search`` command, you must supply a keyword.
621*4882a593SmuzhiyunThe command uses the keyword when searching for a match.
622