|
Of course. I saved it as /usr/local/bin/check-temperature.sh
- #!/bin/bash
- FexSetting1=/media/boot/script.bin.OPI-PC_1080p60
- FexSetting2=/media/boot/script.bin-display
- diff /media/boot/script.bin ${FexSetting1} >/dev/null 2>&1
- case $? in
- 0)
- cat ${FexSetting2} >/media/boot/script.bin
- ;;
- *)
- cat ${FexSetting1} >/media/boot/script.bin
- ;;
- esac
- i=480000
- echo $i >/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
- echo $i >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
- echo performance >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
- sleep $(( 15 * 60 ))
- read Maximum </sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
- while [ $i -le ${Maximum} ]; do echo $i >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq; echo $i; sleep 6; i=$(( $i + 2400 )); done
- sleep 300
- cpuburn-a7 &
- sleep 300
- while [ $i -gt 480000 ]; do echo $i >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq; echo $i; sleep 6; i=$(( $i - 2400 )); done
- pkill cpuburn-a7
- sleep 300
- shutdown -r now
Copy code
It's called from within /etc/rc.local this way (the trailing " &" is important):
- /usr/local/bin/check-temperature.sh &
Copy code (ensure that "exit 0" follows later in /etc/rc.local).
The "sleep $(( 15 * 60 ))" statement ensures that 15 minutes after a reboot nothing happens (this is necessary to get correct thermal measurements when running the board headless, since the display controller will be activated after a hot or cold boot and disables itself after 10 minutes -- in case you use this with an active display you can lower the amount of time to 5 minutes). And then the script walks through all cpufrequencies starting from 480 MHz.
The 2 script.bin files containing different dvfs settings MUST exist and will be referenced through $FexSetting1 and $FexSetting2. Be careful. This is just a quick&dirty hack above. If the files you specify here don't exist, script.bin will be deleted and the next boot impossible!
|
|