Difference between revisions of "Bitbake options"

From KoanSoftware Wiki
Jump to: navigation, search
(Advanced options)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
== bitbake options ==
+
= BitBake options =
  
= Basic options =
+
BitBake is a make-like build tool with the special focus of distributions and packages for embedded Linux cross compilation although it is not limited to that. It is derived from Portage, which is the package management system used by the Gentoo Linux distribution. BitBake existed for some time in the OpenEmbedded project until it was separated out into a standalone, maintained, distribution-independent tool. BitBake is co-maintained by the Yocto Project and the OpenEmbedded project.
  
Build performance tuning for OE/Yocto
+
== BitBake Recipes ==
 +
BitBake recipes specify how a particular package is built. It includes all the package dependencies, source code locations, configuration, compilation, build, install and remove instructions. It also stores the metadata for the package in standard variables.
 +
 
 +
The BitBake recipes consist of the source URL (http, https, ftp, cvs, svn, git, local file system) of the package, dependencies and compile or install options. During the build process they are used to track dependencies, performing native or cross-compilation of the package and package it so that it is suitable for installation on the local or a target device. It is also possible to create complete images consisting of a root file system and kernel. As a first step in a cross-build setup, the framework will attempt to create a cross-compiler toolchain suited for the target platform.
 +
 
 +
== Bitbake User Manual ==
 +
 
 +
[[http://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html Bitbake User Manual]]
 +
 
 +
== Basic options ==
 +
 
 +
* bitbake <pkgname>
 +
Build package (including creating package)
 +
 
 +
* bitbake -c cleansstate <pkgname>
 +
Cleans up all the tasks state with regard to the given <pkgname>
 +
This option is frequently used during the development of new recipes
 +
 
 +
* bitbake -e
 +
Displays the internal state of variables used by BitBake
 +
 
 +
* bitbake <pkgname> -c listtasks
 +
Tasks available for a package/recipe
 +
 
 +
* bitbake <pkgname> -c rebuild -f
 +
Clean and build again a package
 +
 
 +
* bitbake <pkgname> -c fetch -f
 +
Download again the source program
 +
 
 +
* bitbake <pkgname> -c devshell
 +
Expand a gnome xterm ready to raise commands
 +
 
 +
* bitbake <pkgname> -c clean/compile
 +
Clean or compile package.
 +
 
 +
* bitbake package-index
 +
Make package index files for feeds
 +
 
 +
* bitbake <target_image>
 +
Build image contains task-base packages
 +
 
 +
* bitbake <target_image> -c buildall -f
 +
Build pending packages for \code{target_image}
 +
 
 +
* bitbake <target_image> -c rootfs -f
 +
Populate rootfs again for \code{target_image}
 +
 
 +
* bitbake -e <pkgname> | grep ^S=
 +
Finds the source code.
 +
 
 +
* bitbake -e <target> | grep ^WORKDIR=
 +
Finds bitbakes's working directory.
 +
 
 +
* bitbake -e <image-target> | grep ^IMAGE_FSTYPES=
 +
Finds the image types being build
  
 
* bitbake -h
 
* bitbake -h
 +
Prints out the following help page
  
bitbake -h
+
bitbake -h
Usage: bitbake [options] [recipename/target ...]
+
 
+
Usage: bitbake [options] [recipename/target ...]
 +
 
     Executes the specified task (default is 'build') for a given set of target recipes (.bb files).
 
     Executes the specified task (default is 'build') for a given set of target recipes (.bb files).
 
     It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which
 
     It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which
 
     will provide the layer, BBFILES and other configuration information.
 
     will provide the layer, BBFILES and other configuration information.
 
+
Options:
+
Options:
 
   --version            show program's version number and exit
 
   --version            show program's version number and exit
 
   -h, --help            show this help message and exit
 
   -h, --help            show this help message and exit
Line 84: Line 141:
  
  
= Advanced options =
+
== Advanced options ==
 +
 
 +
* Find the Kernel generated .config file
  
* bitbake -c listtasks core-image-minimal
+
bitbake -e virtual/kernel | grep ^B=
 +
 
 +
* Show package dependencies
 +
 
 +
bitbake -g <pkg> && cat pn-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' | awk '{print $1}' | sort | uniq
 +
 
 +
* bitbake: How to list all recipe and append files used in an image?
 +
 
 +
bitbake -g core-image-minimal && cat pn-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' | awk '{print $1}' | sort | uniq
 +
...
 +
Loaded 1291 entries from dependency cache.
 +
NOTE: Resolving any missing task queue dependencies
 +
NOTE: Preparing runqueue
 +
NOTE: PN build list saved to 'pn-buildlist'
 +
NOTE: PN dependencies saved to 'pn-depends.dot'
 +
NOTE: Package dependencies saved to 'package-depends.dot'
 +
NOTE: Task dependencies saved to 'task-depends.dot'
 +
}
 +
"acl"
 +
"attr"
 +
"base-files"
 +
"base-passwd"
 +
"bash"
 +
"bc"
 +
"binutils-cross-arm"
 +
"busybox"
 +
"bzip2"
 +
"coreutils"
 +
"cryptodev-linux"
 +
"db"
 +
"dbus"
 +
"dbus-glib"
 +
"depmodwrapper-cross"
 +
"diffutils"
 +
"e2fsprogs"
 +
"expat"
 +
"flex"
 +
"gcc-cross-arm"
 +
"gcc-cross-initial-arm"
 +
"gcc-runtime"
 +
"gcc-source"
 +
"gdbm"
 +
"gettext"
 +
"glib-2.0"
 +
"glibc"
 +
"glibc-initial"
 +
"glibc-locale"
 +
"gmp"
 +
"gnome-desktop-testing"
 +
"init-ifupdown"
 +
"initscripts"
 +
"inputproto"
 +
"kbproto"
 +
"kmod"
 +
"libaio"
 +
"libcap"
 +
"libffi"
 +
"libgcc"
 +
"libgcc-initial"
 +
"libice"
 +
"libpthread-stubs"
 +
"libsm"
 +
"libtool-cross"
 +
"libusb1"
 +
"libusb-compat"
 +
"libx11"
 +
"libxau"
 +
"libxcb"
 +
"libxdmcp"
 +
"libxml2"
 +
"linux-libc-headers"
 +
"linux-yocto"
 +
"m4"
 +
"make"
 +
"modutils-initscripts"
 +
"ncurses"
 +
"netbase"
 +
"openssh"
 +
"openssl"
 +
"opkg-utils"
 +
"packagegroup-core-boot"
 +
"packagegroup-core-ssh-openssh"
 +
"pciutils"
 +
"perl"
 +
"psplash"
 +
"python"
 +
"python-dbus"
 +
"python-pygobject"
 +
"qemuwrapper-cross"
 +
"readline"
 +
"run-postinsts"
 +
"sed"
 +
"shadow"
 +
"shadow-securetty"
 +
"shadow-sysroot"
 +
"shared-mime-info"
 +
"sqlite3"
 +
"strace"
 +
"sysvinit"
 +
"sysvinit-inittab"
 +
"tcp-wrappers"
 +
"tzdata"
 +
"udev"
 +
"update-rc.d"
 +
"usbutils"
 +
"util-linux"
 +
"util-macros"
 +
"xcb-proto"
 +
"xextproto"
 +
"xproto"
 +
"xtrans"
 +
"zlib"
 +
 
 +
 
 +
* List tasks involved in image (or recipe) creation
  
 
  bitbake -c listtasks core-image-minimal
 
  bitbake -c listtasks core-image-minimal
Line 118: Line 291:
 
  do_rootfs                      Creates the root filesystem (file and directory structure) for an image
 
  do_rootfs                      Creates the root filesystem (file and directory structure) for an image
 
  do_unpack                      Unpacks the source code into a working directory
 
  do_unpack                      Unpacks the source code into a working directory
 +
 +
 +
* This is a simple graphical wrapper over the streaming text output of bitbake.
 +
It's nice in that it shows collapsible trees for the logs for sub-tasks for each recipe.
 +
 +
bitbake -u goggle core-image-minimal
  
  
 
----
 
----
  
= bitbake-layers =
+
== bitbake-layers ==
  
 
* bitbake-layers
 
* bitbake-layers
Line 160: Line 339:
  
  
----
 
  
 
* bitbake-layers show-overlayed
 
* bitbake-layers show-overlayed
Line 171: Line 349:
 
   meta-oe              2.0
 
   meta-oe              2.0
 
   meta                1.0
 
   meta                1.0
 
 
----
 

Latest revision as of 08:51, 12 June 2020

BitBake options

BitBake is a make-like build tool with the special focus of distributions and packages for embedded Linux cross compilation although it is not limited to that. It is derived from Portage, which is the package management system used by the Gentoo Linux distribution. BitBake existed for some time in the OpenEmbedded project until it was separated out into a standalone, maintained, distribution-independent tool. BitBake is co-maintained by the Yocto Project and the OpenEmbedded project.

BitBake Recipes

BitBake recipes specify how a particular package is built. It includes all the package dependencies, source code locations, configuration, compilation, build, install and remove instructions. It also stores the metadata for the package in standard variables.

The BitBake recipes consist of the source URL (http, https, ftp, cvs, svn, git, local file system) of the package, dependencies and compile or install options. During the build process they are used to track dependencies, performing native or cross-compilation of the package and package it so that it is suitable for installation on the local or a target device. It is also possible to create complete images consisting of a root file system and kernel. As a first step in a cross-build setup, the framework will attempt to create a cross-compiler toolchain suited for the target platform.

Bitbake User Manual

[Bitbake User Manual]

Basic options

  • bitbake <pkgname>

Build package (including creating package)

  • bitbake -c cleansstate <pkgname>

Cleans up all the tasks state with regard to the given <pkgname> This option is frequently used during the development of new recipes

  • bitbake -e

Displays the internal state of variables used by BitBake

  • bitbake <pkgname> -c listtasks

Tasks available for a package/recipe

  • bitbake <pkgname> -c rebuild -f

Clean and build again a package

  • bitbake <pkgname> -c fetch -f

Download again the source program

  • bitbake <pkgname> -c devshell

Expand a gnome xterm ready to raise commands

  • bitbake <pkgname> -c clean/compile

Clean or compile package.

  • bitbake package-index

Make package index files for feeds

  • bitbake <target_image>

Build image contains task-base packages

  • bitbake <target_image> -c buildall -f

Build pending packages for \code{target_image}

  • bitbake <target_image> -c rootfs -f

Populate rootfs again for \code{target_image}

  • bitbake -e <pkgname> | grep ^S=

Finds the source code.

  • bitbake -e <target> | grep ^WORKDIR=

Finds bitbakes's working directory.

  • bitbake -e <image-target> | grep ^IMAGE_FSTYPES=

Finds the image types being build

  • bitbake -h

Prints out the following help page

bitbake -h

Usage: bitbake [options] [recipename/target ...]

   Executes the specified task (default is 'build') for a given set of target recipes (.bb files).
   It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which
   will provide the layer, BBFILES and other configuration information.

Options:
 --version             show program's version number and exit
 -h, --help            show this help message and exit
 -b BUILDFILE, --buildfile=BUILDFILE
                       Execute tasks from a specific .bb recipe directly.
                       WARNING: Does not handle any dependencies from other
                       recipes.
 -k, --continue        Continue as much as possible after an error. While the
                       target that failed and anything depending on it cannot
                       be built, as much as possible will be built before
                       stopping.
 -a, --tryaltconfigs   Continue with builds by trying to use alternative
                       providers where possible.
 -f, --force           Force the specified targets/task to run (invalidating
                       any existing stamp file).
 -c CMD, --cmd=CMD     Specify the task to execute. The exact options
                       available depend on the metadata. Some examples might
                       be 'compile' or 'populate_sysroot' or 'listtasks' may
                       give a list of the tasks available.
 -C INVALIDATE_STAMP, --clear-stamp=INVALIDATE_STAMP
                       Invalidate the stamp for the specified task such as
                       'compile' and then run the default task for the
                       specified target(s).
 -r PREFILE, --read=PREFILE
                       Read the specified file before bitbake.conf.
 -R POSTFILE, --postread=POSTFILE
                       Read the specified file after bitbake.conf.
 -v, --verbose         Output more log message data to the terminal.
 -D, --debug           Increase the debug level. You can specify this more
                       than once.
 -n, --dry-run         Don't execute, just go through the motions.
 -S DUMP_SIGNATURES, --dump-signatures=DUMP_SIGNATURES
                       Dump out the signature construction information, with
                       no task execution. Parameters are passed to the
                       signature handling code, use 'none' if no specific
                       handler is required.
 -p, --parse-only      Quit after parsing the BB recipes.
 -s, --show-versions   Show current and preferred versions of all recipes.
 -e, --environment     Show the global or per-package environment complete
                       with information about where variables were
                       set/changed.
 -g, --graphviz        Save dependency tree information for the specified
                       targets in the dot syntax.
 -I EXTRA_ASSUME_PROVIDED, --ignore-deps=EXTRA_ASSUME_PROVIDED
                       Assume these dependencies don't exist and are already
                       provided (equivalent to ASSUME_PROVIDED). Useful to
                       make dependency graphs more appealing
 -l DEBUG_DOMAINS, --log-domains=DEBUG_DOMAINS
                       Show debug logging for the specified logging domains
 -P, --profile         Profile the command and save reports.
 -u UI, --ui=UI        The user interface to use (e.g. knotty, hob, depexp).
 -t SERVERTYPE, --servertype=SERVERTYPE
                       Choose which server to use, process or xmlrpc.
 --revisions-changed   Set the exit code depending on whether upstream
                       floating revisions have changed or not.
 --server-only         Run bitbake without a UI, only starting a server
                       (cooker) process.
 -B BIND, --bind=BIND  The name/address for the bitbake server to bind to.
 --no-setscene         Do not run any setscene tasks. sstate will be ignored
                       and everything needed, built.
 --remote-server=REMOTE_SERVER
                       Connect to the specified server.
 -m, --kill-server     Terminate the remote server.
 --observe-only        Connect to a server as an observing-only client.
 --status-only         Check the status of the remote bitbake server.




Advanced options

  • Find the Kernel generated .config file
bitbake -e virtual/kernel | grep ^B=
  • Show package dependencies
bitbake -g <pkg> && cat pn-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' | awk '{print $1}' | sort | uniq
  • bitbake: How to list all recipe and append files used in an image?
bitbake -g core-image-minimal && cat pn-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' | awk '{print $1}' | sort | uniq
...
Loaded 1291 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
NOTE: Preparing runqueue
NOTE: PN build list saved to 'pn-buildlist'
NOTE: PN dependencies saved to 'pn-depends.dot'
NOTE: Package dependencies saved to 'package-depends.dot'
NOTE: Task dependencies saved to 'task-depends.dot'
}
"acl"
"attr"
"base-files"
"base-passwd"
"bash"
"bc"
"binutils-cross-arm"
"busybox"
"bzip2"
"coreutils"
"cryptodev-linux"
"db"
"dbus"
"dbus-glib"
"depmodwrapper-cross"
"diffutils"
"e2fsprogs"
"expat"
"flex"
"gcc-cross-arm"
"gcc-cross-initial-arm"
"gcc-runtime"
"gcc-source"
"gdbm"
"gettext"
"glib-2.0"
"glibc"
"glibc-initial"
"glibc-locale"
"gmp"
"gnome-desktop-testing"
"init-ifupdown"
"initscripts"
"inputproto"
"kbproto"
"kmod"
"libaio"
"libcap"
"libffi"
"libgcc"
"libgcc-initial"
"libice"
"libpthread-stubs"
"libsm"
"libtool-cross"
"libusb1"
"libusb-compat"
"libx11"
"libxau"
"libxcb"
"libxdmcp"
"libxml2"
"linux-libc-headers"
"linux-yocto"
"m4"
"make"
"modutils-initscripts"
"ncurses"
"netbase"
"openssh"
"openssl"
"opkg-utils"
"packagegroup-core-boot"
"packagegroup-core-ssh-openssh"
"pciutils"
"perl"
"psplash"
"python"
"python-dbus"
"python-pygobject"
"qemuwrapper-cross"
"readline"
"run-postinsts"
"sed"
"shadow"
"shadow-securetty"
"shadow-sysroot"
"shared-mime-info"
"sqlite3"
"strace"
"sysvinit"
"sysvinit-inittab"
"tcp-wrappers"
"tzdata"
"udev"
"update-rc.d"
"usbutils"
"util-linux"
"util-macros"
"xcb-proto"
"xextproto"
"xproto"
"xtrans"
"zlib"


  • List tasks involved in image (or recipe) creation
bitbake -c listtasks core-image-minimal

do_build                       Default task for a recipe - depends on all other normal tasks required to 'build' a recipe
do_bundle_initramfs            Combines an initial ramdisk image and kernel together to form a single image
do_checkuri                    Validates the SRC_URI value
do_checkuriall                 Validates the SRC_URI value for all recipes required to build a target
do_clean                       Removes all output files for a target
do_cleanall                    Removes all output files, shared state cache, and downloaded source files for a target
do_cleansstate                 Removes all output files and shared state cache for a target
do_compile                     Compiles the source in the compilation directory
do_configure                   Configures the source by enabling and disabling any build-time and configuration options for the software being built
do_devshell                    Starts a shell with the environment set up for development/debugging
do_fetch                       Fetches the source code
do_fetchall                    Fetches all remote sources required to build a target
do_install                     Copies files from the compilation directory to a holding area
do_listtasks                   Lists all defined tasks for a target
do_package                     Analyzes the content of the holding area and splits it into subsets based on available packages and files
do_package_setscene            Analyzes the content of the holding area and splits it into subsets based on available packages and files (setscene version)
do_package_write_rpm           Creates the actual RPM packages and places them in the Package Feed area
do_package_write_rpm_setscene  Creates the actual RPM packages and places them in the Package Feed area (setscene version)
do_packagedata                 Creates package metadata used by the build system to generate the final packages
do_packagedata_setscene        Creates package metadata used by the build system to generate the final packages (setscene version)
do_patch                       Locates patch files and applies them to the source code
do_populate_lic                Writes license information for the recipe that is collected later when the image is constructed
do_populate_lic_setscene       Writes license information for the recipe that is collected later when the image is constructed (setscene version)
do_populate_sdk                Creates the file and directory structure for an installable SDK
do_populate_sysroot            Copies a subset of files installed by do_install into the sysroot in order to make them available to other recipes
do_populate_sysroot_setscene   Copies a subset of files installed by do_install into the sysroot in order to make them available to other recipes (setscene version)
do_rootfs                      Creates the root filesystem (file and directory structure) for an image
do_unpack                      Unpacks the source code into a working directory


  • This is a simple graphical wrapper over the streaming text output of bitbake.

It's nice in that it shows collapsible trees for the logs for sub-tasks for each recipe.

bitbake -u goggle core-image-minimal



bitbake-layers

  • bitbake-layers
bitbake-layers

usage: bitbake-layers <command> [arguments]

Available commands:
 help
   display general help or help on a specified command
 show-recipes
   list available recipes, showing the layer they are provided by
 show-cross-depends
   figure out the dependency between recipes that crosses a layer boundary.
 show-appends
   list bbappend files and recipe files they apply to
 flatten
   flattens layer configuration into a separate output directory.
 show-layers
   show current configured layers
 show-overlayed
   list overlayed recipes (where the same recipe exists in another layer)


  • bitbake-layers show-layers
bitbake-layers show-layers

layer                 path                                      priority
==========================================================================
meta                  /home/koan/yocto/poky/meta                5
meta-yocto            /home/koan/yocto/poky/meta-yocto          5
meta-yocto-bsp        /home/koan/yocto/poky/meta-yocto-bsp      5
meta-oe               /home/koan/yocto/poky/meta-openembedded/meta-oe  6


  • bitbake-layers show-overlayed
bitbake-layers show-overlayed

Parsing recipes..done.
=== Overlayed recipes ===
xserver-nodm-init:
  meta-oe              2.0
  meta                 1.0