cpufreqscaling: update

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-08-22 23:18:32 +02:00
parent 4b64ba15ac
commit d56cfe7c41
2 changed files with 9 additions and 5 deletions

View File

@ -22,6 +22,7 @@ if [ "${1}" = "ondemand" ] || [ "${1}" = "conservative" ]; then
else
echo "CPUFreqScaling: cpufreq_${1} not found"
error=1
break
fi
fi
# Deamonize the main function...
@ -41,7 +42,8 @@ for i in $(seq 0 ${cpucorecount}); do
else
echo "CPUFreqScaling: Failed to set governor to ${1}"
error=1
break
fi
done
[ "${error}" -eq 1 ] && exit 1
[ ${error} -eq 1 ] && exit 1
exit 0

View File

@ -24,7 +24,7 @@ if [ "${1}" = "late" ]; then
Description=Enable CPU Freq scaling
DefaultDependencies=no
IgnoreOnIsolate=true
After=multi-user.target
After=udevrules.service
[Service]
User=root
@ -42,20 +42,22 @@ EOF
mkdir -vp /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
else
[ "${2}" != "schedutil" ] && cp -vf /usr/lib/modules/cpufreq_${2}.ko /tmpRoot/usr/lib/modules/cpufreq_${2}.ko
[ "${2}" != "schedutil" ] && cp -vf /usr/lib/modules/cpufreq_${2}.ko /tmpRoot/usr/lib/modules/cpufreq_${2}.ko && modprobe cpufreq_${2}
mkdir -p "/tmpRoot/usr/lib/systemd/system"
DEST="/tmpRoot/usr/lib/systemd/system/cpufreqscaling.service"
cat << EOF > ${DEST}
[Unit]
Description=Enable CPU Freq scaling
After=multi-user.target
DefaultDependencies=no
IgnoreOnIsolate=true
After=udevrules.service
[Service]
User=root
Type=simple
Restart=on-failure
RestartSec=10s
ExecStart=-/usr/bin/rescaler.sh "${2}"
ExecStart=-/usr/bin/rescaler.sh ${2}
[Install]
WantedBy=multi-user.target