As you may have seen in the usage information, or in the information about .bb files, the BBFILES
variable is how the BitBake tool locates its files. This variable is a space separated list of files that are available, and supports wildcards.
With regard to dependencies, it expects the .bb to define a DEPENDS
variable, which contains a space separated list of “package names”, which themselves are the PN
variable. The PN
variable is, in general, set to a component of the .bb filename by default.
Example 4.5. Depending on another .bb
a.bb:
PN = "package-a" DEPENDS += "package-b"
b.bb:
PN = "package-b"
Example 4.6. Using PROVIDES
This example shows the usage of the PROVIDES
variable, which allows a given .bb to specify what functionality it provides.
package1.bb:
PROVIDES += "virtual/package"
package2.bb:
DEPENDS += "virtual/package"
package3.bb:
PROVIDES += "virtual/package"
As you can see, we have two different .bb's that provide the same functionality (virtual/package). Clearly, there needs to be a way for the person running BitBake to control which of those providers gets used. There is, indeed, such a way.
The following would go into a .conf file, to select package1:
PREFERRED_PROVIDER_virtual/package = "package1"
Example 4.7. Specifying version preference
When there are multiple “versions” of a given package, BitBake defaults to selecting the most recent version, unless otherwise specified. If the .bb in question has a DEFAULT_PREFERENCE
set lower than the other .bb's (default is 0), then it will not be selected. This allows the person or persons maintaining the repository of .bb files to specify their preference for the default selected version. In addition, the user can specify their preferred version.
If the first .bb is named a_1.1.bb
, then the PN
variable will be set to “a”, and the PV
variable will be set to 1.1.
If we then have an a_1.2.bb
, BitBake will choose 1.2 by default. However, if we define the following variable in a .conf that BitBake parses, we can change that.
PREFERRED_VERSION_a = "1.1"
Example 4.8. Using “bbfile collections”
bbfile collections exist to allow the user to have multiple repositories of bbfiles that contain the same exact package. For example, one could easily use them to make one's own local copy of an upstream repository, but with custom modifications that one does not want upstream. Usage:
BBFILES = "/stuff/openembedded/*/*.bb /stuff/openembedded.modified/*/*.bb" BBFILE_COLLECTIONS = "upstream local" BBFILE_PATTERN_upstream = "^/stuff/openembedded/" BBFILE_PATTERN_local = "^/stuff/openembedded.modified/" BBFILE_PRIORITY_upstream = "5" BBFILE_PRIORITY_local = "10"