summarylogtreecommitdiffstats
path: root/auto-cpu-optimization.sh
blob: a1b76ec05944ece0bcfafdb6ccb1969ad043223b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
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
    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"
elif [[ ${MARCH} == "ICELAKE-CLIENT" ]]; then
    MARCH="ICELAKE"
fi
MARCH2=M${MARCH}
echo
echo "----------------------------------"
echo "| APPLYING AUTO-CPU-OPTIMIZATION |"
echo "----------------------------------"
echo "[*] DETECTED CPU (MARCH) : ${MARCH2}"
scripts/config -k --disable CONFIG_GENERIC_CPU
scripts/config -k --enable CONFIG_${MARCH2}
sleep 3&&echo