From 7d75020bd2afc2dda8f4e4e55c7e0ff1009ffa513da526bc6d4594a414d4a6f5 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Wed, 23 Feb 2022 20:09:02 +0000 Subject: [PATCH] Accepting request 957121 from home:gmbr3:Active - Change to building the package from kernel-source based on how the perf package works - Removed patches: * turbostat_makefile_fix_asm_header.patch * remove_bits_h.patch * x86_perf_makefile_fix_asm_header.patch - Remove all tarballs and git script - Use %lang_package - Correct ix86 to %ix86 OBS-URL: https://build.opensuse.org/request/show/957121 OBS-URL: https://build.opensuse.org/package/show/hardware/cpupower?expand=0&rev=120 --- Makefile.intel-speed-select | 34 ----- cpupower-5.14.tar.bz2 | 3 - cpupower.changes | 13 ++ cpupower.spec | 98 +++++-------- cpupower_export_tarball_from_git.sh | 180 ------------------------ intel-speed-select-1.10.tar.bz2 | 3 - remove_bits_h.patch | 15 -- turbostat-21.05.04.tar.bz2 | 3 - turbostat_makefile_fix_asm_header.patch | 19 --- x86_energy_perf_policy-17.05.11.tar.bz2 | 3 - x86_perf_makefile_fix_asm_header.patch | 15 -- 11 files changed, 48 insertions(+), 338 deletions(-) delete mode 100644 Makefile.intel-speed-select delete mode 100644 cpupower-5.14.tar.bz2 delete mode 100644 cpupower_export_tarball_from_git.sh delete mode 100644 intel-speed-select-1.10.tar.bz2 delete mode 100644 remove_bits_h.patch delete mode 100644 turbostat-21.05.04.tar.bz2 delete mode 100644 turbostat_makefile_fix_asm_header.patch delete mode 100644 x86_energy_perf_policy-17.05.11.tar.bz2 delete mode 100644 x86_perf_makefile_fix_asm_header.patch diff --git a/Makefile.intel-speed-select b/Makefile.intel-speed-select deleted file mode 100644 index 314204c..0000000 --- a/Makefile.intel-speed-select +++ /dev/null @@ -1,34 +0,0 @@ -bindir ?= /usr/bin - -# Do not use make's built-in rules -# (this improves performance and avoids hard-to-debug behaviour); -MAKEFLAGS += -r - -override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I include - -ALL_PROGRAMS := intel-speed-select - -all: $(ALL_PROGRAMS) - -OBJ = isst-config.o isst-core.o isst-display.o - -%.o: %.c - $(CC) -c -o $@ $< $(CFLAGS) - -intel-speed-select: isst-config.o isst-core.o isst-display.o - $(CC) -o $@ $^ $(CFLAGS) - -clean: - rm -f $(ALL_PROGRAMS) - rm -rf include/linux/isst_if.h - find . -name '*.o' -delete -o -name '\.*.d' -delete - -install: $(ALL_PROGRAMS) - install -d -m 755 $(DESTDIR)$(bindir); \ - for program in $(ALL_PROGRAMS); do \ - install $$program $(DESTDIR)$(bindir); \ - done - -FORCE: - -.PHONY: all install clean diff --git a/cpupower-5.14.tar.bz2 b/cpupower-5.14.tar.bz2 deleted file mode 100644 index b8a4702..0000000 --- a/cpupower-5.14.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a797d2584b25181147bb8a36e9538179066f8cb88c277cd8bbf485b8790f0fd1 -size 75224 diff --git a/cpupower.changes b/cpupower.changes index 439cc9b..a28f387 100644 --- a/cpupower.changes +++ b/cpupower.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Fri Feb 18 15:56:24 UTC 2022 - Callum Farmer + +- Change to building the package from kernel-source based on + how the perf package works +- Removed patches: + * turbostat_makefile_fix_asm_header.patch + * remove_bits_h.patch + * x86_perf_makefile_fix_asm_header.patch +- Remove all tarballs and git script +- Use %lang_package +- Correct ix86 to %ix86 + ------------------------------------------------------------------- Mon Jul 19 12:17:54 UTC 2021 - Thomas Renninger diff --git a/cpupower.spec b/cpupower.spec index 8d6d859..e931ee7 100644 --- a/cpupower.spec +++ b/cpupower.spec @@ -16,42 +16,25 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # - -# Use this as version when things are in mainline kernel -%define version %(rpm -q --qf '%{VERSION}' kernel-source) - -%define tsversion 21.05.04 -%define pbversion 17.05.11 -%define ssversion 1.10 +%define maindir tools/power/cpupower +%define tsdir tools/power/x86/turbostat +%define pbdir tools/power/x86/x86_energy_perf_policy +%define ssdir tools/power/x86/intel-speed-select Name: cpupower # Use this as version when things are in mainline kernel -%define version %(rpm -q --qf '%VERSION' kernel-source) -Version: 5.14 +%define version %(rpm -q --qf '%%{VERSION}' kernel-source) +Version: %{version} Release: 0 Summary: Tools to determine and set CPU Power related Settings License: GPL-2.0-only Group: System/Base URL: https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git -Source: %{name}-%{version}.tar.bz2 -Source1: turbostat-%{tsversion}.tar.bz2 -Source2: cpupower_export_tarball_from_git.sh -Source3: x86_energy_perf_policy-%{pbversion}.tar.bz2 -Source4: intel-speed-select-%{ssversion}.tar.bz2 -Source5: Makefile.intel-speed-select Patch1: cpupower_rapl.patch Patch2: rapl_monitor.patch Patch3: cpupower_exclude_kernel_Makefile.patch Patch6: amd_do_not_show_amount_of_boost_states_if_zero.patch - -#turbostat patches -Patch22: turbostat_makefile_fix_asm_header.patch -Patch23: remove_bits_h.patch - -# x86_energy_perf patches -# Fixes bsc#1048546: -Patch30: x86_perf_makefile_fix_asm_header.patch - +BuildRequires: kernel-source BuildRequires: gettext-tools BuildRequires: libcap-devel BuildRequires: pciutils @@ -89,42 +72,38 @@ governor (e.g. ondemand, userspace, conservative) and the cpufreq HW driver For that purpose, it compares the performance governor to a configured powersave module. +%lang_package + %prep -%setup -q -D -b 1 -b 3 -b 4 +# copy necessary files from kernel-source since we need to modify them +(cd %{_prefix}/src/linux ; tar -cf - COPYING CREDITS README tools include scripts Kbuild Makefile arch/*/{include,lib,Makefile} lib) | tar -xf - +chmod +x tools/power/cpupower/utils/version-gen.sh +cd %maindir %patch1 -p1 %patch2 -p1 %patch3 -p1 %patch6 -p1 -cd ../turbostat-%{tsversion} -%patch22 -p1 -%patch23 -p1 - -cd ../x86_energy_perf_policy-%{pbversion} -%patch23 -p1 -%patch30 -p1 - -cd ../intel-speed-select-%{ssversion} -cp %{SOURCE5} Makefile - %build -CONF="PACKAGE_BUGREPORT=https://bugs.opensuse.org mandir=%{_mandir} libdir=%{_libdir} CPUFRQ_BENCH=true VERSION=%{version}" -export CFLAGS="%{optflags} -fcommon -I ." -make $CONF %{?_smp_mflags} +CONF="PACKAGE_BUGREPORT=https://bugs.opensuse.org mandir=%{_mandir} libdir=%{_libdir} CPUFRQ_BENCH=true" +export CFLAGS="%{optflags} -fcommon" +%make_build -C %{maindir} $CONF -%ifarch ix86 x86_64 -cd ../turbostat-%{tsversion} -export CFLAGS="%{optflags} -fcommon -I ../turbostat-%{tsversion}/include" -make %{?_smp_mflags} -cd ../x86_energy_perf_policy-%{pbversion} -make %{?_smp_mflags} -cd ../intel-speed-select-%{ssversion} -make %{?_smp_mflags} +%ifarch %{ix86} x86_64 +%make_build -C %{tsdir} +%make_build -C %{pbdir} +%make_build -C %{ssdir} %endif %install -CONF="PACKAGE_BUGREPORT=https://bugs.opensuse.org mandir=%{_mandir} libdir=%{_libdir} CPUFRQ_BENCH=true DESTDIR=%{buildroot} sbindir=%{_sbindir} docdir=%{_docdir}/%{name} confdir=%{_sysconfdir} VERSION=%{version}" -%make_install $CONF +CONF="PACKAGE_BUGREPORT=https://bugs.opensuse.org mandir=%{_mandir} libdir=%{_libdir} CPUFRQ_BENCH=true DESTDIR=%{buildroot} sbindir=%{_sbindir} docdir=%{_docdir}/%{name} confdir=%{_sysconfdir}" +%make_install -C %{maindir} $CONF + +%ifarch %{ix86} x86_64 +%make_install -C %{tsdir} +%make_install -C %{pbdir} +%make_install -C %{ssdir} +%endif # copy to examples doc dir to avoid complains from the build # system about an executable in the doc dir. @@ -133,26 +112,17 @@ mv %{buildroot}//%{_docdir}/%{name}/cpufreq-bench_script.sh %{buildroot}/%{_docd %find_lang %{name} -%ifarch ix86 x86_64 -cd ../turbostat-%{tsversion} -%make_install -e -cd ../x86_energy_perf_policy-%{pbversion} -%make_install -cd ../intel-speed-select-%{ssversion} -%make_install -%endif - %post -n libcpupower0 -p /sbin/ldconfig %postun -n libcpupower0 -p /sbin/ldconfig -%files -f %{name}.lang +%files %{_datadir}/bash-completion/completions/cpupower -%{_mandir}/man1/cpupower* +%{_mandir}/man1/cpupower*%{?ext_man} %{_bindir}/cpupower -%ifarch ix86 x86_64 -%{_mandir}/man8/turbostat* +%ifarch %{ix86} x86_64 +%{_mandir}/man8/turbostat*%{?ext_man} %{_bindir}/turbostat -%{_mandir}/man8/x86_energy_perf_policy* +%{_mandir}/man8/x86_energy_perf_policy*%{?ext_man} %{_bindir}/x86_energy_perf_policy %{_bindir}/intel-speed-select %endif @@ -175,4 +145,6 @@ cd ../intel-speed-select-%{ssversion} %{_includedir}/powercap.h %{_libdir}/libcpu*.so +%files lang -f %{name}.lang + %changelog diff --git a/cpupower_export_tarball_from_git.sh b/cpupower_export_tarball_from_git.sh deleted file mode 100644 index 93f3d36..0000000 --- a/cpupower_export_tarball_from_git.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/bash - -# Author: Thomas Renninger -# This code is covered and distributed under -# the General Public Licence v2 - -GIT_TAG=HEAD -VERSION="" -TOOL="" - -function usage(){ - echo "$(basename $0) [ -k git_tag ] [ -v tag_to_use ] -t cpupower | turbostat | x86_perf_bias | intel-speed-select" - echo - echo "git_tag Must be a valid kernel git tag, for example v3.1" - echo " if git_tag is not passed HEAD will be used which" - echo " may produce a package incompatible tarball name" - echo " BEST ALWAYS PASS AN EXISTING TAG" - echo " cpupower got introduced in 3.1-rc1" - echo "tag_to_use obs does not like -rcX as a version tag. Pass a verion" - echo " tag you like to use (e.g. 3.13 instead of 3.13-rc7" - echo - echo "export GIT_DIR= environment variable if the git repo is not the current directory" - echo "For example: GIT_DIR=/path_to_git_repo/.git" -} - -function parse_args() -{ - while getopts hv:k:t: name ; do - case $name in - v) - VERSION="$OPTARG" - ;; - - k) - GIT_TAG="$OPTARG" - ;; - t) - TOOL="$OPTARG" - echo $TOOL - ;; - ?|h) - usage - exit 1 - ;; - esac - done - shift $(($OPTIND -1)) -} - - -function export_cpupower() { - - echo "Exporting cpupower from kernel version $GIT_TAG" - - if [ "$VERSION" = "" ];then - # convert - to . as package versions do not allow - - if [ $# -eq 1 ];then - VERSION="${GIT_TAG/-/.}" - # remove leading v - VERSION="-${VERSION#v}" - elif [ $# -eq 2 ];then - VERSION="${2/-/.}" - # remove leading v - VERSION="-${VERSION#v}" - elif [ $# -gt 2 ];then - usage - exit 1 - fi - fi - - # Tried to do this with one git archive command, but - # --remote= param seem not to be configured for kernel.org gits -set -x - git archive --format=tar $GIT_TAG tools/power/cpupower |tar -x -set +x - mv tools/power/cpupower cpupower-${VERSION} - tar -cvjf cpupower-${VERSION}.tar.bz2 cpupower-${VERSION} - popd - mv "$DIR/cpupower-${VERSION}".tar.bz2 . - echo cpupower-${VERSION}.tar.bz2 -} - -function export_turbostat() { - - git archive --format=tar $GIT_TAG tools/power/x86/turbostat |tar -x - - if [ -z "$TURBOSTAT_VERSION" ];then - TURBOSTAT_VERSION=$(grep "turbostat version" tools/power/x86/turbostat/turbostat.c |grep fprintf |sed 's/.*turbostat version \([0-9][0-9].[0-9][0-9].[0-9][0-9]\).*/\1/') - fi - TURBOSTAT_VERSION=$(echo "-$TURBOSTAT_VERSION") - mv tools/power/x86/turbostat turbostat${TURBOSTAT_VERSION} - git checkout $GIT_TAG include/uapi/linux/const.h - git checkout $GIT_TAG include/vdso/bits.h - git checkout $GIT_TAG include/vdso/const.h - git checkout $GIT_TAG arch/x86/include/asm/msr-index.h - git checkout $GIT_TAG arch/x86/include/asm/intel-family.h - mkdir -p turbostat${TURBOSTAT_VERSION}/include/uapi/linux - mkdir -p turbostat${TURBOSTAT_VERSION}/include/vdso - cp include/uapi/linux/const.h turbostat${TURBOSTAT_VERSION}/include/uapi/linux/const.h - cp include/vdso/bits.h turbostat${TURBOSTAT_VERSION}/include/vdso/bits.h - cp include/vdso/const.h turbostat${TURBOSTAT_VERSION}/include/vdso/const.h - cp arch/x86/include/asm/intel-family.h turbostat${TURBOSTAT_VERSION} - cp arch/x86/include/asm/msr-index.h turbostat${TURBOSTAT_VERSION} - tar -cvjf turbostat${TURBOSTAT_VERSION}.tar.bz2 turbostat${TURBOSTAT_VERSION} - popd - mv "$DIR/turbostat${TURBOSTAT_VERSION}".tar.bz2 . - echo turbostat${TURBOSTAT_VERSION}.tar.bz2 -} - -function export_x86_perf_bias() { - -set -x - git archive --format=tar $GIT_TAG tools/power/x86/x86_energy_perf_policy |tar -x - - if [ -z "$PERF_BIAS_VERSION" ];then - PERF_BIAS_VERSION=$(grep 'printf("x86_energy_perf_policy .* (C) Len Brown -+#include - - /* - * CPU model specific register (MSR) numbers. diff --git a/turbostat-21.05.04.tar.bz2 b/turbostat-21.05.04.tar.bz2 deleted file mode 100644 index 5f8b479..0000000 --- a/turbostat-21.05.04.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ed6c7716b7718ffc8c7037108b1fa2a923aea306e2aa01b99abc7b2157eb7da9 -size 48713 diff --git a/turbostat_makefile_fix_asm_header.patch b/turbostat_makefile_fix_asm_header.patch deleted file mode 100644 index 8f3a210..0000000 --- a/turbostat_makefile_fix_asm_header.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- - Makefile | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -9,9 +9,9 @@ - endif - - turbostat : turbostat.c --override CFLAGS += -O2 -Wall -I../../../include --override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' --override CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"' -+override CFLAGS += -O2 -Wall -I ./include -+override CFLAGS += -DMSRHEADER='"msr-index.h"' -+override CFLAGS += -DINTEL_FAMILY_HEADER='"intel-family.h"' - override CFLAGS += -D_FILE_OFFSET_BITS=64 - override CFLAGS += -D_FORTIFY_SOURCE=2 - diff --git a/x86_energy_perf_policy-17.05.11.tar.bz2 b/x86_energy_perf_policy-17.05.11.tar.bz2 deleted file mode 100644 index 5328f45..0000000 --- a/x86_energy_perf_policy-17.05.11.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5080ec1fa9597b9c5863119000c4cc87d767fd1f0a3f7250a5c1e7747ab4d714 -size 20254 diff --git a/x86_perf_makefile_fix_asm_header.patch b/x86_perf_makefile_fix_asm_header.patch deleted file mode 100644 index 622e486..0000000 --- a/x86_perf_makefile_fix_asm_header.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/Makefile -+++ b/Makefile -@@ -10,7 +10,7 @@ - - x86_energy_perf_policy : x86_energy_perf_policy.c - override CFLAGS += -O2 -Wall -I../../../include --override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"' -+override CFLAGS += -DMSRHEADER='"msr-index.h"' - override CFLAGS += -D_FORTIFY_SOURCE=2 - - %: %.c