mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 13:40:51 +07:00
cpufreqscaling: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
0c9b4f1d9b
commit
6271194522
@ -12,17 +12,17 @@ set -euo pipefail
|
||||
# Load the correct cpufreq module
|
||||
cerror=0
|
||||
governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
||||
if [ "${1}" == "ondemand" ] || [ "${1}" == "conservative" ]; then
|
||||
insmod /usr/lib/modules/cpufreq_${1}.ko || cerror=1
|
||||
if [ "${1}" = "ondemand" ] || [ "${1}" = "conservative" ]; then
|
||||
insmod "/usr/lib/modules/cpufreq_${1}.ko" || cerror=1
|
||||
fi
|
||||
# Set correct cpufreq governor to allow frequency scaling
|
||||
if [ "${governor}" != "${1}" ]; then
|
||||
echo ${1} | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||
echo "${1}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||
fi
|
||||
sleep 10
|
||||
# Check if the governor is set correctly
|
||||
verifygovernor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
||||
if [ "${verifygovernor}" == "${1}" ]; then
|
||||
if [ "${verifygovernor}" = "${1}" ]; then
|
||||
echo "CPUFreqScaling: Governor set to ${1}"
|
||||
else
|
||||
echo "CPUFreqScaling: Failed to set governor to ${1}"
|
||||
|
@ -13,7 +13,9 @@ if [ "${1}" = "late" ]; then
|
||||
|
||||
cp -pf "/usr/sbin/scaling.sh" "/tmpRoot/usr/sbin/scaling.sh"
|
||||
[ ! -f "/tmpRoot/usr/bin/echo" ] && cp -pf /usr/bin/echo /tmpRoot/usr/bin/echo || true
|
||||
if [ "${2}" = "schedutil" ] || [ "${2}" = "ondemand" ] || [ "${2}" = "conservative" ]; then
|
||||
cp -pf "/usr/lib/modules/acpi_cpufreq.ko" "/tmpRoot/usr/lib/modules/acpi_cpufreq.ko"
|
||||
fi
|
||||
[ "${2}" != "schedutil" ] && cp -pf "/usr/lib/modules/cpufreq_${2}.ko" "/tmpRoot/usr/lib/modules/cpufreq_${2}.ko"
|
||||
|
||||
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||
@ -21,7 +23,7 @@ if [ "${1}" = "late" ]; then
|
||||
{
|
||||
echo "[Unit]"
|
||||
echo "Description=Enable CPU Freq scaling"
|
||||
echo "After=syno-volume.target syno-space.target"
|
||||
echo "After=multi-user.target"
|
||||
echo
|
||||
echo "[Service]"
|
||||
echo "User=root"
|
||||
@ -35,7 +37,7 @@ if [ "${1}" = "late" ]; then
|
||||
} >"${DEST}"
|
||||
mkdir -p /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||
ln -vsf /usr/lib/systemd/system/cpufreqscaling.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/cpufreqscaling.service
|
||||
|
||||
if [ "${2}" = "schedutil" ] || [ "${2}" = "ondemand" ] || [ "${2}" = "conservative" ]; then
|
||||
if [ ! -f /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db ]; then
|
||||
echo "copy esynoscheduler.db"
|
||||
mkdir -p /tmpRoot/usr/syno/etc/esynoscheduler
|
||||
@ -47,6 +49,7 @@ if [ "${1}" = "late" ]; then
|
||||
DELETE FROM task WHERE task_name LIKE 'CPUFreqscaling';
|
||||
INSERT INTO task VALUES('CPUFreqscaling', '', 'bootup', '', 0, 0, 0, 0, '', 0, '/usr/sbin/scaling.sh ${2}', 'script', '{}', '', '', '{}', '{}');
|
||||
EOF
|
||||
fi
|
||||
|
||||
elif [ "${1}" = "uninstall" ]; then
|
||||
echo "Installing cpufreqscalingscaling - ${1}"
|
||||
|
Loading…
Reference in New Issue
Block a user