From f1cc7c20a139286d9313ad034f1c559759a34ba5 Mon Sep 17 00:00:00 2001 From: Ing Date: Wed, 26 Mar 2025 10:33:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20GPU=20=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/initrd/opt/rr/include/functions.sh | 8 ++++---- files/initrd/opt/rr/menu.sh | 9 +++++---- guide.md | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/files/initrd/opt/rr/include/functions.sh b/files/initrd/opt/rr/include/functions.sh index 6f007b12..856921b3 100755 --- a/files/initrd/opt/rr/include/functions.sh +++ b/files/initrd/opt/rr/include/functions.sh @@ -234,7 +234,7 @@ function _get_fastest() { URL="$(echo "${fastest}" | awk '{print $1}')" SPD="$(echo "${fastest}" | awk '{print $2}')" # It is a float type echo "${URL:-${1}}" - [ "$(echo "${SPD:-999}" | cut -d. -f1)" -ge 999 ] && return 1 || return 0 + [ "$(echo "${SPD:-999}" | cut -d'.' -f1)" -ge 999 ] && return 1 || return 0 } ############################################################################### @@ -301,11 +301,11 @@ function getBus() { function getIP() { local IP="" if [ -n "${1}" ] && [ -d "/sys/class/net/${1}" ]; then - IP=$(ip route show dev "${1}" 2>/dev/null | sed -n 's/.* via .* src \(.*\) metric .*/\1/p') - [ -z "${IP}" ] && IP=$(ip addr show "${1}" scope global 2>/dev/null | grep -E "inet .* eth" | awk '{print $2}' | cut -f1 -d'/' | head -1) + IP=$(ip route show dev "${1}" 2>/dev/null | sed -n 's/.* via .* src \(.*\) metric .*/\1/p' | head -1) + [ -z "${IP}" ] && IP=$(ip addr show "${1}" scope global 2>/dev/null | grep -E "inet .* eth" | awk '{print $2}' | cut -d'/' -f1 | head -1) else IP=$(ip route show 2>/dev/null | sed -n 's/.* via .* src \(.*\) metric .*/\1/p' | head -1) - [ -z "${IP}" ] && IP=$(ip addr show scope global 2>/dev/null | grep -E "inet .* eth" | awk '{print $2}' | cut -f1 -d'/' | head -1) + [ -z "${IP}" ] && IP=$(ip addr show scope global 2>/dev/null | grep -E "inet .* eth" | awk '{print $2}' | cut -d'/' -f1 | head -1) fi echo "${IP}" return 0 diff --git a/files/initrd/opt/rr/menu.sh b/files/initrd/opt/rr/menu.sh index a4c7522d..443dfe71 100755 --- a/files/initrd/opt/rr/menu.sh +++ b/files/initrd/opt/rr/menu.sh @@ -150,7 +150,8 @@ function modelMenu() { while true; do rm -f "${TMP_PATH}/menu" FLGNEX=0 - IGPUPS=(apollolake geminilake) + IGPU1L=(apollolake geminilake epyc7002) + IGPU2L=(epyc7002) IGPUID="$(lspci -nd ::300 2>/dev/null | grep "8086" | cut -d' ' -f3 | sed 's/://g')" NVMEMS=(DS918+ RS1619xs+ DS419+ DS1019+ DS719+ DS1621xs+) NVMEMD=$(find /sys/devices -type d -name nvme | awk -F'/' '{print NF}' | sort -n | tail -n1) @@ -170,8 +171,8 @@ function modelMenu() { fi unset DT G N H [ "$(readConfigKey "platforms.${A}.dt" "${WORK_PATH}/platforms.yml")" = "true" ] && DT="DT" || DT="" - [ -z "${G}" ] && [ ${hasiGPU} -eq 1 ] && echo "${IGPUPS[@]}" | grep -wq "${A}" && G="G" - [ -z "${G}" ] && [ ${hasiGPU} -eq 2 ] && echo "epyc7002" | grep -wq "${A}" && G="G" + [ -z "${G}" ] && [ ${hasiGPU} -eq 1 ] && echo "${IGPU1L[@]}" | grep -wq "${A}" && G="G" + [ -z "${G}" ] && [ ${hasiGPU} -eq 2 ] && echo "${IGPU2L[@]}" | grep -wq "${A}" && G="G" [ -z "${N}" ] && [ ${hasNVME} -ne 0 ] && [ "${DT}" = "DT" ] && N="N" [ -z "${N}" ] && [ ${hasNVME} -eq 2 ] && echo "${NVMEMS[@]}" | grep -wq "${M}" && N="N" [ -z "${H}" ] && [ ${hasHBA} -eq 1 ] && [ ! "${DT}" = "DT" ] && H="H" @@ -2161,7 +2162,7 @@ function languageMenu() { ############################################################################### # Choose a timezone function timezoneMenu() { - OPTIONS="$(find /usr/share/zoneinfo/right -type f | cut -d '/' -f 6- | sort | uniq | xargs)" + OPTIONS="$(find /usr/share/zoneinfo/right -type f | cut -d'/' -f6- | sort | uniq | xargs)" DIALOG --title "$(TEXT "Settings")" \ --default-item "${LAYOUT}" --no-items --menu "$(TEXT "Choose a timezone")" 0 0 20 ${OPTIONS} \ 2>"${TMP_PATH}/resp" diff --git a/guide.md b/guide.md index 923606d6..2e256b02 100644 --- a/guide.md +++ b/guide.md @@ -295,7 +295,7 @@ lspci -d ::302 # 查看 3D 控制器 (不是 VGA 兼容) # Intel GPU - lspci -nd ::300 | cut -d " " -f 3 # PIDVID + lspci -nd ::300 | cut -d' ' -f3 # PIDVID ls /dev/dri # 查看显卡设备 cat /sys/kernel/debug/dri/0/i915_frequency_info # 显卡驱动详细信息