]>
Commit | Line | Data |
---|---|---|
d2c65e37 AF |
1 | #!/bin/sh |
2 | ######################################################################## | |
3 | # Begin $rc_base/init.d/cpufreq | |
4 | # | |
5 | # Description : Initalisize and startup cpufreq and set a governor | |
6 | # | |
7 | # Authors : Arne Fitzenreiter - arne_f@ipfire.org | |
8 | # | |
26ca2208 | 9 | # Version : 01.01 |
d2c65e37 AF |
10 | # |
11 | # Notes : | |
12 | # | |
13 | ######################################################################## | |
14 | ||
15 | . /etc/sysconfig/rc | |
16 | . ${rc_functions} | |
17 | ||
18 | case "${1}" in | |
19 | start) | |
06391e6d | 20 | boot_mesg -n "Starting cpufreq... " |
a041a28d | 21 | |
4f3651e6 | 22 | # try cpufreq hardware depend modules |
ceffe9bd DW |
23 | for i in $(find /lib/modules/$(uname -r)/kernel/drivers/cpufreq \ |
24 | ! -name speedstep-lib.ko ! -name p4-clockmod.ko ! -name "cpufreq_*" ! -name mperf.ko | sort -d -r); do | |
03755188 AF |
25 | module=$(basename $i | cut -d. -f1); |
26 | modprobe $module > /dev/null 2>&1; | |
27 | if [ ${?} = 0 ]; then | |
28 | boot_mesg -n "$SUCCESS$module$NORMAL " | |
29 | fi | |
a041a28d AF |
30 | done |
31 | boot_mesg "" | |
4f3651e6 | 32 | |
d2c65e37 AF |
33 | # load cqufreq governors |
34 | modprobe cpufreq_conservative | |
35 | modprobe cpufreq_ondemand | |
36 | modprobe cpufreq_powersave | |
37 | modprobe cpufreq_userspace | |
38 | ||
03755188 | 39 | CPUCOUNT=`ls /sys/devices/system/cpu/cpu*/cpufreq/affected_cpus 2> /dev/null | wc -l `; |
341a7082 AF |
40 | let CPUCOUNT-=1 |
41 | # Set the governor to ondemand to test if it works | |
d2c65e37 | 42 | cpufreq-set -g ondemand |
4f3651e6 AF |
43 | if [ ${?} = 0 ]; then |
44 | # activate cpufreq collectd module | |
341a7082 AF |
45 | sed -i -e "s|^#LoadPlugin cpufreq|LoadPlugin cpufreq|g" /etc/collectd.conf |
46 | ||
47 | # Set the governor to ondemand for all cpus | |
48 | for i in `seq 0 $CPUCOUNT`; | |
49 | do | |
50 | cpufreq-set -c $i -g ondemand | |
51 | done | |
4f3651e6 AF |
52 | echo_ok; |
53 | else | |
54 | echo_failure; | |
55 | fi | |
d2c65e37 AF |
56 | exit 0; |
57 | ;; | |
58 | *) | |
59 | echo "Usage: ${0} {start}" | |
60 | exit 1 | |
61 | ;; | |
62 | esac | |
63 | ||
64 | # End $rc_base/init.d/cpufreq | |
03755188 AF |
65 | |
66 |