Re: Could not load PC BIOS


Laszlo Ersek
 

On 10/24/19 16:19, Peter Wiehe wrote:
Hello Tianocore list,

I am trying (with Qemu) to emulate an UEFI 64bit PC that boots from a
virtual CD and installs an OS on a virtual HD.

But I get always an error (See below).

I use:

- Xubuntu 18.04 LTS

- qemu-system-x86_64: QEMU emulator version 2.11.1(Debian
1:2.11+dfsg-1ubuntu7.19)

- gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010

I followed your instructions in the documentation about building and
installing edk2. I tried to download OVMF repo with yum and did set
both targets IA32 and x86_64.

The emulation command I enter is:*
*

*qemu-system-x86_64 -L . -drive format=raw,file=hd.img,readonly=off
-cdrom os.iso -net none -bios bios.bin -m 1G*

The OS-CD-ISO is Haiku if that matters. You probably want more
information, but I don't know what else I can tell you.

I get the following outpout:

*qemu-system-x86_64: warning: TCG doesn't support requested feature:
CPUID.01H:ECX.vmx [bit 5]**
**qemu: could not load PC BIOS 'bios.bin'*

The first line is just a warning, so it's probably not important (I
hope). But the last line is bad. I also tried without "-L .". DIdn't
work either.

What can I do? Do I have to build OVMF from source? Or how precisely
can I find the OVMF "BIOS" file?

Or maybe it isn't a Tianocore problem, but a Qemu bug?
First, let me see the contents of the OVMF package that your distro
offers... You mention Xubuntu 18.04 LTS, I think that means "bionic":

https://packages.ubuntu.com/

Then, we have:

https://packages.ubuntu.com/bionic/all/ovmf/filelist

So you got

/usr/share/OVMF/OVMF_CODE.fd
/usr/share/OVMF/OVMF_VARS.fd

Seems OK.

Assuming you want to use the raw QEMU command line, here's what you
should run:

VM=my-virtual-machine
ISO=/path/to/Haiku-OS.iso

# create a private variable store file for the VM, from the
# template, if such a variable store does not exist yet for the VM
if ! test -e "$VM.varstore"; then
cp /usr/share/OVMF/OVMF_VARS.fd "$VM.varstore"
fi

# create the virtual disk image if it doesn't exist yet
if ! test -e "$VM.qcow2"; then
qemu-img create -f qcow2 "$VM.qcow2" 20G
fi

qemu-system-x86_64 \
-m 1024 \
-smp 2 \
-machine pc,accel=kvm \
\
-boot menu=on,splash-time=5000 \
\
-drive if=pflash,unit=0,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \
-drive if=pflash,unit=1,format=raw,file="$VM.varstore" \
\
-debugcon file:"$VM.ovmf.log" \
-global isa-debugcon.iobase=0x402 \
\
-drive id=disk,if=none,format=qcow2,file="$VM.qcow2" \
-drive id=cdrom,if=none,format=raw,readonly,file="$ISO" \
\
-device ide-hd,bus=ide.0,unit=0,drive=disk,bootindex=0 \
-device ide-cd,bus=ide.0,unit=1,drive=cdrom,bootindex=1

With this command line, OVMF will attempt to boot the disk first, and if
that fails, attempt to boot the ISO. You can use this to install the OS
from the ISO to the disk, and then continue booting from the disk.

The OVMF log will be written to "$VM.ovmf.log".

Thanks
Laszlo

Join discuss@edk2.groups.io to automatically receive all group messages.