Monday, November 16, 2015

Porting Method MTK - Part One

by jonacxDGreat

1. Normal Porting - AOSP, Stock Based, Customed/Modded Stock, Customed/Modded AOSP
2. Cyanogenmod 12 - 5.0.2
3. Cyanogenmod 12.1 - 5.1.1
4. MIUI 7 - KK
5. Crossporting MT6582 - MT6592 (vice-versa) AOSP, Stock Based, AOSP, Stock Based, Customed/Modded Stock, Customed/Modded AOSP



Normal Porting - MT6582/MT6592
Stock - Port

system/bin
                file: pq, vold, sdcard (optional)
system/etc:
                file: apns-conf.xml, custom.conf (port file - edit lines)
                folder: bluetooth, firmware, wifi, mddb (optional)
system/lib:
                file: libcamalgo.so, libcamdrv.so, libcameracustom.so, libdpframework.so,
                                  libEGL.so, libMali.so, libsensorservice.so, libsync.so, libvcodecdrv.so
                                  (note: all libaudio files only for fixing audio)
                folder: egl (libEGL_mali.so, libGLES_android.so)
                                                hw (copy all file from stock to port - replace existing)
                                                modules (copy all file from stock to port - replace existing)
system/vendor:
                replace from stock to port - replace existing and leave not on stock

system/xbin:
                file: libmnlp_mt6592, mnld, (and other rooting files needed)
               
               
Cyanogenmod 12

Copy stock to port (boot.img)
stock/zImage and stock/ramdisk/ueventd.rc

system/etc:
                folder: firmware (modem_1_wg_n.img or whole firmware folder)
system/lib:
                file: libMali.so,libaudio.primary.default.so,libcamdrv.so,libcamalgo.so,libcameracustom.so
                folder: hw (gralloc.default.so, gralloc.mt6592.so, hwcomposer.mt6592.so)

Cyanogenmod 12.1

Copy stock to port (boot.img)
stock/zImage and stock/ramdisk/ueventd.rc

system/bin: (boot_logo_updater, ipod, logwrapper, netd)
system/etc:
                folder: firmware (modem_1_wg_n.img or whole firmware folder)
                hostapd folder, permissions (android.hardware.camera.xml, android.hardware.microphone.xml)
system/lib:
                hw folder: camera.default.so
                file: libfeatureio.so, libfeatureio.so, libimageio_plat_drv.so, libipod.so, libMali.so, libshowlogo.so


For emulated storage fix

Edit: init.mt65xx.rc
Replace:

on init
    export LD_PRELOAD /system/lib/libxlog.so

    export EXTERNAL_STORAGE /storage/emulated/legacy
    export SECONDARY_STORAGE /storage/sdcard1

    mkdir /mnt/shell 0700 shell shell
    chmod 0750 /mnt/shell
    chown shell sdcard_r /mnt/shell
    mkdir /mnt/shell/emulated 0700 shell shell
    mkdir /mnt/shell/emulated/0 0700 shell shell
    mkdir /storage/emulated 0555 root root

    mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
    mkdir /storage/sdcard1 0700 root root

    export EXTERNAL_STORAGE /storage/emulated/legacy
    export SECONDARY_STORAGE /storage/sdcard1
    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
    export EMULATED_STORAGE_TARGET /storage/emulated

With this:

on init
    export LD_PRELOAD /system/lib/libxlog.so
    export EXTERNAL_STORAGE /storage/sdcard0
    export SECONDARY_STORAGE /storage/sdcard1

on init
    mkdir /mnt/media_rw/sdcard0 0700 media_rw media_rw
    mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
    mkdir /storage/sdcard0 0700 root root
    mkdir /storage/sdcard1 0700 root root

    export EXTERNAL_STORAGE /storage/sdcard1

    # Support legacy paths
    symlink /storage/sdcard0 /sdcard
    symlink /storage/sdcard0 /mnt/sdcard
symlink /storage/sdcard1 /mnt/sdcard2


    # USB OTG
    mkdir /storage/usbotg 0700 root root
    mkdir /mnt/media_rw/usbotg 0700 media_rw media_rw

And Edit: Framework-res.apk (storagelist.xml)

From this:

    <storage android:storageDescription="@string/storage_internal" android:primary="true" android:emulated="true" android:mtpReserve="400" />
    <storage android:mountPoint="/storage/sdcard1" android:storageDescription="@string/storage_sd_card" android:removable="true" />
    <storage android:mountPoint="/storage/usbotg" android:storageDescription="@string/storage_usb" android:removable="true" />

To this:

    <storage android:storageDescription="@string/storage_internal" android:primary="false" android:removable="false" android:allowMassStorage="true" />
    <storage android:mountPoint="/storage/sdcard1" android:storageDescription="@string/storage_sd_card" android:primary="false" android:removable="true" />
    <storage android:mountPoint="/storage/usbotg" android:storageDescription="@string/storage_usb" android:removable="true" />
</StorageList>



Porting MIUI 7

System Files (Patch Files)

system/bin (mtkbt, vold, sdcard(optional))

system/etc
                folder: firmware and mddb

system/lib
                folder: hw
                files:
                                libcameracustom.so
                                libcameraservice.so
                                libfeatureio.so
                                libMali.so
                                libshowlogo.so
                                libaudio*.so (optional if bug on sound)

system/vendor: copy whole folder to port, replace if existing

system/xbin: libmnlp_mt6592, mnld


Boot.img porting

-copy stock kernel to port boot.img
-compare and edit port init.rc w/ stock init.rc
-copy sepolicy and ueventd.rc from stock to port


Crossporting MT6582 - MT6592 (vice-versa)

stock to port rom

boot.img:
copy ramdisk/init.rc and init.environ.rc bootclash lines from stock to port

system/bin
                copy all file and replace existing

system/etc
                delete bluetooth and mddb folder from port
                copy bluetooth and mddb folder from stock to port
                copy firmware folder from stock to port - replace existing files
                copy permissions folder (platform.xml, handheld_core_hardware.xml) optional/bug fix
                edit port custom.conf

system/lib
                must delete files from stock before copy paste to port
                libandroid.so,libandroid_runtime.so,libandroid_servers.so
                libandroidfw.so,libjavacore.so,libjavacrypto.so
                libwebrtc_audio_preprocessing.so,libwebviewchromium.so,libwebviewchromium_plat_support.so
                *now copy whole lib folder to port libfolder and replace existing file consider hw/modules

system/vendor
                copy stock vendor to port - replace existing

system/xbin
                delete libmnlp_mt6582 from port
                copy libmnlp_mt6592, mnld from stock to port
               
build.prop:
replace all mt6582 lines to mt6592 vice-versa
replace lines if xport mt6582 - mt6592
mediatek.wlan.chip=MTK_CONNSYS_MT6592

mediatek.wlan.module.postfix=_mtk_connsys_mt6592

19 comments:

  1. the crossporting guide will work for mt6592 lollipop v5.0.2 as a port rom and mt6582 kitkat 4.4.2 Base? please help me because i want to port flyme os to my fuze v5.

    ReplyDelete
  2. Can you tell me how to port smart gestures of Lava Iris X8 Stock Rom to custom ROM

    ReplyDelete
  3. These guides look very appealing. At least they're different from all the copied, outdated guides I see everywhere. Good work.
    However, noob that I am, I have a doubt: are the guides meant to be used in conjunction, or each by itself?
    I mean, I want to port a CM12.1, should I only follow the guidelines for CM12.1, or the ones from CM12 also?
    Sorry for the silly question, and thank you in advance.

    ReplyDelete
  4. i am trying to port a rom to blu vivo air but the problem is it is not detecting imei, what could be the solution, if someone has any information please let me know, the rom is AICP lollipop.

    ReplyDelete
    Replies
    1. Root it, install Chamelephon (available on playstore), grant root access, input your IMEI numbers, apply changes, reboot. In case you don't know your IMEI, remove the device's back cover (and its battery, if it's removable), and look for a sticker with a long number (15 digits), that's your IMEI.

      Delete
  5. the problem is it does not detects nvram partition. i am missing to replace some files from related to radio. which could b those. or the problem might be in boot.img. when i restore nvram from mtk droid tools the rom boot loops thanks for your reply :) .

    ReplyDelete
  6. I follow this post because I have camera, flash ligh and promixity issue, due Android starting state it go forever, as I expect is call some error mean: deamon...no such file or folder, I porting 12.1 cynanogenmod,I think I miss some file around, any advice?

    ReplyDelete
  7. Will Crossport method work from mt6592 to mt6582??

    ReplyDelete
  8. Thanks, dude, wery well guide for fix storage

    ReplyDelete
  9. bro your guide vice versa possible to mt6572-mt6582?

    ReplyDelete
  10. Please give me to edit boot.img for edit init.rc or extr. How to edit port init.rc w/ stock init.rc?Thanks sir.

    ReplyDelete
  11. bro, anong guide yong magwowork with mt6753 with same chipset? I am new to lollipop world and a cm flare s4 user.. hoping na matutulungan mo ko bro. salamat

    ReplyDelete
  12. Bro hello ı have ported cm13 my dvice storage isnt mounting and my base roms ramdisk folder doesnt have mt6592.rc file help me

    ReplyDelete
  13. Bro hello ı have ported cm13 my dvice storage isnt mounting and my base roms ramdisk folder doesnt have mt6592.rc file help me

    ReplyDelete
  14. How cross port Z5 mt6592 to mt6582. I'm stock on boot logo.

    ReplyDelete
  15. How to port Miui Redmi Note (MT6592) to MT6582..??
    Which Guide should i follow..??
    I successfully port miui mt6582 to mt6582 but don't know how to cross port.

    ReplyDelete
  16. i follow your miui guide but stuck at bool logo.
    i am trying to port miui mt6582 to mt6582

    ReplyDelete
  17. Thanks for sharing, nice post! Post really provice useful information!

    Giaonhan247 chuyên dịch vụ vận chuyển hàng đi mỹ cũng như dịch vụ ship hàng mỹ từ dịch vụ nhận mua hộ hàng mỹ từ website nổi tiếng Mỹ là mua hàng amazon về VN uy tín, giá rẻ.

    ReplyDelete