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

14,186

Solution 1

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.

Solution 2

If you prefer a graphical presentation, the Toaster web UI will also show you this, plus dependency information.

Solution 3

The candidate files deployed for each recipe are placed in each $WORKDIR/image

So you can cd to

$ cd ${TMPDIR}/work/${MULTIMACH_TARGET_SYS}

and perform a

$ find . -path '*/image/*/fileYouAreLookingFor'

from the result you should be able to infer the ${PN} of the recipe which deploys such file.

For example:

$ find . -path '*/image/*/mc'
./bash-completion/2.4-r0/image/usr/share/bash-completion/completions/mc
./mc/4.8.18-r0/image/usr/share/mc
./mc/4.8.18-r0/image/usr/bin/mc
./mc/4.8.18-r0/image/usr/libexec/mc
./mc/4.8.18-r0/image/etc/mc
Share:
14,186

Related videos on Youtube

shibley
Author by

shibley

Updated on December 22, 2020

Comments

  • shibley
    shibley over 3 years

    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.

  • Ross Burton
    Ross Burton over 5 years
    That assumes that both the recipe was just built and not pulled from sstate, and that rm_work isn't enabled. The best way is to use oe-pkgdata-util.