From bd56bcf5382c1b2122f1e71207b6fa0b5861609f Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Sat, 19 Apr 2025 14:02:12 +0800 Subject: [PATCH] Refactoring Kconfig to optimize KernelSU-related configuration and simplify conditional dependency logic --- kernel/Kconfig | 83 +++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/kernel/Kconfig b/kernel/Kconfig index 33a3a1f2..da717d45 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -1,60 +1,59 @@ menu "KernelSU" config KSU - tristate "KernelSU function support" - depends on OVERLAY_FS - default y - help - Enable kernel-level root privileges on Android System. - To compile as a module, choose M here: the - module will be called kernelsu. + tristate "KernelSU function support" + depends on OVERLAY_FS + default y + help + Enable kernel-level root privileges on Android System. + To compile as a module, choose M here: the + module will be called kernelsu. config KSU_DEBUG - bool "KernelSU debug mode" - depends on KSU - default n - help - Enable KernelSU debug mode. + bool "KernelSU debug mode" + depends on KSU + default n + help + Enable KernelSU debug mode. config KSU_MANUAL_HOOK - bool "Manual hooking GKI kernels without kprobes" - depends on KSU && KSU != m - depends on KPROBES - default y if KSU_GKI_KERNEL - default n - help - Keep KPROBES enabled but do not use KPROBES to implement - the hooks required by KernelSU, but instead hook them manually. - This function is automatically enabled for GKI kernels. + bool "Manual hooking GKI kernels without kprobes" + depends on KSU && KSU != m + default n + help + Keep KPROBES enabled but do not use KPROBES to implement + the hooks required by KernelSU, but instead hook them manually. + This function is automatically enabled for GKI kernels. config KSU_GKI_KERNEL - bool - default y if (VERSION >= 5 && PATCHLEVEL >= 10) - help - Internal flag to indicate whether the kernel is GKI. + bool + default y if (VERSION >= 5 && PATCHLEVEL >= 10) + help + Internal flag to indicate whether the kernel is GKI. config KSU_HOOK_KPROBES - bool - default y if !KSU_MANUAL_HOOK - default n - help - Internal flag to indicate whether KPROBES should be used for hooking. + bool + depends on KPROBES + depends on KSU_GKI_KERNEL + default y if !KSU_MANUAL_HOOK + help + Internal flag to indicate whether KPROBES should be used for hooking. config KSU_ALLOWLIST_WORKAROUND - bool "KernelSU Session Keyring Init workaround" - depends on KSU - default n - help - Enable session keyring init workaround for problematic devices. - Useful for situations where the SU allowlist is not kept after a reboot + bool "KernelSU Session Keyring Init workaround" + depends on KSU + default n + help + Enable session keyring init workaround for problematic devices. + Useful for situations where the SU allowlist is not kept after a reboot config KPM - bool "Enable SukiSU KPM" - default n - help - 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. - but it may affect system stability. + bool "Enable SukiSU KPM" + default n + help + 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. + but it may affect system stability. menu "KernelSU - SUSFS" config KSU_SUSFS