Devtool
The devtool command-line utility provides several features that help you build, test, and package software in Yocto environments.
This command is available alongside bitbake and is an essential tool for recipe development and maintenance.
This page provides a Quick Reference for the devtool command.
Getting Started
Before using devtool, you must set up the BitBake environment as described in your BSP setup instructions.
Once the environment is ready, run the following command to list all available subcommands:
The Workspace Layer Structure
devtool uses a workspace layer to manage source code and recipes under development.
This workspace is a shared working area used by multiple devtool commands.
Below is the typical structure of the workspace layer:
../build-directory
└── workspace
├── attic
├── conf
├── appends
│ └── recipe.bbappend
├── README
├── recipes
│ └── recipe-name
│ └── recipe-name.bb
└── sources
└── recipe-name
├── folders
├── files
.
.
Directory Overview
| Folder | Description |
|---|---|
| attic | Created when running devtool reset, used to temporarily preserve files. |
| conf | Contains configuration files, including layer.conf. |
| appends | Holds .bbappend files pointing to external sources. |
| README | Describes the contents of the workspace and basic management info. |
| recipes | Contains recipe directories; each folder corresponds to a recipe. |
| sources | Contains working copies of the source trees used in builds. |
Adding a New Recipe
Use the devtool add command to create and add a new recipe to the workspace layer.
The recipe should not already exist — devtool will generate it for you.
The general syntax is:
Example:
If the workspace layer does not exist, devtool creates and populates it automatically.
If it already exists, the new recipe, append files, and source tree are added within the existing workspace.
Note
If your recipe has runtime dependencies, make sure the required packages are installed on the target hardware. Missing libraries or dependencies will cause your application to fail when executed.
Modifying an Existing Recipe
The devtool modify command lets you customize the source code of an existing recipe.
This command:
- Extracts the source of a recipe
- Sets it up as a Git repository (if not already one)
- Checks out a development branch (
devtool) - Applies any existing patches as commits
Syntax:
Example — modifying the Linux kernel or U-Boot source:
After running the command, devtool uses the recipe’s SRC_URI to fetch and extract sources into the workspace.
You can then edit, build, and test your changes directly from the extracted source tree.
Updating a Recipe
Use the devtool update-recipe command to update an existing recipe with patches that represent your code modifications.
Typical workflow:
- Extract sources using
devtool modify - Make your changes and test the build
- Commit your changes in Git
- Run
devtool update-recipeto generate patches and update the recipe
Syntax:
Tip
If you run devtool update-recipe without committing your changes, they will be ignored.
If you prefer to keep your changes in a custom layer rather than modifying the original recipe, use the -a or --append option:
This creates a .bbappend file in the specified layer path.
If an append file already exists, it will be updated accordingly.
Tip
To learn how to create your own meta-layer, refer to the Creating a New Meta-Layer guide.