|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# This program is free software: you can redistribute it and/or modify |
| 4 | +# it under the terms of the GNU General Public License as published by |
| 5 | +# the Free Software Foundation, either version 3 of the License, or |
| 6 | +# (at your option) any later version. |
| 7 | + |
| 8 | +# This program is distributed in the hope that it will be useful, |
| 9 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | +# GNU General Public License for more details. |
| 12 | + |
| 13 | +# You should have received a copy of the GNU General Public License |
| 14 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | + |
| 16 | +if [ ! -f "/media/fat/MiSTer" ]; |
| 17 | +then |
| 18 | + echo "This script must be run" |
| 19 | + echo "on a MiSTer system." |
| 20 | + exit 1 |
| 21 | +fi |
| 22 | + |
| 23 | +if [ ! -f "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" ]; |
| 24 | +then |
| 25 | + echo "This script must be run" |
| 26 | + echo "on a kernel with cpufreq driver." |
| 27 | + exit 1 |
| 28 | +fi |
| 29 | + |
| 30 | +echo "Warning: Active cooling required!" |
| 31 | +echo "Warning: Overclock/underclock at your own risk!" |
| 32 | +echo "This script comes with no warranty" |
| 33 | +echo "Press UP to proceed, press DOWN to abort" |
| 34 | + |
| 35 | +for (( ; ; )); do |
| 36 | + read -r -s -N 1 -t 1 key |
| 37 | + if [[ "${key}" == "A" ]]; then |
| 38 | + break |
| 39 | + elif [[ "${key}" == "B" ]]; then |
| 40 | + echo "Aborted script" |
| 41 | + exit 1 |
| 42 | + break |
| 43 | + fi |
| 44 | +done |
| 45 | + |
| 46 | +echo "1000000" > "/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq" |
| 47 | +echo "Max CPU frequency set to 1000 MHz" |
0 commit comments