Skip to content

qemu: Using -bios for firmware does not work with OVMF firmware  #1231

@c3d

Description

@c3d

Get your issue reviewed faster

From code inspection, this applies to both the 1.x and 2.0 branches equally.

Description of problem

When using the firmware configuration option, the runtime translates that into a -bios command-line option for qemu. This will not work with an OVMF firmware, which also needs separate OVMF_CODE.fd for the read-only portion of the firmware and OVMF_VARS.fd for the associated variables.

Expected result

For an OVMF firmware, you'd expect the qemu command line to contain two entries, one for the read-only section of the firmware (OVMF_CODE.fd) and one for the read-write portion (OVMF_VARS.fd). This is typically done using:

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

See fuller story here, for example: https://wiki.debian.org/SecureBoot/VirtualMachine

Actual result

The current code generates the simpler -bios option that looks like:

-bios /path/to/OVMF_CODE.fd

In that case, qemu will most likely not know how to find the related OVMF_VARS.fd. This may or may not be important.

Further information

Example of command-line option with an OVMF firmware:

-name sandbox-csh -uuid a9ecf610-ebb5-42b4-bd8c-d72445f60601 -machine q35,accel=kvm,kernel_irqchip -cpu host,pmu=off -qmp unix:/run/vc/vm/csh/qmp.sock,server,nowait -m 2048M,slots=10,maxmem=129755M -device pci-bridge,bus=pcie.0,id=pci-bridge-0,chassis_nr=1,shpc=on,addr=2,romfile= -device virtio-serial-pci,disable-modern=false,id=serial0,romfile= -device virtconsole,chardev=charconsole0,id=console0 -chardev socket,id=charconsole0,path=/run/vc/vm/csh/console.sock,server,nowait -device virtio-scsi-pci,id=scsi0,disable-modern=false,romfile= -object rng-random,id=rng0,filename=/dev/urandom -device virtio-rng-pci,rng=rng0,romfile= -device vhost-vsock-pci,disable-modern=false,vhostfd=3,id=vsock-3113278101,guest-cid=3113278101,romfile= -device virtio-9p-pci,disable-modern=false,fsdev=extra-9p-kataShared,mount_tag=kataShared,romfile= -fsdev local,id=extra-9p-kataShared,path=/run/kata-containers/shared/sandboxes/csh/shared,security_model=none,multidevs=remap -rtc base=utc,driftfix=slew,clock=host -global kvm-pit.lost_tick_policy=discard -vga none -no-user-config -nodefaults -nographic --no-reboot -daemonize -object memory-backend-ram,id=dimm1,size=2048M -numa node,memdev=dimm1 -kernel /usr/share/kata-containers/vmlinuz-sev-es-5.6-v3.container -initrd /usr/share/kata-containers/kata-containers-initrd.img -append tsc=reliable no_timer_check rcupdate.rcu_expedited=1 i8042.direct=1 i8042.dumbkbd=1 i8042.nopnp=1 i8042.noaux=1 noreplace-smp reboot=k console=hvc0 console=hvc1 cryptomgr.notests net.ifnames=0 pci=lastbus=0 quiet panic=1 nr_cpus=240 scsi_mod.scan=none root=/dev/vda1 rootflags=data=ordered,errors=remount-ro agent.log=debug initcall_debug -bios /usr/local/share/qemu/OVMF_CODE.fd.kata -pidfile /run/vc/vm/csh/pid -smp 1,cores=1,threads=1,sockets=240,maxcpus=240

Metadata

Metadata

Assignees

Labels

area/QEMUIssues specific to the qemu hypervisorbugIncorrect behaviourlow-priorityLow-priority issues

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions