Porting a stock Xiaomi ROM to another device can be a complex process,
especially if the target device has different hardware specifications. Here's
a general guide to get you started:
### **Prerequisites**
1. **Unlocked Bootloader:** Ensure that your device has an unlocked
bootloader.
2. **Stock ROM:** Have the stock ROM of the Xiaomi device you want to
port.
3. **Base ROM:** Obtain a base ROM from a device that is similar to the
target device (preferably one that is already working).
4. **Linux/Windows Environment:** A PC with a Linux or Windows OS and
basic knowledge of using terminal/command line tools.
### **Steps to Port Xiaomi ROM**
#### 1. **Set Up Your Environment**
- Install necessary tools such as `Android SDK`, `ADB`, `Fastboot`, and
`Python`.
- Download tools like `Android Image Kitchen`, `Notepad++`, and `Hex
Editor`.
#### 2. **Extract the ROMs**
- Extract the Xiaomi stock ROM and the base ROM to separate folders.
- The main files you'll work with is `[Link]`
#### 4. **Port the System Image**
- Decompile the `[Link]` of the stock ROM using tools like `UKA`
and `CRB `.
- Add [Link] from product/etc/device_features of stock rom to base
rom
- Handle `[Link]`: Edit `[Link]` to match the target device's
specifications.
- Adjust the `[Link]` and other init scripts for compatibility.
- replace base rom’s vendor with your stock rom’s.
- pack all images with the same tool ypu used to unpack them.(DO NOT
INTERCHANGE)
-convert the format supported by your device while packing (ext4 in
case of everpal)
#### 7. **Repack the Super Image**
- Repack the system image using same tool you used to unpack it
(AGAIN, DO NOT INTERCHANGE YOUR TOOLS).
- Now just place the new [Link] in your stock rom folder.
#### 8. **Testing**
- Flash the ROM onto your target device.
- Boot the device and check for issues.
- Troubleshoot by examining boot logs, logcat, and dmesg for errors.
#### 10. **Debugging**
- Analyze logcat logs for errors and trace back to problematic files.