Add riscv64 support
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
This commit is contained in:
parent
cdb2169949
commit
e8e15a39d4
|
@ -4,7 +4,7 @@
|
|||
|
||||
Name: lorax
|
||||
Version: 38.12
|
||||
Release: 1%{?dist}
|
||||
Release: 1.0.riscv64%{?dist}
|
||||
Summary: Tool for creating the anaconda install images
|
||||
|
||||
License: GPL-2.0-or-later
|
||||
|
@ -15,6 +15,8 @@ URL: https://github.com/weldr/lorax
|
|||
# tito build --tgz
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
Patch1: lorax_riscv.patch
|
||||
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-setuptools
|
||||
BuildRequires: make
|
||||
|
@ -168,6 +170,9 @@ make DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir} install
|
|||
%{_datadir}/lorax/templates.d/*
|
||||
|
||||
%changelog
|
||||
* Thu Aug 31 2023 David Abdurachmanov <davidlt@rivosinc.com> 38.12-1.0.riscv64
|
||||
- Add riscv64 support
|
||||
|
||||
* Wed Aug 09 2023 Brian C. Lane <bcl@redhat.com> 38.12-1
|
||||
- Exclude more obsoleted libertas firmware packages (awilliam@redhat.com)
|
||||
|
||||
|
|
|
@ -0,0 +1,367 @@
|
|||
diff --git a/share/templates.d/99-generic/config_files/riscv64/boot.msg b/share/templates.d/99-generic/config_files/riscv64/boot.msg
|
||||
new file mode 100644
|
||||
index 0000000..ff54899
|
||||
--- /dev/null
|
||||
+++ b/share/templates.d/99-generic/config_files/riscv64/boot.msg
|
||||
@@ -0,0 +1,5 @@
|
||||
+
|
||||
+splash.lss
|
||||
+
|
||||
+ - Press the 01<ENTER>07 key to begin the installation process.
|
||||
+
|
||||
diff --git a/share/templates.d/99-generic/config_files/riscv64/grub2-efi.cfg b/share/templates.d/99-generic/config_files/riscv64/grub2-efi.cfg
|
||||
new file mode 100644
|
||||
index 0000000..1ce5d33
|
||||
--- /dev/null
|
||||
+++ b/share/templates.d/99-generic/config_files/riscv64/grub2-efi.cfg
|
||||
@@ -0,0 +1,46 @@
|
||||
+set default="1"
|
||||
+
|
||||
+function load_video {
|
||||
+ if [ x$feature_all_video_module = xy ]; then
|
||||
+ insmod all_video
|
||||
+ else
|
||||
+ insmod efi_gop
|
||||
+ insmod efi_uga
|
||||
+ insmod ieee1275_fb
|
||||
+ insmod vbe
|
||||
+ insmod vga
|
||||
+ insmod video_bochs
|
||||
+ insmod video_cirrus
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+load_video
|
||||
+set gfxpayload=keep
|
||||
+insmod gzio
|
||||
+insmod part_gpt
|
||||
+insmod ext2
|
||||
+
|
||||
+set timeout=60
|
||||
+### END /etc/grub.d/00_header ###
|
||||
+
|
||||
+search --no-floppy --set=root -l '@ISOLABEL@'
|
||||
+
|
||||
+### BEGIN /etc/grub.d/10_linux ###
|
||||
+menuentry 'Install @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os {
|
||||
+ linux @KERNELPATH@ @ROOT@ ro
|
||||
+ initrd @INITRDPATH@
|
||||
+}
|
||||
+menuentry 'Test this media & install @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os {
|
||||
+ linux @KERNELPATH@ @ROOT@ rd.live.check
|
||||
+ initrd @INITRDPATH@
|
||||
+}
|
||||
+submenu 'Troubleshooting -->' {
|
||||
+ menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class red --class gnu-linux --class gnu --class os {
|
||||
+ linux @KERNELPATH@ @ROOT@ nomodeset
|
||||
+ initrd @INITRDPATH@
|
||||
+ }
|
||||
+ menuentry 'Rescue a @PRODUCT@ system' --class red --class gnu-linux --class gnu --class os {
|
||||
+ linux @KERNELPATH@ @ROOT@ inst.rescue
|
||||
+ initrd @INITRDPATH@
|
||||
+ }
|
||||
+}
|
||||
diff --git a/share/templates.d/99-generic/live/config_files/riscv64/grub2-efi.cfg b/share/templates.d/99-generic/live/config_files/riscv64/grub2-efi.cfg
|
||||
new file mode 100644
|
||||
index 0000000..c874547
|
||||
--- /dev/null
|
||||
+++ b/share/templates.d/99-generic/live/config_files/riscv64/grub2-efi.cfg
|
||||
@@ -0,0 +1,42 @@
|
||||
+set default="1"
|
||||
+
|
||||
+function load_video {
|
||||
+ if [ x$feature_all_video_module = xy ]; then
|
||||
+ insmod all_video
|
||||
+ else
|
||||
+ insmod efi_gop
|
||||
+ insmod efi_uga
|
||||
+ insmod ieee1275_fb
|
||||
+ insmod vbe
|
||||
+ insmod vga
|
||||
+ insmod video_bochs
|
||||
+ insmod video_cirrus
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+load_video
|
||||
+set gfxpayload=keep
|
||||
+insmod gzio
|
||||
+insmod part_gpt
|
||||
+insmod ext2
|
||||
+
|
||||
+set timeout=60
|
||||
+### END /etc/grub.d/00_header ###
|
||||
+
|
||||
+search --no-floppy --set=root -l '@ISOLABEL@'
|
||||
+
|
||||
+### BEGIN /etc/grub.d/10_linux ###
|
||||
+menuentry 'Start @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os {
|
||||
+ linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image quiet rhgb
|
||||
+ initrd @INITRDPATH@
|
||||
+}
|
||||
+menuentry 'Test this media & start @PRODUCT@ @VERSION@' --class red --class gnu-linux --class gnu --class os {
|
||||
+ linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image rd.live.check quiet
|
||||
+ initrd @INITRDPATH@
|
||||
+}
|
||||
+submenu 'Troubleshooting -->' {
|
||||
+ menuentry 'Install @PRODUCT@ @VERSION@ in basic graphics mode' --class red --class gnu-linux --class gnu --class os {
|
||||
+ linux @KERNELPATH@ @ROOT@ @EXTRA@ rd.live.image nomodeset quiet rhgb
|
||||
+ initrd @INITRDPATH@
|
||||
+ }
|
||||
+}
|
||||
diff --git a/share/templates.d/99-generic/live/live-install.tmpl b/share/templates.d/99-generic/live/live-install.tmpl
|
||||
index ef514ee..2367d1d 100644
|
||||
--- a/share/templates.d/99-generic/live/live-install.tmpl
|
||||
+++ b/share/templates.d/99-generic/live/live-install.tmpl
|
||||
@@ -6,6 +6,10 @@
|
||||
installpkg efibootmgr
|
||||
installpkg grub2-efi-aa64-cdboot shim-aa64
|
||||
%endif
|
||||
+%if basearch == "riscv64":
|
||||
+ installpkg efibootmgr
|
||||
+ installpkg grub2-efi-riscv64-cdboot
|
||||
+%endif
|
||||
%if basearch == "x86_64":
|
||||
installpkg grub2-tools-efi
|
||||
installpkg efibootmgr
|
||||
diff --git a/share/templates.d/99-generic/live/riscv64.tmpl b/share/templates.d/99-generic/live/riscv64.tmpl
|
||||
new file mode 100644
|
||||
index 0000000..6d8784d
|
||||
--- /dev/null
|
||||
+++ b/share/templates.d/99-generic/live/riscv64.tmpl
|
||||
@@ -0,0 +1,84 @@
|
||||
+<%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel, extra_boot_args"/>
|
||||
+<%
|
||||
+configdir="tmp/config_files/riscv64"
|
||||
+PXEBOOTDIR="images/pxeboot"
|
||||
+KERNELDIR=PXEBOOTDIR
|
||||
+LIVEDIR="LiveOS"
|
||||
+LORAXDIR="usr/share/lorax/"
|
||||
+
|
||||
+## Don't allow spaces or escape characters in the iso label
|
||||
+def valid_label(ch):
|
||||
+ return ch.isalnum() or ch == '_'
|
||||
+
|
||||
+isolabel = ''.join(ch if valid_label(ch) else '-' for ch in isolabel)
|
||||
+
|
||||
+import os
|
||||
+from os.path import basename
|
||||
+from pylorax.sysutils import joinpaths
|
||||
+
|
||||
+# Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3
|
||||
+if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3:
|
||||
+ isoargs = "-iso-level 3"
|
||||
+else:
|
||||
+ isoargs = ""
|
||||
+%>
|
||||
+
|
||||
+mkdir ${LIVEDIR}
|
||||
+install ${runtime_img} ${LIVEDIR}/squashfs.img
|
||||
+treeinfo stage2 mainimage ${LIVEDIR}/squashfs.img
|
||||
+
|
||||
+## install kernels
|
||||
+mkdir ${KERNELDIR}
|
||||
+%for kernel in kernels:
|
||||
+ ## normal aarch64
|
||||
+ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
||||
+ installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
||||
+%endfor
|
||||
+
|
||||
+#FIXME: this will need adjusted when we have a real bootloader.
|
||||
+## WHeeeeeeee, EFI.
|
||||
+## We could remove the basearch restriction someday..
|
||||
+<% efiargs=""; efigraft="" %>
|
||||
+%if exists("boot/efi/EFI/*/gcdriscv64.efi"):
|
||||
+ <%
|
||||
+ efiarch32 = None
|
||||
+ efiarch64 = 'riscv64'
|
||||
+ efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot)
|
||||
+ images = ["images/efiboot.img"]
|
||||
+ %>
|
||||
+ %for img in images:
|
||||
+ <%
|
||||
+ efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img)
|
||||
+ efigraft += " {0}={1}/{0}".format(img,outroot)
|
||||
+ %>
|
||||
+ treeinfo images-${basearch} ${img|basename} ${img}
|
||||
+ %endfor
|
||||
+ <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel, extra_boot_args=extra_boot_args"/>
|
||||
+%endif
|
||||
+
|
||||
+# Create optional product.img and updates.img
|
||||
+<% filegraft=""; images=["product", "updates"] %>
|
||||
+%for img in images:
|
||||
+ %if exists("%s/%s/" % (LORAXDIR, img)):
|
||||
+ installimg ${LORAXDIR}/${img}/ images/${img}.img
|
||||
+ treeinfo images-${basearch} ${img}.img images/${img}.img
|
||||
+ <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
|
||||
+ %endif
|
||||
+%endfor
|
||||
+
|
||||
+# Add the license files
|
||||
+%for f in glob("usr/share/licenses/*-release-common/*"):
|
||||
+ install ${f} ${f|basename}
|
||||
+ <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
|
||||
+%endfor
|
||||
+
|
||||
+%if exists("boot/efi/EFI/*/gcdriscv64.efi"):
|
||||
+## make boot.iso
|
||||
+runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \
|
||||
+ ${efiargs} -R -J -V '${isolabel}' \
|
||||
+ -graft-points \
|
||||
+ ${KERNELDIR}=${outroot}/${KERNELDIR} \
|
||||
+ ${LIVEDIR}=${outroot}/${LIVEDIR} \
|
||||
+ ${efigraft} ${filegraft}
|
||||
+treeinfo images-${basearch} boot.iso images/boot.iso
|
||||
+%endif
|
||||
diff --git a/share/templates.d/99-generic/riscv64.tmpl b/share/templates.d/99-generic/riscv64.tmpl
|
||||
new file mode 100644
|
||||
index 0000000..4edee89
|
||||
--- /dev/null
|
||||
+++ b/share/templates.d/99-generic/riscv64.tmpl
|
||||
@@ -0,0 +1,86 @@
|
||||
+<%page args="kernels, runtime_img, basearch, inroot, outroot, product, isolabel"/>
|
||||
+<%
|
||||
+configdir="tmp/config_files/riscv64"
|
||||
+PXEBOOTDIR="images/pxeboot"
|
||||
+KERNELDIR=PXEBOOTDIR
|
||||
+STAGE2IMG="images/install.img"
|
||||
+LORAXDIR="usr/share/lorax/"
|
||||
+
|
||||
+import os
|
||||
+from os.path import basename
|
||||
+from pylorax.sysutils import joinpaths
|
||||
+
|
||||
+# Test the runtime_img, if it is > 4GiB we need to set -iso-level to 3
|
||||
+if os.stat(joinpaths(inroot, runtime_img)).st_size >= 4*1024**3:
|
||||
+ isoargs = "-iso-level 3"
|
||||
+else:
|
||||
+ isoargs = ""
|
||||
+%>
|
||||
+
|
||||
+mkdir images
|
||||
+install ${runtime_img} ${STAGE2IMG}
|
||||
+treeinfo stage2 mainimage ${STAGE2IMG}
|
||||
+
|
||||
+## install kernels
|
||||
+mkdir ${KERNELDIR}
|
||||
+%for kernel in kernels:
|
||||
+ ## normal aarch64
|
||||
+ installkernel images-${basearch} ${kernel.path} ${KERNELDIR}/vmlinuz
|
||||
+ installinitrd images-${basearch} ${kernel.initrd.path} ${KERNELDIR}/initrd.img
|
||||
+%endfor
|
||||
+
|
||||
+#FIXME: this will need adjusted when we have a real bootloader.
|
||||
+## WHeeeeeeee, EFI.
|
||||
+## We could remove the basearch restriction someday..
|
||||
+<% efiargs=""; efigraft="" %>
|
||||
+%if exists("boot/efi/EFI/*/gcdriscv64.efi"):
|
||||
+ <%
|
||||
+ efiarch32 = None
|
||||
+ efiarch64 = 'riscv64'
|
||||
+ efigraft="EFI/BOOT={0}/EFI/BOOT".format(outroot)
|
||||
+ images = ["images/efiboot.img"]
|
||||
+ %>
|
||||
+ %for img in images:
|
||||
+ <%
|
||||
+ efiargs += " -eltorito-alt-boot -e {0} -no-emul-boot".format(img)
|
||||
+ efigraft += " {0}={1}/{0}".format(img,outroot)
|
||||
+ %>
|
||||
+ treeinfo images-${basearch} ${img|basename} ${img}
|
||||
+ %endfor
|
||||
+ <%include file="efi.tmpl" args="configdir=configdir, KERNELDIR=KERNELDIR, efiarch32=efiarch32, efiarch64=efiarch64, isolabel=isolabel"/>
|
||||
+%endif
|
||||
+
|
||||
+# Create optional product.img and updates.img
|
||||
+<% filegraft=""; images=["product", "updates"] %>
|
||||
+%for img in images:
|
||||
+ %if exists("%s/%s/" % (LORAXDIR, img)):
|
||||
+ installimg ${LORAXDIR}/${img}/ images/${img}.img
|
||||
+ treeinfo images-${basearch} ${img}.img images/${img}.img
|
||||
+ <% filegraft += " images/{0}.img={1}/images/{0}.img".format(img, outroot) %>
|
||||
+ %endif
|
||||
+%endfor
|
||||
+
|
||||
+# Inherit iso-graft/ if it exists from external templates
|
||||
+<%
|
||||
+ import os
|
||||
+ if os.path.exists(workdir + "/iso-graft"):
|
||||
+ filegraft += " " + workdir + "/iso-graft"
|
||||
+%>
|
||||
+
|
||||
+# Add the license files
|
||||
+%for f in glob("usr/share/licenses/*-release-common/*"):
|
||||
+ install ${f} ${f|basename}
|
||||
+ <% filegraft += " {0}={1}/{0}".format(basename(f), outroot) %>
|
||||
+%endfor
|
||||
+
|
||||
+%if exists("boot/efi/EFI/*/gcdriscv64.efi"):
|
||||
+## make boot.iso
|
||||
+runcmd xorrisofs ${isoargs} -o ${outroot}/images/boot.iso \
|
||||
+ ${efiargs} -R -J -V '${isolabel}' \
|
||||
+ -graft-points \
|
||||
+ .discinfo=${outroot}/.discinfo \
|
||||
+ ${KERNELDIR}=${outroot}/${KERNELDIR} \
|
||||
+ ${STAGE2IMG}=${outroot}/${STAGE2IMG} \
|
||||
+ ${efigraft} ${filegraft}
|
||||
+treeinfo images-${basearch} boot.iso images/boot.iso
|
||||
+%endif
|
||||
diff --git a/share/templates.d/99-generic/runtime-install.tmpl b/share/templates.d/99-generic/runtime-install.tmpl
|
||||
index cf879fc..2967774 100644
|
||||
--- a/share/templates.d/99-generic/runtime-install.tmpl
|
||||
+++ b/share/templates.d/99-generic/runtime-install.tmpl
|
||||
@@ -68,6 +68,13 @@ installpkg glibc-all-langpacks
|
||||
installpkg shim-aa64
|
||||
installpkg uboot-tools
|
||||
%endif
|
||||
+%if basearch == "riscv64":
|
||||
+ installpkg efibootmgr
|
||||
+ installpkg grub2-efi-riscv64-cdboot>=${GRUB2VER}
|
||||
+ installpkg grub2-tools>=${GRUB2VER}
|
||||
+ installpkg uboot-tools
|
||||
+%endif
|
||||
+
|
||||
%if basearch == "x86_64":
|
||||
installpkg grub2-tools-efi>=${GRUB2VER}
|
||||
installpkg efibootmgr
|
||||
@@ -149,12 +156,12 @@ installpkg nmap-ncat
|
||||
installpkg pciutils usbutils ipmitool
|
||||
installpkg mt-st smartmontools
|
||||
installpkg hdparm
|
||||
-%if basearch not in ("aarch64", "ppc64le", "s390x"):
|
||||
+%if basearch not in ("aarch64", "ppc64le", "s390x", "riscv64"):
|
||||
installpkg pcmciautils
|
||||
%endif
|
||||
installpkg libmlx4 rdma-core
|
||||
installpkg rng-tools
|
||||
-%if basearch in ("x86_64", "aarch64"):
|
||||
+%if basearch in ("x86_64", "aarch64", "riscv64"):
|
||||
installpkg dmidecode
|
||||
%endif
|
||||
|
||||
diff --git a/src/pylorax/installer.py b/src/pylorax/installer.py
|
||||
index 452439a..885ca09 100644
|
||||
--- a/src/pylorax/installer.py
|
||||
+++ b/src/pylorax/installer.py
|
||||
@@ -138,7 +138,8 @@ class QEMUInstall(object):
|
||||
# Mapping of arch to qemu command
|
||||
QEMU_CMDS = {"x86_64": "qemu-system-x86_64",
|
||||
"aarch64": "qemu-system-aarch64",
|
||||
- "ppc64le": "qemu-system-ppc64"
|
||||
+ "ppc64le": "qemu-system-ppc64",
|
||||
+ "riscv64": "qemu-system-riscv64"
|
||||
}
|
||||
|
||||
def __init__(self, opts, iso, ks_paths, disk_img, img_size=2048,
|
||||
diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py
|
||||
index 6d3b974..1871115 100644
|
||||
--- a/src/pylorax/treebuilder.py
|
||||
+++ b/src/pylorax/treebuilder.py
|
||||
@@ -39,6 +39,7 @@ templatemap = {
|
||||
'ppc64le': 'ppc64le.tmpl',
|
||||
's390x': 's390.tmpl',
|
||||
'aarch64': 'aarch64.tmpl',
|
||||
+ 'riscv64': 'riscv64.tmpl',
|
||||
}
|
||||
|
||||
def generate_module_info(moddir, outfile=None):
|
Loading…
Reference in New Issue