How to find which Yocto Project recipe populates a particular file on an image root filesystem

shibley picture shibley · Feb 15, 2017 · Viewed 8.8k times · Source

I work with the Yocto Project quite a bit and a common challenge is determining why (or from what recipe) a file has been included on the rootfs. This is something that can hopefully be derived from the build system's environment, log & meta data. Ideally, a set of commands would allow linking a file back to a source (ie. recipe).

My usual strategy is to perform searches on the meta data (e.g. grep -R filename ../layers/*) and searches on the internet of said filenames to find clues of possible responsible recipes. However, this is not always very effective. In many cases, filenames are not explicitly stated within a recipe. Additionally, there are many cases where a filename is provided by multiple recipes which leads to additional work to find which recipe ultimately supplied it. There are of course many other clues available to find the answer. Regardless, this investigation is often quite laborious when it seems the build system should have enough information to make resolving the answer simple.

Answer

Tomas Novotny picture Tomas Novotny · Feb 17, 2017

This is exact use case for oe-pkgdata-util script and its subcommand find-path. That script is part of openembedded-core.

See this example (executed in OE build environment, i.e. bitbake works):

tom@pc:~/oe/build> oe-pkgdata-util find-path /lib/ld-2.24.so
glibc: /lib/ld-2.24.so

You can clearly see that this library belongs to glibc recipe.

oe-pkgdata-util has more useful subcommands to see information about packages and recipes, it worth to check the --help.