diff options
Diffstat (limited to 'meta/recipes-kernel/perf/perf.bb')
-rw-r--r-- | meta/recipes-kernel/perf/perf.bb | 203 |
1 files changed, 168 insertions, 35 deletions
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb index 868cde7353..11fa917649 100644 --- a/meta/recipes-kernel/perf/perf.bb +++ b/meta/recipes-kernel/perf/perf.bb | |||
@@ -7,31 +7,38 @@ 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" | ||
13 | 12 | ||
14 | PACKAGECONFIG ??= "scripting tui libunwind" | 13 | PACKAGECONFIG ??= "python tui libunwind libtraceevent" |
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" |
16 | PACKAGECONFIG[python] = ",NO_LIBPYTHON=1,python3 python3-setuptools-native" | ||
17 | # gui support was added with kernel 3.6.35 | 17 | # gui support was added with kernel 3.6.35 |
18 | # since 3.10 libnewt was replaced by slang | 18 | # since 3.10 libnewt was replaced by slang |
19 | # to cover a wide range of kernel we add both dependencies | 19 | # to cover a wide range of kernel we add both dependencies |
20 | PACKAGECONFIG[tui] = ",NO_NEWT=1,libnewt slang" | 20 | PACKAGECONFIG[tui] = ",NO_NEWT=1,libnewt slang" |
21 | PACKAGECONFIG[libunwind] = ",NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1,libunwind" | 21 | PACKAGECONFIG[libunwind] = ",NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1,libunwind" |
22 | PACKAGECONFIG[libnuma] = ",NO_LIBNUMA=1" | 22 | PACKAGECONFIG[libnuma] = ",NO_LIBNUMA=1" |
23 | PACKAGECONFIG[bfd] = ",NO_LIBBFD=1" | ||
23 | PACKAGECONFIG[systemtap] = ",NO_SDT=1,systemtap" | 24 | PACKAGECONFIG[systemtap] = ",NO_SDT=1,systemtap" |
24 | PACKAGECONFIG[jvmti] = ",NO_JVMTI=1" | 25 | PACKAGECONFIG[jvmti] = ",NO_JVMTI=1" |
25 | # libaudit support would need scripting to be enabled | 26 | # libaudit support would need scripting to be enabled |
26 | PACKAGECONFIG[audit] = ",NO_LIBAUDIT=1,audit" | 27 | PACKAGECONFIG[audit] = ",NO_LIBAUDIT=1,audit" |
27 | PACKAGECONFIG[manpages] = ",,xmlto-native asciidoc-native" | 28 | PACKAGECONFIG[manpages] = ",,xmlto-native asciidoc-native" |
28 | PACKAGECONFIG[cap] = ",,libcap" | 29 | PACKAGECONFIG[cap] = ",,libcap" |
30 | PACKAGECONFIG[libtraceevent] = ",NO_LIBTRACEEVENT=1,libtraceevent" | ||
31 | # jevents requires host python for generating a .c file, but is | ||
32 | # unrelated to the python item. | ||
33 | PACKAGECONFIG[jevents] = ",NO_JEVENTS=1,python3-native" | ||
29 | # Arm CoreSight | 34 | # Arm CoreSight |
30 | PACKAGECONFIG[coresight] = "CORESIGHT=1,,opencsd" | 35 | PACKAGECONFIG[coresight] = "CORESIGHT=1,,opencsd" |
36 | PACKAGECONFIG[pfm4] = ",NO_LIBPFM4=1,libpfm4" | ||
37 | PACKAGECONFIG[babeltrace] = ",NO_LIBBABELTRACE=1,babeltrace" | ||
31 | 38 | ||
32 | # libunwind is not yet ported for some architectures | 39 | # libunwind is not yet ported for some architectures |
33 | PACKAGECONFIG_remove_arc = "libunwind" | 40 | PACKAGECONFIG:remove:arc = "libunwind" |
34 | PACKAGECONFIG_remove_riscv64 = "libunwind" | 41 | PACKAGECONFIG:remove:riscv32 = "libunwind" |
35 | 42 | ||
36 | DEPENDS = " \ | 43 | DEPENDS = " \ |
37 | virtual/${MLPREFIX}libc \ | 44 | virtual/${MLPREFIX}libc \ |
@@ -47,7 +54,7 @@ PROVIDES = "virtual/perf" | |||
47 | inherit linux-kernel-base kernel-arch manpages | 54 | inherit linux-kernel-base kernel-arch manpages |
48 | 55 | ||
49 | # needed for building the tools/perf Python bindings | 56 | # needed for building the tools/perf Python bindings |
50 | inherit ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'python3native', '', d)} | 57 | inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)} |
51 | inherit python3-dir | 58 | inherit python3-dir |
52 | export PYTHON_SITEPACKAGES_DIR | 59 | export PYTHON_SITEPACKAGES_DIR |
53 | 60 | ||
@@ -57,7 +64,7 @@ export WERROR = "0" | |||
57 | do_populate_lic[depends] += "virtual/kernel:do_shared_workdir" | 64 | do_populate_lic[depends] += "virtual/kernel:do_shared_workdir" |
58 | 65 | ||
59 | # needed for building the tools/perf Perl binding | 66 | # needed for building the tools/perf Perl binding |
60 | include ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'perf-perl.inc', '', d)} | 67 | include ${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perf-perl.inc', '', d)} |
61 | 68 | ||
62 | inherit kernelsrc | 69 | inherit kernelsrc |
63 | 70 | ||
@@ -69,8 +76,18 @@ SPDX_S = "${S}/tools/perf" | |||
69 | # supported kernel. | 76 | # supported kernel. |
70 | LDFLAGS="-ldl -lutil" | 77 | LDFLAGS="-ldl -lutil" |
71 | 78 | ||
79 | # 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 | ||
81 | # any -O option, so ensure the distro's chosen optimization gets used | ||
82 | # for those. Since ${SELECTED_OPTIMIZATION} always includes | ||
83 | # ${DEBUG_FLAGS} which in turn includes ${DEBUG_PREFIX_MAP}, this also | ||
84 | # ensures perf is built with appropriate -f*-prefix-map options, | ||
85 | # avoiding the 'buildpaths' QA warning. | ||
86 | TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION}" | ||
87 | |||
72 | EXTRA_OEMAKE = '\ | 88 | EXTRA_OEMAKE = '\ |
73 | V=1 \ | 89 | V=1 \ |
90 | VF=1 \ | ||
74 | -C ${S}/tools/perf \ | 91 | -C ${S}/tools/perf \ |
75 | O=${B} \ | 92 | O=${B} \ |
76 | CROSS_COMPILE=${TARGET_PREFIX} \ | 93 | CROSS_COMPILE=${TARGET_PREFIX} \ |
@@ -80,11 +97,13 @@ EXTRA_OEMAKE = '\ | |||
80 | LDSHARED="${CC} -shared" \ | 97 | LDSHARED="${CC} -shared" \ |
81 | AR="${AR}" \ | 98 | AR="${AR}" \ |
82 | LD="${LD}" \ | 99 | LD="${LD}" \ |
83 | EXTRA_CFLAGS="-ldw" \ | 100 | EXTRA_CFLAGS="-ldw -I${S}" \ |
101 | YFLAGS='-y --file-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}' \ | ||
84 | EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \ | 102 | EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \ |
85 | perfexecdir=${libexecdir} \ | 103 | perfexecdir=${libexecdir} \ |
86 | NO_GTK2=1 \ | 104 | NO_GTK2=1 \ |
87 | ${PACKAGECONFIG_CONFARGS} \ | 105 | ${PACKAGECONFIG_CONFARGS} \ |
106 | PKG_CONFIG=pkg-config \ | ||
88 | TMPDIR="${B}" \ | 107 | TMPDIR="${B}" \ |
89 | LIBUNWIND_DIR=${STAGING_EXECPREFIXDIR} \ | 108 | LIBUNWIND_DIR=${STAGING_EXECPREFIXDIR} \ |
90 | ' | 109 | ' |
@@ -100,7 +119,7 @@ EXTRA_OEMAKE += "\ | |||
100 | 'sharedir=${@os.path.relpath(datadir, prefix)}' \ | 119 | 'sharedir=${@os.path.relpath(datadir, prefix)}' \ |
101 | 'mandir=${@os.path.relpath(mandir, prefix)}' \ | 120 | 'mandir=${@os.path.relpath(mandir, prefix)}' \ |
102 | 'infodir=${@os.path.relpath(infodir, prefix)}' \ | 121 | 'infodir=${@os.path.relpath(infodir, prefix)}' \ |
103 | ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'PYTHON=python3 PYTHON_CONFIG=python3-config', '', d)} \ | 122 | ${@bb.utils.contains('PACKAGECONFIG', 'python', 'PYTHON=python3 PYTHON_CONFIG=python3-config', '', d)} \ |
104 | " | 123 | " |
105 | 124 | ||
106 | # During do_configure, we might run a 'make clean'. That often breaks | 125 | # During do_configure, we might run a 'make clean'. That often breaks |
@@ -108,8 +127,12 @@ EXTRA_OEMAKE += "\ | |||
108 | # that it has to be done this way rather than by passing -j1, since | 127 | # that it has to be done this way rather than by passing -j1, since |
109 | # perf's build system by default ignores any -j argument, but does | 128 | # perf's build system by default ignores any -j argument, but does |
110 | # honour a JOBS variable. | 129 | # honour a JOBS variable. |
111 | EXTRA_OEMAKE_append_task-configure = " JOBS=1" | 130 | EXTRA_OEMAKE:append:task-configure = " JOBS=1" |
112 | 131 | ||
132 | # the architectures that need this file can be found in | ||
133 | # tools/include/uapi/asm/bpf_perf_event.h | ||
134 | # We are only listing supported arches at the moment | ||
135 | PERF_BPF_EVENT_SRC ?= '${@bb.utils.contains_any("ARCH", [ "riscv", "arm64" ], "arch/${ARCH}/include/uapi/asm/bpf_perf_event.h", "", d)}' | ||
113 | PERF_SRC ?= "Makefile \ | 136 | PERF_SRC ?= "Makefile \ |
114 | tools/arch \ | 137 | tools/arch \ |
115 | tools/build \ | 138 | tools/build \ |
@@ -119,18 +142,26 @@ PERF_SRC ?= "Makefile \ | |||
119 | tools/perf \ | 142 | tools/perf \ |
120 | tools/scripts \ | 143 | tools/scripts \ |
121 | scripts/ \ | 144 | scripts/ \ |
145 | arch/arm64/tools \ | ||
146 | ${PERF_BPF_EVENT_SRC} \ | ||
122 | arch/${ARCH}/Makefile \ | 147 | arch/${ARCH}/Makefile \ |
123 | " | 148 | " |
124 | 149 | ||
125 | PERF_EXTRA_LDFLAGS = "" | 150 | PERF_EXTRA_LDFLAGS = "" |
126 | 151 | ||
127 | # MIPS N32 | 152 | # MIPS N32/N64 |
128 | PERF_EXTRA_LDFLAGS_mipsarchn32eb = "-m elf32btsmipn32" | 153 | PERF_EXTRA_LDFLAGS:mipsarchn32eb = "-m elf32btsmipn32" |
129 | PERF_EXTRA_LDFLAGS_mipsarchn32el = "-m elf32ltsmipn32" | 154 | PERF_EXTRA_LDFLAGS:mipsarchn32el = "-m elf32ltsmipn32" |
155 | PERF_EXTRA_LDFLAGS:mipsarchn64eb = "-m elf64btsmip" | ||
156 | PERF_EXTRA_LDFLAGS:mipsarchn64el = "-m elf64ltsmip" | ||
130 | 157 | ||
131 | do_compile() { | 158 | do_compile() { |
132 | # Linux kernel build system is expected to do the right thing | 159 | # Linux kernel build system is expected to do the right thing |
133 | unset CFLAGS | 160 | unset CFLAGS |
161 | test -e ${S}/tools/lib/traceevent/plugins/Makefile && \ | ||
162 | sed -i -e 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g' ${S}/tools/lib/traceevent/plugins/Makefile | ||
163 | test -e ${S}/tools/perf/Makefile.config && \ | ||
164 | sed -i -e 's|\$(libdir)/traceevent/plugins|\$(libdir)/traceevent_${KERNEL_VERSION}/plugins|g' ${S}/tools/perf/Makefile.config | ||
134 | oe_runmake all | 165 | oe_runmake all |
135 | } | 166 | } |
136 | 167 | ||
@@ -139,8 +170,11 @@ do_install() { | |||
139 | unset CFLAGS | 170 | unset CFLAGS |
140 | oe_runmake install | 171 | oe_runmake install |
141 | # we are checking for this make target to be compatible with older perf versions | 172 | # we are checking for this make target to be compatible with older perf versions |
142 | if ${@bb.utils.contains('PACKAGECONFIG', 'scripting', 'true', 'false', d)} && grep -q install-python_ext ${S}/tools/perf/Makefile*; then | 173 | if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)} && grep -q install-python_ext ${S}/tools/perf/Makefile*; then |
143 | oe_runmake DESTDIR=${D} install-python_ext | 174 | oe_runmake DESTDIR=${D} install-python_ext |
175 | if [ -e ${D}${libdir}/python*/site-packages/perf-*/SOURCES.txt ]; then | ||
176 | sed -i -e 's#${WORKDIR}##g' ${D}${libdir}/python*/site-packages/perf-*/SOURCES.txt | ||
177 | fi | ||
144 | fi | 178 | fi |
145 | } | 179 | } |
146 | 180 | ||
@@ -155,7 +189,8 @@ python copy_perf_source_from_kernel() { | |||
155 | src = oe.path.join(src_dir, s) | 189 | src = oe.path.join(src_dir, s) |
156 | dest = oe.path.join(dest_dir, s) | 190 | dest = oe.path.join(dest_dir, s) |
157 | if not os.path.exists(src): | 191 | if not os.path.exists(src): |
158 | bb.fatal("Path does not exist: %s. Maybe PERF_SRC does not match the kernel version." % src) | 192 | bb.warn("Path does not exist: %s. Maybe PERF_SRC lists more files than what your kernel version provides and needs." % src) |
193 | continue | ||
159 | if os.path.isdir(src): | 194 | if os.path.isdir(src): |
160 | oe.path.copyhardlinktree(src, dest) | 195 | oe.path.copyhardlinktree(src, dest) |
161 | else: | 196 | else: |
@@ -164,7 +199,7 @@ python copy_perf_source_from_kernel() { | |||
164 | bb.utils.copyfile(src, dest) | 199 | bb.utils.copyfile(src, dest) |
165 | } | 200 | } |
166 | 201 | ||
167 | do_configure_prepend () { | 202 | do_configure:prepend () { |
168 | # If building a multlib based perf, the incorrect library path will be | 203 | # If building a multlib based perf, the incorrect library path will be |
169 | # detected by perf, since it triggers via: ifeq ($(ARCH),x86_64). In a 32 bit | 204 | # detected by perf, since it triggers via: ifeq ($(ARCH),x86_64). In a 32 bit |
170 | # build, with a 64 bit multilib, the arch won't match and the detection of a | 205 | # build, with a 64 bit multilib, the arch won't match and the detection of a |
@@ -200,25 +235,101 @@ do_configure_prepend () { | |||
200 | if [ -e "${S}/tools/perf/Makefile.perf" ]; then | 235 | if [ -e "${S}/tools/perf/Makefile.perf" ]; then |
201 | sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \ | 236 | sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \ |
202 | ${S}/tools/perf/Makefile.perf | 237 | ${S}/tools/perf/Makefile.perf |
203 | sed -i -e "s,prefix='\$(DESTDIR_SQ)/usr'$,prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(DESTDIR)\$(PYTHON_SITEPACKAGES_DIR)',g" \ | 238 | # Variant with linux-yocto-specific patch |
239 | sed -i -e "s,prefix='\$(DESTDIR_SQ)/usr'$,prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(PYTHON_SITEPACKAGES_DIR)' --root='\$(DESTDIR)',g" \ | ||
240 | ${S}/tools/perf/Makefile.perf | ||
241 | # Variant for mainline Linux | ||
242 | sed -i -e "s,root='/\$(DESTDIR_SQ)',prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(PYTHON_SITEPACKAGES_DIR)' --root='/\$(DESTDIR_SQ)',g" \ | ||
204 | ${S}/tools/perf/Makefile.perf | 243 | ${S}/tools/perf/Makefile.perf |
205 | # backport https://github.com/torvalds/linux/commit/e4ffd066ff440a57097e9140fa9e16ceef905de8 | 244 | # backport https://github.com/torvalds/linux/commit/e4ffd066ff440a57097e9140fa9e16ceef905de8 |
206 | sed -i -e 's,\($(Q)$(SHELL) .$(arch_errno_tbl).\) $(CC) $(arch_errno_hdr_dir),\1 $(firstword $(CC)) $(arch_errno_hdr_dir),g' \ | 245 | sed -i -e 's,\($(Q)$(SHELL) .$(arch_errno_tbl).\) $(CC) $(arch_errno_hdr_dir),\1 $(firstword $(CC)) $(arch_errno_hdr_dir),g' \ |
207 | ${S}/tools/perf/Makefile.perf | 246 | ${S}/tools/perf/Makefile.perf |
208 | fi | 247 | fi |
209 | sed -i -e "s,--root='/\$(DESTDIR_SQ)',--prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(DESTDIR)\$(PYTHON_SITEPACKAGES_DIR)',g" \ | 248 | sed -i -e "s,--root='/\$(DESTDIR_SQ)',--prefix='\$(DESTDIR_SQ)/usr' --install-lib='\$(DESTDIR)\$(PYTHON_SITEPACKAGES_DIR)',g" \ |
210 | ${S}/tools/perf/Makefile* | 249 | ${S}/tools/perf/Makefile |
211 | 250 | ||
212 | if [ -e "${S}/tools/build/Makefile.build" ]; then | 251 | if [ -e "${S}/tools/build/Makefile.build" ]; then |
213 | sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \ | 252 | sed -i -e 's,\ .config-detected, $(OUTPUT)/config-detected,g' \ |
214 | ${S}/tools/build/Makefile.build | 253 | ${S}/tools/build/Makefile.build |
215 | fi | 254 | fi |
216 | 255 | ||
256 | # start reproducibility substitutions | ||
257 | if [ -e "${S}/tools/perf/Makefile.config" ]; then | ||
258 | # The following line in the Makefle: | ||
259 | # override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON_AUTO)) | ||
260 | # "PYTHON" / "PYTHON_AUTO" have the full path as part of the variable. We've | ||
261 | # ensure that the environment is setup and we do not need the full path to be | ||
262 | # captured, since the symbol gets built into the executable, making it not | ||
263 | # reproducible. | ||
264 | sed -i -e 's,$(call get-executable-or-default\,PYTHON\,$(PYTHON_AUTO)),$(notdir $(call get-executable-or-default\,PYTHON\,$(PYTHON_AUTO))),g' \ | ||
265 | ${S}/tools/perf/Makefile.config | ||
266 | # The same line is in older releases, but looking explicitly for Python 2 | ||
267 | sed -i -e 's,$(call get-executable-or-default\,PYTHON\,$(PYTHON2)),$(notdir $(call get-executable-or-default\,PYTHON\,$(PYTHON2))),g' \ | ||
268 | ${S}/tools/perf/Makefile.config | ||
269 | |||
270 | # likewise with this substitution. Kernels with commit 18f2967418d031a39 | ||
271 | # [perf tools: Use Python devtools for version autodetection rather than runtime] | ||
272 | # need this substitution for reproducibility. | ||
273 | 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' \ | ||
274 | ${S}/tools/perf/Makefile.config | ||
275 | |||
276 | # The following line: | ||
277 | # srcdir_SQ = $(patsubst %tools/perf,tools/perf,$(subst ','\'',$(srcdir))), | ||
278 | # Captures the full src path of perf, which of course makes it not | ||
279 | # reproducible. We really only need the relative location 'tools/perf', so we | ||
280 | # change the Makefile line to remove everything before 'tools/perf' | ||
281 | sed -i -e "s%srcdir_SQ = \$(subst ','\\\'',\$(srcdir))%srcdir_SQ = \$(patsubst \%tools/perf,tools/perf,\$(subst ','\\\'',\$(srcdir)))%g" \ | ||
282 | ${S}/tools/perf/Makefile.config | ||
283 | # Avoid hardcoded path to python-native | ||
284 | sed -i -e 's#\(PYTHON_WORD := \)$(call shell-wordify,$(PYTHON))#\1 python3#g' \ | ||
285 | ${S}/tools/perf/Makefile.config | ||
286 | fi | ||
287 | if [ -e "${S}/tools/perf/tests/Build" ]; then | ||
288 | # OUTPUT is the full path, we have python on the path so we remove it from the | ||
289 | # definition. This is captured in the perf binary, so breaks reproducibility | ||
290 | sed -i -e 's,PYTHONPATH="BUILD_STR($(OUTPUT)python)",PYTHONPATH="BUILD_STR(python)",g' \ | ||
291 | ${S}/tools/perf/tests/Build | ||
292 | fi | ||
293 | if [ -e "${S}/tools/perf/util/Build" ]; then | ||
294 | # To avoid bison generating #ifdefs that have captured paths, we make sure | ||
295 | # all the calls have YFLAGS, which contains prefix mapping information. | ||
296 | sed -i -e 's,$(BISON),$(BISON) $(YFLAGS),g' ${S}/tools/perf/util/Build | ||
297 | fi | ||
298 | if [ -e "${S}/scripts/Makefile.host" ]; then | ||
299 | # To avoid yacc (bison) generating #ifdefs that have captured paths, we make sure | ||
300 | # all the calls have YFLAGS, which contains prefix mapping information. | ||
301 | sed -i -e 's,$(YACC),$(YACC) $(YFLAGS),g' ${S}/scripts/Makefile.host | ||
302 | fi | ||
303 | if [ -e "${S}/tools/perf/pmu-events/Build" ]; then | ||
304 | target='$(OUTPUT)pmu-events/pmu-events.c $(V)' | ||
305 | replacement1='$(OUTPUT)pmu-events/pmu-events.c $(V)\n' | ||
306 | replacement2='\t$(srctree)/sort-pmuevents.py $(OUTPUT)pmu-events/pmu-events.c $(OUTPUT)pmu-events/pmu-events.c.new\n' | ||
307 | replacement3='\tcp $(OUTPUT)pmu-events/pmu-events.c.new $(OUTPUT)pmu-events/pmu-events.c' | ||
308 | sed -i -e "s,$target,$replacement1$replacement2$replacement3,g" \ | ||
309 | "${S}/tools/perf/pmu-events/Build" | ||
310 | fi | ||
311 | if [ -e "${S}/tools/perf/pmu-events/jevents.py" ]; then | ||
312 | sed -i -e "s#os.scandir(path)#sorted(os.scandir(path), key=lambda e: e.name)#g" \ | ||
313 | "${S}/tools/perf/pmu-events/jevents.py" | ||
314 | fi | ||
315 | if [ -e "${S}/tools/perf/arch/arm64/Makefile" ]; then | ||
316 | sed -i 's,sysdef := $(srctree)/,sysdef := ,' ${S}/tools/perf/arch/arm64/Makefile | ||
317 | sed -i 's,$(incpath) $(sysdef),$(incpath) $(srctree)/$(sysdef) $(sysdef),' ${S}/tools/perf/arch/arm64/Makefile | ||
318 | fi | ||
319 | if [ -e "${S}/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl" ]; then | ||
320 | if ! grep -q input_rel ${S}/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl; then | ||
321 | sed -i 's,input=$4,input=$4\ninput_rel=$5,' ${S}/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | ||
322 | fi | ||
323 | sed -i 's,#include \\"\$input\\",#include \\"\$input_rel\\",' ${S}/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | ||
324 | fi | ||
325 | # end reproducibility substitutions | ||
326 | |||
217 | # We need to ensure the --sysroot option in CC is preserved | 327 | # We need to ensure the --sysroot option in CC is preserved |
218 | if [ -e "${S}/tools/perf/Makefile.perf" ]; then | 328 | if [ -e "${S}/tools/perf/Makefile.perf" ]; then |
219 | sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/perf/Makefile.perf | 329 | sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/perf/Makefile.perf |
220 | sed -i 's,AR = $(CROSS_COMPILE)ar,#AR,' ${S}/tools/perf/Makefile.perf | 330 | sed -i 's,AR = $(CROSS_COMPILE)ar,#AR,' ${S}/tools/perf/Makefile.perf |
221 | sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' ${S}/tools/perf/Makefile.perf | 331 | sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' ${S}/tools/perf/Makefile.perf |
332 | sed -i 's,PKG_CONFIG = $(CROSS_COMPILE)pkg-config,#PKG_CONFIG,' ${S}/tools/perf/Makefile.perf | ||
222 | fi | 333 | fi |
223 | if [ -e "${S}/tools/lib/api/Makefile" ]; then | 334 | if [ -e "${S}/tools/lib/api/Makefile" ]; then |
224 | sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/lib/api/Makefile | 335 | sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/lib/api/Makefile |
@@ -235,6 +346,9 @@ do_configure_prepend () { | |||
235 | if [ -e "${S}/tools/build/Makefile.feature" ]; then | 346 | if [ -e "${S}/tools/build/Makefile.feature" ]; then |
236 | sed -i 's,CFLAGS=,CC="\$(CC)" CFLAGS=,' ${S}/tools/build/Makefile.feature | 347 | sed -i 's,CFLAGS=,CC="\$(CC)" CFLAGS=,' ${S}/tools/build/Makefile.feature |
237 | fi | 348 | fi |
349 | # The libperl feature check produces fatal warnings due to -Werror being | ||
350 | # used, silence enough errors that the check passes. | ||
351 | sed -i 's/\(FLAGS_PERL_EMBED=.*\)/\1 -Wno-error=unused-function -Wno-error=attributes/' ${S}/tools/build/feature/Makefile | ||
238 | 352 | ||
239 | # 3.17-rc1+ has a include issue for arm/powerpc. Temporarily sed in the appropriate include | 353 | # 3.17-rc1+ has a include issue for arm/powerpc. Temporarily sed in the appropriate include |
240 | if [ -e "${S}/tools/perf/arch/$ARCH/util/skip-callchain-idx.c" ]; then | 354 | if [ -e "${S}/tools/perf/arch/$ARCH/util/skip-callchain-idx.c" ]; then |
@@ -254,9 +368,17 @@ do_configure_prepend () { | |||
254 | # so we copy it from the sysroot unistd.h to the perf unistd.h | 368 | # so we copy it from the sysroot unistd.h to the perf unistd.h |
255 | install -D -m0644 ${STAGING_INCDIR}/asm-generic/unistd.h ${S}/tools/include/uapi/asm-generic/unistd.h | 369 | install -D -m0644 ${STAGING_INCDIR}/asm-generic/unistd.h ${S}/tools/include/uapi/asm-generic/unistd.h |
256 | install -D -m0644 ${STAGING_INCDIR}/asm-generic/unistd.h ${S}/include/uapi/asm-generic/unistd.h | 370 | install -D -m0644 ${STAGING_INCDIR}/asm-generic/unistd.h ${S}/include/uapi/asm-generic/unistd.h |
371 | |||
372 | # the fetcher is inhibited by the 'inherit kernelsrc', so we do a quick check and | ||
373 | # copy for a helper script we need | ||
374 | for p in $(echo ${FILESPATH} | tr ':' '\n'); do | ||
375 | if [ -e $p/sort-pmuevents.py ]; then | ||
376 | cp $p/sort-pmuevents.py ${S} | ||
377 | fi | ||
378 | done | ||
257 | } | 379 | } |
258 | 380 | ||
259 | python do_package_prepend() { | 381 | python do_package:prepend() { |
260 | d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0]) | 382 | d.setVar('PKGV', d.getVar("KERNEL_VERSION").split("-")[0]) |
261 | } | 383 | } |
262 | 384 | ||
@@ -265,25 +387,36 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" | |||
265 | 387 | ||
266 | PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python" | 388 | PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python" |
267 | 389 | ||
268 | RDEPENDS_${PN} += "elfutils bash" | 390 | RDEPENDS:${PN} += "elfutils bash" |
269 | RDEPENDS_${PN}-archive =+ "bash" | 391 | RDEPENDS:${PN}-archive =+ "bash" |
270 | RDEPENDS_${PN}-python =+ "bash python3 python3-modules ${@bb.utils.contains('PACKAGECONFIG', 'audit', 'audit-python3', '', d)}" | 392 | RDEPENDS:${PN}-python =+ "bash python3 python3-modules ${@bb.utils.contains('PACKAGECONFIG', 'audit', 'audit-python', '', d)}" |
271 | RDEPENDS_${PN}-perl =+ "bash perl perl-modules" | 393 | RDEPENDS:${PN}-perl =+ "bash perl perl-modules" |
272 | RDEPENDS_${PN}-tests =+ "python3" | 394 | RDEPENDS:${PN}-tests =+ "python3 bash perl" |
273 | |||
274 | RSUGGESTS_SCRIPTING = "${@bb.utils.contains('PACKAGECONFIG', 'scripting', '${PN}-perl ${PN}-python', '',d)}" | ||
275 | RSUGGESTS_${PN} += "${PN}-archive ${PN}-tests ${RSUGGESTS_SCRIPTING}" | ||
276 | 395 | ||
396 | RSUGGESTS:${PN} += "${PN}-archive ${PN}-tests \ | ||
397 | ${@bb.utils.contains('PACKAGECONFIG', 'perl', '${PN}-perl', '', d)} \ | ||
398 | ${@bb.utils.contains('PACKAGECONFIG', 'python', '${PN}-python', '', d)} \ | ||
399 | " | ||
277 | FILES_SOLIBSDEV = "" | 400 | FILES_SOLIBSDEV = "" |
278 | FILES_${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core ${libdir}/traceevent ${libdir}/libperf-jvmti.so" | 401 | FILES:${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core ${libdir}/traceevent* ${libdir}/libperf-jvmti.so" |
279 | FILES_${PN}-archive = "${libdir}/perf/perf-core/perf-archive" | 402 | FILES:${PN}-archive = "${libdir}/perf/perf-core/perf-archive" |
280 | FILES_${PN}-tests = "${libdir}/perf/perf-core/tests ${libexecdir}/perf-core/tests" | 403 | FILES:${PN}-tests = "${libdir}/perf/perf-core/tests ${libexecdir}/perf-core/tests" |
281 | FILES_${PN}-python = " \ | 404 | FILES:${PN}-python = " \ |
282 | ${PYTHON_SITEPACKAGES_DIR} \ | 405 | ${PYTHON_SITEPACKAGES_DIR} \ |
283 | ${libexecdir}/perf-core/scripts/python \ | 406 | ${libexecdir}/perf-core/scripts/python \ |
284 | " | 407 | " |
285 | FILES_${PN}-perl = "${libexecdir}/perf-core/scripts/perl" | 408 | FILES:${PN}-perl = "${libexecdir}/perf-core/scripts/perl" |
286 | 409 | ||
410 | DEBUG_OPTIMIZATION:append = " -Wno-error=maybe-uninitialized" | ||
287 | 411 | ||
288 | INHIBIT_PACKAGE_DEBUG_SPLIT="1" | 412 | PACKAGESPLITFUNCS =+ "perf_fix_sources" |
289 | DEBUG_OPTIMIZATION_append = " -Wno-error=maybe-uninitialized" | 413 | |
414 | perf_fix_sources () { | ||
415 | for f in util/parse-events-flex.h util/parse-events-flex.c util/pmu-flex.c \ | ||
416 | util/pmu-flex.h util/expr-flex.h util/expr-flex.c; do | ||
417 | f=${PKGD}${TARGET_DBGSRC_DIR}/$f | ||
418 | if [ -e $f ]; then | ||
419 | sed -i -e 's#${S}/##g' $f | ||
420 | fi | ||
421 | done | ||
422 | } | ||