misc: rework more

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-06-20 00:33:46 +02:00
parent 215aa1dc87
commit 1ac00194c1
2 changed files with 30 additions and 26 deletions

View File

@ -14,8 +14,13 @@ while true; do
echo "schedutil" >"/sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_governor"
echo "set schedutil governor for ${PLATFORM} cpu: ${CPUCORE}"
else
echo "ondemand" >"/sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_governor"
echo "set ondemand governor for ${PLATFORM} cpu: ${CPUCORE}"
if [ -f "/usr/lib/modules/cpufreq_ondemand" ]; then
echo "ondemand" >"/sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_governor"
echo "set ondemand governor for ${PLATFORM} cpu: ${CPUCORE}"
else
echo "performance" >"/sys/devices/system/cpu/cpu${CPUCORE}/cpufreq/scaling_governor"
echo "set performance governor for ${PLATFORM} cpu: ${CPUCORE}"
fi
fi
if [ ${CPUCORE} -eq 0 ]; then
break

View File

@ -128,37 +128,36 @@ elif [ "${1}" = "late" ]; then
echo "CPU supports CPU Performance Scaling, enabling"
sed -i 's/^# acpi-cpufreq/acpi-cpufreq/g' /tmpRoot/usr/lib/modules-load.d/70-cpufreq-kernel.conf
cp -vf /usr/lib/modules/cpufreq_* /tmpRoot/usr/lib/modules/
# copy cpu governor
echo "Installing Set CPU Governor - ${1}"
cp -vf /usr/bin/governor.sh /tmpRoot/usr/bin/governor.sh
mkdir -p "/tmpRoot/usr/lib/systemd/system"
DEST="/tmpRoot/usr/lib/systemd/system/governor.service"
echo "[Unit]" >${DEST}
echo "Description=Set CPU Governor" >>${DEST}
echo "DefaultDependencies=no" >>${DEST}
echo "IgnoreOnIsolate=true" >>${DEST}
echo "After=multi-user.target" >>${DEST}
echo >>${DEST}
echo "[Service]" >>${DEST}
echo "Type=oneshot" >>${DEST}
echo "RemainAfterExit=yes" >>${DEST}
echo "ExecStart=/usr/bin/governor.sh" >>${DEST}
echo >>${DEST}
echo "[X-Synology]" >>${DEST}
echo "Author=Virtualization Team" >>${DEST}
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
ln -vsf /usr/lib/systemd/system/governor.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/governor.service
else
echo "CPU does NOT support CPU Performance Scaling, disabling"
sed -i 's/^acpi-cpufreq/# acpi-cpufreq/g' /tmpRoot/usr/lib/modules-load.d/70-cpufreq-kernel.conf
echo "CPU does NOT support CPU Performance Scaling, disabling" >/tmpRoot/usr/bin/governor.sh
fi
fi
umount /sys
# copy cpu governor
echo "Installing Set CPU Governor - ${1}"
cp -vf /usr/bin/governor.sh /tmpRoot/usr/bin/governor.sh
mkdir -p "/tmpRoot/usr/lib/systemd/system"
DEST="/tmpRoot/usr/lib/systemd/system/governor.service"
echo "[Unit]" >${DEST}
echo "Description=Set CPU Governor" >>${DEST}
echo "DefaultDependencies=no" >>${DEST}
echo "IgnoreOnIsolate=true" >>${DEST}
echo "After=multi-user.target" >>${DEST}
echo >>${DEST}
echo "[Service]" >>${DEST}
echo "Type=oneshot" >>${DEST}
echo "RemainAfterExit=yes" >>${DEST}
echo "ExecStart=/usr/bin/governor.sh" >>${DEST}
echo >>${DEST}
echo "[X-Synology]" >>${DEST}
echo "Author=Virtualization Team" >>${DEST}
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
ln -vsf /usr/lib/systemd/system/governor.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/governor.service
# crypto-kernel
if [ -f /tmpRoot/usr/lib/modules-load.d/70-crypto-kernel.conf ]; then
# crc32c-intel