Functions
- As with most languages, functions are the building blocks
- that define operations.
+ As with most languages, functions are the building blocks that
+ are used to build up operations into tasks.
BitBake supports three types of functions:
Shell Functions:
- Functions written in a shell language and
- executed by the shell.
+ Functions written in shell script and executed either
+ directly as functions, tasks, or both.
+ They can also be called by other shell functions.
- BitBake Functions:
- Functions written in Python but executed by BitBake using
- bb.build.exec_func().
+ BitBake Style Python Functions:
+ Functions written in Python and executed by BitBake or other
+ Python functions using bb.build.exec_func().
Python Functions:
Functions written in Python and executed by Python.
@@ -696,15 +697,17 @@
Regardless of the type of function, you can only
define them in class (.bbclass)
- and recipe (.bb) files.
+ and recipe (.bb or .inc)
+ files.
Shell Functions
- These functions are written using a shell language and
- executed by the shell.
+ Functions written in shell script and executed either
+ directly as functions, tasks, or both.
+ They can also be called by other shell functions.
Here is an example shell function definition:
some_function () {
@@ -714,14 +717,19 @@
When you create these types of functions in your recipe
or class files, you need to follow the shell programming
rules.
+ The scripts are executed by /bin/sh,
+ which may not be a bash shell but might be something
+ such as dash.
+ You should not use Bash-specific script (bashisms).
-
- BitBake Functions
+
+ BitBake Style Python Functions
- These functions are written in Python and are executed using
+ These functions are written in Python and executed by
+ BitBake or other Python functions using
bb.build.exec_func().
@@ -745,8 +753,8 @@
Python Functions
- These functions are written in Python but are executed by
- Python.
+ These functions are written in Python and are executed by
+ other Python code.
Examples of Python functions are utility functions
that you intend to call from in-line Python or
from within other Python functions.
@@ -767,7 +775,7 @@
Here are some things to know about Python functions:
- Python functions take parameters.
+ Python functions can take parameters.
The BitBake datastore is not
automatically available.
@@ -790,8 +798,9 @@
Tasks are BitBake execution units that originate as
functions and make up the steps that BitBake needs to run
for given recipe.
- Tasks are only supported in recipe (.bb)
- and class (.bbclass) files.
+ Tasks are only supported in recipe (.bb
+ or .inc) and class
+ (.bbclass) files.
By convention, tasks begin with the string "do_".
@@ -919,40 +928,108 @@
Variable Flags
- This section describes variable flags.
+ Variable flags (varflags) help control a task's functionality
+ and dependencies.
+ BitBake reads and writes varflags to the datastore using the following
+ command forms:
+
+ <variable> = d.getVarFlags("<variable>")
+ self.d.setVarFlags("FOO", {"func": True})
+
-
-
-
- Task Flags
- Tasks support a number of flags which control various
- functionality of the task.
- These are as follows:
+ When working with varflags, the same syntax, with the exception of
+ overrides, applies.
+ In other words, you can set, append, and prepend varflags just like
+ variables.
+ See the
+ "Variable Flag Syntax"
+ section for details.
+
+
+
+ BitBake has a defined set of varflags available for recipes and
+ classes.
+ You can discover the complete set by using grep
+ within a shell and search on the string "VarFlags".
+
+
+
+ Tasks support a number of these flags which control various
+ functionality of the task:
dirs:
- Directories which should be created before the task runs.
+ Directories that should be created before the task runs.
cleandirs:
- Directories which should created before the task runs
- but should be empty.
+ Empty directories that should created before the task runs.
+ noexec:
Marks the tasks as being empty and no execution required.
- These are used as dependency placeholders or used when added tasks
- need to be subsequently disabled.
+ These flags are used as dependency placeholders or used when
+ added tasks need to be subsequently disabled.
+
nostamp:
- Do not generate a stamp file for a task.
- This means the task is always executed.
+ Tells BitBake to not generate a stamp file for a task,
+ which implies the task is always executed.
+
fakeroot:
- This task needs to be run in a fakeroot environment,
- obtained by adding the variables in FAKEROOTENV
- to the environment.
+ Causes a task to be run in a fakeroot environment,
+ obtained by adding the variables in
+ FAKEROOTENV
+ to the environment.
+
umask:
- The umask to run the task under.
+ The umask to run the task under.
+
+ deptask:
+ Controls task build-time dependencies.
+ See the
+ DEPENDS
+ variable and the
+ "Build Dependencies"
+ section for more information.
+
+ rdeptask:
+ Controls task runtime dependencies.
+ See the
+ RDEPENDS
+ variable, the
+ RRECOMMENDS
+ variable, and the
+ "Runtime Dependencies"
+ section for more information.
+
+ recrdeptask:
+ Controls task recursive runtime dependencies.
+ See the
+ RDEPENDS
+ variable, the
+ RRECOMMENDS
+ variable, and the
+ "Recursive Dependencies"
+ section for more information.
+
+ depends:
+ Controls inter-task dependencies.
+ See the
+ DEPENDS
+ variable and the
+ "Inter-Task Dependencies"
+ section for more information.
+
+ rdepends:
+ Controls inter-task runtime dependencies.
+ See the
+ RDEPENDS
+ variable, the
+ RRECOMMENDS
+ variable, and the
+ "Inter-Task Dependencies"
+ section for more information.
+
- For the 'deptask', 'rdeptask', 'depends', 'rdepends'and
- 'recrdeptask' flags, please see the dependencies section.