From f519c386a1edbe1775001d0c368a3b6f4a877c5c Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sun, 30 Jun 2024 10:31:51 +0200 Subject: [PATCH] tree: more rewrite Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 4 ++-- files/initrd/opt/arc/arc.sh | 6 +++--- files/initrd/opt/arc/boot.sh | 16 +++++++++++++++- files/initrd/opt/arc/include/functions.sh | 4 +++- files/initrd/opt/arc/include/update.sh | 2 +- files/initrd/opt/arc/init.sh | 4 ++-- files/initrd/opt/arc/ramdisk-patch.sh | 2 +- files/initrd/opt/arc/vmlinux-to-bzImage.sh | 2 +- files/initrd/opt/arc/zimage-patch.sh | 2 +- files/p1/boot/grub/grub.cfg | 12 ++++++------ scripts/func.sh | 2 ++ 11 files changed, 37 insertions(+), 19 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index f3686291..6bb041b4 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -76,7 +76,7 @@ function addonSelection() { function modulesMenu() { PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" # Modify KVER for Epyc7002 if [ "${PLATFORM}" == "epyc7002" ]; then KVERP="${PRODUCTVER}-${KVER}" @@ -1071,7 +1071,7 @@ function sysinfo() { PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")" - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")" REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")" diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 6b62ebc2..0db2b822 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -290,7 +290,7 @@ function arcVersion() { fi done < <(readConfigMap "addons" "${USER_CONFIG_FILE}") # Reset Modules - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" # Modify KVER for Epyc7002 if [ "${PLATFORM}" == "epyc7002" ]; then KVERP="${PRODUCTVER}-${KVER}" @@ -522,7 +522,7 @@ function arcSummary() { PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")" - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" ADDONSINFO="$(readConfigEntriesArray "addons" "${USER_CONFIG_FILE}")" REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")" @@ -1046,7 +1046,7 @@ else fi PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" if [ -n "${PLATFORM}" ] && [ -n "${KVER}" ]; then if [ "${PLATFORM}" == "epyc7002" ]; then KVERP="${PRODUCTVER}-${KVER}" diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index 6d7c8bbe..d54c94a4 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -68,7 +68,7 @@ function bootDSM () { SN="$(readConfigKey "arc.sn" "${USER_CONFIG_FILE}")" KERNELPANIC="$(readConfigKey "arc.kernelpanic" "${USER_CONFIG_FILE}")" DT="$(readConfigKey "platforms.${PLATFORM}.dt" "${P_FILE}")" - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" declare -A CMDLINE @@ -135,12 +135,26 @@ function bootDSM () { [ "${CMDLINE['modprobe.blacklist']}" != "" ] && CMDLINE['modprobe.blacklist']+="," CMDLINE['modprobe.blacklist']+="mpt3sas" fi + if true; then + [ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+="," + CMDLINE['modprobe.blacklist']+="evbug" + fi if echo "apollolake geminilake" | grep -wq "${PLATFORM}"; then CMDLINE["intel_iommu"]="igfx_off" fi if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then CMDLINE["SASmodel"]="1" fi + # Disable x2apic + if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then + if grep -q "^flags.*x2apic.*" /proc/cpuinfo; then + eval $(grep -o "ARC_CMDLINE=.*$" "${USER_GRUB_CONFIG}") + [ -z "${ARC_CMDLINE}" ] && ARC_CMDLINE="bzImage-arc" + echo "${ARC_CMDLINE}" | grep -q 'nox2apic' || sed -i "s|${ARC_CMDLINE}|${ARC_CMDLINE} nox2apic|" "${USER_GRUB_CONFIG}" + fi + else + grep -q ' nox2apic' "${USER_GRUB_CONFIG}" && sed -i "s| nox2apic||" "${USER_GRUB_CONFIG}" + fi # Cmdline NIC Settings ETHN=0 diff --git a/files/initrd/opt/arc/include/functions.sh b/files/initrd/opt/arc/include/functions.sh index 180bba48..9e1de3ac 100755 --- a/files/initrd/opt/arc/include/functions.sh +++ b/files/initrd/opt/arc/include/functions.sh @@ -250,12 +250,14 @@ function _sort_netif() { # 1 - device path function getBus() { BUS="" + # xen + [ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | grep -q "xen" && echo "xen") # usb/ata(sata/ide)/scsi [ -z "${BUS}" ] && BUS=$(udevadm info --query property --name "${1}" 2>/dev/null | grep ID_BUS | cut -d= -f2 | sed 's/ata/sata/') # usb/sata(sata/ide)/nvme [ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,TRAN 2>/dev/null | grep "${1} " | awk '{print $2}') #Spaces are intentional # usb/scsi(sata/ide)/virtio(scsi/virtio)/mmc/nvme - [ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | awk -F':' '{print $(NF-1)}' | sed 's/_host//') #Spaces are intentional + [ -z "${BUS}" ] && BUS=$(lsblk -dpno KNAME,SUBSYSTEMS 2>/dev/null | grep "${1} " | awk '{print $2}' | awk -F':' '{print $(NF-1)}' | sed 's/_host//') # Spaces are intentional echo "${BUS}" return 0 } diff --git a/files/initrd/opt/arc/include/update.sh b/files/initrd/opt/arc/include/update.sh index 11443fe5..26231d23 100755 --- a/files/initrd/opt/arc/include/update.sh +++ b/files/initrd/opt/arc/include/update.sh @@ -273,7 +273,7 @@ function updateModules() { local PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" if [ -n "${PRODUCTVER}" ]; then local PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" - local KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")" + local KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" # Modify KVER for Epyc7002 if [ "${PLATFORM}" = "epyc7002" ]; then KVERP="${PRODUCTVER}-${KVER}" diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index e74cf8f5..c95779ab 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -118,12 +118,12 @@ echo VID="0x46f4" PID="0x0001" -BUSLIST="usb sata scsi nvme mmc" +BUSLIST="usb sata scsi nvme mmc xen" if [ "${BUS}" == "usb" ]; then VID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_VENDOR_ID | cut -d= -f2)" PID="0x$(udevadm info --query property --name "${LOADER_DISK}" | grep ID_MODEL_ID | cut -d= -f2)" elif ! echo "${BUSLIST}" | grep -wq "${BUS}"; then - die "Loader disk is not USB or SATA/SCSI/NVME/eMMC DoM" + die "Loader disk is not USB or SATA/SCSI/NVME/eMMC/XEN" fi # Save variables to user config file diff --git a/files/initrd/opt/arc/ramdisk-patch.sh b/files/initrd/opt/arc/ramdisk-patch.sh index a5725993..a00d781a 100755 --- a/files/initrd/opt/arc/ramdisk-patch.sh +++ b/files/initrd/opt/arc/ramdisk-patch.sh @@ -60,7 +60,7 @@ if [ "${PRODUCTVERDSM}" != "${PRODUCTVER}" ]; then fi # Read model data -KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")" +KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" # Modify KVER for Epyc7002 if [ "${PLATFORM}" == "epyc7002" ]; then diff --git a/files/initrd/opt/arc/vmlinux-to-bzImage.sh b/files/initrd/opt/arc/vmlinux-to-bzImage.sh index 026d16ac..2f2c5145 100755 --- a/files/initrd/opt/arc/vmlinux-to-bzImage.sh +++ b/files/initrd/opt/arc/vmlinux-to-bzImage.sh @@ -7,7 +7,7 @@ PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" -KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")" +KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" # Adapted from: scripts/Makefile.lib # Usage: size_append FILE [FILE2] [FILEn]... diff --git a/files/initrd/opt/arc/zimage-patch.sh b/files/initrd/opt/arc/zimage-patch.sh index a57dd2f7..9b22d20f 100755 --- a/files/initrd/opt/arc/zimage-patch.sh +++ b/files/initrd/opt/arc/zimage-patch.sh @@ -16,7 +16,7 @@ if [ "${KERNEL}" == "custom" ]; then echo -n " - Using customized Kernel" PLATFORM="$(readConfigKey "platform" "${USER_CONFIG_FILE}")" PRODUCTVER="$(readConfigKey "productver" "${USER_CONFIG_FILE}")" - KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.[${PRODUCTVER}].kver" "${P_FILE}")" + KVER="$(readConfigKey "platforms.${PLATFORM}.productvers.\"${PRODUCTVER}\".kver" "${P_FILE}")" # Modify KVER for Epyc7002 if [ "${PLATFORM}" == "epyc7002" ]; then KVERP="${PRODUCTVER}-${KVER}" diff --git a/files/p1/boot/grub/grub.cfg b/files/p1/boot/grub/grub.cfg index 44c9767b..25535e51 100644 --- a/files/p1/boot/grub/grub.cfg +++ b/files/p1/boot/grub/grub.cfg @@ -79,7 +79,7 @@ set menu_color_highlight=white/red set color_normal=white/black set ARC_CMDLINE="console=tty2 root=/dev/ram net.ifnames=0" -set ARC_CONFIG_CMDLINE="console=tty2 root=/dev/ram net.ifnames=0 ipv6.disable=1" +# set ARC_CONFIG_CMDLINE="console=tty2 root=/dev/ram net.ifnames=0 ipv6.disable=1" search --set=root --label "ARC3" if [ -s /zImage-dsm -a -s /initrd-dsm ]; then @@ -109,7 +109,7 @@ if [ -s /automated ]; then menuentry 'Arc Automated Build Mode' --id automated { set_gfxpayload echo "Loading Arc Kernel..." - linux /bzImage-arc ${ARC_CONFIG_CMDLINE} automated_arc + linux /bzImage-arc ${ARC_CMDLINE} automated_arc echo "Loading Arc Initramfs..." initrd /initrd-arc echo "Booting..." @@ -119,7 +119,7 @@ fi menuentry 'Arc Config Mode' --id config { set_gfxpayload echo "Loading Arc Kernel..." - linux /bzImage-arc ${ARC_CONFIG_CMDLINE} force_arc + linux /bzImage-arc ${ARC_CMDLINE} force_arc echo "Loading Arc Initramfs..." initrd /initrd-arc echo "Booting..." @@ -128,7 +128,7 @@ menuentry 'Arc Config Mode' --id config { menuentry 'Arc Update Mode' --id update { set_gfxpayload echo "Loading Arc Kernel..." - linux /bzImage-arc ${ARC_CONFIG_CMDLINE} update_arc + linux /bzImage-arc ${ARC_CMDLINE} update_arc echo "Loading Arc Initramfs..." initrd /initrd-arc echo "Booting..." @@ -138,7 +138,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then menuentry 'DSM Recovery Mode' --id recovery { set_gfxpayload echo "Loading Arc Kernel..." - linux /bzImage-arc ${ARC_CONFIG_CMDLINE} recovery + linux /bzImage-arc ${ARC_CMDLINE} recovery echo "Loading Arc Initramfs..." initrd /initrd-arc echo "Booting..." @@ -146,7 +146,7 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then menuentry 'DSM Reinstall Mode' --id junior { set_gfxpayload echo "Loading Arc Kernel..." - linux /bzImage-arc ${ARC_CONFIG_CMDLINE} force_junior + linux /bzImage-arc ${ARC_CMDLINE} force_junior echo "Loading Arc Initramfs..." initrd /initrd-arc echo "Booting..." diff --git a/scripts/func.sh b/scripts/func.sh index a68424b7..368c7b0e 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -386,6 +386,8 @@ extendedConfigFile = "${VMNAME}.vmxf" floppy0.present = "FALSE" ethernet0.addressType = "generated" ethernet0.virtualDev = "vmxnet3" +ethernet0.connectionType = "nat" +ethernet0.allowguestconnectioncontrol = "true" ethernet0.present = "TRUE" sata0.present = "TRUE" sata0:0.fileName = "${VMNAME}-disk1.vmdk"