Hybrid Mount is a mount orchestration metamodule for KernelSU and APatch.
It merges module files into Android partitions with a hybrid strategy:
- OverlayFS when kernel/filesystem support is stable.
- Magic Mount (bind mount) as fallback or per-path override.
The runtime is designed for predictable boot behavior, conflict visibility, and policy-level control.
- Compatibility-first mounting across diverse Android kernels.
- Deterministic behavior through explicit planning and conflict analysis.
- Operational safety with recovery-friendly defaults.
- Automation-friendly CLI for WebUI or external controllers.
At startup, hybrid-mount follows this pipeline:
- Load config (file + CLI override).
- Scan module tree and inventory mountable entries.
- Generate an execution plan (overlay/magic/ignore).
- Apply mounts and persist runtime state.
- Emit diagnostics/conflict reports when requested.
Key implementation modules:
src/conf: config schema, loader, CLI handlers.src/core/inventory: module scanning and inventory modeling.src/core/ops: planning, execution, synchronization.src/mount: overlayfs + magic-mount backends.src/sys: filesystem/mount helpers and low-level integration.
.
├─ src/ # daemon/runtime implementation
├─ module/ # module scripts and packaging assets
├─ xtask/ # build/release automation commands
├─ tools/notify/ # optional helper binary
├─ Cargo.toml # workspace + runtime crate settings
└─ README*.md # user and developer docs
Default path: /data/adb/hybrid-mount/config.toml.
| Key | Type | Default | Description |
|---|---|---|---|
moduledir |
string | /data/adb/modules |
Module source directory. |
mountsource |
string | auto-detect | Runtime source tag (e.g. KSU, APatch). |
partitions |
list|csv string | [] |
Extra managed partitions. |
overlay_mode |
ext4 | tmpfs |
ext4 |
Overlay upper/work backing mode. |
disable_umount |
bool | false |
Skip unmount operations (debug-only). |
allow_umount_coexistence |
bool | false |
Allow coexistence with existing umount behavior. |
default_mode |
overlay | magic |
overlay |
Default policy for module paths. |
rules |
map | {} |
Per-module path-level mount policy. |
moduledir = "/data/adb/modules"
mountsource = "KSU"
partitions = ["system", "vendor"]
overlay_mode = "ext4"
disable_umount = false
allow_umount_coexistence = false
default_mode = "overlay"
[rules.my_module]
default_mode = "magic"
[rules.my_module.paths]
"system/bin/tool" = "overlay"
"vendor/lib64/libfoo.so" = "ignore"hybrid-mount [OPTIONS] [COMMAND]Global options:
-c, --config <PATH>custom config path-m, --moduledir <PATH>override module directory-s, --mountsource <SOURCE>override source tag-p, --partitions <CSV>override partition list
Subcommands:
gen-configgenerate config fileshow-configprint effective config JSONsave-config --payload <HEX_JSON>save config from WebUI payloadsave-module-rules --module <ID> --payload <HEX_JSON>update one module rule setmoduleslist detected modules
Prerequisites:
- Rust toolchain from
rust-toolchain.toml - Android NDK (recommended r27+)
- Node.js 20+ (only when building WebUI assets)
Build commands:
# full package
cargo run -p xtask -- build --release
# runtime only (skip web assets)
cargo run -p xtask -- build --release --skip-webuiArtifacts are produced under output/.
- If a bad config causes boot issues, regenerate a minimal config with
gen-configand reapply module rules incrementally. - For binary size optimization, prefer dependency feature trimming and release profile tuning before invasive refactors.
Licensed under GPL-3.0.