From d2c65e371a8e043411d910f872394f850fa4166f Mon Sep 17 00:00:00 2001 From: Arne Fitzenreiter Date: Sat, 2 Aug 2008 09:27:36 +0200 Subject: [PATCH] Add cpufrequtils Disabled collectd wireless plugin as default, (enabling by hostapd initskript) --- config/collectd/collectd.conf | 3 +- config/rootfiles/packages/cpufrequtils | 17 ++++++ doc/packages-list.txt | 1 + lfs/collectd | 2 +- lfs/cpufrequtils | 83 ++++++++++++++++++++++++++ lfs/initscripts | 1 + make.sh | 1 + src/initscripts/init.d/cpufreq | 59 ++++++++++++++++++ src/initscripts/init.d/hostapd | 6 +- 9 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 config/rootfiles/packages/cpufrequtils create mode 100644 lfs/cpufrequtils create mode 100644 src/initscripts/init.d/cpufreq diff --git a/config/collectd/collectd.conf b/config/collectd/collectd.conf index 9c5ba2946d..f92ecf2c8a 100644 --- a/config/collectd/collectd.conf +++ b/config/collectd/collectd.conf @@ -13,6 +13,7 @@ Interval 30 ReadThreads 3 LoadPlugin cpu +#LoadPlugin cpufreq LoadPlugin disk LoadPlugin interface LoadPlugin iptables @@ -26,7 +27,7 @@ LoadPlugin rrdtool LoadPlugin sensors LoadPlugin swap LoadPlugin syslog -LoadPlugin wireless +#LoadPlugin wireless Interface "lo" diff --git a/config/rootfiles/packages/cpufrequtils b/config/rootfiles/packages/cpufrequtils new file mode 100644 index 0000000000..de102061a4 --- /dev/null +++ b/config/rootfiles/packages/cpufrequtils @@ -0,0 +1,17 @@ +usr/bin/cpufreq-info +usr/bin/cpufreq-set +#usr/include/cpufreq.h +#usr/lib/libcpufreq.a +#usr/lib/libcpufreq.la +usr/lib/libcpufreq.so +usr/lib/libcpufreq.so.0 +usr/lib/libcpufreq.so.0.0.0 +#usr/man/man1/cpufreq-info.1 +#usr/man/man1/cpufreq-set.1 +#usr/share/locale/cs/LC_MESSAGES/cpufrequtils.mo +usr/share/locale/de/LC_MESSAGES/cpufrequtils.mo +#usr/share/locale/fr/LC_MESSAGES/cpufrequtils.mo +#usr/share/locale/it/LC_MESSAGES/cpufrequtils.mo +#usr/share/locale/pt/LC_MESSAGES/cpufrequtils.mo +etc/rc.d/init.d/cpufreq +etc/rc.d/rc3.d/S18cpufreq diff --git a/doc/packages-list.txt b/doc/packages-list.txt index 70d564b085..398a6abd56 100644 --- a/doc/packages-list.txt +++ b/doc/packages-list.txt @@ -64,6 +64,7 @@ * collectd-4.4.1 * coreutils-5.96 * cpio-2.6 +* cpufrequtils-004 * cups-1.3.7 * curl-7.15.3 * cyrus-imapd-2.2.12 diff --git a/lfs/collectd b/lfs/collectd index 57061089d3..8eb4b4dc96 100644 --- a/lfs/collectd +++ b/lfs/collectd @@ -79,7 +79,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) cd $(DIR_APP) && ./configure --prefix=/usr --localstatedir=/var \ --disable-{apple_sensors,csv,ipvs,mbmon,memcached,mysql} \ - --disable-{netlink,nginx,nut,perl,serial,snmp,tape,vserver,wireless,xmms} \ + --disable-{netlink,nginx,nut,perl,serial,snmp,tape,vserver,xmms} \ --disable-{perl,serial,snmp,tape,vserver,xmms} \ --enable-{apcups,battery,cpu{,freq},df,disk,dns,email,entropy,exec,hddtemp} \ --enable-{interface,iptables,irq,load,logfile,memory,multimeter} \ diff --git a/lfs/cpufrequtils b/lfs/cpufrequtils new file mode 100644 index 0000000000..b799b6fdb6 --- /dev/null +++ b/lfs/cpufrequtils @@ -0,0 +1,83 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 004 + +THISAPP = cpufrequtils-$(VER) +DL_FILE = $(THISAPP).tar.bz2 +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) +PROG = cpufrequtils +PAK_VER = 1 + +DEPS = "" + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_MD5 = f868b9b6642c6c16b36cfd3eb627506a + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +md5 : $(subst %,%_MD5,$(objects)) + +dist: + @$(PAK) + +############################################################################### +# Downloading, checking, md5sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_MD5,$(objects)) : + @$(MD5) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && make + cd $(DIR_APP) && make install + @rm -rf $(DIR_APP) + @$(POSTBUILD) diff --git a/lfs/initscripts b/lfs/initscripts index fff10c1a35..8de4269abb 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -97,6 +97,7 @@ $(TARGET) : ln -sf ../init.d/halt /etc/rc.d/rc0.d/S99halt ln -sf ../init.d/sysklogd /etc/rc.d/rc3.d/S10sysklogd ln -sf ../init.d/smartenabler /etc/rc.d/rc3.d/S19smartenabler + ln -sf ../init.d/cpufreq /etc/rc.d/rc3.d/S18cpufreq ln -sf ../init.d/sysklogd /etc/rc.d/rc6.d/K90sysklogd ln -sf ../init.d/sendsignals /etc/rc.d/rc6.d/S60sendsignals ln -sf ../init.d/mountfs /etc/rc.d/rc6.d/S70mountfs diff --git a/make.sh b/make.sh index 973b4d59f2..4ae3d116a6 100755 --- a/make.sh +++ b/make.sh @@ -586,6 +586,7 @@ buildipfire() { ipfiremake urlgrabber ipfiremake syslinux ipfiremake tftp-hpa + ipfiremake cpufrequtils echo Build on $HOSTNAME > $BASEDIR/build/var/ipfire/firebuild cat /proc/version >> $BASEDIR/build/var/ipfire/firebuild echo >> $BASEDIR/build/var/ipfire/firebuild diff --git a/src/initscripts/init.d/cpufreq b/src/initscripts/init.d/cpufreq new file mode 100644 index 0000000000..e15037caf0 --- /dev/null +++ b/src/initscripts/init.d/cpufreq @@ -0,0 +1,59 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/cpufreq +# +# Description : Initalisize and startup cpufreq and set a governor +# +# Authors : Arne Fitzenreiter - arne_f@ipfire.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +case "${1}" in + start) + boot_mesg "Starting cpufreq ..." + # Chose your cpufreq module, acpi-cpufreq should work with + # newer hardware + modprobe acpi-cpufreq + # modprobe cpufreq-nforce2 + # modprobe e-powersaver + # modprobe gx-suspmod + # modprobe longhaul + # modprobe longrun + # modprobe p4-clockmod + # modprobe powernow-k6 + # modprobe powernow-k7 + # modprobe powernow-k8 + # modprobe speedstep-centrino + # modprobe speedstep-ich + # modprobe speedstep-lib + # modprobe speedstep-smi + + # load cqufreq governors + modprobe cpufreq_conservative + modprobe cpufreq_ondemand + modprobe cpufreq_powersave + modprobe cpufreq_userspace + + # Set the governor to ondemand + cpufreq-set -g ondemand + evaluate_retval; + + # activate cpufreq collectd module + sed -i -e "s|#LoadPlugin cpufreq|LoadPlugin cpufreq|g" /etc/collectd.conf + + exit 0; + ;; + *) + echo "Usage: ${0} {start}" + exit 1 + ;; +esac + +# End $rc_base/init.d/cpufreq diff --git a/src/initscripts/init.d/hostapd b/src/initscripts/init.d/hostapd index 87b08bb8ad..6fa326e82e 100644 --- a/src/initscripts/init.d/hostapd +++ b/src/initscripts/init.d/hostapd @@ -4,6 +4,8 @@ case "${1}" in start) + # enable wlan module of collectd + sed -i -e "s|#LoadPlugin wireless|LoadPlugin wireless|g" /etc/collectd.conf /usr/local/bin/wlanconfig ath0 destroy /usr/local/bin/wlanconfig blue0 create wlandev wifi0 wlanmode ap /usr/sbin/iwconfig blue0 channel 05 @@ -12,8 +14,8 @@ case "${1}" in ;; stop) - # Just make shure when going down the first time blue0 nw values are ignored - sed -i -e 's/^ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="*", NAME="blue0"*/#ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="*", NAME="blue0"*/' /etc/udev/rules.d/30-persistent-network.rules + # Just make sure when going down the first time blue0 nw values are ignored + sed -i -e 's/^ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="*", NAME="blue0"*/#ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="*", NAME="blue0"*/' /etc/udev/rules.d/30-persistent-network.rules /usr/local/bin/wlanconfig blue0 destroy killproc /usr/bin/hostapd evaluate_retval -- 2.39.2