Yocto build guide with docker

From Wiki-DB
Jump to navigationJump to search

Requirements

To build Yocto images you need a powerfull build machine and a lot of time.

Hardware

  • CPU: four cores or more
  • RAM: 16 GB or more
  • HDD/SSD: from 25 GB to 100 GB free space (depends on included features)

Software

  • Linux OS
  • Docker

Start your build environment

The following two examples show how to create yocto images using the kas container or the kas-container script.

In the following examples, we use the meta-dhsom-stm32-bsp layer as the top layer for creating images for the STM32MP15 DHSOM family with our baseboards. If you have your own layer on top because you have a custom DHSOM baseboard, then you must replace meta-dhsom-stm32-bsp with your own layer in all commands.

See the documentation for how to use the kas tool:

Docker container based bash shell

Preparation:

export KAS_WORK_DIR=/mnt/work/yocto
export KAS_BUILD_DIR=/mnt/build/yocto

sudo mkdir -p "${KAS_WORK_DIR}" "${KAS_BUILD_DIR}"
sudo chown $(id –u):$(id –g) "${KAS_WORK_DIR}" "${KAS_BUILD_DIR}"

cd /path/to/kas-dhsom

docker run --rm --interactive --tty --init \
	--env TERM="xterm-256color" \
	--env USER_ID="$(id -u)" --env GROUP_ID="$(id -g)" \
	--volume "${KAS_BUILD_DIR}":"${KAS_BUILD_DIR}":rw \
	--env KAS_BUILD_DIR="${KAS_BUILD_DIR}" \
	--volume "${KAS_WORK_DIR}":"${KAS_WORK_DIR}":rw \
	--env KAS_WORK_DIR="${KAS_WORK_DIR}" \
	--volume "${PWD}":"${PWD}":rw \
	--workdir="${PWD}" \
	ghcr.io/siemens/kas/kas:latest-release \
	/bin/bash

Usage:

cd /path/to/kas-dhsom
kas menu
kas build

Docker container based kas tool

Preparation:

wget -O kas-container https://github.com/siemens/kas/raw/master/kas-container
chmod +x kas-container

Usage:

cd /path/to/kas-dhsom
/path/to/kas-container menu
/path/to/kas-container build