summaryrefslogtreecommitdiffabout
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-02-01 16:36:37 (GMT)
committer Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-02-01 19:28:59 (GMT)
commitdda400c3f798ba49b1b638f927b3089a9df24105 (patch)
treea0b8aa9949dbb2a0976b18e855afaf90cf7c6820
parent93af90cfb670849931ffe3741baa630c00682fe5 (diff)
downloadbuildroot-dda400c3f798ba49b1b638f927b3089a9df24105.zip
buildroot-dda400c3f798ba49b1b638f927b3089a9df24105.tar.bz2
oprofile: fix build on PowerPC and do some cleanupsoprofile-ppc-fix
Initially, the goal is this patch is to fix the build of OProfile on PowerPC. In order to do so, we: * Rename the two existing patches to remove the version number, in agreement with the new policy for patch naming. * Add 3 patches that are backported from upstream (and are also present in Yocto). * Add 2 more patches that fix cross-compilation issues, and specifically the PowerPC build problem. For now, on PowerPC, we do not support building the perf features of OProfile, because they depend on the libpfm library, which isn't packaged in Buildroot. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r--package/oprofile/oprofile-001-avr32-enable-lookup-dcookie.patch (renamed from package/oprofile/oprofile-0.9.7-001-avr32-enable-lookup_dcookie.patch)8
-rw-r--r--package/oprofile/oprofile-002-no-query-modules.patch (renamed from package/oprofile/oprofile-0.9.7-002-no-query-modules.patch)6
-rw-r--r--package/oprofile/oprofile-003-oprofile-ppc32-build-fix.patch32
-rw-r--r--package/oprofile/oprofile-004-handle-early-perf-events-kernel-without-perf-record.patch107
-rw-r--r--package/oprofile/oprofile-005-fix-up-configure-to-handle-archs-without-perf.patch160
-rw-r--r--package/oprofile/oprofile-006-fix-cross-compilation-use-of-kernel.patch40
-rw-r--r--package/oprofile/oprofile-007-dont-build-perf-on-ppc-without-libpfm.patch47
-rw-r--r--package/oprofile/oprofile.mk23
8 files changed, 416 insertions, 7 deletions
diff --git a/package/oprofile/oprofile-0.9.7-001-avr32-enable-lookup_dcookie.patch b/package/oprofile/oprofile-001-avr32-enable-lookup-dcookie.patch
index 7c41389..dc87d80 100644
--- a/package/oprofile/oprofile-0.9.7-001-avr32-enable-lookup_dcookie.patch
+++ b/package/oprofile/oprofile-001-avr32-enable-lookup-dcookie.patch
@@ -1,8 +1,8 @@
-Index: oprofile-0.9.4/daemon/opd_cookie.c
+Index: b/daemon/opd_cookie.c
===================================================================
---- oprofile-0.9.4.orig/daemon/opd_cookie.c 2008-07-25 16:00:17.000000000 +0200
-+++ oprofile-0.9.4/daemon/opd_cookie.c 2008-07-25 16:00:20.000000000 +0200
-@@ -78,6 +78,19 @@
+--- a/daemon/opd_cookie.c
++++ b/daemon/opd_cookie.c
+@@ -79,6 +79,19 @@
(unsigned long)(cookie & 0xffffffff),
(unsigned long)(cookie >> 32), buf, size);
}
diff --git a/package/oprofile/oprofile-0.9.7-002-no-query-modules.patch b/package/oprofile/oprofile-002-no-query-modules.patch
index 9f00da6..4dae32d 100644
--- a/package/oprofile/oprofile-0.9.7-002-no-query-modules.patch
+++ b/package/oprofile/oprofile-002-no-query-modules.patch
@@ -1,3 +1,9 @@
+disable portions which use query_module on 2.6 kernel this is not available
+in OE we dont support 2.4 anyway
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
diff -urN oprofile-0.9.4-0rig//daemon/liblegacy/opd_kernel.c oprofile-0.9.4/daemon/liblegacy/opd_kernel.c
--- oprofile-0.9.4-0rig//daemon/liblegacy/opd_kernel.c 2005-05-04 04:47:03.000000000 +0200
+++ oprofile-0.9.4/daemon/liblegacy/opd_kernel.c 2009-01-21 07:40:20.000000000 +0100
diff --git a/package/oprofile/oprofile-003-oprofile-ppc32-build-fix.patch b/package/oprofile/oprofile-003-oprofile-ppc32-build-fix.patch
new file mode 100644
index 0000000..0f609df
--- /dev/null
+++ b/package/oprofile/oprofile-003-oprofile-ppc32-build-fix.patch
@@ -0,0 +1,32 @@
+Upstream-Status: Backport
+
+From fa889ea74b6b931e241a8cd57e90edc23cd7ab03 Mon Sep 17 00:00:00 2001
+From: William Cohen <wcohen@redhat.com>
+Date: Mon, 15 Oct 2012 15:09:55 -0500
+Subject: [PATCH] OProfile doesn't build for 32-bit ppc; the operf_utils.cpp
+ compile fails. Need to be able to build the 32-bit ppc
+ version of oprofile to provide the 32-bit ppc java support
+ libraries. The configure only handles the case of ppc64
+ with perf support.
+
+Signed-off-by: William Cohen <wcohen@redhat.com>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index b739133..7449854 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -104,7 +104,7 @@ AC_DEFINE_UNQUOTED(HAVE_PERF_EVENTS, $HAVE_PERF_EVENTS, [Kernel support for perf
+ if test "$HAVE_PERF_EVENTS" = "1"; then
+ PFM_LIB=
+ arch="`uname -m`"
+- if test "$arch" = "ppc64"; then
++ if test "$arch" = "ppc64" || test "$arch" = "ppc"; then
+ AC_CHECK_HEADER(perfmon/pfmlib.h,,[AC_MSG_ERROR([pfmlib.h not found; usually provided in papi devel package])])
+ AC_CHECK_LIB(pfm,pfm_get_event_name, HAVE_LIBPFM3='1'; HAVE_LIBPFM='1', [
+ AC_CHECK_LIB(pfm,pfm_get_os_event_encoding, HAVE_LIBPFM3='0'; HAVE_LIBPFM='1',
+--
+1.7.9.7
+
diff --git a/package/oprofile/oprofile-004-handle-early-perf-events-kernel-without-perf-record.patch b/package/oprofile/oprofile-004-handle-early-perf-events-kernel-without-perf-record.patch
new file mode 100644
index 0000000..894e99a
--- /dev/null
+++ b/package/oprofile/oprofile-004-handle-early-perf-events-kernel-without-perf-record.patch
@@ -0,0 +1,107 @@
+Upstream-Status: Backport
+
+From dbe24f5f0d98b1fe5517d2b137b4c59766e536ad Mon Sep 17 00:00:00 2001
+From: Maynard Johnson <maynardj@us.ibm.com>
+Date: Mon, 19 Nov 2012 15:16:37 -0600
+Subject: [PATCH] Handle early perf_events kernel without
+ PERF_RECORD_MISC_GUEST* macros
+
+In very early versions of perf_events kernel subsystem, the
+PERF_RECORD_MISC_GUEST_KERNEL and PERF_RECORD_MISC_GUEST_USER
+macros (in perf_event.h) were not yet defined. This patch adds
+a configure check to determine when it's OK for source code to refer
+to those macros.
+
+This patch also does some minor cleanup of the configure script
+help and warning messages relating to the --with-kernel option.
+
+Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
+---
+ configure.ac | 32 ++++++++++++++++++++++++++------
+ libperf_events/operf_utils.cpp | 2 ++
+ 2 files changed, 28 insertions(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 7449854..18d1169 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -60,12 +60,12 @@ test "$LD" || AC_ERROR(ld not found)
+
+ # --with-kernel for cross compilation
+ AC_ARG_WITH(kernel,
+-[AS_HELP_STRING([--with-kernel=dir], [Path to kernel include directory (...include/linux/perf_event.h) to use.
++[AS_HELP_STRING([--with-kernel=dir], [Path to kernel include directory (e.g. /tmp/linux-xyz) to use.
+ If this option is not specified, configure will look for kernel header files in the usual installation location
+-for a kernel-headers package -- /usr/include. Use this option in cross-compile enviroments
++for a kernel-headers package -- /usr. Use this option in cross-compile enviroments
+ or in situations where the host system does not support perf_events but you wish to build binaries
+-for a target system that does support perf_events. Because of OProfile's use of syscalls, be sure that the
+-kernel headers used match the architecture of the intended target system.])],
++for a target system that does support perf_events. Because of OProfile's use of syscalls,
++kernel headers used during build must match the architecture of the intended target system.])],
+ KERNELDIR=$withval)
+
+
+@@ -92,10 +92,29 @@ AC_CHECK_HEADER($PERF_EVENT_H,PERF_EVENT_H_EXISTS="yes")
+ AM_CONDITIONAL(BUILD_FOR_PERF_EVENT, test -n "$PERF_EVENT_H_EXISTS")
+ if test "$PERF_EVENT_H_EXISTS" = "yes"; then
+ HAVE_PERF_EVENTS='1'
++
+ if test "$KERNELDIR" != ""; then
+ PERF_EVENT_FLAGS=" -I$KERNELDIR/include"
+ AC_SUBST(PERF_EVENT_FLAGS)
+ fi
++
++ AC_MSG_CHECKING([whether PERF_RECORD_MISC_GUEST_KERNEL is defined in perf_event.h])
++ rm -f test-for-PERF_GUEST
++ AC_LANG_CONFTEST(
++ [AC_LANG_PROGRAM([[#include <linux/perf_event.h>]],
++ [[unsigned int pr_guest_kern = PERF_RECORD_MISC_GUEST_KERNEL;
++ unsigned int pr_guest_user = PERF_RECORD_MISC_GUEST_USER;]])
++ ])
++ $CC conftest.$ac_ext $CFLAGS $LDFLAGS $LIBS $PERF_EVENT_FLAGS -o test-for-PERF_GUEST > /dev/null 2>&1
++ if test -f test-for-PERF_GUEST; then
++ echo "yes"
++ HAVE_PERF_GUEST_MACROS='1'
++ else
++ echo "no"
++ HAVE_PERF_GUEST_MACROS='0'
++ fi
++ AC_DEFINE_UNQUOTED(HAVE_PERF_GUEST_MACROS, $HAVE_PERF_GUEST_MACROS, [PERF_RECORD_MISC_GUEST_KERNEL is defined in perf_event.h])
++ rm -f test-for-PERF_GUEST*
+ else
+ HAVE_PERF_EVENTS='0'
+ fi
+@@ -416,7 +435,8 @@ elif test "`getent passwd oprofile 2>/dev/null`" == "" || \
+ fi
+
+ if test "$PERF_EVENT_H_EXISTS" != "yes" && test "$kernel_has_perf_events_support" = "yes"; then
+- echo "Warning: perf_event.h not found. Please install the kernel headers package if you"
+- echo " want non-root support built into OProfile."
++ echo "Warning: perf_event.h not found. Either install the kernel headers package or"
++ echo "use the --with-kernel option if you want the non-root, single application"
++ echo "profiling support provided by operf."
+ fi
+
+diff --git a/libperf_events/operf_utils.cpp b/libperf_events/operf_utils.cpp
+index 06cd566..470cfba 100644
+--- a/libperf_events/operf_utils.cpp
++++ b/libperf_events/operf_utils.cpp
+@@ -732,12 +732,14 @@ static void __handle_sample_event(event_t * event, u64 sample_type)
+ case PERF_RECORD_MISC_HYPERVISOR:
+ domain = "hypervisor";
+ break;
++#if HAVE_PERF_GUEST_MACROS
+ case PERF_RECORD_MISC_GUEST_KERNEL:
+ domain = "guest OS";
+ break;
+ case PERF_RECORD_MISC_GUEST_USER:
+ domain = "guest user";
+ break;
++#endif
+ default:
+ domain = "unknown";
+ break;
+--
+1.7.9.7
+
diff --git a/package/oprofile/oprofile-005-fix-up-configure-to-handle-archs-without-perf.patch b/package/oprofile/oprofile-005-fix-up-configure-to-handle-archs-without-perf.patch
new file mode 100644
index 0000000..98e5fd9
--- /dev/null
+++ b/package/oprofile/oprofile-005-fix-up-configure-to-handle-archs-without-perf.patch
@@ -0,0 +1,160 @@
+Upstream-Status: Backport
+
+From ca6d916a6f8f0f8abbb4c9b6a97dd1a1615bb124 Mon Sep 17 00:00:00 2001
+From: Maynard Johnson <maynardj@us.ibm.com>
+Date: Wed, 5 Dec 2012 10:16:35 -0600
+Subject: [PATCH] Fix up configure to handle architectures that do not
+ implement perf_event_open
+
+This patch fixes the following problems:
+
+1) The configure script allows the user to pass a location to kernel
+headers (via --with-kernel option) such that, even if the running
+kernel does not have perf_events support, it may be possible to
+build operf (e.g., in cross-compile environments). But the message
+'This kernel does not have perf_events support; falling back to legacy
+oprofile' was being displayed inappropriately in such cases. This
+patch changes the configure script so that the "falling back to
+legacy oprofile" message will only be displayed if we're running
+on a kernel that does not have perf_events support AND the user
+did not pass specify the "--with-kernel" option.
+
+2) Some architectures don't even implement the perf_event_open syscall, so the
+configure script must do more than checking kernel version and whether or not
+perf_event.h is present in order to decide if perf_events is supported.
+This patch provides that extra capability.
+
+These problems were reported by Tony Jones <tonyj@suse.com>.
+
+Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
+---
+ configure.ac | 74 +++++++++++++++++++++++++++++-----------
+ utils/op_perf_events_checker.c | 6 ++--
+ 2 files changed, 58 insertions(+), 22 deletions(-)
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -70,34 +70,66 @@
+
+
+ dnl Check kernel version for perf_events supported
+-AC_MSG_CHECKING([kernel version supports perf_events])
+ if test "$KERNELDIR" != ""; then
+ KINC="$KERNELDIR/include"
+-fi
+-AX_KERNEL_VERSION(2, 6, 31, <=, kernel_has_perf_events_support="yes",
+-kernel_has_perf_events_support="no")
+-
+-if test "$kernel_has_perf_events_support" = "no"; then
+- AC_MSG_RESULT([This kernel does not have perf_events support; falling back to legacy oprofile])
++ PERF_EVENT_FLAGS=" -I$KERNELDIR/include"
++ AC_SUBST(PERF_EVENT_FLAGS)
++ PERF_EVENT_H="$KERNELDIR/include/linux/perf_event.h"
+ else
+- AC_MSG_RESULT([This kernel has perf_events support])
++ PERF_EVENT_H="/usr/include/linux/perf_event.h"
+ fi
+
+-if test "$KERNELDIR" == ""; then
+- PERF_EVENT_H="/usr/include/linux/perf_event.h"
++PERF_EVENT_H_EXISTS="no"
++kernel_may_have_perf_events_support="no"
++AX_KERNEL_VERSION(2, 6, 31, <=, kernel_may_have_perf_events_support="yes",
++kernel_has_perf_events_support="no")
++
++dnl The AX_KERNEL_VERSION macro may return kernel_may_have_perf_events_support="yes",
++dnl indicating a partial answer. Some architectures do not implement the Performance
++dnl Events Kernel Subsystem even with kernel versions > 2.6.31 -- i.e., not even
++dnl implementing the perf_event_open syscall to return ENOSYS. So the check below
++dnl will identify and handle such situations.
++
++if test "$kernel_may_have_perf_events_support" = "yes"; then
++ AC_CHECK_HEADER($PERF_EVENT_H,PERF_EVENT_H_EXISTS="yes")
++ AC_MSG_CHECKING([kernel supports perf_events])
++ if test "$PERF_EVENT_H_EXISTS" = "yes"; then
++ rm -f test-for-PERF_EVENT_OPEN
++ AC_LANG_CONFTEST(
++ [AC_LANG_PROGRAM([[#include <linux/perf_event.h>
++ #include <asm/unistd.h>
++ #include <sys/types.h>
++ #include <string.h>
++ ]],
++ [[struct perf_event_attr attr;
++ pid_t pid;
++ memset(&attr, 0, sizeof(attr));
++ attr.size = sizeof(attr);
++ attr.sample_type = PERF_SAMPLE_IP;
++ pid = getpid();
++ syscall(__NR_perf_event_open, &attr, pid, 0, -1, 0);
++ ]])
++ ])
++ $CC conftest.$ac_ext $CFLAGS $LDFLAGS $LIBS $PERF_EVENT_FLAGS -o test-for-PERF_EVENT_OPEN > /dev/null 2>&1
++ if test -f test-for-PERF_EVENT_OPEN; then
++ kernel_has_perf_events_support="yes"
++ AC_MSG_RESULT(yes)
++ else
++ AC_MSG_RESULT(no)
++ kernel_has_perf_events_support="no"
++ fi
++ else
++ AC_MSG_RESULT(unknown -- perf_event.h not found)
++ fi
+ else
+- PERF_EVENT_H="$KERNELDIR/include/linux/perf_event.h"
++ AC_MSG_RESULT(kernel supports perf_events... no)
++ kernel_has_perf_events_support="no"
+ fi
+-AC_CHECK_HEADER($PERF_EVENT_H,PERF_EVENT_H_EXISTS="yes")
+-AM_CONDITIONAL(BUILD_FOR_PERF_EVENT, test -n "$PERF_EVENT_H_EXISTS")
+-if test "$PERF_EVENT_H_EXISTS" = "yes"; then
+- HAVE_PERF_EVENTS='1'
+
+- if test "$KERNELDIR" != ""; then
+- PERF_EVENT_FLAGS=" -I$KERNELDIR/include"
+- AC_SUBST(PERF_EVENT_FLAGS)
+- fi
++AM_CONDITIONAL(BUILD_FOR_PERF_EVENT, test "$kernel_has_perf_events_support" = "yes")
+
++if test "$kernel_has_perf_events_support" = "yes"; then
++ HAVE_PERF_EVENTS='1'
+ AC_MSG_CHECKING([whether PERF_RECORD_MISC_GUEST_KERNEL is defined in perf_event.h])
+ rm -f test-for-PERF_GUEST
+ AC_LANG_CONFTEST(
+@@ -117,7 +149,9 @@
+ rm -f test-for-PERF_GUEST*
+ else
+ HAVE_PERF_EVENTS='0'
++ AC_MSG_RESULT([No perf_events support available; falling back to legacy oprofile])
+ fi
++
+ AC_DEFINE_UNQUOTED(HAVE_PERF_EVENTS, $HAVE_PERF_EVENTS, [Kernel support for perf_events exists])
+
+ if test "$HAVE_PERF_EVENTS" = "1"; then
+@@ -434,7 +468,7 @@
+ fi
+ fi
+
+-if test "$PERF_EVENT_H_EXISTS" != "yes" && test "$kernel_has_perf_events_support" = "yes"; then
++if test "$PERF_EVENT_H_EXISTS" != "yes" && test "$kernel_may_have_perf_events_support" = "yes"; then
+ echo "Warning: perf_event.h not found. Either install the kernel headers package or"
+ echo "use the --with-kernel option if you want the non-root, single application"
+ echo "profiling support provided by operf."
+Index: b/utils/op_perf_events_checker.c
+===================================================================
+--- a/utils/op_perf_events_checker.c
++++ b/utils/op_perf_events_checker.c
+@@ -49,8 +49,10 @@
+ }
+
+ #if HAVE_PERF_EVENTS
+- /* If perf_events syscall is not implemented, the syscall below will fail
+- * with ENOSYS (38). If implemented, but the processor type on which this
++ /* Even if the perf_event_open syscall is implemented, the architecture may still
++ * not provide a full implementation of the perf_events subsystem, in which case,
++ * the syscall below will fail with ENOSYS (38). If the perf_events subsystem is
++ * implemented for the architecture, but the processor type on which this
+ * program is running is not supported by perf_events, the syscall returns
+ * ENOENT (2).
+ */
diff --git a/package/oprofile/oprofile-006-fix-cross-compilation-use-of-kernel.patch b/package/oprofile/oprofile-006-fix-cross-compilation-use-of-kernel.patch
new file mode 100644
index 0000000..d606dec
--- /dev/null
+++ b/package/oprofile/oprofile-006-fix-cross-compilation-use-of-kernel.patch
@@ -0,0 +1,40 @@
+Don't make false assumptions when cross-compiling
+
+When no --with-kernel= option is passed to give the path to the kernel
+headers, the configure script assumes that it should use headers in
+/usr/include. While this may be a sane default for a native build, it
+isn't such a good default when cross-compiling.
+
+Therefore, don't make this assumption when we are cross-compiling, and
+prefer not to enable the perf feature (which requires the kernel
+headers) when we are cross-compiling and the --with-kernel= option was
+not passed.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -75,14 +75,18 @@
+ PERF_EVENT_FLAGS=" -I$KERNELDIR/include"
+ AC_SUBST(PERF_EVENT_FLAGS)
+ PERF_EVENT_H="$KERNELDIR/include/linux/perf_event.h"
+-else
++elif test "$cross_compiling" != "no"; then
++ KINC="/usr/include"
+ PERF_EVENT_H="/usr/include/linux/perf_event.h"
+ fi
+
+ PERF_EVENT_H_EXISTS="no"
+ kernel_may_have_perf_events_support="no"
+-AX_KERNEL_VERSION(2, 6, 31, <=, kernel_may_have_perf_events_support="yes",
+-kernel_has_perf_events_support="no")
++
++if test "$KINC" != ""; then
++ AX_KERNEL_VERSION(2, 6, 31, <=, kernel_may_have_perf_events_support="yes",
++ kernel_has_perf_events_support="no")
++fi
+
+ dnl The AX_KERNEL_VERSION macro may return kernel_may_have_perf_events_support="yes",
+ dnl indicating a partial answer. Some architectures do not implement the Performance
diff --git a/package/oprofile/oprofile-007-dont-build-perf-on-ppc-without-libpfm.patch b/package/oprofile/oprofile-007-dont-build-perf-on-ppc-without-libpfm.patch
new file mode 100644
index 0000000..00f2b98
--- /dev/null
+++ b/package/oprofile/oprofile-007-dont-build-perf-on-ppc-without-libpfm.patch
@@ -0,0 +1,47 @@
+Properly disable the perf feature on PowerPC when libpfm is not available
+
+The perf features of oprofile require on all architecture some kernel
+headers related to perf. The configure script already takes care of
+checking the presence of those headers, and if they are not available,
+they disable the perf features.
+
+However, for some reason, on PowerPC and PowerPC 64, the perf features
+also require a special library, libpfm. The configure script has a
+check for this library, but if the library is not found, it forgets to
+disable the build of the perf features in oprofile. This patch fixes
+this: on PowerPC and PowerPC64, we need the libpfm library to be
+available to build the perf features.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -130,8 +130,6 @@
+ kernel_has_perf_events_support="no"
+ fi
+
+-AM_CONDITIONAL(BUILD_FOR_PERF_EVENT, test "$kernel_has_perf_events_support" = "yes")
+-
+ if test "$kernel_has_perf_events_support" = "yes"; then
+ HAVE_PERF_EVENTS='1'
+ AC_MSG_CHECKING([whether PERF_RECORD_MISC_GUEST_KERNEL is defined in perf_event.h])
+@@ -169,10 +167,17 @@
+ PFM_LIB="-lpfm"
+ AC_DEFINE_UNQUOTED(HAVE_LIBPFM3, $HAVE_LIBPFM3, [Define to 1 if using libpfm3; 0 if using newer libpfm])
+ AC_DEFINE_UNQUOTED(HAVE_LIBPFM, $HAVE_LIBPFM, [Define to 1 if libpfm is available])
++ if test "$HAVE_LIBPFM" = "1" || test "$HAVE_LIBPFM3" = "1"; then
++ build_perf_event=yes
++ fi
++ else
++ build_perf_event=yes
+ fi
+ AC_SUBST(PFM_LIB)
+ fi
+
++AM_CONDITIONAL(BUILD_FOR_PERF_EVENT, test "$build_perf_event" = "yes")
++
+ AC_ARG_WITH(java,
+ [ --with-java=java-home Path to Java home directory (default is "no"; "yes" will use /usr as Java home)],
+ JAVA_HOMEDIR=$with_java, [with_java=no])
diff --git a/package/oprofile/oprofile.mk b/package/oprofile/oprofile.mk
index f3ea23f..a1d7041 100644
--- a/package/oprofile/oprofile.mk
+++ b/package/oprofile/oprofile.mk
@@ -8,10 +8,21 @@ OPROFILE_VERSION = 0.9.8
OPROFILE_SITE = http://downloads.sourceforge.net/project/oprofile/oprofile/oprofile-$(OPROFILE_VERSION)
OPROFILE_LICENSE = GPLv2+
OPROFILE_LICENSE_FILES = COPYING
-OPROFILE_CONF_OPT = --localstatedir=/var --with-kernel-support
+OPROFILE_CONF_OPT = \
+ --localstatedir=/var \
+ --disable-account-check \
+ --disable-gui \
+ --with-kernel=$(STAGING_DIR)/usr
+OPROFILE_AUTORECONF = YES
OPROFILE_BINARIES = utils/ophelp pp/opannotate pp/oparchive pp/opgprof
OPROFILE_BINARIES += pp/opreport opjitconv/opjitconv daemon/oprofiled
-OPROFILE_BINARIES += utils/op-check-perfevents pe_profiling/operf libabi/opimport
+OPROFILE_BINARIES += utils/op-check-perfevents libabi/opimport
+
+# On PowerPC, building the perf support requires a special libpfm
+# library, that we don't have for the moment.
+ifneq ($(BR2_powerpc),y)
+OPROFILE_BINARIES += pe_profiling/operf
+endif
ifeq ($(BR2_i386),y)
OPROFILE_ARCH = i386
@@ -29,7 +40,13 @@ ifeq ($(OPROFILE_ARCH),)
OPROFILE_ARCH = $(BR2_ARCH)
endif
-OPROFILE_DEPENDENCIES = popt binutils
+OPROFILE_DEPENDENCIES = popt binutils host-pkgconf
+
+define OPROFILE_CREATE_FILES
+ touch $(@D)/NEWS $(@D)/AUTHORS $(@D)/ChangeLog
+endef
+
+OPROFILE_POST_PATCH_HOOKS += OPROFILE_CREATE_FILES
define OPROFILE_INSTALL_TARGET_CMDS
$(INSTALL) -d -m 755 $(TARGET_DIR)/usr/bin