Refactoring Kconfig to optimize KernelSU-related configuration and simplify conditional dependency logic

This commit is contained in:
ShirkNeko
2025-04-19 14:02:12 +08:00
parent 6c2e67cd50
commit bd56bcf538

View File

@@ -1,60 +1,59 @@
menu "KernelSU" menu "KernelSU"
config KSU config KSU
tristate "KernelSU function support" tristate "KernelSU function support"
depends on OVERLAY_FS depends on OVERLAY_FS
default y default y
help help
Enable kernel-level root privileges on Android System. Enable kernel-level root privileges on Android System.
To compile as a module, choose M here: the To compile as a module, choose M here: the
module will be called kernelsu. module will be called kernelsu.
config KSU_DEBUG config KSU_DEBUG
bool "KernelSU debug mode" bool "KernelSU debug mode"
depends on KSU depends on KSU
default n default n
help help
Enable KernelSU debug mode. Enable KernelSU debug mode.
config KSU_MANUAL_HOOK config KSU_MANUAL_HOOK
bool "Manual hooking GKI kernels without kprobes" bool "Manual hooking GKI kernels without kprobes"
depends on KSU && KSU != m depends on KSU && KSU != m
depends on KPROBES default n
default y if KSU_GKI_KERNEL help
default n Keep KPROBES enabled but do not use KPROBES to implement
help the hooks required by KernelSU, but instead hook them manually.
Keep KPROBES enabled but do not use KPROBES to implement This function is automatically enabled for GKI kernels.
the hooks required by KernelSU, but instead hook them manually.
This function is automatically enabled for GKI kernels.
config KSU_GKI_KERNEL config KSU_GKI_KERNEL
bool bool
default y if (VERSION >= 5 && PATCHLEVEL >= 10) default y if (VERSION >= 5 && PATCHLEVEL >= 10)
help help
Internal flag to indicate whether the kernel is GKI. Internal flag to indicate whether the kernel is GKI.
config KSU_HOOK_KPROBES config KSU_HOOK_KPROBES
bool bool
default y if !KSU_MANUAL_HOOK depends on KPROBES
default n depends on KSU_GKI_KERNEL
help default y if !KSU_MANUAL_HOOK
Internal flag to indicate whether KPROBES should be used for hooking. help
Internal flag to indicate whether KPROBES should be used for hooking.
config KSU_ALLOWLIST_WORKAROUND config KSU_ALLOWLIST_WORKAROUND
bool "KernelSU Session Keyring Init workaround" bool "KernelSU Session Keyring Init workaround"
depends on KSU depends on KSU
default n default n
help help
Enable session keyring init workaround for problematic devices. Enable session keyring init workaround for problematic devices.
Useful for situations where the SU allowlist is not kept after a reboot Useful for situations where the SU allowlist is not kept after a reboot
config KPM config KPM
bool "Enable SukiSU KPM" bool "Enable SukiSU KPM"
default n default n
help help
Enabling this option will activate the KPM feature of SukiSU. Enabling this option will activate the KPM feature of SukiSU.
This option is suitable for scenarios where you need to force KPM to be enabled. This option is suitable for scenarios where you need to force KPM to be enabled.
but it may affect system stability. but it may affect system stability.
menu "KernelSU - SUSFS" menu "KernelSU - SUSFS"
config KSU_SUSFS config KSU_SUSFS