]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/initscripts/init.d/cpufreq
Updated samba to latest stable
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / cpufreq
CommitLineData
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#
9# Version : 00.00
10#
11# Notes :
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. ${rc_functions}
17
18case "${1}" in
19 start)
06391e6d 20 boot_mesg -n "Starting cpufreq... "
a041a28d 21
4f3651e6 22 # try cpufreq hardware depend modules
a041a28d
AF
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 ""
4f3651e6 33
d2c65e37
AF
34 # load cqufreq governors
35 modprobe cpufreq_conservative
36 modprobe cpufreq_ondemand
37 modprobe cpufreq_powersave
38 modprobe cpufreq_userspace
39
341a7082
AF
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
d2c65e37 43 cpufreq-set -g ondemand
4f3651e6
AF
44 if [ ${?} = 0 ]; then
45 # activate cpufreq collectd module
341a7082
AF
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
4f3651e6
AF
53 echo_ok;
54 else
55 echo_failure;
56 fi
d2c65e37
AF
57 exit 0;
58 ;;
59 *)
60 echo "Usage: ${0} {start}"
61 exit 1
62 ;;
63esac
64
65# End $rc_base/init.d/cpufreq