Package: cpufrequtils
Version: 002-2.1
Tags: patch

Here is the complete patch of my NMU relative to version 002-2.

Friendly,
-- 
Petter Reinholdtsen

diff -u cpufrequtils-002/po/de.po cpufrequtils-002/po/de.po
--- cpufrequtils-002/po/de.po
+++ cpufrequtils-002/po/de.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: cpufrequtils 0.1-pre2\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-04 19:52+0200\n"
+"POT-Creation-Date: 2007-05-25 14:53+0200\n"
 "PO-Revision-Date: 2004-11-03 22:21+0100\n"
 "Last-Translator:  <[EMAIL PROTECTED]>\n"
 "Language-Team: NONE\n"
diff -u cpufrequtils-002/po/fr.po cpufrequtils-002/po/fr.po
--- cpufrequtils-002/po/fr.po
+++ cpufrequtils-002/po/fr.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: cpufrequtils 0.1-pre2\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-04 19:52+0200\n"
+"POT-Creation-Date: 2007-05-25 14:53+0200\n"
 "PO-Revision-Date: 2004-11-17 15:53+1000\n"
 "Last-Translator: Bruno Ducrot <[EMAIL PROTECTED]>\n"
 "Language-Team: NONE\n"
diff -u cpufrequtils-002/po/it.po cpufrequtils-002/po/it.po
--- cpufrequtils-002/po/it.po
+++ cpufrequtils-002/po/it.po
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: cpufrequtils 0.3\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-10-04 19:52+0200\n"
+"POT-Creation-Date: 2007-05-25 14:53+0200\n"
 "PO-Revision-Date: 2005-05-04 20:00+0100\n"
 "Last-Translator: Mattia Dongili <[EMAIL PROTECTED]>\n"
 "Language-Team: NONE\n"
diff -u cpufrequtils-002/debian/changelog cpufrequtils-002/debian/changelog
--- cpufrequtils-002/debian/changelog
+++ cpufrequtils-002/debian/changelog
@@ -1,3 +1,29 @@
+cpufrequtils (002-2.1) unstable; urgency=low
+
+  * Non-maintainer upload with maintainers approval.
+  * Add init.d/loadcpufreq to detect and load the needed kernel
+    modules.  Based on code from powernowd in Ubuntu, combined into
+    one script and slightly modified to prefer acpi-cpufreq over
+    speedstep-centrino with kernels 2.6.20->. (Closes: #423991)
+  * Improve wording in README.Debian.  Based on suggestion from Pete
+    Boyd. (Closes: #412184)
+  * Make init.d script accept the same speed values in
+    default/cpufrequtils as cpufreq-set.  Patch from Bernd Feige.
+    (Closes: #392572)
+  * Move default values for init.d/cpufrequtils into the script, and
+    drop /etc/default/cpufrequtils as a conffile to ease
+    autoconfiguration and upgrades when the default values changes.
+  * Add hidden boolean debconf value cpufrequtils/active-on-boot to
+    enable the ondemand governor during installation.  Add lintian
+    overrides to ignore lintian warnings about hidden debconf
+    questions.
+  * Add provides line to the LSB header in init.d/cpufrequtils to keep
+    lintian and insserv happy.
+  * Remove runlevels from the LSB header default-stop, as the init.d
+    script do not stop anything.
+
+ -- Petter Reinholdtsen <[EMAIL PROTECTED]>  Fri, 25 May 2007 14:52:20 +0200
+
 cpufrequtils (002-2) unstable; urgency=low
 
   * Be Sarge's sed compliant, thanks to Peter Palfrader. (Closes: #378482)
diff -u cpufrequtils-002/debian/control cpufrequtils-002/debian/control
--- cpufrequtils-002/debian/control
+++ cpufrequtils-002/debian/control
@@ -8,7 +8,7 @@
 Package: cpufrequtils
 Architecture: any
 Section: admin
-Depends: ${shlibs:Depends}, lsb-base (>= 3.0)
+Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 3.0)
 Description: utilities to deal with the cpufreq Linux kernel feature
  This package contains two utilities for inspecting and setting the
  cpu frequency through both the sysfs and procfs CPUFreq kernel
diff -u cpufrequtils-002/debian/cpufrequtils.README.Debian cpufrequtils-002/debian/cpufrequtils.README.Debian
--- cpufrequtils-002/debian/cpufrequtils.README.Debian
+++ cpufrequtils-002/debian/cpufrequtils.README.Debian
@@ -1,8 +1,8 @@
               README for Debian package of Cpufrequtils
               =========================================
 
-This package provides very useful tools to get informations and set
-values about the CPUFreq Linux kernel features.
+This package provides very useful tools to get information about the CPUFreq
+Linux kernel features (with cpufreq-info) and set values for it (with cpufreq-set).
 This package provides the ability to set a chosen governor (different from
 the one configured at kernel compile time) at boot time by setting the governor
 name in /etc/default/cpufrequtils. By editing that file you can also set limits
reverted:
--- cpufrequtils-002/debian/cpufrequtils.default
+++ cpufrequtils-002.orig/debian/cpufrequtils.default
@@ -1,22 +0,0 @@
-# Which governor to use. Must be one of the governors listed in:
-#   cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
-#
-# and which limits to set. Both MIN_SPEED and MAX_SPEED must be values
-# listed in:
-#   cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
-# a value of 0 for any of the two variables will disabling the use of 
-# that limit variable.
-#
-# WARNING: the correct kernel module must already be loaded or compiled in.
-# 
-# Set ENABLE to "true" to let the script run at boot time.
-# 
-# eg:	ENABLE="true"
-#	GOVERNOR="ondemand"
-#	MAX_SPEED=1000
-#	MIN_SPEED=500
-
-ENABLE="false"
-GOVERNOR="ondemand"
-MAX_SPEED=0
-MIN_SPEED=0
diff -u cpufrequtils-002/debian/cpufrequtils.init cpufrequtils-002/debian/cpufrequtils.init
--- cpufrequtils-002/debian/cpufrequtils.init
+++ cpufrequtils-002/debian/cpufrequtils.init
@@ -1,9 +1,10 @@
 #!/bin/sh
 ### BEGIN INIT INFO
+# Provides:       cpufrequtils
 # Required-Start: $local_fs
 # Required-Stop:
 # Default-Start:  2 3 4 5
-# Default-Stop: 0 1 6
+# Default-Stop:
 # Short-Description: set CPUFreq kernel parameters
 # Description: utilities to deal with CPUFreq Linux 
 #	kernel support
@@ -20,6 +21,29 @@
 # use lsb-base
 . /lib/lsb/init-functions
 
+# Which governor to use. Must be one of the governors listed in:
+#   cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
+#
+# and which limits to set. Both MIN_SPEED and MAX_SPEED must be values
+# listed in:
+#   cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
+# a value of 0 for any of the two variables will disabling the use of 
+# that limit variable.
+#
+# WARNING: the correct kernel module must already be loaded or compiled in.
+# 
+# Set ENABLE to "true" to let the script run at boot time.
+# 
+# eg:	ENABLE="true"
+#	GOVERNOR="ondemand"
+#	MAX_SPEED=1000
+#	MIN_SPEED=500
+
+ENABLE="false"
+GOVERNOR="ondemand"
+MAX_SPEED=0
+MIN_SPEED=0
+
 [ -x $CPUFREQ_SET ] || exit 0
 
 if [ -f /etc/default/cpufrequtils ] ; then
@@ -31,11 +55,11 @@
 # if not enabled then exit gracefully
 [ "$ENABLE" = "true" ] || exit 0
 
-if [ $MAX_SPEED -gt 0 ] ; then
+if [ $MAX_SPEED != '0' ] ; then
 	CPUFREQ_OPTIONS="$CPUFREQ_OPTIONS --max $MAX_SPEED"
 fi
 
-if [ $MIN_SPEED -gt 0 ] ; then
+if [ $MIN_SPEED != '0' ] ; then
 	CPUFREQ_OPTIONS="$CPUFREQ_OPTIONS --min $MIN_SPEED"
 fi
 
diff -u cpufrequtils-002/debian/cpufrequtils.postinst cpufrequtils-002/debian/cpufrequtils.postinst
--- cpufrequtils-002/debian/cpufrequtils.postinst
+++ cpufrequtils-002/debian/cpufrequtils.postinst
@@ -24,10 +24,33 @@
 #     `abort-remove' or `abort-deconfigure'.
 
 # Source debconf library.
-#. /usr/share/debconf/confmodule
+. /usr/share/debconf/confmodule
 
 case "$1" in
     configure)
+	# Remove unedited conffiles, as the defaults values are in the
+	# script now.  This make automatic configuration easier.
+	deffile=/etc/default/cpufrequtils
+	if [ -f $deffile ]; then
+	    case $(md5sum $deffile|sed 's/ .*//') in 
+		a5a78170cb0fb90c5ae08fd397741f9d) # from version 002-2
+		    rm $deffile
+		    ;;
+		*)
+		    ;;
+	    esac
+	fi
+
+	# If the config file is missing (or removed above because it
+	# was the old default file), check debconf to see if the
+	# init.d script should be enabled.  This hidden debconf
+	# question allow preseeding during installation.
+	if [ ! -f $deffile ] ; then
+	    db_get cpufrequtils/enable
+	    if [ true = "$RET" ] ; then
+		echo 'ENABLE="true"' > $deffile
+	    fi
+	fi
         
         # setup startup links
 	# D-DEVEL didn't approve rcS.d/S37 (just after sysfs has been mounted)
diff -u cpufrequtils-002/debian/rules cpufrequtils-002/debian/rules
--- cpufrequtils-002/debian/rules
+++ cpufrequtils-002/debian/rules
@@ -90,6 +90,10 @@
 	dh_installexamples
 	dh_installman
 	dh_installinit -n
+	dh_installinit --name loadcpufreq -r --no-start -u"start 05 2 3 4 5 ."
+	dh_installdebconf
+	install -D -m644 debian/lintian.overrides \
+		debian/cpufrequtils/usr/share/lintian/overrides/cpufrequtils
 	dh_link
 	dh_strip
 	dh_compress 
only in patch2:
unchanged:
--- cpufrequtils-002.orig/debian/lintian.overrides
+++ cpufrequtils-002/debian/lintian.overrides
@@ -0,0 +1,2 @@
+cpufrequtils source: not-using-po-debconf
+cpufrequtils: no-debconf-config
only in patch2:
unchanged:
--- cpufrequtils-002.orig/debian/cpufrequtils.templates
+++ cpufrequtils-002/debian/cpufrequtils.templates
@@ -0,0 +1,6 @@
+Template: cpufrequtils/enable
+Type: boolean
+Default: false
+Description: Enable cpufreq governor at install time?
+ This is an internal (hidden) debconf question.  It should not be translated.
+
only in patch2:
unchanged:
--- cpufrequtils-002.orig/debian/cpufrequtils.loadcpufreq.init
+++ cpufrequtils-002/debian/cpufrequtils.loadcpufreq.init
@@ -0,0 +1,242 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          loadcpufreq
+# Required-Start:    $local_fs
+# Required-Stop:
+# Default-Start:     2 3 4 5
+# Default-Stop:
+# Short-Description: Load kernel modules needed to enable cpufreq scaling
+# Description:       Make it possible to save power by reducing
+#                    the CPU speed when there is little to do.
+### END INIT INFO
+# License: GNU General Public License.
+#
+# Based on scripts found in the powernowd package version
+# 0.97-1ubuntu6 on Ubuntu.
+#
+# This script is an interim solution until the default Debian packages
+# will load the proper kernel modules at boot time.  Track #396117,
+# #342014 and #367307 to see status on this.
+# <URL:http://0pointer.de/blog/projects/dmi-based-module-autoloading.html>
+# claim the later kernels support autoloading of these modules, so I
+# guess In the future this script can be dropped. [pere 2007-05-12]
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+NAME=loadcpufreq
+
+# Get lsb functions
+. /lib/lsb/init-functions
+. /etc/default/rcS
+
+[ -f /etc/default/loadcpufreq ] && . /etc/default/loadcpufreq
+
+set -e
+
+load_detected_cpufreq_modules() {
+    if /usr/sbin/laptop-detect; then LAPTOP=1; fi
+    CPUINFO=/proc/cpuinfo
+    IOPORTS=/proc/ioports
+
+    if [ ! -f $CPUINFO ] ; then
+	echo $CPUINFO not detected... >2
+	return
+    fi
+
+    MODEL_NAME=$(grep '^model name' "$CPUINFO" | head -1 | sed -e 's/^.*: //;')
+    CPU=$(grep -E '^cpud[^:]+:' "$CPUINFO" | head -1 | sed -e 's/^.*: //;')
+    VENDOR_ID=$(grep -E '^vendor_id[^:]+:' "$CPUINFO" | head -1 | sed -e 's/^.*: //;')
+    CPU_FAMILY=$(sed -e '/^cpu family/ {s/.*: //;p;Q};d' $CPUINFO)
+
+    MODULE=
+    MODULE_FALLBACK=acpi-cpufreq
+
+    # Two modules for PIII-M depending the chipset.
+    # modprobe speedstep-ich$EXT || modprobe speestep-smi$EXT
+    # would be another way
+    if [ -f $IOPORTS ] && grep -q 'Intel .*ICH' $IOPORTS ; then
+	PIII_MODULE=speedstep-ich
+    else
+	PIII_MODULE=speedstep-smi
+    fi
+
+    case "$VENDOR_ID" in
+        GenuineIntel*)
+            # If the CPU has the est flag, it supports enhanced
+            # speedstep and should use the speedstep-centrino driver
+            if [ "$(grep est $CPUINFO)" ]; then
+		case "$(uname -3)" in
+		    2.6.2[0-9]*)
+			# Prefer acpi-cpufreq for kernels after 2.6.20
+			MODULE=acpi-cpufreq
+			;;
+		    *)
+			MODULE=speedstep-centrino
+			;;
+		esac
+            elif [ $CPU_FAMILY = 15 ]; then
+            # Right. Check if it's a P4 without est.
+                # Could be speedstep-ich, or could be p4-clockmod. 
+                MODULE=speedstep-ich;
+                # Disabled for now - the latency tends to be bad
+                # enough to make it fairly pointless.
+                # echo "FREQDRIVER=p4-clockmod" >/etc/default/powernowd
+                # to override this
+#               if [ $LAPTOP = "1" ]; then
+#                   MODULE_FALLBACK=p4-clockmod;
+#               fi
+            else
+        # So it doesn't have Enhanced Speedstep, and it's not a
+        # P4. It could be a Speedstep PIII, or it may be
+        # unsupported. There's no terribly good programmatic way
+        # of telling.
+                case "$MODEL_NAME" in
+                    Intel\(R\)\ Pentium\(R\)\ III\ Mobile\ CPU*)
+                        MODULE=$PIII_MODULE
+                        ;;
+        
+        # JD: says this works with cpufreq_userspace
+
+                    Mobile\ Intel\(R\)\ Pentium\(R\)\ III\ CPU\ -\ M*)
+                        MODULE=$PIII_MODULE
+                        ;;
+        
+        # https://bugzilla.ubuntu.com/show_bug.cgi?id=4262
+        # UNCONFIRMED
+                    Pentium\ III\ \(Coppermine\)*)
+                        MODULE=$PIII_MODULE
+                        ;;
+                esac
+            fi
+            ;;
+        AuthenticAMD*)
+# Hurrah. This is nice and easy.
+            case $CPU_FAMILY in
+                5)
+                    # K6
+                    MODULE=powernow-k6
+                    ;;
+                6)
+                    # K7
+                    MODULE=powernow-k7
+                    ;;
+                15)
+                    # K8
+                    MODULE=powernow-k8
+                    ;;
+            esac
+            ;;
+        CentaurHauls*)
+        # VIA
+            if [ $CPU_FAMILY == 6 ]; then
+                MODULE=longhaul;
+            fi
+            ;;    
+        GenuineTMx86*)
+        # Transmeta
+            if [ "$(grep longrun $CPUINFO)" ]; then
+                MODULE=longrun
+            fi
+            ;;
+    esac
+}
+
+load_modules() {
+        #stop the kernel printk'ing at all while we load.
+        PRINTK=$(cat /proc/sys/kernel/printk)
+        [ "$VERBOSE" = no ] && echo "1 1 1 1" > /proc/sys/kernel/printk
+
+        #build a list of current modules so we don't load a module twice
+        LIST=$(/sbin/lsmod|awk '!/Module/ {print $1}')
+        
+        #get list of available modules
+        LOC="/lib/modules/$(uname -r)/kernel/drivers/cpufreq"
+        if [ -d $LOC ]; then
+          MODAVAIL=$( ( find $LOC -type f -name "*.o" -printf "basename %f .o\n"; \
+	      find $LOC -type f -name "*.ko" -printf "basename %f .ko\n" ) | /bin/sh)
+        else
+          MODAVAIL=""
+        fi
+
+        
+        #echo "Loading cpufreq modules:"
+        for mod in $MODAVAIL; do
+        #        echo "     $mod"
+                echo $LIST| grep -q -w "$mod" || modprobe $mod >/dev/null || /bin/true
+        done
+        
+        #cpufreq is built in on powerpc; just return
+        if [ "$(uname -m)" = "ppc" ]; then
+                echo "$PRINTK" > /proc/sys/kernel/printk
+                return 0
+        fi
+
+
+        #new style detection system
+        if [ ! "$FREQDRIVER" = "" ]; then 
+                modprobe "$FREQDRIVER"
+        else
+	        load_detected_cpufreq_modules
+		if [ ! -z "$MODULE" ] || [ ! -z "$MODULE_FALLBACK" ] ; then
+		    if [ ! -z "$MODULE" ] && modprobe "$MODULE" ; then
+			:
+		    else
+			modprobe "$MODULE_FALLBACK"
+		    fi
+		fi
+        fi
+
+        if [ "$USE_OLD_DETECT" = "fish" ]; then
+        # now lets load the driver
+        if [ ! $FREQDRIVER = "" ]; then 
+                modprobe $FREQDRIVER||true
+        fi
+        if [ "$(uname -m)" = "x86_64" ]; then 
+                modprobe powernow-k8 >/dev/null 2>&1||true
+        fi
+
+        if [ ! -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
+                modprobe acpi > /dev/null 2>&1|| true
+        fi
+        fi
+        echo "$PRINTK" > /proc/sys/kernel/printk
+}
+
+check_kernel() {
+	CPUFREQ=/sys/devices/system/cpu/cpu0/cpufreq
+
+	if [ -f "$CPUFREQ/scaling_governor" ] && \
+		[ -f "$CPUFREQ/scaling_available_governors" ] && \
+		grep -q userspace "$CPUFREQ/scaling_available_governors"
+	then
+		return 0
+	else
+		return 1
+	fi
+}
+
+case "$1" in
+  start)
+       	log_begin_msg "Loading cpufreq kernel modules... "
+        [ -f /proc/modules ] && load_modules
+	if check_kernel ; then
+	    log_end_msg 0
+	else
+	    log_end_msg 1
+	fi
+	;;
+  stop)
+	;;
+  restart|force-reload)
+        $0 stop
+	sleep 1
+	$0 start
+	#echo "$NAME."
+	;;
+  *)
+	N=/etc/init.d/$NAME
+	log_success_msg "Usage: $N {start|stop|restart|force-reload}" >&2
+	exit 1
+	;;
+esac
+
+exit 0

Reply via email to