linux-cachyos/auto-cpu-optimization.sh

48 lines
1.5 KiB
Bash
Raw Normal View History

2021-10-12 20:31:02 +02:00
#!/bin/bash
2022-06-11 15:05:56 +02:00
CPU=$(gcc -Q -march=native --help=target|grep march=|awk '{print $2}'|head -1)
MARCH=$(echo $CPU|tr '[:lower:]' '[:upper:]'&&echo)
if [[ ${MARCH} == "ZNVER1" ]]; then
2022-06-11 15:05:56 +02:00
MARCH="ZEN"
elif [[ ${MARCH} == "ZNVER2" ]]; then
MARCH="ZEN2"
elif [[ ${MARCH} == "ZNVER3" ]]; then
MARCH="ZEN3"
elif [[ ${MARCH} == "BDVER1" ]]; then
MARCH="BULLDOZER"
elif [[ ${MARCH} == "BDVER2" ]]; then
MARCH="PILEDRIVER"
elif [[ ${MARCH} == "BDVER3" ]]; then
MARCH="STEAMROLLER"
elif [[ ${MARCH} == "BDVER4" ]]; then
MARCH="EXCAVATOR"
elif [[ ${MARCH} == "BTVER1" ]]; then
MARCH="BOBCAT"
elif [[ ${MARCH} == "BTVER2" ]]; then
MARCH="JAGUAR"
elif [[ ${MARCH} == "AMDFAM10" ]]; then
MARCH="MK10"
elif [[ ${MARCH} == "K8-SSE3" ]]; then
MARCH="K8SSE3"
elif [[ ${MARCH} == "BONNELL" ]]; then
MARCH="ATOM"
elif [[ ${MARCH} == "GOLDMONT-PLUS" ]]; then
MARCH="GOLDMONTPLUS"
elif [[ ${MARCH} == "SKYLAKE-AVX512" ]]; then
MARCH="SKYLAKE2"
elif [[ ${MARCH} == "MIVYBRIDGE" ]]; then
scripts/config --disable CONFIG_AGP_AMD64
scripts/config --disable CONFIG_MICROCODE_AMD
MARCH="MIVYBRIDGE"
2022-06-11 15:05:56 +02:00
elif [[ ${MARCH} == "ICELAKE-CLIENT" ]]; then
MARCH="ICELAKE"
2021-10-12 20:31:02 +02:00
fi
2022-06-11 15:05:56 +02:00
MARCH2=M${MARCH}
echo
2021-10-12 20:31:02 +02:00
echo "----------------------------------"
echo "| APPLYING AUTO-CPU-OPTIMIZATION |"
echo "----------------------------------"
2022-06-11 15:05:56 +02:00
echo "[*] DETECTED CPU (MARCH) : ${MARCH2}"
scripts/config -k --disable CONFIG_GENERIC_CPU
scripts/config -k --enable CONFIG_${MARCH2}
sleep 3&&echo