An auto-porter that builds a Xiaomi ROM for OnePlus phones. It supports MIUI14 Android 13 on Ace 3V and HyperOS 1, 2, 3 and 4 as the donor, combined with a OnePlus stock ROM:
vendorandodmcome from the OnePlus stock ROM, so the hardware stack stays OnePlus.system,system_extandproductcome from the HyperOS donor, withmi_extmerged in.
HyperOS 4 / Android 17 (SDK37) keeps the donor's model, device codename and
regional product name. These values are captured before the Pangu/mi_ext merge
and restored in the final system/ODM properties. Only existing ODM build.prop
paths are updated: creating /odm/etc/build.prop on a root-layout base would
hide its complete /odm/build.prop, including arm64-only ABI and zygote overrides.
Existing ODM imports and file metadata are retained. The OnePlus vendor hardware
properties stay with the stock base.
For generic Xiaomi identities such as miproduct / miproduct_annibale, the
porter resolves the donor from ro.product.mod_device (or the product-name
suffix), yielding annibale while preserving a real model or regional name.
The final system build.prop receives the resolved ro.product.model,
ro.product.device, ro.product.name and ro.build.product values too. Updating
ODM aliases alone leaves Android's Build.MODEL / Build.DEVICE at miproduct
when system already sets those top-level properties.
The saved donor values and applied changes appear in donor_identity.json
and the donor_identity section of port_compat.json. A missing donor model
fails before merging instead of substituting a OnePlus or reference identity.
The output is an uncompressed zip containing system.img, system_ext.img,
product.img, vendor.img and odm.img.
It runs the same way locally or from GitHub Actions. The device-specific values
(FOD geometry, resolution, density, marketname, camera) live in devices/, so
adding a device is a config file, not a code change.
Disclaimer: use this at your own risk. I am not responsible for any issues, data loss, or bricked phones that result from flashing these builds. Keep a working recovery/fastboot path and a backup before you flash.
| Device | Codename | Status |
|---|---|---|
| OnePlus 13 | PJZ110 |
✅ Fully Supported |
| OnePlus 15 | PLK110 |
|
| OnePlus Ace 3V | PJF110 |
HyperOS 1 / Android 14 and HyperOS 3 / Android 16 boot confirmed via DSU; Android 17 uses the existing profile |
Ace 3V also has a verified MIUI14 SDK33 profile for the marble
V14.0.27.0.TMRCNXM donor and SDK34 vendor/ODM. It uses the same build command
and Actions workflow, retains donor ART/APEX, and needs no --apex-stock.
MIUI14 packages may omit mi_ext; newer donors still require it. Boot,
Gboard typing, Wi-Fi browsing and the Google email login screen were confirmed
through DSU. SELinux stays Enforcing and boot ADB uses shell UID2000 without
host authentication. Unknown binary/ABI hashes stop the build before applying
this profile's patches. See the SDK33 profile
for exact fixes, input hashes, package integrity and testing limits.
Linux x86_64.
./requirements.shThis installs the dependencies on Arch, Debian, Ubuntu and Fedora and fetches
payload-dumper-rust. If it can't be fetched, the porter falls back to a
built-in Python payload extractor, so it still works offline.
./port.sh --stock <oneplus-stock> --hyperos <hyperos-rom>The target is detected from the OnePlus stock vendor/odm properties. A
verified folder under devices/ is preferred. If none matches, the porter
creates an in-memory automatic profile from the stock model, codename, density,
market name and FOD props, then continues the build. --device remains an
optional manual override (for example, OnePlus13).
--stock, --hyperos and --apex-stock accept a URL, an OTA/fastboot/recovery
ZIP, payload.bin, a raw or Android sparse super.img, a directory of raw
images, or extracted trees with their config/ metadata. ZIPs built by
nothingsvn_xiaomi-toolbuild are supported: the porter finds super/super.img
inside the archive and extracts only the requested logical partitions. Nested
raw images are also supported. Populated _a/_b names are normalized to
system.img, etc.; empty slots are skipped. Flashing scripts and firmware
images from the donor package are not executed or installed. The finished ZIP
lands in out/. Super extraction is built into Python and requires neither
lpunpack nor an intermediate full unsparse copy. Multi-device retrofit super
images are unsupported.
Google Drive file share URLs are accepted directly. When download credentials
are configured, both the stock probe and porter use the authenticated Drive v3
API (alt=media), as the OneDrive copy bot does. Without credentials, public
links use the anonymous large-file confirmation flow:
./port.sh --stock /path/to/stock.zip \
--hyperos 'https://drive.google.com/file/d/FILE_ID/view?usp=sharing'Set the Actions secret GOOGLE_DRIVE_DOWNLOAD_CREDENTIALS_JSON to an offline
authorized-user JSON (client_id, client_secret, refresh_token) with
drive.readonly access. Generate it after publishing the OAuth app to
In production. This separate read-only identity does not change the upload
account. If absent, the downloader can use the existing
GOOGLE_OAUTH_CREDENTIALS_JSON / GOOGLE_OAUTH_REFRESH_TOKEN, or service-account
credentials (install google-auth for service-account downloads).
The authenticated path supports resource keys and shared drives, refreshes expired access tokens, retries temporary rate limits with backoff, resumes interrupted streams with HTTP Range, and verifies size and Drive MD5 before publishing the ROM. Credentials are never sent to non-Google download hosts. The configured account must be allowed to read the source file. Builders with access to this workflow can request files visible to that account; use a dedicated download account when accepting untrusted builders.
This avoids relying on the anonymous web download endpoint; it does not remove Google's API or file download quotas. A genuine API quota/permission error stops the download, and HTML error pages are never saved as ROM ZIPs. Use an accessible mirror or wait for quota recovery in that case. See Google's download API.
For the toolbuild GitHub mirror, pass the direct download URL of its
*.zip.download.json asset. The porter streams the release parts in manifest
order into the original ZIP and checks every part and the full ZIP against
SHA256 before unpacking. No second ZIP archive is created:
./port.sh --stock /path/to/stock.zip \
--hyperos 'https://github.com/OWNER/REPO/releases/download/TAG/ROM.zip.download.json'Interrupted downloads retain a .part file for diagnosis. Use a fresh work
directory for the next attempt; these Python downloaders do not resume parts.
For Ace 3V HyperOS 3 Android 15 or 16, use a matching stock ROM containing
system_ext, or supply it separately with --apex-stock. The hardware
vendor/odm still come from --stock; the APEX source must match the
donor's Android SDK. See the Android 15 enforcing flow
or the Android 16 flow for the
inputs, extracted-tree build examples and remaining compatibility limits.
OPlus Android 16 links containing downloadCheck are resolved automatically
to their signed CDN URL before downloading, with the same retry behaviour as
the NothingsVN toolbuild flow.
Telegram /bp4 uses /bp4 <base ROM> -port <port ROM>. For workflow-side
progress notifications, add TELEGRAM_BOT_TOKEN to this repository's Actions
secrets (the same token used by the existing bot). The workflow edits the bot's
pending message at download, unpack, build, pack and upload stages, then sends a
fresh completion/failure alert. TELEGRAM_CHANNEL_ID is optional for manual
workflow runs because bot-dispatched runs include the requesting user's ID.
Options:
--device <name> optional target-profile override; normally auto-detected
--name <basename> output zip basename (default: HyperOS-<device>-port)
--out <dir> output directory (default: out)
--work <dir> working directory (default: work)
--res <dir> overlay directory (default: RES)
--keep-work keep the working tree instead of cleaning it up
--apex-stock <input> separate Android-matched stock ROM/tree for Ace 3V SDK34/35/36
--adb-key <public> optionally authorize one adbkey.pub for authenticated ADB builds
--force-adb legacy flag; Ace 3V SDK33-36 and HyperOS 4 SDK37 enable no-auth ADB with UID2000
--assemble-only assemble and compile policy without repacking images
port.sh is the entry point. It's mostly Bash, and calls small Python helpers
under lib/ for the parts that are cleaner in Python — SELinux config synthesis
(lib/erofs_config.py), the payload fallback (lib/payload_extractor.py) and
the Google Drive download (lib/gdrive.py).
- Fork this repo.
- For the automatic pixeldrain upload, add your key under Settings → Secrets
and variables → Actions as
PIXELDRAIN_API_KEY. - Open the Actions tab, pick Build HyperOS for OnePlus, and Run workflow.
- Enter a device profile name, then paste the OnePlus stock ROM link and the
HyperOS link. The profile must be a verified folder in
devices/.
The finished zip is attached to the run as an artifact. Upload to Google
Drive is on by default: configure GDRIVE_FOLDER_ID and either
GOOGLE_SERVICE_ACCOUNT_JSON or GOOGLE_OAUTH_CREDENTIALS_JSON as Actions
secrets. A service-account Drive folder must be shared with that account. If an
upload fails, the GitHub artifact remains available. Pixeldrain remains an
optional alternative.
Each device is a folder under devices/<name>/:
devices/OnePlus13/
device.conf # scalar values (below)
device_features.xml # copied to <ro.product.device>.xml
displayconfig/display_id_<panelid>.xml # brightness / refresh / density map
Start from devices/_template/ to replace an automatic profile with a verified
one. Automatic builds intentionally do not stop when properties are missing:
they use conservative fallback display/FOD values and a donor feature file.
They are experimental and should be tested with recovery or fastboot available.
device.conf:
name=OnePlus 13
model=PJZ110
status=Fully Supported
density=600
miui_resolution=1440,3168,480
fod_location=628,2200
fod_size=184,184
fod_target=616,2388,824,2616
marketname=一加 13
camera_gdrive_id=<google drive id of that device's MiuiCamera.zip>The porter overlays the folder's displayconfig and device_features.xml (the
latter renamed to the port's detected ro.product.device), then writes the
scalar values into the right build.props (FOD, density and resolution) and the
odm attestation (marketname). To add a device, copy an existing folder and drop
in that device's verified values — FOD coordinates and the displayconfig are
panel-specific, and the displayconfig filename must be that device's real panel
id (read it from a dump). Reusing another device's values is what "untested"
means.
A straight port of HyperOS onto a OnePlus boots with several things broken. This porter bakes in the fixes:
- Under-display fingerprint (FOD). Adds the FOD geometry props, the
enrolment gate (
vendor.fingerprint.cali=1), the fingerprint permission xml labelledvendor_configs_file, and the SELinux property contexts so system_server can read the props and the fingerprint HAL can set its own. Without these there's no way to enrol, or enrolment dies withinvalid cali data. - 120 Hz. Vendor display props plus the product refresh-rate config and device-features flags.
- Brightness curve and boot hang. A brightness map that starts above the panel minimum makes the brightness spline blow up and the phone hang on the boot animation. The bundled display config starts at the real panel minimum.
- Status bar icon tint.
debug.layered.strategy.phone=99. - Camera. The ported MiuiCamera is replaced with a working build, which the
porter downloads into
RES/automatically (it's too big for git).
Not fixed here: face-unlock enrolment freeze (needs Settings.apk edits) and
slightly buggy fullscreen AOD.
- Extract OnePlus
vendorandodmfrom the stock ROM. - Extract HyperOS
system,system_ext,productandmi_ext. - Fold
mi_ext/product,mi_ext/system_extandmi_ext/systeminto their target partitions, retaining their source metadata. - Merge
mi_ext/etc/build.propintoproductandsystem/system, dropping the hugero.vendor.build.ab_ota_partitionsline. - Add MIUI home/dexopt props to
system/system/build.prop. - Tag
ro.mi.os.version.incremental. - Move
product/pangu/systemintosystem/system. - Append the OnePlus vendor props (the
# end of fileblock + FOD) tovendor/build.prop. - Add the Xiaomi attestation block to
odm/build.propand stripimportlines. - Remove
ro.vendor.oplus.sensor.high_pwm_rgb. - Add the density and status-bar props to
product/etc/build.prop. - Delete
system_ext/priv-app/qcrilmsgtunneland the portedproduct/priv-app/MiuiCamera.
Then it applies the RES/ overlays and the device overrides, regenerates the
EROFS fs_config / file_contexts, repacks each partition, and writes the zip.
Ace 3V SDK36 additionally moves the remaining mi_ext into the system image,
moves the complete pangu directory, replaces system_ext APEX from matching
stock, compiles the compatibility policy, and applies the setup flow.
These changes are selected by donor SDK, not the ROM name.
Ace 3V SDK36 enables optical fingerprint enrollment and screen unlock with
Local HBM for the verified fuxi HyperOS 3 build OS3.0.310.0.WMCCNXM. The
bridge uses the OnePlus touch HAL and lights the sensor area only during a
touch after boot. The build checks the donor SystemUI, framework and
SurfaceFlinger and the stock OnePlus composer by SHA-256. The build report
records whether it applied the profile or skipped it for differing inputs.
Ace 3V SDK33-36 and HyperOS 4 SDK37 share one no-auth boot ADB installer in lib/port_compat.py,
used by both port.sh and Actions. It keeps ro.secure=1, ro.debuggable=0
and shell UID2000, even with the legacy --force-adb flag. SDK34/35 retain
SELinux Enforcing; the existing SDK36 policy selection is unchanged.
The compatibility compiler follows Android init's split-policy inputs: platform
policy and the vendor-version platform mapping are required, while private
system_ext/product policies and their mappings are included only when shipped
by the donor. For example, the rembrandt HyperOS 2 Android 14 toolbuild donor
omits product/etc/selinux entirely. No empty or unrelated mapping is substituted;
unresolved policy references still fail compilation. Cache hashes follow the
actual inputs, and stale source/cache stamp pairs for an absent optional policy
are removed together. SDK34/35 still require zero compiled permissive domains
and valid property labels before packaging.
The compiler also rejects duplicate property-info matches across the runtime
context files. When a donor repeats a vendor/odm-owned key with the same match
kind, the stock hardware route is retained and only that donor entry is removed.
This fixes rembrandt's persist.vendor.bluetooth. collision between MediaTek
system_ext and the Ace 3V Qualcomm vendor. More-specific properties and distinct
exact/prefix matches are preserved; unrelated collisions fail with both source
locations. Removed entries are recorded in donor_property_collisions_removed.
The signed donor APEX and its libraries are preserved. The installer accepts
compressed, uncompressed and flattened adbd APEX layouts. Known profiles are
an optional cache; other regions derive their daemon from the donor itself.
The auth state stays disabled even when vendor sets ro.adb.secure=1.
Unsupported ELF layouts fail before the ADB installer changes the tree;
a successful build is not a substitute for a device boot test.
On Ace 3V with HyperOS 4 SDK37, the build starts USB ADB during bootanimation
and retains the existing SELinux enforcement mode. It fills missing
MiuiCalendar grants when the app is installed under /product/priv-app.
See shared boot fixes.
Ace 3V SDK35 removes SetupWizard and retains the minimal Provision fallback.
SDK35 also supplies the two observed boot-blocking product permission grants.
For the verified nuwa GMS 25.10.36 container, its eight original embedded
modules are staged under GmsCore/m/container to repair factory module
discovery. Unknown GMS containers are unchanged. See
Android 15 port and Google login.
Ace 3V SDK34 uses the same enforcing assembly with its own Android 14 ADB
profile and matching stock system_ext APEX. It skips the Android 15 role
overlay. GMS donors also receive the hash-verified GMS/GSF bundle from
PJF110_14.0.1.720(CN01) stock my_bigball, including eight unchanged embedded
Chimera modules staged for the factory app in GmsCore/m/container.
A Xiaomi VoNR query is corrected
to avoid blocking SystemUI's network callbacks. See
Android 14 port notes for source requirements and
the scope of device verification.
All Ace 3V SDK flows remove wait only from optional OEM my_* bind mounts
that retain nofail; required partition waits remain.
RES/ holds files copied over the assembled tree, mirroring the partition
layout — RES/product/... goes into product, RES/vendor/... into vendor.
After the copy, the SELinux metadata is regenerated for the new files (a file
under vendor/etc/permissions correctly becomes vendor_configs_file). Line-
based edits (build.prop props, SELinux property contexts) live in fixes/ and
are shared by both front-ends.
- MIO Kitchen — the erofs and image tools in
bin/. - payload-dumper-rust — payload extraction (reads the ROM zip directly).
- XMAPort and HyperOS-Port-Python — references for the porting flow.
- tqmane — for some help.
Fixes worked out by palaziks. If you reuse them, keep the credit.
GPLv3. See LICENSE.