Showing posts with label Root or ROM Porting Tutorial. Show all posts
Showing posts with label Root or ROM Porting Tutorial. Show all posts

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

Tuesday, June 13, 2017

[Guide] MTK6582 ROM Porting


MT6582 to MT6582 Simple ROM Porting

~Follow these steps to start porting~
----------------------------

STEP - 01
--------------------
---------------------------
Unzip/Extract all files using 7-Zip, WINRAR or Any other Zip/RAR Extractor Tool(Download link bellow)
[Note: If downloaded PORT ROM is SP flash tool flashable and not recovery flashable then extract system.img using ext2explore or dsixda's Android Kitchen]
Rename stock ROM (original rom of your phone) as STOCK and port rom (which you want to port) as PORT

STEP - 02
--------------------
---------------------------
a) Open STOCK and PORT ROMs in another Tab
b) Delete boot.img & logo.bin(if the ROM) from PORT
c) Copy boot.img & logo.bin(if the ROM) from STOCK
d) Paste boot.img & logo.bin(if the ROM) in PORT

STEP - 02
--------------------
---------------------------
a) Open "META-INF>>google>android>>updater-script" from PORT with any Text Editor App(Download link bellow) See here...like


c) Now Change the Mount Point into your STOCK Mount Point. You can use this App(Download link bellow) to Know about your Mount Point...like

c) After Editing...Save it

STEP - 02
--------------------
---------------------------
a) Open folder system/etc in PORT and delete this folder "firmware"
b) Open folder system/etc in STOCK and copy this folder "firmware"
c) Open folder system/etc in PORT and paste this folder "firmware"

STEP - 03
--------------------
---------------------------
a) Open folder system/lib in STOCK and copy following files:
libaudio.primary.default.so
libcamalgo.so
libcamdrv.so
libcameracustom.so
libMali.so
b) Open folder system/lib in PORT and paste all files

STEP - 04
--------------------
---------------------------
a) Open folder system/usr/keylayout in STOCK and copy file Generic.kl
b) Open folder system/usr/keylayout in PORT and paste file Generic.kl

STEP - 04
--------------------
---------------------------
Open build.prop in PORT and search the line ro.sf.lcd_density=
[ex: If value is 240 or  then change it on your stock value, that is your dispaly density]

STEP - 04
--------------------
---------------------------
Open build.prop in PORT and search the line ro.sf.hwrotation=
[ex: If value is 0 or 180 then change it on your stock value, Bloom have flipped screen]

STEP - 04
--------------------
---------------------------
Compress/zip "META-INF, system, boot.img & have any other file or folder" using 7-Zip or other Apps as "Any ROM.zip" and flash using any custom recovery.
First boot may take 2-3 minutes

-HD Video Tutorial-
-----------------------------------
-----------------
Here: YouTube

~File Attachment~
-------------------------
----------------------------------
All Dev Tools: Download here

[N.B: If you Find Any Bug After Porting, Comment here. I will try to Fix that...]

post signature

Tuesday, June 6, 2017

[Guide] MT6582 to MT6582 ROM Porting


        MT6582 to MT6582 ROM Porting

Follow these steps to start porting:

Step 1:
Unzip/Extract all files using 7-Zip
Note: If downloaded PORT ROM is SP flash tool flashable and not recovery flashable then extract system.img using ext2explore or dsixda's Android Kitchen.
Rename stock ROM (original rom of your phone) as STOCK and port rom (which you want to port) as PORT

Step 2:
a) Open STOCK and PORT ROMs in separate windows as shown below
b) Delete META-INF and boot.img from PORT
c) Copy META-INF and boot.img from STOCK
d) Paste META-INF and boot.img in PORT



Step 3:
a) Open folder system/bin in STOCK and copy files pq and vold (use ctrl key to select multiple files)
b) Open folder system/bin in PORT and paste pq and vold (Select Copy and Replace for both files)



Step 4:
a) open folder system/etc in PORT and delete folders bluetooth, firmware and wifi
b) open folder system/etc in STOCK and copy folders bluetooth, firmware and wifi
c) open folder system/etc in PORT and paste folders bluetooth, firmware and wifi


Step 5:
a) open folder system/lib in PORT and delete folder egl and hw
b) open folder system/lib in STOCK and copy folder egl and hw
c) open folder system/lib in PORT and paste folder egl and hw



Step 6:
a) open folder system/lib in STOCK and copy all files which starts with libaudio
b) open folder system/lib in PORT and paste all libaudio files



Step 7:
a) open folder system/lib in STOCK and copy following files:
libcamalgo.so
libcamdrv.so
libcameracustom.so
libdpframework.so
libsensorservice.so
libsync.so
libvcodecdrv.so
b) open folder system/lib in PORT and paste all files



Step 8:
a) open folder system/usr/keylayout in STOCK and copy file Generic.kl
b) open folder system/usr/keylayout in PORT and paste file Generic.kl



Step 9:
a) open folder system in PORT and delete folder vendor
b) open folder system in STOCK and copy folder vendor
c) open folder system in PORT and paste folder vendor



Step 10:
Open build.prop in PORT and search line ro.sf.hwrotation=
[ex: If value is 0 then change it to 180 as Walton Primo GM mini,Bloom have flipped screen.]

In build.prop search lines
ro.product.locale.language=
ro.product.locale.region=
For English change it to
ro.product.locale.language=en
ro.product.locale.region=US


Step 11:
Compress/zip META-INF, system and boot.img using 7-Zip as port.zip and flash using any custom recovery.
First boot may take 2-3 minutes�

Please add proper credits in your ported ROMs




#Bug fixing:

#1.Showing black screen after logo?
Replace following file from STOCK to PORT
system/lib/libMali.so


#2.Stuck at logo/Bootloop?
Replace following files from STOCK to PORT
system/lib/libandroid_runtime.so
system/lib/libandroid_servers.so
system/lib/libmedia_jni.so


#3.Camera focus not working?
Replace following file from STOCK to PORT
system/lib/libfeatureio.so


#4.Camera showing wrong model in pic property?
Change model in build.prop
Still not working? Replace following file from STOCK to PORT
system/lib/libexif.so


#5.Camera not working/force close?
Replace following files from STOCK to PORT
all files from system/lib folder which starts with libcam


#6.Resolution problem?
open build.prop and add following line
ro.sf.lcd_density=229
[ex: 229 but your dpi maybe deferent]

#7.Pixalation in video?
Replace following file from STOCK to PORT
system/lib/libvcodecdrv.so


#8.Flipped touch screen?
Replace following files from STOCK to PORT
system/lib/libinput.so


#9.Storage not mounting?
Decompile framework-res.apk using apktool or apk multitool and replace following file from STOCK framework-res.apk to PORT framework-res.apk
/res/xml/storage_list.xml


#10.LED not working?
Replace following files from STOCK to PORT
system/lib/libfeatureio.so

...Good Luck!!!

[N.B. don't Forgot geiven me a Credit.
>www.mtk-developers.blogspot.in
>www.fb.com/groups/devIndex.bd]

#Powered by :

Monday, June 5, 2017

[Guide] [4.x.x] [JB] MTK ROM Porting

MT65xx Porting Guide

I will not be responsible for any damage to your device.

This guide is only for porting ROM of the same chipset. You can port any ROM which is made for your chipset.

MT6572 to MT6572
MT6582 to MT6582
MT6592 to MT6592
MT6577 to MT6577
MT6589 to MT6589

This guide can only be used to port ROMs for the same android version.

4.2.2 to 4.2.2
4.3 to 4.3

Guide :

ONLY FOR PERSONAL USE If you want to share please take permission, give proper credits and give link to this post

TO PORT TO YOUR DEVICE :

Replace files and folders from stock to port :

1. /system/vendor/
2. /system/usr/
3. /system/priv-app
4. /system/lib/modules (this might not be present in 4.4.2 ROMs)
5. /system/lib/hw
6. /system/etc/firmware
7. /system/etc/bluetooth
8. /boot.img
9. /system/etc/vold.fstab (for jellybean devices only)
10. /system/etc/vold.nand.fstab (for jellybean devices only)

To fix problems :


Replace files and folders from Stock to Port

1./system/etc.permissions/
*Note copy all files from /system/etc/permissions/ and paste them in Port ROM /system/etc/permissions/ replacing files, but do not delete any files
2. /system/etc/security
3. /system/etc/audio
4. /system/etc/wifi
5. /system/lib/drm
6. /system/lib/soundfx


Last Step :

This step is important because sometimes the device gets stuck in boot logo because the /system partition is not mounted properly1. Open Port ROM /META-INF/com/google/android/updater-script using Notepad++
2. Open MTK Droid Tools and connect your device
3. Select Blocks Map
4. Now in updater-script find a line that resembles this (Note it will not be the same)



format("ext4", "EMMC", "/data", "0");

format("ext4", "EMMC", "/system", "0");

mount("ext4", "EMMC", "/dev/block/mmcblk0p4", "/system");

mount("ext4", "EMMC", "/dev/block/mmcblk0p6", "/data");

5. In the Blocks Map you opened before find these :



6. Now just change the mount points accordingly

Example : 

*Note : Your updater-script and my updater-script will not be the same 

My Port ROM updater-script has these lines :

"format("ext4", "EMMC", "/cache", "0");

format("ext4", "EMMC", "/system", "0");" (These lines do not have any mount points you do not need to do anything)
"mount("ext4", "EMMC", "/dev/block/mmcblk0p8", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p10", "/data");" (The red colored numbers are the mount points)

My Blocks Map shows that /system is mounted in 5 and /data is mounted in 7 so I will edit it like this :


format("ext4", "EMMC", "/cache", "0");

format("ext4", "EMMC", "/system", "0");
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p7", "/data");

To fix stuck on boot animation after flashing MIUI ROM :
Port the kernel using this guide : Port Kernel

To fix bootloop :

Replace files from Stock to Port
1. libandroid_runtime.so
2. libandroid_servers.so
3. libmedia_jni.so

To fix black screen, Or messed up boot screen :
Replace files from Stock to Port
1. /system/lib/libMali.so

To fix memory issues :
Replace files from Stock to Port
1. /system/bin/vold

To fix audio :
Replace files from Stock to Port
1. /system/lib/libaudio.primary.default.so