[Android Software Development] yuweng:
Yeoh Bro, i'm happy that you got yourself a MTK, now i got a companion to test Philz Touch & thank you Master Shifu Philz3759 for supporting MTK devices...

And i've just found out ONLY a few days ago that. . . :o

The main culprit for Philz Touch branch cm-10.1, cm-10.2 & cm-11.0 not to boot on MTK is that it requires BOARD_USE_NTFS_3G := false & recovery.fstab v2 or it'll boots up with a blank screen then bootloop... With it, it'll boot on all branches while for jellybean branch, it has been booting but not backing up MTK boot/ recovery...

Tested & found only 240x320, 320x480 & 480x320 res boots while 480x800, 480x854(my device res), 540x960, 600x1024 & 720x1280 doesn't & i didn't test the remaining...

Touch is working perfectly... :good: i donno much C/C++ so donno how to debug codes... :o Have tried with/ without various build flags but no effect on my device res...

BOARD_USE_MTK_LAYOUT := true
BOARD_MTK_BOOT_LABEL := "/bootimg"
BOARD_HAS_LOW_RESOLUTION := true
BRIGHTNESS_SYS_FILE := "/sys/class/leds/lcd-backlight/brightness" [COLOR="Blue"]<- doesn't build without this flag[/COLOR]
BOARD_HAS_FLIPPED_SCREEN := true [COLOR="Blue"]<- Whoops, just found out Philz Touch doesn't have this[/COLOR]
RECOVERY_TOUCHSCREEN_FLIP_X := true [COLOR="Blue"]<- Only tested on 320X480, working[/COLOR]
RECOVERY_TOUCHSCREEN_FLIP_Y := true [COLOR="Blue"]<- Only tested on 320X480, working[/COLOR]
TARGET_RECOVERY_PIXEL_FORMAT := "RGB_565"
TARGET_RECOVERY_PIXEL_FORMAT := "RGBA_8888"
TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"

Refer to update here

240x320

320x480​

Discovered v6.26.6 backup only to /data/media (i'm still using the old ics MT6577) & i still haven't figured out how to make both sdcard mount using the mount USB storage... Refer to conclusion here . . .

When using custom backup, it doesn't properly backup MTK boot(backup boot as bootimg.img instead of boot.img & only a restart(adb reboot -p) & found the bootimg.img at external sdcard with a size of 320Mb instead of 7Mb... Cannot get recovery.log as mounting sdcard is not working, i guess...

Mounts and Storage -> Mount /sdcard & it will tell you Error mounting /sdcard! -> Go Back

Backup and Restore -> Custom Backup to storage/sdcard0 >> Start Custom Backup Job & it'll start backing up but only a adb reboot recovery or battery out will stop it... Refer to update here...

BoardConfig.mk that i'm using . . .

mkvendor.sh generated, need editing are those in BLUE . . .

USE_CAMERA_STUB := true

# inherit from the proprietary version
-include vendor/TD2/9300/BoardConfigVendor.mk

TARGET_ARCH := arm
TARGET_NO_BOOTLOADER := true
TARGET_BOARD_PLATFORM := MT6577 [COLOR="Blue"]<- Non-critical, originally is [B]unknown[/B], can leave it as it is or change to any label[/COLOR]
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_VARIANT := cortex-a9 [COLOR="Blue"]<- Critical , originally is [B]cortex-a7[/B], wrong selection & it will not boot ![/COLOR]
ARCH_ARM_HAVE_TLS_REGISTER := true

TARGET_BOOTLOADER_BOARD_NAME := 9300

BOARD_KERNEL_CMDLINE :=
BOARD_KERNEL_BASE := 0x10000000
BOARD_KERNEL_PAGESIZE := 2048

# fix this up by examining /proc/mtd on a running device
BOARD_BOOTIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_FLASH_BLOCK_SIZE := 131072

TARGET_PREBUILT_KERNEL := device/TD2/9300/kernel

BOARD_HAS_NO_SELECT_BUTTON := true

[COLOR="Blue"]TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/mt_usb/gadget/lun%d/file"[/COLOR]

[COLOR="blue"]#AFAIK, for MT6582/ 92 it is at -> [B]"/sys/devices/platform/mt_usb/musb-hdrc.0/gadget/lun%d/file"[/COLOR][/B]

[COLOR="blue"]#Philz Touch build flags for MTK
TARGET_COMMON_NAME := TD2 9300 [COLOR="red"]<- This will be displayed at Philz Settings -> About[/COLOR]
BOARD_USE_MTK_LAYOUT := true
BOARD_MTK_BOOT_LABEL := "/bootimg"
BOARD_USE_NTFS_3G := false
TARGET_SCREEN_HEIGHT := 480 [COLOR="red"]<- Edit according to your device res[/COLOR]
TARGET_SCREEN_WIDTH := 320 [COLOR="red"]<- Edit according to your device res[/COLOR]
BOARD_HAS_LOW_RESOLUTION := true [COLOR="Red"]<- For all devices lower than 1024x768 resolution. Mentioned at Philz Touch ~/cm11/bootable/recovery/boardconfig/BoardConfig.mk[/COLOR]
BRIGHTNESS_SYS_FILE := "/sys/class/leds/lcd-backlight/brightness"[/COLOR]

recovery.fstab that i'm using . . .

Still haven't figure out how to Mounts & Storage -> mount USB storage . . .

/dev/bootimg /bootimg emmc defaults defaults
/dev/recovery /recovery emmc defaults defaults
/dev/uboot /uboot emmc defaults defaults
/emmc@android /system ext4 ro,noatime wait
/emmc@cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc wait
/emmc@usrdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc wait,encryptable=footer

# According to Master Shifu [COLOR="Blue"][B]Phil3759[/B][/COLOR], [B]ONLY[/B] either one below but cannot use both [B]INIT[/B] & [B]VOLD[/B] mount points

# [B]INIT[/B] mount points
/emmc@fat /emmc vfat defaults defaults
/dev/block/mmcblk1p1 /sdcard vfat defaults defaults

# [B]VOLD[/B] mount points (Ref taken from Lenovo S939 KitKat 4.4.2)
# vold managed volumes for generic MTK
/devices/platform/mtk-sd.0/mmc_host auto vfat defaults voldmanaged=sdcard0:emmc@fat,noemulatedsd
/devices/platform/mtk-sd.1/mmc_host auto vfat defaults voldmanaged=sdcard1:auto

# [B]VOLD[/B] mount points (Ref taken from Lenovo S939 KitKat 4.4.2)
# vold managed volumes for MT6582/ 92
#/devices/platform/mtk-msdc.0/mmc_host auto vfat defaults voldmanaged=sdcard0:emmc@fat,noemulatedsd
#/devices/platform/mtk-msdc.1/mmc_host auto vfat defaults voldmanaged=sdcard1:auto

Below has been tested working too but backup to /data/media though mount USB storage not working . . .

/emmc@fat /emmc vfat defaults defaults
/dev/block/mmcblk1p1 /external_sd vfat defaults defaults

/dev/block/mmcblk0p6 /emmc vfat defaults defaults
/dev/block/mmcblk1p1 /external_sd vfat defaults defaults

/dev/block/mmcblk0p6 /emmc vfat defaults lun=/sys/devices/platform/mt_usb/gadget/lun0/file
/dev/block/mmcblk1p1 /external_sd vfat defaults lun=/sys/devices/platform/mt_usb/gadget/lun1/file

/emmc@fat /emmc vfat defaults lun=/sys/devices/platform/mt_usb/gadget/lun0/file
/dev/block/mmcblk1p1 /external_sd vfat defaults lun=/sys/devices/platform/mt_usb/gadget/lun1/file

/emmc@fat /internal_sd vfat defaults defaults
/dev/block/mmcblk1p1 /external_sd vfat defaults defaults

/dev/block/mmcblk0p6 /internal_sd vfat defaults defaults
/dev/block/mmcblk1p1 /external_sd vfat defaults defaults

/dev/block/mmcblk0p6 /internal_sd vfat defaults lun=/sys/devices/platform/mt_usb/gadget/lun0/file
/dev/block/mmcblk1p1 /external_sd vfat defaults lun=/sys/devices/platform/mt_usb/gadget/lun1/file

/emmc@fat /internal_sd vfat defaults lun=/sys/devices/platform/mt_usb/gadget/lun0/file
/dev/block/mmcblk1p1 /external_sd vfat defaults lun=/sys/devices/platform/mt_usb/gadget/lun1/file

To backup to /emmc though mount USB storage not working, for 4.2.2 & below that doesn't use /data/media backup path

/emmc@fat /emmc vfat defaults defaults
/dev/block/mmcblk1p1 /sdcard vfat defaults defaults

/devices/platform/mtk-sd.0/mmc_host auto vfat defaults voldmanaged=sdcard0:emmc@fat,noemulatedsd
/devices/platform/mtk-sd.1/mmc_host auto vfat defaults voldmanaged=sdcard1:auto

Refer to here . . .

Added on Apr 22, 2014

Conclusion, only MT6589 & latest MT6592 is able to use the mount USB storage, refer to here . . .

Found the solution for my old MT6577 to use Philz Touch . . .:laugh:

Backup to /emmc internal sd

extra.fstab

# add here entries already existing in main device fstab, but for which you want a blk_device2, fs_type2 or fs_options2
# mount point must be the same, mmcblk device must be your device true path
# used to partition sdcard/usb disks and format it to ext2/ext3
# used also to stat for size of mtd/yaffs2 partitions

# blk_device2 mount_point fs_type2 fs_options2 flags (not used in extra.fstab code)
/emmc@fat /storage/sdcard0	vfat	defaults	defaults
/dev/block/mmcblk1p1	/storage/sdcard1	vfat	defaults	defaults

recovery.fstab

# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK

#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/bootimg /bootimg emmc defaults defaults
/dev/recovery /recovery emmc defaults defaults
/dev/uboot /uboot emmc defaults defaults
/emmc@android /system ext4 ro,noatime wait
/emmc@cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc wait
/emmc@usrdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc wait,encryptable=footer

#<src> <mnt_point> <type> <mnt_flags> <fs_mgr_flags>
/devices/platform/mtk-sd.0/mmc_host /storage/sdcard0 vfat defaults voldmanaged=sdcard0
/devices/platform/mtk-sd.1/mmc_host /storage/sdcard1 vfat defaults voldmanaged=sdcard1

Backup to /external_sd

extra.fstab <- different is this file, swap sdcard0 with sdcard1

# add here entries already existing in main device fstab, but for which you want a blk_device2, fs_type2 or fs_options2
# mount point must be the same, mmcblk device must be your device true path
# used to partition sdcard/usb disks and format it to ext2/ext3
# used also to stat for size of mtd/yaffs2 partitions

# blk_device2 mount_point fs_type2 fs_options2 flags (not used in extra.fstab code)
/emmc@fat /storage/sdcard[COLOR="red"]1[/COLOR]	vfat	defaults	defaults
/dev/block/mmcblk1p1	/storage/sdcard[COLOR="red"]0[/COLOR]	vfat	defaults	defaults

recovery.fstab

# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK

#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/bootimg /bootimg emmc defaults defaults
/dev/recovery /recovery emmc defaults defaults
/dev/uboot /uboot emmc defaults defaults
/emmc@android /system ext4 ro,noatime wait
/emmc@cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc wait
/emmc@usrdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc wait,encryptable=footer

#<src> <mnt_point> <type> <mnt_flags> <fs_mgr_flags>
/devices/platform/mtk-sd.0/mmc_host /storage/sdcard0 vfat defaults voldmanaged=sdcard0
/devices/platform/mtk-sd.1/mmc_host /storage/sdcard1 vfat defaults voldmanaged=sdcard1

Added on Apr 23, 2014

Solved ! Huge credits to suhas.holla . . . :good:

Huge credits to suhas.holla, the fstab v2 AKA unified fstab has been demystified for MTK devices & mount both sdcard at Philz Touch is working perfecty now. . . :laugh:

recovery.fstab for MT65xx

# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK

#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/bootimg /bootimg emmc defaults defaults
/dev/recovery /recovery emmc defaults defaults
/dev/uboot /uboot emmc defaults defaults
/emmc@android /system ext4 ro,noatime wait
/emmc@cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc wait
/emmc@usrdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc wait,encryptable=footer

# For MT6577
/devices/platform/mtk-sd.0/mmc_host/mmc0 auto auto defaults voldmanaged=sdcard0:[COLOR="blue"][B][SIZE="4"]6[/SIZE][/B][/COLOR]
/devices/platform/mtk-sd.1/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto

# For MT65[B]xx[/B]
[COLOR="Blue"]/devices/platform/mtk-msdc.0/mmc_host/mmc0[/COLOR] auto auto defaults voldmanaged=sdcard0:[COLOR="blue"][B][SIZE="4"]6[/SIZE][/B][/COLOR]
[COLOR="blue"]/devices/platform/mtk-msdc.1/mmc_host/mmc1[/COLOR] auto auto defaults voldmanaged=sdcard1:auto

To identify your MTK voldmanaged path for sdcard -> adb shell find /sys -name mmc0. You don't need to include the first path /sys so it should start with /devices

To identify your internal sdcard partition no. -> adb shell cat /proc/dumchar_info & look at fat partition block /dev/block/mmcblk0p6 & update it accordingly . . .

Copy your edited recovery.fstab content to replace it at fstab.goldfish & rename it to fstab.${ro.hardware}

The correct way to check ${ro.hardware} -> adb shell getprop ro.hardware -> mt6577 then it should be rename to fstab.mt6577

You can use this custombootimg.mk by Dees_Troy credits to bgcngm or another one by xda friend awaaas he told me big biff has help him with that... :good:

If you're a Win OS user then you can use this Drag&Drop Repack Utils... And a Factory ROM backup for your MTK... :good:

With BBQLinux any newbies also can compile from source... :laugh: And you don't need 12.2GB of cm-11.0 complete full source just to build the latest Philz Touch... :cool:

Commands to build Philz Touch on BBQLinux with cm-11.0 Part Source is only 1.5GB !

Credits to shoey63 for the tips, i only build locally so no codes to commit . . . :o

Source

mkdir -p ~/cm11/.repo/local_manifests
cd ~/cm11
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
Copy & paste [COLOR="blue"]local_manifest.xml[/COLOR] to sync Part-Source for building recovery only

repo sync -f -j4 [COLOR="blue"]<- Shall only sync 52 out of the total 447 projects on cm-11.0 full source[/COLOR]

Copy stock boot.img to [COLOR="Blue"][Home][/COLOR] & use [COLOR="Blue"]mkvendor.sh[/COLOR], edit [COLOR="blue"]BoardConfig.mk[/COLOR] & [COLOR="blue"]recovery.fstab[/COLOR]

Delete everything at ~/cm11/vendor/cm/config/[COLOR="Blue"]common_full.mk[/COLOR] only left the first as below

[COLOR="DarkOrange"]# Inherit common CM stuff
$(call inherit-product, vendor/cm/config/common.mk)[/COLOR]

build/tools/device/mkvendor.sh [COLOR="Blue"][B]Lenovo[/B][/COLOR] [COLOR="Red"]S939[/COLOR] ~/boot.img [COLOR="Blue"]<- change accordingly to your [B]vendor[/B] & [COLOR="red"]device[/COLOR] name[/COLOR]
prebuilts/misc/linux-x86/ccache/ccache -M 25G
export USE_CCACHE=1
. build/envsetup.sh
lunch cm_[COLOR="red"]S939[/COLOR]-eng [COLOR="blue"]<- change accordingly to your [COLOR="red"]device[/COLOR] name[/COLOR]
make -j4 recoveryimage