Porting Third-Party HyperOS to Android Devices: A Technical Guide
This guide outlines the process of porting a third-party HyperOS ROM to an Android device, using the Redmi Note 12 Turbo European HyperOS as a base and the Redmi K70 Pro Chinese HyperOS as the port. The approach involves modifying system partitions, adjusting boot scripts, and installing necessary drivers.
Base and Port Versions
- Base: Redmi Note 12 Turbo European HyperOS (OS1.0.4.0.UMREUXM)
- Port: Redmi K70 Pro Chinese HyperOS (OS1.0.12.0.UNMCNXM)
Porting Strategy
- Trensfer system, system_ext, product, and mi_ext partitions.
- Modify official flashing scripts to bypass rollback and vbmeta checks.
- Install drivers from Android, Microsoft, Nvidia, and Qualcomm.
- Set up ADB and Fastboot environments.
Key Points
- The super.img file is located in the */images directory.
- Add your project folder to antivirus exclusions to prevent false positives.
- Ensure access to Google services for ADB and Fastboot setup.
Fixing Common Issues
1. Resolving Boot Stuck on First Screen for 8Gen3 Devices
- Extract super.img from both base and port.
- Extract system_ext.img from both.
- Copy the apex folder from base/system_ext to port/system_ext.
2. Adjusting Display Features (Corners, Status Bar, Refresh Rate, AOD)
- Extract product.img from base and port.
- Copy device_features files (e.g., marble.xml, marblein.xml) from base/product/etc/device_features to port/product/etc/device_features.
- Replace overlay APKs in port/product/overlay with those from base/product/overlay (e.g., DevicesAndroidOverlay.apk).
- Replace the MIUIAod folder in port/product/priv-app with the base version.
3. Fixing Auto-Brightness and Freezes
- Replace the displayconfig folder in port/product/etc with the one from base/product/etc/displayconfig.
4. Enabling Face Recognition
- Remove the Biometric folder from port/product/app.
- Copy the Biometric folder from base/product/app to port/product/app.
5. Restoring Camera Functionality
- Copy the MIUICamera folder from base/product/priv-app to port/product/priv-app.
6. Repairing NFC and Xiaomi Smart Card
- Delete the NQNfcNci folder from port/product/pangu/system/app and replace it with the base version.
- Copy all files from port/product/pangu/system to port/product.
- Extract vendor.img from base and modify vendor/build.prop: change
ro.vendor.se.type=HCE,UICCtoro.vendor.se.type=HCE,UICC,eSE.
7. Addressing Launcher Crashes
- Fromm base/vendor, modify marble_build.prop and marblein_build.prop to udpate fingerprint and device details.
- Extract odm.img from base and adjust odm/etc/marble_build.prop and odm/etc/marblein_build.prop similarly.
8. Eliminating Security Warnings on Boot
- Extract system.img from port.
- Decompile framework.jar in port/system/system/framework, locate the
isBuildConsistent()method in classes3.dex, and modify it to return true.
9. Reducing Image Size
- Extract cust.img from base and delete all non-folder contents.
Repackaging Instructions
1. Creating super.img
- Repack modified images (system.img, system_ext.img, product.img, mi_ext.img) and overwrite the base versions.
- Repack the base super.img, ensuring correct partition type (e.g., A/B for Redmi Note 12 Turbo).
- Place the new super.img back into */images.
2. Editing Flashing Scripts
- Remove flash_all_lock.bat and flash_all_lock.sh.
- Edit flash_all.bat: delete code blocks for device verification and anti-rollback checks.
- After
fastboot flash misc, add commands to disable verity and flash vbmeta images. - Apply similar changes to flash_all_except_storage.bat.
3. Installing Drivers
- Download MiFlash and install drivers from Android, Microsoft, Nvidia, and Qualcomm. Avoid using MiFlash for the ported ROM.
4. Setting Up Environment
- Download ADB and Fastboot, then extract them into the same directory as the flashing scripts.