]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/cpufreq
Updated cpufreq initskript to set all cpus to ondemand
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / cpufreq
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 #
9 # Version : 00.00
10 #
11 # Notes :
12 #
13 ########################################################################
14
15 . /etc/sysconfig/rc
16 . ${rc_functions}
17
18 case "${1}" in
19 start)
20 boot_mesg -n "Starting cpufreq... "
21
22 # try cpufreq hardware depend modules
23 for module in acpi-cpufreq cpufreq-nforce2 e-powersaver \
24 gx-suspmod longhaul longrun p4-clockmod powernow-k6 \
25 powernow-k7 powernow-k8 speedstep-centrino speedstep-ich \
26 speedstep-smi; do
27 modprobe $module > /dev/null 2>&1;
28 if [ ${?} = 0 ]; then
29 boot_mesg -n "$SUCCESS$module$NORMAL "
30 fi
31 done
32 boot_mesg ""
33
34 # load cqufreq governors
35 modprobe cpufreq_conservative
36 modprobe cpufreq_ondemand
37 modprobe cpufreq_powersave
38 modprobe cpufreq_userspace
39
40 CPUCOUNT=`ls /sys/devices/system/cpu/cpu*/cpufreq/affected_cpus | wc -l`;
41 let CPUCOUNT-=1
42 # Set the governor to ondemand to test if it works
43 cpufreq-set -g ondemand
44 if [ ${?} = 0 ]; then
45 # activate cpufreq collectd module
46 sed -i -e "s|^#LoadPlugin cpufreq|LoadPlugin cpufreq|g" /etc/collectd.conf
47
48 # Set the governor to ondemand for all cpus
49 for i in `seq 0 $CPUCOUNT`;
50 do
51 cpufreq-set -c $i -g ondemand
52 done
53 echo_ok;
54 else
55 echo_failure;
56 fi
57 exit 0;
58 ;;
59 *)
60 echo "Usage: ${0} {start}"
61 exit 1
62 ;;
63 esac
64
65 # End $rc_base/init.d/cpufreq