integ/kernel-rt/centos/meta_patches/tis-add-tools.patch
Dean Troyer 3cd12006bb StarlingX open source release updates
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-05-31 07:36:35 -07:00

242 lines
7.1 KiB
Diff

From c6c5f512db8d2e06758333f17dec7960ab7e34d9 Mon Sep 17 00:00:00 2001
Message-Id: <c6c5f512db8d2e06758333f17dec7960ab7e34d9.1507842722.git.Jim.Somerville@windriver.com>
In-Reply-To: <9c07167bbe02febf5402665f4a907a0edd21c1fd.1507842722.git.Jim.Somerville@windriver.com>
References: <9c07167bbe02febf5402665f4a907a0edd21c1fd.1507842722.git.Jim.Somerville@windriver.com>
From: Scott Little <scott.little@windriver.com>
Date: Tue, 9 May 2017 13:00:12 -0400
Subject: [PATCH 10/29] tis add tools
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
---
SPECS/kernel-rt.spec | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 157 insertions(+), 1 deletion(-)
diff --git a/SPECS/kernel-rt.spec b/SPECS/kernel-rt.spec
index aff01a7..7ab7c45 100644
--- a/SPECS/kernel-rt.spec
+++ b/SPECS/kernel-rt.spec
@@ -42,6 +42,11 @@ Summary: The Linux Realtime kernel
%bcond_with perf
%bcond_with firmware
%bcond_with debuginfo
+%bcond_without tools
+
+# Architectures we build tools/cpupower on
+%define cpupowerarchs x86_64 ppc64 ppc64le
+
# What parts do we want to build? We must build at least one kernel.
# These are the kernels that are built IF the architecture allows it.
@@ -305,6 +310,9 @@ BuildRequires: python-devel, newt-devel, perl(ExtUtils::Embed)
BuildRequires: pesign >= 0.109-4
%endif
%endif
+%if %{with_tools}
+BuildRequires: pciutils-devel gettext ncurses-devel
+%endif
%if %{with_sparse}
BuildRequires: sparse >= 0.4.1
%endif
@@ -362,6 +370,11 @@ Source37: centos.cer
Source50: kernel-%{version}-x86_64-rt.config
Source51: kernel-%{version}-x86_64-rt-trace.config
Source52: kernel-%{version}-x86_64-rt-debug.config
+
+# Sources for kernel-rt-tools
+Source2000: cpupower.service
+Source2001: cpupower.config
+
Source30000: kernel-3.10.0-x86_64-rt.config.tis_extra
Source30001: kernel-3.10.0-x86_64-rt-debug.config.tis_extra
Source30002: kernel-3.10.0-x86_64-rt-trace.config.tis_extra
@@ -641,6 +654,47 @@ It should only be installed when trying to gather additional information
on kernel bugs.
%endif
+%if %{with_tools}
+
+%package -n kernel-rt-tools
+Summary: Assortment of tools for the Linux kernel
+Group: Development/System
+License: GPLv2
+Provides: cpupowerutils-rt = 1:009-0.6.p1
+Obsoletes: cpupowerutils-rt < 1:009-0.6.p1
+Provides: cpufreq-utils-rt = 1:009-0.6.p1
+Provides: cpufrequtils-rt = 1:009-0.6.p1
+Obsoletes: cpufreq-utils-rt < 1:009-0.6.p1
+Obsoletes: cpufrequtils-rt < 1:009-0.6.p1
+Obsoletes: cpuspeed-rt < 1:2.0
+Requires: kernel-rt-tools-libs = %{version}-%{release}
+%description -n kernel-rt-tools
+This package contains the tools/ directory from the kernel source
+and the supporting documentation.
+
+%package -n kernel-rt-tools-libs
+Summary: Libraries for the kernels-tools
+Group: Development/System
+License: GPLv2
+%description -n kernel-rt-tools-libs
+This package contains the libraries built from the tools/ directory
+from the kernel source.
+
+%package -n kernel-rt-tools-libs-devel
+Summary: Assortment of tools for the Linux kernel
+Group: Development/System
+License: GPLv2
+Requires: kernel-rt-tools = %{version}-%{release}
+Provides: cpupowerutils-devel = 1:009-0.6.p1.1
+Obsoletes: cpupowerutils-devel <= 1:009-0.6.p1
+Requires: kernel-rt-tools-libs = %{version}-%{release}
+Provides: kernel-rt-tools-devel
+%description -n kernel-rt-tools-libs-devel
+This package contains the development files for the tools/ directory from
+the kernel source.
+
+%endif # with_tools
+
%prep
## ApplyPatch routine
patch_command='patch -p1 -F1 -s'
@@ -1097,6 +1151,31 @@ BuildKernel %make_target %kernel_image vanilla
BuildKernel %make_target %kernel_image
%endif
+%if %{with_tools}
+%ifarch %{cpupowerarchs}
+# cpupower
+# make sure version-gen.sh is executable.
+chmod +x tools/power/cpupower/utils/version-gen.sh
+make %{?cross_opts} %{?_smp_mflags} -C tools/power/cpupower CPUFREQ_BENCH=false
+%ifarch x86_64
+ pushd tools/power/cpupower/debug/x86_64
+ make %{?_smp_mflags} centrino-decode powernow-k8-decode
+ popd
+%endif
+%ifarch x86_64
+ pushd tools/power/x86/x86_energy_perf_policy/
+ make
+ popd
+ pushd tools/power/x86/turbostat
+ make
+ popd
+%endif #turbostat/x86_energy_perf_policy
+%endif
+pushd tools
+make tmon
+popd
+%endif
+
%if %{builddoc}
# Make the HTML and man pages.
make -j1 htmldocs mandocs || %{doc_build_fail}
@@ -1229,7 +1308,6 @@ find Documentation/DocBook/man -name '*.9.gz' -print0 |
xargs -0 --no-run-if-empty %{__install} -m 444 -t $man9dir $m
ls $man9dir | grep -q '' || > $man9dir/BROKEN
%endif # builddoc
-
# perf docs
%if %{buildrt}
%if %{buildperf}
@@ -1255,6 +1333,39 @@ mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/perf
%endif # buildperf
%endif
+%if %{with_tools}
+%ifarch %{cpupowerarchs}
+make -C tools/power/cpupower DESTDIR=$RPM_BUILD_ROOT libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
+rm -f %{buildroot}%{_libdir}/*.{a,la}
+%find_lang cpupower
+mv cpupower.lang ../
+%ifarch x86_64
+ pushd tools/power/cpupower/debug/x86_64
+ install -m755 centrino-decode %{buildroot}%{_bindir}/centrino-decode
+ install -m755 powernow-k8-decode %{buildroot}%{_bindir}/powernow-k8-decode
+ popd
+%endif
+chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
+mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
+install -m644 %{SOURCE2000} %{buildroot}%{_unitdir}/cpupower.service
+install -m644 %{SOURCE2001} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
+%ifarch %{ix86} x86_64
+ mkdir -p %{buildroot}%{_mandir}/man8
+ pushd tools/power/x86/x86_energy_perf_policy
+ make DESTDIR=%{buildroot} install
+ popd
+ pushd tools/power/x86/turbostat
+ make DESTDIR=%{buildroot} install
+ popd
+%endif #turbostat/x86_energy_perf_policy
+pushd tools/thermal/tmon
+make INSTALL_ROOT=%{buildroot} install
+popd
+%endif
+
+%endif
+
+
%if %{buildheaders}
# Install kernel headers
make ARCH=%{hdrarch} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install
@@ -1303,6 +1414,14 @@ rm -rf $RPM_BUILD_ROOT
### scripts
###
+%if %{with_tools}
+%post -n kernel-rt-tools
+/sbin/ldconfig
+
+%postun -n kernel-rt-tools
+/sbin/ldconfig
+%endif
+
#
# This macro defines a %%post script for a kernel*-devel package.
# %%kernel_devel_post [<subpackage>]
@@ -1460,6 +1579,43 @@ fi
%endif
%endif
+
+%if %{with_tools}
+%files -n kernel-rt-tools -f cpupower.lang
+%defattr(-,root,root)
+%ifarch %{cpupowerarchs}
+%{_bindir}/cpupower
+%ifarch x86_64
+%{_bindir}/centrino-decode
+%{_bindir}/powernow-k8-decode
+%endif
+%{_unitdir}/cpupower.service
+%{_mandir}/man[1-8]/cpupower*
+%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
+%ifarch %{ix86} x86_64
+%{_bindir}/x86_energy_perf_policy
+%{_mandir}/man8/x86_energy_perf_policy*
+%{_bindir}/turbostat
+%{_mandir}/man8/turbostat*
+%endif
+%endif
+%{_bindir}/tmon
+
+%ifarch %{cpupowerarchs}
+%files -n kernel-rt-tools-libs
+%defattr(-,root,root)
+%{_libdir}/libcpupower.so.0
+%{_libdir}/libcpupower.so.0.0.0
+
+%files -n kernel-rt-tools-libs-devel
+%defattr(-,root,root)
+%{_libdir}/libcpupower.so
+%{_includedir}/cpufreq.h
+%endif
+
+%endif # with_tools
+
+
# This is %{image_install_path} on an arch where that includes ELF files,
# or empty otherwise.
%global elf_image_install_path %{?kernel_image_elf:%{image_install_path}}
--
1.8.3.1