Question

I'm using bitbake / openembedded, but my recipe fails because some path-variable ends up being not set correctly I think. Specifically i'm adding files to SRC_URI, but the error indicates the attempt to copy the file is done using the wrong path. Therefore

1) How can I verify the "current" path-variable used when using file:// protocol

2) Given that I somehow confirm which variable is used to search for files, can I track assignments to said variable in my dependency-graph? I mean, bitbake must encounter appends/prepends to the variable in some order in some set of recipe-files, which i would like to inspect in order to find my error

Bonus question: I'm thinking that my current "debug-method" for detecting errors in my recipes is too primitive (e.g. adding -D -D -D to the command-line and subsequently wade through the piles of output to look for hints). How do "professionals" debug their bitbake recipes?

Update: I've found a much better way of debugging my recipes:

It turns out, that after the "fetch" task of a given recipe has successfully completed, the working folder for the recipe is created. Inside this folder is a "temp" sub-folder containing the code executed (e.g run.do_fetch.######) and the results (e.g. log._do_fetch.######) for each task in the recipe.

Inspecting the "run..###" file will tell you the exact value of any variable, and the exact commands/Python-functions executed for the task. The output of a given "run" is stored in the "log..###" file with same id/number as the "run" file. Somehow this very basic information did not register while I read the manual, but now I always look in the "temp" folder when a recipe fails.

Was it helpful?

Solution

I presume you've discovered bitbake -e, right? That dumps the environment specific to a single bitbake "target" (ie. a recipe.) I believe FILESPATH is the key variable that bitbake uses to find files specified in a file:// SRC_URI component. Using bitbake -e (recipe) | grep ^FILESPATH= will display that very large path variable!

I don't know of a way to track assignments to that variable, but there are several ways to modify it. (Actually I recall a bitbake patch which would annotate the output of bitbake -e with what file modified which variable but can't recall the details. Ask on the oe list.) In any case, if you remove the = sign from the grep above you can see the other ways FILESPATH can be modified. I think this is covered in the various docs, as well.

Finally, you may have better luck asking on the openembedded mailing list, rather than here on stackoverflow.

bitbake -e and the log files (found in ${WORKDIR}/temp) are your best debug tools. (Also check out ack-grep. Better than grep for some bitbake-related use cases.) Where is WORKDIR you ask?

bitbake -e (recipe) | grep ^WORKDIR=

Once you get familiar with WORKDIR, you'll see the pattern and won't have to find it that way.

Happy baking! ;)

OTHER TIPS

Turns out, that there is a patch for doing this in later versions of BitBake, its just not supported in the one I'm currently using :-(

I would suggest using Toaster, in interactive mode. In the configuration page, you can track variable assignment history.

The mockup is here: https://www.yoctoproject.org/toaster/build-configuration.html

To use it, run "source toaster start" after "source oe-init-build-env" and in the web interface you will find data logged from your builds.

Hope this helps, Alex

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top