Skip to content

# Using bitbake

To build a single package, an image for the target or a toolchain, Yocto uses the `bitbake` command. Before you can use the `bitbake` command you must set up your build environment with `init-env`. See Setting up and using the build environment.

## Building a single recipe

To build a single recipe use:

    bitbake <recipe-name>

To list all available recipes run:

    bitbake -s

A single recipe can create multiple packages, such as -dev, -dbg or such. If you want to provide your package directory as package feed for your package manager on your target, recreate the package index by running:

    bitbake package-index

See Package Management for more info.

Info

Please note, that building from scratch can take a long time (several hours!) and needs a lot of disk space and RAM! Especially when you build images with large libraries like Qt. To build as much as possible even when a recipe fails you can use the `-k` option for bitbake.

## Building an image

The Kontron BSP provides three basic images:

- image-ktn-minimal
  is a minimal image which simply boots the hardware
- image-ktn
  is a basic konsole image with utilities for debugging, package-manager and SSH access.
- image-ktn-qt (only demo image)
  is a image with Qt5/EGLFS support with demo applications

For information on which image is dedicated for your board see its hardware description.

To build, for example, the image-ktn type

    bitbake image-ktn -k

and wait until yocto finished its work. You can find the image files in the `tmp/deploy/images/<yourmachine>` directory of your build repository.

Important

Before building an image, you have to read and accept the EULA document. Else the build will fail! See a newly generated `local.conf` where to find the license documents and how to accept them for your board (e.g. set `ACCEPT_EULA_stm32mp-t1000-s-multi = "1"` in `local.conf`)

After you have built your image successfully, you now can go on to boot this image on your machine. For this continue with Booting an image on your hardware.

## Building the SDK for your image

After you have built your image, it is possible to build a SDK which fits your machine and image contents. For the Kontron Demo-Kits there are already precompiled SDKs. See Prebuild BSP releases for more info.

To create an installer for the toolchain of your board and image combination type:

    bitbake <image-recipe> -c populate_sdk

For example:

    bitbake image-ktn -c populate_sdk

For Qt5 development there is a special recipe which contains the tools needed for Qt5 development:

    bitbake meta-toolchain-qt5

Info

`meta-toolchain-qt5` and `image-ktn-qt` are two toolchains with a little difference:

- the `meta-toolchain-qt5` is the one choice when you want to develop an GUI application based on the Qt toolkit. This toolchain contains the biggest set of Qt extensions, but no additional libraries of your image. It contains the full set of Qt development tools.
- the `image-*` toolchain fits exactly to your image configuration. This toolchain contains, besides the Qt extensions, all libraries included into your image. This toolchain is the best choice when you create an application which needs special libraries which are only part of your image.

If you created the toolchain-installer with Yocto, you can find it in the directory `<build-dir>/tmp/deploy/sdk`

The installer is a shell-script, that can be executed like this:

    sh ktn-glibc-x86_64-cortexa7t2hf-neon-vfpv4-image-ktn-qt-toolchain-thud_1.3.1.sh

The default installation path is `/opt/kontron/` if not specified otherwise.