On 1/16/20 1:27 PM, Pino Toscano wrote:
Starting with 5.2.0, libvirt has a way to select the firmware by
specifying its type, provided configuration files for the firmware are
shipped. Currently we start the appliance as UEFI if any of the firmware
are found, so instead we can try to just set the firmware type iff:
- the libvirt autoselection works
- the 'efi' firmware is available
The only behaviour change is that the default firmware may be a
non-debug version, so we get no debug messages even when running in
verbose mode. This most probably will need an addition in libvirt to
select this feature among the available firmwares.
Firmware autoselection parses JSON files at well defined locations
giving each file precedence over others based on the path it's found
under and it's name.
The file name precedence is based on alphabetical ordering. That is why
file names usually consists of two leading numbers, e.g. 40-bios.json,
50-ovmf-sb.json, 60-ovmf.json and so on. Now, the default, distro wide
path where these files live is /usr/share/qemu/firmware/ and has the
least precedence. If a sysadmin wants to alter config of some FW blob,
instead of fighting with package manager and overwriting files under
/usr/.. they can put changed versions under /etc/qemu/firmware which
takes precedence over the former path. For instance, if 40-bios.json is
found under both paths, only the one from /etc is considered and the
other is not even parsed. If you would apply this logic one more time,
you will get $HOME/.config/qemu/firmware which allows non-root users to
override their sysadmin's config and have their private FW blobs with
the highest priority.
So if libguestfs wants libvirt to select certain FW image it can install
its own JSON descriptor somewhere into a suitable path and if the file
has the correct content it will direct libvirt into using FW blob with
debug messages enabled.
Pino Toscano (4):
launch: libvirt: parse firmware autoselection
lib: uefi: reset out parameters earlier
lib: allow to use libvirt firmware autoselection
lib: uefi: use the efi libvirt firmware if available
lib/appliance-uefi.c | 32 ++++++++++++++++++++++++++------
lib/guestfs-internal.h | 2 +-
lib/launch-direct.c | 3 ++-
lib/launch-libvirt.c | 40 +++++++++++++++++++++++++++++++++++++++-
4 files changed, 68 insertions(+), 9 deletions(-)
I'm no libguestfs devel, but this looks sane to me.
Michal