FORUMS
Remove All Ads from XDA

 View Poll Results: Is my GUIDE useful??How is it compared to other??

Awesome ,, Best of the best
 
45 Vote(s)
54.22%
It's really good
 
32 Vote(s)
38.55%
Yes , it's like others - it does the work
 
4 Vote(s)
4.82%
Average ,, not so great
 
2 Vote(s)
2.41%

[Guide] AIO PORTING GUIDE [MTK-QUALCOMM-RECOVERY-BUGFIX-VOLTE]

275 posts
Thanks Meter: 329
 
By kuberrocks96, Senior Member on 13th February 2017, 05:09 PM
Post Reply Email Thread
ALL IN ONE PORTING GUIDE

by @kuberrocks96

Code:
/*
 * Your warranty is now void.
 *
 * I am not responsible for bricked devices, dead SD cards,
 * thermonuclear war, or you getting fired because the alarm app failed. Please
 * do some research if you have any concerns about features included in this ROM
 * before flashing it! YOU are choosing to make these modifications, and if
 * you point the finger at me for messing up your device, I will laugh at you.
 */
INDEX:
GUIDE FOR MTK
MTK BUG FIXING
RECOVERY PORTING
QUALCOMM BUG FIXING


ABOUT ME :
My name is Kuber Sharma aka AlphaGeek , mostly known for my work for Coolpad Note 3 , Note 3 Lite and Note 3 plus. A blogger and a YouTuber , ex member of A.M.T and a founding member of Team Zero

Update:-
Code:
*Updated Bug Fix Guide for MTK
*Added SNAPDRAGON Bug fix guide.
*Guide to port TWRP also updated.
*Improved the thread.
*Added more fixes.
*Qualcomm porting guide added.
This is for all those users who want to port roms and use them in their devices.

But , before porting any rom,here are some of the main things you should keep in mind.


1)Base Rom :-
What is a Base Rom?
Code:
Base Rom is reffered to the Stock rom or the Default Rom of your device or sometimes the rom from which you will take base files(libs,apns,modem etc).
2)Port Rom
What is a Port Rom?
Code:
Port Rom is the rom which you will port for your device.
like if you are working a rom of another device having similar specifications and porting it for your device then it is called PORT ROM.
3)Kernel
What is a Kernel?
Code:
The kernel is a computer program that is the core of a computer's operating system, with complete control over everything in the system.
the central or most important part of something
In easy words kernel acts as the middle man between the Software and the Hardware
When porting a rom , you should check the Kernel version of the Port Rom and the Base Rom

They both should be similar,
like you can port from :

3.18.xx to 3.18.xx only
3.10.xx to 3.10.xx only



BUGS IN THE BASE ROM OR IN THE PORT ROM.


Yes , our Base Rom and the Port roms may contain bugs,
Those bugs will exist in our final Ported Rom also so , fixing those is not possible - Its always recommended to use a Stable or near to Stable Roms but hi, Custom Roms are made for pleasure only and these roms can't take place of stock roms.
Many users don't like Stock Rom (i.e Default Rom) so , they look for a Custom Rom.


Now let's talk about the main topic for which YOU ARE HERE!
PORTING A ROM!



In this Guide, i will tell one of the most easy way to BOOT UP THE ROM.
So, lets begin,
This guide will focus on MT6735/MT6753 porting.
Device i used is Coolpad Note 3 Lite
CPU:MT6735



But, it will work mostly on all MT675X SoCs , this can also be useful for MT67XX series but , My main focus is on MT675X


Without any delay let's talk about how you should port a ROM and what should be your focus at

YOU SHOULD FOCUS ON BOOTING THE ROM INSTEAD OF BUG FIXING AND DOING OTHER THINGS.

WHEN YOU PORT A ROM CHANGE FILES WISELY

DONT JUST COPY PASTE

PORTING A ROM CAN GET TOUGH ACCORDING TO THE ROM, LIKE PORTING AN AOSP BUILD CAN BE EASY BUT PORTING A MIUI BUILD IS CONSIDERED ONE OF THE MOST TOUGHED AND IRRITATING THING.

RESPECT THE EFFORTS BY THE PREVIOUS DEV.

CREDITS, WHEN YOU PORT A ROM THAT ROM WAS MADE BY SOMEONE , PORTED BY SOMEONE or BUG FIXED BY SOMEONE - SO BY ANY MEANS IF YOU KNOW THE SOURCE AND THE DEV OR TEAM WHOSE BUILD YOU ARE PORTING PLEASE GIVE CREDIT.

THANKS.


NOW , FINALLY. LET'S TALK ABOUT THE PORTING GUIDE WHICH YOU ALL ARE WAITING FOR.

What you guys need:-
Code:
1)Base Rom
2)Port Rom
3)Any good Notepad
4)Any Boot.img repack or unpack tool
5)Brain

Now , if you have all the above mentioned things , Lets proceed.

BOOT.IMG :-

BOOT.IMG contains all the magic , it has the KERNEL inside which is one of the main thing.

Porting from Same CPU & GPU:-

NOTE:- When you are porting from a Similar device having same chipset like porting from:-
MT6753 TO MT6753
MT6735 TO MT6735

Use this method (95% times working ):-

System/lib & lib64 :-
Code:
libaudiocomponentengine.so
libaudiocustparam.so
libnvram.so
libnvramagentclient.so
libnvram_platform.so
libnvram_sec.so
libcustom_nvram.so
System/etc :-
Code:
/Firmware folder
/apnconfig
/spnconfig
/agps_profile_conf2
/media_codecs.xml
BLACK SCREEN AFTER LOGO???
REPLACE THIS LIB:- libcam.paramsmgr

To Fix Camera ( sometimes bootloop so try one by one ) :-

from System/lib & lib64 replace all libs starting like this:-
Code:
libcamera.mt6735 (mt6735 is according to my CPU )

 libcameracustom.lib etc
libcamalgo.lib

Unpack Boot.img of both Base & Port Rom

Code:
replace kernel
and init.mt6735.rc ( not recommended always)
and Fstab.mt6735
System/Lib(/64)/HW*

Done , Now zip em and flash.

90% Rom will boot with BUGS! ( NO ROM IS THERE WITHOUT BUGS, LOL)



==>READ BUG FIX METHOD ALSO{Later in this Guide}<==


For Cross Porting Like:-

MT6752 etc to MT6753/MT6735

DO REMEMBER TO CHANGE :-
Code:
System/xbin/mnld
System/mddb
System/etc/firmware
System/etc/Apnconf
System/etc/spnconf
In lib(/64)/HW :- add files accordingly to your CPU or rename them.

BLACK SCREEN AFTER LOGO :-
Code:
libcam.paramsmgr
BOOT.IMG PORTING:-

UNPACK both Base Rom and Port Rom Boot.img

In PORT ROM BOOT.IMG:-
Code:
replace the boot.img-kernel
and in ramdisk folder add these files from Base Boot.img to Port Boot.img

Code:
fstab.mt6735
init.mt6735.rc
init.mt6735.usb.rc
Note:- Name may differ a little according to your CPU

REPACK THE BOOT IMAGE

NOTE:- If u get WIFI AND BLUETOOTH NOT SWITCHING ON OR BATTERY PERCENTAGE THEN REPLACE
Code:
init.project.rc
Done , You have succesfully ported Boot.img


Now , Lets focus on BUG FIXING


Bug Fixing isnt easy as it seems.
Replacing any wrong file or not supported file can easily give you bootloops.

It depends from ROM to ROM.


BUG FIXING[MTK]


Let's Begin.
If any lib missing in Base leave that - DONT WORRY


NOTE:- CHANGE LIB FILES FROM BOTH lib & lib64 folders


[I][SIZE="3"]

If you face "This rom is for Coolpad Note 3 Lite and your device is "K4Note"
To remove this delete the assertlines in Updater-script

ALWAYS CHANGE DPI IN BUILD.PROP ACCORDING TO YOUR STOCK ROM

Bootloop when porting
Code:
*libandroid_runtime.so
*libandroid_servers.so
*libmedia_jni.so

*Repack boot.image (properly)
RadioFM
Code:
\system\bin\fmradio
\system\etc\firmware\mt6620_patch_e3_hdr.bin
\system\etc\firmware\mt6620_patch_e6_hdr.bin 
\system\etc\firmware\WMT.CFG 
\system\lib(/64)\libfmcust.so
/system/lib(/64)/libfmjni.so
Sensors
Code:
/system/bin/akmd*
/system/lib/libsensors.so
/system/lib/libms3c_yamaha.so ( acc. To device)
/system/etc/firmware (folder)
/system/bin/servicemanager
/system/bin/sensorservice
System/bin/msensord

system/etc/permissions/:-
android.hardware.sensor.xxxxx.xml

FIX Offline charging:-

Code:
In Boot.img -> sbin/healthd

System/Lib(/64):-
Showlogo

System/bin:-
Kpoc_charger

Bluetooth\Wifi not turning On\Off(old)

Code:
\system\lib\module\mtk_stp_wmt
Wifi
Code:
/system/etc/wifi (folder)

/system/bin/netcfg
/system/bin/dhcpcd
/system/bin/ifconfig
/system/bin/hostap
/system/bin/hostapd
/system/bin/hostapd_bin
/system/bin/pcscd
/system/bin/wlan*
/system/bin/wpa*


/system/lib(/64)/libhardwarelegacy.so

Hotspot:-
Code:
/system/bin/netd
*follow Wifi fix also*

Camera

Code:
 firstly try one by one:
\system\lib(/64)\libcameracustom.so
\system\lib(/64)\libcameraservice.so
System/lib(/64)/camalgo
/system/etc/media_profiles.xml
/system/lib(/64)/libcamera.so
/system/lib(/64)/liboemcamera.so
\system\lib(/64)\hw\camera.default.so
\system\lib(/64)\libcamera_client.so
\system\lib(/64)\libcamer aprofile.so
\system\lib(/64)\libmhal.so
\system\lib(/64)\libmhalcontent.s o
\system\lib(/64)\libmhaldrv.so
\system\lib(/64)\libmhalmdp.so
\system\lib(/64)\libmhalpipe.so
\system\lib(/64)\libmhalscenario.so
\system\lib(/64)\libmhalutility.so
\system\etc\permission\android.hardware.camera.front.xml
Other cam files if any
*try one by one*


CamCoder/HwDecoder
Code:
\system\lib\libOmx*.so 
system/etc/media_codecs
 
Green/pink Camera / video lagging
system/lib(/64)/libdpframework.so

SD card/Memory


Code:
mt67**.fstab in boot.img

/system/bin/vold
/System/bin/pq

System/bin/sdcard
WhatsApp Media Fix:-
Code:
from System/bin/  replace these files:-
Media
mediaserver
netd
service
servicemanager
surfaceflinger

GPS
Code:
\system\xbin\libmnlp 
/system/etc/gps.conf
Touch Screen(Haptic)
Code:
/system/usr
/system/usr\keylayout\Generic.kl ->fix HomeKey
NFC ( experimental)
Code:
System/etc/: Nfc files 
System/etc/permissions/ nfc files
System/lib/libnfc****** ( all starting from nfc )
Sim1/2 (RIL)

((Trustbin.bin flash it accordingly to LP or MM etc of stock rom))
Code:
\system\etc\firmware\modem.img
\system\etc\permission (RIL)

Try these aswell if ( you may suffer Bootloop )

/System/bin/mtkrild
/System/bin/mtkrildm1

/system/bin/stmd
EXPERIMENTAL FIX for ril:-
Code:
System/ Lib(/64)/ :-
Nvram
Nvram_sec
Nvram_platform
Nvrammagentclient

System/bin:-
Gsm*** 

System/etc/trustzone

Lib(/64):-
Libril
Libc2k***
Librilmtk

Audio/Sound:-
Code:
\system\lib\libaudio* .so
system/lib(/64)/libaudiocustomparam
system/lib(/64)/libaudiopolicymanager
system/lib(/64)/libaudiopolicyservice
system/etc/audio_effects
system/etc/audio_policy
System/lib(/64)/soundfx
Sometimes if Sound isn't working fully :::::
Code:
System/lib(/64)/hw/audioxxxxxxxxx (audio files)
Bluetooth:-
Code:
system/etc/bluetooth
System/etc/permissions/android.hardware.bluetooth.xml

/system/bin/uim*
/system/bin/bluetooth*
/system/lib(/64)/libbluetooth_mtk.so
/system/lib(/64)/libbluetoothem_mtk.so

Ads
Code:
/system/etc/hosts ->replace with new files or use tweak.

=====>>ADVANCE BUG FIXING:-


Volte Fixing


( Will only work if your Base Rom , Port Rom and Kernel supports VOLTE )
Code:
Boot.img:-
Zimage ( kernel - volte supported )
init.volte.rc
==THIS SHOULD NORMALLY FIX but if it doesn't try :- ==

Code:
System Folder:-
bin/volte_stack
bin/volte_imcb
bin/volte_ua

lib(/64)/volte_imsm

build.prop(Not always required):-

ro.mtk_volte_support=1
persist.mtk.volte.enable=1
FingerPrint:-

[Try one by one][If any file missing leave it]
Usual way to fix :-
Code:
System/etc/permissions/android.hardware.fingerprint.xml
System/lib(/64)/libgatekeeper.so
System/lib(/64)/hw/gatekeeper.mt6735.so
System/(/64)/libmcgatekeeper.so

System/lib(/64)/hw/fingerprint.default.so ( can break FP in some devices)
Advanced ( if usual doesn't work ):-
Code:
System/bin/:-
fingerprintd
Gx_fpd
tee_deamon

Lib64/lib:- ( if any missing leave that)
Fpclient
Fpalgorithm
Fphal
FPservice

IF ROM DOESNT BOOT TAKE LOG ( From ADB)
adb shell logcat > log.txt
and check what is causing issue



REFERENCE LINKS
:-

Carliv Image Kitchen :-

https://forum.xda-developers.com/and...droid-t3013658

Cross Port and Porting Guides:-

https://forum.xda-developers.com/k3-...cross-t3310605

Unpack and Repack without PC guide:-

https://youtu.be/qTe9XofT5VE

Meta-INF Info:-
http://www.mtkroms.com/2015/06/make-...-easy.html?m=1

Meta-Inf generator:- ( Not tested try but its worth a look)

https://forum.xda-developers.com/sho....php?t=1221003

Sample Recovery flashable zip:-

https://forum.xda-developers.com/and...y-zip-t3552916

Assert Failed ?check this:-

http://forums.androidcentral.com/opt...rt-failed.html

Need Some Rom Projects???:-
Go here:-


http://www.needrom.com

www.zerodevelopers.blogspot.com

GUIDE FOR SNAPDRAGON

Qualcomm Rom Porting

Porting from same chipset like SD410 to SD410

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

2. Replace the files from the BASE TO PORT:
Code:
boot.img-zImage
boot.img-dtb
Then in the BOOT-PORT/ramdisk/ folder compare the file fstab.qcom with that of the base i.e. BOOT-BASE/ramdisk/fstab.qcom.
REPACK BOOT.IMG

Replace this Boot.img in port.
*The Rom will boot with bugs .. ril , wifi etc
FOR MORE INFO

Do , have a look at these guides :
1 http://www.miuios.in/2014/12/how-to-...lcomm.html?m=1
2.http://en.miui.com/thread-70745-1-1.html

BUG FIXING FOR SNAPDRAGON

NOTE: THESE WORKED FOR FEW ROMS IN YU MSM DEVICES NOT SURE IF WILL WORK IN ALL.......

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

Compare the PORT FILES FROM BASE FILES:
Code:
uneventd.qcom.rc ( will fix sensor )
uneventd.rc

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


No sound bug:
Code:
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:
Code:
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:
Code:
system/usr/keylayout/ 
goodix.kl
gpio-keys.kl (important)
Generik.kl

Video hw encoding/decoding not working:
Code:
system/etc/firmware/ 
venus.*** (all files starting with ‘venus’)
Sensors not working:
Code:
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:
Code:
system/lib/hw/lights.msm****.so
system/lib64/hw/lights.msm****.so
Vibration not working:
Code:
system/lib/libhardware_legacy.so
system/lib64/libhardware_legacy.so
FM not working:
Code:
system/lib/qcomfm_jni.so
system/lib64/qcomfm_jni.so
Wifi not working:
Code:
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
Code:
system/lib/libwcnss_qmi.so
system/lib64/libwcnss_qmi.so
For slow WiFi network and other WiFi related issues replace these files:
Code:
system/etc/wifi/ -- all files
system/etc/firmware/wlan/ -- all files

Camera and flash not working:
Code:
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]

GUIDE TO PORT RECOVERY



PORT TWRP RECOVERY


Things You are Required ::-

Code:
1.Android Image Kitchen
2.Notepad++
3.Base Recovery
4.TWRP to Port
5.Brain
First of All , You Guys need to unpack Recovery.img i.e both Stock Recovery or TWRP Recovery.

After this :-

You need to Copy these files from your Stock Recovery to the TWRP Recovery ( which you want to port ) :-

Lets Divide Step by Step ::--

*REPLACE FROM STOCK TO PORT*


STEP1:
Inside Ramdisk Folder ::::::
Code:
1.meta_init.modem.rc
2.meta_init.project.rc
3.meta_init.rc
STEP2:

Now replace your Kernel usually named as zimage-kernel

STEP3

Inside Ramdisk Folder(boot.img):::::::
Code:
1.fstab
2.ueventd.rc
3.ueventd.goldfish.rc.
STEP4
INSIDE RAMDISK/ETC
Code:
recovery.fstab
STEP5

Open Default.prop
and Compare it with stock Default.prop or your Build.prop ( add values from build.prop )


=============>>>>>>>


DONE!!!!! EVERYTHING IS IN PLACE

NOW REPACK IT AND FLASH.

YOU HAVE PORTED A RECOVERY....





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


Now Mostly its the end of the Guide / Tutorial / G.K on porting or whatever you call it.

Once again , i (Kuber Sharma) hope you guys succesfully learn porting and making roms soon.

You guys have my Best Wishes.
Thank You.

CREDITS:-
KUBER SHARMA for writing this.

I couldn't have done this without the help of :-
Amit Kumar (A.M.T)
Sam Grande (A.M.T)

Special Thanks to @sandeep.sethi
Special Thanks to @Yousef Algadri
Special thanks to @mohancm

You can find me here:-
@kuberrocks96

Follow me:-
Android Daily AlphaGeek @ YouTube
Android Daily - AlphaGeek @ Facebook


To learn more with more DEVELOPERs join this group { MTK }
https://www.facebook.com/groups/684069671760424/

For Gadgets Related Discussions Join my Telegram Group :
https://t.me/joinchat/AAAAAEFUGQBeBloTRksjCg

THANK YOU
DO HIT THANKS BUTTON IF YOU LIKE MY GUIDE
The Following 66 Users Say Thank You to kuberrocks96 For This Useful Post: [ View ] Gift kuberrocks96 Ad-Free
 
 
Adreno306™
13th February 2017, 05:40 PM |#2  
Guest
Thanks Meter: 0
 
More
not lib64 files?

http://cloud.tapatalk.com/s/58a1efb4...213_183928.jpg


Odesláno z mého VFD 700 pomocí Tapatalk
Attached Thumbnails
Click image for larger version

Name:	IMG_20170213_183928.jpg
Views:	1730
Size:	64.5 KB
ID:	4040176  
13th February 2017, 05:51 PM |#3  
mohancm's Avatar
Recognized Contributor
Flag bengaluru
Thanks Meter: 2,276
 
Donate to Me
More
Great work, Really appreciated!
Thank you

---------- Post added at 05:51 PM ---------- Previous post was at 05:49 PM ----------

Quote:
Originally Posted by Adreno306™

not lib64 files?

http://cloud.tapatalk.com/s/58a1efb4...213_183928.jpg


Odesláno z mého VFD 700 pomocí Tapatalk

I think op have missed while typing, both lib and lib64 should be considered.
The Following User Says Thank You to mohancm For This Useful Post: [ View ] Gift mohancm Ad-Free
13th February 2017, 05:57 PM |#4  
kuberrocks96's Avatar
OP Senior Member
Flag New Delhi , India
Thanks Meter: 329
 
More
Reserved...
The Following 6 Users Say Thank You to kuberrocks96 For This Useful Post: [ View ] Gift kuberrocks96 Ad-Free
13th February 2017, 05:58 PM |#5  
kuberrocks96's Avatar
OP Senior Member
Flag New Delhi , India
Thanks Meter: 329
 
More
Thank you
Quote:
Originally Posted by mohancm

Great work, Really appreciated!
Thank you

---------- Post added at 05:51 PM ---------- Previous post was at 05:49 PM ----------



I think op have missed while typing, both lib and lib64 should be considered.

Couldn't have done without your support.
Thanks
The Following 3 Users Say Thank You to kuberrocks96 For This Useful Post: [ View ] Gift kuberrocks96 Ad-Free
13th February 2017, 06:27 PM |#6  
Member
Flag Dombivali
Thanks Meter: 34
 
Donate to Me
More
Awesome work
Great job man.. Awesome and best guide for 64 bit devices.. Great thing... Expecting more guides.. 😋
The Following User Says Thank You to KP@2016 For This Useful Post: [ View ] Gift KP@2016 Ad-Free
Adreno306™
13th February 2017, 06:32 PM |#7  
Guest
Thanks Meter: 0
 
More
Is there a method for fixing the NFC to?o
14th February 2017, 10:03 AM |#8  
kuberrocks96's Avatar
OP Senior Member
Flag New Delhi , India
Thanks Meter: 329
 
More
Quote:
Originally Posted by Adreno306™

Is there a method for fixing the NFC to?o

Follow sensor fix and replace libnfcxxxx in lib folder
The Following 2 Users Say Thank You to kuberrocks96 For This Useful Post: [ View ] Gift kuberrocks96 Ad-Free
Adreno306™
14th February 2017, 11:32 AM |#9  
Guest
Thanks Meter: 0
 
More
Quote:
Originally Posted by kuberrocks96

Follow sensor fix and replace libnfcxxxx in lib folder

nfc service has stopped working

Odesláno z mého VFD 700 pomocí Tapatalk
14th February 2017, 11:48 AM |#10  
kuberrocks96's Avatar
OP Senior Member
Flag New Delhi , India
Thanks Meter: 329
 
More
Quote:
Originally Posted by Adreno306™

nfc service has stopped working

Odesláno z mého VFD 700 pomocí Tapatalk

Take a log
The Following 4 Users Say Thank You to kuberrocks96 For This Useful Post: [ View ] Gift kuberrocks96 Ad-Free
14th February 2017, 04:13 PM |#11  
Senior Member
Thanks Meter: 120
 
More
trying to port for teclast t98 4g mt8752
I've trying to port following a lot of guide ever bootloop only one time boot but no touchscreen
what i'm wondering my stock rom is kitkat so with a 32bit kernel ,i think, can i mix it with 64bit rom?
in my stock rom there isn't lib64 directory so what can I do to follow your guide?
thanx
Post Reply Subscribe to Thread

Tags
all in one porting guide, bug fix guide, recovery porting guide, snapdragon porting, volte fix guide
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes