Building Xilinx Yocto (Scarthgap 5.0.4) Inside Docker
Published at December 1, 2025 · Last Modified at December 2, 2025 · 2 min read · Tags: yocto xilinx docker embedded-linux zynq zynqmp petalinux xen qemu build-systems
Building Xilinx Yocto (Scarthgap 5.0.4) Inside Docker
Published at December 1, 2025 · Last Modified at December 2, 2025 · 2 min read · Tags: yocto xilinx docker embedded-linux zynq zynqmp petalinux xen qemu build-systems
This guide explains how to build Yocto Scarthgap 5.0.4 for Xilinx platforms in a stable and reproducible Docker environment.
Yocto builds are sensitive to host OS changes — Docker ensures a clean, identical environment every time.
This Dockerfile provides all host tools required by Poky, BitBake, meta-xilinx, and QEMU/Xen.
It avoids host contamination and ensures reproducible builds.
# Use Ubuntu 22.04 LTS as base
FROM ubuntu:22.04
# Avoid interaction during package install
ENV DEBIAN_FRONTEND=noninteractive
# Install necessary dependencies
RUN apt-get update && apt-get install -y gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev xterm locales zstd sudo vim nano lz4 repo curl libtinfo5 libncurses5 file && rm -rf /var/lib/apt/lists/*
# Set locale (important for Yocto)
RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
# Create a non-root user (yocto)
RUN useradd -m yocto && echo "yocto ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Set work directory and give permissions
WORKDIR /home/yocto
# Change ownership
RUN chown -R yocto:yocto /home/yocto
# Switch to user
USER yocto
# Default to bash
CMD ["/bin/bash"]
docker build -t yocto-xilinx-5.0.4 .
docker run --rm -it -v /mnt/debian12/Xilinx/yocto/scarthgap/:/home/yocto/ yocto-xilinx-5.0.4
docker ps
docker commit sharp_lamarr yocto-xilinx-5.0.4
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
repo init -u https://github.com/Xilinx/yocto-manifests.git -b rel-v2023.2
repo sync
source setupsdk
MACHINE=microzed-zynq7 bitbake meta-toolchain
MACHINE=zcu102-zynqmp bitbake petalinux-image-minimal
MACHINE = "qemu-arm64"
bitbake core-image-minimal
Add this to local.conf:
CORE_IMAGE_EXTRA_INSTALL:core-image-minimal = "dropbear busybox"
IMAGE_FEATURES:core-image-minimal += "debug-tweaks"
IMAGE_INSTALL:append = " xen-tools"
Docker gives Yocto a stable, repeatable environment, avoids host poisoning, and simplifies builds for Zynq, ZynqMP, and QEMU Xen.