summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/perf
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/perf')
-rw-r--r--meta/recipes-kernel/perf/perf-perl.inc4
-rw-r--r--meta/recipes-kernel/perf/perf.bb53
2 files changed, 32 insertions, 25 deletions
diff --git a/meta/recipes-kernel/perf/perf-perl.inc b/meta/recipes-kernel/perf/perf-perl.inc
index 491f54c328..f3eef75a90 100644
--- a/meta/recipes-kernel/perf/perf-perl.inc
+++ b/meta/recipes-kernel/perf/perf-perl.inc
@@ -5,7 +5,3 @@ export PERLCONFIGTARGET = "${@is_target(d)}"
5export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}/CORE" 5export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}/CORE"
6export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}" 6export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}"
7export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}" 7export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}"
8
9# The perl symbols CPPSTDIN and CPPRUN embed the sysroot into the
10# binaries, work needed to remove this
11INSANE_SKIP:${PN}-dbg += "buildpaths"
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 4f26813de0..4f29bd5bbc 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -9,15 +9,12 @@ HOMEPAGE = "https://perf.wiki.kernel.org/index.php/Main_Page"
9 9
10LICENSE = "GPL-2.0-only" 10LICENSE = "GPL-2.0-only"
11 11
12 12# zstd is required for kernels 6.14+ when libelf-zstd is detected
13PACKAGECONFIG ??= "python tui libunwind libtraceevent" 13PACKAGECONFIG ??= "python tui libunwind libtraceevent zstd"
14PACKAGECONFIG[dwarf] = ",NO_DWARF=1" 14PACKAGECONFIG[dwarf] = ",NO_DWARF=1"
15PACKAGECONFIG[perl] = ",NO_LIBPERL=1,perl" 15PACKAGECONFIG[perl] = ",NO_LIBPERL=1,perl"
16PACKAGECONFIG[python] = ",NO_LIBPYTHON=1,python3 python3-setuptools-native" 16PACKAGECONFIG[python] = ",NO_LIBPYTHON=1,python3 python3-setuptools-native"
17# gui support was added with kernel 3.6.35 17PACKAGECONFIG[tui] = ",NO_SLANG=1,slang"
18# since 3.10 libnewt was replaced by slang
19# to cover a wide range of kernel we add both dependencies
20PACKAGECONFIG[tui] = ",NO_NEWT=1,libnewt slang"
21PACKAGECONFIG[libunwind] = ",NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1,libunwind" 18PACKAGECONFIG[libunwind] = ",NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1,libunwind"
22PACKAGECONFIG[libnuma] = ",NO_LIBNUMA=1" 19PACKAGECONFIG[libnuma] = ",NO_LIBNUMA=1"
23PACKAGECONFIG[bfd] = ",NO_LIBBFD=1" 20PACKAGECONFIG[bfd] = ",NO_LIBBFD=1"
@@ -35,6 +32,7 @@ PACKAGECONFIG[jevents] = ",NO_JEVENTS=1,python3-native"
35PACKAGECONFIG[coresight] = "CORESIGHT=1,,opencsd" 32PACKAGECONFIG[coresight] = "CORESIGHT=1,,opencsd"
36PACKAGECONFIG[pfm4] = ",NO_LIBPFM4=1,libpfm4" 33PACKAGECONFIG[pfm4] = ",NO_LIBPFM4=1,libpfm4"
37PACKAGECONFIG[babeltrace] = ",NO_LIBBABELTRACE=1,babeltrace" 34PACKAGECONFIG[babeltrace] = ",NO_LIBBABELTRACE=1,babeltrace"
35PACKAGECONFIG[zstd] = ",NO_LIBZSTD=1,zstd"
38 36
39# libunwind is not yet ported for some architectures 37# libunwind is not yet ported for some architectures
40PACKAGECONFIG:remove:arc = "libunwind" 38PACKAGECONFIG:remove:arc = "libunwind"
@@ -68,22 +66,30 @@ include ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perf-perl.inc', '', d)}
68 66
69inherit kernelsrc 67inherit kernelsrc
70 68
71S = "${WORKDIR}/${BP}" 69S = "${UNPACKDIR}/${BP}"
72SPDX_S = "${S}/tools/perf"
73 70
74# The LDFLAGS is required or some old kernels fails due missing 71# The LDFLAGS is required or some old kernels fails due missing
75# symbols and this is preferred than requiring patches to every old 72# symbols and this is preferred than requiring patches to every old
76# supported kernel. 73# supported kernel.
77LDFLAGS="-ldl -lutil" 74LDFLAGS = "-ldl -lutil"
78 75
79# Perf's build system adds its own optimization flags for most TUs, 76# Perf's build system adds its own optimization flags for most TUs,
80# overriding the flags included here. But for some, perf does not add 77# overriding the flags included here. But for some, perf does not add
81# any -O option, so ensure the distro's chosen optimization gets used 78# any -O option, so ensure the distro's chosen optimization gets used
82# for those. Since ${SELECTED_OPTIMIZATION} always includes 79# for those. Also include ${DEBUG_PREFIX_MAP} which ensures perf is
83# ${DEBUG_FLAGS} which in turn includes ${DEBUG_PREFIX_MAP}, this also 80# built with appropriate -f*-prefix-map options,
84# ensures perf is built with appropriate -f*-prefix-map options,
85# avoiding the 'buildpaths' QA warning. 81# avoiding the 'buildpaths' QA warning.
86TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION}" 82TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION} ${DEBUG_PREFIX_MAP}"
83
84#| libbpf.c: In function 'find_kernel_btf_id.constprop':
85#| libbpf.c:10009:33: error: 'mod_len' may be used uninitialized [-Werror=maybe-uninitialized]
86#| 10009 | if (mod_name && strncmp(mod->name, mod_name, mod_len) != 0)
87#| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
88#| libbpf.c:9979:21: note: 'mod_len' was declared here
89#| 9979 | int ret, i, mod_len;
90#| | ^~~~~~~
91#| cc1: all warnings being treated as errors
92TARGET_CC_ARCH:append:toolchain-clang:arm = " -fno-error=maybe-uninitialized"
87 93
88EXTRA_OEMAKE = '\ 94EXTRA_OEMAKE = '\
89 V=1 \ 95 V=1 \
@@ -129,6 +135,10 @@ EXTRA_OEMAKE += "\
129# honour a JOBS variable. 135# honour a JOBS variable.
130EXTRA_OEMAKE:append:task-configure = " JOBS=1" 136EXTRA_OEMAKE:append:task-configure = " JOBS=1"
131 137
138# the architectures that need this file can be found in
139# tools/include/uapi/asm/bpf_perf_event.h
140# We are only listing supported arches at the moment
141PERF_BPF_EVENT_SRC ?= '${@bb.utils.contains_any("ARCH", [ "riscv", "arm64" ], "arch/${ARCH}/include/uapi/asm/bpf_perf_event.h", "", d)}'
132PERF_SRC ?= "Makefile \ 142PERF_SRC ?= "Makefile \
133 tools/arch \ 143 tools/arch \
134 tools/build \ 144 tools/build \
@@ -139,7 +149,9 @@ PERF_SRC ?= "Makefile \
139 tools/scripts \ 149 tools/scripts \
140 scripts/ \ 150 scripts/ \
141 arch/arm64/tools \ 151 arch/arm64/tools \
152 ${PERF_BPF_EVENT_SRC} \
142 arch/${ARCH}/Makefile \ 153 arch/${ARCH}/Makefile \
154 include/uapi/asm-generic/Kbuild \
143" 155"
144 156
145PERF_EXTRA_LDFLAGS = "" 157PERF_EXTRA_LDFLAGS = ""
@@ -197,7 +209,7 @@ python copy_perf_source_from_kernel() {
197do_configure:prepend () { 209do_configure:prepend () {
198 # If building a multlib based perf, the incorrect library path will be 210 # If building a multlib based perf, the incorrect library path will be
199 # detected by perf, since it triggers via: ifeq ($(ARCH),x86_64). In a 32 bit 211 # detected by perf, since it triggers via: ifeq ($(ARCH),x86_64). In a 32 bit
200 # build, with a 64 bit multilib, the arch won't match and the detection of a 212 # build, with a 64 bit multilib, the arch won't match and the detection of a
201 # 64 bit build (and library) are not exected. To ensure that libraries are 213 # 64 bit build (and library) are not exected. To ensure that libraries are
202 # installed to the correct location, we can use the weak assignment in the 214 # installed to the correct location, we can use the weak assignment in the
203 # config/Makefile. 215 # config/Makefile.
@@ -230,14 +242,18 @@ do_configure:prepend () {
230 if [ -e "${S}/tools/perf/Makefile.perf" ]; then 242 if [ -e "${S}/tools/perf/Makefile.perf" ]; then
231 sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \ 243 sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \
232 ${S}/tools/perf/Makefile.perf 244 ${S}/tools/perf/Makefile.perf
245 # Variant with linux-yocto-specific patch
233 sed -i -e "s,prefix='\$(DESTDIR_SQ)/usr'$,prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(PYTHON_SITEPACKAGES_DIR)' --root='\$(DESTDIR)',g" \ 246 sed -i -e "s,prefix='\$(DESTDIR_SQ)/usr'$,prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(PYTHON_SITEPACKAGES_DIR)' --root='\$(DESTDIR)',g" \
234 ${S}/tools/perf/Makefile.perf 247 ${S}/tools/perf/Makefile.perf
248 # Variant for mainline Linux
249 sed -i -e "s,root='/\$(DESTDIR_SQ)',prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(PYTHON_SITEPACKAGES_DIR)' --root='/\$(DESTDIR_SQ)',g" \
250 ${S}/tools/perf/Makefile.perf
235 # backport https://github.com/torvalds/linux/commit/e4ffd066ff440a57097e9140fa9e16ceef905de8 251 # backport https://github.com/torvalds/linux/commit/e4ffd066ff440a57097e9140fa9e16ceef905de8
236 sed -i -e 's,\($(Q)$(SHELL) .$(arch_errno_tbl).\) $(CC) $(arch_errno_hdr_dir),\1 $(firstword $(CC)) $(arch_errno_hdr_dir),g' \ 252 sed -i -e 's,\($(Q)$(SHELL) .$(arch_errno_tbl).\) $(CC) $(arch_errno_hdr_dir),\1 $(firstword $(CC)) $(arch_errno_hdr_dir),g' \
237 ${S}/tools/perf/Makefile.perf 253 ${S}/tools/perf/Makefile.perf
238 fi 254 fi
239 sed -i -e "s,--root='/\$(DESTDIR_SQ)',--prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(DESTDIR)\$(PYTHON_SITEPACKAGES_DIR)',g" \ 255 sed -i -e "s,--root='/\$(DESTDIR_SQ)',--prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(DESTDIR)\$(PYTHON_SITEPACKAGES_DIR)',g" \
240 ${S}/tools/perf/Makefile* 256 ${S}/tools/perf/Makefile
241 257
242 if [ -e "${S}/tools/build/Makefile.build" ]; then 258 if [ -e "${S}/tools/build/Makefile.build" ]; then
243 sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \ 259 sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \
@@ -369,20 +385,15 @@ do_configure:prepend () {
369 done 385 done
370} 386}
371 387
372python do_package:prepend() {
373 d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0])
374}
375
376PACKAGE_ARCH = "${MACHINE_ARCH}" 388PACKAGE_ARCH = "${MACHINE_ARCH}"
377 389
378
379PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python" 390PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python"
380 391
381RDEPENDS:${PN} += "elfutils bash" 392RDEPENDS:${PN} += "elfutils bash"
382RDEPENDS:${PN}-archive =+ "bash" 393RDEPENDS:${PN}-archive =+ "bash"
383RDEPENDS:${PN}-python =+ "bash python3 python3-modules ${@bb.utils.contains('PACKAGECONFIG', 'audit', 'audit-python', '', d)}" 394RDEPENDS:${PN}-python =+ "bash python3 python3-modules ${@bb.utils.contains('PACKAGECONFIG', 'audit', 'audit-python', '', d)}"
384RDEPENDS:${PN}-perl =+ "bash perl perl-modules" 395RDEPENDS:${PN}-perl =+ "bash perl perl-modules"
385RDEPENDS:${PN}-tests =+ "python3 bash" 396RDEPENDS:${PN}-tests =+ "python3 bash perl"
386 397
387RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests \ 398RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests \
388 ${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl', '', d)} \ 399 ${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl', '', d)} \