Build from source
Requirements
- JDK 21
- Android SDK 37 with NDK 29
- Rust with the
aarch64-linux-androidtarget cargo-ndk
Manager
cd manager
./gradlew :app:assembleReleaseThe APK lands in manager/app/build/outputs/apk/release/.
The manager build requires a libksud.so in app/src/main/jniLibs/arm64-v8a/. See below.
ksud
export LIBCLANG_PATH="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/<host>/bin"
export PATH="$LIBCLANG_PATH:$PATH"
cargo ndk -t arm64-v8a --platform 26 build --release --manifest-path userspace/ksud/Cargo.toml
cp target/aarch64-linux-android/release/ksud manager/app/src/main/jniLibs/arm64-v8a/libksud.soThe two traps in packing ksud
ksud embeds the eight prebuilt kernel modules with rust-embed, and both steps below are easy to get wrong:
The modules must exist before the build.
userspace/ksud/bin/.gitignoreexcludes**/*.ko, so a fresh clone has none. Fetch them from a KernelSU release, drop them intouserspace/ksud/bin/aarch64/, then build.rust-embedis configured withcompression, so after adding files you must rebuild from clean — an incremental build will not pick them up.Gradle strips them back out.
stripReleaseDebugSymbolstreats the embedded modules as debug data and removes ~1.4 MB. Keep them:kotlinpackaging { jniLibs { keepDebugSymbols += "**/libksud.so" } }
Verify before shipping:
ksud kernel supported-kmi # should list eight KMIsIf it prints nothing, the APK will fail every LKM install with asset not found: <kmi>_kernelsu.ko.