mirror of
https://github.com/xmrig/xmrig.git
synced 2024-12-23 20:19:23 +00:00
9b63955b09
Checked using www.shellcheck.net Specific issues addessed: * https://github.com/koalaman/shellcheck/wiki/SC2002 * Use POSIX instead of bash for wider compatibility * Fail on error
36 lines
935 B
Bash
Executable file
36 lines
935 B
Bash
Executable file
#!/bin/sh -e
|
|
|
|
MSR_FILE=/sys/module/msr/parameters/allow_writes
|
|
|
|
if test -e "$MSR_FILE"; then
|
|
echo on > $MSR_FILE
|
|
else
|
|
modprobe msr allow_writes=on
|
|
fi
|
|
|
|
if grep -E 'AMD Ryzen|AMD EPYC' /proc/cpuinfo > /dev/null;
|
|
then
|
|
if grep "cpu family[[:space:]]:[[:space:]]25" /proc/cpuinfo > /dev/null;
|
|
then
|
|
echo "Detected Zen3 CPU"
|
|
wrmsr -a 0xc0011020 0x4480000000000
|
|
wrmsr -a 0xc0011021 0x1c000200000040
|
|
wrmsr -a 0xc0011022 0xc000000401500000
|
|
wrmsr -a 0xc001102b 0x2000cc14
|
|
echo "MSR register values for Zen3 applied"
|
|
else
|
|
echo "Detected Zen1/Zen2 CPU"
|
|
wrmsr -a 0xc0011020 0
|
|
wrmsr -a 0xc0011021 0x40
|
|
wrmsr -a 0xc0011022 0x1510000
|
|
wrmsr -a 0xc001102b 0x2000cc16
|
|
echo "MSR register values for Zen1/Zen2 applied"
|
|
fi
|
|
elif grep "Intel" /proc/cpuinfo > /dev/null;
|
|
then
|
|
echo "Detected Intel CPU"
|
|
wrmsr -a 0x1a4 0xf
|
|
echo "MSR register values for Intel applied"
|
|
else
|
|
echo "No supported CPU detected"
|
|
fi
|