List dependencies of Yocto recipes with bb-depends-dot

Yocto/Poky ships the script oe-depends-dot which has stopped working some years ago when the output of bitbake -g changed. The same is true for oe-depends-dot from openembedded-core.

So I wrote a tool called bb-depends-dot to inspect recipes from BitBake’s task-depends.dot and the dependencies between these recipes.

Examples using bb-depends-dot

List all the direct dependencies of recipe curl:

$ bb-depends-dot task-depends.dot curl
nghttp2
brotli
openssl
libpsl
...

Or, list all the reverse dependencies:

$ bb-depends-dot task-depends.dot -r curl
my-image
libmicrohttpd
elfutils

Adding the argument -t prints all transitive dependencies.

This allows me to quickly figure out why certain packages are included in my image, or which packages can be removed to reduce the size of my image.

The Yocto Project

Building your own custom Linux distribution sounds like a mountainous task, but it’s a breeze with Yocto. According to yoctoproject.org:

The Yocto Project (YP) is an open source collaboration project that helps developers create custom Linux-based systems regardless of the hardware architecture.

BitBake Dependency Graph

Yocto comes with a build tool called BitBake. A Linux distribution is basically a heap of different packages lumped together. BitBake builds these packages according to recipes.

A recipe contains all the information required to obtain the source code, build the components and package them. Recipes may depend on other recipes. For example, curl depends on nghttp2 for its HTTP/2 support. The relationships between packages form a dependency graph. BitBake will save this graph in the DOT format when run with the argument -g, i.e. bitbake -g.

bb-depends-dot does not contain a complete DOT parser (see dot-machine.rl), only the output of bitbake -g is supported. A recipe’s tasks are ignored completely. No distinction is made between build and runtime dependencies, as of yet.

Last updated on