fix some problem in detecting cpu such as loongson

This commit is contained in:
saeziae 2022-11-03 23:50:58 +08:00
parent d56f083dbc
commit bce73f6836
No known key found for this signature in database
GPG key ID: 25E82BBEA32BD476

View file

@ -2573,9 +2573,8 @@ END
esac esac
# If cpu is not detected on a platform-specific bases, fallback to cpuinfo method # If cpu is not detected on a platform-specific bases, fallback to cpuinfo method
[[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' \ [[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' '/model name|Model|uarch|Hardware|Processor|^cpu model|chip type|^cpu type/ { print $2; exit}' "$cpu_file")"
'/model name|Model|uarch|Hardware|Processor|^cpu model|chip type|^cpu type/ { [[ -z "$cpu" ]] && cpu="$(awk -F '\\s*: | @' '/Hardware/ {print $2; exit}' "$cpu_file")"
cpu=$2; if ($1 == "Hardware") exit } END { print cpu }' "$cpu_file")"
speed_dir="/sys/devices/system/cpu/cpu0/cpufreq" speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"