QEMU

Note

Last Update: 2025-01-01 (Wed.)

Boot from QEMU System

Basic Command

qemu-system-x86_64 \
  -bios <BIOS_ROM_IMAGE> \
  -debugcon file:<DEBUG_LOG_PATH> \
  -global isa-debugcon.iobase=0x402 \
  -fw_cfg name=opt/org.tianocore/X-Cpuhp-Bugcheck-Override,string=yes \
  -display none \
  -vnc :0

Simulate the USB Device

Tip

Refer the QEMU USB Emulation document to see the usage.

  -drive if=none,id=stick,format=raw,file=USB.img \
  -device nec-usb-xhci,id=xhci \
  -device usb-storage,bus=xhci.0,drive=stick

Boot to setup option with USB device

Boot to UEFI shell with USB device

Create USB Image (FAT32)

Linux

Tip

Use the command losetup to see the whole loop device.

Create the Blank Image

dd if=/dev/zero of=USB.img iflag=fullblock bs=1M count=100 && sync

Format the Image as FAT

mkfs.vfat USB.img

Mount the Image

sudo mkdir /mnt/VirtualImg
sudo mount -o loop USB.img /mnt/VirtualImg
sudo umount /mnt/VirtualImg