lkpatcher
serves as both a streamlined Python tool and module designed for the alteration and patching of LK (Little Kernel) images. The utility offers flexibility along with an intuitive API for ease of use. To use the library, Python 3.11 or higher is required. An alternative method of access is available via the new web version of the tool, which is not open-source but offers the same functionality and has a GUI.
sudo apt install python3-pip # If you don't have pip installed.
pip3 install --upgrade pip # If pip hasn't been updated yet.
pip3 install --upgrade git+https://github.com/R0rt1z2/lkpatcher
[!NOTE] Windows users should omit the first two command(s) and install python manually from here.
python3 -m lkpatcher [-h] [-o OUTPUT] [-j JSON] [-d DUMP_PARTITION] bootloader_image
[!NOTE] Arguments between
<>
are required, while arguments between[]
are optional.
You can also use the module in your own projects:
# Import the patcher class from the module. This should be enough to
# get you started, as it provides an API to apply patches to images.
from lkpatcher.patcher import LkPatcher
# Create the patcher object. When initializing the object, you MUST
# specify the path to the image you want to patch, and, optionally,
# the path to the JSON file containing the patches. If you don't
# specify a JSON file, the default one will be used.
patcher = LkPatcher(image='lk.img', patches='patches.json')
# Use the patcher object to apply patches to the image. The output
# parameter is optional, and, if not specified, the patched image
# will be saved as 'lk-patched.img'.
image = patcher.patch(output='lk-patched.bin')
expdb
partition using mtkclient and open a new issue here with the dump attached.image.txt
file generated by the tool.patches.json
file has sample patches applicable to various devices. These samples serve as reference material for the creation of your own device-specific patches.This project is licensed under the GPL-3.0 License - see the LICENSE file for details.