中文: README_ZH.md
GhostLock matches kernels by exact uname -r. When nothing matches, the app
refuses to run. Supporting a new kernel usually needs no code change, only a
profile (a HOCON config file) for that kernel.
Only kernel geometry (symbol and struct offsets) is required.
recommend_shizuku and the retry/wait values under execution are
suggestions: a profile may omit them and the shipped default applies. See
Shared execution defaults.
- A target device reachable over
adb, or a firmware package matching it. - A working build:
./gradlew :app:assembleDebugsucceeds. - The extraction tool builds (
tools/extract_rs, Rust).
Built-in profiles live in app/src/main/assets/kernel_profiles/:
index.conf: the list of built-in kernels. New profiles must be added here.<uname-r>.conf: one complete profile per kernel. Thereleaseentry inindex.confmust matchuname -rexactly, and the file is named after it.execution-tuning.conf: tuning shared by every kernel.execution-<route>.conf: tuning for one attack route. The resolver loads these presets; device profiles don'tincludethem.credential-6x.conf,kernelsnitch-6x.conf: credential template and KernelSnitch values shared by 6.x kernels.*-template.conf: annotated reference templates. You can load them from the debug page, but they never participate in device matching.docs/kernel_profiles/templates/: templates grouped by kernel family.
All of these parse as HOCON (Typesafe Config): # comments, ${?variables},
trailing commas, and include "file.conf" (relative to the same directory,
nestable). JSON is valid HOCON, so nothing needs converting.
Field meanings, the required-field matrix, and validation rules are in the Profile schema.
-
Identify the kernel version. Run
adb shell uname -rand keep the complete string. Any character difference makes matching fail. -
Pick a template. Open the document for the kernel family: 5.x, 6.1, 6.6, 6.12.
-
Copy it into a new profile. Copy the template to
app/src/main/assets/kernel_profiles/<uname-r>.conf. The file name must matchrelease, then fill in the required fields. -
Extract the offsets.
(cd tools/extract_rs && cargo build --release) build/extract/release/ghostlock-extract boot.img --format conf --out profile.conf--format confwrites a flattened, self-contained profile with noincludelines and the 6.x credential/KernelSnitch constants inlined. It writes every field of the selected route and the shared geometry, using explicitnullfor unavailable values and never borrowing a neighbouring kernel family's guesses. Treat the result as a candidate seed: the app validates missing fields after import and blocks execution, so a successful generation does not mean the profile is usable. On 5.x the tool also derives the credential reference repair and the multicast geometry from the image and its BTF.The tool accepts a
boot.img(optionally withxbl_config.img), a complete OTA zip, or anhttp(s)URL pointing at one. Pass--kallsymsto supply a symbol table explicitly, or omit it to recover the image's embedded table.pselect_waiter_shiftandoff_slide_loggers_0_1come from the built-in arm64 disassembler, and the route is suggested from kernel evidence (--routeoverrides it). For MediaTek physical addresses, pass--vendor-boot vendor_boot.imgor--iomem iomem.txt. The vendor header supplies the load address and, when proven by alignment, the DRAM base. An iomem dump supplies the DRAM base and theKernel coderange needed with kallsyms to derive the load address._textalone is insufficient.--physsupplies an explicit load address, not the DRAM base. -
Transcribe field by field, then check your work. Field meanings and requirements are in the Profile schema. Confirm every required
off_*is non-zero and that the task/cred layout comes from the same image. Setrecommend_shizukuas needed (default0; some shipped profiles set1). -
Change
executiononly with device evidence. Otherwise keep the shared defaults. You can try values on the in-app override page before writing them back. -
Register it in
index.conf. Add a{release, file}entry, then validate and build:jq . app/src/main/assets/kernel_profiles/index.conf (cd tools/extract_rs && cargo test) ./gradlew clean :app:assembleDebug
-
Verify on a real device. Install with
./gradlew installDebugand test repeatedly in the same environment, on fixed cores, with a single attack route. Let the device cool down first so CPU throttling doesn't skew the results. Don't mark a new profile as supported until it passes on-device verification.
You don't have to edit assets and reinstall the app for every tweak. Two override layers apply immediately and take part in the next run:
- Parameter override page: adjust
execution.*tuning, such as attempt counts, wait/timeout values, and core selection. - Advanced override page: change
route/fallback.toand any numeric path (stored as sparse HOCON). Useful for trying new offsets or geometry.
Export config writes the fully merged HOCON to a folder you pick (SAF), so you can use it as the starting point for a new profile.
Overrides are saved per release and take priority over the built-in profile and imported offsets. Section 7 of the Profile schema lists the layer order and storage locations. Adding a kernel to the built-in set still follows the steps above and commits to assets.
off_* = 0in a template is a symbol offset relative to the kernel image base; you must extract the real value.- A wrong task/cred/multicast layout can corrupt arbitrary kernel memory, blank the screen, or reboot the device.
- Raising
executionattempt counts or shortening waits increases heat and can lower the success rate. - Don't submit a new profile as supported before it passes on-device verification.