Approved version. Approved on: 07:40, 4 February 2020
Difference between revisions of "BitBake cheat sheet"
[quality revision] | [quality revision] |
imported>Frq08988
m
|
|
Template:ArticleMainWriter Template:ArticleApprovedVersion
Contents
1 Command-line options[edit]
Here are a few commonly-used command line options for BitBake.
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 |
-b | execute tasks from a specific .bb recipe directly. This does not handle any dependencies from other recipes. bitbake -b ../meta-st/meta-st-cannes2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-stm_local.bb -f -c compile |
-v | show verbose output |
-DDD | show lots of debug information |
-s | show recipe version information |
-e | output recipe environment variables bitbake -e <recipe> |
--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 bitbake -g <recipe> dot -v -Tpng -o package-depends.png package-depends.dot dot -v -Tpng -o pn-depends.png pn-depends.dot dot -v -Tsvg -o task-depends.svg task-depends.dot |
Here are a few examples of command line options for BitBake.
How to | Command | Comment |
---|---|---|
How to get the version of packages | bitbake -s | |
How to get the Image package list | bitbake <image> -g | Then: cat pn-buildlist |
How to clean a module | bitbake <module> -f -c cleanall | |
How to clean an image | bitbake <image> - c cleanall | |
How to load the packages to a local hard drive | bitbake <image> -f -c fetchall | |
How to get the list of tasks | bitbake <image> -f -c listtasks | |
How to display all appends | bitbake-layers show-appends | |
How to display all layers | bitbake <recipe-or-image-name> -g -u depexp | |
How to configure the kernel | bitbake <kernel_module> -c menuconfig | kernel module : linux-stm32 |
How to make an SDK relocatable image | bitbake <image> -c populate_sdk | self-extracting image available in tmp-glibc/deploy/sdk |
2 .bb file syntax[edit]
This table lists some of the syntaxes found in recipe (.bb) files.
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 when parsing this line |
VAR += "foo" |
append with space | |
VAR =+ "foo" |
prepend with space | |
VAR .= "foo" |
append without space | |
VAR =. "foo" |
prepend without space | |
VAR_append = "foo" |
append without space | |
OVERRIDES="string1:string2" VAR = "foo" VAR_string1 = "bar" |
alternate/override value | if string1 is listed in OVERRIDES, use "bar" for value of VAR, otherwise use "foo" |
OVERRIDES="string1:string2" VAR = "foo" VAR_append_string1 = " bar" |
conditional append | if string1 is in OVERRIDES, then append " bar" to the value of VAR |
BBVERSIONS="1.0 1.8 string" VAR="foo" VAR_string="bar" |
range-specific conditional | If the version of the package is in the specified range (1.0-1.8 in this example), then 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 |
do_sometask() { <shell code> } |
define a task using shell code | |
python do_sometask { <python code> |
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 a specific ordering. Zero or more 'before' or 'after' clauses can be used. |
VAR [some_flag]="foo" |
associate a subsidiary flag value to a variable | a few subsidiary flag value names are well-defined: "dirs", "cleandirs", "noexec", "nostamp", "fakeroot", "umask", "deptask", "rdeptask", "recdeptask", "recrdeptask" %%% Flag values appear to be used exclusively with task definitions (i.e. do_sometask) |
3 Additional BitBake-related command[edit]
Syntax | Meaning | Notes |
---|---|---|
bitbake-layers | Shows information about layers and recipes | Included in the bitbake/bin directory in openembedded source tree. |
bitbake-whatchanged <image> | Shows all changes made since the last generation of image |
bitbake st-image-weston # Edit the recipes bitbake-whatchanged st-image-weston |
bitbake -g -u depexp <recipe-or-image-name> | Shows dependency information in a graphical interface | |
bitbake -u goggle st-image-weston | simple graphical interface | This is a simple graphical wrapper over the streaming text output of BitBake. It shows collapsible trees for the logs for sub-tasks for each recipe. |
4 Useful links[edit]
- http://docs.openembedded.org/bitbake/html/
- http://www.openembedded.org/wiki/Main_Page
- http://www.yoctoproject.org/docs/1.6/dev-manual/dev-manual.html
- http://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html
<noinclude> {{ArticleMainWriter | ChristopheP}} {{ArticleApprovedVersion | ChristopheP | BernardP (PASS, 12June'18) | No previous approved version | NStephen Gregory - 02Feb'19 - 10440 | 05Feb'19}} [[Category:System build]]</noinclude> == Command-line options == Here are a few commonly-used command line options for BitBake. {| |+ Command-line options ! Option ! Meaning |- |<tt>-c</tt> <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 |- |<tt>-f</tt> |force execution of the operation, even if not required |- |<tt>-b</tt> |execute tasks from a specific .bb recipe directly. This does not handle any dependencies from other recipes. bitbake -b ../meta-st/meta-st-cannes2/recipes-multimedia/gstreamer/gstreamer1.0-plugins-stm_local.bb -f -c compile |- |<tt>-v</tt> |show verbose output |- |<tt>-DDD</tt> |show lots of debug information |- |<tt>-s</tt> |show recipe version information |- |<tt>-e</tt> |output recipe environment variables bitbake -e <recipe> |- |<tt>--help</tt> |get usage help |- |<tt>-c</tt> listtasks <image-or-recipe-name> |show the tasks associated with an image or individual recipe |- |<tt>-g</tt> <recipe> |output dependency tree in graphviz format bitbake -g <recipe> dot -v -Tpng -o package-depends.png package-depends.dot dot -v -Tpng -o pn-depends.png pn-depends.dot dot -v -Tsvg -o task-depends.svg task-depends.dot |} Here are a few examples of command line options for BitBake. {| |+ Main command lines commands ! How to ! Command ! Comment |- |<tt>How to get the version of packages</tt> |bitbake -s |- |<tt>How to get the Image package list</tt> |bitbake <image> -g |Then: cat pn-buildlist |- |<tt> How to clean a module</tt> |bitbake <module> -f -c cleanall |- |<tt>How to clean an image</tt> |bitbake <image> - c cleanall |- |<tt>How to load the packages to a local hard drive</tt> |bitbake <image> -f -c fetchall |- |<tt>How to get the list of tasks</tt> |bitbake <image> -f -c listtasks |- |<tt>How to display all appends</tt> |bitbake-layers show-appends |- |<tt>How to display all layers</tt> |bitbake <recipe-or-image-name> -g -u depexp |- |<tt>How to configure the kernel</tt> |bitbake <kernel_module> -c menuconfig |kernel module : linux-stm32 |- |<tt>How to make an SDK relocatable image</tt> |bitbake <image> -c populate_sdk |self-extracting image available in tmp-glibc/deploy/sdk |} == .bb file syntax == This table lists some of the syntaxes found in recipe (.bb) files. {| |+ .bb file 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 when parsing this line |- | VAR += "foo" |append with space | |- | VAR =+ "foo" |prepend with space | |- | VAR .= "foo" |append without space | |- | VAR =. "foo" |prepend without space | |- | VAR_append = "foo" |append without space | |- | OVERRIDES="string1:string2" VAR = "foo" VAR_string1 = "bar" |alternate/override value |if string1 is listed in OVERRIDES, use "bar" for value of VAR, otherwise use "foo" |- | OVERRIDES="string1:string2" VAR = "foo" VAR_append_string1 = " bar" |conditional append |if string1 is in OVERRIDES, then append " bar" to the value of VAR |- | BBVERSIONS="1.0 1.8 string" VAR="foo" VAR_string="bar" |range-specific conditional |If the version of the package is in the specified range (1.0-1.8 in this example), then 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 |- |<pre> do_sometask() {<shell code> }</pre> |define a task using shell code | |- |<pre> python do_sometask {<python code> </pre> |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 a specific ordering. Zero or more 'before' or 'after' clauses can be used. |- | VAR [some_flag]="foo" |associate a subsidiary flag value to a variable |a few subsidiary flag value names are well-defined: "dirs", "cleandirs", "noexec", "nostamp", "fakeroot", "umask", "deptask", "rdeptask", "recdeptask", "recrdeptask" %%% Flag values appear to be used exclusively with task definitions (i.e. do_sometask) |} == Additional BitBake-related command == {| |+ Additional BitBake-related command ! Syntax ! Meaning ! Notes |- | bitbake-layers |Shows information about layers and recipes |Included in the bitbake/bin directory in openembedded source tree. |- | bitbake-whatchanged <image> |Shows all changes made since the last generation of image |<pre> bitbake st-image-weston # Edit the recipes bitbake-whatchanged st-image-weston</pre> |- | bitbake -g -u depexp <recipe-or-image-name> |Shows dependency information in a graphical interface | |- | bitbake -u goggle st-image-weston |simple graphical interface |This is a simple graphical wrapper over the streaming text output of BitBake. It shows collapsible trees for the logs for sub-tasks for each recipe. |} == Useful links == * http://docs.openembedded.org/bitbake/html/ * http://www.openembedded.org/wiki/Main_Page * http://www.yoctoproject.org/docs/1.6/dev-manual/dev-manual.html * http://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html <noinclude> [[Category:System build]] {{PublicationRequestId | 10440 | 2019-02-02 | StephenG}}</noinclude>
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Command-line options == |
== Command-line options == |
||
Here are a few commonly-used command line options for BitBake. |
Here are a few commonly-used command line options for BitBake. |
||
Line 241: | Line 235: | ||
* http://www.yoctoproject.org/docs/1.6/dev-manual/dev-manual.html |
* http://www.yoctoproject.org/docs/1.6/dev-manual/dev-manual.html |
||
* http://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html |
* http://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html |
||
+ | |||
+ | <noinclude> |
||
+ | [[Category:System build]] |
||
+ | {{PublicationRequestId | 10440 | 2019-02-02 | StephenG}} |
||
+ | </noinclude> |