The Yocto build environment includes a scripts/ directory containing utilities and tools that extend the BitBake command-line experience. These scripts help you explore the build system, manage layers, and perform routine operations efficiently.
The scripts Directory
The scripts/ directory in the Poky tree contains various tools that automate common tasks:
poky/scripts/
├── bitbake-layers (layer management tool)
├── create-recipe (recipe scaffolding tool)
├── oe-setup-builddir (build directory setup)
├── runqemu (QEMU launcher for Yocto images)
└── ...
All these tools are available in your PATH after sourcing oe-init-build-env.
Working with Images
List All Available Images
Find all image recipes across all meta layers in the current directory:
find . -name "*.bb" | grep image
List only the images that are visible to BitBake from the configured layers:
bitbake -s | grep image
The second command is more accurate — it only shows images that BitBake can actually build with the current layer configuration.
Working with Layers
Add a Layer
bitbake-layers add-layer <layer-path>
Example:
bitbake-layers add-layer /home/user/poky/meta-raspberrypi
This automatically updates build/conf/bblayers.conf.
List Configured Layers
bitbake-layers show-layers
Example output:
layer path priority
================================================================
meta /home/amr/poky/meta 5
meta-poky /home/amr/poky/meta-poky 5
meta-yocto-bsp /home/amr/poky/meta-yocto-bsp 5
meta-raspberrypi /home/amr/poky/meta-raspberrypi 9
Working with Machines
Show the Current Active Machine
bitbake -e | grep "^MACHINE="
This evaluates the full BitBake environment and extracts the MACHINE variable, showing exactly what target is configured.
List Machines from a Specific Layer
find meta-* -name "*.conf" | grep "machine"
Or more broadly:
find . -type f -name "*.conf" | grep "machine"
Each .conf file in a machine/ subdirectory represents a supported machine configuration. The filename (without .conf) is the value you set for MACHINE in local.conf.
Working with Recipes
List Tasks for a Recipe
bitbake -c listtasks core-image-minimal
Execute a Specific Task
Run a task for a recipe by specifying the task name without the do_ prefix:
bitbake -c fetch busybox
Fetch All Dependencies
Download all source archives for an image without building:
bitbake -c fetchall core-image-minimal
Useful for preparing an offline build environment.
Clean a Recipe
Remove all build artifacts and downloaded sources for a recipe:
bitbake -c cleanall busybox
Debug a Recipe Interactively
Open a shell with the full BitBake build environment set up, inside the recipe's source directory:
bitbake -c devshell <recipe-name>
This is the most powerful debugging tool for recipe development — you can run compile commands manually, inspect environment variables, and test fixes interactively.
Quick Reference Table
| Task | Command | |
|---|---|---|
| List all images | `find . -name "*.bb" \ | grep image` |
| List buildable images | `bitbake -s \ | grep image` |
| Add a layer | bitbake-layers add-layer <path> | |
| Show layers | bitbake-layers show-layers | |
| Current machine | `bitbake -e \ | grep "^MACHINE="` |
| Find machines in layers | `find meta- -name ".conf" \ | grep machine` |
| List recipe tasks | bitbake -c listtasks <recipe> | |
| Run a task | bitbake -c <task> <recipe> | |
| Fetch all sources | bitbake -c fetchall <image> | |
| Clean a recipe | bitbake -c cleanall <recipe> | |
| Debug a recipe | bitbake -c devshell <recipe> |
Running the Image with runqemu
The runqemu script launches Yocto-generated images in QEMU with a single command:
runqemu qemuarm
Run without graphics (serial console only):
runqemu qemuarm nographic
Additional options:
# Specify a build directory
runqemu qemuarm nographic slirp
# Run with KVM acceleration (x86 only)
runqemu qemux86-64 kvm
# Run with specific image
runqemu qemuarm core-image-minimal nographic
Final Thoughts
These utility commands are the daily tools of a Yocto developer. Knowing them by heart reduces the friction of exploring an unfamiliar build configuration, troubleshooting build failures, and iterating on recipe development.
Essential Yocto Development Commands:
Start session: source oe-init-build-env
Build image: bitbake core-image-minimal
Run in QEMU: runqemu qemuarm nographic
Check layers: bitbake-layers show-layers
Debug recipe: bitbake -c devshell <recipe>
List images: bitbake -s | grep image
Find machines: find meta-* -name "*.conf" | grep machine
Bookmark this reference — these commands will be used in every Yocto development session.