diff options
author | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
commit | 972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch) | |
tree | 97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/recipes-kernel/perf | |
download | poky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz |
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-kernel/perf')
-rw-r--r-- | meta/recipes-kernel/perf/perf-features.inc | 22 | ||||
-rw-r--r-- | meta/recipes-kernel/perf/perf.bb | 189 |
2 files changed, 211 insertions, 0 deletions
diff --git a/meta/recipes-kernel/perf/perf-features.inc b/meta/recipes-kernel/perf/perf-features.inc new file mode 100644 index 0000000000..b8859ab7d5 --- /dev/null +++ b/meta/recipes-kernel/perf/perf-features.inc | |||
@@ -0,0 +1,22 @@ | |||
1 | PERF_FEATURES_ENABLE ?= "perf-scripting perf-tui" | ||
2 | |||
3 | def perf_feature_enabled(feature, trueval, falseval, d): | ||
4 | """ | ||
5 | Check which perf features are enabled. | ||
6 | |||
7 | The PERF_FEATURES_ENABLE variable lists the perf features to | ||
8 | enable. Override it if you want something different from what's | ||
9 | listed above, which is the default. If empty, the build won't | ||
10 | enable any features (which may be exactly what you want, just a | ||
11 | barebones perf without any extra baggage, what you get if you | ||
12 | specify an empty feature list). | ||
13 | |||
14 | Available perf features: | ||
15 | perf-scripting: enable support for Perl and Python bindings | ||
16 | perf-tui: enable support for the perf TUI (via libnewt) | ||
17 | |||
18 | """ | ||
19 | enabled_features = d.getVar("PERF_FEATURES_ENABLE", True) or "" | ||
20 | if feature in enabled_features: | ||
21 | return trueval | ||
22 | return falseval | ||
diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb new file mode 100644 index 0000000000..19772d87c9 --- /dev/null +++ b/meta/recipes-kernel/perf/perf.bb | |||
@@ -0,0 +1,189 @@ | |||
1 | SUMMARY = "Performance analysis tools for Linux" | ||
2 | DESCRIPTION = "Performance counters for Linux are a new kernel-based \ | ||
3 | subsystem that provide a framework for all things \ | ||
4 | performance analysis. It covers hardware level \ | ||
5 | (CPU/PMU, Performance Monitoring Unit) features \ | ||
6 | and software features (software counters, tracepoints) \ | ||
7 | as well." | ||
8 | |||
9 | LICENSE = "GPLv2" | ||
10 | LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" | ||
11 | |||
12 | PR = "r9" | ||
13 | |||
14 | require perf-features.inc | ||
15 | |||
16 | BUILDPERF_libc-uclibc = "no" | ||
17 | |||
18 | # gui support was added with kernel 3.6.35 | ||
19 | # since 3.10 libnewt was replaced by slang | ||
20 | # to cover a wide range of kernel we add both dependencies | ||
21 | TUI_DEPENDS = "${@perf_feature_enabled('perf-tui', 'libnewt slang', '',d)}" | ||
22 | SCRIPTING_DEPENDS = "${@perf_feature_enabled('perf-scripting', 'perl python', '',d)}" | ||
23 | LIBUNWIND_DEPENDS = "${@perf_feature_enabled('perf-libunwind', 'libunwind', '',d)}" | ||
24 | |||
25 | DEPENDS = "virtual/kernel \ | ||
26 | virtual/${MLPREFIX}libc \ | ||
27 | ${MLPREFIX}elfutils \ | ||
28 | ${MLPREFIX}binutils \ | ||
29 | ${TUI_DEPENDS} \ | ||
30 | ${SCRIPTING_DEPENDS} \ | ||
31 | ${LIBUNWIND_DEPENDS} \ | ||
32 | bison flex \ | ||
33 | " | ||
34 | |||
35 | PROVIDES = "virtual/perf" | ||
36 | |||
37 | inherit linux-kernel-base kernel-arch pythonnative | ||
38 | |||
39 | # needed for building the tools/perf Python bindings | ||
40 | inherit python-dir | ||
41 | export STAGING_INCDIR | ||
42 | export STAGING_LIBDIR | ||
43 | export BUILD_SYS | ||
44 | export HOST_SYS | ||
45 | |||
46 | #kernel 3.1+ supports WERROR to disable warnings as errors | ||
47 | export WERROR = "0" | ||
48 | |||
49 | do_populate_lic[depends] += "virtual/kernel:do_populate_sysroot" | ||
50 | |||
51 | # needed for building the tools/perf Perl binding | ||
52 | inherit perlnative cpan-base | ||
53 | # Env var which tells perl if it should use host (no) or target (yes) settings | ||
54 | export PERLCONFIGTARGET = "${@is_target(d)}" | ||
55 | export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}/CORE" | ||
56 | export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}" | ||
57 | export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${@get_perl_version(d)}" | ||
58 | |||
59 | S = "${STAGING_KERNEL_DIR}" | ||
60 | # The source should be ready after the do_unpack | ||
61 | do_unpack[depends] += "virtual/kernel:do_populate_sysroot" | ||
62 | |||
63 | B = "${WORKDIR}/${BPN}-${PV}" | ||
64 | |||
65 | SCRIPTING_DEFINES = "${@perf_feature_enabled('perf-scripting', '', 'NO_LIBPERL=1 NO_LIBPYTHON=1',d)}" | ||
66 | TUI_DEFINES = "${@perf_feature_enabled('perf-tui', '', 'NO_NEWT=1',d)}" | ||
67 | LIBUNWIND_DEFINES = "${@perf_feature_enabled('perf-libunwind', '', 'NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1',d)}" | ||
68 | |||
69 | # The LDFLAGS is required or some old kernels fails due missing | ||
70 | # symbols and this is preferred than requiring patches to every old | ||
71 | # supported kernel. | ||
72 | LDFLAGS="-ldl -lutil" | ||
73 | |||
74 | EXTRA_OEMAKE = '\ | ||
75 | -C ${S}/tools/perf \ | ||
76 | O=${B} \ | ||
77 | CROSS_COMPILE=${TARGET_PREFIX} \ | ||
78 | ARCH=${ARCH} \ | ||
79 | CC="${CC}" \ | ||
80 | AR="${AR}" \ | ||
81 | EXTRA_CFLAGS="-ldw" \ | ||
82 | perfexecdir=${libexecdir} \ | ||
83 | NO_GTK2=1 ${TUI_DEFINES} NO_DWARF=1 ${LIBUNWIND_DEFINES} ${SCRIPTING_DEFINES} \ | ||
84 | ' | ||
85 | |||
86 | EXTRA_OEMAKE += "\ | ||
87 | 'prefix=${prefix}' \ | ||
88 | 'bindir=${bindir}' \ | ||
89 | 'sharedir=${datadir}' \ | ||
90 | 'sysconfdir=${sysconfdir}' \ | ||
91 | 'perfexecdir=${libexecdir}/perf-core' \ | ||
92 | \ | ||
93 | 'ETC_PERFCONFIG=${@os.path.relpath(sysconfdir, prefix)}' \ | ||
94 | 'sharedir=${@os.path.relpath(datadir, prefix)}' \ | ||
95 | 'mandir=${@os.path.relpath(mandir, prefix)}' \ | ||
96 | 'infodir=${@os.path.relpath(infodir, prefix)}' \ | ||
97 | " | ||
98 | |||
99 | PARALLEL_MAKE = "" | ||
100 | |||
101 | do_compile() { | ||
102 | # Linux kernel build system is expected to do the right thing | ||
103 | unset CFLAGS | ||
104 | oe_runmake all | ||
105 | } | ||
106 | |||
107 | do_install() { | ||
108 | # Linux kernel build system is expected to do the right thing | ||
109 | unset CFLAGS | ||
110 | oe_runmake DESTDIR=${D} install | ||
111 | # we are checking for this make target to be compatible with older perf versions | ||
112 | if [ "${@perf_feature_enabled('perf-scripting', 1, 0, d)}" = "1" -a $(grep install-python_ext ${S}/tools/perf/Makefile) = "0" ]; then | ||
113 | oe_runmake DESTDIR=${D} install-python_ext | ||
114 | fi | ||
115 | } | ||
116 | |||
117 | do_configure_prepend () { | ||
118 | # Fix for rebuilding | ||
119 | rm -rf ${B}/ | ||
120 | mkdir ${B}/ | ||
121 | |||
122 | #kernels before 3.1 do not support WERROR env variable | ||
123 | sed -i 's,-Werror ,,' ${S}/tools/perf/Makefile | ||
124 | if [ -e "${S}/tools/perf/config/Makefile" ]; then | ||
125 | sed -i 's,-Werror ,,' ${S}/tools/perf/config/Makefile | ||
126 | fi | ||
127 | |||
128 | # If building a multlib based perf, the incorrect library path will be | ||
129 | # detected by perf, since it triggers via: ifeq ($(ARCH),x86_64). In a 32 bit | ||
130 | # build, with a 64 bit multilib, the arch won't match and the detection of a | ||
131 | # 64 bit build (and library) are not exected. To ensure that libraries are | ||
132 | # installed to the correct location, we can use the weak assignment in the | ||
133 | # config/Makefile. | ||
134 | if [ -e "${S}/tools/perf/config/Makefile" ]; then | ||
135 | # Match $(prefix)/$(lib) and $(prefix)/lib | ||
136 | sed -i -e 's,^libdir = \($(prefix)/.*lib\),libdir ?= \1,' \ | ||
137 | -e 's,^perfexecdir = \(.*\),perfexecdir ?= \1,' \ | ||
138 | ${S}/tools/perf/config/Makefile | ||
139 | fi | ||
140 | # We need to ensure the --sysroot option in CC is preserved | ||
141 | if [ -e "${S}/tools/perf/Makefile.perf" ]; then | ||
142 | sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/perf/Makefile.perf | ||
143 | sed -i 's,AR = $(CROSS_COMPILE)ar,#AR,' ${S}/tools/perf/Makefile.perf | ||
144 | fi | ||
145 | if [ -e "${S}/tools/lib/api/Makefile" ]; then | ||
146 | sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/lib/api/Makefile | ||
147 | sed -i 's,AR = $(CROSS_COMPILE)ar,#AR,' ${S}/tools/lib/api/Makefile | ||
148 | fi | ||
149 | if [ -e "${S}/tools/perf/config/feature-checks/Makefile" ]; then | ||
150 | sed -i 's,CC := $(CROSS_COMPILE)gcc -MD,CC += -MD,' ${S}/tools/perf/config/feature-checks/Makefile | ||
151 | fi | ||
152 | |||
153 | # 3.17-rc1+ has a include issue for arm/powerpc. Temporarily sed in the appropriate include | ||
154 | if [ -e "${S}/tools/perf/arch/$ARCH/util/skip-callchain-idx.c" ]; then | ||
155 | sed -i 's,#include "util/callchain.h",#include "util/callchain.h"\n#include "util/debug.h",' ${S}/tools/perf/arch/$ARCH/util/skip-callchain-idx.c | ||
156 | fi | ||
157 | if [ -e "${S}/tools/perf/arch/arm/util/unwind-libunwind.c" ] && [ -e "${S}/tools/perf/arch/arm/tests/dwarf-unwind.c" ]; then | ||
158 | sed -i 's,#include "tests/tests.h",#include "tests/tests.h"\n#include "util/debug.h",' ${S}/tools/perf/arch/arm/tests/dwarf-unwind.c | ||
159 | sed -i 's,#include "perf_regs.h",#include "perf_regs.h"\n#include "util/debug.h",' ${S}/tools/perf/arch/arm/util/unwind-libunwind.c | ||
160 | fi | ||
161 | } | ||
162 | |||
163 | python do_package_prepend() { | ||
164 | bb.data.setVar('PKGV', get_kernelversion('${S}').split("-")[0], d) | ||
165 | } | ||
166 | |||
167 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
168 | |||
169 | |||
170 | PACKAGES =+ "${PN}-archive ${PN}-tests ${PN}-perl ${PN}-python" | ||
171 | |||
172 | RDEPENDS_${PN} += "elfutils" | ||
173 | RDEPENDS_${PN}-archive =+ "bash" | ||
174 | RDEPENDS_${PN}-python =+ "bash python" | ||
175 | RDEPENDS_${PN}-perl =+ "bash perl perl-modules" | ||
176 | RDEPENDS_${PN}-tests =+ "python" | ||
177 | |||
178 | RSUGGESTS_SCRIPTING = "${@perf_feature_enabled('perf-scripting', '${PN}-perl ${PN}-python', '',d)}" | ||
179 | RSUGGESTS_${PN} += "${PN}-archive ${PN}-tests ${RSUGGESTS_SCRIPTING}" | ||
180 | |||
181 | FILES_${PN} += "${libexecdir}/perf-core ${exec_prefix}/libexec/perf-core ${libdir}/traceevent" | ||
182 | FILES_${PN}-dbg += "${libdir}/python*/site-packages/.debug" | ||
183 | FILES_${PN}-archive = "${libdir}/perf/perf-core/perf-archive" | ||
184 | FILES_${PN}-tests = "${libdir}/perf/perf-core/tests" | ||
185 | FILES_${PN}-python = "${libdir}/python*/site-packages ${libdir}/perf/perf-core/scripts/python" | ||
186 | FILES_${PN}-perl = "${libdir}/perf/perf-core/scripts/perl" | ||
187 | |||
188 | |||
189 | INHIBIT_PACKAGE_DEBUG_SPLIT="1" | ||