From abfabee34a9dbbe83e63db4e8a4084aee856f327 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Mon, 13 Jan 2025 18:26:57 +0100 Subject: [PATCH] tree: rewrite Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 8 +- files/initrd/opt/arc/boot.sh | 114 ++++---- files/initrd/opt/arc/include/functions.py | 2 +- files/initrd/opt/arc/include/modulelist | 12 +- files/initrd/opt/arc/include/network.sh | 45 ++- files/initrd/opt/arc/include/storage.sh | 322 ++++++++++------------ files/p1/boot/grub/grub.cfg | 121 ++++---- 7 files changed, 312 insertions(+), 312 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 7e6e2a65..e3abd975 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -1000,7 +1000,7 @@ function sysinfo() { GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")" SECURE=$(dmesg 2>/dev/null | grep -i "Secure Boot" | awk -F'] ' '{print $2}') VENDOR=$(dmesg 2>/dev/null | grep -i "DMI:" | head -1 | sed 's/\[.*\] DMI: //i') - ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true + ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) ETHN=$(echo ${ETHX} | wc -w) ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")" HWID="$(genHWID)" @@ -1291,7 +1291,7 @@ function uploadDiag () { # Shows Networkdiag to user function networkdiag() { ( - ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true + ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) for N in ${ETHX}; do echo DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}') @@ -1395,7 +1395,7 @@ function credits() { ############################################################################### # Setting Static IP for Loader function staticIPMenu() { - ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true + ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) IPCON="" for N in ${ETHX}; do MACR="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')" @@ -2134,7 +2134,7 @@ function rebootMenu() { echo -e "recovery \"DSM: Recovery Mode\"" >>"${TMP_PATH}/opts" echo -e "junior \"DSM: Reinstall Mode\"" >>"${TMP_PATH}/opts" fi - echo -e "bios \"System: BIOS/UEFI\"" >>"${TMP_PATH}/opts" + echo -e "uefi \"System: UEFI\"" >>"${TMP_PATH}/opts" echo -e "poweroff \"System: Shutdown\"" >>"${TMP_PATH}/opts" echo -e "shell \"System: Shell Cmdline\"" >>"${TMP_PATH}/opts" dialog --backtitle "$(backtitle)" --title "Power Menu" \ diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index a76a3eec..0bd3d24d 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -9,7 +9,6 @@ set -e rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")" -[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!" ARC_BRANCH="$(readConfigKey "arc.branch" "${USER_CONFIG_FILE}")" # Get Loader Disk Bus @@ -62,6 +61,25 @@ HWIDINFO="$(readConfigKey "bootscreen.hwidinfo" "${USER_CONFIG_FILE}")" GOVERNOR="$(readConfigKey "governor" "${USER_CONFIG_FILE}")" USBMOUNT="$(readConfigKey "usbmount" "${USER_CONFIG_FILE}")" +# Build Sanity Check +[ "${BUILDDONE}" = "false" ] && die "Loader build not completed!" +if [ -z "${MODELID}" ] || [ "${MODELID}" != "${MODEL}" ]; then + die "Loader build not completed! Model mismatch!" +fi +# HardwareID Check +if [ "${ARCPATCH}" = "true" ]; then + HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")" + HWID="$(genHWID)" + if [ "${HARDWAREID}" != "${HWID}" ]; then + echo "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m" + writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}" + writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}" + writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" + sleep 5 + rebootTo "config" + fi +fi + if [ "${DSMINFO}" = "true" ]; then echo -e "\033[1;37mDSM:\033[0m" echo -e "Model: \033[1;37m${MODELID:-${MODEL}}\033[0m" @@ -117,28 +135,29 @@ EMMCBOOT="$(readConfigKey "emmcboot" "${USER_CONFIG_FILE}")" MODBLACKLIST="$(readConfigKey "modblacklist" "${USER_CONFIG_FILE}")" ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" -# HardwareID Check -if [ "${ARCPATCH}" = "true" ]; then - HARDWAREID="$(readConfigKey "arc.hardwareid" "${USER_CONFIG_FILE}")" - HWID="$(genHWID)" - if [ "${HARDWAREID}" != "${HWID}" ]; then - echo "\033[1;31m*** HardwareID does not match! - Loader can't boot to DSM! You need to reconfigure your Loader - Rebooting to Config Mode! ***\033[0m" - writeConfigKey "arc.patch" "false" "${USER_CONFIG_FILE}" - writeConfigKey "arc.hardwareid" "" "${USER_CONFIG_FILE}" - writeConfigKey "arc.userid" "" "${USER_CONFIG_FILE}" - sleep 5 - rebootTo "config" - fi -fi - declare -A CMDLINE # Automated Cmdline -CMDLINE["syno_hw_version"]="${MODELID:-${MODEL}}" +CMDLINE["syno_hw_version"]="${MODELID}" CMDLINE["vid"]="${VID:-"0x46f4"}" # Sanity check CMDLINE["pid"]="${PID:-"0x0001"}" # Sanity check CMDLINE["sn"]="${SN}" +# NIC Cmdline +ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) +ETHM=$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null) +ETHN=$(echo "${ETHX}" | wc -w) +ETHM=${ETHM:-${ETHN}} +NIC=0 +for N in ${ETHX}; do + MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}") + MAC=${MAC:-$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')} + NIC=$((NIC + 1)) + CMDLINE["mac${NIC}"]="${MAC}" + [ ${NIC} -ge ${ETHM} ] && break +done +CMDLINE["netif_num"]="${NIC}" + # Boot Cmdline if grep -q "force_junior" /proc/cmdline; then CMDLINE["force_junior"]="" @@ -161,13 +180,14 @@ if [ $(echo "${KVER:-4}" | cut -d'.' -f1) -lt 5 ]; then SIZE=$((${SZ:-0} * ${SS:-0} / 1024 / 1024 + 10)) # Read SATADoM type SATADOM="$(readConfigKey "satadom" "${USER_CONFIG_FILE}")" - CMDLINE["synoboot_satadom"]="${SATADOM:-2}" - CMDLINE["dom_szmax"]="${SIZE}" + CMDLINE['synoboot_satadom']="${SATADOM:-2}" + CMDLINE['dom_szmax']="${SIZE}" fi - CMDLINE['elevator']="elevator" + CMDLINE["elevator"]="elevator" else CMDLINE["split_lock_detect"]="off" fi + if [ "${DT}" = "true" ]; then CMDLINE["syno_ttyS0"]="serial,0x3f8" CMDLINE["syno_ttyS1"]="serial,0x2f8" @@ -179,35 +199,33 @@ fi CMDLINE["HddHotplug"]="1" CMDLINE["vender_format_version"]="2" -CMDLINE["skip_vender_mac_interfaces"]="0,1,2,3,4,5,6,7" -CMDLINE["earlyprintk"]="" -CMDLINE["earlycon"]="uart8250,io,0x3f8,115200n8" -CMDLINE["console"]="ttyS0,115200n8" -CMDLINE["consoleblank"]="600" +CMDLINE['skip_vender_mac_interfaces']="0,1,2,3,4,5,6,7" +CMDLINE['earlyprintk']="" +CMDLINE['earlycon']="uart8250,io,0x3f8,115200n8" +CMDLINE['console']="ttyS0,115200n8" +CMDLINE['consoleblank']="600" # CMDLINE['no_console_suspend']="1" -CMDLINE["root"]="/dev/md0" -CMDLINE["loglevel"]="15" -CMDLINE["log_buf_len"]="32M" -CMDLINE["rootwait"]="" +CMDLINE['root']="/dev/md0" +CMDLINE['loglevel']="15" +CMDLINE['log_buf_len']="32M" +CMDLINE['rootwait']="" CMDLINE['panic']="${KERNELPANIC:-0}" # CMDLINE['intremap']="off" # no need # CMDLINE['amd_iommu_intr']="legacy" # no need -# CMDLINE['split_lock_detect']="off" # check KVER CMDLINE['pcie_aspm']="off" # CMDLINE['intel_pstate']="disable" # CMDLINE['amd_pstate']="disable" -# CMDLINE['nox2apic']="" # check platform # CMDLINE['nomodeset']="" -CMDLINE["modprobe.blacklist"]="${MODBLACKLIST}" +CMDLINE['modprobe.blacklist']="${MODBLACKLIST}" + if [ "${USBMOUNT}" = "true" ]; then CMDLINE['usbinternal']="" fi + if [ -n "${GOVERNOR}" ]; then - CMDLINE["governor"]="${GOVERNOR}" -fi -if [ $(cat /proc/cpuinfo | grep Intel | wc -l) -gt 0 ]; then - CMDLINE["intel_pstate"]="disable" + CMDLINE['governor']="${GOVERNOR}" fi + if echo "apollolake geminilake purley" | grep -wq "${PLATFORM}"; then CMDLINE["nox2apic"]="" fi @@ -221,11 +239,11 @@ fi # fi if [ "${DT}" = "true" ] && ! echo "epyc7002 purley broadwellnkv2" | grep -wq "${PLATFORM}"; then if ! echo "${CMDLINE['modprobe.blacklist']}" | grep -q "mpt3sas"; then - [ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE["modprobe.blacklist"]+="," - CMDLINE["modprobe.blacklist"]+="mpt3sas" + [ ! "${CMDLINE['modprobe.blacklist']}" = "" ] && CMDLINE['modprobe.blacklist']+="," + CMDLINE['modprobe.blacklist']+="mpt3sas" fi #else -# CMDLINE['scsi_mod.scan']="sync" # TODO: kernel panic caused by vmware scsi? (add to cmdline) +# CMDLINE['scsi_mod.scan']="sync" # TODO: redpill panic of vmware scsi? (add to cmdline) fi # CMDLINE['kvm.ignore_msrs']="1" @@ -239,20 +257,6 @@ if echo "purley broadwellnkv2" | grep -wq "${PLATFORM}"; then CMDLINE["SASmodel"]="1" fi -# NIC Cmdline -ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true -ETHM=$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null) -ETHN=$(echo ${ETHX} | wc -w) -[ -z "${ETHM}" ] && ETHM="${ETHN}" -NIC=0 -for N in ${ETHX}; do - MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")" - [ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | tr '[:upper:]' '[:lower:]')" || NIC=$((NIC + 1)) - [ ${NIC} -le ${ETHM} ] && CMDLINE["mac${NIC}"]="${MAC}" - [ ${NIC} -ge ${ETHM} ] && break -done -CMDLINE["netif_num"]="${NIC}" - # Read user network settings while IFS=': ' read -r KEY VALUE; do [ -n "${KEY}" ] && CMDLINE["network.${KEY}"]="${VALUE}" @@ -295,8 +299,10 @@ elif [ "${DIRECTBOOT}" = "false" ]; then echo -e "\033[1;37mDetected ${ETHN} NIC:\033[0m" fi echo + [ ! -f /var/run/dhcpcd/pid ] && /etc/init.d/S41dhcpcd restart >/dev/null 2>&1 || true - sleep 3 + sleep 2 + for N in ${ETHX}; do COUNT=0 DRIVER=$(ls -ld /sys/class/net/${N}/device/driver 2>/dev/null | awk -F '/' '{print $NF}') @@ -361,7 +367,7 @@ elif [ "${DIRECTBOOT}" = "false" ]; then echo -e "\033[1;33mWarning, running kexec with --noefi param, strange things will happen!!\033[0m" KEXECARGS+=" --noefi" fi - kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE}" >"${LOG_FILE}" 2>&1 || dieLog + kexec ${KEXECARGS} -l "${MOD_ZIMAGE_FILE}" --initrd "${MOD_RDGZ_FILE}" --command-line="${CMDLINE_LINE} kexecboot" >"${LOG_FILE}" 2>&1 || dieLog echo -e "\033[1;37mBooting DSM...\033[0m" [ "${KERNELLOAD}" = "kexec" ] && kexec -e || poweroff diff --git a/files/initrd/opt/arc/include/functions.py b/files/initrd/opt/arc/include/functions.py index 65d288d8..710d140c 100755 --- a/files/initrd/opt/arc/include/functions.py +++ b/files/initrd/opt/arc/include/functions.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2023 AuxXxilium and Ing +# Copyright (C) 2025 AuxXxilium and Ing # # This is free software, licensed under the MIT License. # See /LICENSE for more information. diff --git a/files/initrd/opt/arc/include/modulelist b/files/initrd/opt/arc/include/modulelist index fc63490a..0d661cee 100644 --- a/files/initrd/opt/arc/include/modulelist +++ b/files/initrd/opt/arc/include/modulelist @@ -13,9 +13,7 @@ F kvm-amd.ko F kvm.ko # acpi -F acpi_call.ko -F acpi-cpufreq.ko -F processor.ko +N acpi_call.ko # misc N check_signature.ko @@ -36,14 +34,6 @@ N cdc_ether.ko N rndis_host.ko N r8152.ko -# iwlwifi -N libarc4.ko -N cfg80211.ko -N mac80211.ko -N iwlwifi.ko -N iwlmvm.ko -N iwldvm.ko - ## i915 #N dmabuf.ko #N drm.ko diff --git a/files/initrd/opt/arc/include/network.sh b/files/initrd/opt/arc/include/network.sh index dade3462..298422d3 100755 --- a/files/initrd/opt/arc/include/network.sh +++ b/files/initrd/opt/arc/include/network.sh @@ -1,34 +1,33 @@ # Get Network Config for Loader function getnet() { - ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true - MODEL="$(readConfigKey "model" "${USER_CONFIG_FILE}")" - ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")" - NICPORTS="$(readConfigKey "${MODEL}.ports" "${S_FILE}" 2>/dev/null)" - ETHN=$(echo ${ETHX} | wc -w) - if [ "${ARCPATCH}" = "true" ]; then - MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "true")) - for I in $(seq 1 ${ETHN}); do - eval MAC${I}="${MACS[$((${I} - 1))]}" - writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}" + generate_and_write_macs() { + local patch=$1 + local macs=($(generateMacAddress "${MODEL}" "${ETHN}" "${patch}")) + + for i in $(seq 1 "${ETHN}"); do + local mac="${macs[$((i - 1))]}" + writeConfigKey "eth$((i - 1))" "${mac}" "${USER_CONFIG_FILE}" done - elif [ "${ARCPATCH}" = "false" ]; then - MACS=($(generateMacAddress "${MODEL}" "${ETHN}" "false")) - for I in $(seq 1 ${ETHN}); do - eval MAC${I}="${MACS[$((${I} - 1))]}" - writeConfigKey "eth$((${I} - 1))" "${MACS[$((${I} - 1))]}" "${USER_CONFIG_FILE}" - done - elif [ "${ARCPATCH}" = "user" ]; then - # User Mac + } + + ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) + MODEL=$(readConfigKey "model" "${USER_CONFIG_FILE}") + ARCPATCH=$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}") + ETHN=$(echo "${ETHX}" | wc -w) + + if [ "${ARCPATCH}" != "user" ]; then + generate_and_write_macs "${ARCPATCH}" + else for N in ${ETHX}; do while true; do dialog --backtitle "$(backtitle)" --title "Mac Setting" \ - --inputbox "Type a custom Mac for ${N} (Eq. 001132a1b2c3).\nA custom Mac will not be applied to NIC!" 8 50\ + --inputbox "Type a custom Mac for ${N} (Eq. 001132a1b2c3).\nA custom Mac will not be applied to NIC!" 8 50 \ 2>"${TMP_PATH}/resp" [ $? -ne 0 ] && break MAC=$(cat "${TMP_PATH}/resp") - [ -z "${MAC}" ] && MAC="$(readConfigKey "${N}" "${USER_CONFIG_FILE}")" - [ -z "${MAC}" ] && MAC="$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g')" - MAC="$(echo "${MAC}" | tr '[:upper:]' '[:lower:]')" + [ -z "${MAC}" ] && MAC=$(readConfigKey "${N}" "${USER_CONFIG_FILE}") + [ -z "${MAC}" ] && MAC=$(cat /sys/class/net/${N}/address 2>/dev/null | sed 's/://g') + MAC=$(echo "${MAC}" | tr '[:upper:]' '[:lower:]') if [ ${#MAC} -eq 12 ]; then dialog --backtitle "$(backtitle)" --title "Mac Setting" --msgbox "Set Mac for ${N} to ${MAC}!" 5 50 writeConfigKey "${N}" "${MAC}" "${USER_CONFIG_FILE}" @@ -42,7 +41,7 @@ function getnet() { } # Get Amount of NIC -ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) || true +ETHX=$(ls /sys/class/net/ 2>/dev/null | grep eth) # Get actual IP for N in ${ETHX}; do IPCON="$(getIP "${N}")" diff --git a/files/initrd/opt/arc/include/storage.sh b/files/initrd/opt/arc/include/storage.sh index 3f5abfe4..447e9b09 100755 --- a/files/initrd/opt/arc/include/storage.sh +++ b/files/initrd/opt/arc/include/storage.sh @@ -1,109 +1,100 @@ # Get PortMap for Loader function getmap() { + detect_drives() { + local pci_id=$1 + local drive_var=$2 + local class_path=$3 + local grep_pattern=$4 + local sed_pattern=$5 + + eval "${drive_var}=0" + if [ $(lspci -d ::${pci_id} 2>/dev/null | wc -l) -gt 0 ]; then + for PCI in $(lspci -d ::${pci_id} 2>/dev/null | awk '{print $1}'); do + PORT=$(ls -l ${class_path} | grep "${PCI}" | awk -F'/' '{print $NF}' | sed "${sed_pattern}" | sort -n 2>/dev/null) + PORTNUM=$(lsscsi -b | grep -v - | grep "${grep_pattern}${PORT}:" | wc -l) + eval "${drive_var}=\$((\${${drive_var}} + \${PORTNUM}))" + done + fi + } + # Sata Disks SATADRIVES=0 if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then # Clean old files - [ -f "${TMP_PATH}/drivesmax" ] && rm -f "${TMP_PATH}/drivesmax" && touch "${TMP_PATH}/drivesmax" - [ -f "${TMP_PATH}/drivescon" ] && rm -f "${TMP_PATH}/drivescon" && touch "${TMP_PATH}/drivescon" - [ -f "${TMP_PATH}/ports" ] && rm -f "${TMP_PATH}/ports" && touch "${TMP_PATH}/ports" - [ -f "${TMP_PATH}/remap" ] && rm -f "${TMP_PATH}/remap" && touch "${TMP_PATH}/remap" - if [ $(lspci -d ::106 | wc -l) -gt 0 ]; then - let DISKIDXMAPIDX=0 - DISKIDXMAP="" - let DISKIDXMAPIDXMAX=0 - DISKIDXMAPMAX="" - for PCI in $(lspci -d ::106 2>/dev/null | awk '{print $1}'); do - NUMPORTS=0 - CONPORTS=0 - unset HOSTPORTS - declare -A HOSTPORTS - while read -r LINE; do - ATAPORT="$(echo ${LINE} | grep -o 'ata[0-9]*')" - PORT=$(echo ${ATAPORT} | sed 's/ata//') - HOSTPORTS[${PORT}]=$(echo ${LINE} | grep -o 'host[0-9]*$') - done < <(ls -l /sys/class/scsi_host | grep -F "${PCI}") - while read -r PORT; do - ls -l /sys/block | grep -F -q "${PCI}/ata${PORT}" && ATTACH=1 || ATTACH=0 - PCMD=$(cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd) - [ ${PCMD} = 0 ] && DUMMY=1 || DUMMY=0 - [ ${ATTACH} = 1 ] && CONPORTS="$((${CONPORTS} + 1))" && echo "$((${PORT} - 1))" >>"${TMP_PATH}/ports" - [ ${DUMMY} = 1 ] # Do nothing for now - NUMPORTS=$((${NUMPORTS} + 1)) - done < <(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n) - [ ${NUMPORTS} -gt 8 ] && NUMPORTS=8 - [ ${CONPORTS} -gt 8 ] && CONPORTS=8 - echo -n "${NUMPORTS}" >>"${TMP_PATH}/drivesmax" - echo -n "${CONPORTS}" >>"${TMP_PATH}/drivescon" - DISKIDXMAP=$DISKIDXMAP$(printf "%02x" $DISKIDXMAPIDX) - let DISKIDXMAPIDX=$DISKIDXMAPIDX+$CONPORTS - DISKIDXMAPMAX=$DISKIDXMAPMAX$(printf "%02x" $DISKIDXMAPIDXMAX) - let DISKIDXMAPIDXMAX=$DISKIDXMAPIDXMAX+$NUMPORTS - SATADRIVES=$((${SATADRIVES} + ${CONPORTS})) + for file in drivesmax drivescon ports remap; do + > "${TMP_PATH}/${file}" + done + + DISKIDXMAPIDX=0 + DISKIDXMAP="" + DISKIDXMAPIDXMAX=0 + DISKIDXMAPMAX="" + + for PCI in $(lspci -d ::106 2>/dev/null | awk '{print $1}'); do + NUMPORTS=0 + CONPORTS=0 + declare -A HOSTPORTS + + while read -r LINE; do + PORT=$(echo ${LINE} | grep -o 'ata[0-9]*' | sed 's/ata//') + HOSTPORTS[${PORT}]=$(echo ${LINE} | grep -o 'host[0-9]*$') + done < <(ls -l /sys/class/scsi_host | grep -F "${PCI}") + + for PORT in $(echo ${!HOSTPORTS[@]} | tr ' ' '\n' | sort -n); do + ATTACH=$(ls -l /sys/block | grep -F -q "${PCI}/ata${PORT}" && echo 1 || echo 0) + PCMD=$(cat /sys/class/scsi_host/${HOSTPORTS[${PORT}]}/ahci_port_cmd) + DUMMY=$([ ${PCMD} = 0 ] && echo 1 || echo 0) + + [ ${ATTACH} = 1 ] && CONPORTS=$((CONPORTS + 1)) && echo $((PORT - 1)) >>"${TMP_PATH}/ports" + NUMPORTS=$((NUMPORTS + 1)) done - fi + + NUMPORTS=$((NUMPORTS > 8 ? 8 : NUMPORTS)) + CONPORTS=$((CONPORTS > 8 ? 8 : CONPORTS)) + + echo -n "${NUMPORTS}" >>"${TMP_PATH}/drivesmax" + echo -n "${CONPORTS}" >>"${TMP_PATH}/drivescon" + DISKIDXMAP+=$(printf "%02x" $DISKIDXMAPIDX) + DISKIDXMAPIDX=$((DISKIDXMAPIDX + CONPORTS)) + DISKIDXMAPMAX+=$(printf "%02x" $DISKIDXMAPIDXMAX) + DISKIDXMAPIDXMAX=$((DISKIDXMAPIDXMAX + NUMPORTS)) + SATADRIVES=$((SATADRIVES + CONPORTS)) + done fi + # SAS Disks - SASDRIVES=0 - if [ $(lspci -d ::107 2>/dev/null | wc -l) -gt 0 ]; then - for PCI in $(lspci -d ::107 2>/dev/null | awk '{print $1}'); do - NAME=$(lspci -s "${PCI}" | sed "s/\ .*://") - PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null) - PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l) - SASDRIVES=$((${SASDRIVES} + ${PORTNUM})) - done - fi + detect_drives "107" "SASDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//" + # SCSI Disks - SCSIDRIVES=0 - if [ $(lspci -d ::100 2>/dev/null | wc -l) -gt 0 ]; then - for PCI in $(lspci -d ::100 2>/dev/null | awk '{print $1}'); do - NAME=$(lspci -s "${PCI}" | sed "s/\ .*://") - PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort - 2>/dev/null) - PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l) - SCSIDRIVES=$((${SCSIDRIVES} + ${PORTNUM})) - done - fi + detect_drives "100" "SCSIDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//" + # Raid Disks - RAIDDRIVES=0 - if [ $(lspci -d ::104 2>/dev/null | wc -l) -gt 0 ]; then - for PCI in $(lspci -d ::104 2>/dev/null | awk '{print $1}'); do - NAME=$(lspci -s "${PCI}" | sed "s/\ .*://") - PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null) - PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l) - RAIDDRIVES=$((${RAIDDRIVES} + ${PORTNUM})) - done - fi + detect_drives "104" "RAIDDRIVES" "/sys/class/scsi_host" "\[${PORT}:" "s/host//" + + # NVMe Disks + detect_drives "108" "NVMEDRIVES" "/sys/class/nvme" "\[N:${PORT}:" "s/nvme//" + # USB Disks USBDRIVES=0 if [ $(ls -l /sys/class/scsi_host 2>/dev/null | grep usb | wc -l) -gt 0 ]; then for PCI in $(lspci -d ::c03 2>/dev/null | awk '{print $1}'); do - NAME=$(lspci -s "${PCI}" | sed "s/\ .*://") PORT=$(ls -l /sys/class/scsi_host | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/host//' | sort -n 2>/dev/null) PORTNUM=$(lsscsi -b | grep -v - | grep "\[${PORT}:" | wc -l) [ ${PORTNUM} -eq 0 ] && continue - USBDRIVES=$((${USBDRIVES} + ${PORTNUM})) + USBDRIVES=$((USBDRIVES + PORTNUM)) done fi + # MMC Disks MMCDRIVES=0 if [ $(ls -l /sys/block/mmc* 2>/dev/null | wc -l) -gt 0 ]; then for PCI in $(lspci -d ::805 | awk '{print $1}'); do - NAME=$(lspci -s "${PCI}" 2>/dev/null | sed "s/\ .*://") PORTNUM=$(ls -l /sys/block/mmc* | grep "${PCI}" | wc -l 2>/dev/null) [ ${PORTNUM} -eq 0 ] && continue - MMCDRIVES=$((${MMCDRIVES} + ${PORTNUM})) - done - fi - # NVMe Disks - NVMEDRIVES=0 - if [ $(lspci -d ::108 2>/dev/null | wc -l) -gt 0 ]; then - for PCI in $(lspci -d ::108 2>/dev/null | awk '{print $1}'); do - NAME=$(lspci -s "${PCI}" | sed "s/\ .*://") - PORT=$(ls -l /sys/class/nvme | grep "${PCI}" | awk -F'/' '{print $NF}' | sed 's/nvme//' | sort -n 2>/dev/null) - PORTNUM=$(lsscsi -b | grep -v - | grep "\[N:${PORT}:" | wc -l) - NVMEDRIVES=$((${NVMEDRIVES} + ${PORTNUM})) + MMCDRIVES=$((MMCDRIVES + PORTNUM)) done fi + # Disk Count for MaxDisks DRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${USBDRIVES} + ${MMCDRIVES} + ${NVMEDRIVES})) HARDDRIVES=$((${SATADRIVES} + ${SASDRIVES} + ${SCSIDRIVES} + ${RAIDDRIVES} + ${NVMEDRIVES})) @@ -116,30 +107,56 @@ function getmap() { writeConfigKey "device.nvmedrives" "${NVMEDRIVES}" "${USER_CONFIG_FILE}" writeConfigKey "device.drives" "${DRIVES}" "${USER_CONFIG_FILE}" writeConfigKey "device.harddrives" "${HARDDRIVES}" "${USER_CONFIG_FILE}" + # Check for Sata Boot if [ $(lspci -d ::106 2>/dev/null | wc -l) -gt 0 ]; then LASTDRIVE=0 while read -r D; do if [ "${BUS}" = "sata" ] && [ "${MACHINE}" != "Native" ] && [ ${D} -eq 0 ]; then MAXDISKS=${DRIVES} - echo -n "${D}>${MAXDISKS}:">>"${TMP_PATH}/remap" - elif [ ${D} != ${LASTDRIVE} ]; then - echo -n "${D}>${LASTDRIVE}:">>"${TMP_PATH}/remap" - LASTDRIVE=$((${LASTDRIVE} + 1)) - elif [ ${D} = ${LASTDRIVE} ]; then - LASTDRIVE=$((${D} + 1)) + echo -n "${D}>${MAXDISKS}:" >>"${TMP_PATH}/remap" + elif [ ${D} -ne ${LASTDRIVE} ]; then + echo -n "${D}>${LASTDRIVE}:" >>"${TMP_PATH}/remap" + LASTDRIVE=$((LASTDRIVE + 1)) + else + LASTDRIVE=$((D + 1)) fi - done < <(cat "${TMP_PATH}/ports") + done < "${TMP_PATH}/ports" fi } function getmapSelection() { # Compute PortMap Options - SATAPORTMAPMAX="$(awk '{print $1}' "${TMP_PATH}/drivesmax")" - SATAPORTMAP="$(awk '{print $1}' "${TMP_PATH}/drivescon")" - SATAREMAP="$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//')" - EXTERNALCONTROLLER="$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}")" - ARCMODE="$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}")" + SATAPORTMAPMAX=$(awk '{print $1}' "${TMP_PATH}/drivesmax") + SATAPORTMAP=$(awk '{print $1}' "${TMP_PATH}/drivescon") + SATAREMAP=$(awk '{print $1}' "${TMP_PATH}/remap" | sed 's/.$//') + EXTERNALCONTROLLER=$(readConfigKey "device.externalcontroller" "${USER_CONFIG_FILE}") + ARCMODE=$(readConfigKey "arc.mode" "${USER_CONFIG_FILE}") + + show_dialog() { + dialog --backtitle "$(backtitle)" --title "Sata Portmap" \ + --menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \ + 1 "DiskIdxMap: Active Ports ${REMAP1}" \ + 2 "DiskIdxMap: Max Ports ${REMAP2}" \ + 3 "SataRemap: Remove empty Ports ${REMAP3}" \ + 4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \ + 5 "Set my own Portmap in Config" \ + 2>"${TMP_PATH}/resp" + [ $? -ne 0 ] && return 1 + resp=$(cat "${TMP_PATH}/resp") + [ -z "${resp}" ] && return 1 + } + + set_remap() { + case ${resp} in + 1) writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" ;; + 2) writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" ;; + 3) writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" ;; + 4) writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}" ;; + 5) writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}" ;; + esac + } + if [ "${ARCMODE}" = "config" ]; then # Show recommended Option to user if [ -n "${SATAREMAP}" ] && [ "${EXTERNALCONTROLLER}" = "true" ] && [ "${MACHINE}" = "Native" ]; then @@ -149,42 +166,13 @@ function getmapSelection() { else REMAP1="*" fi - # Ask for Portmap + if [ "${STEP}" = "storagemap" ]; then - dialog --backtitle "$(backtitlep)" --title "Sata Portmap" \ - --menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \ - 1 "DiskIdxMap: Active Ports ${REMAP1}" \ - 2 "DiskIdxMap: Max Ports ${REMAP2}" \ - 3 "SataRemap: Remove empty Ports ${REMAP3}" \ - 4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \ - 5 "Set my own Portmap in Config" \ - 2>"${TMP_PATH}/resp" - [ $? -ne 0 ] && return 1 - resp=$(cat "${TMP_PATH}/resp") - [ -z "${resp}" ] && return 1 + show_dialog || return 1 + set_remap else - dialog --backtitle "$(backtitle)" --title "Sata Portmap" \ - --menu "Choose a Portmap for Sata!?\n* Recommended Option" 8 60 0 \ - 1 "DiskIdxMap: Active Ports ${REMAP1}" \ - 2 "DiskIdxMap: Max Ports ${REMAP2}" \ - 3 "SataRemap: Remove empty Ports ${REMAP3}" \ - 4 "AhciRemap: Remove empty Ports (new) ${REMAP4}" \ - 5 "Set my own Portmap in Config" \ - 2>"${TMP_PATH}/resp" - [ $? -ne 0 ] && return 1 - resp=$(cat "${TMP_PATH}/resp") - [ -z "${resp}" ] && return 1 - fi - if [ ${resp} -eq 1 ]; then - writeConfigKey "arc.remap" "acports" "${USER_CONFIG_FILE}" - elif [ ${resp} -eq 2 ]; then - writeConfigKey "arc.remap" "maxports" "${USER_CONFIG_FILE}" - elif [ ${resp} -eq 3 ]; then - writeConfigKey "arc.remap" "remap" "${USER_CONFIG_FILE}" - elif [ ${resp} -eq 4 ]; then - writeConfigKey "arc.remap" "ahci" "${USER_CONFIG_FILE}" - elif [ ${resp} -eq 5 ]; then - writeConfigKey "arc.remap" "user" "${USER_CONFIG_FILE}" + show_dialog || return 1 + set_remap fi else # Show recommended Option to user @@ -198,53 +186,45 @@ function getmapSelection() { fi # Check Remap for correct config REMAP="$(readConfigKey "arc.remap" "${USER_CONFIG_FILE}")" - # Write Map to config and show Map to User - if [ "${REMAP}" = "acports" ]; then - writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}" - writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}" - elif [ "${REMAP}" = "maxports" ]; then - writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}" - writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}" - elif [ "${REMAP}" = "remap" ]; then - writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}" - elif [ "${REMAP}" = "ahci" ]; then - writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}" - elif [ "${REMAP}" = "user" ]; then - deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}" - deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}" - fi + deleteConfigKey "cmdline.SataPortMap" "${USER_CONFIG_FILE}" + deleteConfigKey "cmdline.DiskIdxMap" "${USER_CONFIG_FILE}" + deleteConfigKey "cmdline.sata_remap" "${USER_CONFIG_FILE}" + deleteConfigKey "cmdline.ahci_remap" "${USER_CONFIG_FILE}" + + case "${REMAP}" in + "acports") + writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAP}" "${USER_CONFIG_FILE}" + writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAP}" "${USER_CONFIG_FILE}" + ;; + "maxports") + writeConfigKey "cmdline.SataPortMap" "${SATAPORTMAPMAX}" "${USER_CONFIG_FILE}" + writeConfigKey "cmdline.DiskIdxMap" "${DISKIDXMAPMAX}" "${USER_CONFIG_FILE}" + ;; + "remap") + writeConfigKey "cmdline.sata_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}" + ;; + "ahci") + writeConfigKey "cmdline.ahci_remap" "${SATAREMAP}" "${USER_CONFIG_FILE}" + ;; + esac } # Check for Controller // 104=RAID // 106=SATA // 107=SAS // 100=SCSI // c03=USB -SATACONTROLLER=$(lspci -d ::106 2>/dev/null | wc -l) -writeConfigKey "device.satacontroller" "${SATACONTROLLER}" "${USER_CONFIG_FILE}" -if [ ${SATACONTROLLER} -gt 0 ]; then - writeConfigKey "device.externalcontroller" "false" "${USER_CONFIG_FILE}" -fi -SASCONTROLLER=$(lspci -d ::107 2>/dev/null | wc -l) -writeConfigKey "device.sascontroller" "${SASCONTROLLER}" "${USER_CONFIG_FILE}" -if [ ${SASCONTROLLER} -gt 0 ]; then - writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}" -fi -SCSICONTROLLER=$(lspci -d ::100 2>/dev/null | wc -l) -writeConfigKey "device.scsicontroller" "${SCSICONTROLLER}" "${USER_CONFIG_FILE}" -if [ ${SCSICONTROLLER} -gt 0 ]; then - writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}" -fi -RAIDCONTROLLER=$(lspci -d ::104 2>/dev/null | wc -l) -writeConfigKey "device.raidcontroller" "${RAIDCONTROLLER}" "${USER_CONFIG_FILE}" -if [ ${RAIDCONTROLLER} -gt 0 ]; then - writeConfigKey "device.externalcontroller" "true" "${USER_CONFIG_FILE}" -fi \ No newline at end of file +declare -A controllers=( + [satacontroller]=106 + [sascontroller]=107 + [scsicontroller]=100 + [raidcontroller]=104 +) + +external_controller=false + +for controller in "${!controllers[@]}"; do + count=$(lspci -d ::${controllers[$controller]} 2>/dev/null | wc -l) + writeConfigKey "device.${controller}" "${count}" "${USER_CONFIG_FILE}" + if [ "${controller}" != "satacontroller" ] && [ ${count} -gt 0 ]; then + external_controller=true + fi +done + +writeConfigKey "device.externalcontroller" "${external_controller}" "${USER_CONFIG_FILE}" \ No newline at end of file diff --git a/files/p1/boot/grub/grub.cfg b/files/p1/boot/grub/grub.cfg index 482854ca..c772f698 100644 --- a/files/p1/boot/grub/grub.cfg +++ b/files/p1/boot/grub/grub.cfg @@ -1,44 +1,66 @@ -set default="boot" + set timeout="5" set timeout_style="menu" -set vesa_mode=1 -set menu_color_normal=white/black -set menu_color_highlight=white/red -set color_normal=white/black if [ -s ${prefix}/grubenv ]; then load_env --skip-sig fi + if [ "${next_entry}" ]; then set default="${next_entry}" unset next_entry save_env next_entry -fi -if [ "${vesa_mode}" ]; then - set vesa_mode=${vesa_mode} -fi - -terminal_input console -terminal_output console - -if [ "${feature_all_video_module}" = "y" ]; then - insmod all_video else - insmod efi_gop - insmod efi_uga - insmod vbe - insmod vga - insmod video_bochs - insmod video_cirrus + set default="boot" fi -if loadfont unicode; then +if [ "${linux_gfx_mode}" ]; then + save_env linux_gfx_mode +else + set linux_gfx_mode=keep + save_env linux_gfx_mode +fi + +if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" +else + menuentry_id_option="" +fi + +export menuentry_id_option + +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 +} + +set menu_color_normal=white/black +set menu_color_highlight=white/red +set color_normal=white/black + +if [ x"${feature_default_font_path}" = xy ]; then + font=unicode +else + font=${prefix}/fonts/unicode.pf2 +fi + +if loadfont ${font}; then if [ "${grub_platform}" = "efi" ]; then set gfxmode=auto else set gfxmode=1024x768 fi - terminal_output gfxterm + load_video + insmod gfxterm insmod gfxmenu loadfont ${prefix}/theme/dejavu_bold_14.pf2 loadfont ${prefix}/theme/dejavu_mono_12.pf2 @@ -47,17 +69,20 @@ if loadfont unicode; then export theme fi +terminal_output gfxterm + if serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1; then terminal_input --append serial terminal_output --append serial fi -function set_gfxpayload { - if [ ${vesa_mode} -eq 1 ]; then - set gfxpayload=keep - else - set gfxpayload=text - fi +function gfxmode { + set gfxpayload="${linux_gfx_mode}" + if [ "${linux_gfx_mode}" = "keep" ]; then + set vt_handoff=vt.handoff=7 + else + set vt_handoff= + fi } set ARC_CMDLINE="earlyprintk earlycon=uart8250,io,0x3f8,115200n8 console=ttyS0,115200n8 root=/dev/ram rootwait intremap=off amd_iommu_intr=legacy net.ifnames=0 panic=5 split_lock_detect=off pcie_aspm=off intel_pstate=disable amd_pstate=disable nox2apic nomodeset" @@ -66,8 +91,8 @@ search --set=root --label "ARC3" if [ -s /zImage-dsm -a -s /initrd-dsm ]; then if [ "${default}" = "direct" ]; then set timeout="1" - menuentry 'DSM Direct Mode' --id direct { - set_gfxpayload + menuentry 'DSM Direct Mode' ${menuentry_id_option} direct { + gfxmode echo "Loading DSM Kernel..." linux /zImage-dsm ${dsm_cmdline} echo "Loading DSM Initramfs..." @@ -76,8 +101,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then echo "Access http://find.synology.com/ to connect the DSM via web." } fi - menuentry 'Arc DSM Mode' --id boot { - set_gfxpayload + menuentry 'Arc DSM Mode' ${menuentry_id_option} boot { + gfxmode echo "Loading Arc Kernel..." linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} echo "Loading Arc Initramfs..." @@ -91,8 +116,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then fi if [ -e /automated ]; then - menuentry 'Arc Automated Mode' --id automated { - set_gfxpayload + menuentry 'Arc Automated Mode' ${menuentry_id_option} automated { + gfxmode echo "Loading Arc Kernel..." linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} automated_arc echo "Loading Arc Initramfs..." @@ -105,8 +130,8 @@ if [ -e /automated ]; then } fi -menuentry 'Arc Config Mode' --id config { - set_gfxpayload +menuentry 'Arc Config Mode' ${menuentry_id_option} config { + gfxmode echo "Loading Arc Kernel..." linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} force_arc echo "Loading Arc Initramfs..." @@ -119,8 +144,8 @@ menuentry 'Arc Config Mode' --id config { } if [ -s /zImage-dsm -a -s /initrd-dsm ]; then - menuentry 'Arc Update Mode' --id update { - set_gfxpayload + menuentry 'Arc Update Mode' ${menuentry_id_option} update { + gfxmode echo "Loading Arc Kernel..." linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} update_arc echo "Loading Arc Initramfs..." @@ -131,8 +156,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then fi echo "Booting..." } - menuentry 'DSM Recovery Mode' --id recovery { - set_gfxpayload + menuentry 'DSM Recovery Mode' ${menuentry_id_option} recovery { + gfxmode echo "Loading Arc Kernel..." linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} recovery echo "Loading Arc Initramfs..." @@ -143,8 +168,8 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then fi echo "Booting..." } - menuentry 'DSM Reinstall Mode' --id junior { - set_gfxpayload + menuentry 'DSM Reinstall Mode' ${menuentry_id_option} junior { + gfxmode echo "Loading Arc Kernel..." linux /bzImage-arc ${ARC_CMDLINE} ${arc_cmdline} force_junior echo "Loading Arc Initramfs..." @@ -157,28 +182,28 @@ if [ -s /zImage-dsm -a -s /initrd-dsm ]; then } fi -menuentry 'Enter BIOS Setup' --id bios { +menuentry 'Enter UEFI Setup' ${menuentry_id_option} uefi { fwsetup } -menuentry 'Start Memtest86+' --id memtest { +menuentry 'Start Memtest86+' ${menuentry_id_option} memtest { echo "Loading memtest86+..." linux ${prefix}/memtest } -menuentry 'Poweroff' --id poweroff { +menuentry 'Poweroff' ${menuentry_id_option} poweroff { echo "System is powering off..." halt } if [ ${vesa_mode} = 1 ]; then - menuentry 'Change Vesa to Text Output' --id videomode { + menuentry 'Change Vesa to Text Output' ${menuentry_id_option} videomode { set vesa_mode=0 save_env vesa_mode configfile ${prefix}/grub.cfg } else - menuentry 'Change Text to Vesa Output' --id videomode { + menuentry 'Change Text to Vesa Output' ${menuentry_id_option} videomode { set vesa_mode=1 save_env vesa_mode reboot