November 2017
Intermediate to advanced
162 pages
4h 8m
English
We may be required to use Python functions to generate a value for a variable or some other use. This can be easily done, in recipes (.bb) and classes (.bbclass), using the following code:
def get_depends(d): if d.getVar('SOMECONDITION'): return "dependencywithcond" else: return "dependency"SOMECONDITION = "1"DEPENDS = "${@get_depends(d)}"
Usually, we need to access the BitBake database when writing a Python function. A convention among all metadata is that the d variable is used to point to BitBake's database, and it is usually passed as the last parameter of a function.
So, in the preceding example, we ask the database the value of the SOMECONDITION variable and return a value depending ...
Read now
Unlock full access