How do you use the qemu with OVMF.fd?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
benji
Posts: 22
Joined: Fri Nov 23, 2018 10:53 pm
Libera.chat IRC: os student

How do you use the qemu with OVMF.fd?

Post by benji »

As we all know, we can use the qemu to boot the os which supports UEFI. But, When I use the qemu to boot my os, It‘s always stuck in this interface.
ipv4.png
How can I jump this interface?
linguofreak
Member
Member
Posts: 510
Joined: Wed Mar 09, 2011 3:55 am

Re: How do you use the qemu with OVMF.fd?

Post by linguofreak »

We need more information. How are you starting QEMU, and with what options.

It looks like OVMF is attempting to boot from the network (PXE boot). Is this how you intend to boot your OS, or are you booting it from a disk image?
benji
Posts: 22
Joined: Fri Nov 23, 2018 10:53 pm
Libera.chat IRC: os student

Re: How do you use the qemu with OVMF.fd?

Post by benji »

linguofreak wrote:We need more information. How are you starting QEMU, and with what options.

It looks like OVMF is attempting to boot from the network (PXE boot). Is this how you intend to boot your OS, or are you booting it from a disk image?
actually, I don't want qemu boot from network. I just want it skip this step.
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: How do you use the qemu with OVMF.fd?

Post by bzt »

benji wrote:actually, I don't want qemu boot from network. I just want it skip this step.
Go into the UEFI setup screen (by pressing F12 or ESC if I recall correctly), select Boot Manager from the menu and change the boot sequence. If I were you, I'd add EFI Shell too to the list as the last option, that would save you lot of headaches later.

If you are interested, the boot manager in TianoCore is implemented here, and it looks like this:
Image

Cheers,
bzt
benji
Posts: 22
Joined: Fri Nov 23, 2018 10:53 pm
Libera.chat IRC: os student

Re: How do you use the qemu with OVMF.fd?

Post by benji »

bzt wrote:
benji wrote:actually, I don't want qemu boot from network. I just want it skip this step.
Go into the UEFI setup screen (by pressing F12 or ESC if I recall correctly), select Boot Manager from the menu and change the boot sequence. If I were you, I'd add EFI Shell too to the list as the last option, that would save you lot of headaches later.

If you are interested, the boot manager in TianoCore is implemented here, and it looks like this:
Image

Cheers,
bzt
It's useless. Because it only skip this once. I don't want to edit the list each time.
linguofreak
Member
Member
Posts: 510
Joined: Wed Mar 09, 2011 3:55 am

Re: How do you use the qemu with OVMF.fd?

Post by linguofreak »

How are you starting QEMU? Are you starting it from the command line? If so, what is the exact command you're using to start it? Are you using a GUI wrapper like virt-manager to do your setup?
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: How do you use the qemu with OVMF.fd?

Post by zhiayang »

linguofreak wrote:How are you starting QEMU? Are you starting it from the command line? If so, what is the exact command you're using to start it? Are you using a GUI wrapper like virt-manager to do your setup?
Indeed, assuming you downloaded the prebuilt OVMF images, you should run with something like this:

Code: Select all

qemu-system-i386 -bios OVMF-pure-efi.fd <other options>
As far as the changes not persisting, I haven't had that happen to me (even though I just run it like above), but you can look at viewtopic.php?f=1&t=33207 for the options to use.
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: How do you use the qemu with OVMF.fd?

Post by MichaelPetch »

Are you building and running this on a Linux distro?
benji
Posts: 22
Joined: Fri Nov 23, 2018 10:53 pm
Libera.chat IRC: os student

Re: How do you use the qemu with OVMF.fd?

Post by benji »

MichaelPetch wrote:Are you building and running this on a Linux distro?
yes, And I met a problem that is I have a disk with GTP partition. In this disk, I build a test.EFI with edk2 in uefi.hd. Now, I want to qemu run my test.EFI directly. I don't want to qemu drop into UEFI shell each time. How do I do? This is How I run qemu with ovmf.fd:

Code: Select all

qemu-system-x86_64 -bios OVMF.fd -hda uefi.hd -net none
Attachments
Screenshot from 2019-10-11 15-56-45.png
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: How do you use the qemu with OVMF.fd?

Post by zhiayang »

If you want your OS or UEFI program to run "automatically", then AFAIK it must be placed in /EFI/BOOT/BOOTX64.EFI (or maybe BOOTX86.EFI for 32-bit), and you must setup the boot order in the configuration appropriately.

Alternatively you can probably find a way to write to the NVRAM of the machine and modify the "default" path that it looks for the EFI (I think this is possible on real machines, [remembered rEFInd doing something like that?] but not sure about QEMU).
Post Reply