build: Use binary kernel artifacts

The Linux kernel fork repository for Cloud Hypervisor now produces
prebuilt x86-64 and aarch64 binaries. Speed up the CI by using those
binaries.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
Rob Bradford 2024-09-08 11:51:57 +01:00
parent e47677020e
commit a10e9e6cd5
6 changed files with 29 additions and 7 deletions

View File

@ -154,8 +154,8 @@ update_workloads() {
fi fi
popd || exit popd || exit
# Build custom kernel for guest VMs # Download prebuild linux binaries
build_custom_linux download_linux
# Update the kernel in the cloud image for some tests that requires recent kernel version # Update the kernel in the cloud image for some tests that requires recent kernel version
FOCAL_OS_RAW_IMAGE_UPDATE_KERNEL_NAME="focal-server-cloudimg-arm64-custom-20210929-0-update-kernel.raw" FOCAL_OS_RAW_IMAGE_UPDATE_KERNEL_NAME="focal-server-cloudimg-arm64-custom-20210929-0-update-kernel.raw"

View File

@ -56,7 +56,8 @@ popd || exit
# Build custom kernel based on virtio-pmem and virtio-fs upstream patches # Build custom kernel based on virtio-pmem and virtio-fs upstream patches
VMLINUX_IMAGE="$WORKLOADS_DIR/vmlinux" VMLINUX_IMAGE="$WORKLOADS_DIR/vmlinux"
if [ ! -f "$VMLINUX_IMAGE" ]; then if [ ! -f "$VMLINUX_IMAGE" ]; then
build_custom_linux # Download prebuild linux binaries
download_linux
fi fi
CFLAGS="" CFLAGS=""

View File

@ -44,7 +44,8 @@ if ! grep focal sha1sums-x86_64 | sha1sum --check; then
fi fi
popd || exit popd || exit
build_custom_linux # Download prebuild linux binaries
download_linux
CFLAGS="" CFLAGS=""
if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then if [[ "${BUILD_TARGET}" == "x86_64-unknown-linux-musl" ]]; then

View File

@ -102,7 +102,8 @@ popd || exit
# Build custom kernel based on virtio-pmem and virtio-fs upstream patches # Build custom kernel based on virtio-pmem and virtio-fs upstream patches
VMLINUX_IMAGE="$WORKLOADS_DIR/vmlinux" VMLINUX_IMAGE="$WORKLOADS_DIR/vmlinux"
if [ ! -f "$VMLINUX_IMAGE" ]; then if [ ! -f "$VMLINUX_IMAGE" ]; then
build_custom_linux # Download prebuild linux binaries
download_linux
fi fi
VIRTIOFSD="$WORKLOADS_DIR/virtiofsd" VIRTIOFSD="$WORKLOADS_DIR/virtiofsd"

View File

@ -80,8 +80,8 @@ if [ "${TEST_ARCH}" == "aarch64" ]; then
guestunmount "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR" guestunmount "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR"
fi fi
# Build custom kernel based on virtio-pmem and virtio-fs upstream patches # Download prebuild linux binaries
build_custom_linux download_linux
CFLAGS="" CFLAGS=""
if [[ "${BUILD_TARGET}" == "${TEST_ARCH}-unknown-linux-musl" ]]; then if [[ "${BUILD_TARGET}" == "${TEST_ARCH}-unknown-linux-musl" ]]; then

View File

@ -42,6 +42,7 @@ checkout_repo() {
fi fi
} }
# Not actively used by CI
build_custom_linux() { build_custom_linux() {
ARCH=$(uname -m) ARCH=$(uname -m)
SRCDIR=$PWD SRCDIR=$PWD
@ -130,6 +131,24 @@ download_hypervisor_fw() {
popd || exit popd || exit
} }
download_linux() {
if [ -n "$AUTH_DOWNLOAD_TOKEN" ]; then
echo "Using authenticated download from GitHub"
KERNEL_URLS=$(curl --silent https://api.github.com/repos/cloud-hypervisor/linux/releases/latest \
--header "Authorization: Token $AUTH_DOWNLOAD_TOKEN" \
--header "X-GitHub-Api-Version: 2022-11-28" | grep "browser_download_url" | grep -o 'https://.*[^ "]')
else
echo "Using anonymous download from GitHub"
KERNEL_URLS=$(curl --silent https://api.github.com/repos/cloud-hypervisor/linux/releases/latest | grep "browser_download_url" | grep -o 'https://.*[^ "]')
fi
pushd "$WORKLOADS_DIR" || exit
for url in $KERNEL_URLS; do
wget --quiet "$url" || exit 1
done
popd || exit
}
download_ovmf() { download_ovmf() {
OVMF_FW_TAG="ch-6624aa331f" OVMF_FW_TAG="ch-6624aa331f"
OVMF_FW_URL="https://github.com/cloud-hypervisor/edk2/releases/download/$OVMF_FW_TAG/CLOUDHV.fd" OVMF_FW_URL="https://github.com/cloud-hypervisor/edk2/releases/download/$OVMF_FW_TAG/CLOUDHV.fd"