From 30f66c88b44928ec10a107cf8b330a8b4ad9137e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Tue, 14 May 2024 14:28:06 +0200 Subject: [PATCH] ci(uefi): use ovmf-prebuilt images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- .github/workflows/ci.yml | 21 +++++++++++++++++++-- xtask/src/ci/qemu.rs | 9 ++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6d2259f..90910a00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install qemu-system-x86 qemu-system-arm qemu-system-misc ovmf + sudo apt-get install qemu-system-x86 qemu-system-arm qemu-system-misc - name: Install QEMU (macos) if: matrix.os == 'macos-latest' run: | @@ -76,6 +76,19 @@ jobs: run: | gh release download v1.4 --repo riscv-software-src/opensbi --pattern 'opensbi-*-rv-bin.tar.xz' tar -xvf opensbi-*-rv-bin.tar.xz opensbi-1.4-rv-bin/share/opensbi/lp64/generic/firmware/fw_jump.bin + - name: Download OVMF (prebuilt) + run: | + gh release download edk2-stable202402-r1 --repo rust-osdev/ovmf-prebuilt --pattern 'edk2-stable*-bin.tar.xz' + tar -xvf edk2-stable*-bin.tar.xz edk2-stable202402-r1-bin/x64 + if: matrix.os != 'ubuntu-latest' && matrix.target == 'x86_64-uefi' + - name: Download OVMF (ubuntu) + run: | + sudo apt-get update + sudo apt-get install ovmf + mkdir -p edk2-stable202402-r1-bin/x64 + cp /usr/share/OVMF/OVMF_CODE.fd edk2-stable202402-r1-bin/x64/code.fd + cp /usr/share/OVMF/OVMF_VARS.fd edk2-stable202402-r1-bin/x64/vars.fd + if: matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64-uefi' - name: Run VM (hello_world, dev) run: cargo xtask ci qemu --target ${{ matrix.target }} - name: Run VM (hello_world, release) @@ -100,7 +113,7 @@ jobs: - name: Install QEMU run: | sudo apt-get update - sudo apt-get install -y --no-install-recommends qemu-system-x86 ovmf + sudo apt-get install -y --no-install-recommends qemu-system-x86 - uses: actions/checkout@v4 with: lfs: true @@ -118,6 +131,10 @@ jobs: echo "$PWD" >> $GITHUB_PATH ./firecracker --version + - name: Download OVMF + run: | + gh release download edk2-stable202402-r1 --repo rust-osdev/ovmf-prebuilt --pattern 'edk2-stable*-bin.tar.xz' + tar -xvf edk2-stable*-bin.tar.xz edk2-stable202402-r1-bin/x64 - uses: dtolnay/rust-toolchain@stable - name: Run QEMU (hello_world, dev) run: cargo xtask ci qemu --target x86_64 --accel diff --git a/xtask/src/ci/qemu.rs b/xtask/src/ci/qemu.rs index 9d3fd02b..a525e705 100644 --- a/xtask/src/ci/qemu.rs +++ b/xtask/src/ci/qemu.rs @@ -42,11 +42,6 @@ impl Qemu { let sh = crate::sh()?; if self.build.target() == Target::X86_64Uefi { - if super::in_ci() { - sh.copy_file("/usr/share/OVMF/OVMF_CODE.fd", "OVMF_CODE.fd")?; - sh.copy_file("/usr/share/OVMF/OVMF_VARS.fd", "OVMF_VARS.fd")?; - } - sh.create_dir("target/esp/efi/boot")?; sh.copy_file(self.build.dist_object(), "target/esp/efi/boot/bootx64.efi")?; sh.write_file("target/esp/efi/boot/hermit-app", "Hello, UEFI!\n")?; @@ -139,10 +134,10 @@ impl Qemu { Target::X86_64Uefi => { cpu_args.push("-drive".to_string()); cpu_args - .push("if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd".to_string()); + .push("if=pflash,format=raw,readonly=on,file=edk2-stable202402-r1-bin/x64/code.fd".to_string()); cpu_args.push("-drive".to_string()); cpu_args - .push("if=pflash,format=raw,readonly=on,file=OVMF_VARS.fd".to_string()); + .push("if=pflash,format=raw,readonly=on,file=edk2-stable202402-r1-bin/x64/vars.fd".to_string()); cpu_args.push("-drive".to_string()); cpu_args.push("format=raw,file=fat:rw:target/esp".to_string()); }