Skip to content

Build and run a QEMU image

unitexe edited this page Jan 19, 2025 · 3 revisions

Overview

Build and run a QEMU image.

Activate python virtual environment

source ~/.venv.yocto/bin/activate

Configure

Configure the build, work, sstate and download directories based on the distro, machine and release.

export KAS_CONTAINER_ENGINE=podman
export KAS_BUILD_DIR="/home/$(whoami)/dev/yocto/unit/build/scarthgap/poky/qemuarm64/"
export KAS_WORK_DIR=$KAS_BUILD_DIR
export SSTATE_DIR="/home/$(whoami)/dev/yocto/unit/build/scarthgap/sstate/"
export DL_DIR="/home/$(whoami)/dev/yocto/unit/dl"
  • To use docker instead of podman don't set KAS_CONTAINER_ENGINE as it is docker by default
  • The KAS_BUILD_DIR will vary based on the distro, machine and release being targeted
  • Update KAS_WORK_DIR whenever KAS_BUILD_DIR changes
  • The SSTATE_DIR will vary based on the release being targeted, all distro and machine combinations for a particular release share the same sstate cache
  • The same DL_DIR is used for all combinations of distro/machine/release

If this is the first time building for this particular combination of release/distro/machine then create the KAS_BUILD_DIR as it won't get created automatically. The sstate and download directories will get automatically created by bitbake.

mkdir -p $KAS_BUILD_DIR

Build

kas-container build images/poky/qemuarm64/core-image-base/scarthgap.yml

Run

This step is unique to images targeting QEMU machines.

kas-container --runtime-args --privileged shell images/poky/qemuarm64/core-image-base/scarthgap.yml -c 'runqemu slirp nographic'
Clone this wiki locally