GSoC 2022: Progress Report 2

7 min read July 24, 2022 #rust #tianocore #gsoc22 #uefi

Hello everyone. It is finally possible to run the whole Rust testing suit for UEFI under QEMU and OVMF. So I think this is a good point to give a detailed overview of everything that has been implemented and the state of those implementations. I will also provide instructions on how to go about running the tests as well.

Running Rust Tests


We will follow the instructions in Running Tests in a Remote Machine.

  1. Clone my fork of Rust source and switch to uefi-std-rebase branch:
git clone
cd rust
git checkout uefi-std-rebase
  1. Make sure that all the dependencies have been met. Try building std for UEFI:
./ build --stage 1 --target x86_64-unknown-uefi
  1. Build remote-test-server:
./ build --stage 1 --target x86_64-unknown-uefi src/tools/remote-test-server

Launch QEMU

Now we have to launch the generated build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server.efi in QEMU. The following options are needed for launching this executable:

  1. Network with port 12345 forwarded
-netdev user,id=net0,hostfwd=tcp::12345-:12345 -device virtio-net-pci,netdev=net0,mac=00:00:00:00:00:00
  1. OVMF:
-drive if=pflash,format=raw,file={Path to OVMF_CODE.fd},index=0 -drive if=pflash,format=raw,file={Path to OVMF_VARS.fd},index=1
  1. UEFI Shell: Not supplying this ISO makes OVMF try to boot from the network first for me, so I do this manually as well:
-drive format=raw,file={Path to UefiShell.iso},index=2
  1. Image containing the executable and a startup.nsh (for automatic startup): I would recommend not using vvfat since it gives a lot of mapping errors in intensive File I/O which is needed in running the tests

All of this can be simplified by using my fork of uefi-run. If you are using that, then it is possible to use the config I am using currently:

qemu-uefi build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-uefi/release/remote-test-server.efi -s 1024 --shell-path UefiShell.iso --vars-path OVMF_VARS.fd -b OVMF_CODE.fd --output-path output.txt -- -netdev user,id=net0,hostfwd=tcp::12345-:12345 -device virtio-net-pci,netdev=net0,mac=00:00:00:00:00:00

The output-path argument passes -serial output.txt since the stderr output is not visible on the VGA buffer for me. However, the output.txt is extremely useful for debugging since all the stderr (Rust panics and aborts) are present in the file with the correct location of panics.

I would also recommend launching the executable with verbose argument.

Run test

Any of the Rust test/s or test folders can be run on the QEMU instance using the following command:

TEST_DEVICE_ADDR="localhost:12345" ./ test src/test/ui/{FILE or Directory} --target x86_64-unknown-uefi --stage 1

Std Implementation Status


Since the first main object to run Rust tests has now been met, I will work on improving/refactoring most of the implementations before trying to merge them to master. It would also be great if more people try out this std and give feedback.

Back to top