From b03377f4d8b68fe04d4cde4545abc9cd893a61ae Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 21 Jul 2011 20:04:49 +0000 Subject: Add a few upstream fixes patches, one of which allows us to use cpufrequtils on mips. (Portage version: 2.1.10.3/cvs/Linux x86_64) --- sys-power/cpufrequtils/ChangeLog | 13 ++++- sys-power/cpufrequtils/cpufrequtils-008-r1.ebuild | 58 ++++++++++++++++++++++ .../files/cpufrequtils-008-cpuid.patch | 34 +++++++++++++ .../files/cpufrequtils-008-fix-msr-read.patch | 35 +++++++++++++ .../cpufrequtils-008-increase-MAX_LINE_LEN.patch | 29 +++++++++++ 5 files changed, 167 insertions(+), 2 deletions(-) create mode 100644 sys-power/cpufrequtils/cpufrequtils-008-r1.ebuild create mode 100644 sys-power/cpufrequtils/files/cpufrequtils-008-cpuid.patch create mode 100644 sys-power/cpufrequtils/files/cpufrequtils-008-fix-msr-read.patch create mode 100644 sys-power/cpufrequtils/files/cpufrequtils-008-increase-MAX_LINE_LEN.patch (limited to 'sys-power') diff --git a/sys-power/cpufrequtils/ChangeLog b/sys-power/cpufrequtils/ChangeLog index 6fd3640c6f46..81a06c542440 100644 --- a/sys-power/cpufrequtils/ChangeLog +++ b/sys-power/cpufrequtils/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for sys-power/cpufrequtils -# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/ChangeLog,v 1.55 2010/08/13 14:03:56 josejx Exp $ +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/ChangeLog,v 1.56 2011/07/21 20:04:49 mattst88 Exp $ + +*cpufrequtils-008-r1 (21 Jul 2011) + + 21 Jul 2011; Matt Turner +cpufrequtils-008-r1.ebuild, + +files/cpufrequtils-008-cpuid.patch, + +files/cpufrequtils-008-fix-msr-read.patch, + +files/cpufrequtils-008-increase-MAX_LINE_LEN.patch: + Add a few upstream fixes patches, one of which allows us to use cpufrequtils + on mips. 13 Aug 2010; Joseph Jezak cpufrequtils-007.ebuild: Marked ppc/ppc64 stable for bug #327035. diff --git a/sys-power/cpufrequtils/cpufrequtils-008-r1.ebuild b/sys-power/cpufrequtils/cpufrequtils-008-r1.ebuild new file mode 100644 index 000000000000..1b5c3517f25a --- /dev/null +++ b/sys-power/cpufrequtils/cpufrequtils-008-r1.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/cpufrequtils-008-r1.ebuild,v 1.1 2011/07/21 20:04:49 mattst88 Exp $ + +EAPI="3" + +inherit eutils toolchain-funcs multilib + +DESCRIPTION="Userspace utilities for the Linux kernel cpufreq subsystem" +HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html" +SRC_URI="mirror://kernel/linux/utils/kernel/cpufreq/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux" +IUSE="debug nls" + +DEPEND="" +RDEPEND="" + +ft() { use $1 && echo true || echo false ; } + +src_prepare() { + epatch "${FILESDIR}"/${PN}-007-build.patch + epatch "${FILESDIR}"/${PN}-007-nls.patch #205576 #292246 + epatch "${FILESDIR}"/${PN}-008-remove-pipe-from-CFLAGS.patch #362523 + epatch "${FILESDIR}"/${PN}-008-cpuid.patch + epatch "${FILESDIR}"/${PN}-008-fix-msr-read.patch + epatch "${FILESDIR}"/${PN}-008-increase-MAX_LINE_LEN.patch +} + +src_configure() { + export DEBUG=$(ft debug) V=true NLS=$(ft nls) + unset bindir sbindir includedir localedir confdir + export mandir="${EPREFIX}/usr/share/man" + export libdir="${EPREFIX}/usr/$(get_libdir)" + export docdir="${EPREFIX}/usr/share/doc/${PF}" +} + +src_compile() { + emake \ + CC="$(tc-getCC)" \ + LD="$(tc-getCC)" \ + AR="$(tc-getAR)" \ + STRIP=: \ + RANLIB="$(tc-getRANLIB)" \ + LIBTOOL="${EPREFIX}"/usr/bin/libtool \ + INSTALL="${EPREFIX}"/usr/bin/install \ + || die +} + +src_install() { + emake DESTDIR="${D}" install || die + dodoc AUTHORS README + + newinitd "${FILESDIR}"/${PN}-init.d-006 ${PN} || die + newconfd "${FILESDIR}"/${PN}-conf.d-006 ${PN} +} diff --git a/sys-power/cpufrequtils/files/cpufrequtils-008-cpuid.patch b/sys-power/cpufrequtils/files/cpufrequtils-008-cpuid.patch new file mode 100644 index 000000000000..5982e91ee60c --- /dev/null +++ b/sys-power/cpufrequtils/files/cpufrequtils-008-cpuid.patch @@ -0,0 +1,34 @@ +From f1b6bccf08f53295b2f7f448f28bbd37533c14a2 Mon Sep 17 00:00:00 2001 +From: Zhang Le +Date: Sun, 18 Jul 2010 02:05:28 +0800 +Subject: [PATCH 1/1] Only x86 has cpuid instruction + +Signed-off-by: Zhang Le +Signed-off-by: Dominik Brodowski +--- + utils/aperf.c | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/utils/aperf.c b/utils/aperf.c +index 627fb17..1c64501 100644 +--- a/utils/aperf.c ++++ b/utils/aperf.c +@@ -68,11 +68,15 @@ struct avg_perf_cpu_info + + static int cpu_has_effective_freq() + { ++#if defined(__i386__) || defined(__x86_64__) + /* largest base level */ + if (cpuid_eax(0) < 6) + return 0; + + return cpuid_ecx(6) & 0x1; ++#else ++ return 0; ++#endif + } + + /* +-- +1.7.4.4 + diff --git a/sys-power/cpufrequtils/files/cpufrequtils-008-fix-msr-read.patch b/sys-power/cpufrequtils/files/cpufrequtils-008-fix-msr-read.patch new file mode 100644 index 000000000000..c1d13ec25c42 --- /dev/null +++ b/sys-power/cpufrequtils/files/cpufrequtils-008-fix-msr-read.patch @@ -0,0 +1,35 @@ +From d4490efed068a552e8b67d52a0726458a224c9a0 Mon Sep 17 00:00:00 2001 +From: Frank Arnold +Date: Wed, 8 Dec 2010 17:39:14 +0100 +Subject: [PATCH] cpufrequtils aperf: Fix MSR read on 32-bit + +The cpufreq-aperf command does not work on 32-bit systems. The reason +for that is a wrong count argument passed to the read() call. Instead +of the buffer size, the size of the pointer to the buffer is used. On +64-bit systems this just happened to work, because we need to read an +8 byte value and a pointer has a size of 8 bytes on 64-bit. On 32-bit +systems only 4 bytes are read, which then triggers the error path. + +Signed-off-by: Frank Arnold +Reviewed-by: Thomas Renninger +Signed-off-by: Dominik Brodowski +--- + utils/aperf.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/utils/aperf.c b/utils/aperf.c +index 1c64501..6302f5a 100644 +--- a/utils/aperf.c ++++ b/utils/aperf.c +@@ -100,7 +100,7 @@ static int read_msr(int cpu, unsigned int idx, unsigned long long *val) + return -1; + if (lseek(fd, idx, SEEK_CUR) == -1) + goto err; +- if (read(fd, val, sizeof val) != sizeof *val) ++ if (read(fd, val, sizeof *val) != sizeof *val) + goto err; + close(fd); + return 0; +-- +1.7.4.4 + diff --git a/sys-power/cpufrequtils/files/cpufrequtils-008-increase-MAX_LINE_LEN.patch b/sys-power/cpufrequtils/files/cpufrequtils-008-increase-MAX_LINE_LEN.patch new file mode 100644 index 000000000000..e4ef1de584d1 --- /dev/null +++ b/sys-power/cpufrequtils/files/cpufrequtils-008-increase-MAX_LINE_LEN.patch @@ -0,0 +1,29 @@ +From 9f2efa7bc6969c10562ac2c720d50ff77083e5c2 Mon Sep 17 00:00:00 2001 +From: Roman Vasiyarov +Date: Mon, 25 Apr 2011 21:34:23 +0400 +Subject: [PATCH] cpufrequtils sysfs: increase MAX_LINE_LEN + +larger sysfs data (>255 bytes) was truncated and thus used improperly + +Signed-off-by: Roman Vasiyarov +Signed-off-by: Dominik Brodowski +--- + lib/sysfs.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/lib/sysfs.c b/lib/sysfs.c +index 4e0edab..24dd563 100644 +--- a/lib/sysfs.c ++++ b/lib/sysfs.c +@@ -18,7 +18,7 @@ + #include "cpufreq.h" + + #define PATH_TO_CPU "/sys/devices/system/cpu/" +-#define MAX_LINE_LEN 255 ++#define MAX_LINE_LEN 4096 + #define SYSFS_PATH_MAX 255 + + /* helper function to read file from /sys into given buffer */ +-- +1.7.4.4 + -- cgit v1.2.3-65-gdbad