From 7925e678baef3079090b6cd65bfc92255711bb4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Mon, 20 Jul 2026 19:42:48 +0200 Subject: [PATCH] qemu: drop cross-compilation build support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Building QEMU for a foreign arch relied on configure-hypervisor.sh emitting --cross-prefix, build-qemu.sh passing --cc/--cross-prefix for s390x, and the builder image installing foreign-arch -dev packages (via dpkg multiarch/DPKG_ARCH) plus a gcc--linux-gnu cross toolchain. None of this is exercised on our side: QEMU is always built on a native-arch runner. Remove the cross-prefix logic, the s390x cross configure branch, and the DPKG_ARCH/cross-gcc plumbing from the Dockerfile and build-base-qemu.sh. Signed-off-by: Fabiano FidĂȘncio Assisted-by: Cursor --- .../packaging/scripts/configure-hypervisor.sh | 12 ---- tools/packaging/static-build/qemu/Dockerfile | 61 +++++++------------ .../static-build/qemu/build-base-qemu.sh | 9 --- .../packaging/static-build/qemu/build-qemu.sh | 6 +- 4 files changed, 24 insertions(+), 64 deletions(-) diff --git a/tools/packaging/scripts/configure-hypervisor.sh b/tools/packaging/scripts/configure-hypervisor.sh index 0160f7e27d..8ca899f74b 100755 --- a/tools/packaging/scripts/configure-hypervisor.sh +++ b/tools/packaging/scripts/configure-hypervisor.sh @@ -209,18 +209,6 @@ show_array() { generate_qemu_options() { #--------------------------------------------------------------------- - #check if cross-compile is needed - host=$(uname -m) - if [[ "${arch}" != "${host}" ]]; then - case ${arch} in - aarch64) qemu_options+=(size:--cross-prefix=aarch64-linux-gnu-);; - ppc64le) qemu_options+=(size:--cross-prefix=powerpc64le-linux-gnu-);; - s390x) exit;; - x86_64);; - *) exit;; - esac - fi - # Disabled options # braille support not required diff --git a/tools/packaging/static-build/qemu/Dockerfile b/tools/packaging/static-build/qemu/Dockerfile index aaff0d6457..84b0b13b74 100644 --- a/tools/packaging/static-build/qemu/Dockerfile +++ b/tools/packaging/static-build/qemu/Dockerfile @@ -8,23 +8,10 @@ FROM ubuntu:22.04 # This is required to keep build dependencies with security fixes. ARG CACHE_TIMEOUT ARG DEBIAN_FRONTEND=noninteractive -ARG DPKG_ARCH -ARG ARCH -ARG GCC_ARCH ARG PREFIX SHELL ["/bin/bash", "-o", "pipefail", "-c"] -RUN if [ "${ARCH}" != "$(uname -m)" ]; then sed -i 's/^deb/deb [arch=amd64]/g' /etc/apt/sources.list && \ - dpkg --add-architecture "${DPKG_ARCH#:}" && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy main restricted" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy-updates main restricted" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy universe" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy-updates universe" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy multiverse" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy-updates multiverse" >> /etc/apt/sources.list && \ - echo "deb [arch=${DPKG_ARCH#:}] http://ports.ubuntu.com/ jammy-backports main restricted universe multiverse" >> /etc/apt/sources.list; fi - RUN apt-get update && apt-get upgrade -y && \ apt-get --no-install-recommends install -y \ apt-utils \ @@ -37,39 +24,37 @@ RUN apt-get update && apt-get upgrade -y && \ dpkg-dev \ flex \ gawk \ - libaio-dev${DPKG_ARCH} \ - libaudit-dev${DPKG_ARCH} \ - libblkid-dev${DPKG_ARCH} \ - libcap-dev${DPKG_ARCH} \ - libcap-ng-dev${DPKG_ARCH} \ - libdw-dev${DPKG_ARCH} \ - libelf-dev${DPKG_ARCH} \ - libffi-dev${DPKG_ARCH} \ - libglib2.0-0${DPKG_ARCH} \ - libglib2.0-dev${DPKG_ARCH} \ - libglib2.0-dev${DPKG_ARCH} git \ - libltdl-dev${DPKG_ARCH} \ - libmount-dev${DPKG_ARCH} \ - libnuma-dev${DPKG_ARCH} \ - libpixman-1-dev${DPKG_ARCH} \ - libselinux1-dev${DPKG_ARCH} \ - libtool${DPKG_ARCH} \ - liburing-dev${DPKG_ARCH} \ + libaio-dev \ + libaudit-dev \ + libblkid-dev \ + libcap-dev \ + libcap-ng-dev \ + libdw-dev \ + libelf-dev \ + libffi-dev \ + libglib2.0-0 \ + libglib2.0-dev \ + libglib2.0-dev git \ + libltdl-dev \ + libmount-dev \ + libnuma-dev \ + libpixman-1-dev \ + libselinux1-dev \ + libtool \ + liburing-dev \ make \ ninja-build \ - pkg-config${DPKG_ARCH} \ - libseccomp-dev${DPKG_ARCH} \ - libseccomp2${DPKG_ARCH} \ + pkg-config \ + libseccomp-dev \ + libseccomp2 \ patch \ python3 \ python3-dev \ python3-venv \ python3-tomli \ rsync \ - zlib1g-dev${DPKG_ARCH} && \ - if [ "${ARCH}" != s390x ]; then apt-get install -y --no-install-recommends libpmem-dev${DPKG_ARCH}; fi && \ - GCC_ARCH="${ARCH}" && if [ "${ARCH}" = "ppc64le" ]; then GCC_ARCH="powerpc64le"; fi && \ - if [ "${ARCH}" != "$(uname -m)" ]; then apt-get install --no-install-recommends -y gcc-"${GCC_ARCH}"-linux-gnu; fi && \ + zlib1g-dev && \ + if [ "$(uname -m)" != s390x ]; then apt-get install -y --no-install-recommends libpmem-dev; fi && \ apt-get clean && rm -rf /var/lib/apt/lists/ # Detect architecture and set appropriate Ubuntu mirror diff --git a/tools/packaging/static-build/qemu/build-base-qemu.sh b/tools/packaging/static-build/qemu/build-base-qemu.sh index 39fde58638..1e6862c728 100755 --- a/tools/packaging/static-build/qemu/build-base-qemu.sh +++ b/tools/packaging/static-build/qemu/build-base-qemu.sh @@ -8,8 +8,6 @@ set -o errexit set -o nounset set -o pipefail -CROSS_BUILD="${CROSS_BUILD:-false}" - script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly qemu_builder="${script_dir}/build-qemu.sh" @@ -22,10 +20,6 @@ source "${script_dir}/../qemu.blacklist" repo_root_dir="${repo_root_dir:-$(git rev-parse --show-toplevel 2>/dev/null || echo "${script_dir}/../../../..")}" ARCH=${ARCH:-$(uname -m)} -dpkg_arch=":${ARCH}" -[[ "${dpkg_arch}" == ":aarch64" ]] && dpkg_arch=":arm64" -[[ "${dpkg_arch}" == ":x86_64" ]] && dpkg_arch="" -[[ "${dpkg_arch}" == ":ppc64le" ]] && dpkg_arch=":ppc64el" packaging_dir="${script_dir}/../.." qemu_destdir="/tmp/qemu-static/" @@ -52,14 +46,11 @@ CACHE_TIMEOUT=$(date +"%Y-%m-%d") [[ -n "${build_suffix}" ]] && PKGVERSION="kata-static-${build_suffix}" || PKGVERSION="kata-static" container_image="${QEMU_CONTAINER_BUILDER:-$(get_qemu_image_name)}" -[[ "${CROSS_BUILD}" == "true" ]] && container_image="${container_image}-cross-build" "${container_engine}" pull "${container_image}" || ("${container_engine}" build \ --build-arg CACHE_TIMEOUT="${CACHE_TIMEOUT}" \ --build-arg http_proxy="${http_proxy}" \ --build-arg https_proxy="${https_proxy}" \ - --build-arg DPKG_ARCH="${dpkg_arch}" \ - --build-arg ARCH="${ARCH}" \ "${packaging_dir}" \ -f "${script_dir}/Dockerfile" \ -t "${container_image}" && \ diff --git a/tools/packaging/static-build/qemu/build-qemu.sh b/tools/packaging/static-build/qemu/build-qemu.sh index b9d327ec8e..fb7c2d01a8 100755 --- a/tools/packaging/static-build/qemu/build-qemu.sh +++ b/tools/packaging/static-build/qemu/build-qemu.sh @@ -34,11 +34,7 @@ git fetch --depth=1 origin "${QEMU_VERSION_NUM}" git checkout FETCH_HEAD scripts/git-submodule.sh update meson capstone "${kata_packaging_scripts}/patch_qemu.sh" "${QEMU_VERSION_NUM}" "${kata_packaging_dir}/qemu/patches" -if [[ "$(uname -m)" != "${ARCH}" ]] && [[ "${ARCH}" == "s390x" ]]; then - PREFIX="${PREFIX}" "${kata_packaging_scripts}/configure-hypervisor.sh" -s "${HYPERVISOR_NAME}" "${ARCH}" | xargs ./configure --with-pkgversion="${PKGVERSION}" --cc=s390x-linux-gnu-gcc --cross-prefix=s390x-linux-gnu- --prefix="${PREFIX}" --target-list=s390x-softmmu -else - PREFIX="${PREFIX}" "${kata_packaging_scripts}/configure-hypervisor.sh" -s "${HYPERVISOR_NAME}" "${ARCH}" | xargs ./configure --with-pkgversion="${PKGVERSION}" -fi +PREFIX="${PREFIX}" "${kata_packaging_scripts}/configure-hypervisor.sh" -s "${HYPERVISOR_NAME}" "${ARCH}" | xargs ./configure --with-pkgversion="${PKGVERSION}" make -j"$(nproc --ignore=1)" make install DESTDIR="${QEMU_DESTDIR}" popd