diff --git a/.gitignore b/.gitignore index e69de29..4a406bf 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,4 @@ +*~ +*.rpm +*.tar* +results_*/ diff --git a/0001-Fix-path-for-Lenovo-kill-switch-heuristic.patch b/0001-Fix-path-for-Lenovo-kill-switch-heuristic.patch new file mode 100644 index 0000000..558be0d --- /dev/null +++ b/0001-Fix-path-for-Lenovo-kill-switch-heuristic.patch @@ -0,0 +1,31 @@ +From 8c283e472fa3947ec66e3560599cdce378ce62a1 Mon Sep 17 00:00:00 2001 +From: Benjamin Berg +Date: Tue, 1 Sep 2020 14:09:47 +0200 +Subject: [PATCH] Fix path for Lenovo kill-switch heuristic + +The path was missing the /sys prefix, rendering the test useless. Add +the appropriate prefix and also a comment explaining why we do this. +--- + src/thd_engine.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/thd_engine.cpp b/src/thd_engine.cpp +index ee4ed57..4f86549 100644 +--- a/src/thd_engine.cpp ++++ b/src/thd_engine.cpp +@@ -698,7 +698,11 @@ static supported_ids_t id_table[] = { + }; + + std::vector blocklist_paths { +- "/devices/platform/thinkpad_acpi/dytc_lapmode", ++ /* Some Lenovo machines have in-firmware thermal management, ++ * avoid having two entities trying to manage things. ++ * We may want to change this to dytc_perfmode once that is ++ * widely available. */ ++ "/sys/devices/platform/thinkpad_acpi/dytc_lapmode", + }; + #endif + +-- +2.26.2 + diff --git a/0001-adaptive-Fix-64bit-printing-on-non-64bit-machines.patch b/0001-adaptive-Fix-64bit-printing-on-non-64bit-machines.patch new file mode 100644 index 0000000..bc36106 --- /dev/null +++ b/0001-adaptive-Fix-64bit-printing-on-non-64bit-machines.patch @@ -0,0 +1,25 @@ +From 0710804c2c2747839231142c6be95485ed1707b7 Mon Sep 17 00:00:00 2001 +From: Benjamin Berg +Date: Tue, 25 Aug 2020 15:01:56 +0200 +Subject: [PATCH] adaptive: Fix 64bit printing on non-64bit machines + +--- + src/thd_engine_adaptive.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/thd_engine_adaptive.cpp b/src/thd_engine_adaptive.cpp +index acae7d4..8d33153 100644 +--- a/src/thd_engine_adaptive.cpp ++++ b/src/thd_engine_adaptive.cpp +@@ -183,7 +183,7 @@ void cthd_engine_adaptive::dump_apat() + thd_log_info("..apat dump begin.. \n"); + for (unsigned int i = 0; i < targets.size(); ++i) { + thd_log_info( +- "target_id:%lu name:%s participant:%s domain:%d code:%s argument:%s\n", ++ "target_id:%" PRIu64 " name:%s participant:%s domain:%d code:%s argument:%s\n", + targets[i].target_id, targets[i].name.c_str(), + targets[i].participant.c_str(), (int)targets[i].domain, + targets[i].code.c_str(), targets[i].argument.c_str()); +-- +2.26.2 + diff --git a/sources b/sources new file mode 100644 index 0000000..c914f03 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (thermald-2.3.tar.gz) = 0d722c35e3638bb917994b8a123e1226b737b120f0946cfc604eb3bb4bd501121b1f196833f8cb3aceee73a8bb3566ef1d176d81143b84423f89d20966e91ed8 diff --git a/thermald.spec b/thermald.spec new file mode 100644 index 0000000..5626998 --- /dev/null +++ b/thermald.spec @@ -0,0 +1,330 @@ +# Explicitly turn on hardening, if required. +%if 0%{?rhel} && 0%{?rhel} <= 7 +%global _hardened_build 1 +%endif + +%global pkgname thermal_daemon + + +Name: thermald +Version: 2.3 +Release: 2%{?dist} +Summary: Thermal Management daemon + +License: GPLv2+ +URL: https://github.com/intel/%{pkgname} +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz + +# No cpuid.h on other arches. +ExclusiveArch: %{ix86} x86_64 + +BuildRequires: autoconf autoconf-archive +BuildRequires: automake +BuildRequires: dbus-glib-devel +BuildRequires: desktop-file-utils +BuildRequires: gcc-c++ +BuildRequires: glib-devel +BuildRequires: libxml2-devel +BuildRequires: systemd-devel +BuildRequires: upower-devel +BuildRequires: libevdev-devel +BuildRequires: gtk-doc + +Requires: dbus%{?_isa} + +Requires(pre): glibc-common +Requires(pre): shadow-utils + +Patch0: 0001-adaptive-Fix-64bit-printing-on-non-64bit-machines.patch +Patch1: 0001-Fix-path-for-Lenovo-kill-switch-heuristic.patch + +%{?systemd_requires} + +%description +%{name} monitors and controls platform temperature. + +Thermal issues are important to handle proactively to reduce performance +impact. %{name} uses the existing Linux kernel infrastructure and can +be easily enhanced. + + +%package monitor +Summary: Application for monitoring %{name} +License: GPLv3+ + +BuildRequires: qt5-qtbase-devel + +Requires: hicolor-icon-theme +Requires: %{name}%{?_isa} == %{version}-%{release} + +%description monitor +This package contains an Application to monitor %{name} for system +developers who want to enable application developers and their +customers with the responsive and flexible thermal management, +supporting optimal performance in desktop, clam-shell, mobile and +embedded devices. + + +%prep +%autosetup -n %{pkgname}-%{version} -p 1 + +# Create tmpfiles.d config. +%{__mkdir} -p fedora_addons +%{__cat} << EOF > fedora_addons/%{name}.conf +d %{_rundir}/%{name} 0755 root root - +EOF + +# Create desktop-file for the monitor-app. +%{__cat} << EOF > fedora_addons/%{name}-monitor.desktop +[Desktop Entry] +Name=%{name} Monitor +Comment=Application for monitoring %{name} +Icon=%{name}-monitor +Categories=System;Settings; +Exec=%{_bindir}/ThermalMonitor +Type=Application +StartupNotify=true +Terminal=false +EOF + +# Create icon for the monitor-app. +%{__cat} << EOF > fedora_addons/%{name}-monitor.svg + + + + + + + + + + + + + + + +EOF + +# Create ReadMe.txt for the monitor-app. +%{__cat} << EOF > fedora_addons/%{name}-monitor.ReadMe.txt +Running the thermald-monitor-app +-------------------------------- + +To communicate with thermald via dbus, the user has to be member +of the "power" group. So make sure to add your user id to this +group before using the thermald-monitor-app. +EOF + +NO_CONFIGURE=1 ./autogen.sh + + +%build +%configure \ + --disable-option-checking \ + --disable-silent-rules + +%make_build + +# Build the monitor-app. +pushd tools/thermal_monitor +%{__mkdir} -p %{_target_platform} +pushd %{_target_platform} +%{qmake_qt5} .. +%make_build +popd +popd + + +%install +%make_install + +# Install management-script. +%{__install} -Dpm 0755 tools/thermald_set_pref.sh \ + %{buildroot}%{_bindir}/%{name}-set-pref + +# DBus config belongs into %%{_datadir}. +%{__mkdir} -p %{buildroot}%{_datadir} +%{__mv} -f %{buildroot}%{_sysconfdir}/dbus-1/* %{buildroot}%{_datadir}/dbus-1/ + +# No Upstart. +%{__rm} -fr %{buildroot}%{_sysconfdir}/init + +# Setup tmpfiles.d +%{__install} -Dpm 0644 fedora_addons/%{name}.conf \ + %{buildroot}%{_tmpfilesdir}/%{name}.conf +%{__install} -dm 0755 %{buildroot}%{_rundir}/%{name} +/bin/echo "%{name}_pid" > %{buildroot}%{_rundir}/%{name}/%{name}.pid +%{__chmod} -c 0644 %{buildroot}%{_rundir}/%{name}/%{name}.pid + +# Install the monitor-app. +%{__install} -Dpm 0755 tools/thermal_monitor/%{_target_platform}/ThermalMonitor \ + %{buildroot}%{_bindir}/ThermalMonitor +%{__install} -Dpm 0644 fedora_addons/%{name}-monitor.desktop \ + %{buildroot}%{_datadir}/applications/%{name}-monitor.desktop +%{__install} -Dpm 0644 fedora_addons/%{name}-monitor.svg \ + %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}-monitor.svg + + +%check +%{_bindir}/desktop-file-validate \ + %{buildroot}%{_datadir}/applications/*.desktop + + +%pre +/bin/getent group power >/dev/null || /sbin/groupadd -r power +exit 0 + + +%post +%systemd_post thermald.service + + +%preun +%systemd_preun thermald.service + + +%postun +%systemd_postun_with_restart thermald.service + +%files +%config(noreplace) %{_sysconfdir}/%{name} +%doc README.txt thermal_daemon_usage.txt +%ghost %dir %{_rundir}/%{name} +%ghost %{_rundir}/%{name}/%{name}.pid +%license COPYING +%{_bindir}/%{name}-set-pref +%{_datadir}/dbus-1/system-services/org.freedesktop.%{name}.service +%{_datadir}/dbus-1/system.d/org.freedesktop.%{name}.conf +%{_mandir}/man5/thermal-conf.xml.5* +%{_mandir}/man8/%{name}.8* +%{_sbindir}/%{name} +%{_tmpfilesdir}/%{name}.conf +%{_unitdir}/%{name}.service + + +%files monitor +%doc fedora_addons/%{name}-monitor.ReadMe.txt +%license tools/thermal_monitor/qcustomplot/GPL.txt +%{_bindir}/ThermalMonitor +%{_datadir}/applications/%{name}-monitor.desktop +%{_datadir}/icons/hicolor/scalable/apps/%{name}-monitor.svg + + +%changelog +* Tue Sep 01 2020 Benjamin Berg - 2.3-2 +- Fix Lenovo kill switch (#1874462) + +* Tue Aug 25 2020 Benjamin Berg - 2.3-1 +- New upstream release 2.3 (rhbz#1866784) +- Add patch to fix printf on non-64 bit + +* Wed Jul 29 2020 Fedora Release Engineering - 2.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jun 08 2020 Benjamin Berg - 2.2-1 +- New upstream release 2.2 (rhbz#1827883) + +* Fri Jan 31 2020 Fedora Release Engineering - 1.9.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Dec 18 2019 Benjamin Berg - 1.9.1-1 +- New upstream release 1.9 (rhbz#1782249) +- Drop Patch0, it has been merged upstream + +* Fri Sep 20 2019 Christian Kellner - 1.9-1 +- New upstream release 1.9 (rhbz#1742290) +- Update patch0 (taken from upstream, commit dcdaf52...) + +* Sat Jul 27 2019 Fedora Release Engineering - 1.8-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri May 17 2019 Benjamin Berg - 1.8-2 +- Fix build on i686 + +* Fri May 17 2019 Benjamin Berg - 1.8-1 +- New upstream release (#1582506) + +* Sun Feb 03 2019 Fedora Release Engineering - 1.7.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Sat Jul 14 2018 Fedora Release Engineering - 1.7.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri Feb 09 2018 Fedora Release Engineering - 1.7.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Dec 28 2017 Björn Esser - 1.7.1-1 +- New upstream release (#1505144) + +* Thu Aug 03 2017 Fedora Release Engineering - 1.6-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 1.6-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Jul 01 2017 Björn Esser - 1.6-6 +- Add upstreamed patch to silence compiler warnings + +* Sat Jul 01 2017 Björn Esser - 1.6-5 +- Replace fix for rhbz#1464548 from upstream commit +- Add upstream patch to fix README + +* Fri Jun 30 2017 Björn Esser - 1.6-4 +- Add upstream patch to fix ThermalMonitor (rhbz#1464548) +- Add several fixes from upstream + +* Tue Apr 11 2017 Björn Esser - 1.6-3 +- Explicitly turn on hardening, if required + +* Tue Apr 11 2017 Björn Esser - 1.6-2 +- Fix missing trailing semicolon in desktop-file + +* Tue Apr 11 2017 Björn Esser - 1.6-1 +- Initial import (rhbz#1440406) + +* Mon Apr 10 2017 Björn Esser - 1.6-0.4 +- Use qmake_qt5-macro and build out of tree + +* Sat Apr 08 2017 Björn Esser - 1.6-0.3 +- Small packaging improvements + +* Sat Apr 08 2017 Björn Esser - 1.6-0.2 +- Add management-script + +* Sat Apr 08 2017 Björn Esser - 1.6-0.1 +- Initial rpm-release (rhbz#1440406)