Use UEFI/EDK2 firmware (qcow2) for riscv64 + QEMU setup

This requires QEMU 8.1 for riscv64 to support UEFI/EDK2 and libvirt
9.2.0+.

No support for ACPI for now.

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
David Abdurachmanov 2023-09-09 08:48:17 +03:00
parent 6a94f4b05a
commit e76ba181b6
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
2 changed files with 31 additions and 2 deletions

View File

@ -1,5 +1,5 @@
diff --git a/oz/Guest.py b/oz/Guest.py
index 9cc80a6..b799cd3 100644
index 9cc80a6..9c5dc1d 100644
--- a/oz/Guest.py
+++ b/oz/Guest.py
@@ -135,7 +135,7 @@ class Guest(object):
@ -29,6 +29,15 @@ index 9cc80a6..b799cd3 100644
mods = {'arch': self.tdl.arch, 'machine': 'virt'}
oz.ozutil.lxml_subelement(osNode, "type", "hvm", mods)
if bootdev:
@@ -497,7 +497,7 @@ class Guest(object):
oz.ozutil.lxml_subelement(osNode, "initrd", initrd)
if cmdline:
oz.ozutil.lxml_subelement(osNode, "cmdline", cmdline)
- if self.tdl.arch in ["aarch64", "armv7l"]:
+ if self.tdl.arch in ["aarch64", "armv7l", "riscv64"]:
loader, nvram = oz.ozutil.find_uefi_firmware(self.tdl.arch)
oz.ozutil.lxml_subelement(osNode, "loader", loader, {'readonly': 'yes', 'type': 'pflash'})
oz.ozutil.lxml_subelement(osNode, "nvram", None, {'template': nvram})
@@ -529,7 +529,7 @@ class Guest(object):
elif self.mousetype == "usb":
mousedict['type'] = 'tablet'
@ -53,6 +62,23 @@ index cb373cb..384b309 100644
self.key = _xml_get_value(self.doc, '/template/os/key', 'OS key',
optional=True)
diff --git a/oz/ozutil.py b/oz/ozutil.py
index 3a861be..b20b8ca 100644
--- a/oz/ozutil.py
+++ b/oz/ozutil.py
@@ -1064,6 +1064,12 @@ def find_uefi_firmware(arch):
'/usr/share/edk2/aarch64/vars-template-pflash.raw'),
UEFI('/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw',
'/usr/share/edk2.git/aarch64/vars-template-pflash.raw')]
+ elif arch in ['riscv64']:
+ uefi_list = [UEFI('/usr/share/edk2/riscv/RISCV_VIRT_CODE.qcow2',
+ '/usr/share/edk2/riscv/RISCV_VIRT_VARS.qcow2'),
+ UEFI('/usr/share/edk2/riscv/RISCV_VIRT_CODE.fd',
+ '/usr/share/edk2/riscv/RISCV_VIRT_VARS.fd')]
+
elif arch in ['armv7l']:
uefi_list = [UEFI('/usr/share/edk2/arm/QEMU_EFI-pflash.raw',
'/usr/share/edk2/arm/vars-template-pflash.raw')]
diff --git a/oz/tdl.rng b/oz/tdl.rng
index dc29c9a..44fb48a 100644
--- a/oz/tdl.rng

View File

@ -1,6 +1,6 @@
Name: oz
Version: 0.18.1
Release: 6.0.riscv64%{?dist}
Release: 6.1.riscv64%{?dist}
Summary: Library and utilities for automated guest OS installs
License: LGPLv2
URL: http://github.com/clalancette/oz
@ -95,6 +95,9 @@ fi
%{python3_sitelib}/%{name}*.egg-info
%changelog
* Sat Sep 09 2023 David Abdurachmanov <davidlt@rivosinc.com> - 0.18.1-6.1.riscv64
- Use UEFI/EDK2 firmware (qcow2) on riscv64 + QEMU setup
* Fri Sep 01 2023 David Abdurachmanov <davidlt@rivosinc.com> - 0.18.1-6.0.riscv64
- Add riscv64 support