# - add -n python-perf?
# - add bcond to disable building docs (perf docs)
# - install of perf links perf binary again
-
+# - build runqslower (needs vmlinux with BPF section)
+#
# Conditional build:
%bcond_without verbose # verbose build (V=1)
%bcond_without cpupower # cpupower tools
%bcond_without gtk # GTK+ 2.x perf support
%bcond_without libunwind # libunwind perf support
%bcond_without multilib # multilib perf support
+%bcond_with runqslower # runqslower bpf tool
%bcond_without usbip # usbip utils
-%ifarch x32
-%undefine with_libunwind
-%endif
%ifnarch %{x8664}
%undefine with_multilib
%endif
-%define basever 4.12
-%define postver .1
+%define basever 5.8
+%define postver .0
Summary: Assortment of tools for the Linux kernel
Summary(pl.UTF-8): Zestaw narzędzi dla jądra Linuksa
Name: kernel-tools
Version: %{basever}%{postver}
-Release: 2
+Release: 1
License: GPL v2
Group: Applications/System
-Source0: https://www.kernel.org/pub/linux/kernel/v4.x/linux-%{basever}.tar.xz
-# Source0-md5: fc454157e2d024d401a60905d6481c6b
+Source0: https://www.kernel.org/pub/linux/kernel/v5.x/linux-%{basever}.tar.xz
+# Source0-md5: 0e5c4c15266218ef26c50fac0016095b
Source1: cpupower.service
Source2: cpupower.config
%if "%{postver}" != ".0"
-Patch0: https://www.kernel.org/pub/linux/kernel/v4.x/patch-%{version}.xz
-# Patch0-md5: fab3dcd3b5a99d959bde7cde2e5cedb8
+Patch0: https://www.kernel.org/pub/linux/kernel/v5.x/patch-%{version}.xz
+# Patch0-md5: 7055ff82e7e6a557c04831a191ed14b3
%endif
Patch1: x32.patch
-Patch2: %{name}-lguest-update.patch
+Patch2: regex.patch
Patch3: %{name}-perf-update.patch
-URL: http://www.kernel.org/
+Patch4: %{name}-perf-gtk2.patch
+Patch5: %{name}-usbip-nocommon.patch
+URL: https://www.kernel.org/
BuildRequires: bison
+BuildRequires: docutils
BuildRequires: flex
BuildRequires: gettext-tools
BuildRequires: linux-libc-headers >= 7:4.12
BuildRequires: ncurses-devel
+BuildRequires: ncurses-ext-devel
BuildRequires: pciutils-devel
BuildRequires: pkgconfig
-BuildRequires: rpmbuild(macros) >= 1.647
+BuildRequires: python3
+BuildRequires: python3-modules
+BuildRequires: rpmbuild(macros) >= 1.673
BuildRequires: tar >= 1:1.22
BuildRequires: xz
%if %{with perf}
BuildRequires: asciidoc
BuildRequires: audit-libs-devel
-BuildRequires: binutils-devel
+BuildRequires: babeltrace-devel
+BuildRequires: binutils-devel >= 4:2.29
BuildRequires: docbook-dtd45-xml
BuildRequires: docbook-style-xsl
-BuildRequires: elfutils-devel
+BuildRequires: elfutils-devel >= 0.158
%if %{with multilib}
BuildRequires: gcc-multilib-32
BuildRequires: gcc-multilib-x32
%endif
+# for `btftool btf dump file ... format c` - requires vmlinux with BPF section
+%{?with_runqslower:BuildRequires: kernel-vmlinux >= 5.?}
%{?with_libunwind:BuildRequires: libunwind-devel >= 0.99}
BuildRequires: numactl-devel
+BuildRequires: openssl-devel
BuildRequires: perl-devel >= 5.1
BuildRequires: python-devel
BuildRequires: rpm-pythonprov
BuildRequires: slang-devel
BuildRequires: xmlto
+BuildRequires: xz-devel
+BuildRequires: zlib-devel
+BuildRequires: zstd-devel
+# openscd? (CORESIGHT=1 for %{arm}?)
%if %{with gtk}
BuildRequires: gtk+2-devel >= 2.0
%endif
%description cpupower-libs-devel -l pl.UTF-8
Pliki programistyczne biblioteki cpupower.
+%package -n bash-completion-cpupower
+Summary: Bash completion for cpupower tools
+Summary(pl.UTF-8): Bashowe uzupełnianie parametrów dla poleceń cpupower
+Group: Applications/Shells
+Requires: %{name}-cpupower = %{version}-%{release}
+Requires: bash-completion
+%if "%{_rpmversion}" >= "5"
+BuildArch: noarch
+%endif
+
+%description -n bash-completion-cpupower
+Bash completion for cpupower tools.
+
+%description -n bash-completion-cpupower -l pl.UTF-8
+Bashowe uzupełnianie parametrów dla poleceń cpupower.
+
%package hv
Summary: Hyper-V virtualization tools
Summary(pl.UTF-8): Narzędzia do wirtualizacji Hyper-V
Summary: Bash completion for perf command
Summary(pl.UTF-8): Bashowe uzupełnianie parametrów dla polecenia perf
Group: Applications/Shells
-Requires: %{name}-perf
+Requires: %{name}-perf = %{version}-%{release}
Requires: bash-completion
%if "%{_rpmversion}" >= "5"
BuildArch: noarch
%description -n bash-completion-perf -l pl.UTF-8
Bashowe uzupełnianie parametrów dla polecenia perf.
+%package -n bash-completion-kernel-tools
+Summary: Bash completion for kernel-tools commands
+Summary(pl.UTF-8): Bashowe uzupełnianie parametrów dla poleceń kernel-tools
+Group: Applications/Shells
+Requires: %{name} = %{version}-%{release}
+Requires: bash-completion >= 2.0
+%if "%{_rpmversion}" >= "5"
+BuildArch: noarch
+%endif
+
+%description -n bash-completion-kernel-tools
+Bash completion for kernel-tools commands (currently bpftool).
+
+%description -n bash-completion-kernel-tools -l pl.UTF-8
+Bashowe uzupełnianie parametrów dla poleceń kernel-tools (obecnie
+bpftool).
+
%package -n usbip
Summary: USB device sharing system over IP network
Summary(pl.UTF-8): System współdzielenia urządzeń USB po sieci IP
%patch1 -p1
%patch2 -p1
%patch3 -p1
+%patch4 -p1
+%patch5 -p1
%{__sed} -i -e '/^CFLAGS = /s/ -g / $(OPTFLAGS) /' tools/hv/Makefile
%{__sed} -i -e '/^CFLAGS+=/s/ -O1 / $(OPTFLAGS) /' tools/thermal/tmon/Makefile
-%{__sed} -i -e 's#libexec/perf-core#%{_datadir}/perf-core#g' tools/perf/Makefile.config
+%{__sed} -i -e 's#libexec/perf-core#share/perf-core#g' tools/perf/Makefile.config
+
+# don't rebuild on make install
+%{__sed} -i -e '/^\$(LIBBPF): FORCE/ s/FORCE$//' tools/bpf/bpftool/Makefile
+
+%if %{without runqslower}
+%{__sed} -i -e '/^all: / s/ runqslower//' \
+ -e '/^install: / s/ runqslower_install//' \
+ tools/bpf/Makefile
+%endif
%build
+Wstringop=""
+Waddressof=""
+%if "%{cc_version}" >= "8"
+Wstringop="-Wno-error=stringop-truncation"
+%endif
+%if "%{cc_version}" >= "9"
+Waddressof="-Wno-error=address-of-packed-member"
+%endif
cd linux-%{basever}
# Simple Disk Sleep Monitor
# tools common (used eg. by tools/vm)
%{__make} -C tools/lib/api \
%{makeopts} \
- EXTRA_CFLAGS="%{rpmcflags}"
+ EXTRA_CFLAGS="%{rpmcflags} $Wstringop"
# lsgpio
CFLAGS="%{rpmcflags}" \
%endif
CFLAGS="%{rpmcflags}" \
-%{__make} -C tools/iio \
- CC="%{__cc}"
+%{__make} -C tools/iio -j1 \
+ CC="%{__cc}" \
+ %{?with_verbose:V=1}
%{__make} -C tools/laptop/freefall \
CC="%{__cc}" \
CFLAGS="%{rpmcflags}"
-%ifarch %{ix86}
-# drivers/lguest is x86-32 only
-%{__make} -C tools/lguest \
+# make bpftool first, top-level bpf CFLAGS cause includes conflict
+CFLAGS="%{rpmcflags}" \
+%{__make} -C tools/bpf/bpftool \
CC="%{__cc}" \
- CFLAGS="%{rpmcflags} -Wall -U_FORTIFY_SOURCE -Iinclude"
-%endif
+ %{?with_verbose:V=1}
CFLAGS="%{rpmcflags}" \
-%{__make} -C tools/net \
- CC="%{__cc}"
+%{__make} -C tools/bpf \
+ CC="%{__cc}" \
+ EXTRA_CFLAGS="%{rpmcflags}" \
+ %{?with_runqslower:VMLINUX_BTF=$(rpm -ql kernel-vmlinux | head -n 1)} \
+ %{?with_verbose:V=1}
# perf
%if %{with perf}
-%{__make} -C tools/perf all man \
+%{__make} -j1 -C tools/perf all man \
%ifarch %{x8664}
IS_X86_64=1 \
%{!?with_multilib:NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1} \
%endif
%ifarch %{ix86} %{x8664} x32
+CFLAGS="%{rpmcflags}" \
%{__make} -C tools/power/x86/x86_energy_perf_policy \
- CC="%{__cc}" \
- CFLAGS="%{rpmcflags}"
+ CC="%{__cc}"
+
CFLAGS="%{rpmcflags}" \
%{__make} -C tools/power/x86/turbostat \
CC="%{__cc}"
%{__autoheader}
%{__automake}
%configure \
+ CFLAGS="%{rpmcflags} $Wstringop $Waddressof" \
--disable-silent-rules \
--with-usbids-dir=/lib/hwdata
%{__make}
CPUFREQ_BENCH=false
%find_lang cpupower
-mv cpupower.lang ..
+%{__mv} cpupower.lang ..
install -d $RPM_BUILD_ROOT{/etc/sysconfig,%{systemdunitdir}}
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/cpupower.service
%endif
%if %{with perf}
-%{__make} -C tools/perf -j1 install install-man \
+%{__make} -C tools/perf install install-man \
%ifarch %{x8664}
IS_X86_64=1 \
%{!?with_multilib:NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1} \
prefix=%{_prefix} \
perfexecdir=%{_datadir}/perf-core \
template_dir=%{_datadir}/perf-core/templates \
+ bash_compdir=%{bash_compdir} \
lib=%{_lib} \
DESTDIR=$RPM_BUILD_ROOT
install -p tools/laptop/freefall/freefall $RPM_BUILD_ROOT%{_sbindir}
-%ifarch %{ix86}
-install -p tools/lguest/lguest $RPM_BUILD_ROOT%{_bindir}
-%endif
-
-install -p tools/net/{bpf_asm,bpf_dbg,bpf_jit_disasm} $RPM_BUILD_ROOT%{_bindir}
+%{__make} -C tools/bpf install \
+ prefix=$RPM_BUILD_ROOT%{_prefix} \
+ bash_compdir=$RPM_BUILD_ROOT%{bash_compdir} \
+ %{?with_verbose:V=1}
+%{__make} -C tools/bpf/bpftool doc-install \
+ prefix=$RPM_BUILD_ROOT%{_prefix} \
+ mandir=$RPM_BUILD_ROOT%{_mandir} \
+ %{?with_verbose:V=1}
install -p tools/thermal/tmon/tmon $RPM_BUILD_ROOT%{_bindir}
cp -p tools/thermal/tmon/tmon.8 $RPM_BUILD_ROOT%{_mandir}/man8
# gen_init_cpio
install -p usr/gen_init_cpio $RPM_BUILD_ROOT%{_bindir}/gen_init_cpio
+# packaged in man-pages (5.02)
+%{__rm} $RPM_BUILD_ROOT%{_mandir}/man7/bpf-helpers.7*
+
%clean
rm -rf $RPM_BUILD_ROOT
%attr(755,root,root) %{_bindir}/lsiio
%attr(755,root,root) %{_bindir}/slabinfo
%attr(755,root,root) %{_bindir}/tmon
+%attr(755,root,root) %{_sbindir}/bpftool
%attr(755,root,root) %{_sbindir}/dslm
%attr(755,root,root) %{_sbindir}/freefall
%attr(755,root,root) %{_sbindir}/page-types
+%{_mandir}/man8/bpftool*.8*
%{_mandir}/man8/tmon.8*
-%ifarch %{ix86}
-%doc linux-%{basever}/tools/lguest/lguest.txt
-%attr(755,root,root) %{_bindir}/lguest
-%endif
%ifarch %{ix86} %{x8664} x32
%attr(755,root,root) %{_bindir}/centrino-decode
%attr(755,root,root) %{_bindir}/powernow-k8-decode
%{_includedir}/cpufreq.h
%{_includedir}/cpuidle.h
+%files -n bash-completion-cpupower
+%defattr(644,root,root,755)
+%{bash_compdir}/cpupower
+
%ifarch %{ix86} %{x8664} x32
%files hv
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/perf
%attr(755,root,root) %{_bindir}/trace
%{_mandir}/man1/perf*.1*
+%{_docdir}/perf-tip
%dir %{_datadir}/perf-core
%attr(755,root,root) %{_datadir}/perf-core/perf-archive
%attr(755,root,root) %{_datadir}/perf-core/perf-with-kcore
+%{_datadir}/perf-core/strace
%dir %{_datadir}/perf-core/scripts
%dir %{_libdir}/traceevent/plugins
%attr(755,root,root) %{_libdir}/traceevent/plugins/plugin_*.so
+%dir %{_prefix}/lib/perf
+%{_prefix}/lib/perf/examples
+%{_prefix}/lib/perf/include
+
%if %{with multilib}
%files perf-vdso32
%defattr(644,root,root,755)
/etc/bash_completion.d/perf
%endif
+%files -n bash-completion-kernel-tools
+%defattr(644,root,root,755)
+%{bash_compdir}/bpftool
+
%if %{with usbip}
%files -n usbip
%defattr(644,root,root,755)