userspace: add susfsd to /data/adb/ksu/bin

This commit is contained in:
Rifat Azad
2025-01-02 20:40:42 +06:00
parent ef9b297148
commit bc88fbba3a
13 changed files with 55 additions and 50 deletions

View File

@@ -8,7 +8,7 @@ on:
- 'manager/**' - 'manager/**'
- 'kernel/**' - 'kernel/**'
- 'userspace/ksud/**' - 'userspace/ksud/**'
- 'userspace/susfs/**' - 'userspace/susfsd/**'
pull_request: pull_request:
branches: [ "next" ] branches: [ "next" ]
paths: paths:
@@ -21,8 +21,20 @@ jobs:
uses: ./.github/workflows/build-lkm.yml uses: ./.github/workflows/build-lkm.yml
secrets: inherit secrets: inherit
build-ksud: build-susfs:
needs: build-lkm needs: build-lkm
strategy:
matrix:
include:
- target: aarch64-linux-android
os: ubuntu-latest
uses: ./.github/workflows/susfsd.yml
with:
target: ${{ matrix.target }}
os: ${{ matrix.os }}
build-ksud:
needs: build-susfsd
strategy: strategy:
matrix: matrix:
include: include:
@@ -33,20 +45,8 @@ jobs:
target: ${{ matrix.target }} target: ${{ matrix.target }}
os: ${{ matrix.os }} os: ${{ matrix.os }}
build-susfs:
needs: build-ksud
strategy:
matrix:
include:
- target: aarch64-linux-android
os: ubuntu-latest
uses: ./.github/workflows/build-susfs.yml
with:
target: ${{ matrix.target }}
os: ${{ matrix.os }}
build-manager: build-manager:
needs: build-susfs needs: build-ksud
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults: defaults:
run: run:
@@ -82,26 +82,26 @@ jobs:
- name: Setup Android SDK - name: Setup Android SDK
uses: android-actions/setup-android@v3 uses: android-actions/setup-android@v3
- name: Download arm64 ksud
uses: actions/download-artifact@v4
with:
name: ksud-aarch64-linux-android
path: .
- name: Download arm64 susfs - name: Download arm64 susfs
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: susfs-aarch64-linux-android name: susfs-aarch64-linux-android
path: . path: .
- name: Copy ksud to app jniLibs - name: Download arm64 ksud
uses: actions/download-artifact@v4
with:
name: ksud-aarch64-linux-android
path: .
- name: Copy susfsd to app jniLibs
run: | run: |
mkdir -p app/src/main/jniLibs/arm64-v8a mkdir -p app/src/main/jniLibs/arm64-v8a
cp -f ../aarch64-linux-android/release/ksud ../manager/app/src/main/jniLibs/arm64-v8a/libksud.so cp -f ../arm64-v8a/susfsd ../manager/app/src/main/jniLibs/arm64-v8a/libsusfsd.so
- name: Copy susfs to app jniLibs - name: Copy ksud to app jniLibs
run: | run: |
cp -f ../arm64-v8a/susfs ../manager/app/src/main/jniLibs/arm64-v8a/libsusfs.so cp -f ../aarch64-linux-android/release/ksud ../manager/app/src/main/jniLibs/arm64-v8a/libksud.so
- name: Build with Gradle - name: Build with Gradle
run: | run: |

View File

@@ -32,6 +32,10 @@ jobs:
if: ${{ inputs.pack_lkm }} if: ${{ inputs.pack_lkm }}
run: | run: |
cp android*-lkm/*_kernelsu.ko ./userspace/ksud/bin/aarch64/ cp android*-lkm/*_kernelsu.ko ./userspace/ksud/bin/aarch64/
- name: Add susfsd lib
run: |
cp susfsd-aarch64-linux-android/arm64-v8a/susfsd ./userspace/ksud/bin/aarch64/
- name: Setup rustup - name: Setup rustup
run: | run: |

View File

@@ -3,8 +3,8 @@ on:
push: push:
branches: [ "next" ] branches: [ "next" ]
paths: paths:
- '.github/workflows/build-susfs.yml' - '.github/workflows/susfsd.yml'
- 'userspace/susfs/**' - 'userspace/susfsd/**'
workflow_dispatch: workflow_dispatch:
workflow_call: workflow_call:
inputs: inputs:
@@ -17,18 +17,18 @@ on:
default: ubuntu-latest default: ubuntu-latest
jobs: jobs:
build-susfs: build-susfs:
name: Build userspace susfs name: Build userspace susfsd
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Build susfs - name: Build susfsd
working-directory: ./userspace/susfs working-directory: ./userspace/susfs
run: $ANDROID_NDK/ndk-build run: $ANDROID_NDK/ndk-build
- name: Upload a Build Artifact - name: Upload a Build Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: susfs-aarch64-linux-android name: susfs-aarch64-linux-android
path: ./userspace/susfs/libs path: ./userspace/susfsd/libs

View File

@@ -69,16 +69,16 @@ class MainActivity : ComponentActivity() {
val isManager = Natives.becomeManager(ksuApp.packageName) val isManager = Natives.becomeManager(ksuApp.packageName)
if (isManager) install() if (isManager) install()
val prefs = getSharedPreferences("settings", MODE_PRIVATE) // val prefs = getSharedPreferences("settings", MODE_PRIVATE)
val isSUS_SU = getSuSFSFeatures() // val isSUS_SU = getSuSFSFeatures()
if (isSUS_SU == "CONFIG_KSU_SUSFS_SUS_SU") { // if (isSUS_SU == "CONFIG_KSU_SUSFS_SUS_SU") {
if (prefs.getBoolean("enable_sus_su", false)) { // if (prefs.getBoolean("enable_sus_su", false)) {
if (susfsSUS_SU_Mode() != "2") { // if (susfsSUS_SU_Mode() != "2") {
susfsSUS_SU_2() // susfsSUS_SU_2()
} // }
} // }
} // }
setContent { setContent {
KernelSUTheme { KernelSUTheme {

View File

@@ -120,48 +120,48 @@ fun getModuleCount(): Int {
}.getOrElse { return 0 } }.getOrElse { return 0 }
} }
private fun getSuSFSPath(): String { private fun getSuSFSDaemonPath(): String {
return ksuApp.applicationInfo.nativeLibraryDir + File.separator + "libsusfs.so" return ksuApp.applicationInfo.nativeLibraryDir + File.separator + "libsusfsd.so"
} }
fun getSuSFS(): String { fun getSuSFS(): String {
val shell = getRootShell() val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} support") val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} support")
return result return result
} }
fun getSuSFSVersion(): String { fun getSuSFSVersion(): String {
val shell = getRootShell() val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} version") val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} version")
return result return result
} }
fun getSuSFSVariant(): String { fun getSuSFSVariant(): String {
val shell = getRootShell() val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} variant") val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} variant")
return result return result
} }
fun getSuSFSFeatures(): String { fun getSuSFSFeatures(): String {
val shell = getRootShell() val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} features") val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} features")
return result return result
} }
fun susfsSUS_SU_0(): String { fun susfsSUS_SU_0(): String {
val shell = getRootShell() val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} sus_su 0") val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} sus_su 0")
return result return result
} }
fun susfsSUS_SU_2(): String { fun susfsSUS_SU_2(): String {
val shell = getRootShell() val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} sus_su 2") val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} sus_su 2")
return result return result
} }
fun susfsSUS_SU_Mode(): String { fun susfsSUS_SU_Mode(): String {
val shell = getRootShell() val shell = getRootShell()
val result = ShellUtils.fastCmd(shell, "${getSuSFSPath()} sus_su mode") val result = ShellUtils.fastCmd(shell, "${getSuSFSDaemonPath()} sus_su mode")
return result return result
} }

BIN
userspace/ksud/bin/aarch64/susfsd Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -8,6 +8,7 @@ use crate::{defs::BINARY_DIR, utils};
pub const RESETPROP_PATH: &str = concatcp!(BINARY_DIR, "resetprop"); pub const RESETPROP_PATH: &str = concatcp!(BINARY_DIR, "resetprop");
pub const BUSYBOX_PATH: &str = concatcp!(BINARY_DIR, "busybox"); pub const BUSYBOX_PATH: &str = concatcp!(BINARY_DIR, "busybox");
pub const BOOTCTL_PATH: &str = concatcp!(BINARY_DIR, "bootctl"); pub const BOOTCTL_PATH: &str = concatcp!(BINARY_DIR, "bootctl");
pub const SUSFSD_PATH: &str = concatcp!(BINARY_DIR, "susfsd");
#[cfg(all(target_arch = "x86_64", target_os = "android"))] #[cfg(all(target_arch = "x86_64", target_os = "android"))]
#[derive(RustEmbed)] #[derive(RustEmbed)]

View File

@@ -1,6 +1,6 @@
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := susfs LOCAL_MODULE := susfsd
LOCAL_SRC_FILES := susfs.c LOCAL_SRC_FILES := susfsd.c
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)