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

时光总嘲笑我的痴心妄想 提交于 2019-12-03 12:21:31

问题


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.


回答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.




回答2:


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




回答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


来源:https://stackoverflow.com/questions/42258323/how-to-find-which-yocto-project-recipe-populates-a-particular-file-on-an-image-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!