From a6026e8bb4df0a234e43fe7a087519809d614f33 Mon Sep 17 00:00:00 2001 From: cryobry <38270216+cryobry@users.noreply.github.com> Date: Tue, 18 Feb 2020 13:44:46 -0500 Subject: [PATCH] Development fork for copr --- .gitignore | 2 +- systemd/lenovo_fix.service | 4 +-- throttled.spec | 74 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 throttled.spec diff --git a/.gitignore b/.gitignore index 7bbc71c..ff135c4 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,7 @@ wheels/ # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest -*.spec +#*.spec # Installer logs pip-log.txt diff --git a/systemd/lenovo_fix.service b/systemd/lenovo_fix.service index 72fc963..5ec0fdb 100644 --- a/systemd/lenovo_fix.service +++ b/systemd/lenovo_fix.service @@ -1,9 +1,9 @@ [Unit] -Description=Stop Intel throttling +Description=Stop Intel throttling [Service] Type=simple -ExecStart=/opt/lenovo_fix/venv/bin/python3 /opt/lenovo_fix/lenovo_fix.py +ExecStart=/usr/bin/throttled --conf /etc/throttled.conf # Setting PYTHONUNBUFFERED is necessary to see the output of this service in the journal Environment=PYTHONUNBUFFERED=1 StandardOutput=syslog diff --git a/throttled.spec b/throttled.spec new file mode 100644 index 0000000..32a5aad --- /dev/null +++ b/throttled.spec @@ -0,0 +1,74 @@ +%global _hardened_build 1 +%define debug_package %{nil} + +Name: throttled +Version: 0.6 +Release: 2 +Summary: Workaround for Intel throttling issues in Linux +License: MIT +URL: https://github.com/erpalma/throttled +Source0: https://github.com/erpalma/throttled/archive/v%{version}.tar.gz + +BuildRequires: python3-devel +BuildRequires: systemd-units + +Requires: python3 +Requires: python3-gobject +Requires: python3-configparser +Requires: systemd + +Conflicts: thermald + +%description +This tool was originally developed to fix Linux CPU throttling issues affecting +Lenovo T480 / T480s / X1C6. + +The CPU package power limit (PL1/2) is forced to a value of 44 W (29 W on +battery) and the temperature trip point to 95 'C (85 'C on battery) by +overriding default values in MSR and MCHBAR every 5 seconds (30 on battery) to +block the Embedded Controller from resetting these values to default. + +%prep +%autosetup + +%build + +%install +install -D lenovo_fix.py %{buildroot}/%{_bindir}/%{name} +install -D mmio.py %{buildroot}/%{python3_sitelib}/mmio.py +install -D etc/lenovo_fix.conf %{buildroot}/%{_sysconfdir}/%{name}.conf +install -D systemd/lenovo_fix.service %{buildroot}/%{_unitdir}/%{name}.service + +%post +%systemd_post %{name}.service + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%defattr(-,root,root,-) +%attr(755, root, root) %{_bindir}/%{name} +%attr(644, root, root) %{python3_sitelib}/mmio.py +%attr(644, root, root) %{python3_sitelib}/__pycache__/* +%config(noreplace) %attr(640, %{name}, %{name}) %{_sysconfdir}/%{name}.conf +%attr(644, root, root) %{_unitdir}/%{name}.service + +%changelog +* Thu May 02 2019 Arun Babu Neelicattu - 0.6-1 +- Upgrade to 0.6 + +* Mon Mar 11 2019 Arun Babu Neelicattu - 0.5-4 +- Add conflict for thermald + +* Mon Mar 11 2019 Arun Babu Neelicattu - 0.5-3 +- Fix unit file to use configuration + +* Mon Mar 11 2019 Arun Babu Neelicattu - 0.5-2 +- Add default configuration file +- Fix file permissions + +* Mon Mar 11 2019 Arun Babu Neelicattu - 0.5-1 +- Initial release of version 0.5