|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH RFC] CI: Add an EFI/StrictNX test
From: Roger Pau Monne <roger.pau@xxxxxxxxxx> While most of our testing of this nature happens in a Debian container, Debian's strictnx build of OVMF is buggy at the time of writing. See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1154178 Fedora have non-strict StrictNX enabled in their SecureBoot build of OVMF, but by default it prints a warning on failure and then relaxes permissions. It can be turned into strict StrictNX mode with an extra -fw_cfg setting, making it actually usable in a CI scenario. Unlike Debian, Fedora has no equivelent of the enroled snakeoil key, so for simplicity sake just turn off SecureBoot for now. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Anthony PERARD <anthony.perard@xxxxxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Michal Orzel <michal.orzel@xxxxxxx> CC: Doug Goldstein <cardoe@xxxxxxxxxx> CC: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx> Adapted from a previous patch of Rogers. Not for applying yet, as Xen is not compatible with StrictNX. However, I want to rebuild the container including these new packages for ease of testing, so this wants a cusory review at least. --- automation/build/fedora/43-x86_64.dockerfile | 7 ++ automation/gitlab-ci/test.yaml | 9 +++ .../scripts/include/xtf-x86_64-efi-strictnx | 64 +++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 automation/scripts/include/xtf-x86_64-efi-strictnx diff --git a/automation/build/fedora/43-x86_64.dockerfile b/automation/build/fedora/43-x86_64.dockerfile index 0a2329e2dc37..a9f69b4cdc95 100644 --- a/automation/build/fedora/43-x86_64.dockerfile +++ b/automation/build/fedora/43-x86_64.dockerfile @@ -67,6 +67,13 @@ RUN <<EOF glib2-devel pixman-devel ninja-build + + # for test phase, qemu-* jobs + edk2-ovmf + expect + python3-virt-firmware + qemu-img + qemu-system-x86 ) dnf -y --setopt=install_weak_deps=False install "${DEPS[@]}" diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml index cf4b7ed416b0..4673815b484f 100644 --- a/automation/gitlab-ci/test.yaml +++ b/automation/gitlab-ci/test.yaml @@ -783,6 +783,15 @@ qemu-smoke-x86_64-gcc-efi-uki: needs: - debian-13-x86_64-gcc-debug +qemu-smoke-x86_64-gcc-efi-strictnx: + extends: .qemu-smoke-x86_64 + variables: + CONTAINER: fedora:43-x86_64 + script: + - ./automation/scripts/qemu-xtf.sh x86_64-efi-strictnx pv64 example 2>&1 | tee ${LOGFILE} + needs: + - debian-13-x86_64-gcc-debug + qemu-xtf-argo-x86_64-gcc-debug: extends: .qemu-smoke-x86_64 variables: diff --git a/automation/scripts/include/xtf-x86_64-efi-strictnx b/automation/scripts/include/xtf-x86_64-efi-strictnx new file mode 100644 index 000000000000..49a87c7dd91f --- /dev/null +++ b/automation/scripts/include/xtf-x86_64-efi-strictnx @@ -0,0 +1,64 @@ +#!/bin/bash +# +# XTF test utilities (x86_64, EFI). +# + +# Arch-specific environment overrides. +function xtf_arch_prepare() +{ + export FW_PREFIX="${FW_PREFIX:-/usr/share/edk2/ovmf}" + export QEMU_PREFIX="${QEMU_PREFIX:-}" + export XEN_BINARY="${XEN_BINARY:-${WORKDIR}/xen.efi}" + export XEN_CMDLINE="${XEN_CMDLINE:-loglvl=all noreboot console_timestamps=boot console=com1}" + export XTF_SRC_BRANCH="${XTF_SRC_BRANCH:-master}" + export XTF_SRC_URI="${XTF_SRC_URI:-https://xenbits.xen.org/git-http/xtf.git}" + export XTF_SRC_VARIANTS="hvm64 pv64" +} + +# Perform arch-specific XTF environment setup. +function xtf_arch_setup() +{ + local esp_dir="${WORKDIR}/boot-esp" + local efi_dir="${esp_dir}/EFI/BOOT" + + # Generate EFI boot environment + mkdir -p ${efi_dir} + cp ${XEN_BINARY} ${efi_dir}/BOOTX64.EFI + cp ${XTF_BINARY} ${efi_dir}/kernel + + cat > ${efi_dir}/BOOTX64.cfg <<EOF +[global] +default=test + +[test] +options=${XEN_CMDLINE} +kernel=kernel +EOF + + # Fedora has StrictNX built into in the SecureBoot image, but by default + # it is permissive and only prints a warning. It's made strict by an + # extra -fw_cfg setting. + local ovmf_code=${FW_PREFIX}/OVMF_CODE_4M.secboot.qcow2 + local ovmf_vars=${FW_PREFIX}/OVMF_VARS_4M.secboot.qcow2 + local ovmf_format=qcow2 + + cp $ovmf_code ${WORKDIR}/OVMF_CODE + cp $ovmf_vars ${WORKDIR}/OVMF_VARS + + # Xen.efi isn't signed, so turn SecureBoot off. + virt-fw-vars --inplace ${WORKDIR}/OVMF_VARS --set-false SecureBootEnable + + export TEST_CMD="${QEMU_PREFIX}qemu-system-x86_64 \ + -no-reboot \ + -nographic \ + -monitor none \ + -serial stdio \ + -m 2048 \ + -smp 2 \ + -M q35,kernel-irqchip=split \ + -drive if=pflash,format=${ovmf_format},readonly=on,file=${WORKDIR}/OVMF_CODE \ + -drive if=pflash,format=${ovmf_format},file=${WORKDIR}/OVMF_VARS \ + -drive file=fat:rw:${esp_dir},media=disk,index=0,format=raw \ + -fw_cfg name=opt/org.tianocore/StrictNX,string=yes \ + " +} -- 2.39.5
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |