Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
392 changes: 297 additions & 95 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ suspend fun getFeaturePersistValue(feature: String): Long? = withContext(Dispatc

fun install() {
val start = SystemClock.elapsedRealtime()
val magiskboot = File(ksuApp.applicationInfo.nativeLibraryDir, "libmagiskboot.so").absolutePath
val libadbroot = File(ksuApp.applicationInfo.nativeLibraryDir, "libadbroot.so").absolutePath
val result = execKsud("install --magiskboot $magiskboot --libadbroot $libadbroot", true)
val result = execKsud("install --libadbroot $libadbroot", true)
Log.w(TAG, "install result: $result, cost: ${SystemClock.elapsedRealtime() - start}ms")
}

Expand Down Expand Up @@ -241,16 +240,14 @@ fun runModuleAction(
fun restoreBoot(
onStdout: (String) -> Unit, onStderr: (String) -> Unit
): FlashResult {
val magiskboot = File(ksuApp.applicationInfo.nativeLibraryDir, "libmagiskboot.so")
val result = flashWithIO("${getKsuDaemonPath()} boot-restore -f --magiskboot $magiskboot", onStdout, onStderr)
val result = flashWithIO("${getKsuDaemonPath()} boot-restore -f", onStdout, onStderr)
return FlashResult(result)
}

fun uninstallPermanently(
onStdout: (String) -> Unit, onStderr: (String) -> Unit
): FlashResult {
val magiskboot = File(ksuApp.applicationInfo.nativeLibraryDir, "libmagiskboot.so")
val result = flashWithIO("${getKsuDaemonPath()} uninstall --magiskboot $magiskboot --package-name ${BuildConfig.APPLICATION_ID}", onStdout, onStderr)
val result = flashWithIO("${getKsuDaemonPath()} uninstall --package-name ${BuildConfig.APPLICATION_ID}", onStdout, onStderr)
return FlashResult(result)
}

Expand Down Expand Up @@ -289,8 +286,7 @@ fun installBoot(
}
}

val magiskboot = File(ksuApp.applicationInfo.nativeLibraryDir, "libmagiskboot.so")
var cmd = "boot-patch --magiskboot ${magiskboot.absolutePath}"
var cmd = "boot-patch"

cmd += if (bootFile == null) {
// no boot.img, use -f to flash
Expand Down
Binary file not shown.
7 changes: 5 additions & 2 deletions userspace/ksud/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ rust-embed = { version = "8", features = [
"compression", # must clean build after updating binaries
] }
which = "8"
sha1 = "0.10"
sha1 = "0.11"
base16ct = { version = "0.2", features = ["alloc"] }
sha256 = "1"
tempfile = "3"
chrono = "0.4"
regex-lite = "0.1"
memmap2 = "0.9"
android-bootimg = { git = "https://github.com/5ec1cff/android_bootimg", rev = "ae9c67a69cdcb1fdbdce523a09bcdd3b085a210b" }

Comment thread
5ec1cff marked this conversation as resolved.
[target.'cfg(target_os = "android")'.dependencies]
rustix = { version = "1", features = [
Expand Down Expand Up @@ -56,4 +59,4 @@ adb_client = { git = "https://github.com/Kernel-SU/adb_client" }
prop-rs-android = { git = "https://github.com/Kernel-SU/ksu_props" }

[build-dependencies]
bindgen = "0.71.0"
bindgen = "0.72"
9 changes: 4 additions & 5 deletions userspace/ksud/src/assets.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use anyhow::Result;
use rust_embed::RustEmbed;
use std::path::Path;

#[cfg(target_os = "android")]
mod android {
Expand Down Expand Up @@ -47,15 +46,15 @@ struct Asset;
#[folder = "bin/aarch64"]
struct Asset;

#[allow(unused)]
pub fn get_asset_data(name: &str) -> Result<std::borrow::Cow<'static, [u8]>> {
let asset = Asset::get(name).ok_or_else(|| anyhow::anyhow!("asset not found: {name}"))?;
Ok(asset.data)
}
Comment thread
5ec1cff marked this conversation as resolved.

pub fn copy_assets_to_file(name: &str, dst: impl AsRef<Path>) -> Result<()> {
let data = get_asset_data(name)?;
std::fs::write(dst, &*data)?;
Ok(())
pub fn get_asset(name: &str) -> Result<Box<dyn AsRef<[u8]>>> {
let asset = Asset::get(name).ok_or_else(|| anyhow::anyhow!("asset not found: {name}"))?;
Ok(Box::new(asset.data))
}

pub fn list_supported_kmi() -> std::vec::Vec<std::string::String> {
Expand Down
Loading