diff --git a/xCAT-server/share/xcat/install/rh/compute.rhels10.riscv64.pkglist b/xCAT-server/share/xcat/install/rh/compute.rhels10.riscv64.pkglist new file mode 100644 index 000000000..437df1d02 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/compute.rhels10.riscv64.pkglist @@ -0,0 +1,16 @@ +@Minimal Install +kernel +chrony +net-tools +nfs-utils +openssh-server +openssl +rsync +util-linux +wget +python3 +tar +bzip2 +perl-interpreter +grub2-efi-riscv64 +efibootmgr diff --git a/xCAT-server/share/xcat/install/rh/compute.rhels10.riscv64.tmpl b/xCAT-server/share/xcat/install/rh/compute.rhels10.riscv64.tmpl new file mode 100644 index 000000000..68e3817cb --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/compute.rhels10.riscv64.tmpl @@ -0,0 +1,70 @@ +# Use text install +text +# Use network installation +%include /tmp/repos +# Keyboard layouts +keyboard --vckeymap=us --xlayouts='us' +# System language +lang en_US.UTF-8 + +# Network information +#KICKSTARTNET# +# Root password +rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password# +# Not run the Setup Agent on first boot +firstboot --disable +# Do not configure the X Window System +skipx +# System services +#services --enabled="chronyd" +# System timezone +timezone #TABLE:site:key=timezone:value# --utc +# Partition clearing information +zerombr +clearpart --all --initlabel +#XCAT_PARTITION_START# +%include /tmp/partitionfile +#XCAT_PARTITION_END# + +# Do not configure any iptables rules +firewall --disable +selinux --disable +reboot + +# riscv64: the EL10 anaconda has no RISC-V EFI platform and always asks for the +# x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not exist +# for riscv64; tolerate that. The riscv64 package list pulls grub2-efi-riscv64 +# and efibootmgr in explicitly. +%packages --ignoremissing +#INCLUDE_DEFAULT_PKGLIST# + +%end + +%pre +{ +echo "Running Kickstart Pre-installation script..." +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels10# +} &>>/tmp/pre-install.log +%end +%post --interpreter=/bin/bash +mkdir -p /var/log/xcat/ +cat /tmp/pre-install.log >>/var/log/xcat/xcat.log +{ +echo "Running Kickstart Post-installation script..." +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.rhels10# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10.riscv64# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10# +} &>>/var/log/xcat/xcat.log +%end + +# --ignoremissing above also hides a missing grub2-efi-riscv64, which would leave the +# node with no boot loader at all. Fail the installation instead of rebooting into +# firmware that has nothing to load. +%post --erroronfail --interpreter=/bin/bash +if [ ! -f /boot/efi/EFI/BOOT/BOOTRISCV64.EFI ] && + ! ls /boot/efi/EFI/*/grubriscv64.efi >/dev/null 2>&1; then + echo "riscv64: no grub2 UEFI boot loader on the ESP; grub2-efi-riscv64 is missing" \ + >>/var/log/xcat/xcat.log + exit 1 +fi +%end diff --git a/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.pkglist b/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.pkglist new file mode 100644 index 000000000..eb3b4ec36 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.pkglist @@ -0,0 +1,21 @@ +@Minimal Install +kernel +chrony +net-tools +nfs-utils +openssh-server +openssl +rsync +util-linux +wget +mariadb-connector-odbc +perl-DBD-MySQL +perl-DBD-Pg +unixODBC +python3 +tar +bzip2 +perl-interpreter +perl-lib +grub2-efi-riscv64 +efibootmgr diff --git a/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.tmpl b/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.tmpl new file mode 100644 index 000000000..68e3817cb --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/service.rhels10.riscv64.tmpl @@ -0,0 +1,70 @@ +# Use text install +text +# Use network installation +%include /tmp/repos +# Keyboard layouts +keyboard --vckeymap=us --xlayouts='us' +# System language +lang en_US.UTF-8 + +# Network information +#KICKSTARTNET# +# Root password +rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password# +# Not run the Setup Agent on first boot +firstboot --disable +# Do not configure the X Window System +skipx +# System services +#services --enabled="chronyd" +# System timezone +timezone #TABLE:site:key=timezone:value# --utc +# Partition clearing information +zerombr +clearpart --all --initlabel +#XCAT_PARTITION_START# +%include /tmp/partitionfile +#XCAT_PARTITION_END# + +# Do not configure any iptables rules +firewall --disable +selinux --disable +reboot + +# riscv64: the EL10 anaconda has no RISC-V EFI platform and always asks for the +# x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not exist +# for riscv64; tolerate that. The riscv64 package list pulls grub2-efi-riscv64 +# and efibootmgr in explicitly. +%packages --ignoremissing +#INCLUDE_DEFAULT_PKGLIST# + +%end + +%pre +{ +echo "Running Kickstart Pre-installation script..." +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels10# +} &>>/tmp/pre-install.log +%end +%post --interpreter=/bin/bash +mkdir -p /var/log/xcat/ +cat /tmp/pre-install.log >>/var/log/xcat/xcat.log +{ +echo "Running Kickstart Post-installation script..." +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.rhels10# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10.riscv64# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10# +} &>>/var/log/xcat/xcat.log +%end + +# --ignoremissing above also hides a missing grub2-efi-riscv64, which would leave the +# node with no boot loader at all. Fail the installation instead of rebooting into +# firmware that has nothing to load. +%post --erroronfail --interpreter=/bin/bash +if [ ! -f /boot/efi/EFI/BOOT/BOOTRISCV64.EFI ] && + ! ls /boot/efi/EFI/*/grubriscv64.efi >/dev/null 2>&1; then + echo "riscv64: no grub2 UEFI boot loader on the ESP; grub2-efi-riscv64 is missing" \ + >>/var/log/xcat/xcat.log + exit 1 +fi +%end diff --git a/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.pkglist b/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.pkglist new file mode 100644 index 000000000..437df1d02 --- /dev/null +++ b/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.pkglist @@ -0,0 +1,16 @@ +@Minimal Install +kernel +chrony +net-tools +nfs-utils +openssh-server +openssl +rsync +util-linux +wget +python3 +tar +bzip2 +perl-interpreter +grub2-efi-riscv64 +efibootmgr diff --git a/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.tmpl b/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.tmpl new file mode 100644 index 000000000..68e3817cb --- /dev/null +++ b/xCAT-server/share/xcat/install/rocky/compute.rocky10.riscv64.tmpl @@ -0,0 +1,70 @@ +# Use text install +text +# Use network installation +%include /tmp/repos +# Keyboard layouts +keyboard --vckeymap=us --xlayouts='us' +# System language +lang en_US.UTF-8 + +# Network information +#KICKSTARTNET# +# Root password +rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password# +# Not run the Setup Agent on first boot +firstboot --disable +# Do not configure the X Window System +skipx +# System services +#services --enabled="chronyd" +# System timezone +timezone #TABLE:site:key=timezone:value# --utc +# Partition clearing information +zerombr +clearpart --all --initlabel +#XCAT_PARTITION_START# +%include /tmp/partitionfile +#XCAT_PARTITION_END# + +# Do not configure any iptables rules +firewall --disable +selinux --disable +reboot + +# riscv64: the EL10 anaconda has no RISC-V EFI platform and always asks for the +# x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not exist +# for riscv64; tolerate that. The riscv64 package list pulls grub2-efi-riscv64 +# and efibootmgr in explicitly. +%packages --ignoremissing +#INCLUDE_DEFAULT_PKGLIST# + +%end + +%pre +{ +echo "Running Kickstart Pre-installation script..." +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels10# +} &>>/tmp/pre-install.log +%end +%post --interpreter=/bin/bash +mkdir -p /var/log/xcat/ +cat /tmp/pre-install.log >>/var/log/xcat/xcat.log +{ +echo "Running Kickstart Post-installation script..." +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.rhels10# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10.riscv64# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10# +} &>>/var/log/xcat/xcat.log +%end + +# --ignoremissing above also hides a missing grub2-efi-riscv64, which would leave the +# node with no boot loader at all. Fail the installation instead of rebooting into +# firmware that has nothing to load. +%post --erroronfail --interpreter=/bin/bash +if [ ! -f /boot/efi/EFI/BOOT/BOOTRISCV64.EFI ] && + ! ls /boot/efi/EFI/*/grubriscv64.efi >/dev/null 2>&1; then + echo "riscv64: no grub2 UEFI boot loader on the ESP; grub2-efi-riscv64 is missing" \ + >>/var/log/xcat/xcat.log + exit 1 +fi +%end diff --git a/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.pkglist b/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.pkglist new file mode 100644 index 000000000..e9c3e2263 --- /dev/null +++ b/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.pkglist @@ -0,0 +1,19 @@ +@^minimal-environment +chrony +net-tools +nfs-utils +openssh-server +rsync +util-linux +wget +mariadb-connector-odbc +perl-DBD-MySQL +perl-DBD-Pg +unixODBC +python3 +tar +bzip2 +perl-interpreter +perl-lib +grub2-efi-riscv64 +efibootmgr diff --git a/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.tmpl b/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.tmpl new file mode 100644 index 000000000..00364f2ac --- /dev/null +++ b/xCAT-server/share/xcat/install/rocky/service.rocky10.riscv64.tmpl @@ -0,0 +1,70 @@ +# Use text install +text +# Use network installation +%include /tmp/repos +# Keyboard layouts +keyboard --vckeymap=us --xlayouts='us' +# System language +lang en_US.UTF-8 + +# Network information +#KICKSTARTNET# +# Root password +rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password# +# Not run the Setup Agent on first boot +firstboot --disable +# Do not configure the X Window System +skipx +# System services +#services --enabled="chronyd" +# System timezone +timezone #TABLE:site:key=timezone:value# --utc +# Partition clearing information +zerombr +clearpart --all --initlabel +#XCAT_PARTITION_START# +%include /tmp/partitionfile +#XCAT_PARTITION_END# + +# Do not configure any iptables rules +firewall --disable +selinux --disable +reboot + +# riscv64: the EL10 anaconda has no RISC-V EFI platform and always asks for the +# x86 UEFI boot loader packages (grub2-efi-x64, shim-x64), which do not exist +# for riscv64; tolerate that. The riscv64 package list pulls grub2-efi-riscv64 +# and efibootmgr in explicitly. +%packages --ignoremissing +#INCLUDE_DEFAULT_PKGLIST# + +%end + +%pre +{ +echo "Running Kickstart Pre-installation script..." +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/pre.rhels8# +} &>>/tmp/pre-install.log +%end +%post --interpreter=/bin/bash +mkdir -p /var/log/xcat/ +cat /tmp/pre-install.log >>/var/log/xcat/xcat.log +{ +echo "Running Kickstart Post-installation script..." +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.xcat.ng# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels10.riscv64# +#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/post.rhels8# +} &>>/var/log/xcat/xcat.log +%end + +# --ignoremissing above also hides a missing grub2-efi-riscv64, which would leave the +# node with no boot loader at all. Fail the installation instead of rebooting into +# firmware that has nothing to load. +%post --erroronfail --interpreter=/bin/bash +if [ ! -f /boot/efi/EFI/BOOT/BOOTRISCV64.EFI ] && + ! ls /boot/efi/EFI/*/grubriscv64.efi >/dev/null 2>&1; then + echo "riscv64: no grub2 UEFI boot loader on the ESP; grub2-efi-riscv64 is missing" \ + >>/var/log/xcat/xcat.log + exit 1 +fi +%end diff --git a/xCAT-server/share/xcat/install/scripts/post.rhels10.riscv64 b/xCAT-server/share/xcat/install/scripts/post.rhels10.riscv64 new file mode 100644 index 000000000..09245064c --- /dev/null +++ b/xCAT-server/share/xcat/install/scripts/post.rhels10.riscv64 @@ -0,0 +1,51 @@ +# riscv64 UEFI boot entry fix-up for EL10 kickstart installs. +# +# The EL10 anaconda has no RISC-V EFI platform: it asks for the x86 boot +# loader packages (grub2-efi-x64, shim-x64; tolerated with --ignoremissing) +# and registers the UEFI boot entry as \EFI\\shimx64.efi, which does +# not exist on riscv64, so the firmware cannot boot the installed system. +# grub2-efi-riscv64 (from the riscv64 package list) provides +# \EFI\\grubriscv64.efi and anaconda still writes the ESP grub.cfg +# stub next to it, so point the boot entry at that image and also place the +# removable-media fallback loader \EFI\BOOT\BOOTRISCV64.EFI for firmware +# without usable NVRAM entries. Runs in the installed system chroot. +if [ "$(uname -m)" = "riscv64" ] && [ -d /boot/efi/EFI ]; then + grubefi="" + for candidate in /boot/efi/EFI/*/grubriscv64.efi; do + [ -f "$candidate" ] || continue + grubefi="$candidate" + break + done + if [ -n "$grubefi" ]; then + vendordir="$(basename "$(dirname "$grubefi")")" + mkdir -p /boot/efi/EFI/BOOT + cp -f "$grubefi" /boot/efi/EFI/BOOT/BOOTRISCV64.EFI + echo "riscv64: installed \\EFI\\BOOT\\BOOTRISCV64.EFI from \\EFI\\$vendordir\\grubriscv64.efi" + if command -v efibootmgr >/dev/null 2>&1 && efibootmgr >/dev/null 2>&1; then + espdev="$(findmnt -no SOURCE /boot/efi 2>/dev/null)" + # lsblk pads its output, and efibootmgr wants bare values + disk="$(lsblk -no PKNAME "$espdev" 2>/dev/null | head -1 | tr -d '[:space:]')" + part="$(lsblk -no PARTN "$espdev" 2>/dev/null | head -1 | tr -d '[:space:]')" + if [ -n "$disk" ] && [ -n "$part" ]; then + # drop the x86 entries anaconda created for this install, and any + # riscv64 entry a previous provisioning of this node left behind, so + # reinstalling does not fill the firmware variable store with copies + for bootnum in $(efibootmgr -v 2>/dev/null | awk '/\\EFI\\[^\\]+\\(shimx64|grubx64|grubriscv64)\.efi/ { sub(/^Boot/, "", $1); sub(/\*$/, "", $1); print $1 }'); do + efibootmgr -q -b "$bootnum" -B || true + done + label="$(. /etc/os-release 2>/dev/null; echo "${NAME:-Linux}")" + if efibootmgr -q -c -d "/dev/$disk" -p "$part" -L "$label" -l "\\EFI\\$vendordir\\grubriscv64.efi"; then + echo "riscv64: UEFI boot entry \"$label\" -> \\EFI\\$vendordir\\grubriscv64.efi on /dev/$disk part $part" + else + echo "riscv64: efibootmgr could not create the boot entry; the firmware will use \\EFI\\BOOT\\BOOTRISCV64.EFI" + fi + else + echo "riscv64: could not determine the ESP disk/partition; the firmware will use \\EFI\\BOOT\\BOOTRISCV64.EFI" + fi + else + echo "riscv64: efibootmgr unavailable; the firmware will use \\EFI\\BOOT\\BOOTRISCV64.EFI" + fi + else + echo "riscv64: no \\EFI\\*\\grubriscv64.efi on the ESP; is grub2-efi-riscv64 in the package list?" + fi +fi