[TUTORIAL] [arm-MTK-only] MT65xx Firmware Porting Thread | Guidelines | The Easy Way

Which MTK Chipset Device You Owe?


  • Total voters
    619
  • Poll closed .
Search This thread

Rohan Taneja

Inactive Recognized Developer
Feb 22, 2013
740
2,564
Hello Viewers! I am Rohan Taneja, here with completely re-written guide to Port MTK65xx Roms. :)
I had left MTK development since a year and I finally got another MTK device to carry with it again.
Untitled_1.jpg

So, Many Of You May be MTK Device User than you are at right place to fill your device with many awesome roms!

Note: Android ONE devices (MT6582 SoC) use Google's device tree, meaning they differ on everything with all the other MediaTek devices (even the ones with the same SoC , MT6582), as per @superdragonpt told us :eek:

Requirements:
  • A MTK powered device :cowboy:
  • USB Cable :p
  • Usable Brains :cyclops:
  • Knowledge about Flashing & Taking Logs :angel:
  • Stock Firmware (from manufacturer) & Port Firmware (matching specification of your device) :)
  • Custom Recovery installed on device :)

Porting Tips
  • Choose Custom ROM from a device matching same resolution to reduce App Size related bugs
  • This Guide Applies to
    1. MT6577 to MT6577, vice-versa
    2. MT6589 to MT6589, vice-versa
    3. MT6572 to MT6572, vice-versa
    4. MT6582 to MT6582, vice-versa
Note: Try it at your own risk, and don't complaint any developer or XDA if any mishap takes place. :good:​

TUTORIAL:
Starting with the tutorial, I request you to follow every single step written below to prevent any kind of problem in flashing and causing bootloop. I also dare you to take a nandroid backup of your current rom you are using.​

Get. Set. Go.

Step 1 : Patching System Folder for the port patch.​
First of all make a folder named "Port_Patch" and setup all the folder as shown in the images below.
Untitled.png


  1. Now, in Port_Patch make system folder in which make folders, "bin" "etc" "lib" "usr" "vendor" "xbin" (without ")
  2. In folder "bin" copy pq & vold from your stock rom
  3. In folder "etc" copy "bluetooth" "firmware" "wifi" "apns-conf.xml" "vold.fstab" "vold.fstab.nand"
    etc.png
  4. In folder "lib" copy files as shown in the image
    lib.png
  5. In folder "usr" copy usr/keylayout/Generic.kl
    usr.png
  6. In folder "vendor" all the files
    vendor.png
  7. In folder "xbin" copy "libmnlp_mt662x" (x - '0' or '8') from stock
    xbin.png

System has been patched, copy this /system to patch the /system of port ROM.

Step 2: Patching the boot.img of the port rom.
This is bit tricky but can be done easily.
  1. So, first of download this little tool, to unpack & repack your boot.img - MTKbootimg.zip - tested on Windows 7 & above platform
  2. Extract the Tool and you will get two folders named "stock" & "port"
  3. Copy boot.img's respectively from stock rom in "stock" folder & from port rom to "port"
  4. Unpack both boot.img repectively and they may look like this.
    bootimg.png
  5. From stock copy "kernel" to port folder and just replace it.
  6. Now, repack it, new file named "boot-new.img" will be generated.
  7. Copy "boot-new.img" to port Rom Folder.
  8. Delete existing "boot.img" and rename "boot-new.img" to "boot.img"

Now, your boot.img is patched, proceed to last step.

Step 3: Modifying updater-script to install ROM accordingly.
  1. So, it's the last step before flashing the rom. Now lets fix it.
  2. First, you have to know your device mount points, that can be tracked using MTKDroid Tool or check them in stock rom updater-script.
  3. I have my flashable stock rom so I will get mount points from it.
  4. As show in the image, my stock updater have different mount point for system & data while port have different.
    meta.png
  5. Now, replace "mmcblk0pX" (X - no. for the mount) from stock to port as designated for the partition.
  6. Now Save the updater-script.

Finally, the ROM is ready to flashed.

Step 4: Compressing & Flashing the ROM.
  1. Now, the rom is ready to be packed and flashed.
  2. Simply get to the main directory with META-INF, system, boot.img, etc files.
  3. Select all the files and compress them to zip. Select the compression ratio as you want.
  4. After compressing copy the ROM into root of sdcard
  5. Enter Custom Recovery, wipe data & Cache
  6. Flash the ROM.zip wait till it completes.
  7. Wait till it boots, or else take log using ADB logcat. (Hint: If LED light blinks, the rom is booting)

FOR Fixes Proceed to next post and find out the way to tackle and fix the bugs. :)
 
Last edited:

Rohan Taneja

Inactive Recognized Developer
Feb 22, 2013
740
2,564
Fixing ROM issues

Finally Ported a Custom ROM. Now, time to kill out some bugs.
Its all about making the build stable for personal as well as others to use it.
Leave the files if not there in your System

Let's get started:

Bootloop? :crying:
Replace following files(from stock to port):
Code:
[LIST]
[*]libandroid_runtime.so
[*]libandroid_servers.so
[*]libmedia_jni.so
[*]libsync.so

[*]If possible try modifying framework.jar "\smali\com\android\server" (copy from stock)
[/LIST]

Camera Not Working? :(
Replace following files(from stock to port):
Code:
[HIDE][LIST]
[*]lib3a.so 
[*]liba3m.so
[*]libacdk.so
[*]libaudioflinger.so
[*]libc.so
[*]libcam.camadapter.so
[*]libcam.campipe.so
[*]libcam.camshot.so
[*]libcam.client.so
[*]libcam.paramsmgr.so
[*]libcam.utils.so
[*]libcam_camera_exif.so
[*]libcamalgo.so
[*]libcamdrv.so
[*]libcamera_client.so
[*]libcamera_jni_eglfence.so
[*]libcamera_metadata.so
[*]libcameracustom.so
[*]libcameraservice.so
[*]libgn_camera_feature.so
[*]libexif
[*]libfeatureio.so
[*]libfrsdk.so
[*]libft.so
[*]libgcomm_jni.so
[*]libgoggles_clientvision.so
[*]libgui.so
[*]libimageio.so
[*]libja3m.so
[*]libjni_mosaic.so
[/LIST]
Thanks To [I]Shikar A[/I][/HIDE]
[B]Init.rc Fix:[/B]
[HIDE]Init.rc(present in the ramdisk of boot.img), find for code #Camera in stock boot.img. Copy it and replace from stock init.rc and replace in the port init.rc
[IMG]http://s27.postimg.org/4ucj34cwj/initrc_cam.png[/IMG][/HIDE]

Wlan not working properly? :rolleyes:
Code:
Check wlan.chip in stock like:
[HIDE][IMG]http://s30.postimg.org/myaya0sxt/Untitled.png[/IMG]
fmradio.driver.chip=x (if mt6620 then x=1, if mt6628 then x=3)
Change the above codes accordingly in updater-script
Replace the version in port from the one in stock[/HIDE]
(Replace from stock to port)
libbluetooth_mtk.so
libbluetoothem_mtk.so

GPS, unstable or not working? :confused:
(Replace from stock to port)
Code:
xbin/libmnlp

Media Player problem? :confused:
(Replace from stock to port)
Code:
libdpframework.so
libcodecvdrv.so

Sensors not working properly? :confused:
(Replace from stock to port)
Code:
libsensorservice.so

SD Card not working or mounting?
Code:
In the framework-res.apk of your port, replace /res/xml/storage_list.xml from stock one.

USB not mounting your device? :eek:
Code:
Unpack your boot.img replace init.usb.rc from ramdisk by stock boot.img init.usb.rc

This tutorial worked for porting MIUI, Baidu, Vibe UI, LeWa OS, AOSP based rom from different device to my MT6589 of same hardware.

Credits:
Special Thanks to @yuweng (for starting his main MTK porting thread and his great works)
XDA-Developers being one of the best place for Android Development
Other Developers for helping in fixing most the issues.​
 
Last edited:

Rohan Taneja

Inactive Recognized Developer
Feb 22, 2013
740
2,564

iel0000

Senior Member
Jan 9, 2012
222
21
Angeles City
Redmi Note 11
cant also find these
com.google.android.media.effects.jar
com.google.android.media.effects.xml

sorry for the noob questions..i just want to port a rom to my device as we dont have developers :D
 

xjammetx

Senior Member
Mar 18, 2012
301
59
Las Islas Pilipinas!
it worked!
i ported an miui from newman n1, the ics 4.0.4 with no bugs to my cherry mobile blaze / Ming Ren A2 clone.
btw, this is not a dual sim display miui, i need to go to settings anytime i wan to use the other sim.
anyone who knows where to get a dual sim display miui?
 
Last edited:

iel0000

Senior Member
Jan 9, 2012
222
21
Angeles City
Redmi Note 11
You Can Use Stock BOOT.IMG or try changing the ramdisk with stock from the port kernel!

Tool: http://d-h.st/BVz

i give up porting miui to my phone and tried porting another rom from amoi n820..it boot but the home key is not working..i already used Generic.kl from my device stock rom but it still dont work :( can you help me plss?

edit : i finally got it working..thanks for the tut it really help me..:D..
 
Last edited:

dreamyworld

Senior Member
Aug 1, 2011
214
176
How to from STOCK

how to use the tool?

Do you know procedure to Port a STOCK ROM(SP Flash tool format not a CWM) of X device to Y device?
Both are mostly same in specifications except the resolution.

I read in some threads that we can not port a rom from a device which has different resolution ?

Thanks in Advance
 

Top Liked Posts

  • There are no posts matching your filters.
  • 75
    Hello Viewers! I am Rohan Taneja, here with completely re-written guide to Port MTK65xx Roms. :)
    I had left MTK development since a year and I finally got another MTK device to carry with it again.
    Untitled_1.jpg

    So, Many Of You May be MTK Device User than you are at right place to fill your device with many awesome roms!

    Note: Android ONE devices (MT6582 SoC) use Google's device tree, meaning they differ on everything with all the other MediaTek devices (even the ones with the same SoC , MT6582), as per @superdragonpt told us :eek:

    Requirements:
    • A MTK powered device :cowboy:
    • USB Cable :p
    • Usable Brains :cyclops:
    • Knowledge about Flashing & Taking Logs :angel:
    • Stock Firmware (from manufacturer) & Port Firmware (matching specification of your device) :)
    • Custom Recovery installed on device :)

    Porting Tips
    • Choose Custom ROM from a device matching same resolution to reduce App Size related bugs
    • This Guide Applies to
      1. MT6577 to MT6577, vice-versa
      2. MT6589 to MT6589, vice-versa
      3. MT6572 to MT6572, vice-versa
      4. MT6582 to MT6582, vice-versa
    Note: Try it at your own risk, and don't complaint any developer or XDA if any mishap takes place. :good:​

    TUTORIAL:
    Starting with the tutorial, I request you to follow every single step written below to prevent any kind of problem in flashing and causing bootloop. I also dare you to take a nandroid backup of your current rom you are using.​

    Get. Set. Go.

    Step 1 : Patching System Folder for the port patch.​
    First of all make a folder named "Port_Patch" and setup all the folder as shown in the images below.
    Untitled.png


    1. Now, in Port_Patch make system folder in which make folders, "bin" "etc" "lib" "usr" "vendor" "xbin" (without ")
    2. In folder "bin" copy pq & vold from your stock rom
    3. In folder "etc" copy "bluetooth" "firmware" "wifi" "apns-conf.xml" "vold.fstab" "vold.fstab.nand"
      etc.png
    4. In folder "lib" copy files as shown in the image
      lib.png
    5. In folder "usr" copy usr/keylayout/Generic.kl
      usr.png
    6. In folder "vendor" all the files
      vendor.png
    7. In folder "xbin" copy "libmnlp_mt662x" (x - '0' or '8') from stock
      xbin.png

    System has been patched, copy this /system to patch the /system of port ROM.

    Step 2: Patching the boot.img of the port rom.
    This is bit tricky but can be done easily.
    1. So, first of download this little tool, to unpack & repack your boot.img - MTKbootimg.zip - tested on Windows 7 & above platform
    2. Extract the Tool and you will get two folders named "stock" & "port"
    3. Copy boot.img's respectively from stock rom in "stock" folder & from port rom to "port"
    4. Unpack both boot.img repectively and they may look like this.
      bootimg.png
    5. From stock copy "kernel" to port folder and just replace it.
    6. Now, repack it, new file named "boot-new.img" will be generated.
    7. Copy "boot-new.img" to port Rom Folder.
    8. Delete existing "boot.img" and rename "boot-new.img" to "boot.img"

    Now, your boot.img is patched, proceed to last step.

    Step 3: Modifying updater-script to install ROM accordingly.
    1. So, it's the last step before flashing the rom. Now lets fix it.
    2. First, you have to know your device mount points, that can be tracked using MTKDroid Tool or check them in stock rom updater-script.
    3. I have my flashable stock rom so I will get mount points from it.
    4. As show in the image, my stock updater have different mount point for system & data while port have different.
      meta.png
    5. Now, replace "mmcblk0pX" (X - no. for the mount) from stock to port as designated for the partition.
    6. Now Save the updater-script.

    Finally, the ROM is ready to flashed.

    Step 4: Compressing & Flashing the ROM.
    1. Now, the rom is ready to be packed and flashed.
    2. Simply get to the main directory with META-INF, system, boot.img, etc files.
    3. Select all the files and compress them to zip. Select the compression ratio as you want.
    4. After compressing copy the ROM into root of sdcard
    5. Enter Custom Recovery, wipe data & Cache
    6. Flash the ROM.zip wait till it completes.
    7. Wait till it boots, or else take log using ADB logcat. (Hint: If LED light blinks, the rom is booting)

    FOR Fixes Proceed to next post and find out the way to tackle and fix the bugs. :)
    30
    Fixing ROM issues

    Finally Ported a Custom ROM. Now, time to kill out some bugs.
    Its all about making the build stable for personal as well as others to use it.
    Leave the files if not there in your System

    Let's get started:

    Bootloop? :crying:
    Replace following files(from stock to port):
    Code:
    [LIST]
    [*]libandroid_runtime.so
    [*]libandroid_servers.so
    [*]libmedia_jni.so
    [*]libsync.so
    
    [*]If possible try modifying framework.jar "\smali\com\android\server" (copy from stock)
    [/LIST]

    Camera Not Working? :(
    Replace following files(from stock to port):
    Code:
    [HIDE][LIST]
    [*]lib3a.so 
    [*]liba3m.so
    [*]libacdk.so
    [*]libaudioflinger.so
    [*]libc.so
    [*]libcam.camadapter.so
    [*]libcam.campipe.so
    [*]libcam.camshot.so
    [*]libcam.client.so
    [*]libcam.paramsmgr.so
    [*]libcam.utils.so
    [*]libcam_camera_exif.so
    [*]libcamalgo.so
    [*]libcamdrv.so
    [*]libcamera_client.so
    [*]libcamera_jni_eglfence.so
    [*]libcamera_metadata.so
    [*]libcameracustom.so
    [*]libcameraservice.so
    [*]libgn_camera_feature.so
    [*]libexif
    [*]libfeatureio.so
    [*]libfrsdk.so
    [*]libft.so
    [*]libgcomm_jni.so
    [*]libgoggles_clientvision.so
    [*]libgui.so
    [*]libimageio.so
    [*]libja3m.so
    [*]libjni_mosaic.so
    [/LIST]
    Thanks To [I]Shikar A[/I][/HIDE]
    [B]Init.rc Fix:[/B]
    [HIDE]Init.rc(present in the ramdisk of boot.img), find for code #Camera in stock boot.img. Copy it and replace from stock init.rc and replace in the port init.rc
    [IMG]http://s27.postimg.org/4ucj34cwj/initrc_cam.png[/IMG][/HIDE]

    Wlan not working properly? :rolleyes:
    Code:
    Check wlan.chip in stock like:
    [HIDE][IMG]http://s30.postimg.org/myaya0sxt/Untitled.png[/IMG]
    fmradio.driver.chip=x (if mt6620 then x=1, if mt6628 then x=3)
    Change the above codes accordingly in updater-script
    Replace the version in port from the one in stock[/HIDE]
    (Replace from stock to port)
    libbluetooth_mtk.so
    libbluetoothem_mtk.so

    GPS, unstable or not working? :confused:
    (Replace from stock to port)
    Code:
    xbin/libmnlp

    Media Player problem? :confused:
    (Replace from stock to port)
    Code:
    libdpframework.so
    libcodecvdrv.so

    Sensors not working properly? :confused:
    (Replace from stock to port)
    Code:
    libsensorservice.so

    SD Card not working or mounting?
    Code:
    In the framework-res.apk of your port, replace /res/xml/storage_list.xml from stock one.

    USB not mounting your device? :eek:
    Code:
    Unpack your boot.img replace init.usb.rc from ramdisk by stock boot.img init.usb.rc

    This tutorial worked for porting MIUI, Baidu, Vibe UI, LeWa OS, AOSP based rom from different device to my MT6589 of same hardware.

    Credits:
    Special Thanks to @yuweng (for starting his main MTK porting thread and his great works)
    XDA-Developers being one of the best place for Android Development
    Other Developers for helping in fixing most the issues.​
    6
    just wanna ask..is it ok if i dont copy the srec folder cause i cant find it..also yhe meta-inf folder as i only have the system.img of my base rom
    If You Don't Have "srec" folder no need to worry but for system.img you need to extract the img by ext4 method:
    http://forum.xda-developers.com/showthread.php?t=2285831
    5
    how about theses files?
    CERT.RSA
    CERT.SF
    MANIFEST.MF

    i dont have them cause i dont have a flashable stock rom..
    Don't Worry Try The one in the Ported Rom!
    5
    what boot.img did you use? stock from cherry mobile?
    Don't Try boot.img(Kernel) from the port rom or you'll brick your device!