diff options
Diffstat (limited to 'meta/recipes-kernel/perf')
-rw-r--r-- | meta/recipes-kernel/perf/perf-perl.inc | 6 | ||||
-rw-r--r-- | meta/recipes-kernel/perf/perf.bb | 151 | ||||
-rwxr-xr-x | meta/recipes-kernel/perf/perf/sort-pmuevents.py | 13 |
3 files changed, 127 insertions, 43 deletions
diff --git a/meta/recipes-kernel/perf/perf-perl.inc b/meta/recipes-kernel/perf/perf-perl.inc index ae77319b20..f3eef75a90 100644 --- a/meta/recipes-kernel/perf/perf-perl.inc +++ b/meta/recipes-kernel/perf/perf-perl.inc | |||
@@ -2,6 +2,6 @@ inherit perlnative cpan-base | |||
2 | 2 | ||
3 | # Env var which tells perl if it should use host (no) or target (yes) settings | 3 | # Env var which tells perl if it should use host (no) or target (yes) settings |
4 | export PERLCONFIGTARGET = "${@is_target(d)}" | 4 | export PERLCONFIGTARGET = "${@is_target(d)}" |
5 | export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(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}/perl/${@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}/perl/${@get_perl_version(d)}" | 7 | export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl5/${@get_perl_version(d)}/${@get_perl_arch(d)}" |
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb index 7bbc1ad70c..4f29bd5bbc 100644 --- a/meta/recipes-kernel/perf/perf.bb +++ b/meta/recipes-kernel/perf/perf.bb | |||
@@ -7,27 +7,32 @@ and software features (software counters, tracepoints) \ | |||
7 | as well." | 7 | as well." |
8 | HOMEPAGE = "https://perf.wiki.kernel.org/index.php/Main_Page" | 8 | HOMEPAGE = "https://perf.wiki.kernel.org/index.php/Main_Page" |
9 | 9 | ||
10 | LICENSE = "GPLv2" | 10 | LICENSE = "GPL-2.0-only" |
11 | 11 | ||
12 | PR = "r9" | 12 | # zstd is required for kernels 6.14+ when libelf-zstd is detected |
13 | 13 | PACKAGECONFIG ??= "python tui libunwind libtraceevent zstd" | |
14 | PACKAGECONFIG ??= "scripting tui libunwind" | ||
15 | PACKAGECONFIG[dwarf] = ",NO_DWARF=1" | 14 | PACKAGECONFIG[dwarf] = ",NO_DWARF=1" |
16 | PACKAGECONFIG[scripting] = ",NO_LIBPERL=1 NO_LIBPYTHON=1,perl python3" | 15 | PACKAGECONFIG[perl] = ",NO_LIBPERL=1,perl" |
17 | # gui support was added with kernel 3.6.35 | 16 | PACKAGECONFIG[python] = ",NO_LIBPYTHON=1,python3 python3-setuptools-native" |
18 | # since 3.10 libnewt was replaced by slang | 17 | PACKAGECONFIG[tui] = ",NO_SLANG=1,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" |
20 | PACKAGECONFIG[bfd] = ",NO_LIBBFD=1" | ||
23 | PACKAGECONFIG[systemtap] = ",NO_SDT=1,systemtap" | 21 | PACKAGECONFIG[systemtap] = ",NO_SDT=1,systemtap" |
24 | PACKAGECONFIG[jvmti] = ",NO_JVMTI=1" | 22 | PACKAGECONFIG[jvmti] = ",NO_JVMTI=1" |
25 | # libaudit support would need scripting to be enabled | 23 | # libaudit support would need scripting to be enabled |
26 | PACKAGECONFIG[audit] = ",NO_LIBAUDIT=1,audit" | 24 | PACKAGECONFIG[audit] = ",NO_LIBAUDIT=1,audit" |
27 | PACKAGECONFIG[manpages] = ",,xmlto-native asciidoc-native" | 25 | PACKAGECONFIG[manpages] = ",,xmlto-native asciidoc-native" |
28 | PACKAGECONFIG[cap] = ",,libcap" | 26 | PACKAGECONFIG[cap] = ",,libcap" |
27 | PACKAGECONFIG[libtraceevent] = ",NO_LIBTRACEEVENT=1,libtraceevent" | ||
28 | # jevents requires host python for generating a .c file, but is | ||
29 | # unrelated to the python item. | ||
30 | PACKAGECONFIG[jevents] = ",NO_JEVENTS=1,python3-native" | ||
29 | # Arm CoreSight | 31 | # Arm CoreSight |
30 | PACKAGECONFIG[coresight] = "CORESIGHT=1,,opencsd" | 32 | PACKAGECONFIG[coresight] = "CORESIGHT=1,,opencsd" |
33 | PACKAGECONFIG[pfm4] = ",NO_LIBPFM4=1,libpfm4" | ||
34 | PACKAGECONFIG[babeltrace] = ",NO_LIBBABELTRACE=1,babeltrace" | ||
35 | PACKAGECONFIG[zstd] = ",NO_LIBZSTD=1,zstd" | ||
31 | 36 | ||
32 | # libunwind is not yet ported for some architectures | 37 | # libunwind is not yet ported for some architectures |
33 | PACKAGECONFIG:remove:arc = "libunwind" | 38 | PACKAGECONFIG:remove:arc = "libunwind" |
@@ -47,7 +52,7 @@ PROVIDES = "virtual/perf" | |||
47 | inherit linux-kernel-base kernel-arch manpages | 52 | inherit linux-kernel-base kernel-arch manpages |
48 | 53 | ||
49 | # needed for building the tools/perf Python bindings | 54 | # needed for building the tools/perf Python bindings |
50 | inherit ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'python3targetconfig', '', d)} | 55 | inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)} |
51 | inherit python3-dir | 56 | inherit python3-dir |
52 | export PYTHON_SITEPACKAGES_DIR | 57 | export PYTHON_SITEPACKAGES_DIR |
53 | 58 | ||
@@ -57,20 +62,38 @@ export WERROR = "0" | |||
57 | do_populate_lic[depends] += "virtual/kernel:do_shared_workdir" | 62 | do_populate_lic[depends] += "virtual/kernel:do_shared_workdir" |
58 | 63 | ||
59 | # needed for building the tools/perf Perl binding | 64 | # needed for building the tools/perf Perl binding |
60 | include ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'perf-perl.inc', '', d)} | 65 | include ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perf-perl.inc', '', d)} |
61 | 66 | ||
62 | inherit kernelsrc | 67 | inherit kernelsrc |
63 | 68 | ||
64 | S = "${WORKDIR}/${BP}" | 69 | S = "${UNPACKDIR}/${BP}" |
65 | SPDX_S = "${S}/tools/perf" | ||
66 | 70 | ||
67 | # The LDFLAGS is required or some old kernels fails due missing | 71 | # The LDFLAGS is required or some old kernels fails due missing |
68 | # symbols and this is preferred than requiring patches to every old | 72 | # symbols and this is preferred than requiring patches to every old |
69 | # supported kernel. | 73 | # supported kernel. |
70 | LDFLAGS="-ldl -lutil" | 74 | LDFLAGS = "-ldl -lutil" |
75 | |||
76 | # Perf's build system adds its own optimization flags for most TUs, | ||
77 | # overriding the flags included here. But for some, perf does not add | ||
78 | # any -O option, so ensure the distro's chosen optimization gets used | ||
79 | # for those. Also include ${DEBUG_PREFIX_MAP} which ensures perf is | ||
80 | # built with appropriate -f*-prefix-map options, | ||
81 | # avoiding the 'buildpaths' QA warning. | ||
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" | ||
71 | 93 | ||
72 | EXTRA_OEMAKE = '\ | 94 | EXTRA_OEMAKE = '\ |
73 | V=1 \ | 95 | V=1 \ |
96 | VF=1 \ | ||
74 | -C ${S}/tools/perf \ | 97 | -C ${S}/tools/perf \ |
75 | O=${B} \ | 98 | O=${B} \ |
76 | CROSS_COMPILE=${TARGET_PREFIX} \ | 99 | CROSS_COMPILE=${TARGET_PREFIX} \ |
@@ -80,12 +103,13 @@ EXTRA_OEMAKE = '\ | |||
80 | LDSHARED="${CC} -shared" \ | 103 | LDSHARED="${CC} -shared" \ |
81 | AR="${AR}" \ | 104 | AR="${AR}" \ |
82 | LD="${LD}" \ | 105 | LD="${LD}" \ |
83 | EXTRA_CFLAGS="-ldw" \ | 106 | EXTRA_CFLAGS="-ldw -I${S}" \ |
84 | YFLAGS='-y --file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}' \ | 107 | YFLAGS='-y --file-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}' \ |
85 | EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \ | 108 | EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \ |
86 | perfexecdir=${libexecdir} \ | 109 | perfexecdir=${libexecdir} \ |
87 | NO_GTK2=1 \ | 110 | NO_GTK2=1 \ |
88 | ${PACKAGECONFIG_CONFARGS} \ | 111 | ${PACKAGECONFIG_CONFARGS} \ |
112 | PKG_CONFIG=pkg-config \ | ||
89 | TMPDIR="${B}" \ | 113 | TMPDIR="${B}" \ |
90 | LIBUNWIND_DIR=${STAGING_EXECPREFIXDIR} \ | 114 | LIBUNWIND_DIR=${STAGING_EXECPREFIXDIR} \ |
91 | ' | 115 | ' |
@@ -101,7 +125,7 @@ EXTRA_OEMAKE += "\ | |||
101 | 'sharedir=${@os.path.relpath(datadir, prefix)}' \ | 125 | 'sharedir=${@os.path.relpath(datadir, prefix)}' \ |
102 | 'mandir=${@os.path.relpath(mandir, prefix)}' \ | 126 | 'mandir=${@os.path.relpath(mandir, prefix)}' \ |
103 | 'infodir=${@os.path.relpath(infodir, prefix)}' \ | 127 | 'infodir=${@os.path.relpath(infodir, prefix)}' \ |
104 | ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'PYTHON=python3 PYTHON_CONFIG=python3-config', '', d)} \ | 128 | ${@bb.utils.contains('PACKAGECONFIG', 'python', 'PYTHON=python3 PYTHON_CONFIG=python3-config', '', d)} \ |
105 | " | 129 | " |
106 | 130 | ||
107 | # During do_configure, we might run a 'make clean'. That often breaks | 131 | # During do_configure, we might run a 'make clean'. That often breaks |
@@ -111,6 +135,10 @@ EXTRA_OEMAKE += "\ | |||
111 | # honour a JOBS variable. | 135 | # honour a JOBS variable. |
112 | EXTRA_OEMAKE:append:task-configure = " JOBS=1" | 136 | EXTRA_OEMAKE:append:task-configure = " JOBS=1" |
113 | 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)}' | ||
114 | PERF_SRC ?= "Makefile \ | 142 | PERF_SRC ?= "Makefile \ |
115 | tools/arch \ | 143 | tools/arch \ |
116 | tools/build \ | 144 | tools/build \ |
@@ -120,18 +148,27 @@ PERF_SRC ?= "Makefile \ | |||
120 | tools/perf \ | 148 | tools/perf \ |
121 | tools/scripts \ | 149 | tools/scripts \ |
122 | scripts/ \ | 150 | scripts/ \ |
151 | arch/arm64/tools \ | ||
152 | ${PERF_BPF_EVENT_SRC} \ | ||
123 | arch/${ARCH}/Makefile \ | 153 | arch/${ARCH}/Makefile \ |
154 | include/uapi/asm-generic/Kbuild \ | ||
124 | " | 155 | " |
125 | 156 | ||
126 | PERF_EXTRA_LDFLAGS = "" | 157 | PERF_EXTRA_LDFLAGS = "" |
127 | 158 | ||
128 | # MIPS N32 | 159 | # MIPS N32/N64 |
129 | PERF_EXTRA_LDFLAGS:mipsarchn32eb = "-m elf32btsmipn32" | 160 | PERF_EXTRA_LDFLAGS:mipsarchn32eb = "-m elf32btsmipn32" |
130 | PERF_EXTRA_LDFLAGS:mipsarchn32el = "-m elf32ltsmipn32" | 161 | PERF_EXTRA_LDFLAGS:mipsarchn32el = "-m elf32ltsmipn32" |
162 | PERF_EXTRA_LDFLAGS:mipsarchn64eb = "-m elf64btsmip" | ||
163 | PERF_EXTRA_LDFLAGS:mipsarchn64el = "-m elf64ltsmip" | ||
131 | 164 | ||
132 | do_compile() { | 165 | do_compile() { |
133 | # Linux kernel build system is expected to do the right thing | 166 | # Linux kernel build system is expected to do the right thing |
134 | unset CFLAGS | 167 | unset CFLAGS |
168 | test -e ${S}/tools/lib/traceevent/plugins/Makefile && \ | ||
169 | sed -i -e 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g' ${S}/tools/lib/traceevent/plugins/Makefile | ||
170 | test -e ${S}/tools/perf/Makefile.config && \ | ||
171 | sed -i -e 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g' ${S}/tools/perf/Makefile.config | ||
135 | oe_runmake all | 172 | oe_runmake all |
136 | } | 173 | } |
137 | 174 | ||
@@ -140,8 +177,11 @@ do_install() { | |||
140 | unset CFLAGS | 177 | unset CFLAGS |
141 | oe_runmake install | 178 | oe_runmake install |
142 | # we are checking for this make target to be compatible with older perf versions | 179 | # we are checking for this make target to be compatible with older perf versions |
143 | if ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'true', 'false', d)} && grep -q install-python_ext ${S}/tools/perf/Makefile*; then | 180 | if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)} && grep -q install-python_ext ${S}/tools/perf/Makefile*; then |
144 | oe_runmake DESTDIR=${D} install-python_ext | 181 | oe_runmake DESTDIR=${D} install-python_ext |
182 | if [ -e ${D}${libdir}/python*/site-packages/perf-*/SOURCES.txt ]; then | ||
183 | sed -i -e 's#${WORKDIR}##g' ${D}${libdir}/python*/site-packages/perf-*/SOURCES.txt | ||
184 | fi | ||
145 | fi | 185 | fi |
146 | } | 186 | } |
147 | 187 | ||
@@ -156,7 +196,8 @@ python copy_perf_source_from_kernel() { | |||
156 | src = oe.path.join(src_dir, s) | 196 | src = oe.path.join(src_dir, s) |
157 | dest = oe.path.join(dest_dir, s) | 197 | dest = oe.path.join(dest_dir, s) |
158 | if not os.path.exists(src): | 198 | if not os.path.exists(src): |
159 | bb.fatal("Path does not exist: %s. Maybe PERF_SRC does not match the kernel version." % src) | 199 | bb.warn("Path does not exist: %s. Maybe PERF_SRC lists more files than what your kernel version provides and needs." % src) |
200 | continue | ||
160 | if os.path.isdir(src): | 201 | if os.path.isdir(src): |
161 | oe.path.copyhardlinktree(src, dest) | 202 | oe.path.copyhardlinktree(src, dest) |
162 | else: | 203 | else: |
@@ -168,7 +209,7 @@ python copy_perf_source_from_kernel() { | |||
168 | do_configure:prepend () { | 209 | do_configure:prepend () { |
169 | # 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 |
170 | # 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 |
171 | # 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 |
172 | # 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 |
173 | # 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 |
174 | # config/Makefile. | 215 | # config/Makefile. |
@@ -201,14 +242,18 @@ do_configure:prepend () { | |||
201 | if [ -e "${S}/tools/perf/Makefile.perf" ]; then | 242 | if [ -e "${S}/tools/perf/Makefile.perf" ]; then |
202 | sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \ | 243 | sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \ |
203 | ${S}/tools/perf/Makefile.perf | 244 | ${S}/tools/perf/Makefile.perf |
204 | sed -i -e "s,prefix='\$(DESTDIR_SQ)/usr'$,prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(DESTDIR)\$(PYTHON_SITEPACKAGES_DIR)',g" \ | 245 | # Variant with linux-yocto-specific patch |
246 | sed -i -e "s,prefix='\$(DESTDIR_SQ)/usr'$,prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(PYTHON_SITEPACKAGES_DIR)' --root='\$(DESTDIR)',g" \ | ||
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" \ | ||
205 | ${S}/tools/perf/Makefile.perf | 250 | ${S}/tools/perf/Makefile.perf |
206 | # backport https://github.com/torvalds/linux/commit/e4ffd066ff440a57097e9140fa9e16ceef905de8 | 251 | # backport https://github.com/torvalds/linux/commit/e4ffd066ff440a57097e9140fa9e16ceef905de8 |
207 | 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' \ |
208 | ${S}/tools/perf/Makefile.perf | 253 | ${S}/tools/perf/Makefile.perf |
209 | fi | 254 | fi |
210 | 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" \ |
211 | ${S}/tools/perf/Makefile* | 256 | ${S}/tools/perf/Makefile |
212 | 257 | ||
213 | if [ -e "${S}/tools/build/Makefile.build" ]; then | 258 | if [ -e "${S}/tools/build/Makefile.build" ]; then |
214 | sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \ | 259 | sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \ |
@@ -225,6 +270,15 @@ do_configure:prepend () { | |||
225 | # reproducible. | 270 | # reproducible. |
226 | sed -i -e 's,$(call get-executable-or-default\,PYTHON\,$(PYTHON_AUTO)),$(notdir $(call get-executable-or-default\,PYTHON\,$(PYTHON_AUTO))),g' \ | 271 | sed -i -e 's,$(call get-executable-or-default\,PYTHON\,$(PYTHON_AUTO)),$(notdir $(call get-executable-or-default\,PYTHON\,$(PYTHON_AUTO))),g' \ |
227 | ${S}/tools/perf/Makefile.config | 272 | ${S}/tools/perf/Makefile.config |
273 | # The same line is in older releases, but looking explicitly for Python 2 | ||
274 | sed -i -e 's,$(call get-executable-or-default\,PYTHON\,$(PYTHON2)),$(notdir $(call get-executable-or-default\,PYTHON\,$(PYTHON2))),g' \ | ||
275 | ${S}/tools/perf/Makefile.config | ||
276 | |||
277 | # likewise with this substitution. Kernels with commit 18f2967418d031a39 | ||
278 | # [perf tools: Use Python devtools for version autodetection rather than runtime] | ||
279 | # need this substitution for reproducibility. | ||
280 | sed -i -e 's,$(call get-executable-or-default\,PYTHON\,$(subst -config\,\,$(PYTHON_AUTO))),$(notdir $(call get-executable-or-default\,PYTHON\,$(subst -config\,\,$(PYTHON_AUTO)))),g' \ | ||
281 | ${S}/tools/perf/Makefile.config | ||
228 | 282 | ||
229 | # The following line: | 283 | # The following line: |
230 | # srcdir_SQ = $(patsubst %tools/perf,tools/perf,$(subst ','\'',$(srcdir))), | 284 | # srcdir_SQ = $(patsubst %tools/perf,tools/perf,$(subst ','\'',$(srcdir))), |
@@ -233,6 +287,9 @@ do_configure:prepend () { | |||
233 | # change the Makefile line to remove everything before 'tools/perf' | 287 | # change the Makefile line to remove everything before 'tools/perf' |
234 | sed -i -e "s%srcdir_SQ = \$(subst ','\\\'',\$(srcdir))%srcdir_SQ = \$(patsubst \%tools/perf,tools/perf,\$(subst ','\\\'',\$(srcdir)))%g" \ | 288 | sed -i -e "s%srcdir_SQ = \$(subst ','\\\'',\$(srcdir))%srcdir_SQ = \$(patsubst \%tools/perf,tools/perf,\$(subst ','\\\'',\$(srcdir)))%g" \ |
235 | ${S}/tools/perf/Makefile.config | 289 | ${S}/tools/perf/Makefile.config |
290 | # Avoid hardcoded path to python-native | ||
291 | sed -i -e 's#\(PYTHON_WORD := \)$(call shell-wordify,$(PYTHON))#\1 python3#g' \ | ||
292 | ${S}/tools/perf/Makefile.config | ||
236 | fi | 293 | fi |
237 | if [ -e "${S}/tools/perf/tests/Build" ]; then | 294 | if [ -e "${S}/tools/perf/tests/Build" ]; then |
238 | # OUTPUT is the full path, we have python on the path so we remove it from the | 295 | # OUTPUT is the full path, we have python on the path so we remove it from the |
@@ -258,6 +315,20 @@ do_configure:prepend () { | |||
258 | sed -i -e "s,$target,$replacement1$replacement2$replacement3,g" \ | 315 | sed -i -e "s,$target,$replacement1$replacement2$replacement3,g" \ |
259 | "${S}/tools/perf/pmu-events/Build" | 316 | "${S}/tools/perf/pmu-events/Build" |
260 | fi | 317 | fi |
318 | if [ -e "${S}/tools/perf/pmu-events/jevents.py" ]; then | ||
319 | sed -i -e "s#os.scandir(path)#sorted(os.scandir(path), key=lambda e: e.name)#g" \ | ||
320 | "${S}/tools/perf/pmu-events/jevents.py" | ||
321 | fi | ||
322 | if [ -e "${S}/tools/perf/arch/arm64/Makefile" ]; then | ||
323 | sed -i 's,sysdef := $(srctree)/,sysdef := ,' ${S}/tools/perf/arch/arm64/Makefile | ||
324 | sed -i 's,$(incpath) $(sysdef),$(incpath) $(srctree)/$(sysdef) $(sysdef),' ${S}/tools/perf/arch/arm64/Makefile | ||
325 | fi | ||
326 | if [ -e "${S}/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl" ]; then | ||
327 | if ! grep -q input_rel ${S}/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl; then | ||
328 | sed -i 's,input=$4,input=$4\ninput_rel=$5,' ${S}/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | ||
329 | fi | ||
330 | sed -i 's,#include \\"\$input\\",#include \\"\$input_rel\\",' ${S}/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | ||
331 | fi | ||
261 | # end reproducibility substitutions | 332 | # end reproducibility substitutions |
262 | 333 | ||
263 | # We need to ensure the --sysroot option in CC is preserved | 334 | # We need to ensure the --sysroot option in CC is preserved |
@@ -265,6 +336,7 @@ do_configure:prepend () { | |||
265 | sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/perf/Makefile.perf | 336 | sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/perf/Makefile.perf |
266 | sed -i 's,AR = $(CROSS_COMPILE)ar,#AR,' ${S}/tools/perf/Makefile.perf | 337 | sed -i 's,AR = $(CROSS_COMPILE)ar,#AR,' ${S}/tools/perf/Makefile.perf |
267 | sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' ${S}/tools/perf/Makefile.perf | 338 | sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' ${S}/tools/perf/Makefile.perf |
339 | sed -i 's,PKG_CONFIG = $(CROSS_COMPILE)pkg-config,#PKG_CONFIG,' ${S}/tools/perf/Makefile.perf | ||
268 | fi | 340 | fi |
269 | if [ -e "${S}/tools/lib/api/Makefile" ]; then | 341 | if [ -e "${S}/tools/lib/api/Makefile" ]; then |
270 | sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/lib/api/Makefile | 342 | sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/lib/api/Makefile |
@@ -281,6 +353,9 @@ do_configure:prepend () { | |||
281 | if [ -e "${S}/tools/build/Makefile.feature" ]; then | 353 | if [ -e "${S}/tools/build/Makefile.feature" ]; then |
282 | sed -i 's,CFLAGS=,CC="\$(CC)" CFLAGS=,' ${S}/tools/build/Makefile.feature | 354 | sed -i 's,CFLAGS=,CC="\$(CC)" CFLAGS=,' ${S}/tools/build/Makefile.feature |
283 | fi | 355 | fi |
356 | # The libperl feature check produces fatal warnings due to -Werror being | ||
357 | # used, silence enough errors that the check passes. | ||
358 | sed -i 's/\(FLAGS_PERL_EMBED=.*\)/\1 -Wno-error=unused-function -Wno-error=attributes/' ${S}/tools/build/feature/Makefile | ||
284 | 359 | ||
285 | # 3.17-rc1+ has a include issue for arm/powerpc. Temporarily sed in the appropriate include | 360 | # 3.17-rc1+ has a include issue for arm/powerpc. Temporarily sed in the appropriate include |
286 | if [ -e "${S}/tools/perf/arch/$ARCH/util/skip-callchain-idx.c" ]; then | 361 | if [ -e "${S}/tools/perf/arch/$ARCH/util/skip-callchain-idx.c" ]; then |
@@ -310,26 +385,22 @@ do_configure:prepend () { | |||
310 | done | 385 | done |
311 | } | 386 | } |
312 | 387 | ||
313 | python do_package:prepend() { | ||
314 | d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0]) | ||
315 | } | ||
316 | |||
317 | PACKAGE_ARCH = "${MACHINE_ARCH}" | 388 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
318 | 389 | ||
319 | |||
320 | PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python" | 390 | PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python" |
321 | 391 | ||
322 | RDEPENDS:${PN} += "elfutils bash" | 392 | RDEPENDS:${PN} += "elfutils bash" |
323 | RDEPENDS:${PN}-archive =+ "bash" | 393 | RDEPENDS:${PN}-archive =+ "bash" |
324 | 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)}" |
325 | RDEPENDS:${PN}-perl =+ "bash perl perl-modules" | 395 | RDEPENDS:${PN}-perl =+ "bash perl perl-modules" |
326 | RDEPENDS:${PN}-tests =+ "python3 bash" | 396 | RDEPENDS:${PN}-tests =+ "python3 bash perl" |
327 | |||
328 | RSUGGESTS_SCRIPTING = "${@bb.utils.contains('PACKAGECONFIG', 'scripting', '${PN}-perl ${PN}-python', '',d)}" | ||
329 | RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests ${RSUGGESTS_SCRIPTING}" | ||
330 | 397 | ||
398 | RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests \ | ||
399 | ${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl', '', d)} \ | ||
400 | ${@bb.utils.contains('PACKAGECONFIG', 'python', '${PN}-python', '', d)} \ | ||
401 | " | ||
331 | FILES_SOLIBSDEV = "" | 402 | FILES_SOLIBSDEV = "" |
332 | FILES:${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core ${libdir}/traceevent ${libdir}/libperf-jvmti.so" | 403 | FILES:${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core ${libdir}/traceevent* ${libdir}/libperf-jvmti.so" |
333 | FILES:${PN}-archive = "${libdir}/perf/perf-core/perf-archive" | 404 | FILES:${PN}-archive = "${libdir}/perf/perf-core/perf-archive" |
334 | FILES:${PN}-tests = "${libdir}/perf/perf-core/tests ${libexecdir}/perf-core/tests" | 405 | FILES:${PN}-tests = "${libdir}/perf/perf-core/tests ${libexecdir}/perf-core/tests" |
335 | FILES:${PN}-python = " \ | 406 | FILES:${PN}-python = " \ |
@@ -338,6 +409,16 @@ FILES:${PN}-python = " \ | |||
338 | " | 409 | " |
339 | FILES:${PN}-perl = "${libexecdir}/perf-core/scripts/perl" | 410 | FILES:${PN}-perl = "${libexecdir}/perf-core/scripts/perl" |
340 | 411 | ||
341 | |||
342 | INHIBIT_PACKAGE_DEBUG_SPLIT="1" | ||
343 | DEBUG_OPTIMIZATION:append = " -Wno-error=maybe-uninitialized" | 412 | DEBUG_OPTIMIZATION:append = " -Wno-error=maybe-uninitialized" |
413 | |||
414 | PACKAGESPLITFUNCS =+ "perf_fix_sources" | ||
415 | |||
416 | perf_fix_sources () { | ||
417 | for f in util/parse-events-flex.h util/parse-events-flex.c util/pmu-flex.c \ | ||
418 | util/pmu-flex.h util/expr-flex.h util/expr-flex.c; do | ||
419 | f=${PKGD}${TARGET_DBGSRC_DIR}/$f | ||
420 | if [ -e $f ]; then | ||
421 | sed -i -e 's#${S}/##g' $f | ||
422 | fi | ||
423 | done | ||
424 | } | ||
diff --git a/meta/recipes-kernel/perf/perf/sort-pmuevents.py b/meta/recipes-kernel/perf/perf/sort-pmuevents.py index 09ba3328a7..0a87e553ab 100755 --- a/meta/recipes-kernel/perf/perf/sort-pmuevents.py +++ b/meta/recipes-kernel/perf/perf/sort-pmuevents.py | |||
@@ -36,10 +36,10 @@ with open(infile, 'r') as file: | |||
36 | preamble_regex = re.compile( '^(.*?)^(struct|const struct|static struct|static const struct)', re.MULTILINE | re.DOTALL ) | 36 | preamble_regex = re.compile( '^(.*?)^(struct|const struct|static struct|static const struct)', re.MULTILINE | re.DOTALL ) |
37 | 37 | ||
38 | preamble = re.search( preamble_regex, data ) | 38 | preamble = re.search( preamble_regex, data ) |
39 | struct_block_regex = re.compile( '^(struct|const struct|static struct|static const struct).*?(\w+) (.*?)\[\] = {(.*?)^};', re.MULTILINE | re.DOTALL ) | 39 | struct_block_regex = re.compile(r'^(struct|const struct|static struct|static const struct).*?(\w+) (.*?)\[\] = {(.*?)^};', re.MULTILINE | re.DOTALL ) |
40 | field_regex = re.compile( '{.*?},', re.MULTILINE | re.DOTALL ) | 40 | field_regex = re.compile(r'{.*?},', re.MULTILINE | re.DOTALL ) |
41 | cpuid_regex = re.compile( '\.cpuid = (.*?),', re.MULTILINE | re.DOTALL ) | 41 | cpuid_regex = re.compile(r'\.cpuid = (.*?),', re.MULTILINE | re.DOTALL ) |
42 | name_regex = re.compile( '\.name = (.*?),', re.MULTILINE | re.DOTALL ) | 42 | name_regex = re.compile(r'\.name = (.*?),', re.MULTILINE | re.DOTALL ) |
43 | 43 | ||
44 | # create a dictionary structure to store all the structs, their | 44 | # create a dictionary structure to store all the structs, their |
45 | # types and then their fields. | 45 | # types and then their fields. |
@@ -62,7 +62,10 @@ for struct in re.findall( struct_block_regex, data ): | |||
62 | #print( " name found: %s" % name.group(1) ) | 62 | #print( " name found: %s" % name.group(1) ) |
63 | entry_dict[struct[2]]['fields'][name.group(1)] = entry | 63 | entry_dict[struct[2]]['fields'][name.group(1)] = entry |
64 | 64 | ||
65 | if not entry_dict[struct[2]]['fields']: | 65 | # unmatched entries are most likely array terminators and |
66 | # should end up as the last element in the sorted list, which | ||
67 | # is achieved by using '0' as the key | ||
68 | if not cpuid and not name: | ||
66 | entry_dict[struct[2]]['fields']['0'] = entry | 69 | entry_dict[struct[2]]['fields']['0'] = entry |
67 | 70 | ||
68 | # created ordered dictionaries from the captured values. These are ordered by | 71 | # created ordered dictionaries from the captured values. These are ordered by |