This is a simple Python script that applies a binary patch to the given kernel image. Its purpose is to revert the BPF commit introduced by MTK, which indirectly broke arraymap while attempting to fix ubsan errors. The specified commit, caused connectivity issues on Android 12 based ROMs.
The patch applied by this script is quite simple. It just NOPs the offending code, in order to allow the memcpy()
call to be executed.
4.14.X
and 4.19.X
based kernel(s).sudo apt install python3-pip
pip3 install --upgrade git+https://github.com/R0rt1z2/mtk-bpf-patcher
Requires Windows Terminal or PowerShell.
# (Requires privileges - start Terminal/PowerShell as administrator)
Invoke-WebRequest https://raw.githubusercontent.com/R0rt1z2/mtk-bpf-patcher/master/Install.ps1 -OutFile .\Install.ps1; .\Install.ps1
usage: mtk-bpf-patcher [-h] [-l LOG_FILE] [-d] input_file output_file
positional arguments:
input_file The input file
output_file The output file
options:
-h, --help show this help message and exit
-l LOG_FILE, --log_file LOG_FILE
The log file
-d, --debug Enable debug mode