How caremeos-dev/kernelpatch works
KernelPatch modifies Linux kernels from stripped images, either by producing static image patches or by loading an LKM for runtime changes. The runtime path initializes symbol and memory support, installs hooks and a syscall supercall channel, then exposes KPM loading and Android SU features. The README also documents symbol discovery and inline/syscall hooks. Relationships for unsampled subsystems are included only where documented; dashed links mark workflows implied by the product description rather than verified in the excerpts.
Main entry points: init.c LKM initialization · patch.c Static image patch · dispatch.c Supercall dispatch · hook.c Hook relocation
Components 22
Image analysis
- Symbol discovery
tools/kallsym.c - Image mapping
kernel/arm/map.c
Static patching
- Static image patch
tools/patch.c - Hook relocation
kernel/base/hook.c - Kernel setup
kernel/base/setup.h - Kernel presets
kernel/include/preset.h - LZ4 compression
tools/lib/lz4/lz4.c
Runtime kernel
- LKM initialization
lkm/core/init.c - Symbol resolver
lkm/infra/symbol_resolver.h - Patch memory
lkm/infra/patch_memory.h - Hook runtime
lkm/hook/hook_runtime.c - Hook engine
lkm/hook/hook_engine.c - Syscall table
lkm/infra/syscall_table.h
Kernel features
- KPM loader
lkm/kpm/module.c - Trusted manager scan
lkm/manager/manager.c - Kernel key storage
lkm/supercall/kstorage.c - Android SU access
lkm/supercall/su.c
User interface
- Supercall dispatch
lkm/supercall/dispatch.c - Userspace CLI
user_deprecated/main.c
Other components
- Operator
- Stripped kernel image
- Linux kernel
Connections 29
- Operator → Stripped kernel image: provides
README.md - Stripped kernel image → Symbol discovery: scans symbols
README.md - Symbol discovery → Image mapping: informs mapping
- Image mapping → Static image patch: maps image
- Static image patch → Stripped kernel image: patches image
README.md - Static image patch → Hook relocation: uses relocations
- Static image patch → Kernel setup: configures
- Kernel setup → Kernel presets: uses presets
kernel/base/setup.h - Static image patch → LZ4 compression: compresses data
- Operator → LKM initialization: loads module
README.md - LKM initialization → Symbol resolver: initializes
lkm/core/init.c - LKM initialization → Syscall table: initializes
lkm/core/init.c - LKM initialization → Patch memory: initializes
lkm/core/init.c - LKM initialization → Hook runtime: initializes
lkm/core/init.c - Hook runtime → Hook engine: uses engine
- Hook engine → Hook relocation: reuses code
lkm/hook/hook_engine.c - LKM initialization → KPM loader: initializes
lkm/core/init.c - LKM initialization → Supercall dispatch: installs channel
lkm/core/init.c - LKM initialization → Trusted manager scan: initializes
lkm/core/init.c - LKM initialization → Kernel key storage: initializes
lkm/core/init.c - LKM initialization → Android SU access: initializes hooks
lkm/core/init.c - Userspace CLI → Supercall dispatch: sends commands
README.md - Supercall dispatch → KPM loader: dispatches KPM
- Supercall dispatch → Kernel key storage: dispatches storage
- Supercall dispatch → Android SU access: dispatches SU
- Trusted manager scan → Linux kernel: reads app metadata
lkm/manager/manager.c - LKM initialization → Linux kernel: runs in
lkm/core/init.c - Hook relocation → Linux kernel: hooks functions
README.md - Syscall table → Linux kernel: hooks syscalls
README.md