mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
systemd: use a cpufreq service to configure cpu governor
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
This commit is contained in:
parent
a182767d1e
commit
f27caaddc1
@ -963,15 +963,6 @@ prepare_sysroot() {
|
||||
# hide kernel log messages on console
|
||||
echo '1 4 1 7' > /proc/sys/kernel/printk
|
||||
|
||||
# set ondemand up_threshold
|
||||
if [ -e /sys/devices/system/cpu/cpufreq/ondemand/up_threshold ]; then
|
||||
echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
|
||||
else
|
||||
for f in $(ls /sys/devices/system/cpu/cpufreq/policy*/ondemand/up_threshold 2>/dev/null) ; do
|
||||
echo 50 > $f
|
||||
done
|
||||
fi
|
||||
|
||||
# run platform_init script if exists
|
||||
if [ -f "./platform_init" ]; then
|
||||
./platform_init
|
||||
|
@ -206,6 +206,9 @@ post_makeinstall_target() {
|
||||
cp $PKG_DIR/scripts/userconfig-setup $INSTALL/usr/bin
|
||||
cp $PKG_DIR/scripts/usercache-setup $INSTALL/usr/bin
|
||||
|
||||
# use systemd to set cpufreq governor and tunables
|
||||
find_file_path scripts/cpufreq && cp -PRv $FOUND_PATH $INSTALL/usr/bin
|
||||
|
||||
mkdir -p $INSTALL/usr/sbin
|
||||
cp $PKG_DIR/scripts/kernel-overlays-setup $INSTALL/usr/sbin
|
||||
|
||||
@ -268,4 +271,5 @@ post_install() {
|
||||
enable_service usercache.service
|
||||
enable_service kernel-overlays.service
|
||||
enable_service hwdb.service
|
||||
enable_service cpufreq.service
|
||||
}
|
||||
|
17
packages/sysutils/systemd/scripts/cpufreq
Executable file
17
packages/sysutils/systemd/scripts/cpufreq
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
SYS_CPUFREQ_GOV=$( cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor )
|
||||
SYS_CPUFREQ_DIR="/sys/devices/system/cpu/cpufreq"
|
||||
|
||||
# Configure frequency scaling properties
|
||||
if [ $SYS_CPUFREQ_GOV = "ondemand" ]; then
|
||||
for policy in ${SYS_CPUFREQ_DIR}/ondemand ${SYS_CPUFREQ_DIR}/policy*/; do
|
||||
if [ -e $policy/up_threshold ]; then
|
||||
echo 50 > $policy/up_threshold
|
||||
fi
|
||||
done
|
||||
fi
|
11
packages/sysutils/systemd/system.d/cpufreq.service
Normal file
11
packages/sysutils/systemd/system.d/cpufreq.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Set CPU frequency governor and its tunables
|
||||
ConditionPathExists=/usr/bin/cpufreq
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/cpufreq
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=basic.target
|
Loading…
x
Reference in New Issue
Block a user