Building Xilinx Yocto (Scarthgap 5.0.4) Inside Docker

Building Xilinx Yocto (Scarthgap 5.0.4) Inside Docker

Building Xilinx Yocto (Scarthgap 5.0.4) Inside Docker

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.


🧱 Dockerfile Used for the Yocto Build Environment

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"]

📦 Build the Docker Image

docker build -t yocto-xilinx-5.0.4 .

🐳 Run the Docker Container

docker run --rm -it   -v /mnt/debian12/Xilinx/yocto/scarthgap/:/home/yocto/   yocto-xilinx-5.0.4

💾 Save Container State

docker ps
docker commit sharp_lamarr yocto-xilinx-5.0.4

🔁 Initialize Yocto Sources

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

🧰 Initialize BitBake

source setupsdk

🛠 Build Examples

Build SDK for Zynq-7000:

MACHINE=microzed-zynq7 bitbake meta-toolchain

Build Minimal Linux Image for Zynq UltraScale+ MPSoC:

MACHINE=zcu102-zynqmp bitbake petalinux-image-minimal

🏗️ Build for Xen (QEMU ARM64)

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"

📚 References


✅ Conclusion

Docker gives Yocto a stable, repeatable environment, avoids host poisoning, and simplifies builds for Zynq, ZynqMP, and QEMU Xen.


Comments
comments powered by Disqus




Archives

2025 (8)
2022 (3)
2021 (9)
2020 (18)
2014 (4)