Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 577818 - sys-boot/ovmf: new package request (UEFI firmware for qemu/kvm)
Summary: sys-boot/ovmf: new package request (UEFI firmware for qemu/kvm)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement
Assignee: Matthias Maier
URL: http://www.tianocore.org/ovmf/
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-20 05:14 UTC by Michael Jones
Modified: 2018-06-10 03:51 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ebuild for sys-firmware/edk2-ovmf (edk2-ovmf-20160901.ebuild,2.06 KB, text/plain)
2016-09-14 12:16 UTC, Mekong
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Jones 2016-03-20 05:14:19 UTC
This feature would allow for guest virtual machines to boot using UEFI instead of BIOS.

Some interesting links:

http://www.wordmark.org/UefiGentoo.html
https://gpo.zugaina.org/app-misc/edk2-git-ovmf-x64
https://github.com/coreos/coreos-overlay/tree/master/sys-firmware/edk2-ovmf
Comment 1 SpanKY gentoo-dev 2016-03-28 20:49:52 UTC
what exactly is it you're asking for here ?  a new ebuild for the UEFI roms ?
i don't see any changes required for qemu itself.
Comment 2 Michael Jones 2016-03-28 20:51:06 UTC
A useflag for the qemu ebuild that grabs the ovmf / uefi binaries and installs them where qemu/libvirt look for them.
Comment 3 SpanKY gentoo-dev 2016-03-28 21:36:11 UTC
(In reply to Michael Jones from comment #2)

we don't generally add USE flags whose only purpose is to install packages that can get used at runtime via command line switches.

looks like adding a new ebuild that builds/installs OVMF binaries is sufficient.
Comment 4 Michael Jones 2016-03-28 22:01:20 UTC
I'm fine with that. Thank you for taking a look at it.
Comment 5 Doug Goldstein (RETIRED) gentoo-dev 2016-03-29 16:19:52 UTC
(In reply to SpanKY from comment #3)
> (In reply to Michael Jones from comment #2)
> 
> we don't generally add USE flags whose only purpose is to install packages
> that can get used at runtime via command line switches.
> 
> looks like adding a new ebuild that builds/installs OVMF binaries is
> sufficient.

This has been on my radar for a while now but there were some pieces missing a while back and I've been busy but this is exactly what we need to do. Similarly to the change in the SeaBIOS build to make the 128k and 256k BIOS... tangent I know.
Comment 6 Michael Jones 2016-09-09 20:48:52 UTC
I just configured my system to use the OVMF roms from TianoCore for Qemu / LibVirt.

One detail of note is that, by default, libvirt doesn't know about the existance of the OVMF package. So a user who simply installs the firmware won't be able to start using them right away. Instead, the system admin would need to change the nvram variable in /etc/libvirt/qemu.conf.

A sample ebuild installing a binary very of the ovmf firmware, from some kind persons nightly build machine:

EAPI=5

inherit eutils rpm

BUILD="0-${PV}.b2125.g1f8f4e3"
MY_PN=${PN/-/.}
DESCRIPTION="TianoCore EDK2 OVMF Binary images by Gerd Hoffman"
HOMEPAGE=""
SRC_URI="https://www.kraxel.org/repos/jenkins/edk2/${MY_PN}-${BUILD}.noarch.rpm"
LICENSE="as-is"
SLOT="0"
KEYWORDS="amd64"
IUSE=""

DEPEND="${DEPEND}"
RDEPEND=""

S="${WORKDIR}"
RESTRICT="strip"


src_install() {

	# Removing links of file we don't need, we just want the OVF image
	rm -rfv "${S}"/usr/share/edk2.git/ovmf-x64/*.bin
	rm -rfv "${S}"/usr/share/edk2.git/ovmf-x64/*.rom

	insinto /usr/share
	doins -r "${S}"/usr/share/*
}





A snippet of my /etc/libvirt/qemu.conf file, for the nvram variable:

# Location of master nvram file
#
# When a domain is configured to use UEFI instead of standard
# BIOS it may use a separate storage for UEFI variables. If
# that's the case libvirt creates the variable store per domain
# using this master file as image. Each UEFI firmware can,
# however, have different variables store. Therefore the nvram is
# a list of strings when a single item is in form of:
#   ${PATH_TO_UEFI_FW}:${PATH_TO_UEFI_VARS}.
# Later, when libvirt creates per domain variable store, this list is
# searched for the master image. The UEFI firmware can be called
# differently for different guest architectures. For instance, it's OVMF
# for x86_64 and i686, but it's AAVMF for aarch64. The libvirt default
# follows this scheme.
#nvram = [
#   "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd",
#   "/usr/share/AAVMF/AAVMF_CODE.fd:/usr/share/AAVMF/AAVMF_VARS.fd"
#]

nvram = [
   "/usr/share/edk2.git/ovmf-x64/OVMF_CODE-need-smm.fd:/usr/share/edk2.git/ovmf-x64/OVMF_VARS-need-smm.fd",
   "/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd:/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd",
   "/usr/share/edk2.git/ovmf-x64/OVMF_CODE-with-csm.fd:/usr/share/edk2.git/ovmf-x64/OVMF_VARS-with-csm.fd"
]




Restarting libvirtd, and reconnecting with Virt-Manager allowed me to create a new virtual machine with the UEFI firmware.
Comment 7 Mekong 2016-09-14 12:16:27 UTC
Created attachment 445678 [details]
ebuild for sys-firmware/edk2-ovmf

I use this ebuild in my overlay. It can not be built with hardened toolchains, and it can be patched to be built but I'm to lazy to update the patch. Instead I'm using hardnednopie gcc profile with this specific package.