summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-01-15 07:41:51 +0000
committerMike Frysinger <vapier@gentoo.org>2010-01-15 07:41:51 +0000
commit56eddb5b744ae5fcbf373ba96338073372d3ef0e (patch)
tree3a40a78815976740acf5eccf90abb5980b2eb1f3 /sys-power/cpufrequtils/files
parentKeyworded ~sparc. (diff)
downloadgentoo-2-56eddb5b744ae5fcbf373ba96338073372d3ef0e.tar.gz
gentoo-2-56eddb5b744ae5fcbf373ba96338073372d3ef0e.tar.bz2
gentoo-2-56eddb5b744ae5fcbf373ba96338073372d3ef0e.zip
Version bump #292246 by gionnico with updated NLS patch by Lars Wendler and a more flexible init.d script #179729 by Oliver Koch.
(Portage version: 2.2_rc61/cvs/Linux x86_64)
Diffstat (limited to 'sys-power/cpufrequtils/files')
-rw-r--r--sys-power/cpufrequtils/files/cpufrequtils-006-modprobe-gov.patch50
-rw-r--r--sys-power/cpufrequtils/files/cpufrequtils-006-nls.patch76
-rw-r--r--sys-power/cpufrequtils/files/cpufrequtils-conf.d-00611
-rwxr-xr-xsys-power/cpufrequtils/files/cpufrequtils-init.d-00641
4 files changed, 178 insertions, 0 deletions
diff --git a/sys-power/cpufrequtils/files/cpufrequtils-006-modprobe-gov.patch b/sys-power/cpufrequtils/files/cpufrequtils-006-modprobe-gov.patch
new file mode 100644
index 000000000000..4011f77bf236
--- /dev/null
+++ b/sys-power/cpufrequtils/files/cpufrequtils-006-modprobe-gov.patch
@@ -0,0 +1,50 @@
+if a gov isnt loaded, try to modprobe it first
+
+http://bugs.gentoo.org/204069
+
+--- a/lib/sysfs.c
++++ b/lib/sysfs.c
+@@ -12,6 +12,7 @@
+ #include <limits.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <sys/wait.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+
+@@ -539,8 +540,23 @@ static int verify_gov(char *new_gov, char *passed_gov)
+ return 0;
+ }
+
++static int modprobe(const char *module)
++{
++ char new_module[strlen(module) + 10];
++ int status;
++ pid_t child;
++
++ sprintf(new_module, "cpufreq_%s", module);
++ child = vfork();
++ if (child == 0)
++ _exit(execlp("modprobe", "modprobe", "-q", new_module, NULL));
++ waitpid(child, &status, 0);
++ return (WIFEXITED(status) && WEXITSTATUS(status) == 0 ? 0 : 1);
++}
++
+ int sysfs_modify_policy_governor(unsigned int cpu, char *governor)
+ {
++ int ret;
+ char new_gov[SYSFS_PATH_MAX];
+
+ if (!governor)
+@@ -549,7 +565,10 @@ int sysfs_modify_policy_governor(unsigned int cpu, char *governor)
+ if (verify_gov(new_gov, governor))
+ return -EINVAL;
+
+- return sysfs_write_one_value(cpu, WRITE_SCALING_GOVERNOR, new_gov, strlen(new_gov));
++ ret = sysfs_write_one_value(cpu, WRITE_SCALING_GOVERNOR, new_gov, strlen(new_gov));
++ if (ret == -ENODEV && modprobe(new_gov) == 0)
++ return sysfs_write_one_value(cpu, WRITE_SCALING_GOVERNOR, new_gov, strlen(new_gov));
++ return ret;
+ };
+
+ int sysfs_modify_policy_max(unsigned int cpu, unsigned long max_freq)
diff --git a/sys-power/cpufrequtils/files/cpufrequtils-006-nls.patch b/sys-power/cpufrequtils/files/cpufrequtils-006-nls.patch
new file mode 100644
index 000000000000..fa0b6015c4a4
--- /dev/null
+++ b/sys-power/cpufrequtils/files/cpufrequtils-006-nls.patch
@@ -0,0 +1,76 @@
+make nls/gettext support optional
+
+patch by
+Jos van der Ende <seraph@xs4all.nl>
+Lars Wendler <polynomial-c@gentoo.org>
+
+http://bugs.gentoo.org/205576
+http://bugs.gentoo.org/292246
+
+--- cpufrequtils-006/Makefile
++++ cpufrequtils-006/Makefile
+@@ -147,6 +147,7 @@
+ ifeq ($(strip $(NLS)),true)
+ INSTALL_NLS += install-gmo
+ COMPILE_NLS += update-gmo
++ CFLAGDEF += -DNLS
+ endif
+
+ ifeq ($(strip $(CPUFRQ_BENCH)),true)
+--- cpufrequtils-006/utils/info.c
++++ cpufrequtils-006/utils/info.c
+@@ -10,7 +10,6 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <libintl.h>
+ #include <locale.h>
+
+ #include <getopt.h>
+@@ -18,9 +17,18 @@
+ #include "cpufreq.h"
+
+
++#ifdef NLS
++#include <libintl.h>
+ #define _(String) gettext (String)
+ #define gettext_noop(String) String
+ #define N_(String) gettext_noop (String)
++#else
++#define gettext_noop(String) String
++#define _(String) gettext_noop (String)
++#define gettext(String) gettext_noop (String)
++#define N_(String) gettext_noop (String)
++#define textdomain(String)
++#endif
+
+ #define LINE_LEN 10
+
+--- cpufrequtils-006/utils/set.c
++++ cpufrequtils-006/utils/set.c
+@@ -12,16 +12,24 @@
+ #include <limits.h>
+ #include <string.h>
+ #include <ctype.h>
+-#include <libintl.h>
+ #include <locale.h>
+
+ #include <getopt.h>
+
+ #include "cpufreq.h"
+
++#ifdef NLS
++#include <libintl.h>
+ #define _(String) gettext(String)
+ #define gettext_noop(String) String
+ #define N_(String) gettext_noop(String)
++#else
++#define gettext_noop(String) String
++#define _(String) gettext_noop (String)
++#define gettext(String) gettext_noop (String)
++#define N_(String) gettext_noop (String)
++#define textdomain(String)
++#endif
+
+ #define NORM_FREQ_LEN 32
+
diff --git a/sys-power/cpufrequtils/files/cpufrequtils-conf.d-006 b/sys-power/cpufrequtils/files/cpufrequtils-conf.d-006
new file mode 100644
index 000000000000..895966448e44
--- /dev/null
+++ b/sys-power/cpufrequtils/files/cpufrequtils-conf.d-006
@@ -0,0 +1,11 @@
+# /etc/conf.d/cpufrequtils: config file for /etc/init.d/cpufrequtils
+
+# Options when starting cpufreq (given to the `cpufreq-set` program)
+START_OPTS="--governor ondemand"
+
+# Options when stopping cpufreq (given to the `cpufreq-set` program)
+STOP_OPTS="--governor performance"
+
+# Extra settings to write to sysfs cpufreq values.
+#SYSFS_EXTRA="ondemand/ignore_nice_load=1 ondemand/up_threshold=70"
+
diff --git a/sys-power/cpufrequtils/files/cpufrequtils-init.d-006 b/sys-power/cpufrequtils/files/cpufrequtils-init.d-006
new file mode 100755
index 000000000000..201f2341cbf9
--- /dev/null
+++ b/sys-power/cpufrequtils/files/cpufrequtils-init.d-006
@@ -0,0 +1,41 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-init.d-006,v 1.1 2010/01/15 07:41:51 vapier Exp $
+
+affect_change() {
+ local c ret=0 opts="$1"
+ shift
+ ebegin "Running cpufreq-set ${opts}"
+ for c in $(cpufreq-info -o | awk '$1 == "CPU" { print $2 }') ; do
+ cpufreq-set -c ${c} ${opts}
+ : $(( ret += $? ))
+ done
+ eend ${ret}
+
+ if [ $# -gt 0 ] ; then
+ c=1
+ einfo "Setting extra options: $*"
+ if cd /sys/devices/system/cpu/cpufreq ; then
+ local o v
+ for o in "$@" ; do
+ v=${o#*=}
+ o=${o%%=*}
+ echo ${v} > ${o} || break
+ done
+ c=0
+ fi
+ eend ${c}
+ : $(( ret += c ))
+ fi
+
+ return ${ret}
+}
+
+start() {
+ affect_change "${START_OPTS}" ${SYSFS_EXTRA}
+}
+
+stop() {
+ affect_change "${STOP_OPTS}"
+}