noone392
noone392

Reputation: 2148

Yocto determine what recipe a file came from

I am trying to determine how I can find what recipe a source file from the build/tmp/work directory came from. Basically normally most of the recipes in the source folder are uri. Then get downloaded and installed to various temp folders. I want to create a patch for some of the files, but I can't seem to figure out which files belong to what recipes.

Thank you

Upvotes: 3

Views: 6601

Answers (2)

David C.
David C.

Reputation: 1001

Each package's work directory is in a location named tmp/work/arch/pkg/ver, where arch is a machine architecture string, pkg is the base name of the package and ver is the version of the package. The contents of that directory will be a function of the recipe's contents, but source files fetched from a Git repository typically get unpacked to a git directory in there.

Since you already know which source file you want to patch, then you know what this directory is.

The corresponding recipe will be a file of the form pkg_ver.bb.

So if, for instance, you needed to patch something in tmp/work/armv8a-poky-linux/gcc/11.2.0-r0/git (the sources for GCC version 11.2.0-r0 for an ARMv8a-poky-linux architecture), you should search your sources directory for a file named gcc_11.2.0.bb, or something similar. A command like `find sources -name 'gcc*.bb' is a good way to look for it.

In my case (a build based on an NXP-provided manifest), the files in question are:

$ find sources -name 'gcc*.bb'

sources/poky/meta/recipes-devtools/gcc/gcc_11.2.bb
sources/poky/meta/recipes-devtools/gcc/gcc-source_11.2.bb
sources/poky/meta/recipes-devtools/gcc/gcc-cross_11.2.bb
sources/poky/meta/recipes-devtools/gcc/gcc-crosssdk_11.2.bb
sources/poky/meta/recipes-devtools/gcc/gcc-cross-canadian_11.2.bb
sources/poky/meta/recipes-devtools/gcc/gcc-sanitizers_11.2.bb
sources/poky/meta/recipes-devtools/gcc/gcc-runtime_11.2.bb

The recipe responsible for the gcc/11.2.0-r0 directory will be gcc_11.2.bb. You can then examine it to learn how it works.

If this is one of your recipes (unlikely, since you were trying to find it), you can modify it to apply your changes.

If it is an upstream recipe (more likely), then you should create a corresponding .bbappend file (e.g. gcc_11.2.bbappend containing the code to apply your patches.

Upvotes: 0

qschulz
qschulz

Reputation: 1763

Run oe-pkgdata-util find-path /path/on/target/to/file. This will give you the package installing the file. From there, run oe-pkgdata-util lookup-recipe <pkg-name>, this will give you which recipe is creating the package. That should be enough to find out which recipe you need to modify. You then need to check whether the file you want to modify is part of the recipe (Yocto artifact) or part of the software that the recipe builds. For the former, you can override the file, for the latter, you can create a patch (you can use devtool to help you create the patch).

Upvotes: 4

Related Questions