# Where to Find a Detailed Breakdown of Binary Patches in vphone-cli

> Find a detailed breakdown of binary patches for vphone-cli in the GitHub repository's research folder. Explore byte-level modifications across all custom firmware variants.

- Repository: [Lakr/vphone-cli](https://github.com/Lakr233/vphone-cli)
- Tags: api-reference
- Published: 2026-09-10

---

**The detailed breakdown of binary patches in vphone-cli is maintained in [`research/0_binary_patch_comparison.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/0_binary_patch_comparison.md), which catalogs every byte-level modification applied to the custom firmware across all build variants.**

The vphone-cli repository provides a complete toolchain for building and modifying custom firmware (CFW) for virtual phone environments. Understanding the exact binary modifications applied during the build process is critical for security auditing and development. The project maintains authoritative documentation that maps every patch to its source implementation and build system integration.

## The Master Patch Documentation

The canonical source for binary patch analysis is **[`research/0_binary_patch_comparison.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/0_binary_patch_comparison.md)**. This markdown file serves as a line-by-line comparison of every binary modification applied to the firmware.

The document categorizes patches into distinct groups:

- **Stand-alone binary patches**: Six discrete files that modify the device’s rootfs directly, independent of the main firmware image
- **CFW binary patches by variant**: Separate patch sets for base, development, jailbreak, and experimental firmware builds
- **Byte-level change tables**: Structured data showing exact offsets, original byte values, and replacement values
- **Patch metadata**: Per-phase counts, functional descriptions, and security implications of each modification

This documentation is not manually curated separately from the build process. According to the vphone-cli source code, the file is generated from the same patch definitions that the build system consumes, ensuring the descriptions remain synchronized with the actual applied patches.

## Python Patcher Implementation

The **[`scripts/patchers/cfw.py`](https://github.com/Lakr233/vphone-cli/blob/main/scripts/patchers/cfw.py)** module implements the core binary modification logic. This Python script reads the patch definitions referenced in the research documentation and applies them to firmware images during the build process.

When you execute `make fw_patch` or related targets, the build system invokes this patcher, which writes modified binaries directly to the VM image. The patcher also outputs a CSV-style log of applied changes that you can capture for verification:

```bash

# Capture the patch application log for detailed inspection

scripts/patchers/cfw.py --log > patch_log.txt
cat patch_log.txt | grep "CFW binary patches"

```

The patcher maintains a bidirectional relationship with the documentation. The markdown files describe precisely what the Python code applies, while the code ensures the documentation reflects the actual byte-level changes being written to the firmware.

## Build System Integration

The Makefile provides declarative targets that orchestrate the patching workflow across different firmware variants. The primary automation targets include:

- `make fw_patch`: Builds the firmware image and applies all documented binary patches via the Python patcher
- `make cfw_install`: Mounts the patched image and installs it on the host system

These targets delegate to shell scripts in the `scripts/` directory. The standard installation wrapper is **[`scripts/cfw_install.sh`](https://github.com/Lakr233/vphone-cli/blob/main/scripts/cfw_install.sh)**, with specialized variants for different build types:

- [`scripts/cfw_install_dev.sh`](https://github.com/Lakr233/vphone-cli/blob/main/scripts/cfw_install_dev.sh) for development builds
- [`scripts/cfw_install_jb.sh`](https://github.com/Lakr233/vphone-cli/blob/main/scripts/cfw_install_jb.sh) for jailbreak variants  
- [`scripts/cfw_install_exp.sh`](https://github.com/Lakr233/vphone-cli/blob/main/scripts/cfw_install_exp.sh) for experimental firmware

To execute a complete patch-and-install cycle for the base firmware:

```bash
make fw_patch      # Applies binary patches via scripts/patchers/cfw.py

make cfw_install   # Deploys the modified VM image

```

## Supplementary Kernel Documentation

While [`0_binary_patch_comparison.md`](https://github.com/Lakr233/vphone-cli/blob/main/0_binary_patch_comparison.md) covers userspace and firmware binary modifications, kernel-level patches are documented separately. The file **[`research/kernel_jb_patch_notes.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/kernel_jb_patch_notes.md)** contains complementary technical notes on kernel patches that enable jailbreak functionality and extended hardware support. These kernel modifications work in conjunction with the binary patches applied to the rootfs and firmware image.

**Key files for binary patch analysis:**

- **[`research/0_binary_patch_comparison.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/0_binary_patch_comparison.md)** – Human-readable breakdown of every binary patch with byte-level precision
- **[`scripts/patchers/cfw.py`](https://github.com/Lakr233/vphone-cli/blob/main/scripts/patchers/cfw.py)** – Python implementation that applies the documented patches during build
- **[`scripts/cfw_install.sh`](https://github.com/Lakr233/vphone-cli/blob/main/scripts/cfw_install.sh)** (and `*_dev.sh`, `*_jb.sh`, `*_exp.sh` variants) – Shell wrappers for installation
- **`Makefile`** – Build automation driving the `fw_patch*` and `cfw_install*` targets
- **[`research/kernel_jb_patch_notes.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/kernel_jb_patch_notes.md)** – Supplementary kernel-level patch documentation

## Programmatic Access to Patch Data

For automated analysis or CI/CD integration, you can fetch the patch documentation directly from the repository without cloning:

```python
import requests

url = "https://raw.githubusercontent.com/Lakr233/vphone-cli/main/research/0_binary_patch_comparison.md"
response = requests.get(url)
patch_documentation = response.text

# Display specific sections containing CFW binary patch tables

lines = patch_documentation.splitlines()
for line in lines[200:250]:
    if "CFW binary" in line or "|" in line:
        print(line)

```

This approach allows external security tools to parse the byte-level change tables and verify patch integrity against deployed firmware images.

## Summary

- The authoritative reference for binary patches is **[`research/0_binary_patch_comparison.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/0_binary_patch_comparison.md)**, documenting all byte-level changes for stand-alone binaries and CFW variants (base, development, jailbreak, and experimental).
- **[`scripts/patchers/cfw.py`](https://github.com/Lakr233/vphone-cli/blob/main/scripts/patchers/cfw.py)** implements the actual patch application logic, reading from the same definitions used to generate the research documentation.
- Use **`make fw_patch`** to apply patches during the build process and **`make cfw_install`** to deploy them, with variant-specific shell scripts handling specialized configurations.
- Kernel-level modifications are documented separately in **[`research/kernel_jb_patch_notes.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/kernel_jb_patch_notes.md)** to complement the userspace binary patch breakdown.

## Frequently Asked Questions

### Where is the detailed breakdown of binary patches stored in vphone-cli?

The detailed breakdown is stored in **[`research/0_binary_patch_comparison.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/0_binary_patch_comparison.md)**. This file contains a comprehensive, line-by-line comparison of every binary patch applied to the custom firmware, including stand-alone rootfs modifications and variant-specific CFW patches for base, development, jailbreak, and experimental builds.

### How do I apply the binary patches documented in the research folder?

Execute **`make fw_patch`** from the repository root to build the firmware image and apply all binary patches via the Python patcher. Then run **`make cfw_install`** to mount and install the patched image on the host. For specialized variants like jailbreak or experimental builds, use the corresponding shell scripts such as [`scripts/cfw_install_jb.sh`](https://github.com/Lakr233/vphone-cli/blob/main/scripts/cfw_install_jb.sh).

### What is the relationship between the Python patcher and the markdown documentation?

**[`scripts/patchers/cfw.py`](https://github.com/Lakr233/vphone-cli/blob/main/scripts/patchers/cfw.py)** reads patch definitions from the `research/` directory and applies them during the build process. The markdown documentation in [`research/0_binary_patch_comparison.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/0_binary_patch_comparison.md) is generated from these same underlying definitions, ensuring that the human-readable descriptions always match the actual byte-level modifications performed by the Python code.

### Are there additional notes on kernel-level patches?

Yes. While binary patches for userspace and firmware components are detailed in [`research/0_binary_patch_comparison.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/0_binary_patch_comparison.md), kernel-specific modifications are documented in **[`research/kernel_jb_patch_notes.md`](https://github.com/Lakr233/vphone-cli/blob/main/research/kernel_jb_patch_notes.md)**. This supplementary file covers kernel patches that enable jailbreak functionality and extended hardware support, working in conjunction with the binary patches applied to the firmware image.