qemu: drop cross-compilation build support

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-<arch>-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 <ffidencio@nvidia.com>
Assisted-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Fabiano Fidêncio
2026-07-20 19:42:48 +02:00
parent 7632ffd8a8
commit 7925e678ba
4 changed files with 24 additions and 64 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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}" && \

View File

@@ -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