Skip to content

Commit

Permalink
ci(uefi): use ovmf-prebuilt images
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
  • Loading branch information
mkroening committed May 14, 2024
1 parent 444d38c commit 30f66c8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 2 additions & 7 deletions xtask/src/ci/qemu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")?;
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit 30f66c8

Please sign in to comment.