The devtool command-line tool provides a number of features that help you build, test, and package the software. This command is available alongside the bitbake command.
Here you can find a Quick Reference for the devtool command.
In order to start using the devtool command you need to set up the bitbake environment as mentioned in How to build Yocto Image and Generate SDK
Once the environment is ready you can run the following command to see all available commands:
The Workspace Layer Structure
devtool uses a Workspace layer in which to accomplish builds. This layer is not specific to any single devtool command but is rather the common working area used across the tool. The following schematics will show the workspace structure:
../build-directory └── workspace ├── attic ├── conf ├── appends │ └── recipe.bbappend ├── README ├── recipes │ └── recipe-name │ └── recipe-name.bb └── sources └── recipe-name ├── folders ├── files . .
The following list is a brief description of the folders and files that will populate the workspace directory:
- attic: A directory created if devtool needs to preserve some anything when the command devtool reset has been used.
- conf: A configuration directory that contains the layer.conf file.
- appends: A directory that contains .bbappend files, which point to an external source.
- README: Provides information on what is in the workspace layer and how to manage it.
- recipes: A directory containing recipes. This directory contains a folder for each directory added whose name matches that of the added recipe. devtool places the recipe.bb file within that sub-directory.
- sources: A directory containing a working copy of the source files used when building the recipe. This is the default directory used as the location of the source tree when you do not provide a source tree path. This directory contains a folder for each set of source files matched to a corresponding recipe.
Adding a New Recipe to the Workspace Layer
Use the devtool add command to add a new recipe to the workspace layer. The recipe you add should not exist, devtool will create it for you. The source files the recipe is going to use should exist in an external area. The syntax for this command is:
devtool add <new recipe name> <source files path>
The following example creates and adds a new recipe named engicam to a workspace layer the tool creates. The source code that devtool will include in the resulting recipe resides in /home/user/sources/engicam:
devtool add engicam /home/user/sources/engicam
If you add a recipe and the workspace layer does not exist, the command creates and populates it as described in the previous section.
Using devtool add when the workspace layer exists causes the tool to add the recipe, append files, and source files into the existing workspace layer. The resulting .bbappend file is created to point to the external source tree.
Note: If your recipe has runtime dependencies defined, you must be sure that these packages exist on the target hardware before attempting to run your application. If dependent packages (e.g. libraries) do not exist on the target, your application will fail to find those functions when run.
Modifying an Existing Recipe
The devtool modify command gives you the possibility to modify the source of an existing recipe.
This command extracts the source for a recipe, sets it up as a Git repository (if the source had not already been fetched from Git), checks out a branch for development, and applies any patches from the recipe as commits on top. The syntax to check out the source files:
devtool modify <recipe name>
Two examples that can be very helpful if you need to customize the Linux Kernel or the U-Boot are:
devtool modify linux-engicam devtool modify u-boot-engicam
Using the above command form, devtool uses the existing recipe\'s SRC_URI statement to locate the upstream source extracts the source files into the default sources location in the workspace source directory. The default development branch used is devtool.
Updating a Recipe
Use the devtool update-recipe command to update your recipe with patches that reflect changes you make to the source files. For example, if you know you are going to work on some code, you could first use the devtool modify command to extract the code and set up the workspace. After which, you could modify, compile, and test the code.
When you are satisfied with the results and you have committed your changes to the Git repository, you can then run the devtool update-recipe to create the patches and update the recipe. In order to do that the syntax is:
devtool update-recipe <recipe name>
Note: If you run the devtool update-recipe without committing your changes, the command ignores the changes.
In order to not alter the default recipe, you might want to apply customizations made to your software in your own layer rather than apply them to the original recipe. If so, you can use the -a or --append option with the devtool update-recipe command. These options allow you to specify the layer into which to write an append file:
devtool update-recipe <recipe name> -a <base layer directory>
The .bbappend file is created at the appropriate path within the specified layer directory. If an append file already exists, the command updates it appropriately.