Files
xen/automation/scripts/build
T
Andrew Cooper f27787545c CI: Stop building QEMU in general
We spend an awful lot of CI time building QEMU, even though most changes don't
touch the subset of tools/libs/ used by QEMU.  Some numbers taken at a time
when CI was otherwise quiet:

                       With     Without
  Alpine:              13m38s   6m04s
  Debian 12:           10m05s   8m10s
  OpenSUSE Tumbleweed: 11m40s   7m54s
  Ubuntu 24.04:        14m56s   8m06s

which is a >50% improvement in wallclock time in some cases.

The only build we have that needs QEMU is alpine-3.18-gcc-debug.  This is the
build deployed and used by the QubesOS ADL-* and Zen3p-* jobs.

Xilinx-x86_64 deploys it too, but is PVH-only and doesn't use QEMU.

QEMU is also built by CirrusCI for FreeBSD (fully Clang/LLVM toolchain).

This should help quite a lot with Gitlab CI capacity.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit e305256e69)
2024-11-12 11:20:45 +00:00

87 lines
2.4 KiB
Python
Executable File

#!/bin/bash -ex
test -f /etc/os-release && cat "$_"
$CC --version
# Express the compiler version as an integer. e.g. GCC 4.9.2 => 0x040902
cc-ver()
{
$CC -dumpversion | awk -F. '{ printf "0x%02x%02x%02x", $1, $2, $3 }'
}
# random config or default config
if [[ "${RANDCONFIG}" == "y" ]]; then
# Append job-specific fixed configuration
if [[ -n "${EXTRA_FIXED_RANDCONFIG}" ]]; then
echo "${EXTRA_FIXED_RANDCONFIG}" >> xen/tools/kconfig/allrandom.config
fi
make -j$(nproc) -C xen KCONFIG_ALLCONFIG=tools/kconfig/allrandom.config randconfig
hypervisor_only="y"
else
echo "CONFIG_DEBUG=${debug}" > xen/.config
if [[ -n "${EXTRA_XEN_CONFIG}" ]]; then
echo "${EXTRA_XEN_CONFIG}" >> xen/.config
fi
make -j$(nproc) -C xen olddefconfig
fi
# Save the config file before building because build failure causes the script
# to exit early -- bash is invoked with -e.
cp xen/.config xen-config
# arm32 only cross-compiles the hypervisor
if [[ "${XEN_TARGET_ARCH}" = "arm32" ]]; then
hypervisor_only="y"
fi
# build up our configure options
cfgargs=()
cfgargs+=("--enable-docs")
if [[ "${CC}" == "clang"* ]]; then
# SeaBIOS cannot be built with clang
cfgargs+=("--with-system-seabios=/usr/share/seabios/bios.bin")
# iPXE cannot be built with clang
cfgargs+=("--with-system-ipxe=/usr/lib/ipxe/ipxe.pxe")
# newlib cannot be built with clang so we cannot build stubdoms
cfgargs+=("--disable-stubdom")
fi
if ! test -z "$(ldd /bin/ls|grep musl|head -1)"; then
# disable --disable-werror for QEMUU when building with MUSL
cfgargs+=("--with-extra-qemuu-configure-args=\"--disable-werror\"")
# SeaBIOS doesn't build on MUSL systems
cfgargs+=("--with-system-seabios=/bin/false")
fi
# QEMU is only for those who ask
if [[ "$BUILD_QEMU_XEN" != "y" ]]; then
cfgargs+=("--with-system-qemu=/bin/false")
fi
# SeaBIOS requires GCC 4.6 or later
if [[ "${CC}" == "gcc" && `cc-ver` -lt 0x040600 ]]; then
cfgargs+=("--with-system-seabios=/bin/false")
fi
if [[ "${hypervisor_only}" == "y" ]]; then
make -j$(nproc) xen
else
./configure "${cfgargs[@]}"
make -j$(nproc) dist
fi
# Extract artifacts to avoid getting rewritten by customised builds
mkdir binaries
if [[ "${XEN_TARGET_ARCH}" != "x86_32" ]]; then
cp xen/xen binaries/xen
if [[ "${hypervisor_only}" != "y" ]]; then
cp -r dist binaries/
fi
fi