mirror of
https://github.com/AuxXxilium/arc.git
synced 2024-11-24 02:59:53 +07:00
arc: rework cpu frequency scaling support
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
bbc667f3a6
commit
7c0305aa37
@ -49,10 +49,6 @@ function addonSelection() {
|
||||
touch "${TMP_PATH}/opts"
|
||||
while read -r ADDON DESC; do
|
||||
arrayExistItem "${ADDON}" "${!ADDONS[@]}" && ACT="on" || ACT="off"
|
||||
if [ "${ADDON}" == "cpufreqscaling" ]; then
|
||||
[ "${ACPISYS}" == "false" ] && continue
|
||||
[ ! -d "/sys/devices/system/cpu/cpu0/cpufreq" ] && continue
|
||||
fi
|
||||
if [ "${ADDON}" == "amepatch" ] && [ "${OFFLINE}" == "true" ]; then
|
||||
continue
|
||||
fi
|
||||
@ -1929,4 +1925,38 @@ function arcNIC () {
|
||||
ARCNIC=${resp}
|
||||
writeConfigKey "arc.nic" "${ARCNIC}" "${USER_CONFIG_FILE}"
|
||||
return
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# CPU Governor Menu
|
||||
function governorMenu () {
|
||||
governorSelection
|
||||
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
|
||||
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
|
||||
return
|
||||
}
|
||||
|
||||
function governorSelection () {
|
||||
rm -f "${TMP_PATH}/opts" >/dev/null
|
||||
touch "${TMP_PATH}/opts"
|
||||
CPUFREQSUPPORT=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
||||
if [ -n "${CPUFREQSUPPORT}" ]; then
|
||||
# Selectable CPU governors
|
||||
echo -e "performance \"always run at max frequency\"" >>"${TMP_PATH}/opts"
|
||||
[ "${PLATFORM}" == "epyc7002" ] && echo -e "schedutil \"use schedutil to scale frequency\"" >>"${TMP_PATH}/opts"
|
||||
[ "${PLATFORM}" != "epyc7002" ] && echo -e "ondemand \"use ondemand to scale frequency\"" >>"${TMP_PATH}/opts"
|
||||
echo -e "userspace \"use userspace settings to scale frequency\"" >>"${TMP_PATH}/opts"
|
||||
dialog --backtitle "$(backtitle)" --title "DSM Frequency Scaling" \
|
||||
--default-item "performance" --menu "Choose a Governor" 0 0 0 --file "${TMP_PATH}/opts" \
|
||||
2>${TMP_PATH}/resp
|
||||
[ $? -ne 0 ] && return
|
||||
resp=$(cat ${TMP_PATH}/resp)
|
||||
[ -z "${resp}" ] && return
|
||||
CPUGOVERNOR=${resp}
|
||||
else
|
||||
dialog --backtitle "$(backtitle)" --title "DSM Frequency Scaling" \
|
||||
--msgbox "CPU frequency scaling not supported!" 0 0
|
||||
CPUGOVERNOR="performance"
|
||||
fi
|
||||
writeConfigKey "arc.governor" "${CPUGOVERNOR}" "${USER_CONFIG_FILE}"
|
||||
}
|
@ -87,6 +87,7 @@ ARCPATCH="$(readConfigKey "arc.patch" "${USER_CONFIG_FILE}")"
|
||||
BOOTIPWAIT="$(readConfigKey "arc.bootipwait" "${USER_CONFIG_FILE}")"
|
||||
DIRECTBOOT="$(readConfigKey "arc.directboot" "${USER_CONFIG_FILE}")"
|
||||
EMMCBOOT="$(readConfigKey "arc.emmcboot" "${USER_CONFIG_FILE}")"
|
||||
CPUGOVERNOR="$(readConfigKey "arc.governor" "${USER_CONFIG_FILE}")"
|
||||
HDDSORT="$(readConfigKey "arc.hddsort" "${USER_CONFIG_FILE}")"
|
||||
KERNEL="$(readConfigKey "arc.kernel" "${USER_CONFIG_FILE}")"
|
||||
KERNELLOAD="$(readConfigKey "arc.kernelload" "${USER_CONFIG_FILE}")"
|
||||
@ -517,6 +518,7 @@ function arcSettings() {
|
||||
writeConfigKey "addons.cpuinfo" "" "${USER_CONFIG_FILE}"
|
||||
# Select Addons
|
||||
addonSelection
|
||||
governorSelection
|
||||
# Check for DT and HBA/Raid Controller
|
||||
if [ "${PLATFORM}" != "epyc7002" ]; then
|
||||
if [ "${DT}" == "true" ] && [ "${EXTERNALCONTROLLER}" == "true" ]; then
|
||||
@ -954,6 +956,7 @@ else
|
||||
echo "= \"\Z4========== Arc ==========\Zn \" " >>"${TMP_PATH}/menu"
|
||||
echo "b \"DSM Addons \" " >>"${TMP_PATH}/menu"
|
||||
echo "d \"DSM Modules \" " >>"${TMP_PATH}/menu"
|
||||
echo "g \"DSM Frequency Scaling \" " >>"${TMP_PATH}/menu"
|
||||
echo "e \"DSM Version \" " >>"${TMP_PATH}/menu"
|
||||
if [ ${SATACONTROLLER} -gt 0 ]; then
|
||||
echo "S \"DSM Sata PortMap \" " >>"${TMP_PATH}/menu"
|
||||
@ -1057,6 +1060,7 @@ else
|
||||
;;
|
||||
b) addonMenu; NEXT="b" ;;
|
||||
d) modulesMenu; NEXT="d" ;;
|
||||
g) governorMenu; NEXT="g" ;;
|
||||
e) ONLYVERSION="true" && arcVersion; NEXT="e" ;;
|
||||
S) storageMenu; NEXT="S" ;;
|
||||
P) storagepanelMenu; NEXT="P" ;;
|
||||
|
@ -43,6 +43,7 @@ initConfigKey "arc.custom" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.directboot" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.dsmlogo" "true" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.emmcboot" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.governor" "" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.hddsort" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.ipv6" "false" "${USER_CONFIG_FILE}"
|
||||
initConfigKey "arc.kernel" "official" "${USER_CONFIG_FILE}"
|
||||
|
@ -33,6 +33,7 @@ LKM="$(readConfigKey "lkm" "${USER_CONFIG_FILE}")"
|
||||
SN="$(readConfigKey "arc.sn" "${USER_CONFIG_FILE}")"
|
||||
LAYOUT="$(readConfigKey "layout" "${USER_CONFIG_FILE}")"
|
||||
KEYMAP="$(readConfigKey "keymap" "${USER_CONFIG_FILE}")"
|
||||
CPUGOVERNOR="$(readConfigKey "arc.governor" "${USER_CONFIG_FILE}")"
|
||||
HDDSORT="$(readConfigKey "arc.hddsort" "${USER_CONFIG_FILE}")"
|
||||
KERNEL="$(readConfigKey "kernel" "${USER_CONFIG_FILE}")"
|
||||
RD_COMPRESSED="$(readConfigKey "rd-compressed" "${USER_CONFIG_FILE}")"
|
||||
@ -162,12 +163,15 @@ echo "export KEYMAP=\"${KEYMAP}\"" >>"${RAMDISK_PATH}/addons/addons.sh"
|
||||
chmod +x "${RAMDISK_PATH}/addons/addons.sh"
|
||||
|
||||
# System Addons
|
||||
for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "updatenotify" "wol"; do
|
||||
for ADDON in "redpill" "revert" "misc" "eudev" "disks" "localrss" "notify" "updatenotify" "wol" "cpufreqscaling"; do
|
||||
PARAMS=""
|
||||
if [ "${ADDON}" == "disks" ]; then
|
||||
PARAMS=${HDDSORT}
|
||||
PARAMS=${HDDSORT:-"false"}
|
||||
[ -f "${USER_UP_PATH}/${MODEL}.dts" ] && cp -f "${USER_UP_PATH}/${MODEL}.dts" "${RAMDISK_PATH}/addons/model.dts"
|
||||
fi
|
||||
if [ "${ADDON}" == "cpufreqscaling" ]; then
|
||||
PARAMS=${CPUGOVERNOR:-"performance"}
|
||||
fi
|
||||
installAddon "${ADDON}" "${PLATFORM}" || exit 1
|
||||
echo "/addons/${ADDON}.sh \${1} ${PARAMS}" >>"${RAMDISK_PATH}/addons/addons.sh" 2>>"${LOG_FILE}" || exit 1
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user