How to find which Yocto project recipe fills a specific file in the root image file system

I work with Yocto Project quite a bit, and a common problem is to determine why (or from which recipe) the file was included in rootfs. This is what you can hopefully get from the build system environment, logs, and metadata. Ideally, a set of commands will allow you to link the file to the source code (i.e. Recipe).

My usual strategy is to search metadata (for example, grep -R filename ../layers/* ) and search the Internet for the specified file names to find hints for possible recipes. However, this is not always very effective. In many cases, file names are not explicitly specified in the recipe. In addition, there are many cases where a file name is provided by several recipes, which leads to additional work to find which recipe ultimately provided it. Of course, there are many other tips available for finding the answer. Despite this, this investigation is often very time-consuming when it seems that the build system should have enough information to simplify the solution.

+9
linux embedded-linux openembedded bitbake yocto
source share
3 answers

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

Take a look at this example (runs in the 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 the glibc recipe.

oe-pkgdata-util there are more useful subcommands for viewing information about packages and recipes, it is worth checking --help .

+15
source share

If you prefer a graphical representation, the Toaster web interface will also show you this, as well as dependency information.

+3
source share

Candidate files deployed for each recipe are placed in each $ WORKDIR / image file

So you can use cd to

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

and execute

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

from the result, you should be able to infer $ {PN} of the recipe that deploys such a 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 
+1
source share

All Articles