mirror of
https://github.com/okhsunrog/vpnhide.git
synced 2026-04-30 15:41:44 +00:00
refactor: overhaul kmod build system, fix kernel module bugs
Build system: - Replace hardcoded paths in Makefile with env vars (KERNEL_SRC, CLANG_DIR) - Add .env.example and .envrc for direnv-based config - Simplify build-zip.sh to delegate to make instead of duplicating build command - Rewrite BUILDING.md: 5-step happy path with direnv, standalone prep as appendix - Remove redundant quick-reference script and step 7 (manual module.lds hack) Kernel module (vpnhide_kmod.c): - Fix fib_route_seq_show hook: save seq_file pointer and buffer position in entry handler instead of reading regs->regs[0] in return handler (which holds the return value on arm64, not the original argument). Rewrite buffer scanning as clean forward iteration with memmove compaction. - Remove dead SIOCGIFCONF case from dev_ioctl hook (confirmed in kernel source: SIOCGIFCONF goes through sock_ioctl -> dev_ifconf, not dev_ioctl on GKI 6.1) - Fix header comment: remove false tcp4_seq_show claim, correct rtnl symbol name Test app: - Auto-run checks on launch (LaunchedEffect) for easier adb-driven testing
This commit is contained in:
parent
60b3235dc0
commit
e35cf1a6b9
8 changed files with 277 additions and 305 deletions
|
|
@ -3,21 +3,10 @@ set -euo pipefail
|
|||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# Build the kernel module if .ko is not fresh
|
||||
KSRC="${KSRC:-$HOME/tmp_zfs/kernel_build/kernel-source}"
|
||||
CLANG="${CLANG:-$HOME/Android/Sdk/ndk/29.0.14033849/toolchains/llvm/prebuilt/linux-x86_64/bin}"
|
||||
|
||||
# Build the kernel module (env vars loaded by direnv from .env)
|
||||
if [ ! -f vpnhide_kmod.ko ] || [ vpnhide_kmod.c -nt vpnhide_kmod.ko ]; then
|
||||
echo "Building kernel module..."
|
||||
make -C "$KSRC" M=$(pwd) \
|
||||
ARCH=arm64 LLVM=1 LLVM_IAS=1 \
|
||||
CC=$CLANG/clang LD=$CLANG/ld.lld \
|
||||
AR=$CLANG/llvm-ar NM=$CLANG/llvm-nm \
|
||||
OBJCOPY=$CLANG/llvm-objcopy \
|
||||
OBJDUMP=$CLANG/llvm-objdump \
|
||||
STRIP=$CLANG/llvm-strip \
|
||||
CROSS_COMPILE=aarch64-linux-gnu- \
|
||||
modules
|
||||
make
|
||||
fi
|
||||
|
||||
cp vpnhide_kmod.ko module/vpnhide_kmod.ko
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue