Add kernel version and patch tool version log information

- Should fix the 5.10 bug where you can't swipe write

Signed-off-by: ShirkNeko 109797057+ShirkNeko@users.noreply.github.com
This commit is contained in:
ShirkNeko
2025-04-28 16:05:59 +08:00
parent a297e07055
commit bfdb706b60
5 changed files with 15 additions and 3 deletions

Binary file not shown.

View File

@@ -196,9 +196,17 @@ class HorizonKernelWorker(
}
private fun patch() {
val mkbootfsPath = "${context.filesDir.absolutePath}/mkbootfs"
AssetsUtil.exportFiles(context, "mkbootfs", mkbootfsPath)
runCommand(false, "sed -i '/chmod -R 755 tools bin;/i cp -f $mkbootfsPath \$AKHOME/tools;' $binaryPath")
val kernelVersion = runCommandGetOutput(true, "cat /proc/version")
val versionRegex = """\d+\.\d+\.\d+""".toRegex()
val version = versionRegex.find(kernelVersion)?.value ?: ""
val toolName = when {
version.startsWith("5.10.") -> "5_10"
else -> "5_15+"
}
val toolPath = "${context.filesDir.absolutePath}/mkbootfs"
AssetsUtil.exportFiles(context, "$toolName-mkbootfs", toolPath)
state.addLog("${context.getString(R.string.kernel_version_log, version)} ${context.getString(R.string.tool_version_log, toolName)}")
runCommand(false, "sed -i '/chmod -R 755 tools bin;/i cp -f $toolPath \$AKHOME/tools;' $binaryPath")
}
private fun flash() {

View File

@@ -295,4 +295,6 @@
<!-- lkm/gki install -->
<string name="Lkm_install_methods">LKM修补/安装</string>
<string name="GKI_install_methods">GKI安装</string>
<string name="kernel_version_log">内核版本:%1$s</string>
<string name="tool_version_log">使用修补工具:%1$s</string>
</resources>

View File

@@ -299,4 +299,6 @@
<!-- lkm/gki install -->
<string name="Lkm_install_methods">LKM repair/installation</string>
<string name="GKI_install_methods">GKI installation</string>
<string name="kernel_version_log">Kernel version%1$s</string>
<string name="tool_version_log">Using the patching tool%1$s</string>
</resources>