Debloated, performance-tuned HyperOS 3 build pipeline for the Xiaomi 13 Lite / Civi 2 (ziyi)
Part of my ziyi HyperOS port work — this repo is the build pipeline; released ROMs live on Telegram and brizz.uz.
A fastboot-flashable, aggressively debloated, performance-tuned build of the
base package the phone actually runs (stock or a hybrid port), using a donor
HyperOS package as a config/reference source. No cross-SoC binaries are
ported — read PORTING_GUIDE.md Section 0 for why that
is the design, not a shortcut: it is what guarantees the three priority
components (in-display fingerprint, all cameras, dual-SIM telephony) keep
working.
v2 pipeline: only the product partition is modified; SELinux labels are
applied at image-build time (mkfs.erofs --file-contexts), so the build runs
fine on WSL1/NTFS hosts; system-resident bloat is handled by a generated
post-flash pm disable script instead of system surgery.
| File | What it is |
|---|---|
PORTING_GUIDE.md |
The complete step-by-step guide (Sections 0–12). Start here. |
debloat_list.txt |
Manifest of every removal: package | path | reason. Caution rows are !-prefixed and skipped by default. Consumed directly by the patch script. |
tweaks_applied.txt |
Every performance tweak: file | original | new | benefit, including the tweaks deliberately not applied and why. |
scripts/setup_wsl.sh |
One-time WSL tool install (erofs-utils, payload-dumper-go, lpunpack.py…). Idempotent. |
scripts/extract_and_patch.sh |
The build: extracts the base package, debloats, tweaks, repacks product with build-time SELinux labeling + verification, assembles the flash package. Idempotent. |
scripts/flash_ziyi.bat |
Double-click Windows flasher with device-identity gate, unlock gate, and confirmation prompt. Auto-copied into the output package. |
scripts/flash_ziyi_full.bat |
Full-package variant of the flasher. |
- WSL: run
setup_wsl.shonce. - Place the base package at
build/base_rom.zip(or setBASE_PKG=...). - Run
scripts/extract_and_patch.shinside WSL. - Output lands in
build/out/ziyi_flashpkg/— double-clickflash_ziyi.bat(bootloader must be unlocked; see guide Section 11). - After first boot: run
post_flash_disable.cmd, then verify per guide Section 12 (fingerprint, every camera, both SIMs, animation scales via adb).
- Device identity is verified twice (guide pre-flight, and the
.batrefuses any device not reportingproduct: ziyi). vendor,odm,system, boot chain, modem/firmware,persist: never modified; onlyproductis rebuilt, and the rebuilt image must pass SELinux label verification or the build aborts.- Telephony/IMS/SIM/payment-attestation/Google paths are hard-refused by the debloat engine no matter what the manifest says.
- Unbrick path: official ziyi fastboot ROM + MiFlash ("clean all", never "clean all and lock").
Flashing modified firmware can void your warranty and, done carelessly, brick
your device. Everything here gates on product: ziyi and follows the
never-touch-vendor design, but you flash at your own risk. Read the guide
first. Keep the official fastboot ROM downloaded before you start.
MIT — the pipeline and docs. ROM content itself belongs to Xiaomi; this repo ships no ROM binaries.