Skip to content

Build from source ​

Requirements ​

  • JDK 21
  • Android SDK 37 with NDK 29
  • Rust with the aarch64-linux-android target
  • cargo-ndk

Manager ​

bash
cd manager
./gradlew :app:assembleRelease

The 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 ​

bash
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.so

The two traps in packing ksud ​

ksud embeds the eight prebuilt kernel modules with rust-embed, and both steps below are easy to get wrong:

  1. The modules must exist before the build. userspace/ksud/bin/.gitignore excludes **/*.ko, so a fresh clone has none. Fetch them from a KernelSU release, drop them into userspace/ksud/bin/aarch64/, then build. rust-embed is configured with compression, so after adding files you must rebuild from clean — an incremental build will not pick them up.

  2. Gradle strips them back out. stripReleaseDebugSymbols treats the embedded modules as debug data and removes ~1.4 MB. Keep them:

    kotlin
    packaging {
        jniLibs {
            keepDebugSymbols += "**/libksud.so"
        }
    }

Verify before shipping:

bash
ksud kernel supported-kmi   # should list eight KMIs

If it prints nothing, the APK will fail every LKM install with asset not found: <kmi>_kernelsu.ko.

Released under the GPL-3.0 License.