mirror of
https://abf.rosa.ru/djam/kernel-6.1.git
synced 2025-02-23 15:22:54 +00:00
Make sure cpupower starts after the list of governors is available
On EeePC 1015 PED (in Live mode), cpupower.service seemed to start too early, before /sys/devices/.../scaling_available_governors was there, and failed as a result. There were no such problems on faster machines, but still. Now cpupower.service will start only when 'scaling_available_governors' file is available. cpupower.path unit handles this. If CPU frequency scaling is not supported the file will never appear and cpupower.service will not start at all, which is natural.
This commit is contained in:
parent
e8480bfda5
commit
e6f2856989
3 changed files with 22 additions and 6 deletions
9
cpupower.path
Normal file
9
cpupower.path
Normal file
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=cpupower - wait for the list of frequency governors
|
||||
After=syslog.target
|
||||
|
||||
[Path]
|
||||
PathExists=/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,6 +1,7 @@
|
|||
[Unit]
|
||||
Description=Configure CPU frequency settings
|
||||
After=syslog.target
|
||||
ConditionPathExists=/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
@ -10,3 +11,4 @@ ExecStart=/usr/bin/cpupower-start.sh
|
|||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Also=cpupower.path
|
||||
|
|
17
kernel.spec
17
kernel.spec
|
@ -29,7 +29,7 @@
|
|||
%define rpmrel %mkrel 0.%{kpatch}.%{mibrel}
|
||||
%endif
|
||||
%else
|
||||
%define rpmrel 3
|
||||
%define rpmrel 4
|
||||
%endif
|
||||
|
||||
# fakerel and fakever never change, they are used to fool
|
||||
|
@ -349,10 +349,11 @@ Source2: disable-mrproper-prepare-scripts-configs-in-devel-rpms.patch
|
|||
Source4: README.kernel-sources
|
||||
Source5: kernel.rpmlintrc
|
||||
|
||||
# Cpupower: the service, the config and the wrapper script
|
||||
# Cpupower: the service, the config, etc.
|
||||
Source50: cpupower.service
|
||||
Source51: cpupower.config
|
||||
Source52: cpupower-start.sh
|
||||
Source53: cpupower.path
|
||||
|
||||
# Our patch tarball,
|
||||
# see https://abf.rosalinux.ru/soft/kernel-patches-and-configs/
|
||||
|
@ -1038,14 +1039,16 @@ The cpupower tools.
|
|||
%post -n cpupower
|
||||
|
||||
if [ $1 -ge 0 ]; then
|
||||
/bin/systemctl enable cpupower >/dev/null 2>&1 || :
|
||||
/bin/systemctl start cpupower >/dev/null 2>&1 || :
|
||||
# Do not enable/disable cpupower.service directly, because it should start
|
||||
# when cpupower.path triggers it.
|
||||
/bin/systemctl enable cpupower.path >/dev/null 2>&1 || :
|
||||
/bin/systemctl start cpupower.path >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%preun -n cpupower
|
||||
if [ $1 -eq 0 ]; then
|
||||
/bin/systemctl --no-reload disable cpupower > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop cpupower > /dev/null 2>&1 || :
|
||||
/bin/systemctl --no-reload disable cpupower.path > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop cpupower.path > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%package -n cpupower-devel
|
||||
|
@ -1836,6 +1839,7 @@ mv cpupower.lang ../
|
|||
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
|
||||
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
|
||||
install -m644 %{SOURCE50} %{buildroot}%{_unitdir}/cpupower.service
|
||||
install -m644 %{SOURCE53} %{buildroot}%{_unitdir}/cpupower.path
|
||||
install -m644 %{SOURCE51} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
|
||||
install -m755 %{SOURCE52} %{buildroot}%{_bindir}/cpupower-start.sh
|
||||
%endif
|
||||
|
@ -1953,6 +1957,7 @@ rm -rf %{buildroot}
|
|||
%{_libdir}/libcpupower.so.0
|
||||
%{_libdir}/libcpupower.so.0.0.0
|
||||
%{_unitdir}/cpupower.service
|
||||
%{_unitdir}/cpupower.path
|
||||
%{_mandir}/man[1-8]/cpupower*
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue