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

View File

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