Difference between revisions of "Bitbake Cheat Sheet"
From eLinux.org
(→Syntax) |
(→Syntax: add subsidiary flag values) |
||
| Line 78: | Line 78: | ||
|ex: VAR = "the date is: ${@time.strftime(’%Y%m%d’,time.gmtime())}" | |ex: VAR = "the date is: ${@time.strftime(’%Y%m%d’,time.gmtime())}" | ||
|- | |- | ||
| − | |include foo||include file||include file named "foo", search BBPATH | + | |include foo||include file||include file named "foo", search BBPATH |
|- | |- | ||
|require [<path>]foo||require file||include file named "foo", failing if not found exactly where specified | |require [<path>]foo||require file||include file named "foo", failing if not found exactly where specified | ||
| Line 84: | Line 84: | ||
|inherit foo||inherit classes||include definitions from foo.bbclass | |inherit foo||inherit classes||include definitions from foo.bbclass | ||
|- | |- | ||
| + | |do_sometask() {<BR> | ||
| + | <shell code><BR> | ||
| + | } | ||
| + | |define a task using shell code | ||
| + | |- | ||
| + | |python do_sometask {<BR> | ||
| + | <python code><BR> | ||
| + | } | ||
| + | |define a task using python code | ||
| + | | | ||
| + | |- | ||
| + | |addtask sometask [(before|after) other_task] | ||
| + | |add a task | ||
| + | |adds a defined task to the list of tasks, with the ordering specified. Multiple 'before' or 'after' clauses can be used. | ||
| + | |- | ||
| + | |VAR[some_flag]="foo" | ||
| + | |associate a subsidiary flag value to a variable | ||
| + | |a few subsidieary flag value names are well-defined: "dirs", "cleandirs", "noexec", "nostamp", "fakeroot", "umask", "deptask", "rdeptask", "recdeptask", "recrdeptask" | ||
|} | |} | ||
Revision as of 20:28, 30 October 2012
Here are some quick notes on bitbake syntax and rules. For an exhaustive list of functionality, and longer descriptions, see the bitbake manual at: http://docs.openembedded.org/bitbake/html/ (note that this link goes to the OpenEmbedded version of the bitbake manual, which is a version from 2006 as of this writing. A separate (yocto-specific?) bitbake manual is included in source form in the yocto project source directory, under bitbake/doc.)
Options
| Option | Meaning |
|---|---|
| -c <task> | execute <task> for the image or recipe being built. ex: bitbake -c fetch busybox.
Some of the possible tasks are: fetch, configure, compile, package, clean |
| -f | force execution of the operation, even if not required |
| -v | show verbose output |
| -DDD | show lots of debug information |
| -s | show recipe version information |
| --help | get usage help |
| -c listtasks <image-or-recipe-name> | show the tasks associated with an image or individual recipe |
| -g <recipe> | output dependency tree in graphviz format |
Syntax
| Syntax | Meaning | NOTES |
|---|---|---|
| VAR = "foo" | simple assignment | |
| VAR ?= "foo" | assign if no other value is already assigned (default assignment) | |
| VAR ??=foo | weak default assignment | takes lower precedence than ?= |
| VAR = "stuff ${OTHER_VAR} more" | variable expansion | OTHER_VAR expanded at time of reference to VAR |
| VAR := "stuff ${OTHER_VAR} more" | immediate variable expansion | OTHER_VAR expanded at time of parsing this line |
| VAR += "foo" | append with space | |
| VAR =+ "foo" | prepend with space | |
| VAR .= "foo" | append without space | |
| VAR =. "foo" | prepend without space | |
| OVERRIDES="string1:string2" VAR = "foo" |
alternate/override value | if string1 is listed in OVERRIDES, use "bar" for value of VAR, otherwise use "foo" |
| OVERRIDES="string1:string2" VAR = "foo" |
conditional appending | if string1 is in OVERRIDES, then append " bar" to the value of VAR |
| BBVERSIONS="1.0 1.8 string" VAR="foo" |
range-specific conditional | If the version of the package is in the specified range, the perform an override on the indicated variable |
| VAR = "foo ${@<line-of-python-code>}" | python code expansion | ex: VAR = "the date is: ${@time.strftime(’%Y%m%d’,time.gmtime())}" |
| include foo | include file | include file named "foo", search BBPATH |
| require [<path>]foo | require file | include file named "foo", failing if not found exactly where specified |
| inherit foo | inherit classes | include definitions from foo.bbclass |
do_sometask() {<shell code> } |
define a task using shell code | |
python do_sometask {<python code> } |
define a task using python code | |
| after) other_task] | add a task | adds a defined task to the list of tasks, with the ordering specified. Multiple 'before' or 'after' clauses can be used. |
| VAR[some_flag]="foo" | associate a subsidiary flag value to a variable | a few subsidieary flag value names are well-defined: "dirs", "cleandirs", "noexec", "nostamp", "fakeroot", "umask", "deptask", "rdeptask", "recdeptask", "recrdeptask" |