diff options
Diffstat (limited to 'meta/recipes-kernel/perf')
-rw-r--r-- | meta/recipes-kernel/perf/perf-perl.inc | 4 | ||||
-rw-r--r-- | meta/recipes-kernel/perf/perf.bb | 53 |
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)}" | |||
5 | export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}/CORE" | 5 | export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}/CORE" |
6 | export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}" | 6 | export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}" |
7 | export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}" | 7 | export 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 | ||
11 | INSANE_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 | ||
10 | LICENSE = "GPL-2.0-only" | 10 | LICENSE = "GPL-2.0-only" |
11 | 11 | ||
12 | 12 | # zstd is required for kernels 6.14+ when libelf-zstd is detected | |
13 | PACKAGECONFIG ??= "python tui libunwind libtraceevent" | 13 | PACKAGECONFIG ??= "python tui libunwind libtraceevent zstd" |
14 | PACKAGECONFIG[dwarf] = ",NO_DWARF=1" | 14 | PACKAGECONFIG[dwarf] = ",NO_DWARF=1" |
15 | PACKAGECONFIG[perl] = ",NO_LIBPERL=1,perl" | 15 | PACKAGECONFIG[perl] = ",NO_LIBPERL=1,perl" |
16 | PACKAGECONFIG[python] = ",NO_LIBPYTHON=1,python3 python3-setuptools-native" | 16 | PACKAGECONFIG[python] = ",NO_LIBPYTHON=1,python3 python3-setuptools-native" |
17 | # gui support was added with kernel 3.6.35 | 17 | PACKAGECONFIG[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 | ||
20 | PACKAGECONFIG[tui] = ",NO_NEWT=1,libnewt slang" | ||
21 | PACKAGECONFIG[libunwind] = ",NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1,libunwind" | 18 | PACKAGECONFIG[libunwind] = ",NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1,libunwind" |
22 | PACKAGECONFIG[libnuma] = ",NO_LIBNUMA=1" | 19 | PACKAGECONFIG[libnuma] = ",NO_LIBNUMA=1" |
23 | PACKAGECONFIG[bfd] = ",NO_LIBBFD=1" | 20 | PACKAGECONFIG[bfd] = ",NO_LIBBFD=1" |
@@ -35,6 +32,7 @@ PACKAGECONFIG[jevents] = ",NO_JEVENTS=1,python3-native" | |||
35 | PACKAGECONFIG[coresight] = "CORESIGHT=1,,opencsd" | 32 | PACKAGECONFIG[coresight] = "CORESIGHT=1,,opencsd" |
36 | PACKAGECONFIG[pfm4] = ",NO_LIBPFM4=1,libpfm4" | 33 | PACKAGECONFIG[pfm4] = ",NO_LIBPFM4=1,libpfm4" |
37 | PACKAGECONFIG[babeltrace] = ",NO_LIBBABELTRACE=1,babeltrace" | 34 | PACKAGECONFIG[babeltrace] = ",NO_LIBBABELTRACE=1,babeltrace" |
35 | PACKAGECONFIG[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 |
40 | PACKAGECONFIG:remove:arc = "libunwind" | 38 | PACKAGECONFIG:remove:arc = "libunwind" |
@@ -68,22 +66,30 @@ include ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perf-perl.inc', '', d)} | |||
68 | 66 | ||
69 | inherit kernelsrc | 67 | inherit kernelsrc |
70 | 68 | ||
71 | S = "${WORKDIR}/${BP}" | 69 | S = "${UNPACKDIR}/${BP}" |
72 | SPDX_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. |
77 | LDFLAGS="-ldl -lutil" | 74 | LDFLAGS = "-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. |
86 | TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION}" | 82 | TARGET_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 | ||
92 | TARGET_CC_ARCH:append:toolchain-clang:arm = " -fno-error=maybe-uninitialized" | ||
87 | 93 | ||
88 | EXTRA_OEMAKE = '\ | 94 | EXTRA_OEMAKE = '\ |
89 | V=1 \ | 95 | V=1 \ |
@@ -129,6 +135,10 @@ EXTRA_OEMAKE += "\ | |||
129 | # honour a JOBS variable. | 135 | # honour a JOBS variable. |
130 | EXTRA_OEMAKE:append:task-configure = " JOBS=1" | 136 | EXTRA_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 | ||
141 | PERF_BPF_EVENT_SRC ?= '${@bb.utils.contains_any("ARCH", [ "riscv", "arm64" ], "arch/${ARCH}/include/uapi/asm/bpf_perf_event.h", "", d)}' | ||
132 | PERF_SRC ?= "Makefile \ | 142 | PERF_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 | ||
145 | PERF_EXTRA_LDFLAGS = "" | 157 | PERF_EXTRA_LDFLAGS = "" |
@@ -197,7 +209,7 @@ python copy_perf_source_from_kernel() { | |||
197 | do_configure:prepend () { | 209 | do_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 | ||
372 | python do_package:prepend() { | ||
373 | d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0]) | ||
374 | } | ||
375 | |||
376 | PACKAGE_ARCH = "${MACHINE_ARCH}" | 388 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
377 | 389 | ||
378 | |||
379 | PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python" | 390 | PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python" |
380 | 391 | ||
381 | RDEPENDS:${PN} += "elfutils bash" | 392 | RDEPENDS:${PN} += "elfutils bash" |
382 | RDEPENDS:${PN}-archive =+ "bash" | 393 | RDEPENDS:${PN}-archive =+ "bash" |
383 | RDEPENDS:${PN}-python =+ "bash python3 python3-modules ${@bb.utils.contains('PACKAGECONFIG', 'audit', 'audit-python', '', d)}" | 394 | RDEPENDS:${PN}-python =+ "bash python3 python3-modules ${@bb.utils.contains('PACKAGECONFIG', 'audit', 'audit-python', '', d)}" |
384 | RDEPENDS:${PN}-perl =+ "bash perl perl-modules" | 395 | RDEPENDS:${PN}-perl =+ "bash perl perl-modules" |
385 | RDEPENDS:${PN}-tests =+ "python3 bash" | 396 | RDEPENDS:${PN}-tests =+ "python3 bash perl" |
386 | 397 | ||
387 | RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests \ | 398 | RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests \ |
388 | ${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl', '', d)} \ | 399 | ${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl', '', d)} \ |