[Guide] Fix All Bugs When Porting Custom ROM

This guide is to fix all the problems that you may face in your device after porting a new ROM. Using this guide you will able to fix bluetooth, camera, sdcard, radio, No Signal and many more issues in any Custom ROM for MT65xx device. This is universal guide and will work on all MT65xx devices.

Replace From Stock To Port :

To fix Radio and No Signal :
- \system\etc\firmware\mt6620_patch_e3_hdr.bin
- \system\etc\firmware\mt6620_patch_e6_hdr.bin
- \system\etc\firmware\WMT.CFG
- \system\lib\modules\mtk_fm_drv.ko
- \system\lib\libfmcust.so

To fix Bluetooth :
- \system\lib\libbluetooth_mtk.so
- \system\lib\libbluetoothem_mtk.so

To fix Wifi :
- \system\lib\modules\mtk_stp_wmt.ko

- \system\lib\modules\mtk_wmt_wifi.ko

To fix Storage :
For 4.2.2
- \system\etc\vold.fstab

- \system\etc\vold.fstab.nand
For 4.4.x and 5.1.1
-  /system/bin/vold 
- /system/bin/pq
- decompile framework-res.apk of both stock and port and replace storage_list.xml and recompile

To Fix Camera :
- \system\lib\hw\camera.default.so
- \system\lib\libcamera_client.so
- \system\lib\libcameracustom.so
- \system\lib\libcameraprofile.so
- \system\lib\libcameraservice.so
- \system\lib\libmhal.so
- \system\lib\libmhalcontent.so
- \system\lib\libmhaldrv.so
- \system\lib\libmhalmdp.so
- \system\lib\libmhalpipe.so
- \system\lib\libmhalscenario.so
- \system\lib\libmhalutility.so
- \system\etc\permission\android.hardware.camera.front.xml
- \system\etc\permission\android.hardware.camera.xml 


To Fix Bootloop :
- libandroid_runtime.so
- libandroid_servers.so
- libmedia_jni.so
- Repack boot.image

Fix Sensors :
- /system/bin/akmd*
- /system/lib/libsensors- so
- /system/lib/libms3c_yamaha- so
- /system/etc/firmware (folder)
- /system/bin/servicemanager

To Fix GPS :
- /system/xbin/ibmnlp 
- /system/etc/gps.conf

Fix Touchscreen :
- /system/usr

- /system/usr\keylayout\Generic.kl ->fix HomeKey 

Fix Sound/Audio :
First Replace :
- \system\lib\libaudio.primary.default.so
If it doesn't work then replace all :
- \system\lib\libaudio* .so


So, this is it. I hope you were able to fix issues and bugs in your Custom ROM for MTK. If you have any more bug fixes then please comment them below.

Credits :
- Ajit Guraya
- jawaad_s
- Scrack
[Guide] Fix All Bugs When Porting Custom ROM [Guide] Fix All Bugs When Porting Custom ROM Reviewed by MTK Hacker Pro on 9:59 AM Rating: 5

102 comments:

  1. How about Unfortunately com.android.systemui stopped?
    Also when locked and I try to unlock it, no display. Just black. Only capacitive keys light up.

    I am trying to port the miui 7 rom that's here in your blog in my MP Agua RIO, clone of wiko rainbow.

    ReplyDelete
  2. Thanks,i tried to port cm 12.1 for my phonepad duo x510u but stuck on boot logo;i'll try to fix bootloop asap

    ReplyDelete
  3. Try to replace libhardware_legacy.so but i'm not dure only i found it on a miui forum

    ReplyDelete
  4. Add
    qemu.hw.mainkeys=1
    at the bottom of build.prop to remove an unwanted navigation bar.
    (just thought I'd add something)

    ReplyDelete
    Replies
    1. thank you
      also correction : first search if that line is present or not, if it is present don't add it or you will be stuck at animation or will have bugs

      Delete
    2. Good point. I never found a ROM that already had it, so I didn't consider it.
      Another thing that comes to mind is replacing libcustom_nvram.so in order to solve audio issues. As far as I know, you have to do a factory reset afterwards, for it to produce effects.

      Delete
    3. nowadays all ROMs have it, libaudio.primary.default.so 90% of the time solves it

      Delete
  5. how to fix sound recorder, google search, record in messenger problem whit microphone?

    ReplyDelete
  6. Another one I just figured out when trying to port MIUI 7 for MT6592:
    In case there's no sound output from the speaker, replace these:
    system/lib/soundfx/libaudiopreprocessing.so
    system/lib/libaudio.primary.default.so
    system/lib/libaudiocompensationfilter.so
    system/lib/libaudiocustparam.so
    system/lib/libaudiosetting.so
    system/lib/libaudioutils.so

    Any other files replaced may result on a bootloop (MIUI is very picky). As a matter of curiosity, I took those files from a CM12 ROM, instead of the stock.

    ReplyDelete
  7. Any idea how to fix malfunctioning hardware (capacitive) keys in ported ROM's?
    Pretty much 80% of all ROM's I port to my device, a Kingzone K1 Turbo (MT6592), 4.4.x and 5.x.x, have strange behaviour on the hardware keys.

    Home button is mostly the problem as it doesn't go back to the homescreen but just ''selects'' a file or entry in a menu or something..

    Which files control the hw keys and which should I replace? If I can get the hw keys working I can get pretty much every ROM here fully functional for my phone type from simple CM11 4.4.4 to Bliss / Carbon 5.x.x...

    I have a stock 4.4.2 ROM with 3.4.67 kernel available and also a decently well working CM12.1 ROM specifically for my phone model which has working keys.

    I have another question as well. The CM12.1 ROM available for my phone has a wierd problem with the camera which means photo's work but only shows 5MP or lower for the camera which is a 14MP (Sony sensor) model. Also vdeo recording doesn't work as it ''can't connect to the camera''. Happens with all camera apps.

    Any ideas?

    ReplyDelete
    Replies
    1. replace genric.kl
      CM 12.1 was not made for your device. The developer just ported it from device having 5MP camera

      Delete
    2. Thanks. I'll see if i can get hw keys working in CM11 and Bliss. If i can they should be more or less fully functional ROM's.

      Delete
  8. Can u make a Guide for usb debugging? Pls. My device is not recognize on my computer. Even though i installed it. I saw guides but not for mtk devices.

    ReplyDelete
    Replies
    1. please do some research before you comment stupid things, no offense

      Delete
  9. Got another one for you for my Kingzone K1 Turbo.

    I managed to get both the hardware keys and audio fully working in BlissPOP using the libs from a working CM12.1 ROM for my phone.

    The only actual important thing not working now is the 2nd SIM slot. It has a full size SIM (SIM1) and a microSIM (SIM2) and the SIM2 microSIM slot has no data connection. Only EDGE. It does work in CM12.1.

    Which files can I replace to have a chance at getting both SIM slots to work? I currently don't have a full size SIM card so.. Would like to keep using slot 2.

    ReplyDelete
    Replies
    1. Oh btw, lots of thanks for all your help so far. You've been amazing!

      Delete
    2. amazing thanks for the share. Are you using the new beta 6

      Delete
    3. Actually i'm using a build from needrom.com from fire855 and skysauger and some others who made it for the Kingzone. It works pretty well but is far from complete. It's based on the Beta 6 as far as I know.

      I discovered the camera and GPS aren't working either but i'm zipping a test ROM with the camera and gps libs from that ROM now..

      Delete
    4. Camera works, GPS doesn't. Autorotation and compass (sensors) don't work either. This is going to be a lot of work.. :)

      Delete
    5. don't expect the GPS to work, for now that is

      Delete
  10. Hi, after have ported a Lollipop rom for MT6582 devices I can't access to my recovery, if I install it (with mobileuncle or spflashtool) I have a bootloop issue into recovery. There is a solution ? Please

    ReplyDelete
    Replies
    1. the recovery you are using conflicts with the ROM, no option either chose recovery or the ROM or try any other Lollipop ROM which ROM did you actually try

      Delete
  11. I have tried Carbon rom, Blisspop rom, and now cyanogenmod 12.1 beta 6 rom

    ReplyDelete
  12. Can i port micromax aq-4501 lollipop manufacturer rom to my alcatel onetouch pop7 running 4.4.2 stock kitkat?
    Both devices carries the chipest wich is mt6582
    But the cores of cpu are different but the ghz is the same and also both 32bit
    Please need reply as fast as u can im about to do it
    Im not afraid of soft brick i can fix it but wanna know if its possible....thanks a lot

    ReplyDelete
  13. I bumped into a couple of issues while porting a MIUI 7 to my device, maybe someone knows how to solve them.
    First, I must admit it was a "dirty" port: I didn't replace the whole lib/hw folder, I didn't port /mddb folder, and some others. Instead, I just ported the essential files for the ROM to boot on my device (mainly libMali, hwcomposer, libfeatureio, libcameracustom, libdpframework, vold, sdcard, and little more), and it's been working rather nicely for such a weak port xD
    My problems at the moment are:
    1 - Wrong RAM being displayed on the recent apps screen. This has happened to me on a few ROMs already, and I couldn't figure out what causes it yet. My device has 2Gb RAM, the device from which I ported has 2Gb RAM, and the ROM now presents me 2.2Gb RAM :/ Not changing the device in build.prop didn't help, by the way.
    2 - MTKDroidTools doesn't detect the phone when connected to the PC, and adb devices doesn't find any. So far, this only happened on this specific MIUI 7, and I see no reason why ADB would run off like that. The device is shown on windows as a media device, and I can transfer files to and from it in MTP mode (storage and sdcard), but no ADB. I also tried uninstalling and reinstalling all drivers (VCOM, preloader), and it made no difference. Being this such a weird issue, I was wondering if it is possible that some kind of update is needed to PDANet, or if I should try porting some adb related files from the stock ROM.

    Any help is appreciated. Thanks beforehand.

    ReplyDelete
    Replies
    1. RAM can be changed from build.prop (i believe, mostly in build.prop)
      did you turn ON Usb Debugging

      Delete
    2. The ADB issue is solved: I'm an idiot xD
      Looks like, on this particular ROM, ADB is only available through PTP mode, instead of MTP, and it never ocurred to me to change it -.-' It's working perfectly now.
      Regarding the RAM, I have no idea what to change on build.prop, and comparing to the build.prop of ROMs without that problem, I see no difference that might cause it. I'm more inclined to think it's a side effect of a bad port, like libs needing to be replaced. Still doesn't make much sense, but everything's possible when we don't do things properly xD
      Thanks for the help, though ;) I'll try to do a decent port next time and see if it gets fixed (in which case I'll really have to pinpoint the issue, which will be a pain, lol)

      Delete
    3. no, even if you do a complete port the ROM whill show RAM of the device from which you ported. MIUI used to have it in build.prop maybe they changed it

      Delete
  14. Hey bro, ¿you know how to fix "can't connect to microphone" issue? I had have that problem with Google app, whatsapp and facebook messenger

    ReplyDelete
    Replies
    1. in CM based ROMs ? if yes there is already a Q/A post for lollipop which has a fix for it

      Delete
    2. It is CM bases, but is KitKat not Lollipop, anyway, i'll give it a try. Thanks

      Delete
  15. hey bro just a little help

    ussd code is not running. I'm not able to know my balance. every time I dial the number ussd code runs and in few second it disappear and normal screen appears. what should I do.
    simple suggestion pls

    ReplyDelete
    Replies
    1. USSD is bug in all CM and CM based ROMs, already stated that

      Delete
    2. the simple suggestion is go back to your stock rom nad read posts before you comment

      Delete
    3. yes thanks but i already flashed my stock rom now it has this prb :(

      Delete
  16. I have a problem, my camera doesn't work very well and my phone storage (16Go ROm I mean) can't be mounted. I already tried to fix it using this topic, but it doesn't work for both. So if someone have this problem, and that he has solve it, I'm listening ! thanks in advance for help

    ReplyDelete
  17. Hello, i've got the known problem of touchscreen "reversed" but when i try to overwrite libinput.so with the stock one, the touch doesn't react at all apart of the virtual keys (home, back, menu).
    Can you help me please?
    Thanks

    ReplyDelete
    Replies
    1. then get back the original libinput.so and follow the post "Fix upside down screen" it can be found in the tutorials section of this website

      Delete
    2. I've already done the trick on build.prop (ro.sw.hwrotation = 0 ==> 180) and the lcd is ok, but the touch sensor is always y-inverted relative to the lcd. Excuse me if i put my question in the wrong section.

      Delete
    3. unfortunately i've not libMali.so

      Delete
    4. libmali is an important file bro, look for it

      Delete
    5. I haven't any libMali.so file either in stock and port rom.
      If it can help... i'm trying to port a rom from star 9500 to jiayu g3s both mtk6589 and android 4.2.1.
      thank you

      Delete
    6. there is something really wrong, libmali.so is a really really important file and it is no possible for it to just "not be there"

      Delete
  18. Hello to all !
    What if I can't connect to playstore? It says "Check your connectin and try again" but I have a strong signal in wifi. Is there something I need to copy from my stock rom?

    ReplyDelete
    Replies
    1. stock ROM ? custom ROM ?
      email me at : ajit4guraya@gmail.com

      Delete
  19. Bro,
    when switch off and switch on phone not power ups.but,reboot from recovery works.

    also data connection not working with two sims inserted

    ReplyDelete
  20. Navigation Bar problem. Please Help

    ReplyDelete
  21. Sorry for being a Noob. But how do you copy these files from the stock Rom to your Rom ?

    ReplyDelete
    Replies
    1. I looked in the comments above and a guy solved his no sound problem using files from CM12 Rom , So i downloaded a CM12 nightly rom and it doesnt have the .so files.

      I have flashed the MIUI 7 rom on my Idol x+. And there is no sound. I ll try from the stock rom. Hope it works

      Delete
    2. Hey I copied the lib files from a stock rom and now my phone wont start. Helppp Mee

      Delete
    3. your android phone is hard bricked if it doesn't boot anymore.
      study this tutorial to unbrick
      http://www.mtkroms.com/2015/02/how-to-backup-and-restore-your-mtk.html

      Delete
  22. How to fix Navigation bar problem When porting ROMS? Please help

    ReplyDelete
    Replies
    1. if you don't intend to tell what the exact problem is then how do you intend me to provide a solution

      Delete
  23. how to solve "can't connect to camera" bug on lollipop 5.1 rom
    having chipset MTk 6753?

    ReplyDelete
  24. Can't download on google play store it's downloading but stock on 98% or 95%" I tried different apps but its the same, and I all tried install my apk file its installed and work fine.
    The custom rom I tried is [4.2.2] LolliFox ROM For MTK6572*Only 126MB*
    thanks for any help to fix this bug.

    ReplyDelete
  25. Hi, I dont like the keyboard' I like to replace it ios8 keyboard, what files I will replace? I think system/usr/keylayout?

    ReplyDelete
  26. gps,all sensor, and compass arent working but its detected. what should i do sir?
    i port cm12.1 stable v3 mt6582

    ReplyDelete
    Replies
    1. i haven't posted about that ROM so ask the dev not me

      Delete
  27. Sound is not working on MT 6592 (htc desire 820 G Plus), if i replace libaudio.primary.default.so file then mic dont work and i have replaced the audio_policy.conf file but still mic got disappeared. if i connect headphone then i can talk through headphone mic , please anyone solve my issue

    ReplyDelete
    Replies
    1. Samsung s5 Lollipop themed rom http://www.mtkroms.com/2015/04/galaxy-s5-for-mt6592.html
      sorry for late reply , please can you solved it for me , i loved this rom and everything is working except the mic

      Delete
  28. I ported 2 different rom and i have 1 bug and i cant find solition. after flashing rom it install itself nicely boot is done , after boot 1 or 2 minutes later it stuck and reboot, again, again, again. do you have any idea for this? thanks

    ReplyDelete
  29. HI, I ported cm12.1 beta 4 for mtk to a wiko sunset 2. The rom is booting and, thanks to this guide, I got Wifi and Bluetoeth working. Anyway, I still cannot get radio (RIL) and audio working following this guide. Can someone help me?

    ReplyDelete
  30. hi boss one help pls if i locked my phone i can't open it until i remove my baterry from phone

    ReplyDelete
  31. Hi I want to fix the camera"
    because when I'm going to open camera something appear like unfortunately gallery has stopped"
    but when I'm going to fix this, replacing files from stock rom to port rom
    some files is missing from the stock and custom rom
    the following are missing
    libmhal.so
    libmhalcontent.so
    libmhaldrv.so
    libmhalmdp.so
    libmhalpipe.so
    libmhalscenario.so
    libmhalutility.so

    Thanks for the help to fix it.

    ReplyDelete
    Replies
    1. same for me, also i replaced all camera* .so and still fron camera dont work so maybe some file is missing or other file is needed to replace

      Delete
    2. Hopefully someone can help us to fix it,
      this is the common bug of custom ROMS I tried'
      I'm still searching to find out to fix it'
      try and try :)

      Delete
  32. Everything is good....but camera is green & when I connect Headphone, System UI stops

    ReplyDelete
  33. Hi Hacker Pro, thanks for the great ROM and porting instructions.

    I installed the Bugless CM12.1(http://www.mtkroms.com/2015/12/bugless-cyanogenmod-12.1-for-mt6592.html) ROM on my Tecno phantom z mini. It works well except the camera. Tried all the above fixed, but still getting 'Unfortunately, Camera has Stopped' each time I try opening my camera app.

    Please any help will be much appriciated.

    ReplyDelete
  34. it says com.android.systemui and com.android.phone has stopped how can I fix it

    ReplyDelete
  35. hi sir how i can fix my issue to xolo hive rom to my cloudfone excite 501o. it successfully booted and use the rom but in a couple of minutes it turn white screen and reboot.. and also the volume,power, and capacitive button not working how can i fix this issue.. tnx

    ReplyDelete
  36. i have ported ur rom succesfully but with some bugs .
    1)rom internal storage shows incorrectly tried replacing vold and sdcard and res.apkbut no use.
    2)cant add google account it says doesnt have reliable connection but browser works fine .
    please help me clear this bug

    ReplyDelete
  37. Hi, I don't know how to port cuz I don't have a computer and my phone is low budget. I tried replacing "system/lib/libaudio.primary.default.so" but it doesn't work. I took out the file from a stock rom thou.

    ReplyDelete
  38. hey bro, can you help with this problem, after i ported CM 12.1 and flash it to my Pulse X140, it's stuck on boot logo,

    ReplyDelete
  39. Hey sir.
    I have ported dark fab mtk 6582 jellybean i flash it with philiz recovery i show ne bootloop i have remove battery and add it agian and i opened recovery abd aroma file explorer and i go to dalvic cache folder i found the system have optimized 15 file all of them from the framework so ithink the system run framework folder and doesn't go to the app folder.
    Thank you for listing to me.

    ReplyDelete
  40. Bro Can You Help me... I Cant Fix The Audio of Exodus 5.1 Lollipop CM12.1 Base.. Please.. I Already Replace the libaudio.. but nothing happens... But when im using headsets.. Its Ok but if its Speaker.. nothing.. Help me bro

    ReplyDelete
  41. when i ported the cm 12.1 rom the keys and buttons
    doesnot worked how to fix this help me pls

    ReplyDelete
    Replies
    1. delete usr folder and use usr folder from working CM ROM (if no, then use from stock)

      Delete

  42. Please help me. I flashed Samsung S5 custom rom on my Infinix Note, the rom is very cool and I am heads over Hills but when making a call, I can hear the other person but he/ she can not hear me. Please assist me with any solution. Thanks

    ReplyDelete
  43. cyanogen 12.1 how to fix a audio bug
    (i have tried your tutorial not work)
    please help

    ReplyDelete

Powered by Blogger.