# Tasks

Tasks are units of execution for BitBake. Recipes (`.bb` files) use tasks to complete configuring, compiling, and packaging software. This chapter provides a reference of the tasks defined in the OpenEmbedded build system.

## Normal Recipe Build Tasks

The following sections describe normal tasks associated with building a recipe.

### `do_build`

The default task for all recipes. This task depends on all other normal tasks required to build a recipe.

### `do_compile`

Compiles the source in the compilation directory, which is pointed to by the `B` variable.

### `do_compile_ptest_base`

Compiles the runtime test suite included in the software being built.

### `do_configure`

Configures the source by enabling and disabling any build-time and configuration options for the software being built.

### `do_configure_ptest_base`

Configures the runtime test suite included in the software being built.

### `do_deploy`

Writes output files that are to be deployed to the deploy directory, which is defined by the `DEPLOYDIR` variable.

The `do_deploy` task is a shared state (sstate) task, which means that the task can be accelerated through sstate use. Realize also that if the task is re-executed, any previous output is removed (i.e. "cleaned").

### `do_fetch`

Fetches the source code. This task uses the `SRC_URI` variable and the argument's prefix to determine the correct fetcher module.

### `do_install`

Copies files from the compilation directory, which is defined by the `B` variable, to a holding area defined by the `D` variable.

### `do_install_ptest_base`

Copies the runtime test suite files from the compilation directory to a holding area.

### `do_package`

Analyzes the content of the holding area and splits it into subsets based on available packages and files.

### `do_package_write_deb`

Creates the actual DEB packages and places them in the Package Feeds area.

### `do_package_write_ipk`

Creates the actual IPK packages and places them in the Package Feeds area.

### `do_package_write_rpm`

Creates the actual RPM packages and places them in the Package Feeds area.

### `do_package_write_tar`

Creates tar archives for packages and places them in the Package Feeds area.

### `do_packagedata`

Creates package metadata used by the build system to generate the final packages.

### `do_patch`

Locates patch files and applies them to the source code. See the "Patching" section for more information.

### `do_populate_lic`

Writes license information for the recipe that is collected later when the image is constructed.

### `do_populate_sdk`

Creates the file and directory structure for an installable SDK. See the "SDK Generation" section for more information.

### `do_populate_sysroot`

Copies a subset of files installed by the `do_install` task into the sysroot in order to make them available to other recipes.

The `do_populate_sysroot` task is a shared state (sstate) task, which means that the task can be accelerated through sstate use. Realize also that if the task is re-executed, any previous output is removed (i.e. "cleaned").

### `do_rm_work`

Removes work files after the OpenEmbedded build system has finished with them. You can learn more by looking at the "`rm_work.bbclass`" section.

### `do_rm_work_all`

Top-level task for removing work files after the build system has finished with them.

### `do_unpack`

Unpacks the source code into a working directory pointed to by `${` `WORKDIR` `}`. The `S` variable also plays a role in where unpacked source files ultimately reside. For more information on how source files are unpacked, see the "Source Fetching" section and the `WORKDIR` and `S` variable descriptions.

## Manually Called Tasks

These tasks are typically manually triggered (e.g. by using the `bitbake -c` command-line option):

### `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 from the `do_unpack` task forward (i.e. `do_unpack`, `do_configure`, `do_compile`, `do_install`, and `do_package`).

You can run this task using BitBake as follows:

         $ bitbake -c clean <recipe>

Running this task does not remove the sstate) cache files. Consequently, if no changes have been made and the recipe is rebuilt after cleaning, output files are simply restored from the sstate cache. If you want to remove the sstate cache files for the recipe, you need to use the `do_cleansstate` task instead (i.e. `bitbake -c cleansstate <recipe>`).

### `do_cleanall`

Removes all output files, shared state (sstate) cache, and downloaded source files for a target (i.e. the contents of `DL_DIR`). Essentially, the `do_cleanall` task is identical to the `do_cleansstate` task with the added removal of downloaded source files.

You can run this task using BitBake as follows:

         $ bitbake -c cleanall <recipe>

Typically, you would not normally use the `cleanall` task. Do so only if you want to start fresh with the `do_fetch` task.

### `do_cleansstate`

Removes all output files and shared state (sstate) cache for a target. Essentially, the `do_cleansstate` task is identical to the `do_clean` task with the added removal of shared state (sstate) cache.

You can run this task using BitBake as follows:

         $ bitbake -c cleansstate <recipe>

When you run the `do_cleansstate` task, the OpenEmbedded build system no longer uses any sstate. Consequently, building the recipe from scratch is guaranteed.

The `do_cleansstate` task cannot remove sstate from a remote sstate mirror. If you need to build a target from scratch using remote mirrors, use the "-f" option as follows:

         $ bitbake -f -c do_cleansstate <target>

### `do_devshell`

Starts a shell whose environment is set up for development, debugging, or both. See the "Using a Development Shell" section in the Yocto Project Development Manual for more information about using `devshell`.

### `do_fetchall`

Fetches all remote sources required to build a target.

### `do_listtasks`

Lists all defined tasks for a target.

### `do_package_index`

Creates or updates the index in the Package Feeds area.

This task is not triggered with the `bitbake -c` command-line option as are the other tasks in this section. Because this task is specifically for the `package-index` recipe, you run it using `bitbake package-index`.

## Image-Related Tasks

The following tasks are applicable to image recipes.

### `do_bootimg`

Creates a bootable live image. See the `IMAGE_FSTYPES` variable for additional information on live image types.

### `do_bundle_initramfs`

Combines an initial RAM disk (initramfs) image and kernel together to form a single image. The `CONFIG_INITRAMFS_SOURCE` variable has some more information about these types of images.

### `do_rootfs`

Creates the root filesystem (file and directory structure) for an image. See the "Image Generation" section for more information on how the root filesystem is created.

### `do_testimage`

Boots an image and performs runtime tests within the image. For information on automatically testing images, see the "Performing Automated Runtime Testing" section in the Yocto Project Development Manual.

### `do_testimage_auto`

Boots an image and performs runtime tests within the image immediately after it has been built. This task is enabled when you set `TEST_IMAGE` equal to "1".

For information on automatically testing images, see the "Performing Automated Runtime Testing" section in the Yocto Project Development Manual.

### `do_vmdkimg`

Creates a `.vmdk` image for use with VMware and compatible virtual machine hosts.

## Kernel-Related Tasks

The following tasks are applicable to kernel recipes. Some of these tasks (e.g. the `do_menuconfig` task) are also applicable to recipes that use Linux kernel style configuration such as the BusyBox recipe.

### `do_compile_kernelmodules`

Compiles loadable modules for the Linux kernel.

### `do_diffconfig`

Compares the old and new config files after running the `do_menuconfig` task for the kernel.

### `do_kernel_checkout`

Checks out source/meta branches for a linux-yocto style kernel.

### `do_kernel_configcheck`

Validates the kernel configuration for a linux-yocto style kernel.

### `do_kernel_configme`

Assembles the kernel configuration for a linux-yocto style kernel.

### `do_kernel_link_vmlinux`

Creates a symbolic link in `arch/$arch/boot` for vmlinux kernel images.

### `do_menuconfig`

Runs `make menuconfig` for the kernel. For information on `menuconfig`, see the "Using `menuconfig`" section in the Yocto Project Development Manual.

### `do_savedefconfig`

Creates a minimal Linux kernel configuration file.

### `do_sizecheck`

Checks the size of the kernel image against `KERNEL_IMAGE_MAXSIZE` when set.

### `do_strip`

Strips unneeded sections out of the Linux kernel image.

### `do_uboot_mkimage`

Creates a uImage file from the kernel for the U-Boot bootloader.

### `do_validate_branches`

Ensures that the source, metadata (or both) branches are on the locations specified by their `SRCREV` values for a linux-yocto style kernel.

## Miscellaneous Tasks

The following sections describe miscellaneous tasks.

### `do_generate_qt_config_file`

Writes a `qt.conf` configuration file used for building a Qt-based application.

### `do_spdx`

A build stage that takes the source code and scans it on a remote FOSSOLOGY server in order to produce an SPDX document. This task applies only to the `spdx` class.