I'm emulating an OS on QEMU with Arm64 architecture. I'm trying to add UEFI firmware to the emulation. To do this, I added these lines to my QEMU command:
-drive if=pflash,format=raw,unit=0,file=firmware/uefi/AARCH64_OVMF_CODE.fd,readonly=on \
-drive if=pflash,format=raw,unit=1,file=firmware/uefi/AARCH64_OVMF_VARS.fd \
This gets the UEFI shell to appear in my terminal and in the ramfb display in QEMU's window. But now I have two problems I don't know how to fix yet:
help
, ls
, and exit
does nothing. Nothing happens in the terminal or the ramfb display.BdsDxe: failed to load Boot0001 "UEFI Non-Block Boot Device" from VenMedia(1428F772-B64A-441E-B8C3-9EBDD7F893C7): Not Found
. I think this means UEFI can't find my kernel? I've tried adding my kernel as a drive like this: -drive file=myKernel.img
. But that did not work.Here's my full QEMU command:
qemu-system-aarch64 \
-m 4G -cpu cortex-a76 \
-machine virt,mte=off,virtualization=on,gic-version=3,kernel=myKernel.img \
-display gtk,show-tabs=on,show-cursor=on -device ramfb \
-drive if=pflash,format=raw,unit=0,file=firmware/uefi/AARCH64_OVMF_CODE.fd,readonly=on \
-drive if=pflash,format=raw,unit=1,file=firmware/uefi/AARCH64_OVMF_VARS.fd \
-serial stdio -s -S -rtc base=localtime,clock=host,driftfix=none -smp 8,sockets=2 &
gdb-multiarch \
-ex "set architechture aarch64" \
-ex "file myKernel.elf" \
-ex "target remote 127.0.0.1:1234" \
Here's what the UEFI shell output looks like:
UEFI firmware (version built at 00:08:37 on Jun 14 2024)
BdsDxe: failed to load Boot0001 "UEFI Non-Block Boot Device" from VenMedia(1428F772-B64A-441E-B8C3-9EBDD7F893C7): Not Found
BdsDxe: loading Boot0002 "EFI Internal Shell" from Fv(64074AFE-340A-4BE6-94BA-91B5B4D0F71E)/FvFile(7C04A583-9E3E-4F1C-AD65-E05268D0B4D1)
BdsDxe: starting Boot0002 "EFI Internal Shell" from Fv(64074AFE-340A-4BE6-94BA-91B5B4D0F71E)/FvFile(7C04A583-9E3E-4F1C-AD65-E05268D0B4D1)
UEFI Interactive Shell v2.2
EDK II
UEFI v2.70 (EDK II, 0x00010000)
Mapping table
FS0: Alias(s):F0:
VenMedia(1428F772-B64A-441E-B8C3-9EBDD7F893C7)
Press ESC in 1 seconds to skip startup.nsh or any other key to continue.
Shell> help
ls
exit
FSO:
If anyone has any ideas why either of the errors are happening, or how to fix them, that'd be awesome.
unixsmurf suggested pruning away command-line options that aren't necessary to boot the UEFI shell. I have sinned and should have done this before posting the question. But thanks for the suggestion because it led me to the answer!
All I had to do was change -serial stdio
to -serial vc
. -serial vc
is the graphical mode for the serial port. For some reason the stdio serial port mode did not allow commands to affect the UEFI shell.
Edit
Recently, I've found that I can use -serial stdio
and type directly into the ramfb
if I use the -bios
flag to setup the firmware. But when I setup the firmware as drives, I can only use the -serial vc
window to interact with the UEFI shell.