diff --git a/.github/workflows/crdroid-plus-kernel-build.yml b/.github/workflows/crdroid-plus-kernel-build.yml index 45e2c09..98cc582 100644 --- a/.github/workflows/crdroid-plus-kernel-build.yml +++ b/.github/workflows/crdroid-plus-kernel-build.yml @@ -437,6 +437,18 @@ jobs: fi fi + # CRITICAL FIX v39: FINAL umount fix - runs AFTER pre-patched file + # The pre-patched file still contains umount() calls that don't exist in kernel 4.9 + echo "=== CRITICAL FIX v39: FINAL aggressive umount -> sys_umount fix ===" + + if [ -f "$GITHUB_WORKSPACE/build-scripts/fix_kernelsu_49_v39.py" ]; then + echo "Running kernel 4.9 compatibility fix script v39 (FINAL)..." + KERNEL_DIR=~/kernel-build/android_kernel_oneplus_sdm845 python3 "$GITHUB_WORKSPACE/build-scripts/fix_kernelsu_49_v39.py" ~/kernel-build/android_kernel_oneplus_sdm845 + elif [ -f "$GITHUB_WORKSPACE/fix_kernelsu_49_v39.py" ]; then + echo "Running kernel 4.9 compatibility fix script v39 from repo root..." + KERNEL_DIR=~/kernel-build/android_kernel_oneplus_sdm845 python3 "$GITHUB_WORKSPACE/fix_kernelsu_49_v39.py" ~/kernel-build/android_kernel_oneplus_sdm845 + fi + # Verification: Show line 591 of core_hook.c to verify the fix echo "=== Verifying core_hook.c line 591 (flags fix) ===" CORE_HOOK_FILE=$(readlink -f drivers/kernelsu/core_hook.c 2>/dev/null || echo "") diff --git a/build-scripts/__pycache__/fix_kernelsu_49_v39.cpython-311.pyc b/build-scripts/__pycache__/fix_kernelsu_49_v39.cpython-311.pyc new file mode 100644 index 0000000..71900f4 Binary files /dev/null and b/build-scripts/__pycache__/fix_kernelsu_49_v39.cpython-311.pyc differ diff --git a/build-scripts/fix_kernelsu_49_v39.py b/build-scripts/fix_kernelsu_49_v39.py new file mode 100644 index 0000000..e79071f --- /dev/null +++ b/build-scripts/fix_kernelsu_49_v39.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python3 +""" +KernelSU-Next kernel 4.9 compatibility fix script v39 +FINAL FIX: Aggressive umount() -> sys_umount() replacement for kernel 4.9 + +Issue: The pre-patched core_hook.c.patched file contains umount() calls +which don't exist in kernel 4.9. This fix runs AFTER the pre-patched file +is applied to ensure all umount calls are replaced. + +This fix is designed to be the FINAL and MOST AGGRESSIVE fix. +""" + +import sys +import os +import re + +def aggressive_umount_fix(file_path): + """Aggressively replace all umount() calls with sys_umount()""" + + if not os.path.exists(file_path): + return False, "File not found" + + with open(file_path, 'r') as f: + content = f.read() + + original_content = content + changes = [] + + # Pattern 1: Direct umount(something) -> sys_umount(something, 0) + # This is the most common pattern causing the undefined reference + pattern1 = r'(? 1: + kernel_dir = sys.argv[1] + + if not kernel_dir: + print("Usage: KERNEL_DIR=/path/to/kernel python3 fix_kernelsu_49_v39.py [kernel_dir]") + sys.exit(1) + + print("=" * 60) + print("KernelSU-Next 4.9 Compatibility Fix v39 (FINAL)") + print("=" * 60) + print(f"Kernel directory: {kernel_dir}") + print("") + print("This fix aggressively replaces ALL umount() calls with sys_umount()") + print("It runs AFTER the pre-patched file is applied.") + print("") + + results = process_core_hook_files(kernel_dir) + + print("\n" + "=" * 60) + print("SUMMARY") + print("=" * 60) + + if results: + for path, fixed, _declared in results: + status = "FIXED" if fixed else "OK" + print(f" [{status}] {path}") + print("\nv39 fix applied. Build should now succeed.") + return 0 + + print(" WARNING: No core_hook.c files found!") + print(f" Searched in: {kernel_dir}") + return 1 + + +if __name__ == "__main__": + sys.exit(main())