From 506858f996f8094ad79f01615c3647f254381a47 Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Wed, 27 Jan 2021 11:39:43 -0700 Subject: [PATCH] boot-utils: Add '--use-cbl-qemu' We need to do this in order to boot s390 kernels in our CI. The qemu binaries are hosted in a separate repo to keep things reasonable in terms of file size. Signed-off-by: Nathan Chancellor --- .gitignore | 1 + README.txt | 7 +++++++ boot-qemu.sh | 16 ++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/.gitignore b/.gitignore index bc78feb..e7df6b3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +qemu-binaries/ rootfs.cpio diff --git a/README.txt b/README.txt index a9978ea..9960c20 100644 --- a/README.txt +++ b/README.txt @@ -49,3 +49,10 @@ Optional parameters: QEMU machine. Depending on the power of the host machine, this might not be long enough for a kernel to boot so this allows that timeout to be configured. Takes the value passed to timeout (e.g. 30s or 4m). + + --use-cbl-qemu (only relevant with '-a s390'): + Currently, s390 only boots with patches that are available in QEMU + master. It could take a while for those patches to make it to various + distribution versions of qemu-system-s390 so we provide a copy of it + at https://github.com/ClangBuiltLinux/qemu-binaries. This option + downloads that repo here and decompresses the binary to use it. diff --git a/boot-qemu.sh b/boot-qemu.sh index c32732a..6ece571 100755 --- a/boot-qemu.sh +++ b/boot-qemu.sh @@ -72,6 +72,10 @@ function parse_parameters() { shift && TIMEOUT=${1} ;; + --use-cbl-qemu) + USE_CBL_QEMU=true + ;; + *) die "Invalid parameter '${1}'" ;; @@ -208,6 +212,18 @@ function setup_qemu_args() { KIMAGE=bzImage QEMU_ARCH_ARGS=(-M s390-ccw-virtio) QEMU=(qemu-system-s390x) + if ${USE_CBL_QEMU:-false}; then + QEMU_BINARIES=${BASE}/qemu-binaries + + green "Downloading or updating qemu-binaries..." + [[ -d ${QEMU_BINARIES} ]] || git clone https://github.com/ClangBuiltLinux/qemu-binaries "${QEMU_BINARIES}" + git -C "${QEMU_BINARIES}" pull --rebase + + QEMU_BIN=${QEMU_BINARIES}/bin + QEMU_S390=${QEMU_BIN}/${QEMU[*]} + zstd -q -d "${QEMU_S390}".zst -o "${QEMU_S390}" || die "Error decompressing qemu-system-s390x" + export PATH=${QEMU_BIN}:${PATH} + fi ;; x86 | x86_64)