diff --git a/UotanToolbox/Common/BootPatchHelper.cs b/UotanToolbox/Common/BootPatchHelper.cs
index b7c6c6f1..ebf13860 100644
--- a/UotanToolbox/Common/BootPatchHelper.cs
+++ b/UotanToolbox/Common/BootPatchHelper.cs
@@ -7,6 +7,7 @@
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
+using System.Threading;
using System.Threading.Tasks;
using UotanToolbox.Features.Components;
@@ -174,7 +175,7 @@ public static void dtb_detect()
///
/// 检测Boot文件夹下是否存在kernel文件
///
- public static async Task kernel_detect()
+ public static void kernel_detect()
{
if (File.Exists(Path.Combine(BootInfo.tmp_path, "kernel")))
{
@@ -212,9 +213,20 @@ public static async Task ramdisk_detect()
Directory.CreateDirectory(workpath);
}
(string outputcpio, Global.cpio_exitcode) = await CallExternalProgram.MagiskBoot($"cpio \"{cpio_file}\" extract", workpath);
- string initPath = await CheckInitPath(ramdisk_path);
+ string initPath = Path.Combine(ramdisk_path,"init");
string init_info = await CallExternalProgram.File($"\"{initPath}\"");
(BootInfo.userful, BootInfo.arch) = ArchDetect(init_info);
+ if (!BootInfo.userful)
+ {
+ string tmp_initPath = await read_symlink(initPath);
+ initPath = Path.Join(ramdisk_path,tmp_initPath);
+ init_info = await CallExternalProgram.File($"\"{initPath}\"");
+ (BootInfo.userful, BootInfo.arch) = ArchDetect(init_info);
+ if (!BootInfo.userful)
+ {
+ return false;
+ }
+ }
}
return true;
}
@@ -342,7 +354,7 @@ public static bool CleanBoot(string path)
}
}
///
- /// 检查路径下的init文件的实际路径,跳读字节流实现软连接读取
+ /// 检查路径下的init文件的实际路径,跳读字节流实现软连接读取,在Linux和Darwin平台上貌似无法正常运行,暂时弃置
///
/// ramdisk解包路径
/// 如果前9个字节与目标序列匹配则返回true,否则返回false。
diff --git a/UotanToolbox/Features/Dashboard/DashboardView.axaml.cs b/UotanToolbox/Features/Dashboard/DashboardView.axaml.cs
index 93e1519d..4ad1fc62 100644
--- a/UotanToolbox/Features/Dashboard/DashboardView.axaml.cs
+++ b/UotanToolbox/Features/Dashboard/DashboardView.axaml.cs
@@ -424,7 +424,7 @@ private async void OpenBootFile(object sender, RoutedEventArgs args)
BootInfo.os_version = StringHelper.StringRegex(mb_output, osVersionPattern, 1);
BootInfo.patch_level = StringHelper.StringRegex(mb_output, osPatchLevelPattern, 1);
BootPatchHelper.dtb_detect();
- await BootPatchHelper.kernel_detect();
+ BootPatchHelper.kernel_detect();
await BootPatchHelper.ramdisk_detect();
SukiHost.ShowDialog(new PureDialog($"{GetTranslation("Basicflash_DetectdBoot")}\nArch:{BootInfo.arch}\nOS:{BootInfo.os_version}\nPatch_level:{BootInfo.patch_level}\nRamdisk:{BootInfo.have_ramdisk}\nKMI:{BootInfo.kmi}"), allowBackgroundClose: true);
ArchList.SelectedItem = BootInfo.arch;