Monday, June 26, 2017

[Guide] MTK Cross Platform ROM Porting


HELLO FOLKS,

 INTRODUCING A CROSS PLATFORM ROM PORTING GUIDE FOR MTK SOCs

Code:
 NOTE : THIS GUIDE HAS 6 PARTS, ONE FOR THE SYSTEM FOLDER CHANGES AND THE OTHER FOR THE BOOT.IMG MODIFICATIONS.
WARNINGS :-
1) THIS GUIDE IS INTENDED FOR DEVELOPERS ONLY.
2) NEWBIES MAY FIND IT COMPLICATED SO PLEASE DO NOT TRY THIS. (RESEARCH A LITTLE MORE BEFORE YOU TRY THIS)


 MTK CROSS PLATFORM ROM PORTING GUIDE 



REQUIRMENTS:


1. FULLY UNDERSTAND THE ROM PORTING GUIDE (PLEASE FOLLOW THE GUIDE FROM XDA.)
2. THIS GUIDE WILL ONLY WORK FOR MTK SOCs WITH THE SAME GPU.
(EXAMPLE: MT6582 <------>MT6592 (BOTH CHIPSETS HAVE MALI GPU)
3. BASE ROM (STOCK ROM) AND PORT ROM . SHOULD HAVE THE SAME ANDROID SDK LEVEL.
(EXAMPLE: 4.2.x<---->4.2.x , 4.4.x<---->4.4.x ,ETC )
4. A FULLY FUNCTIONING BRAIN AND EXPERTISE

LETS BEGIN :

PART 1 : SYSTEM FOLDER CHANGES
----------------------------------
1.
A) MAKE 2 NEW FOLDERS ON DESKTOP
B)EXTRACT THE STOCK ROM IN THE 1ST FOLDER (NAME IT AS BASE),
C)EXTRACT THE ROM YOU WANT TO PORT TO THE 2ND FOLDER (NAME IT AS PORT)

2.
A) OPEN BASE FOLDER >SYSTEM>BIN>
B) COPY ALL BIN FILES TO THE PORT FOLDER>SYSTEM>BIN> AND PASTE IT REPLACEING ANY EXISTING FILES
(DO NOT DELETE THE FILES THAT HAVE NOT BEEN REPLACED.)

3.
A) OPEN BASE FOLDER >SYSTEM> LIB >
B) COPY HW FOLDER,MODULE FOLDER (IF THIS EXISTS IN YOUR STOCK KK ROM ),SOUNDFX FOLDER TO THE PORT FOLDER >SYSTEM>LIB > PASTE HERE (REMEMBER TO DELETE THE HW,MODULE,SOUNDFX FOLDERS FIRST))

4.
A) OPEN BASE FOLDER >SYSTEM> LIB>
B) COPY ALL LIB FILES(.SO) TO THE PORT FOLDER >SYSTEM>LIB > PASTE HERE AND REPLACE EXISTING FILES

5.
A) OPEN ROM ZIP FILE WITH WINRAR/WINZIP/7-ZIP/
B) EXTRACT THE LIB FOLDER (PRESENT INSIDE THE SYSTEM FOLDER)> INTO A SEPARATE FOLDER.

WE NEED ONLY THE FOLLWOING FILES FOR THE NEXT STEP.

>>libandroid_runtime.so
>>libandroid_servers.so
>>libandroidfw.so
>> libjavacore.so
>> libjavacrypto.so


6. COPY 5 LIBRARY FILES MENTIONED IN STEP 5 AND MOVE IT TO THE PORT FOLDER'S >LIB FOLDER> PASTE THERE AND REPLACE EXISTING FILES

7.
A) OPEN PORT ROM ZIP FILE WITH WINRAR/WINZIP/7-ZIP/
B)EXTRACT THE LIB FOLDER (PRESENT INSIDE THE SYSTEM FOLDER)> INTO A SEPARATE FOLDER.
WE NEED ONLY THE FOLLWOING FILES FOR THE NEXT STEP.
>>libwebp_android.so
>>libwebrtc_audio_preprocessing.so
>>libwebviewchromium.so
>> libwebviewchromium_plat_support.so
(IMPORTANT FILES )

8. COPY THE 4 LIBRARY FILES MENTIONED IN STEP 7 AND MOVE IT TO THE PORT FOLDER'S >LIB FOLDER> PASTE THERE AND REPLACE EXISTING FILES

9. REPLACE THE VENDOR FOLDER IN THE PORT FOLDER WITH THE VENDOR FOLDER FROM THE BASE

10 CHANGE BOOTANIMATION IN THE PORT FOLDER>MEDIA FOLDER> (ACC. TO YOUR SCREEN RESOLUTION USE YOUR STOCK BOOTANIMATION IF YOU DONT HAVE A SIMILAR RESOLUTION BOOT ANIMATION FILE)

11.
A) OPEN THE PORT FOLDER>SYSTEM>ETC > ABD DELETE THE FOLLWOING
FIRMWARE,
MDDB(SOME ROMS MAY NOT HAVE THIS,SO IF YOUR ROM DOES NOT, IGNORE IT)
B) COPY THESE TWO FOLDERS FROM BASE TO PORT>SYSTEM>ETC>

12.
A) OPEN BASE FOLDER >SYSTEM>ETC>
B) COPY AUDIOEFFECT, AUDIOPOLICY, MEDIACODECS FILES TO PORT FOLDER>ETC FOLDER> PASTE THERE REPLACING EXISTING FILES

13.
A) OPEN THE BASE ROM FOLDER'S >SYSTEM>XBIN> FOLDER
B) COPY THE libmnlp_mt65xx(DIFF ACC TO CHIPSET LIKE MT6582,MT6592) FILE TO PORT FOLDER>SYSTEM>XBIN > PASTE IT THERE
C) DELETE PORT ROM'S libmnlp_mt65xx

################################################## ######################################

PART 2 : EDITING THE BOOT.IMG (CRITICAL)

14.
----------------------------------------------------------------------------------------
(USE DSIXDA'S KITCHEN/ MTK FIRMWARE ADAPTER OR ANY OTHER BOOT.IMG DECOMPILER/COMPILER OF YOUR CHOICE)

>> EXTRACT BOTH BOOT.IMG (BASE AND PORT)

>> OPEN BASE BOOT>INIT.RC AND COMPARE WITH PORT'S INIT.RC AND CHANGE BOOTCLASSPATH IF PRESENT
AND OTHER REGARDING THEMES ETC.

>> OPEN BASE BOOT>PROJECT.RC AND COMPARE IT WITH PORT'S PROJECT.RC AND DO CHANGES WHICH IS EXTRA IN PORT

>> OPEN BASE BOOT>ENVIRONMENT.RC AND COMPARE IT WITH PORT'S ENVIRONMENT.RC AND DO CHANGES WHICH IS EXTRA IN PORT (THIS IS ABSENT IN JB ,SO DON'T WORRY ABOUT IT)

>> PACK IT , COPY NEW BOOT.IMG AND PASTE ,REPLACE IN PORT FOLDER

################################################## ######################################

PART 3 : Build.prop

15.
A) NOW OPEN PORT FOLDER>SYSTEM>BUILD.PROP> AND CHANGE MT65xx TO YOUR CHIPSET ACC TO UR STOCK BUILD.PROP ,
B) ALSO THE WLAN LINE mT65xx TO UR CHIPSET ACC TO UR STOCK BUILD.PROP
++++++++++++++++++++++++++++++++++++++++++++
mediatek.wlan.chip=CONSYS_MT6582
mediatek.wlan.module.postfix=_consys_mt6582
++++++++++++++++++++++++++++++++++++++++++++
################################################## ######################################

PART 4: UPDATER-SCRIPT EDIT
16.
A) OPEN META-INF>ANDROID>UPDATER-SCRIPT AS TEXT EDITIOR(IN NOTEPAD++ OR U PREFER ANY OTHER)
B) CHANGE MOUNTPOINT ACC. TO UR STOCK ROM'S UPDATER-SCRIPT
C) ALSO THIS LINE --> symlink("wlan_mt65xx.ko", "/system/lib/modules/wlan.ko"); (MT65XX DEPEND ON UR STOCK ROM UPDATER-SCRIPT)
SAVE IT

################################################## ######################################

PART 5: FRAMEWORK EDIT

17.

A. GO TO BASE> SYSTEM>FRAMEWORK>COPY SERVICES.JAR(MAKE SURE DEODEXED)
>> USING BASKMALI.JAR UNPACK IT (NAME AS S)

B) DO THE SAME WITH PORT>SYSTEM>FRAMEWORK> SERVICES.JAR(MAKE SURE DEODEXED)
>> USING BASKMALI.JAR UNPACK IT (NAME AS CLASSOUT)

>>NOW OPEN THE S FOLDER>ANDROID>SERVER AND SEARCH OF THESE FILES
MOUNTSMALI** (U WILL GET LOTS OF FILE STARTING WITH MOUNT),COPY THESE FILES

PASTE & REPLACE IN THE CLASSOUT FOLDER>ANDROID>SERVER>HERE
>> PACK THE CLASSOUT FOLDER USING SMALI.JAR

> PUSH IN SERVICES.JAR(PORT) AND PASTE IN SAME LOCATION AS MENTIONED IN STEPS 17.
(IMPORTANT STEPS)
(IMPORTANT STEPS)

################################################## ######################################
Part 6: CLEANING UP

18. GO TO PORT FOLDER ,DELETE UNWANTED STUFF LIKE, UBOOT.IMG ,SCATTER ETC
################################################## ######################################

19. MAKE ZIP OF BOOT.IMG,SYSTEM,META-INF AND FLASH VIA UR CWM RECOVERY,TWRP ETC


FAQ :
1. DOES THIS REALLY WORK ?
>> YES ,IT DOES ( I PORTED A MIUI V5 BASED ON KITKAT (BETA),hive ui rom,samsung s5 FROM MT6592 TO MT6582 )

2. WIL I GET LOTS OF BUGS ?
>> YES, ALMOST CERTAINLY YOU WILL. MAY NOT BE MAJOR BUT I DID HAVE BUGS LIKE FCs FOR SOME APPS
NOTE : TAKE A LOGCAT AND TRY TO FIX IT OR ASK HERE

NOTE : PLEASE DO NOT HOLD ME OR THE XDA FORUM RESPONSIBLE FOR ANY DAMAGES CAUSED BY YOU.
IF YOUR DEVICES EXPLODES, GOES TO MARS, GIVES BIRTH TO A DRAGON, CAUSES WAR, MAKES AN OMLETTE OR GETS YOU MARRIED CONSIDER IT FATE AND LIVE WITH IT>


CREDITS :
GOOGLE
XDA
@nISH123
Our TEAM...

No comments:

Post a Comment