From 5657903ce7dffba7b537bcbd881c88cf5799aecd Mon Sep 17 00:00:00 2001 From: Erik Yuan Date: Sun, 24 Jan 2021 01:07:51 +0800 Subject: [PATCH] perf: pack the libperf-jvmti plug-in to perf RPM libperf-jvmti.so hasn't been built as part of perf RPM in the previous openEuler releases. This patch will enable the building and packing of jvmti shared library by default. It should faciliate the JDK user to profile Java application after installing the perf. Signed-off-by: Zhichang Yuan --- kernel.spec | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/kernel.spec b/kernel.spec index b8c9d60..a5d94b8 100644 --- a/kernel.spec +++ b/kernel.spec @@ -12,7 +12,7 @@ %global upstream_sublevel 0 %global devel_release 1 %global maintenance_release .0.0 -%global pkg_release .9 +%global pkg_release .10 %define with_debuginfo 1 # Do not recompute the build-id of vmlinux in find-debuginfo.sh @@ -29,6 +29,9 @@ # failed if there is new config options %define listnewconfig_fail 0 +#defualt is enabled. You can disable it with --without option +%define with_perf %{?_without_perf: 0} %{?!_without_perf: 1} + Name: kernel Version: %{upstream_version}.%{upstream_sublevel} Release: %{devel_release}%{?maintenance_release}%{?pkg_release}%{?extra_release} @@ -101,6 +104,12 @@ Requires: dracut >= 001-7 grubby >= 8.28-2 initscripts >= 8.11.1-1 linux-firmwar ExclusiveArch: noarch aarch64 i686 x86_64 ExclusiveOS: Linux +%if %{with_perf} +BuildRequires: flex xz-devel libzstd-devel +BuildRequires: java-devel +%endif + + %description The Linux Kernel, the operating system core itself. @@ -150,6 +159,7 @@ Obsoletes: kernel-tools-libs-devel This package contains the development files for the tools/ directory from the kernel source. +%if %{with_perf} %package -n perf Summary: Performance monitoring for the Linux kernel %description -n perf @@ -172,6 +182,8 @@ Summary: Python bindings for apps which will manipulate perf events %description -n python3-perf A Python module that permits applications written in the Python programming language to use the interface to manipulate perf events. +# with_perf +%endif %package -n bpftool Summary: Inspection and simple manipulation of eBPF programs and maps @@ -211,6 +223,7 @@ package or when debugging this package.\ %files -n kernel-tools-debuginfo -f kernel-tools-debugfiles.list %{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%{_bindir}/centrino-decode.*(\.debug)?|.*%{_bindir}/powernow-k8-decode.*(\.debug)?|.*%{_bindir}/cpupower.*(\.debug)?|.*%{_libdir}/libcpupower.*|.*%{_libdir}/libcpupower.*|.*%{_bindir}/turbostat.(\.debug)?|.*%{_bindir}/.*gpio.*(\.debug)?|.*%{_bindir}/.*iio.*(\.debug)?|.*%{_bindir}/tmon.*(.debug)?|XXX' -o kernel-tools-debugfiles.list} +%if %{with_perf} %debuginfo_template -n perf %files -n perf-debuginfo -f perf-debugfiles.list %{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%{_bindir}/perf.*(\.debug)?|.*%{_libexecdir}/perf-core/.*|.*%{_libdir}/traceevent/.*|XXX' -o perf-debugfiles.list} @@ -224,6 +237,8 @@ package or when debugging this package.\ %debuginfo_template -n python3-perf %files -n python3-perf-debuginfo -f python3-perf-debugfiles.list %{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%{python3_sitearch}/perf.*(.debug)?|XXX' -o python3-perf-debugfiles.list} +#with_perf +%endif %endif @@ -342,6 +357,7 @@ make ARCH=%{Arch} modules %{?_smp_mflags} %endif ## make tools +%if %{with_perf} # perf %global perf_make \ make EXTRA_CFLAGS="-Wl,-z,now -g -Wall -fstack-protector-strong -fPIC" EXTRA_PERFLIBS="-fpie -pie" %{?_smp_mflags} -s V=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_LIBNUMA=1 NO_STRLCPY=1 prefix=%{_prefix} @@ -365,6 +381,7 @@ chmod +x tools/python3-perf/check-headers.sh pushd tools/perf/Documentation/ make %{?_smp_mflags} man popd +%endif # bpftool pushd tools/bpf/bpftool @@ -605,6 +622,7 @@ popd ## install tools +%if %{with_perf} # perf # perf tool binary and supporting scripts/binaries %if 0%{?with_python2} @@ -630,6 +648,7 @@ rm -rf %{buildroot}/usr/lib/perf/include/bpf/ install -d %{buildroot}/%{_mandir}/man1 install -pm0644 tools/kvm/kvm_stat/kvm_stat.1 %{buildroot}/%{_mandir}/man1/ install -pm0644 tools/perf/Documentation/*.1 %{buildroot}/%{_mandir}/man1/ +%endif # bpftool pushd tools/bpf/bpftool @@ -777,8 +796,10 @@ fi %defattr (-, root, root) /usr/include/* +%if %{with_perf} %files -n perf %{_bindir}/perf +%{_libdir}/libperf-jvmti.so %dir %{_libdir}/traceevent %{_libdir}/traceevent/plugins/ %{_libexecdir}/perf-core @@ -799,6 +820,7 @@ fi %files -n python3-perf %license linux-%{KernelVer}/COPYING %{python3_sitearch}/* +%endif %files -n kernel-tools -f cpupower.lang %{_bindir}/cpupower @@ -862,6 +884,10 @@ fi %endif %changelog +* Tue Jan 22 2021 Yuan Zhichang - 5.10.0-0.0.0.10 +- Add the option of "with_perf" +- Output jvmti plug-in as part of perf building + * Tue Jan 26 2021 Chunsheng Luo - 5.10.0-1.0.0.9 - split from kernel-devel to kernel-headers and kernel-devel