cpupower: Select the governor at start time rather than during install

Should fix bug #4810.

cpupower will now select the governor automatically during the start of
the service, based on what is available. This can be overridden with
the variables in /etc/sysconfig/cpupower (see the comments there).
This commit is contained in:
Eugene Shatokhin 2015-03-13 17:29:40 +03:00
parent 97fa969d8a
commit ecc4aae2dc
4 changed files with 87 additions and 61 deletions

47
cpupower-start.sh Normal file
View file

@ -0,0 +1,47 @@
#!/bin/bash
# A wrapper for cpupower to set the appropriate governor for frequency
# scaling. Sets 'ondemand', 'powersave' or 'performance' if available
# (checks availablility in this order).
# The user can override this behaviour by specifying the governor in
# CPUPOWER_GOVERNOR variable.
#
# CPUPOWER_OTHER_ARGS can be used to provide additional arguments to
# cpupower.
AVAIL_FILE=/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
USE_GOVERNOR=""
if ! test -e "${AVAIL_FILE}"; then
printf "CPU frequency scaling is not supported.\n"
exit 1
fi
if test -n "${CPUPOWER_GOVERNOR}"; then
if grep "${CPUPOWER_GOVERNOR}" "${AVAIL_FILE}" >/dev/null 2>&1; then
USE_GOVERNOR="${CPUPOWER_GOVERNOR}"
else
printf "Unknown governor: ${CPUPOWER_GOVERNOR}.\n"
printf "Available governors: "
cat "${AVAIL_FILE}"
printf "\n"
exit 1
fi
elif grep "ondemand" "${AVAIL_FILE}" >/dev/null 2>&1; then
USE_GOVERNOR=ondemand
elif grep "powersave" "${AVAIL_FILE}" >/dev/null 2>&1; then
USE_GOVERNOR=powersave
elif grep "performance" "${AVAIL_FILE}" >/dev/null 2>&1; then
USE_GOVERNOR=performance
else
printf "Failed to select the governor automatically, "
printf "please specify it explicitly in CPUPOWER_GOVERNOR variable.\n"
printf "Available governors: "
cat "${AVAIL_FILE}"
printf "\n"
exit 1
fi
# Set the governor at last.
printf "Using \"${USE_GOVERNOR}\" governor.\n"
/usr/bin/cpupower frequency-set -g ${USE_GOVERNOR} ${CPUPOWER_OTHER_ARGS}

View file

@ -1,3 +1,7 @@
# See 'cpupower help' and cpupower(1) for more info # If you would like to use a particular CPU frequency scaling governor
CPUPOWER_START_OPTS="frequency-set -g @GOVERNOR@" # rather than the default one, specify it here.
CPUPOWER_STOP_OPTS="frequency-set -g @GOVERNOR@" # CPUPOWER_GOVERNOR=
# Other command-line arguments to cpupower.
# See 'cpupower help' and cpupower(1) for more info.
# CPUPOWER_OTHER_ARGS=

View file

@ -1,13 +1,12 @@
[Unit] [Unit]
Description=Configure CPU power related settings Description=Configure CPU frequency settings
After=syslog.target After=syslog.target
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
EnvironmentFile=/etc/sysconfig/cpupower EnvironmentFile=/etc/sysconfig/cpupower
ExecStart=/usr/bin/cpupower $CPUPOWER_START_OPTS ExecStart=/usr/bin/cpupower-start.sh
ExecStop=/usr/bin/cpupower $CPUPOWER_STOP_OPTS
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -29,7 +29,7 @@
%define rpmrel %mkrel 0.%{kpatch}.%{mibrel} %define rpmrel %mkrel 0.%{kpatch}.%{mibrel}
%endif %endif
%else %else
%define rpmrel 1 %define rpmrel 2
%endif %endif
# fakerel and fakever never change, they are used to fool # fakerel and fakever never change, they are used to fool
@ -342,9 +342,10 @@ Source2: disable-mrproper-prepare-scripts-configs-in-devel-rpms.patch
Source4: README.kernel-sources Source4: README.kernel-sources
Source5: kernel.rpmlintrc Source5: kernel.rpmlintrc
# config and systemd service file from fedora # Cpupower: the service, the config and the wrapper script
Source50: cpupower.service Source50: cpupower.service
Source51: cpupower.config Source51: cpupower.config
Source52: cpupower-start.sh
# Our patch tarball, # Our patch tarball,
# see https://abf.rosalinux.ru/soft/kernel-patches-and-configs/ # see https://abf.rosalinux.ru/soft/kernel-patches-and-configs/
@ -621,7 +622,7 @@ latest %{kname}-%{1}-devel installed... \
%define summary_desktop586 Linux kernel for desktop use with i586 & 4GB RAM %define summary_desktop586 Linux kernel for desktop use with i586 & 4GB RAM
%define info_desktop586 This kernel is compiled for desktop use, single or \ %define info_desktop586 This kernel is compiled for desktop use, single or \
multiple i586 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \ multiple i586 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \
voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour desktop586 %mkflavour desktop586
%endif %endif
%endif %endif
@ -639,7 +640,7 @@ voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler.
%define summary_desktop Linux Kernel for desktop use with %{_arch} %define summary_desktop Linux Kernel for desktop use with %{_arch}
%define info_desktop This kernel is compiled for desktop use, single or \ %define info_desktop This kernel is compiled for desktop use, single or \
multiple %{_arch} processor(s)/core(s), using HZ_1000, \ multiple %{_arch} processor(s)/core(s), using HZ_1000, \
voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler.
%endif %endif
%mkflavour desktop %mkflavour desktop
%endif %endif
@ -657,7 +658,7 @@ voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler.
%define summary_netbook Linux Kernel for netbook use with %{_arch} %define summary_netbook Linux Kernel for netbook use with %{_arch}
%define info_netbook This kernel is compiled for netbook use, single or \ %define info_netbook This kernel is compiled for netbook use, single or \
multiple %{_arch} processor(s)/core(s), using HZ_250, \ multiple %{_arch} processor(s)/core(s), using HZ_250, \
voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler.
%endif %endif
%mkflavour netbook %mkflavour netbook
%endif %endif
@ -670,12 +671,12 @@ voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor.
%define summary_server Linux Kernel for server use with i686 & 64GB RAM %define summary_server Linux Kernel for server use with i686 & 64GB RAM
%define info_server This kernel is compiled for server use, single or \ %define info_server This kernel is compiled for server use, single or \
multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using \ multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using \
no preempt, HZ_100, CFS cpu scheduler and CFQ i/o scheduler, ONDEMAND governor. no preempt, HZ_100, CFS cpu scheduler and CFQ i/o scheduler.
%else %else
%define summary_server Linux Kernel for server use with %{_arch} %define summary_server Linux Kernel for server use with %{_arch}
%define info_server This kernel is compiled for server use, single or \ %define info_server This kernel is compiled for server use, single or \
multiple %{_arch} processor(s)/core(s), using no preempt, HZ_100, \ multiple %{_arch} processor(s)/core(s), using no preempt, HZ_100, \
CFS cpu scheduler and CFQ i/o scheduler, ONDEMAND governor. CFS cpu scheduler and CFQ i/o scheduler.
%endif %endif
%mkflavour server %mkflavour server
%endif %endif
@ -688,7 +689,7 @@ CFS cpu scheduler and CFQ i/o scheduler, ONDEMAND governor.
%define summary_desktop_pae Linux kernel for desktop use with i686 & upto 64GB RAM %define summary_desktop_pae Linux kernel for desktop use with i686 & upto 64GB RAM
%define info_desktop_pae This kernel is compiled for desktop use, single or \ %define info_desktop_pae This kernel is compiled for desktop use, single or \
multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_1000, \ multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_1000, \
voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour desktop-pae %mkflavour desktop-pae
%endif %endif
%endif %endif
@ -701,7 +702,7 @@ voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor.
%define summary_netbook_pae Linux Kernel for for netbook use with i686 & upto 64GB RAM %define summary_netbook_pae Linux Kernel for for netbook use with i686 & upto 64GB RAM
%define info_netbook_pae This kernel is compiled for netbook use, single or \ %define info_netbook_pae This kernel is compiled for netbook use, single or \
multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_250, \ multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_250, \
voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour netbook-pae %mkflavour netbook-pae
%endif %endif
%endif %endif
@ -714,7 +715,7 @@ voluntary preempt, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor.
%define summary_nrj_desktop586 Linux kernel for desktop use with i586 & 4GB RAM %define summary_nrj_desktop586 Linux kernel for desktop use with i586 & 4GB RAM
%define info_nrj_desktop586 This kernel is compiled for desktop use, single or \ %define info_nrj_desktop586 This kernel is compiled for desktop use, single or \
multiple i586 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \ multiple i586 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour nrj-desktop586 %mkflavour nrj-desktop586
%endif %endif
%endif %endif
@ -727,12 +728,12 @@ full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND gover
%define summary_nrj_desktop Linux Kernel for desktop use with i686 & 4GB RAM %define summary_nrj_desktop Linux Kernel for desktop use with i686 & 4GB RAM
%define info_nrj_desktop This kernel is compiled for desktop use, single or \ %define info_nrj_desktop This kernel is compiled for desktop use, single or \
multiple i686 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \ multiple i686 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \
full preempt, rcu boost, RIFS cpu scheduler and BFQ I/O scheduler, ONDEMAND governor. full preempt, rcu boost, RIFS cpu scheduler and BFQ I/O scheduler.
%else %else
%define summary_nrj_desktop Linux Kernel for desktop use with %{_arch} %define summary_nrj_desktop Linux Kernel for desktop use with %{_arch}
%define info_nrj_desktop This kernel is compiled for desktop use, single or \ %define info_nrj_desktop This kernel is compiled for desktop use, single or \
multiple %{_arch} processor(s)/core(s), using HZ_1000, \ multiple %{_arch} processor(s)/core(s), using HZ_1000, \
full preempt, rcu boost, RIFS cpu scheduler and BFQ I/O scheduler, ONDEMAND governor. full preempt, rcu boost, RIFS cpu scheduler and BFQ I/O scheduler.
%endif %endif
%mkflavour nrj-desktop %mkflavour nrj-desktop
%endif %endif
@ -745,12 +746,12 @@ full preempt, rcu boost, RIFS cpu scheduler and BFQ I/O scheduler, ONDEMAND gove
%define summary_nrj_realtime Linux Kernel for low latency use with i686 & 4GB RAM %define summary_nrj_realtime Linux Kernel for low latency use with i686 & 4GB RAM
%define info_nrj_realtime This kernel is compiled for low latency use, single or \ %define info_nrj_realtime This kernel is compiled for low latency use, single or \
multiple i686 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \ multiple i686 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \
full preempt, rcu boost, CFS cpu scheduler and new BFQ I/O scheduler, PERFORMANCE governor. full preempt, rcu boost, CFS cpu scheduler and new BFQ I/O scheduler.
%else %else
%define summary_nrj_realtime Linux Kernel for low latency use with %{_arch} %define summary_nrj_realtime Linux Kernel for low latency use with %{_arch}
%define info_nrj_realtime This kernel is compiled for low latency use, single or \ %define info_nrj_realtime This kernel is compiled for low latency use, single or \
multiple %{_arch} processor(s)/core(s), using HZ_1000, \ multiple %{_arch} processor(s)/core(s), using HZ_1000, \
full preempt, rcu boost, CFS cpu scheduler and new BFQ I/O scheduler, PERFORMANCE governor. full preempt, rcu boost, CFS cpu scheduler and new BFQ I/O scheduler.
%endif %endif
%mkflavour nrj-realtime %mkflavour nrj-realtime
%endif %endif
@ -763,12 +764,12 @@ full preempt, rcu boost, CFS cpu scheduler and new BFQ I/O scheduler, PERFORMANC
%define summary_nrj_server Linux Kernel for server use with i686 & 64GB RAM %define summary_nrj_server Linux Kernel for server use with i686 & 64GB RAM
%define info_nrj_server This kernel is compiled for server use, single or \ %define info_nrj_server This kernel is compiled for server use, single or \
multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using \ multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using \
no preempt, HZ_100, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. no preempt, HZ_100, CFS cpu scheduler and BFQ i/o scheduler.
%else %else
%define summary_nrj_server Linux Kernel for server use with %{_arch} %define summary_nrj_server Linux Kernel for server use with %{_arch}
%define info_nrj_server This kernel is compiled for server use, single or \ %define info_nrj_server This kernel is compiled for server use, single or \
multiple %{_arch} processor(s)/core(s), using no preempt, HZ_100, \ multiple %{_arch} processor(s)/core(s), using no preempt, HZ_100, \
CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. CFS cpu scheduler and BFQ i/o scheduler.
%endif %endif
%mkflavour nrj-server %mkflavour nrj-server
%endif %endif
@ -781,12 +782,12 @@ CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor.
%define summary_nrj_laptop Linux Kernel for laptop use with i686 & 4GB RAM %define summary_nrj_laptop Linux Kernel for laptop use with i686 & 4GB RAM
%define info_nrj_laptop This kernel is compiled for laptop use, single or \ %define info_nrj_laptop This kernel is compiled for laptop use, single or \
multiple i686 processor(s)/core(s) and less than 4GB RAM, using HZ_300, \ multiple i686 processor(s)/core(s) and less than 4GB RAM, using HZ_300, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%else %else
%define summary_nrj_laptop Linux Kernel for laptop use with %{_arch} %define summary_nrj_laptop Linux Kernel for laptop use with %{_arch}
%define info_nrj_laptop This kernel is compiled for laptop use, single or \ %define info_nrj_laptop This kernel is compiled for laptop use, single or \
multiple %{_arch} processor(s)/core(s), using HZ_300, \ multiple %{_arch} processor(s)/core(s), using HZ_300, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%endif %endif
%mkflavour nrj-laptop %mkflavour nrj-laptop
%endif %endif
@ -799,12 +800,12 @@ full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND gover
%define summary_nrj_netbook Linux Kernel for netbook use with i686 & 4GB RAM %define summary_nrj_netbook Linux Kernel for netbook use with i686 & 4GB RAM
%define info_nrj_netbook This kernel is compiled for netbook use, single or \ %define info_nrj_netbook This kernel is compiled for netbook use, single or \
multiple i686 processor(s)/core(s) and less than 4GB RAM, using HZ_250, \ multiple i686 processor(s)/core(s) and less than 4GB RAM, using HZ_250, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%else %else
%define summary_nrj_netbook Linux Kernel for netbook use with %{_arch} %define summary_nrj_netbook Linux Kernel for netbook use with %{_arch}
%define info_nrj_netbook This kernel is compiled for netbook use, single or \ %define info_nrj_netbook This kernel is compiled for netbook use, single or \
multiple %{_arch} processor(s)/core(s), using HZ_250, \ multiple %{_arch} processor(s)/core(s), using HZ_250, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%endif %endif
%mkflavour nrj-netbook %mkflavour nrj-netbook
%endif %endif
@ -818,7 +819,7 @@ full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND gover
%define summary_nrj_desktop_pae Linux kernel for desktop use with i686 & upto 64GB RAM %define summary_nrj_desktop_pae Linux kernel for desktop use with i686 & upto 64GB RAM
%define info_nrj_desktop_pae This kernel is compiled for desktop use, single or \ %define info_nrj_desktop_pae This kernel is compiled for desktop use, single or \
multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_1000, \ multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_1000, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour nrj-desktop-pae %mkflavour nrj-desktop-pae
%endif %endif
%endif %endif
@ -832,7 +833,7 @@ full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND gover
%define summary_nrj_realtime_pae Linux kernel for low latency use with i686 & upto 64GB RAM %define summary_nrj_realtime_pae Linux kernel for low latency use with i686 & upto 64GB RAM
%define info_nrj_realtime_pae This kernel is compiled for low latency use, single or \ %define info_nrj_realtime_pae This kernel is compiled for low latency use, single or \
multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_1000, \ multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_1000, \
full preempt, rcu boost, CFS cpu scheduler and new BFQ I/O scheduler, PERFORMANCE governor. full preempt, rcu boost, CFS cpu scheduler and new BFQ I/O scheduler.
%mkflavour nrj-realtime-pae %mkflavour nrj-realtime-pae
%endif %endif
%endif %endif
@ -846,7 +847,7 @@ full preempt, rcu boost, CFS cpu scheduler and new BFQ I/O scheduler, PERFORMANC
%define summary_nrj_laptop_pae Linux Kernel for for laptop use with i686 & upto 64GB RAM %define summary_nrj_laptop_pae Linux Kernel for for laptop use with i686 & upto 64GB RAM
%define info_nrj_laptop_pae This kernel is compiled for laptop use, single or \ %define info_nrj_laptop_pae This kernel is compiled for laptop use, single or \
multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_300, \ multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_300, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour nrj-laptop-pae %mkflavour nrj-laptop-pae
%endif %endif
%endif %endif
@ -860,7 +861,7 @@ full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND gover
%define summary_nrj_netbook_pae Linux Kernel for for netbook use with i686 & upto 64GB RAM %define summary_nrj_netbook_pae Linux Kernel for for netbook use with i686 & upto 64GB RAM
%define info_nrj_netbook_pae This kernel is compiled for netbook use, single or \ %define info_nrj_netbook_pae This kernel is compiled for netbook use, single or \
multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_250, \ multiple i686 processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_250, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour nrj-netbook-pae %mkflavour nrj-netbook-pae
%endif %endif
%endif %endif
@ -874,7 +875,7 @@ full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND gover
%define summary_nrj_netbook_atom Linux Kernel for netbook use with Intel Atom cpu, less than 4GB RAM %define summary_nrj_netbook_atom Linux Kernel for netbook use with Intel Atom cpu, less than 4GB RAM
%define info_nrj_netbook_atom This kernel is compiled for netbook use, single or \ %define info_nrj_netbook_atom This kernel is compiled for netbook use, single or \
multiple Intel Atom cpu processor(s)/core(s) and less than 4GB RAM, using HZ_250, \ multiple Intel Atom cpu processor(s)/core(s) and less than 4GB RAM, using HZ_250, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour nrj-netbook-atom %mkflavour nrj-netbook-atom
%endif %endif
%endif %endif
@ -888,7 +889,7 @@ full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND gover
%define summary_nrj_netbook_atom_pae Linux Kernel for netbook use with Intel Atom cpu & upto 64GB RAM %define summary_nrj_netbook_atom_pae Linux Kernel for netbook use with Intel Atom cpu & upto 64GB RAM
%define info_nrj_netbook_atom_pae This kernel is compiled for netbook use, single or \ %define info_nrj_netbook_atom_pae This kernel is compiled for netbook use, single or \
multiple Intel Atom cpu processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_250, \ multiple Intel Atom cpu processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_250, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour nrj-netbook-atom-pae %mkflavour nrj-netbook-atom-pae
%endif %endif
%endif %endif
@ -902,7 +903,7 @@ full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND gover
%define summary_nrj_desktop_core2 Linux Kernel for desktop use with i686 & 4GB RAM %define summary_nrj_desktop_core2 Linux Kernel for desktop use with i686 & 4GB RAM
%define info_nrj_desktop_core2 This kernel is compiled for desktop use, single or \ %define info_nrj_desktop_core2 This kernel is compiled for desktop use, single or \
multiple Intel Core 2 and newer processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \ multiple Intel Core 2 and newer processor(s)/core(s) and less than 4GB RAM, using HZ_1000, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour nrj-desktop-core2 %mkflavour nrj-desktop-core2
%endif %endif
%endif %endif
@ -916,7 +917,7 @@ full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND gover
%define summary_nrj_desktop_core2_pae Linux Kernel for desktop use with i686 & upto 64GB RAM %define summary_nrj_desktop_core2_pae Linux Kernel for desktop use with i686 & upto 64GB RAM
%define info_nrj_desktop_core2_pae This kernel is compiled for desktop use, single or \ %define info_nrj_desktop_core2_pae This kernel is compiled for desktop use, single or \
multiple Intel Core 2 and newer processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_1000, \ multiple Intel Core 2 and newer processor(s)/core(s) and up to 64GB RAM using PAE, using HZ_1000, \
full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler, ONDEMAND governor. full preempt, rcu boost, CFS cpu scheduler and BFQ i/o scheduler.
%mkflavour nrj-desktop-core2-pae %mkflavour nrj-desktop-core2-pae
%endif %endif
%endif %endif
@ -1029,33 +1030,6 @@ The cpupower tools.
%post -n cpupower %post -n cpupower
AVAIL_FILE=/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
CFG_FILE=%{_sysconfdir}/sysconfig/cpupower
if ! [ -e "${AVAIL_FILE}" ]; then
echo "Warning: CPU frequency scaling is not supported."
echo "Setting 'performance' governor as the default, just in case."
sed -i 's/@GOVERNOR@/performance/g' "${CFG_FILE}"
exit 0
fi
# Set "ondemand" or "powersave" by default, if they are supported,
# "performance" otherwise.
# ? Perhaps it is better to do this in runtime rather than here?
if grep "ondemand" "${AVAIL_FILE}" >/dev/null 2>&1; then
echo "Info: setting 'ondemand' governor as the default."
sed -i 's/@GOVERNOR@/ondemand/g' "${CFG_FILE}"
elif grep "powersave" "${AVAIL_FILE}" >/dev/null 2>&1; then
echo "Info: setting 'powersave' governor as the default."
sed -i 's/@GOVERNOR@/powersave/g' "${CFG_FILE}"
else
echo -n "Info: setting 'performance' governor as the default."
cat "${AVAIL_FILE}"
echo
sed -i 's/@GOVERNOR@/performance/g' "${CFG_FILE}"
exit 0
fi
if [ $1 -ge 0 ]; then if [ $1 -ge 0 ]; then
/bin/systemctl enable cpupower >/dev/null 2>&1 || : /bin/systemctl enable cpupower >/dev/null 2>&1 || :
/bin/systemctl start cpupower >/dev/null 2>&1 || : /bin/systemctl start cpupower >/dev/null 2>&1 || :
@ -1856,6 +1830,7 @@ chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
install -m644 %{SOURCE50} %{buildroot}%{_unitdir}/cpupower.service install -m644 %{SOURCE50} %{buildroot}%{_unitdir}/cpupower.service
install -m644 %{SOURCE51} %{buildroot}%{_sysconfdir}/sysconfig/cpupower install -m644 %{SOURCE51} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
install -m755 %{SOURCE52} %{buildroot}%{_bindir}/cpupower-start.sh
%endif %endif
############################################################ ############################################################
### Linker start4 > Check point to build for omv or rosa ### ### Linker start4 > Check point to build for omv or rosa ###
@ -1967,6 +1942,7 @@ rm -rf %{buildroot}
%if %{build_cpupower} %if %{build_cpupower}
%files -n cpupower -f cpupower.lang %files -n cpupower -f cpupower.lang
%{_bindir}/cpupower %{_bindir}/cpupower
%{_bindir}/cpupower-start.sh
%{_libdir}/libcpupower.so.0 %{_libdir}/libcpupower.so.0
%{_libdir}/libcpupower.so.0.0.0 %{_libdir}/libcpupower.so.0.0.0
%{_unitdir}/cpupower.service %{_unitdir}/cpupower.service