Sei sulla pagina 1di 24

All-In-One

2/13/2017
ROM
Porting
Guide
For Mediatek and
Qualcomm, with bug-fix;
and Recovery porting, plus
cross-porting-mtk

By Kuber Sharma aka


AlphaGeek
Edited by Me (Rokib Hasan Sagar)
All-in-one ROM porting guide
[mediatek] [qualcomm] [recovery]
[bug-fix] [cross-porting-mtk]
By kuberrocks96, (Kuber Sharma aka AlphaGeek),
Senior Member, on 13th February 2017, 05:09 PM

Official XDA Forum Link:


https://forum.xda-developers.com/showpost.php?p=71014483&postcount=1

/*
* 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.
*/

Update
* 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.
Base Rom
Base Rom is referred 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.).

Port Rom
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.

Kernel
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 only from:

3.18.xx to 3.18.xx only


3.10.xx to 3.10.xx only
In this Guide, I’ll tell one of the easiest way to –
BOOT UP THE ROM.
So, let’s begin.

This guide will focus on MT6735/MT6753 porting.


Device used is Coolpad Note 3 Lite
CPU: MT6735

Author’s Note:

 When You Port a Rom, Change Files Wisely.


 Don’t 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 Toughest and Irritating
Thing.
 Respect The Efforts by The Previous Developers.
 Credits, When You Port a Rom Which Rom Was Made by
Someone, Ported by Someone or Bug Fixed by Someone –
So by Any Means If You Know the Source and the
Developer or Team Whose Build You Are Porting Please
Give Proper Credit.

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

What you guys need:


1. Base Rom
2. Port Rom
3. Notepad++
4. Any Boot.img repack or unpack tool
5. Brain

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:


MT6753 TO MT6753 or MT6735 TO MT6735
Use this method (95% times working)

System/lib & System/lib64


libaudiocomponentengine.so
libaudiocustparam.so
libnvram.so
libnvramagentclient.so
libnvram_platform.so
libnvram_sec.so
libcustom_nvram.so
System/etc
./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 and HW folder, replace all libs


starting like this:-
libcamera.mt6735 (mt6735 is according to my CPU)

libcameracustom.lib etc.
libcamalgo.lib

Unpack Boot.img of both Base & Port Rom


replace kernel
and init.mt6735.rc (not recommended always)
and Fstab.mt6735

Done, now zip em and flash.


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

For Cross Porting Like:

MT6752 etc. to MT6753/MT6735


DO REMEMBER TO CHANGE:
System/xbin/mnld
System/mddb
System/etc/firmware/*
System/etc/Apnconf
System/etc/spnconf

In System/lib(/64)/HW :- add files accordingly to your


CPU or rename them.

BLACK SCREEN AFTER LOGO:


libcam.paramsmgr
BOOT.IMG PORTING:

UNPACK both Base Rom and Port Rom Boot.img

In PORT ROM BOOT.IMG:-


replace the boot.img-kernel

and in ramdisk folder, add these files from Base Boot.img


to Port Boot.img

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 you get Wi-Fi And Bluetooth Not Switching ON


or Battery Percentage then replace
init.project.rc
BUG FIXING [MTK]

NOTE: CHANGE LIB FILES FROM BOTH lib & lib64


folders

If you face "This rom is for Coolpad Note 3 Lite and your device
is "K4Note" or something like that, delete the assert lines in
Updater-script

Always change dpi in build.prop according to your rom

Bootloop when porting


/system/lib(/64)/libandroid_runtime.so
/system/lib(/64)/libandroid_servers.so
/system/lib(/64)/libmedia_jni.so

* Repack boot.image (properly)

Radio FM
/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
/system/bin/akmd*
/system/lib/libsensors.so
/system/lib/libms*.so (according to device)
/system/etc/firmware (folder)
/system/bin/servicemanager
/system/bin/sensorservice
/system/bin/msensord
/system/etc/permissions/android.hardware.sensor.xxxx.xml

FIX Offline charging


* In Boot.img --> sbin/healthd
/system/lib(/64)/Showlogo
/system/bin/Kpoc_charger

Wi-Fi
/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
Bluetooth or Wi-Fi not turning On\Off (old)
/system/lib/module/mtk_stp_wmt

Hotspot
/system/bin/netd
* follow Wi-Fi fix also

Camera
** 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)/libcameraprofile.so
/system/lib(/64)/libmhal.so
/system/lib(/64)/libmhalcontent.so
/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*.xml

Other cam files if any


Try one by one
CamCorder/HwDecoder
/system/lib/libOmx*.so
/system/etc/media_codecs.xml

Green/pink Camera or video lagging


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

SD card/Memory
In boot.img => mt67**.fstab
/system/bin/vold
/system/bin/pq
/system/bin/sdcard

WhatsApp Media Fix


/system/bin/media
/system/bin/mediaserver
/system/bin/netd
/system/bin/service
/system/bin/servicemanager
/system/bin/surfaceflinger

GPS
/system/xbin/libmnlp
/system/etc/gps.conf

Touch Screen (Haptic)


/system/usr (Folder)
/system/usr/keylayout/Generic.kl =>fix HomeKey
NFC (experimental)
/system/etc/ nfc files
/system/etc/permissions/ nfc files
/system/lib/libnfc**** (all starting with nfc)

Sim 1/2 (RIL)


/system/etc/Trustzone.bin (accordingly to LP or MM etc of stock rom)
/system/etc/firmware/modem.img
/system/etc/permission/****telephony**.xml (RIL)

* Try these as well (you may suffer Bootloop)

/system/bin/mtkrild
/system/bin/mtkrildm1
/system/bin/stmd

EXPERIMENTAL FIX for ril


/system/lib(/64)/Nvram
/system/lib(/64)/Nvram_sec
/system/lib(/64)/Nvram_platform
/system/lib(/64)/Nvrammagentclient

/system/bin/Gsm***
/system/etc/trustzone.bin

/system/lib(/64)/Libril
/system/lib(/64)/Libc2k***
/system/lib(/64)/Librilmtk
Audio/Sound
/system/lib\libaudio*.so
/system/lib(/64)/libaudiocustomparam
/system/lib(/64)/libaudiopolicymanager
/system/lib(/64)/libaudiopolicyservice
/system/etc/audio_effects.conf
/system/etc/audio_policy**.xml
/system/lib(/64)/soundfx

Sometimes if Sound isn't working fully


/system/lib(/64)/hw/audioxxxxx (audio files)

Bluetooth
/system/etc/Bluetooth (Folder)
/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
/system/etc/hosts --> replace with new files or use tweak.
===>> ADVANCE BUG FIXING

Volte Fixing
Will only work if your Base Rom, Port Rom & Kernel supports
VoLTE

In Boot.img:-
Zimage ( kernel - volte supported )
init.volte.rc

This Should Normally Fix but if it doesn't try:


/system/bin/volte_stack
/system/bin/volte_imcb
/system/bin/volte_ua

/system/lib(/64)/volte_imsm

** In 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:
/system/etc/permissions/android.hardware.fingerprint.xml
/system/lib(/64)/libgatekeeper.so
/system/lib(/64)/hw/gatekeeper.mt6735.so
/system/lib(/64)/hw/libmcgatekeeper.so
/system/lib(/64)/hw/fingerprint.default.so (can break FP in some devices)
Advanced (if usual doesn't work) (if any missing, leave that):
/system/bin/fingerprintd
/system/bin/Gx_fpd
/system/bin/tee_deamon
/system/lib(/64)/Fpclient
/system/lib(/64)/Fpalgorithm
/system/lib(/64)/Fphal
/system/lib(/64)/FPservice

IF ROM DOESNT BOOT, TAKE LOG (From ADB)


adb shell logcat > log.txt
and check what is causing issue
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.

Replace the files from the BASE TO PORT:


boot.img-zImage
boot.img-dtb

Then in the BOOT-PORT/ramdisk/ folder compare fstab.qcom


with that of the base i.e. BOOT-BASE/ramdisk/fstab.qcom

REPACK BOOT.IMG
Replace this Boot.img in port.

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:


uneventd.qcom.rc (will fix sensor)
uneventd.rc

Copy and replace the following files from Base to Port to solve the
given issues:

No sound bug
/system/lib(/64)/hw/audio.primary.msm****.so
/system/lib(/64)/hw/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
/system/usr/keylayout/gpio-keys.kl (important)
/system/usr/keylayout/Generik.kl

Video hw encoding/decoding not working


/system/etc/firmware/venus.*** (all files starting with ‘venus’)

Sensors not working


/system/lib(/64)/hw/sensors.msm****.so (or sensors.lsm6db0.so)
/system/lib(64)/libsensorservice.so

Led notification not working


/system/lib(/64)/hw/lights.msm****.so

Vibration not working


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

FM not working
/system/lib(/64)/qcomfm_jni.so

Wifi not working


/system/lib(/64)/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’ve to replace in both the places.]
If wlan.ko file is missing, try replacing these files
/system/lib(/64)/libwcnss_qmi.so

For slow WiFi network and other WiFi related issues


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

Camera and flash not working


/system/vendor/lib(/64)/:
libactuator_***.so (all files starting with ‘libactuator’)
libchromatix_***.so (all files starting with ‘libchromatix’)
libmmcamera_***.so (all files starting with ‘libmmcamera’)

/system/lib(/64)/:
libmm-qcamera.so
libmmcamera_interface.co

/system/lib(64)/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
Things You are Required
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, Copy these files from Stock Recovery to TWRP:

STEP 1
Inside Ramdisk Folder
1. meta_init.modem.rc
2. meta_init.project.rc
3. meta_init.rc

STEP 2
Now replace your Kernel usually named as zimage-kernel

STEP3
Inside Ramdisk Folder(boot.img)
1. fstab
2. ueventd.rc
3. ueventd.goldfish.rc
STEP 4
INSIDE RAMDISK/ETC
recovery.fstab

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

DONE!! NOW REPACK IT AND FLASH.


CREDITS
Author:
KUBER SHARMA @kuberrocks96 for writing this guide.

He (KUBER SHARMA aka AlphaGeek) took over four+


hours to type this complete guide and more time to edit any
mistypes, so hats off to him.

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

And finally me (Rokib Hasan Sagar), a NOOB, trying to start porting


ROMs for my own Device lately, for bringing up the idea to make the
guide portable. Find me here: fb.com/rokib.hasan.sagar
But definitely there is no credit for me for any part of this guide.
It is entirely worked by Kuber Sharma. Follow him on XDA.
And if this guide helps you porting Brand New ROMs for your device,
thank him on XDA through his profile @kuberrocks96.
REFERENCE LINKS
Official XDA Forum Link:
https://forum.xda-developers.com/showpost.php?p=71014483&postcount=1

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 it’s 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???:-


http://www.needrom.com
www.coolpadmtk.blogspot.com

To learn more, join this group by Syed Ahmed Ali SIR,


https://www.facebook.com/groups/684069671760424/

Potrebbero piacerti anche