Commit 862c741a authored by Timo Teräs's avatar Timo Teräs

main/cpufrequtils: apply upstream commits to fix arm build

and also the other issues we were already patching for.
parent fc0e71c8
From f1b6bccf08f53295b2f7f448f28bbd37533c14a2 Mon Sep 17 00:00:00 2001
From: Zhang Le <r0bertz@gentoo.org>
Date: Sun, 18 Jul 2010 02:05:28 +0800
Subject: [PATCH 1/8] Only x86 has cpuid instruction
Signed-off-by: Zhang Le <r0bertz@gentoo.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
utils/aperf.c | 4 ++++
1 file changed, 4 insertions(+)
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.10
From 4c6552d2df2912a710cab6acf476347a7fbf15a0 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 1 Sep 2010 09:12:44 +0000
Subject: [PATCH] Support for Position Independet Code by aboid clobbering PIC register
Do not use the PIC register (ebx)
See http://www.gentoo.org/proj/en/hardened/pic-fix-guide.xml#doc_chap5
---
utils/cpuid.h | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/utils/cpuid.h b/utils/cpuid.h
index 2bac69a..ebcec7c 100644
--- a/utils/cpuid.h
+++ b/utils/cpuid.h
@@ -5,9 +5,12 @@ static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{
/* ecx is often an input as well as an output. */
- asm volatile("cpuid"
+ asm volatile(
+ "movl %%ebx, %%esi;"
+ "cpuid;"
+ "xchg %%ebx, %%esi;"
: "=a" (*eax),
- "=b" (*ebx),
+ "=S" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "0" (*eax), "2" (*ecx));
--
1.7.2.2
From d4490efed068a552e8b67d52a0726458a224c9a0 Mon Sep 17 00:00:00 2001
From: Frank Arnold <frank.arnold@amd.com>
Date: Wed, 8 Dec 2010 17:39:14 +0100
Subject: [PATCH 3/8] 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 <frank.arnold@amd.com>
Reviewed-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
utils/aperf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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.10
From 9f2efa7bc6969c10562ac2c720d50ff77083e5c2 Mon Sep 17 00:00:00 2001
From: Roman Vasiyarov <rvasiyarov@gmail.com>
Date: Mon, 25 Apr 2011 21:34:23 +0400
Subject: [PATCH 5/8] cpufrequtils sysfs: increase MAX_LINE_LEN
larger sysfs data (>255 bytes) was truncated and thus used improperly
Signed-off-by: Roman Vasiyarov <rvasiyarov@gmail.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
lib/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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.10
From 9085ce6f615d9d2e0182d3ce029b882835bd0a6b Mon Sep 17 00:00:00 2001
From: Matt Turner <mattst88@gmail.com>
Date: Tue, 26 Jul 2011 19:28:31 -0400
Subject: [PATCH 6/8] aperf: fix compilation on x86-32 with -fPIC
ebx is used to store the GOT pointer when compiled with -fPIC, so it's
not usable by inline assembly.
https://bugs.gentoo.org/375967
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
utils/cpuid.h | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/utils/cpuid.h b/utils/cpuid.h
index 2bac69a..53da789 100644
--- a/utils/cpuid.h
+++ b/utils/cpuid.h
@@ -5,9 +5,21 @@ static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{
/* ecx is often an input as well as an output. */
- asm volatile("cpuid"
+ asm volatile(
+#if defined(__i386__) && defined(__PIC__)
+ "push %%ebx\n"
+ "cpuid\n"
+ "movl %%ebx, %1\n"
+ "pop %%ebx\n"
+#else
+ "cpuid\n"
+#endif
: "=a" (*eax),
+#if defined(__i386__) && defined(__PIC__)
+ "=r" (*ebx),
+#else
"=b" (*ebx),
+#endif
"=c" (*ecx),
"=d" (*edx)
: "0" (*eax), "2" (*ecx));
--
1.7.10
From 26ce99ab92ae9f1f367a58b7858a96f4e1e6814c Mon Sep 17 00:00:00 2001
From: Dominik Brodowski <linux@dominikbrodowski.net>
Date: Fri, 29 Jul 2011 19:40:46 +0200
Subject: [PATCH 7/8] po: add missing word in DE
Reported-by: Michael Basse
Reported-by: <tkranz@zedat.fu-berlin.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
po/de.po | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/po/de.po b/po/de.po
index 1da1f2b..ee793f5 100644
--- a/po/de.po
+++ b/po/de.po
@@ -304,7 +304,7 @@ msgid ""
"modified\n"
msgstr ""
" -c CPU, --cpu CPU Nummer der CPU, deren Taktfrequenz-Einstellung\n"
-" werden soll\n"
+" verndert werden soll\n"
#: utils/set.c:39
#, c-format
--
1.7.10
diff --git a/Makefile b/Makefile
index 19f3dd6..b7f1e56 100644
--- a/Makefile
+++ b/Makefile
@@ -147,6 +147,7 @@ endif
From a2f0c39d5f21596bb9f5223e895c0ff210b265d0 Mon Sep 17 00:00:00 2001
From: Sergey Dryabzhinsky <sergey.dryabzhinsky@gmail.com>
Date: Sat, 13 Aug 2011 23:02:20 -0400
Subject: [PATCH 8/8] cpufrequtils: make NLS optional
https://bugs.gentoo.org/205576
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
Makefile | 1 +
utils/info.c | 10 +++++++++-
utils/set.c | 10 +++++++++-
3 files changed, 19 insertions(+), 2 deletions(-)
Index: cpufrequtils/Makefile
===================================================================
--- cpufrequtils.orig/Makefile 2012-05-06 13:30:41.865796974 +0900
+++ cpufrequtils/Makefile 2012-05-06 13:35:13.994099919 +0900
@@ -140,6 +140,7 @@
ifeq ($(strip $(NLS)),true)
INSTALL_NLS += install-gmo
COMPILE_NLS += update-gmo
+ CFLAGDEF += -DNLS
+ CPPFLAGS += -DNLS
endif
ifeq ($(strip $(CPUFRQ_BENCH)),true)
diff --git a/utils/info.c b/utils/info.c
index 38d906a..155e604 100644
--- a/utils/info.c
+++ b/utils/info.c
Index: cpufrequtils/utils/info.c
===================================================================
--- cpufrequtils.orig/utils/info.c 2012-05-06 11:56:20.287842838 +0900
+++ cpufrequtils/utils/info.c 2012-05-06 13:35:13.994099919 +0900
@@ -10,7 +10,6 @@
#include <errno.h>
#include <stdlib.h>
......@@ -41,10 +56,10 @@ index 38d906a..155e604 100644
#define LINE_LEN 10
diff --git a/utils/set.c b/utils/set.c
index 2ece47e..312cc8c 100644
--- a/utils/set.c
+++ b/utils/set.c
Index: cpufrequtils/utils/set.c
===================================================================
--- cpufrequtils.orig/utils/set.c 2012-05-06 11:56:20.287842838 +0900
+++ cpufrequtils/utils/set.c 2012-05-06 13:35:13.994099919 +0900
@@ -12,16 +12,24 @@
#include <limits.h>
#include <string.h>
......@@ -56,15 +71,13 @@ index 2ece47e..312cc8c 100644
#include "cpufreq.h"
-#define _(String) gettext(String)
+#ifdef NLS
+#include <libintl.h>
+#define _(String) gettext (String)
+#define gettext_noop(String) String
+#define N_(String) gettext_noop (String)
+#else
#define _(String) gettext(String)
#define gettext_noop(String) String
-#define N_(String) gettext_noop(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)
......
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=cpufrequtils
pkgver=008
pkgrel=2
pkgrel=3
pkgdesc="Userspace tools for the kernel cpufreq subsystem"
url="http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html"
arch="all"
......@@ -10,18 +10,26 @@ subpackages="$pkgname-dev $pkgname-doc"
depends="sysfsutils"
makedepends="sysfsutils-dev libtool"
source="ftp://ftp.archlinux.org/other/cpufrequtils/cpufrequtils-$pkgver.tar.bz2
cpufrequtils-006-nls.patch
0001-Support-for-Position-Independet-Code-by-aboid-clobbe.patch
0001-Only-x86-has-cpuid-instruction.patch
0002-cpufrequtils-Remove-proc-compile-option-and-interfac.patch
0003-cpufrequtils-aperf-Fix-MSR-read-on-32-bit.patch
0005-cpufrequtils-sysfs-increase-MAX_LINE_LEN.patch
0006-aperf-fix-compilation-on-x86-32-with-fPIC.patch
0007-po-add-missing-word-in-DE.patch
0008-cpufrequtils-make-NLS-optional.patch
$pkgname.initd
$pkgname.confd"
build() {
prepare() {
cd "$srcdir"/$pkgname-$pkgver
for i in ../*.patch; do
msg "Applying $i..."
patch -p1 < $i || return 1
done
}
build() {
cd "$srcdir"/$pkgname-$pkgver
# distcc and ccache makes libtool confused about the tag.
# we save 4k by disabling the 2.4 kernel support (PROC=false)
make -j1 LIBTOOL_OPT="--tag=CC --silent" \
......@@ -42,17 +50,32 @@ package() {
}
md5sums="c59b71c044d463896f3247e8dd83dd7e cpufrequtils-008.tar.bz2
aa4c6f19766a741a68ae1ad352c6bad9 cpufrequtils-006-nls.patch
9f999b70138d84580894df48340e50cc 0001-Support-for-Position-Independet-Code-by-aboid-clobbe.patch
9ed71a50670aa99e12245cb3f5199142 0001-Only-x86-has-cpuid-instruction.patch
4ccbd46b0b1563067d0c31fe510ff89d 0002-cpufrequtils-Remove-proc-compile-option-and-interfac.patch
5dd9add84e63b213295e2e2a30fd3667 0003-cpufrequtils-aperf-Fix-MSR-read-on-32-bit.patch
139b340b964e2c942dbe426b061c6bc8 0005-cpufrequtils-sysfs-increase-MAX_LINE_LEN.patch
2242f015ca6b8478d6c1a3bfbca5ea48 0006-aperf-fix-compilation-on-x86-32-with-fPIC.patch
0b7d50274fa8286796c9df0b156e2962 0007-po-add-missing-word-in-DE.patch
a99653aab0d334569496a402389f062f 0008-cpufrequtils-make-NLS-optional.patch
b9b80ef2f1b6c5e7ce0476037a8bce6b cpufrequtils.initd
d47ff635eef03248c633486eaeec191d cpufrequtils.confd"
sha256sums="1b9daa591d977679fb09ffb9b4d58afa94b9387f3c0be92ec077080e328130f1 cpufrequtils-008.tar.bz2
fb60cf2543461af3f47ea85927be5d5242489da99a32801ed8beea65a21472b4 cpufrequtils-006-nls.patch
3501d2e07ed7a7609d93d40428057935a08cb84f7b46882710d6b4cf966c1749 0001-Support-for-Position-Independet-Code-by-aboid-clobbe.patch
6793e7e330fe6c9125c998011f203a4d8d5887872178fc872861db1d5dce55ef 0001-Only-x86-has-cpuid-instruction.patch
62efd52ea004e1974a09cc5646fbc18d47b372a54ed33361fb2c8470bd931501 0002-cpufrequtils-Remove-proc-compile-option-and-interfac.patch
5ef9bae9272f867c0187ba0b4845888cf6bb567a4a242da5001b3a4a05935a2c 0003-cpufrequtils-aperf-Fix-MSR-read-on-32-bit.patch
76038bb0197d02c91b7dfde5e65cab9379526bba02cb2bab751bbf23a63b392e 0005-cpufrequtils-sysfs-increase-MAX_LINE_LEN.patch
99b2b04301f1656ea263e5d693be701be8af40880747fd3e34c9c27e5540eefa 0006-aperf-fix-compilation-on-x86-32-with-fPIC.patch
245f1c9db3f8120eb014f782476df6a38c22700dd438d532943ad35f4e4ca46d 0007-po-add-missing-word-in-DE.patch
bb1cba04abb42843085ea4f2b38d539cfe7d4db93ffaca453891ee2de6c6feac 0008-cpufrequtils-make-NLS-optional.patch
af83b2354bd8876efecd85762a61a40a4b498633e186cb85db7a22389936a2e6 cpufrequtils.initd
602b65f6e9927bfb37a26a34c1b44bd4a87cdb2977b5547398e17432afe55727 cpufrequtils.confd"
sha512sums="d25dcc4fbf15bdca65a3fab6ee33d6cf4b7ab7ed291aea42ed7970b707535ddfcd27fd0189aa48affc2792abf72539f1388cc544019e6fc06353a2f9c5a49d17 cpufrequtils-008.tar.bz2
26e2c9e273b084eb64b38b187064a560d05479026522912390054fdbc99eaba55ca682a59884bc67f013c3ce9d7b80e5ba765351765d921c0c66573287f1db52 cpufrequtils-006-nls.patch
827e9b73902f50c9bce75b76cd33759a627837705dc92520ab360e95cc9b242a76c5d59cd9eea83cd6d2c832b97f74f3e3ac31f3bfef82d36fa0a55266e7ec72 0001-Support-for-Position-Independet-Code-by-aboid-clobbe.patch
4d841bdf2b829518932505747e68d661219337259c1321cdd6671faf2eb72ff6d7f437e42b98f093f9d6564d2bb7be1d4ab645f08b0fbd58ce43339a12be37da 0001-Only-x86-has-cpuid-instruction.patch
6d8c6beb98d680d4d47c5cc0a067545b1683f259b7d2474a61876b5e97987be30b8d212017122157236ae91bd415793e5f5a0d22214bfc3f2ec72cf626d28832 0002-cpufrequtils-Remove-proc-compile-option-and-interfac.patch
41082f5ed4cc2962927b12b8dcf4b0dadf6fb227b66b8f383931c7ae0416fa5f73e765664376b50e07948e48060770a7d32bc7422b144c0cb82166515e197f9b 0003-cpufrequtils-aperf-Fix-MSR-read-on-32-bit.patch
00fb946b1f0b42038297b9cf63740a4123a4aafa5292400225803ef8cd6f1e89b387509c2f74fa6223b3b2b3032b6e0edcbfc3b6bf15aab73bb480c0208330b9 0005-cpufrequtils-sysfs-increase-MAX_LINE_LEN.patch
7e924424fe3381fd804edfcb0c0c98e73b67e4da7972c7cfe0bc9cfb5febd2ec660f4e84b6bebe2b0b6d2dc5e60279ebe85d1892905b1112ee43d60b46bcdef5 0006-aperf-fix-compilation-on-x86-32-with-fPIC.patch
69343ab9c9b795523bcd09359f4acdb279510a95c6aa13f70be1d0e2e89ed59952a34f979969f6a3ac3498ad7196ee1c810677fe2d04c5f02207682b820b97bb 0007-po-add-missing-word-in-DE.patch
5d5eab9815d77b8ae9c6c9d122f52da7501068b9a6fe7766e74a8f59d1296c0bcb6e5a61a643e371e2e1433912d48205c8f522207144bb02a3c9961043eb968b 0008-cpufrequtils-make-NLS-optional.patch
a9a1023ad5d55b9050a392a8c05e29dbf1ed9bcdcd8e82063d38adc2a81a86e306ffd7aaf048518a1ca427b4ffcd0ca9410fbd5ae5defe648512e81366caecaa cpufrequtils.initd
81adc035c781c2c6f94fdb9a69dfb5d867830ab0685f2badce055b9f8095881456522fc0cd5386140d920fd1d9b96c82d8dcecd9962e3e6ef5f9be926153802b cpufrequtils.confd"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment