Recommendations and Tips about Yocto¶
The yocto project has a Recipe Style Guide.
This page gives other general recommendations about how to write Yocto files, based on conventions followed in Yocto public layers.
BBPATH¶
BBPATH is used by Yocto to locate classes (.bbclass) and configuration
files (.conf), and some others.
When a file is searched in BBPATH the order of directories in BBPATH
determines which file finally gets selected.
In your conf/bblayers.conf, populate BBLAYERS with the most important layers
first.
Eg:
In this example the file meta-welma/files/fs-perms.txt takes precedence
over poky/meta/files/fs-perms.txt.
Fetching with a passphrase-protected private SSH key¶
When your SSH private key (used for fetching git repositories) is protected by a passphrase, bitbake will not be able to interact with you to get this passphrase for fetching, and will fail.
You can work this around as follows:
Devtool¶
Devtool may help in some situations, but has limitations.
devtool modify and overrides¶
This paragraph deals with the situation where bitbake builds your recipe
correctly but devtool modify raises the following error:
devtool modify RECIPE
...
ERROR: Importing patch '0001.patch'
FileNotFoundError(2, 'No such file or directory')
A possible workaround is to use:
The error can happen if you have these 2 mechanisms used in a recipe at the same time:
- Patches added by overrides on
SRC_URI - And patches added by overrides on
FILESPATH(viaMACHINEOVERRIDES, etc.)
Example:
-
In your recipe:
-
In your files (in the directory of the recipe, searched through
FILESPATH): -
In your
MACHINEOVERRIDES:qemuarm-welma
devtool modify and do_patch:append¶
If you have custom patching in do_patch:append() and other patches added
by overrides on SRC_URI, then you may encounter an error like:
devtool modify RECIPE
...
ERROR: ExecutionError('git checkout devtool', 1, '', 'error: The following
untracked working tree files would be overwritten by checkout:\n\t...\nPle
ase move or remove them before you switch branches.\nAborting\n')
There again, a possible workaround is: