Skip to content


Building edk2 for Qemu

git clone --depth 1 --branch UDK2018 edk2.UDK2018
cd edk2.UDK2018/OvmfPkg
# apply patch to create 8 MB flash image size option
./ \
      -D FD_SIZE_IN_KB=8192

qemu-system-x86_64 \
      -machine q35,smm=on  \
      -global ICH9-LPC.disable_s3=1 \
      -global driver=cfi.pflash01,property=secure,value=on \
      --serial /dev/tty \
      -drive if=pflash,format=raw,unit=0,file=../Build/OvmfX64/DEBUG_GCC5/FV/nerf-smm.rom

# or to output to a file: -serial file:file.log

To print all instructions executed into a log file for tracing: -d in_asm -D log.txt

Things to investigate

  • How does it compress LZMA regions?
  • Extracting just the pieces that we want
  • Enabling debugging 2018

Last update: November 8, 2020