mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 06:06:32 +00:00
raspberrypi: added a cpu frequency startup script
This commit is contained in:
parent
6b69e1b0b0
commit
e26a3717f9
36
board/raspberrypi/overlay/etc/init.d/S05cpufreq
Executable file
36
board/raspberrypi/overlay/etc/init.d/S05cpufreq
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
|
||||||
|
gov="ondemand"
|
||||||
|
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
|
||||||
|
govdir="/sys/devices/system/cpu/cpufreq/$gov"
|
||||||
|
|
||||||
|
configure() {
|
||||||
|
echo $gov > $cpufreqdir/scaling_governor
|
||||||
|
if [ $gov == "ondemand" ]; then
|
||||||
|
echo 50 > $govdir/up_threshold
|
||||||
|
echo 100000 > $govdir/sampling_rate
|
||||||
|
echo 50 > $govdir/sampling_down_factor
|
||||||
|
echo 1 > $govdir/io_is_busy
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
msg_begin "Configuring CPU Frequency"
|
||||||
|
configure
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
true
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
||||||
|
|
36
board/raspberrypi2/overlay/etc/init.d/S05cpufreq
Executable file
36
board/raspberrypi2/overlay/etc/init.d/S05cpufreq
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
|
||||||
|
gov="ondemand"
|
||||||
|
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
|
||||||
|
govdir="/sys/devices/system/cpu/cpufreq/$gov"
|
||||||
|
|
||||||
|
configure() {
|
||||||
|
echo $gov > $cpufreqdir/scaling_governor
|
||||||
|
if [ $gov == "ondemand" ]; then
|
||||||
|
echo 50 > $govdir/up_threshold
|
||||||
|
echo 100000 > $govdir/sampling_rate
|
||||||
|
echo 50 > $govdir/sampling_down_factor
|
||||||
|
echo 1 > $govdir/io_is_busy
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
msg_begin "Configuring CPU Frequency"
|
||||||
|
configure
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
true
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
||||||
|
|
@ -1,16 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
gpio=35
|
|
||||||
check_interval=30
|
check_interval=30
|
||||||
export=/sys/class/gpio/export
|
readv=/sys/class/leds/led1/brightness
|
||||||
readv=/sys/class/gpio/gpio$gpio/value
|
|
||||||
|
test -e "$readv" || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
|
||||||
configure() {
|
|
||||||
echo $gpio > $export
|
|
||||||
}
|
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
while true; do
|
while true; do
|
||||||
if [ "$(cat $readv)" == "0" ]; then
|
if [ "$(cat $readv)" == "0" ]; then
|
||||||
@ -23,9 +19,8 @@ watch() {
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
msg_begin "Starting brownout detector"
|
msg_begin "Starting brownout detector"
|
||||||
configure
|
|
||||||
test $? == 0 && msg_done || msg_fail
|
|
||||||
watch &
|
watch &
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
|
36
board/raspberrypi3/overlay/etc/init.d/S05cpufreq
Executable file
36
board/raspberrypi3/overlay/etc/init.d/S05cpufreq
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
|
||||||
|
gov="ondemand"
|
||||||
|
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
|
||||||
|
govdir="/sys/devices/system/cpu/cpufreq/$gov"
|
||||||
|
|
||||||
|
configure() {
|
||||||
|
echo $gov > $cpufreqdir/scaling_governor
|
||||||
|
if [ $gov == "ondemand" ]; then
|
||||||
|
echo 50 > $govdir/up_threshold
|
||||||
|
echo 100000 > $govdir/sampling_rate
|
||||||
|
echo 50 > $govdir/sampling_down_factor
|
||||||
|
echo 1 > $govdir/io_is_busy
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
msg_begin "Configuring CPU Frequency"
|
||||||
|
configure
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
true
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
||||||
|
|
@ -1,16 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
gpio=35
|
|
||||||
check_interval=30
|
check_interval=30
|
||||||
export=/sys/class/gpio/export
|
readv=/sys/class/leds/led1/brightness
|
||||||
readv=/sys/class/gpio/gpio$gpio/value
|
|
||||||
|
test -e "$readv" || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "$os_version" || source /etc/init.d/base
|
||||||
|
|
||||||
configure() {
|
|
||||||
echo $gpio > $export
|
|
||||||
}
|
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
while true; do
|
while true; do
|
||||||
if [ "$(cat $readv)" == "0" ]; then
|
if [ "$(cat $readv)" == "0" ]; then
|
||||||
@ -23,9 +19,8 @@ watch() {
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
msg_begin "Starting brownout detector"
|
msg_begin "Starting brownout detector"
|
||||||
configure
|
|
||||||
test $? == 0 && msg_done || msg_fail
|
|
||||||
watch &
|
watch &
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user