Skip to content

Commit 1ad3580

Browse files
committed
Revert "Extract kernel .ko from APK and ksud"
This reverts commit 55daaa1.
1 parent 1130c95 commit 1ad3580

2 files changed

Lines changed: 3 additions & 37 deletions

File tree

UotanToolbox/Common/PatchHelper/KernelSUPatch.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,11 @@ public static async Task<string> LKM_Patch(PatchInfo zipInfo, BootInfo bootInfo)
4444
}
4545

4646
string koPath = Path.Combine(zipInfo.TempPath, "kernelsu.ko");
47-
if (zipInfo.Path.EndsWith(".apk", StringComparison.OrdinalIgnoreCase))
48-
{
49-
string extractedKo = KsuAssetExtractor.ExtractKoFromApk(zipInfo.Path, zipInfo.TempPath, bootInfo.Arch, bootInfo.KMI);
50-
if (!string.IsNullOrEmpty(extractedKo))
51-
{
52-
koPath = extractedKo;
53-
}
54-
}
55-
else
47+
if (!File.Exists(koPath))
5648
{
57-
string[] ksuFiles = Directory.GetFiles(zipInfo.TempPath, "libksud.so", SearchOption.AllDirectories);
58-
if (ksuFiles.Length > 0)
49+
if (zipInfo.Path.EndsWith(".apk", StringComparison.OrdinalIgnoreCase))
5950
{
60-
string extractedKo = KsuAssetExtractor.ExtractKoFromKsudFile(ksuFiles[0], zipInfo.TempPath, bootInfo.KMI);
51+
string extractedKo = KsuAssetExtractor.ExtractKoFromApk(zipInfo.Path, zipInfo.TempPath, bootInfo.Arch, bootInfo.KMI);
6152
if (!string.IsNullOrEmpty(extractedKo))
6253
{
6354
koPath = extractedKo;

UotanToolbox/Common/PatchHelper/KsuAssetExtractor.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,6 @@ public static string ExtractKoFromApk(string apkPath, string outputDir, string a
6161
return null;
6262
}
6363

64-
public static string ExtractKoFromKsudFile(string ksudPath, string outputDir, string kernelVersion)
65-
{
66-
if (!File.Exists(ksudPath)) return null;
67-
byte[] data = File.ReadAllBytes(ksudPath);
68-
var extractedFiles = ProcessData(data, outputDir);
69-
70-
if (!string.IsNullOrEmpty(kernelVersion))
71-
{
72-
var match = extractedFiles.Keys.FirstOrDefault(k => k.EndsWith(".ko") && k.Contains(kernelVersion));
73-
if (match != null)
74-
{
75-
return Path.Combine(outputDir, match);
76-
}
77-
78-
throw new Exception(string.Format(FeaturesHelper.GetTranslation("Patch_KSUKoNotFound"), kernelVersion));
79-
}
80-
81-
var koFile = extractedFiles.Keys.FirstOrDefault(k => k.EndsWith(".ko"));
82-
if (koFile != null)
83-
{
84-
return Path.Combine(outputDir, koFile);
85-
}
86-
return null;
87-
}
88-
8964
public static bool IsKsudHaveKo(string ksudPath)
9065
{
9166
try

0 commit comments

Comments
 (0)