Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
QEMU-libvirt UEFI VM? [Solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7236
Location: almost Mile High in the USA

PostPosted: Mon Jul 17, 2017 8:09 am    Post subject: QEMU-libvirt UEFI VM? [Solved] Reply with quote

Is there a Gentoo sanctioned way of using libvirt to setup a QEMU VM that boots UEFI firmware, so I can experiment with efibootmgr on a VM?

My host machine does not support UEFI, though this theoretically shouldn't matter...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?


Last edited by eccerr0r on Tue Jul 18, 2017 7:05 am; edited 1 time in total
Back to top
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1764

PostPosted: Mon Jul 17, 2017 8:14 pm    Post subject: Reply with quote

Host machine does not matter. AFAIK you have to patch UEFI mode into qemu though.
It's been this way for a long time.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7236
Location: almost Mile High in the USA

PostPosted: Mon Jul 17, 2017 11:19 pm    Post subject: Reply with quote

Is it just a maintainer issue or is this due to licensing issues? Probably the latter?
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
mutiny
n00b
n00b


Joined: 06 Aug 2014
Posts: 14

PostPosted: Tue Jul 18, 2017 4:45 am    Post subject: Reply with quote

Not sure what "Gentoo sanctioned" would imply, but isn't this what you can do with OVMF? It seems OVMF got its own ebuild in gentoo recently so you don't need to build from edk on your own. If you use virsh to edit a domain, you would have the OVMF binary in <loader type='pflash'>OVMF_CODE.fd</loader> under <os> I think.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7236
Location: almost Mile High in the USA

PostPosted: Tue Jul 18, 2017 5:58 am    Post subject: Reply with quote

Ah, I see a lot of other distros want to install the ovmf firmware separately, did not know that it got added to portage recently. I'll have to try it then... For searchers it's sys-firmware/edk2-ovmf ...

Hopefully now I have a throwaway UEFI "machine" to play with now :D

---

Information for those interested for those using libvirt:

Apparently the UEFI firmware requires that you're using the Q35 emulated chipset instead of the 440FX. However the libvirt config file is kind of detailed so you can't easily switch from from 440FX to Q35, so it's easiest to create a new VM. Anyway:

# emerge sys-firmware/edk2-ovmf
# ln -s /usr/share/edk2-ovmf /usr/share/OVMF
# restart libvirtd

Now using virt-manager you can create a new virtual machine. Customize before install and there should be an option to switch to Q35 chipset, and also specify the uefi firmware.

Then just start the machine. Upon successful firmware start... this is what I'm stoked about: EFI-SHELL is built in the OVMF firmware! I wish more real hardware has it installed in firmware.

(or follow what Portage says):
Run via command line
$ qemu-system-x86_64 -drive file=/usr/share/edk2-ovmf/OVMF.fd,if=pflash,format=raw,unit=0,readonly=on ...

Or using libvirt:
* You can register the firmware for use in libvirt by adding to /etc/libvirt/qemu.conf:
* nvram = [
* "/usr/share/edk2-ovmf/OVMF_CODE.fd:/usr/share/edk2-ovmf/OVMF_VARS.fd"
* ]
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Fitap
Apprentice
Apprentice


Joined: 13 Mar 2011
Posts: 242
Location: Rosario, Argentina

PostPosted: Sat Jul 07, 2018 3:53 pm    Post subject: Reply with quote

Hi, did you see this link?

https://fedoraproject.org/wiki/Using_UEFI_with_QEMU

Regards.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum