Initial Commit
- initial default booting image
This commit is contained in:
48
package/oprofile/0001-musl.patch
Normal file
48
package/oprofile/0001-musl.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
Remove non-Posix use of FTW_ACTIONRETVAL
|
||||
|
||||
The musl implementation of nftw doesn't support the glibc extension
|
||||
FTW_ACTIONRETVAL. Since none of the features of FTW_ACTIONRETVAL are
|
||||
used here, just use the normal nftw return value.
|
||||
|
||||
Downloaded from:
|
||||
https://github.com/openwrt-mirror/openwrt/blob/f22d5e25660106a48727c7aa5d1a73e4171a7987/package/devel/oprofile/patches/100-musl.patch
|
||||
after I found a hint for the patch here:
|
||||
http://patchwork.openembedded.org/patch/112675/
|
||||
|
||||
Removed unneeded patch for libop/op_events.c.
|
||||
|
||||
Because openwrt removed the oprofile package from their repo last week
|
||||
https://github.com/openwrt-mirror/openwrt/commit/aaf46a8524e138e1673a398e8d2dd9357405b313#diff-fe14456f94abf436d997e2c01c10f3bd
|
||||
I decided to put this patch into the buildroot repo instead of adding
|
||||
_PATCH to oprofile.mk
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
|
||||
|
||||
--- a/pe_profiling/operf.cpp
|
||||
+++ b/pe_profiling/operf.cpp
|
||||
@@ -857,11 +857,14 @@ static int __delete_old_previous_sample_
|
||||
int tflag __attribute__((unused)),
|
||||
struct FTW *ftwbuf __attribute__((unused)))
|
||||
{
|
||||
+ int err;
|
||||
+
|
||||
if (remove(fpath)) {
|
||||
+ err = errno;
|
||||
perror("sample data removal error");
|
||||
- return FTW_STOP;
|
||||
+ return err;
|
||||
} else {
|
||||
- return FTW_CONTINUE;
|
||||
+ return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -896,7 +899,7 @@ static void convert_sample_data(void)
|
||||
return;
|
||||
|
||||
if (!operf_options::append) {
|
||||
- int flags = FTW_DEPTH | FTW_ACTIONRETVAL;
|
||||
+ int flags = FTW_DEPTH;
|
||||
errno = 0;
|
||||
if (nftw(previous_sampledir.c_str(), __delete_old_previous_sample_data, 32, flags) !=0 &&
|
||||
errno != ENOENT) {
|
||||
@@ -0,0 +1,62 @@
|
||||
From 1e4cd78bca2bd6e0d17b6cb9caf1b172d7bac564 Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Date: Mon, 6 May 2024 08:41:49 +0200
|
||||
Subject: [PATCH] fix static build with binutils >= 2.40
|
||||
|
||||
sframe library was added by binutils 2.40 and
|
||||
https://github.com/bminor/binutils-gdb/commit/19e559f1c91bfaedbd2f91d85ee161f3f03fda3c
|
||||
resulting in the following static build failure:
|
||||
|
||||
/home/buildroot/autobuild/run/instance-1/output-1/build/binutils-2.41/bfd/elf-sframe.c:220: undefined reference to `sframe_decode'
|
||||
|
||||
[...]
|
||||
|
||||
configure: error: bfd library not found
|
||||
|
||||
Fixes:
|
||||
- http://autobuild.buildroot.org/results/a9f3e09e6543b3773440c011e93bd41e357691e4
|
||||
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Upstream: https://sourceforge.net/p/oprofile/bugs/295
|
||||
---
|
||||
configure.ac | 2 +-
|
||||
m4/binutils.m4 | 7 +++++--
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index dc447f89..72ef0a21 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -334,7 +334,7 @@ AX_CHECK_DOCBOOK
|
||||
dnl finally restore the original libs setting
|
||||
LIBS="$ORIG_SAVE_LIBS"
|
||||
LIBERTY_LIBS="-liberty $DL_LIB $INTL_LIB"
|
||||
-BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB $Z_LIB"
|
||||
+BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB $SFRAME_LIB $Z_LIB"
|
||||
POPT_LIBS="-lpopt"
|
||||
AC_SUBST(LIBERTY_LIBS)
|
||||
AC_SUBST(BFD_LIBS)
|
||||
diff --git a/m4/binutils.m4 b/m4/binutils.m4
|
||||
index c50e2f3c..e1ccd8e7 100644
|
||||
--- a/m4/binutils.m4
|
||||
+++ b/m4/binutils.m4
|
||||
@@ -10,11 +10,14 @@ AC_CHECK_FUNCS(xmemdup)
|
||||
AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl"; DL_LIB="-ldl", DL_LIB="")
|
||||
AC_CHECK_LIB(intl, main, LIBS="$LIBS -lintl"; INTL_LIB="-lintl", INTL_LIB="")
|
||||
|
||||
-AC_CHECK_LIB(bfd, bfd_openr, LIBS="-lbfd $LIBS"; Z_LIB="",
|
||||
+AC_CHECK_LIB(bfd, bfd_openr, LIBS="-lbfd $LIBS"; SFRAME_LIB=""; Z_LIB="",
|
||||
[AC_CHECK_LIB(z, compress,
|
||||
dnl Use a different bfd function here so as not to use cached result from above
|
||||
[AC_CHECK_LIB(bfd, bfd_fdopenr, LIBS="-lbfd -lz $LIBS"; Z_LIB="-lz",
|
||||
- [AC_MSG_ERROR([bfd library not found])], -lz)
|
||||
+dnl Use a different bfd function here so as not to use cached result from above
|
||||
+ [AC_CHECK_LIB(bfd, bfd_close, LIBS="-lbfd -lsframe -lz $LIBS"; SFRAME_LIB="-lsframe"; Z_LIB="-lz",
|
||||
+ [AC_MSG_ERROR([bfd library not found])], -lsframe -lz)
|
||||
+ ], -lz)
|
||||
],
|
||||
[AC_MSG_ERROR([libz library not found; required by libbfd])])
|
||||
]
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
From b0acf9f0c0aac93bf6f3e196d7a52c9632ff4475 Mon Sep 17 00:00:00 2001
|
||||
From: Tony Jones <tonyj@suse.de>
|
||||
Date: Fri, 8 Nov 2024 13:13:30 -0800
|
||||
Subject: [PATCH] Fix autoconf detection of perf_events
|
||||
|
||||
The autoconf check for the presence of perf_events api began failing
|
||||
on recent openSUSE builds.
|
||||
|
||||
checking kernel supports perf_events... conftest.c: In function 'main':
|
||||
conftest.c:37:39: error: implicit declaration of function 'getpid' [-Wimplicit-function-declaration]
|
||||
37 | pid = getpid();
|
||||
| ^~~~~~
|
||||
conftest.c:38:33: error: implicit declaration of function 'syscall' [-Wimplicit-function-declaration]
|
||||
38 | syscall(__NR_perf_event_open, &attr, pid, 0, -1, 0);
|
||||
| ^~~~~~~
|
||||
no
|
||||
Error: Your kernel does not appear to have the necessary support to run oprofile.
|
||||
|
||||
Upstream: https://sourceforge.net/p/oprofile/oprofile/ci/b0acf9f0c0aac93bf6f3e196d7a52c9632ff4475/
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
configure.ac | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index dc447f89..363bd440 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -116,6 +116,7 @@ if test "$kernel_may_have_perf_events_support" = "yes"; then
|
||||
rm -f test-for-PERF_EVENT_OPEN
|
||||
AC_LANG_CONFTEST(
|
||||
[AC_LANG_PROGRAM([[#include <linux/perf_event.h>
|
||||
+ #include <unistd.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
--
|
||||
2.47.3
|
||||
|
||||
51
package/oprofile/Config.in
Normal file
51
package/oprofile/Config.in
Normal file
@@ -0,0 +1,51 @@
|
||||
# memory barrier function implemented only for some architectures
|
||||
config BR2_PACKAGE_OPROFILE_ARCH_SUPPORTS
|
||||
bool
|
||||
default y
|
||||
depends on BR2_arcle || BR2_arm || BR2_armeb || \
|
||||
BR2_aarch64 || BR2_aarch64_be || BR2_i386 || BR2_mips || \
|
||||
BR2_mipsel || BR2_mips64 || BR2_mips64el || BR2_powerpc || \
|
||||
BR2_powerpc64 || BR2_powerpc64le || BR2_s390x || BR2_sh || \
|
||||
BR2_sparc || BR2_sparc64 || BR2_x86_64
|
||||
|
||||
config BR2_PACKAGE_OPROFILE_NEEDS_LIBPFM4
|
||||
bool
|
||||
default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
|
||||
|
||||
config BR2_PACKAGE_OPROFILE
|
||||
bool "oprofile"
|
||||
depends on BR2_USE_MMU # fork()
|
||||
depends on BR2_INSTALL_LIBSTDCPP
|
||||
depends on BR2_USE_WCHAR # binutils
|
||||
depends on BR2_PACKAGE_OPROFILE_ARCH_SUPPORTS
|
||||
# libpfm4 is needed on PowerPC, and requires thread support
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL || !BR2_PACKAGE_OPROFILE_NEEDS_LIBPFM4
|
||||
select BR2_PACKAGE_POPT
|
||||
select BR2_PACKAGE_BINUTILS
|
||||
select BR2_PACKAGE_LIBPFM4 if BR2_PACKAGE_OPROFILE_NEEDS_LIBPFM4
|
||||
help
|
||||
OProfile is a system-wide profiler for Linux systems,
|
||||
capable of profiling all running code at low overhead.
|
||||
OProfile is released under the GNU GPL.
|
||||
|
||||
It consists of a kernel driver and a daemon for collecting
|
||||
sample data, and several post-profiling tools for turning
|
||||
data into information.
|
||||
|
||||
OProfile leverages the hardware performance counters of the
|
||||
CPU to enable profiling of a wide variety of interesting
|
||||
statistics, which can also be used for basic time-spent
|
||||
profiling. All code is profiled: hardware and software
|
||||
interrupt handlers, kernel modules, the kernel, shared
|
||||
libraries, and applications.
|
||||
|
||||
https://sourceforge.net/projects/oprofile/
|
||||
|
||||
comment "oprofile needs a toolchain w/ C++, wchar"
|
||||
depends on BR2_USE_MMU
|
||||
depends on BR2_PACKAGE_OPROFILE_ARCH_SUPPORTS
|
||||
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR
|
||||
|
||||
comment "oprofile needs a toolchain w/ NPTL on PowerPC(64)"
|
||||
depends on BR2_USE_MMU && BR2_PACKAGE_OPROFILE_NEEDS_LIBPFM4
|
||||
depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL
|
||||
6
package/oprofile/oprofile.hash
Normal file
6
package/oprofile/oprofile.hash
Normal file
@@ -0,0 +1,6 @@
|
||||
# From http://sourceforge.net/projects/oprofile/files/oprofile/oprofile-1.4.0/
|
||||
sha1 d4d7634372d18de821b33650ad0ff7392e94c6e3 oprofile-1.4.0.tar.gz
|
||||
md5 ac0ff685ec9735e30d6a4d19de0efed7 oprofile-1.4.0.tar.gz
|
||||
|
||||
# Hash for license file:
|
||||
sha256 32b1062f7da84967e7019d01ab805935caa7ab7321a7ced0e30ebe75e5df1670 COPYING
|
||||
30
package/oprofile/oprofile.mk
Normal file
30
package/oprofile/oprofile.mk
Normal file
@@ -0,0 +1,30 @@
|
||||
################################################################################
|
||||
#
|
||||
# oprofile
|
||||
#
|
||||
################################################################################
|
||||
|
||||
OPROFILE_VERSION = 1.4.0
|
||||
OPROFILE_SITE = http://downloads.sourceforge.net/project/oprofile/oprofile/oprofile-$(OPROFILE_VERSION)
|
||||
OPROFILE_LICENSE = GPL-2.0+
|
||||
OPROFILE_LICENSE_FILES = COPYING
|
||||
OPROFILE_CPE_ID_VENDOR = maynard_johnson
|
||||
OPROFILE_CONF_OPTS = \
|
||||
--disable-account-check \
|
||||
--with-kernel=$(STAGING_DIR)/usr
|
||||
# 0002-fix-static-build-with-binutils-2.40.patch
|
||||
# 0003-Fix-autoconf-detection-of-perf_events.patch
|
||||
OPROFILE_AUTORECONF = YES
|
||||
|
||||
define OPROFILE_CREATE_MISSING_FILES
|
||||
touch $(@D)/NEWS $(@D)/AUTHORS $(@D)/ChangeLog
|
||||
endef
|
||||
OPROFILE_POST_EXTRACT_HOOKS += OPROFILE_CREATE_MISSING_FILES
|
||||
|
||||
OPROFILE_DEPENDENCIES = popt binutils host-pkgconf
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBPFM4),y)
|
||||
OPROFILE_DEPENDENCIES += libpfm4
|
||||
endif
|
||||
|
||||
$(eval $(autotools-package))
|
||||
Reference in New Issue
Block a user