Add riscv64 support

Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
David Abdurachmanov 2023-09-01 16:15:46 +03:00
parent 61525a2ca9
commit 6a94f4b05a
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
2 changed files with 74 additions and 1 deletions

67
oz-add-riscv64.patch Normal file
View File

@ -0,0 +1,67 @@
diff --git a/oz/Guest.py b/oz/Guest.py
index 9cc80a6..b799cd3 100644
--- a/oz/Guest.py
+++ b/oz/Guest.py
@@ -135,7 +135,7 @@ class Guest(object):
# for backwards compatibility
self.name = self.tdl.name
- if self.tdl.arch not in ["i386", "x86_64", "ppc64", "ppc64le", "aarch64", "armv7l", "s390x"]:
+ if self.tdl.arch not in ["i386", "x86_64", "ppc64", "ppc64le", "aarch64", "armv7l", "s390x", "riscv64"]:
raise oz.OzException.OzException("Unsupported guest arch " + self.tdl.arch)
if os.uname()[4] in ["i386", "i586", "i686"] and self.tdl.arch == "x86_64":
@@ -259,7 +259,7 @@ class Guest(object):
self.clockoffset = "utc"
self.mousetype = mousetype
if self.mousetype is None:
- if self.tdl.arch in ["aarch64", "armv7l"]:
+ if self.tdl.arch in ["aarch64", "armv7l", "riscv64"]:
self.mousetype = "usb"
else:
self.mousetype = "ps2"
@@ -486,7 +486,7 @@ class Guest(object):
# os
osNode = oz.ozutil.lxml_subelement(domain, "os")
mods = None
- if self.tdl.arch in ["aarch64", "armv7l"]:
+ if self.tdl.arch in ["aarch64", "armv7l", "riscv64"]:
mods = {'arch': self.tdl.arch, 'machine': 'virt'}
oz.ozutil.lxml_subelement(osNode, "type", "hvm", mods)
if bootdev:
@@ -529,7 +529,7 @@ class Guest(object):
elif self.mousetype == "usb":
mousedict['type'] = 'tablet'
oz.ozutil.lxml_subelement(devices, "input", None, mousedict)
- if self.tdl.arch in ["aarch64", "armv7l"]:
+ if self.tdl.arch in ["aarch64", "armv7l", "riscv64"]:
# Other arches add a keyboard by default, for historical reasons ARM doesn't
# so we add it here so graphical works and hence we can get debug screenshots RHBZ 1538637
oz.ozutil.lxml_subelement(devices, 'controller', None, {'type': 'usb', 'index': '0'})
diff --git a/oz/TDL.py b/oz/TDL.py
index cb373cb..384b309 100644
--- a/oz/TDL.py
+++ b/oz/TDL.py
@@ -218,8 +218,8 @@ class TDL(object):
self.arch = _xml_get_value(self.doc, '/template/os/arch',
'OS architecture')
- if self.arch not in ["i386", "x86_64", "ppc64", "ppc64le", "aarch64", "armv7l", "s390x"]:
- raise oz.OzException.OzException("Architecture must be one of 'i386, x86_64, ppc64, ppc64le, armv7l, aarch64, or s390x'")
+ if self.arch not in ["i386", "x86_64", "ppc64", "ppc64le", "aarch64", "armv7l", "s390x", "riscv64"]:
+ raise oz.OzException.OzException("Architecture must be one of 'i386, x86_64, ppc64, ppc64le, armv7l, aarch64, s390x, or riscv64'")
self.key = _xml_get_value(self.doc, '/template/os/key', 'OS key',
optional=True)
diff --git a/oz/tdl.rng b/oz/tdl.rng
index dc29c9a..44fb48a 100644
--- a/oz/tdl.rng
+++ b/oz/tdl.rng
@@ -35,6 +35,7 @@
<value>aarch64</value>
<value>armv7l</value>
<value>s390x</value>
+ <value>riscv64</value>
</choice>
</element>
<optional>

View File

@ -1,6 +1,6 @@
Name: oz
Version: 0.18.1
Release: 6%{?dist}
Release: 6.0.riscv64%{?dist}
Summary: Library and utilities for automated guest OS installs
License: LGPLv2
URL: http://github.com/clalancette/oz
@ -15,6 +15,9 @@ Patch0: 0001-Revert-Don-t-write-kickstart-so-initial-setup-won-t-.patch
# Upstream patch to enable the usb controller for aarch64
Patch1: 0001-Enable-USB-controller-and-keyboard-for-aarch64-for-a.patch
# Add riscv64 support
Patch2: oz-add-riscv64.patch
BuildArch: noarch
BuildRequires: python3
@ -92,6 +95,9 @@ fi
%{python3_sitelib}/%{name}*.egg-info
%changelog
* Fri Sep 01 2023 David Abdurachmanov <davidlt@rivosinc.com> - 0.18.1-6.0.riscv64
- Add riscv64 support
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.18.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild