Qemu command


Peter Wiehe <info@...>
 

Hello,

can You tell me what qemu command is used to run OVMF?


Thanks in advance

Peter


Tomas Pilar (tpilar)
 

Hi Peter,

This pair of options should do the trick:

-drive if=pflash,format=raw,readonly,file=path/to/OVMF_CODE.fd
-drive if=pflash,format=raw,file=path/to/OVMF_VARS.fd

Note that the OVMF_CODE is mounted using read only - it consists of the code part of the built platform, while the OVMF_VARS is the EFI variable store, and hence is mounted using read/write.

Cheers,
Tom

-----Original Message-----
From: discuss@edk2.groups.io <discuss@edk2.groups.io> On Behalf Of Peter Wiehe via groups.io
Sent: 17 June 2020 01:20
To: discuss@edk2.groups.io
Subject: [edk2-discuss] Qemu command

Hello,

can You tell me what qemu command is used to run OVMF?


Thanks in advance

Peter




IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Laszlo Ersek
 

On 06/17/20 02:20, Peter Wiehe wrote:
Hello,

can You tell me what qemu command is used to run OVMF?
Use whatever qemu-system-x86_64 command you would otherwise use, with
the following remarks:

(1) Do not use "-bios" or "-L".

(2) Do not use "-boot", in general. Special cases you can use:

-boot menu=on

-boot menu=on,splash-time=N

(See the QEMU manual for these.)

(3) For specifying a UEFI boot order for bootable devices, use the
"bootindex" device property. For example:

-device virtio-scsi-pci,id=scsi0 \
-device scsi-hd,drive=drive0,bus=scsi0.0,bootindex=0 \
-device scsi-cd,drive=drive1,bus=scsi0.0,bootindex=1 \
-device virtio-net-pci,netdev=net0,bootindex=2 \

The above would attempt booting first from a virtio-scsi hard disk, then
from a virtio-scsi CD-ROM, then from the network (PXEv4, PXEv6,
HTTP(S)v4, HTTP(S)v6).

(4) if you want your virtual machine to persistently save the
non-volatile UEFI variables across QEMU invocations, then copy the
OVMF_VARS.fd file to a separate file (such as "my-vars.fd") *before* you
first launch the virtual machine.

Then, use the following QEMU options:

-drive if=pflash,format=raw,unit=0,file=OVMF_CODE.fd,readonly=on \
-drive if=pflash,format=raw,unit=1,file=my-vars.fd \

(5) If you don't care about the above kind of persistence, then you can use:

-drive if=pflash,format=raw,unit=0,file=OVMF_CODE.fd,readonly=on \
-drive if=pflash,format=raw,unit=1,file=OVMF_VARS.fd,snapshot=on \

(6) It's recommended to capture the firmware debug log (if you report a
problem, that's the first thing we ask for):

-debugcon file:debug.log \
-global isa-debugcon.iobase=0x402 \

(7) if you run an OVMF binary built with "-D SMM_REQUIRE", then add the
following too:

-machine q35,smm=on \
-global driver=cfi.pflash01,property=secure,value=on \

(8) Do not use "usb-uas" or "usb-bot" device models. If you absolutely
need USB mass storage in the guest, use "usb-storage". See commit
f9c59fa44ae2.


If you don't insist on the raw QEMU command line, then I strongly
suggest using OVMF with libvirt.

Thanks
Laszlo


Bob Feng
 

-----Original Message-----
From: discuss@edk2.groups.io <discuss@edk2.groups.io> On Behalf Of Peter Wiehe
Sent: Wednesday, June 17, 2020 8:20 AM
To: discuss@edk2.groups.io
Subject: [edk2-discuss] Qemu command

Hello,

can You tell me what qemu command is used to run OVMF?


Thanks in advance

Peter


Laszlo Ersek
 

On 06/25/20 22:47, Peter Wiehe wrote:
On 25.06.20 13:05, Laszlo Ersek wrote:
On 06/17/20 02:20, Peter Wiehe wrote:
Hello,

can You tell me what qemu command is used to run OVMF?
Use whatever qemu-system-x86_64 command you would otherwise use, with
the following remarks:

(1) Do not use "-bios" or "-L".
Thanks to all for the helpful replies!

But why shouldn't I use "-bios"?
Because the UEFI variable store needs to exist in an emulated flash
chip, and "-bios" doesn't do that.

If you use "-bios", OVMF can only fake the UEFI variable runtime
services for the guest in such a way that does not meet the UEFI spec.

People should have stopped using "-bios" with OVMF since QEMU 1.6 (that
means 2013-08-15). I've several times considered killing "-bios" support
in OVMF altogether, but I'm just too annoyed at the thought of having to
explain myself to every (mistaken) "-bios" user.

So for now it's only the -D SMM_REQUIRE build of OVMF that forces users
-- for technical reasons, and not because I'm a pedant -- to use pflash
rather than "-bios".

Laszlo


Peter Wiehe <info@...>
 

On 25.06.20 13:05, Laszlo Ersek wrote:
On 06/17/20 02:20, Peter Wiehe wrote:
Hello,

can You tell me what qemu command is used to run OVMF?
Use whatever qemu-system-x86_64 command you would otherwise use, with
the following remarks:

(1) Do not use "-bios" or "-L".
Thanks to all for the helpful replies!

But why shouldn't I use "-bios"?


Greetings

Peter