# jz8root/xiaomi-hyperos-bootloader-unlock architecture

> Architecture diagram of the GitHub repository jz8root/xiaomi-hyperos-bootloader-unlock, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jz8root/xiaomi-hyperos-bootloader-unlock
- Repository: https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock

## Overview

This repository is a focused Xiaomi MediaTek bootloader-unlock guide with a companion LK binary compatibility scanner. The principal workflow is to scan a device’s LK, follow the documented RPMB/seccfg procedure when compatible, then verify the resulting state; the README also documents device-specific limitations and BROM/USB precautions. Source evidence is limited to the README excerpt and partial scan_lk.py, so the operational steps are documented capabilities rather than inspected automation.

Main entry points: [`README.md`](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/README.md) (Unlock state checks), [`scan_lk.py`](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/scan_lk.py) (LK scanner), [`COMPATIBILITY.md`](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/COMPATIBILITY.md) (Device compatibility), [`proof/VERIFICATION.md`](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/proof/VERIFICATION.md) (Verification evidence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_assessment["Compatibility assessment"]
  node_lk["LK binary"]
  node_scanner["LK scanner<br/>[scan_lk.py]"]
  node_compat["Device compatibility<br/>[COMPATIBILITY.md]"]
end

subgraph group_unlock["Unlock procedure"]
  node_brom["BROM access<br/>[README.md]"]
  node_mtkclient["mtkclient"]
  node_rpmb[("RPMB magic")]
  node_seccfg[("seccfg state")]
  node_preloader["Device preloader"]
  node_lk_boot["LK boot flow"]
  node_usb["USB host setup<br/>[README.md]"]
  node_linux["Linux driver preparation<br/>[README.md]"]
end

subgraph group_verification["Verification and support"]
  node_state_check["Unlock state checks<br/>[README.md]"]
  node_proof["Verification evidence<br/>[VERIFICATION.md]"]
end

node_user(("Device owner"))

node_user -->|"scans LK"| node_scanner
node_lk -->|"binary input"| node_scanner
node_scanner -.->|"assesses compatibility"| node_compat
node_user -->|"enters"| node_brom
node_user -->|"runs commands"| node_mtkclient
node_mtkclient -->|"reads and erases"| node_rpmb
node_mtkclient -->|"sets unlock state"| node_seccfg
node_preloader -->|"may restore magic"| node_rpmb
node_lk_boot -->|"checks magic"| node_rpmb
node_lk_boot -->|"falls back to state"| node_seccfg
node_user -->|"verifies device"| node_state_check
node_state_check -->|"re-reads"| node_rpmb
node_state_check -.->|"compares evidence"| node_proof
node_usb -->|"enables reliable access"| node_mtkclient
node_linux -->|"prepares BROM session"| node_mtkclient

click node_scanner "https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/scan_lk.py"
click node_compat "https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/COMPATIBILITY.md"
click node_brom "https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/README.md"
click node_state_check "https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/README.md"
click node_proof "https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/proof/VERIFICATION.md"
click node_usb "https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/README.md"
click node_linux "https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/README.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_lk,node_scanner,node_compat toneBlue
class node_brom,node_mtkclient,node_rpmb,node_seccfg,node_preloader,node_lk_boot,node_usb,node_linux toneAmber
class node_state_check,node_proof toneMint
class node_user toneIndigo
```

## Components

### Compatibility assessment

- **LK binary**
- [LK scanner](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/scan_lk.py): `scan_lk.py`
- [Device compatibility](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/COMPATIBILITY.md): `COMPATIBILITY.md`

### Unlock procedure

- [BROM access](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/README.md): `README.md`
- **mtkclient**
- **RPMB magic**
- **seccfg state**
- **Device preloader**
- **LK boot flow**
- [USB host setup](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/README.md): `README.md`
- [Linux driver preparation](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/README.md): `README.md`

### Verification and support

- [Unlock state checks](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/README.md): `README.md`
- [Verification evidence](https://github.com/jz8root/xiaomi-hyperos-bootloader-unlock/blob/main/proof/VERIFICATION.md): `proof/VERIFICATION.md`

### Other components

- **Device owner**

## Connections

- Device owner → LK scanner: scans LK (evidence: `scan_lk.py`)
- LK binary → LK scanner: binary input (evidence: `scan_lk.py`)
- LK scanner → Device compatibility: assesses compatibility
- Device owner → BROM access: enters (evidence: `README.md`)
- Device owner → mtkclient: runs commands (evidence: `README.md`)
- mtkclient → RPMB magic: reads and erases (evidence: `README.md`)
- mtkclient → seccfg state: sets unlock state (evidence: `README.md`)
- Device preloader → RPMB magic: may restore magic (evidence: `README.md`)
- LK boot flow → RPMB magic: checks magic (evidence: `README.md`)
- LK boot flow → seccfg state: falls back to state (evidence: `README.md`)
- Device owner → Unlock state checks: verifies device (evidence: `README.md`)
- Unlock state checks → RPMB magic: re-reads (evidence: `README.md`)
- Unlock state checks → Verification evidence: compares evidence
- USB host setup → mtkclient: enables reliable access (evidence: `README.md`)
- Linux driver preparation → mtkclient: prepares BROM session (evidence: `README.md`)
