[Updated] How to port MIUI 7 & MIUI 8 ROMs to Qualcomm powered Smartphones

330 comments
MIUI-8-LOGO
[This Guide is also applicable in porting other ROMs like Color OS, Flyme OS, Sense and more... and this guide has been updated for MIUI 8 as well]

ROM porting is not an easy task for a newbie and porting a highly customizable ROM like MIUI v7 is a way tougher. When I was porting MIUI v7 Lollipop for a Qualcomm Snapdragon device I did not find a definitive guide for porting the latest MIUI v7. So, porting MIUI became a very tough task since I was a newbie in porting ROMs. I learnt porting through experience. Hence I am writing this guide to help the new MIUI porters so that they don’t face the problems which I faced.

Not much history now, let’s move on to our actual task i.e. how to port MIUI v7?

DISCLAIMER: This guide is written to help the emerging devs. Soft bricking is common in porting ROMs. But, I am not responsible if you somehow hard-brick your device. Do it at your own risk.

Prerequisites

Things required for porting:
  • Device for which the ROM is being ported
  • Port ROM i.e. the ROM of other device which you want to port (here we have MIUI 7)
  • Base ROM i.e. the Rom which is exclusively made for your device (CyanogenMod is preferable but if it is not available then Stock ROM may be used)
  • PC with Windows + Ubuntu (either in dual boot or through Virtualbox)
  • Rom Deodexer (for Winidows - JoelDroid Lollipop Batch Deodexer and for Linux - SuperR's Kitchen recommended) [For Android 6.0 Marshmallow ROMs use this tool to deodex: SuperR's Kitchen]
  • Android Image Kitchen to modify boot.img
  • Notepad++ to edit scripts
  • Meld to compare files and folders
  • Winrar or 7zip
  • Apktool (for advanced tasks only)
  • And some common sense

Common Information

  • This guide will teach you to port ROMs from devices with similar hardware specs and same Qualcomm Snapdragon chipset.
  • The Port ROM and the Base ROM should have the same android version.
  • ROMs containing DAT files should be properly unpacked. For base ROM you can easily do it by flashing the ROM and taking the TWRP backup of ‘system’ and extracting the resultant file with Winrar/7zip. For Port ROM follow this guide: [DEV] Lollipop/Marshmallow DAT files | Compression and Decompression
  • ROMs should be properly deodexed before porting (SuperR's Kitchen worked better in deodexing MIUI 7 Lollipop) if your device's /system partition size is smaller than P Port ROMs system files.
  • The size of the system folder of your Port ROM should be lesser than that of the system partition of your device, else you'll not be able to flash the ROM. To decrease the size you need to deodex your ROM and you may further need to debloat you Port ROM which is discussed later.
  • I am writing this guide on the basis of this configuration:

    • Base device: YU Yureka (ARM64)(MSM8939)
    • Base ROM: CyanogenMod 12.0
    • Android Version: 5.0.2 Lollipop
    • Port device: MI4i (ARM64)(MSM8939)
    • Port ROM: MIUI v7 Lollipop
Now let’s start porting.

Preparing Porting Environment

  1. Make sure you have plenty of hard-disk space in your PC.
  2. Make a folder named MIUI-PORTING-PROJECT (you may take any other name)
  3. Inside that folder create two folders: (i) BOOT-EDITING  (ii) ROM-PORTING
  4. In ROM-PORTING folder create two folders named BASE and PORT (this is the main working folder)
  5. Similarly inside the BOOT-EDITING folder create two folders named BOOT-BASE and BOOT-PORT
  6. Now place the extracted deodexed Port ROM (i.e. MIUI v7) in PORT folder and Base ROM (i.e. CM 12.0) in BASE folder.
  7. Similarly place the MIUI v7 boot.img in BOOT-PORT folder and CM12 boot.img in BOOT-BASE folder.
These steps are required to properly organize the project and will be helpful in our later discussions.

Cleaning up:
Just delete some unwnted files (.mbn files) and keep only ‘META-INF’ folder, ‘data’ folder (if available), ‘system’ folder, ‘boot.img’ file and ‘file_contexts’ file (if available) in PORT folder.

Now let’s do some work to make the Port ROM boot.

META-INF editing

  1. Open the updater-script file in PORT/META-INF/com/google/android/ with Notepad++.
  2. Delete the first line containing “get_device_compatible(….” or “assert(getprop….” which restricts the flashing process to other devices.
  3. Then delete the lines containing scripts for flashing radio image, modem image etc. which are not required for our base device.
Now you are ready to go.

boot.img editing

1. Use Android Image Kitchen to unpack the base and port boot.img in BOOT-BASE and BOOT-PORT folder.

2. Replace the files boot.img-zImage, boot.img-dtb in BOOT-PORT/split_img/ with that of BOOT-BASE/split_img.

Editing Boot IMG
Replacing boot.img files
3. Then in the BOOT-PORT/ramdisk/ folder compare the file fstab.qcom with that of the base i.e. BOOT-BASE/ramdisk/fstab.qcom. (You can use Meld for it.)
Editing fstab.qcom Step 1
Editing fstab.qcom using Meld: Step 1
Editing fstab.qcom Step 2
Editing fstab.qcom using Meld: Step 2
After this repack your boot.img and place it in your port ROM folder (i.e. PORT) and create a flashable zip. You will be able to boot this time. But, you may face sensors, sound, camera, ext sd-card etc. issues. So let us move on to fix those issues through boot.img first.

4. If the port device doesn’t support external sd-card but your base device does then you make the following changes to your BOOT-PORT/ramdisk/init.qcom.rc file:

Remove ‘#’ from the lines containing scripts for mounting or fusing ‘sdcard1’. You can do this simply by comparing the port init.qcom.rc with that of base through Meld application. (Note: You may also need to add some lines if missing in the port init.qcom.rc)

5. After sd-card, let’s move towards fixing camera, led, sensors etc. issues. For that we need to edit the init.rc and init.target.rc files.

=> Editing init.rc file:
Following lines should be added to init.rc file:

#Add all these lines under 'on post-fs-data' in appropriate places
on post-fs-data

#Add all these lines under 'on boot' in appropriate places
on boot

=> Editing init.target.rc file:
Following lines should be added to init.target.rc file:

#Add all these lines under 'on post-fs-data' in appropriate places
on post-fs-data

#Add all these lines under 'on boot' in appropriate places
on boot

6. Even after doing the above steps you may find that sensors are not working. So for that you have to do the following step –

Compare the port ueventd.qcom.rc in BOOT-PORT/ramdisk folder with that of base and add the missing lines to the port. This will fix your sensors issue.

7. Similarly compare other BOOT-PORT files like uneventd.rc, file_contexts etc. with that of BOOT-BASE and use your brain to replace required lines.

8. To fix other issues use your common sense.

9. If you are doing boot.img editing at the beginning of your project, then some of you may find that even after doing all these steps, sensors, led, camera etc. are not working. But don’t lose heart, for that you have to start your ROM Porting.

ROM Porting

Before starting ROM porting, your base and port ROM should be properly deodexed as I discussed before. If you have correctly edited the boot.img then the following steps will help you to solve your bugs.

1. Debloating Port ROM: Just delete unwanted apps or bloatwares from your port ROM. You will find them in /data/, /system/app/ and /system/priv-app/ folders.

2. According to my previous instructions you should have placed your port ROM to PORT folder and base ROM to BASE folder.

3. Adding missing files and folders: You may add missing files from BASE/system/bin/ to PORT/system/bin/. For this you can just copy all the files from BASE/system/bin/ to your PORT/system/bin/ without replacing any file.
Similarly you can do the same process in system/xbin/, system/fonts/, system/etc/, system/usr/ etc. and their sub-folders.

But always use your brain to decide which files you should add and which you should not.

You may also add some missing folders from your base ROM  to your port ROM, e.g. system/tts folder, system/etc/init.d and other important folders.

4. Fixing permission related issues: Now you have to work on system/etc/permissions folder. Just compare handheld_core_hardware.xml and platform.xml of port ROM with that of base and add or replace some lines if required.

You can do the same for some other permission files if required, but as I am always saying use your common sense.

5. Replacing files: Copy and replace files in system/etc/firmware and in system/etc/wifi from base to port.

Copy and replace the files goodix.kl, gpio-keys.kl, Generic.kl in system/usr/keylayout/ from base to port.

We will discuss more about replacing files in bug-fixing section.

6. Open system/framework/framework-res.apk of both base and port with Winrar in two different windows but don’t extract. Then navigate to framework-res.apk/res/xml/ of base and copy storage_list.xml and power_profile (optional) and paste to the Winrar window of port framework-res.apk/res/xml/ and replace the existing files. Then close the Winrar window.

Now let’s move on to our bug-fixing section.

Bug-Fixing

If you have properly edited the boot.img then only these fixes will help you.

Copy and replace the following files from Base (ROM-PORTING/BASE) to Port (ROM-PORTING/PORT) to solve the given issues:

No sound bug:
system/lib/hw/
  • audio.primary.msm****.so
  • audio.primary.default.so
system/lib64/hw/
  • audio.primary.msm****.so
  • audio.primary.default.so

Sound working in speaker but not working through headphones or vice-versa:
system/etc/

  • mixer_paths.xml (you can also try patching it with the base)

Distorted Outgoing Sound during Phone call or Partial Sound:
system/etc/acdbdata/MTP/
  • MTP_***.acdb (all files)

Home or any other button not working:
system/usr/keylayout/
  • goodix.kl
  • gpio-keys.kl (important)
  • Generik.kl

External sd-card not showing:
Follow the Step 6 in ROM Porting section.

Video hw encoding/decoding not working:
system/etc/firmware/
  • venus.*** (all files starting with ‘venus’)

Sensors not working:
  • system/lib/hw/sensors.msm****.so (or sensors.lsm6db0.so)
  • system/lib64/hw/sensors.msm****.so (or sensors.lsm6db0.so)
  • system/lib/libsensorservice.so
  • system/lib64/libsensorservice.so

Led notification not working:
  • system/lib/hw/lights.msm****.so
  • system/lib64/hw/lights.msm****.so

Vibration not working:
  • system/lib/libhardware_legacy.so
  • system/lib64/libhardware_legacy.so

FM not working:
  • system/lib/qcomfm_jni.so
  • system/lib64/qcomfm_jni.so

Wifi not working:
  • system/lib/modules/wlan.ko
[Note: In MIUI, wlan.ko is renamed as pronto_wlan.ko and is also kept in system/lib/modules/pronto/ folder, so you have to replace in both the places.]

In some phones you may not find wlan.ko file. In that case you may try replacing these files (thanks @Divyansh747):

  • system/lib/libwcnss_qmi.so
  • system/lib64/libwcnss_qmi.so

For slow WiFi network and other WiFi related issues replace these files:

  • system/etc/wifi/ -- all files
  • system/etc/firmware/wlan/ -- all files


Camera and flash not working:
system/vendor/lib/
  • libactuator_***.so (all files starting with ‘libactuator’)
  • libchromatix_***.so (all files starting with ‘libchromatix’)
  • libmmcamera_***.so (all files starting with ‘libmmcamera’)
system/lib/
  • libmm-qcamera.so
  • libmmcamera_interface.co
system/lib/hw/
  • camera.msm****.so
[Note: If such files are also available in your BASE/system/vendor/lib64/ then you have to copy those files also to their respective place in PORT]

WARNING: Do not replace any file unnecessarily, because it may give rise to new bugs in place of solving it. Always be specific!

build.prop editing

You can edit required parts of build.prop to reflect the brand, model no. etc. according to your preference. You may also add some tweaks and other things to save battery and to add features.
(But in MIUI 7 according to my experience changing the ro.product.manufacturer gives rise to issue in video recording through third-party apps and changing the ro.product.device trims some features from the ROM.)

Now your Porting Project is ready to be flashed and to be reviewed. Congrats!

Giving Credits

Last but not least when you successfully port your ROM, always give credits to the Port and Base Rom developers. Also give credits to the people from whom you took help. Always be generous in giving credits because it will not take anything from you, on the other hand it will increase your reputation and strengthen people’s faith in your work.


If you are taking help from this guide in your ROM Porting then don't forget to give some credit to me too.

My profile

XDA Forums: nitesh9
YU Forums: Nitesh Prasad
MIUI Forums: nitesh9

My works

MIUI v7 Lollipop Global and China Beta for YU Yureka: XDA Forums | YU Forums | MIUI Forums

MIUI 8 Global and China Beta ROM for Yureka and Yureka Plus: OS Busters | XDA Forums | YU Forums


For any queries or discussion please comment below...




330 Replies so far - Add your comment

  1. You're already a rockstar in YU forums and xda.. Thank you!

    ReplyDelete
  2. can i port 5.1 to 5.0 (stock 5.1.1 and port 5.0.2)

    ReplyDelete
    Replies
    1. You should go for Android 5.0 Stock or Base ROM, else you may get bootloops or RIL issues. If you tell me the device for which you are porting the ROM than I can help you in choosing the Base/Stock ROM.

      Delete
    2. my device is oppo r7 plus 5.1.1 stock and cm12.1 available but i cannot fine 5.1 miui in same spec all roms are 5.0.2

      Delete
    3. Then I think currently MIUI 7 is not possible for your device. You can go for other ROMs like EMUI, Funtouch OS, Nubia ROM etc. which are available in android 5.1.1.

      Delete
    4. i sucessfully port 5.0.2 miui7 on my 5.1.1 oppo r7 plus but everything working fine btcamera not connected and no audio on externel speaker and hf but earespeakar working perfectly how 2 fix it

      Delete
    5. Try replacing other audio libs in lib/hw and also check audio profile in system/etc.

      For camera try replacing camera libs in lib/hw and also check system/bin if you have already replaced camera libs in vendor/lib. You can also try changing the kernel once.

      Delete
    6. i am having issues with my rom i port the phone is showing dead bbattery and turning off by it self how to fix.

      Delete
    7. Try replacing boot.img/ramdisk/sbin/healthd from base. Also try replacing system/lib, lib64/hw/power.default.so and power.qcom.so. If doesn't work try calibrating the battery.

      Delete
    8. thanks but i have one more issue the camera is not working i try your guide but it seems to work at first but after i try to switch camera it crash and when i open it it switch the camera

      Delete
  3. Emmm,we are trying to port FlymeOS(5.1.1) from Yu Yureka to the Idol 3 5.5. The rom boots,but there is no signal(RIL is dead?),wifi doesn't work,etc.
    We tried with the above mentioned files,but without success...
    We used files from CM12.1.

    ReplyDelete
    Replies
    1. First I will not recommend to use other ported ROMs for your new ports since bugs will be inherited and may cause other problems since system files are highly modified to make compatible with Yureka.

      I will recommend you to search Flyme OS ROM for Coolpad F2. You may get it from some Chinese forums (I found two at http://bit.ly/1RLktoK and http://bit.ly/1RLkuZV). And use that for your porting. You may also find other portable Coolpad F2 ROMs here: http://bit.ly/1R1fYol

      And for Wifi issue use the wlan.ko file from your base ROM or you can flash any custom kernel for your device.

      Delete
  4. Hello Nitesh, nice to meet you.
    I try, like marionette, to port MIUI from MI4I on our Idol3 (6045).
    But, i allways have a bootloop with stock modded boot.img. I've doing all you mention on your guide, but no success. Can i send you the stock boot.img ?

    thanks

    ReplyDelete
    Replies
    1. Modify the port boot.img from the files from stock. The Port ROM will not boot with your stock boot.img since bootclasspath is different. Please follow the boot.img editing part carefully.

      Delete
  5. i want to port miuiv7 for motorola 3rd generation currnetly it is 5.1.1 ...
    there are cyanogenmod 12.1 available as a base rom !
    but im confused about port rom can you help me out ?
    i really like miui rom

    ReplyDelete
    Replies
    1. Currently no compatible MIUI 7 available for sd410. But keep looking for lollipop update on Redmi 2.

      But currently you can try porting vibe ui from A6000 or Funtouch OS 2.1 from Vivo v1. But the android version of port ROM should match your Android version ie 5.1.1 or use a cm 12.0 base ROM for you device.

      Delete
  6. okay thanks for the reply !
    so can i port miui v6 for the motorola moto g3 !?

    ReplyDelete
    Replies
    1. If you find a MIUI 6 Lollipop for Redmi 2 then you can port, which I think is not available.

      Delete
    2. Nice to meet you Nitesh. I have the same question but it seems that Xiaomi is never going to release lollipop update for Redmi2 as the MIUI7 update for Redmi2 is still based on Kitkat. Is there any alternative to port MIUI to Moto g 3rd gen? how difficult is the cross android version porting as I'm not able to find port ROM for the similar device (chipset & resolution etc..) at the same android version ?

      Delete
    3. Cross Android version porting is not possible in my opinion. Miui 7 Lollipop or Marshmallow will soon release for Redmi 2. Till then you can try porting other UI's like Vibe UI, Zen UI etc. etc.

      Delete
  7. Hello.

    You say "2. Replace the files boot.img-zImage, boot.img-dtb, boot.img-ramdisk.cpio.gz in BOOT-PORT/split_img/ with that of BOOT-BASE/split_img."

    But, in the screen shot, it's inverted ! what is good ?

    ReplyDelete
    Replies
    1. Thanks for pointing out. The screenshot has been updated.

      Delete
  8. Hi Nitesh,

    I want to port your miui rom on my yureka 5.1.1, is it possible to upgrade ?

    ReplyDelete
    Replies
    1. Yes, you can use Miui 7 Android 5.0 on your Yureka Android 5.1.1.

      For porting Miui 7 choose CM 12.0 as base.

      Delete
  9. Hello Nitesh.
    Is there a way to use CM12.1 as base rom ? (Idol3 5.5")
    thanks

    ReplyDelete
    Replies
    1. If you want to use CM 12.1 as base then choose a port ROM based on Android 5.1.1. Some examples are CoolUI 6.0, Color OS 2.1.0 etc.

      Delete
  10. I tried to port flymeos for yuphoria but it does not booted.

    ReplyDelete
    Replies
    1. PM me all the details of your Port and Base ROM through YU Forums then only I can help you.

      Delete
    2. what is ur user name on yu forum

      Delete
  11. Qualcomm is cross porting right ? MSM8916 TO MSM8939 Will Work ?

    ReplyDelete
  12. hello Please i want help to Port Rom For my Lenovo Vibeshot
    i want Rom MIUI 7 and Nubia UI 3.0 Please

    ReplyDelete
    Replies
    1. For MIUI 7 you can go for Xiaomi Mi4i ROM (MIUI 7 Global Edition) and for Nubia UI you can choose ZTE Nubia Z9 Mini.

      Delete
    2. i need vibeshot base rom and Nubia UI base rom please i'am Search on it from month ago please if you have time make it or tell me where can Download it because i'am Don't find it

      Delete
    3. You can get Vibeshot Base ROM either from your device or from XDA. And for Nubia UI download you head over here.

      Delete
    4. my Bro tired to try Really
      and i don't find Custom Recovery to install any Rom
      PLease find MiFlash Please Can you Help me
      i need Use Nubia UI it's Really Go Please
      Can You Make to me Rom ?

      Delete
    5. Sorry cannot work on any project nowadays due to exams.

      Delete
  13. hi mate,
    I have ze550kl, zenfone laser 2, 5.0.2, 64 bit msm8916, please suggest port rom.

    ReplyDelete
    Replies
    1. You can go for MIUI 7 from Mi4i, Color OS 2.1 from Oppo R7 Lite/Plus etc.

      Delete
    2. mi4i having msm8939 while my device have msm8916, will porting works ?

      Delete
    3. Oh sorry, I mistook msm8916 for msm8939. You should go for Vibe UI from Lenovo A6000 Plus, Flyme OS from Lenovo A6000 Plus etc.

      Delete
  14. I can port MIUI 7 for my Nubia Z5 from z5s mini or Nexus 4? I have the Stock Rom (4.4) and CM 12.0 and 12.1 for use as Base, which is better to port?

    ReplyDelete
    Replies
    1. You should choose Z5s Mini and use your Stock ROM (4.4) as base.

      Delete
  15. please elaborate 3rd point in boot editing, which values we need to add or delete ?

    my modified boot image boots but stuck at boot animations.

    ReplyDelete
    Replies
    1. You have to add those lines which are missing, from base to port. You also have to check the lines containing mount points for different things like 'system', 'data' etc. in your port fstab.qcom to match with that of base. If it doesn't match then you have to replace the lines from the base.

      Screenshots are also given there for better understanding.

      Delete
  16. I did everything well but the process is restarted in bootanimation

    ReplyDelete
    Replies
    1. Which ROM are you trying to port? This guide is full for MIUI ROMs but for other ROMs you have to do some extra things.
      You can try taking logcat to uderstand the issue.

      Delete
    2. the phone is Xiaomi redmi2 and I want it port for huawei G620s

      I've done everything he puts in tutorial and not nothing.

      Thanks in advance

      Delete
    3. This is just a basic tutorial written on my experiences. I am trying to improve it as I am getting more and more experienced in ROM porting.

      Your issue seems to look like a boot.img issue. Check the file contexts, service contexts files in boot.img.

      Delete
    4. Hello, I reviewed the boot.img, but it's all right, you think that it may be because the libs?

      Best Regards

      Delete
    5. Maybe. Anything can be the cause. The best way to get an idea about the cause to take a logcat.

      Delete
  17. Bro I want to port miui 7 for moto e xt1022. Which device have the same chipset as moto e xt1022 ? And Plz provide me the link for miui 7 for that device

    ReplyDelete
  18. Hey
    i have some troubles porting wifi and audio
    in port i have qca_cld_wlan.ko and qca/qca_cld_wlan.ko
    in base wlan.ko and qca/qca_cld_wlan.ko

    also your soltion for audio didnt work, any other suggestion?

    device:oneplus2
    base:oxygen
    port:MIUI NotePro

    ReplyDelete
    Replies
    1. Rename base wlan.ko to qca_cld_wlan.ko and copy it to port.

      For audio you can try replacing the audio libs in lib/hw/ and lib64/hw/ from base to port.

      Delete
  19. Hi!
    Are there any opportunities on porting MIUI to Galaxy S6 at the moment?

    ReplyDelete
  20. Hi,
    Do you know how to convert a 64 bit ROM to 32 bit ?
    My device doens't have a 64 bit kernel, just 32 bit lollipop (even kernel source is 32 bit).
    It's ZTE Blade S6 :)
    I tried to port Nubia UI 3.0 from ZTE Nubia Z9 Mini, but I got a reboot loop. I then checked and saw that that device comes with a 64 bit kernel, so 64 bit rom too.

    Thanks in advance!

    ReplyDelete
    Replies
    1. I think it's not possible to convert a 64 bit ROM to 32 bit. You should go for a 32 bit ROM.

      Delete
  21. Hi Nitesh!
    I was trying to port MIUI v7 based on MM from Mi4 to OnePlus X using CM13 as a base. When I tried to flash the zip I made, TWRP gives an error which just says error flashing miui.zip. P.S. the error text isn't in red colour which seemed a bit strange.
    Thanks in advance!

    ReplyDelete
    Replies
    1. You need to remove useless lines from updater-script as given in the guide.
      And also the size of MIUI system folder should not be greater than the system partition of your device. For that you can try deodexing the MIUI 7 ROM.

      Delete
  22. Hi Nitesh!
    I modified the boo.img as told by you. Also the deodexing tool wasn't working so I manually deleted some system apps to reduce /system size of miui to be similar to my base /system. But the problem still persists, it's stuck at the mi logo forever. Also I'm not able to take a logcat,adb refused to detect phone while booting. Could deleting system apps have caused an issue? Could there be a problem in SElinux? Please help.

    ReplyDelete
    Replies
    1. Try deodexing using SuperR's Kitchen to deodex your MIUI ROM since it's based on Marshmallow. And delete only useless gapps like Hangouts, PlusOne, NewsStand, Gmail, Music etc. which can be installed later on.

      Delete
  23. MIUI ROM V7 For Asus Zenfone 2 Laser Ze550kl ?

    ReplyDelete
    Replies
    1. You may need to wait for MIUI 7 for your device since Xiaomi has not yet released MIUI 7 based on Lollipop for Redmi 2 Prime. But it will be released soon...

      Delete
  24. Hi
    Iwant port cm13 for galuxy grand quattro from moto e duel same chipset and confrigation I can yous this tutoria for port cm13

    ReplyDelete
    Replies
    1. Yeah you can give it a try. It should work.

      Delete
  25. hi nitesh...great guide...trying to port roms for yureka through your method...so first question in a handful of questions to come later, is I unpacked the boot.img but cldnt find split_img..just a folder named boot.img-ramdisk and zImage...so I slh juz replace the zImage right ???

    ReplyDelete
    Replies
    1. Yes you can just replace the zImage.

      But which ROM are you porting and which tool are you using?

      Delete
  26. ported china version miui7 of mi4i...while flashing the rom, error - error executing update binary in zip :(...can u help ??

    ReplyDelete
    Replies
    1. Try changing the update binary file. You can also try removing some unimportant lines from the updater script.

      Delete
  27. Hi Nitesh,
    Actually I'm trying to port MIUI v7 based on marshmallow from Xiaomi Mi4 to OnePlus X but the ROM is not booting it'sit's stuck on Mi logo forever. Moreover I'm not able to get a logcat and also last_kmsg method is not working in order to know what's wrong.Can you please help? Thanks.

    ReplyDelete
    Replies
    1. If you have deleted any system file then you need to revert it to its original condition. Try to port Global MIUI 7 ROM or sMIUI 7. And deodex it using the latest SuperR's Kitchen.

      You may delete some unimportant gapps like PlusOne, GMail, GMaps, Chrome, Music2, Hangouts etc. from system/app/ folder to reduce the size.

      And edit the boot.img as directed.

      Delete
  28. Hi Nitesh,
    I am trying to port MIUI v7.0 for my YU4711 a.k.a Yu Yunique... I need your help!! Reply as soon as you see this... :) and I appreciate your for writing this helpful guide. ^_^

    ReplyDelete
    Replies
    1. You will need a MIUI 7 Lollipop to be able to port on your device. If your are taking Redmi 2 as port device then you may need to wait since MIUI 7 Lollipop is not yet released for this device.

      I think MIUI Team will skip Lollipop update for Redmi 2 and it will directly get marshmallow. ;)

      Delete
  29. Hello Nitesh.
    When i try to extract system.new.dat from your LewaOS7 port (yureka), extraction work but files are corrupted ?! (i use SystemExtractor 5.1)

    ReplyDelete
    Replies
    1. Follow the DAT extraction guide provided under "Common Information" section above.

      Delete
    2. sorry, same result. files are extracted but corrupted.
      i try this:
      i flash with twrp 3.0.0 (idol3) and immediatly make a backup. extract backup = files are corrupted too. very strange .....

      Delete
  30. Hi Nitesh, is is possible to port MIUI 7 to Zte Nubia z7 max? Which rom should I use as base?

    ReplyDelete
    Replies
    1. You should use Xiaomi Mi4 MIUI7 as Port and your stock ROM as base.

      Delete
    2. Hi Nitesh, I managed to find the ZTE Nubia Z7 max rom, MIUI 7 but its based on kitkat. (http://en.miui.com/download-259.html) How do I update the same to lollipop? My base rom is 5.1.1 lollipop and the Xiaomi Mi4 rom is also lollipop. Is there a way to update/replace any specific files without now porting the entire rom?

      Delete
    3. I porting also we add/replace some specific files to make the port ROM work. So if you want to use Mi4 Lollipop MIUI ROM then the only way is to port the ROM. You may find already ported MIUI 7 Lollipop ROM for your device on some chinese forums.

      Delete
  31. Hi Nitesh. Is it possible to port Redmi2 Prime's ROM to Wileyfox Swift? In last update they upgraded Redmi2's Android version to 5.1.1. If it possible, can you tell me how can I do? This method didn't work for Wileyfox Swift. Sorry for my bad English.

    ReplyDelete
    Replies
    1. Yes, it can be ported. Just follow the given method. And use the base ROM as directed. Also don't forget to deodex the MIUI 7 ROM. All the best.

      Delete
    2. take 32bit base then port redmi 2 prime miui

      Delete
  32. Bro will 32 bit miui boot on 64bit yuphoria or will it brick the phone

    ReplyDelete
    Replies
    1. It will not brick the phone, but it won't boot also.

      Delete
    2. But the stock aosp ROM of yuphoria is 32bit and it boots



      ??

      Delete
    3. Then first you have to flash the fastboot images of 32bit stock AOSP firmware. Then you may port MIUI 32 bit and it will boot.

      Delete
  33. Hello I have Wifi problem only.
    No file in lib/modules folder (Stock Rom)
    Stock Rom: CyanogenMod 12.1
    Port Rom: Color OS 2.1 - Api5.1.1
    Qualcomm Snapdragon 410 Msm8916

    ReplyDelete
    Replies
    1. Then try replacing these files:
      {*} lib/libwcnss_qmi.so
      {*} lib64/libwcnss_qmi.so

      Also the Wifi bug-fix has been updated above. Just review once.

      Delete
    2. Thanks but it didn't work.
      Wifi problem On Log /Sender: WifiHW, XTWiFiLP, WifiStateMachine
      WifiHW connected libhardware_legacy.so libs.
      When I change (lib+lib64) "libhardware_legacy.so" it doesn't boot ROM.
      I solved like this Flyme OS wifi problem but it didn't work on this ROM

      Delete
    3. Then first try replacing the wifi/wlan/wcnss related binary files in bin folder and also in etc folder.

      Delete
  34. Hello! It's possible now to make a porting to galaxy s6 from xiaomi mi5 rom?
    They have both ARMv8 processors and both android 6.0...

    ReplyDelete
    Replies
    1. But both have different chipsets. Cross-firmware porting is very difficult but you may try once.

      It will be much easier through MIUI Patchrom. But it has not been released either for lollipop or for marshmallow.

      Delete
  35. my devise is Huawei G8 (Rio-L01 dual sim). I used Mi4i for porting. But the device stuck on mi logo. Huawei is android 5.1.1 but I cannot find android 5.1 for mi4i. Please help

    ReplyDelete
  36. I ported miui 7 to my device and it successfully booted but after booting battery saver has stopped and xiaomi service framework has error is coming and the device reboots how to fix it

    ReplyDelete
    Replies
    1. The problem may be in boot.img or kernel. Try flashing any custom kernel. If not fixed then take a logcat.

      Delete
  37. I'm planning to port MIUI 7 to a Lenovo Vibe Z2 Pro (K920 CN), I have the stocks roms from KK (4.4.2) and LP (5.0.2) also I have the kernel source from both versions. Which version and which device do you recommend to port (mi note?) I'm concerned about the differences in the camera module and the display resolution. Thanks in advance.

    ReplyDelete
    Replies
    1. You can use your stock ROM (Kitkat) as base and port ROM from Xiaomi Mi Note MIUI 7 Global Stable edition (Kitkat). Camera and display should not matter much, just give it a try.

      Delete
  38. I have a serious doubt. Why is my boot.IMG getting more compressed than actual? Say the port device's kernel is 19 MB, after editing and stuff its coming to 8 MB! How? Is it bad?

    ReplyDelete
    Replies
    1. What is the size of your Port kernel and Base kernel?

      Delete
    2. maybe your stock rom is 32bit and port rom is 64bit ;)

      Delete
    3. No. It's 64-bit confirmed. @Nitesh, both are approximately what I said in the above comment

      Delete
  39. I was ported but when I was flashing it says error 6 how to solve

    ReplyDelete
    Replies
    1. Seems a issue of mounting. Check your updater script once, especially the lines regarding mounting system, data etc.

      Also check that the size of extracted ROM should not exceed the size of system partition of your device.

      Delete
  40. Can i port this rom to my Samsung Galaxy A8(A800F) 5.1.1?

    ReplyDelete
    Replies
    1. Yes, if your device has TWRP recovery.

      Delete
  41. At META-INF editing you said we should delete some lines. But how do they look like? I am trying to port from Redmi 2 5.1.1

    ReplyDelete
  42. can i take yu yunique stock rom as base rom for redmi 2?

    ReplyDelete
    Replies
    1. If you want to port Redmi 2 MIUI ROM for Yunique then take Yunique Stock ROM as base and Redmi 2 MIUI 7 ROM as port.

      Delete
  43. i am working on port flyme os from coolpad f2 to vodafone smart ultra 6,following your post, all work except camera app,it dont apear on app drawer....what can i do??

    ReplyDelete
    Replies
    1. Maybe your camera app is corrupt. Try any other camera app or use any ported flyme camera app.

      Delete
    2. is common in every camera app but now camera open and after 1 seg crash,with "cant conect to the camera" message

      Delete
  44. No bro. I want to port fom for Redmi 2. Can i take yu yunique stock rom as a port rom and cm 12.1 as base rom? And also bro i have very much doubts in porting the rom. How can i contact you personally?

    ReplyDelete
    Replies
    1. Yes, you can take.
      For contacting pm me on my YU forums account.

      Delete
  45. I have xiaomi mi4(cancro) and I want to use cynogenmod as base ROM and official miui 7.2 ROM as port ROM which is already made by miui team.Do I need to port the boot.IMG file too?

    Basically I need a ROM with multi window and doze support.so I thought installing cynogenmod ROM with miui UserinterfaceUseliace(I love iit) present.Plz answer whether I need to port boot.IMG too?

    ReplyDelete
  46. I'm trying to port Marshmallow MIUI from MI Note or MI3 on my Oppo Find7a (snapdragon801).
    It starts and goes in bootanimation, but It bootloop :(
    Can you help me, please ?
    I've ART and mmcamera errors...

    ReplyDelete
    Replies
    1. Try replacing system/lib,lib64/
      libart-compiler.so
      libart.so
      libsigchain.so

      And for camera follow camera bugfix method above.

      Delete
  47. hey bro. I have a "Galaxy Tab Pro 8.4 T320 Snapdragon 800" and I want to make a port of miui 7 "Nexus 5 Snapdragon 800" will be that I'll be able to start the rom? or patch me another device that is more compatible

    ReplyDelete
  48. Parasgrover492

    Can i port touch wiz from samsung j5 to redmi 2 by your method?

    ReplyDelete
    Replies
    1. You can try but I am not sure about it.

      Delete
  49. A radio image which lines, modem image?
    I dont found split-image, i use other tool to unpack boot.img
    So i do this without remplace de files Of split and i get a bootlogo

    ReplyDelete
  50. i port the rom to moto x, but the bootanimation dont load. just load the logo and afther shutdown. why?

    ReplyDelete
    Replies
    1. Edit boot.img correctly and use the tool suggested.

      Delete
  51. When i repack the boot imagen give me two files, new-boot.img and ramdisk.gpio.gz. Why? What i have to do With randisk.gpio.gz?

    ReplyDelete
    Replies
    1. You have to do nothing with ramdisk.gpio.gz.You just have to use the new-boot.img.

      Delete
  52. Hey! I am trying to port this to the LG G4 (international). I am using stock ROM 5.1 lollipop as base and MIUI lollipop 5.1.1 for Xiaomi Mi 4S because it has the same CPU, RAM and GPU.

    However, I did all of the steps but I can't get it to boot, it doesn't get past the LG logo. Are you able to help me please? I would really appreciate it! :D

    ReplyDelete
    Replies
    1. Most probably a boot.img issue. Check fstab.qcom in ramdisk of boot image and edit it correctly as mentioned in the guide. You can also try replacing lib,lib64/libart.so, libart-compiler.so, libart-dissembler.so and libsigchain.so.

      Delete
    2. i have camera and sound issue how to fix it my call works but external sound not working and camera will not start it crashes .

      Delete
    3. For Sound Issue:
      If you have already tried replacing the audio libs then replace system/etc/acdbdata/ files and system/etc/mixer-paths.xml.

      For Camera Issue:
      Replace all the libs related to camera in lib, lib64, vendor/lib, vendor/lib64, bin folders.

      Delete
    4. my phone bootloop when i replace libcameraservice.so what to do i only have two bugs in my custom rom now.

      Delete
    5. Try replacing lib,lib64/hw/camera.msm8916.so also.

      Delete
  53. bro followed every steps ....after flashing it shows like this
    when i hit reboot option
    zuk z1 logo> screen off >zuk z1 logo>screen off>come back to TWRP recovery

    ReplyDelete
    Replies
    1. Most probably an issue with fstab file or kernel. Check boot.img for errors. you can also try replacing system/lib,lib64/
      libart-compiler.so
      libart.so
      libsigchain.so

      Delete
    2. now showing miui boot animation .....continuously so took logcat here it is
      http://pastebin.com/ZTWDMNPW

      Delete
  54. HI, i tried porting cyanogenos 11 from yu yureka to redmi 2...and its booted and its working fine...I know both of them have different chipsets but it booted.and stable after fixes....and now i wanna port cyanogen os 12 nut all rom seems to to be having lib64 where as redmi 2 is 32 bit only......any solution for this

    ReplyDelete
    Replies
    1. You may need to wait for ARM 64 upgrade of Redmi 2 or look for any other port device with sd410.

      Delete
  55. This guide is for qualcomm based but I have meditek 6752 and notification light not work.. When lunching cit and test lights it's not blink my device support red and green light how fix this plzz tell me.. Thanks..

    ReplyDelete
    Replies
    1. Check system/lib/hw and try to find lights.****.so file. If such file is there replace it with base.

      Delete
  56. thanks for this great tutorial on how to port qualcomm rom. i most concede u rock. plz i need your help.i was able to port coolpad 8675 fhd rom to my tcl m2l but i always come across this same issues, no sound, camera force close and cant play video but i was able to fix the video issue by replacing files from system-etc, system-etc-fameware, system-etc-permission, & system-lib, but cant seem to find a fix for camera and sound. my phone use to bootloop whenever i replace libcamera-client file from system-lib and libaudios lib files from system-lib. what should i do next?

    ReplyDelete
    Replies
    1. You don't need to replace libcamera-client.so. The post have been updated with new bug fixes. Check the bug fixes section.

      Delete
  57. have fix sound bug by replacing all the mixer-path and audio files from system-etc. but theres still camera bug and wifi bug. wifi is optional to me. i can still do witbout wifi but camerA is something i cant do without.

    ReplyDelete
    Replies
    1. Try replacing the camera related files also check the boot.img for anything missed related to camera.

      Delete
    2. When you say that we need to compare fstab.qcom With meld . we just press the arrow ? so we must have to let both files in the same form

      Delete
    3. You can either replace fstab.qcom or edit it. Sometimes replacing works and some times editing. You can try both one by one. ;)

      Delete
  58. nitesh i Am using xolo black(Snap.615) and i port miui 6 from mi4i but one biggest problems in porting in my device have dual camera (13+2) so in miui 6 in my device camera is not working and all other small bugs i can solved them my own but pls help me to poting camera you my last hope pls help me

    ReplyDelete
    Replies
    1. Refer to Bug-Fixes section. The Camera fix provided above should work.

      Delete
  59. I have error 7 when I try install it. I have deleted the lines on updater script :(

    ReplyDelete
    Replies
    1. You must have done some mistake in updater script. Most common mistake is missing ";" at the end of each line. Check for it. Also delete "assert(getprop....." line if you have not already deleted it.

      Delete
    2. thanks for all your help my rom is very stable thank to you but there bare bugs with my phone when i charge without turning on the phone it first looks normal until 19 seconds pass it start to reboot and it repeat over and over so how to fix this bug on miui7 rom

      Delete
    3. and 3g data is not working how to fix that

      Delete
    4. Offline charging issue is really a well known bug of MIUI 7 Ports. You can check charging related lines in ramdisk/init.RC or init.qcom.rc.

      And for 3g data edit the "ro.telephony.default_network" in build.prop according to your base ROM.

      Delete
    5. How to fix camera con not connect with switching camera from front to back.

      Delete
  60. Thanks
    But can i ask u a question?
    Can i port the rom to my device (s2 plus)

    ReplyDelete
  61. good work you help me alot but i have one issue my divices is sd410 sd mean snap_drogan soc410 i was wondering where i can get roms from to port because the miui7 rom i port is not fixed for offline charging but i want to sometimes turn my phone off while charging.

    ReplyDelete
    Replies
    1. You can try porting ColorOS 3.0 from Oppo A37.

      Delete
    2. Hi Nitesh...
      I have ported MIUI7stable for Coolpad 8297L100..Everything is perfectly working. But at charging Battery light should be red as default but it is glowing yellow. and turns green at 89% (means Before 100&)............................

      As well trying to add option for home button double tap sleep and wakeup.and default app install in sd card.
      But when trying to decompile system.apk and other syst apks its done with errors...means decompiling incomplete..due to its not compiling again.
      i am using win7 32bt tryed apk tool advance apk tool and such more but its not working...used basic procedures already.
      Handset is Coolpad dazen18297L-I00
      qualcomm msm8916
      1.2Gh..kitkat4.4.4
      pls help to fix these things

      Delete
    3. Yellow Charging LED is a system feature and is not a bug. ;)

      And for decompiling apks you should use Jbart tool (google it) or use the aapt from that tool. And always use latest apktool.

      Delete
    4. Thanks a lot...
      And what about the led turns green before 100%
      (It is turning green at 89%)

      Delete
    5. It is not a big problem. It actually turns green at 90%, but 1% doesn't matter. But you can try calibrating your battery. And Green LED at 90% is set by MIUI devs so nothing much can be done from our sides.

      Delete
    6. Thanks a lot..
      Is it possible to port Samsung note prime KitKat rom to CP8297..same config.
      Already tried but sim cards are not detecting.

      Delete
    7. Try replacing etc/firmware/ files. This may fix the sim detecting issue.

      Delete
    8. Trying to decompile Settings.apk of MIUI7.3.1.0 global stable rom.and used advanced apktool,Android multitool, the error is-skipping"android"package group-tryed jBART also with latest apktool.

      Delete
    9. Try uninstalling Java 8 from your PC (use jdk 7) and use aapt from jBART while decompiling and compiling apks. And install app/miui.apk, miuisystem.apk, framework/framework-res.apk and framework-ext-res.apk as apktool framework using "apktool if " command. Follow this link for more: http://en.miui.com/thread-162639-1-1.html

      Delete
    10. Uninstalled java and installed java jdk and used aapt from jBART (with latest apktool)....but not working...same error again.its decompiling but not recompiling.
      ITS only with settings.apk other apps working great.MIUI6.2.8 settings is compiling but 6.7 ...7.2..and 7.3 stable global settings.apk is having issue.also tried jBART ,but same,
      expecting solution for it

      Delete
    11. There must be some problem in settings.apk. Try porting xiaomi.eu MIUI ROMs.

      Delete
  62. Which device would you recommend I use for moto x? I use mi2 but not boot

    ReplyDelete
    Replies
    1. You are using the correct port device. Just edit the boot.img correctly and replace the etc/firmware/ files with that of base.

      Delete
    2. where can i find ColorOS 3.0 from Oppo A37 and how to fix random reboots when i turn screen brightness done to max low this issue is it reboot to defualt brightness and also when phone display turn off it is reboot as soon as screen turn off
      while charging offline every time screen turn off and on i port the miui7 rom from yuphoria because every rom was 32bit and my kernal supports 64bit.

      Delete
    3. You can get ColorOS 3.0 here: http://www.oppo.com/in/downloads/.
      And for light sensor try changing kernel or replacing light and sensor libs.

      Delete
    4. how to make the system folder more smaller for color os try to remove some aps but when i flash the rom it got stuck on setup not going to home screen. i use META-INF buti do not thing that is the issue.

      Delete
    5. You must have deleted some core apps. Try to find what you deleted and check by flashing the apps one by one whether it boots or not.

      Delete
  63. My stock rom was archived as dat format but my base ROM no archives what would I do my mobile was moto g3

    I was tried this whole process another website in XDA and miui forms with our archiving .bat it was not working in moto g3


    What would I do please help me

    ReplyDelete
    Replies
    1. Follow this method: http://forum.xda-developers.com/android/software-hacking/how-to-conver-lollipop-dat-files-to-t2978952

      Delete
  64. can i try this method on moto e 1st gen with samsung galaxy grand quttro rom as base

    ReplyDelete
    Replies
    1. Yeah, you can try if they have same chipset.

      Delete
  65. I can use this miui rom for moto x? Port this rom mi2
    http://en.miui.com/forum.php?mod=viewthread&tid=306444&extra=page%3D1%26filter%3Dtypeid%26typeid%3D415%26typeid%3D415&mobile=2

    ReplyDelete
  66. Please suggest me base rom and port rom, for Oppo R7 plus, i want to port MIUI 8 for R7 plus device, which has the same processor as Yurekha, and IT has Cm13 official Support to, shall I use Stock Color OS, as base or CM13, (Note: Stock Color os is based on lollipop 5.1.1) please advise...

    ReplyDelete
    Replies
    1. You can use Mi4i MIUI 8 as port ROM. And you can use CM 12.0 as base ROM (if you have) or you can try Color OS 2.0 based on Android 5.0 as base.

      Delete
  67. Replies
    1. It's required to use SuperR's Android Kitchen which can deodex ROMs and makes ROM porting a lot easier. But it's not compulsory if you are porting an odexed ROM.

      Delete
  68. Thanks ....
    In the MIUI7beta rom from XDA for CPdazen1....there is a option in settings "Advanced settings" in that option we can install apps direct to SD card...and on great feature also that is doubletapp HOME button to sleep and wakeup device..
    I found one app in system/priv-app/stocksettings.apk is used for these all feature.
    pls suggest how to Add this in my poreted rom.
    and also i want to remove "child mode"..."Lite mode" from settings.
    need your help

    ReplyDelete
    Replies
    1. Try replacing the settings.apk with the other one. Or you may try modding settings.apk by decompiling it using apktool. You can find related posts in miui forums. Just search for that.

      Delete
  69. hi nitesh..im from indonesia,can i port this rom to my device which is msm8929 sd415..my device is rebranding from hisense l676..if this cant..so can you tell me which miui8 that i can port to my device
    sorry for my bad english

    ReplyDelete
    Replies
    1. You can try porting it from Redmi 2 which has the same chipset.

      Delete
  70. but i read from gsmarena.com redmi 2 is sd410 msm8916 and my device is sd415..so far i know that sd410 using 32bit but 415 using 64bit..correct me if im wrong

    ReplyDelete
  71. while deodexding cm 12 i got error boot.oat not found deoxdexding

    ReplyDelete
    Replies
    1. CM 12 ROMs are already deodexed, you don't need to deodex them. LOL!

      Delete
  72. Hey Nitesh, you have even marked ramdisk.cpio.gz to move from base to port and in the text you haven't mentioned about ramdisk.
    And I had some questions to you, can't we just use the ramdisk of MIUI? Can I use GPe as my base to port MIUI 8? My device: Butterfly 2, Port Device: Mi4

    ReplyDelete
    Replies
    1. No need to replace ramdisk.cpio.gz. There's a mistake in the SS. I will correct it asap.

      Yes you can use the Ramdisk of MIUI but you have to modify it if required.

      Yes you can use GPE ROM as base.

      Delete
    2. And can HTC sense zImage be used?

      Delete
  73. Can MIUI 8 of mi5 be ported to OnePlus 3? They have Same snapdragon processor 820 but different speeds.

    ReplyDelete
    Replies
    1. Different speeds don't matter, HTC One M8 has MSM8974AB at 2.3 GHz and HTC Butterfly 2 has MSM8974AC at 2.5 GHz and we don't do anything special to port from M8 to B2, just fix camera, NFC, Wi-Fi and create a working boot.img.

      Delete
«Oldest ‹Older Showing comments 1 – 200 of 330 Newer› Newest»

Your comments are valuable for us. So please don't SPAM. Your comments are checked by human beings, so in any case SPAM comments will not be published.