FORUMS
Remove All Ads from XDA

Easy Magic PhilZ Touch Installer for MediaTek Devices ONLY (Developers ONLY)

1,139 posts
Thanks Meter: 3,965
 
By yuweng, Senior Member on 11th May 2014, 04:54 PM
Post Reply Email Thread
Announcement from yuweng: Easy Magic PhilZ Touch Installer for MediaTek Devices ONLY

* * * * * * * * * * * * * * * * * * * * * * * * *
PhilZ Touch 6 Recovery
CWM Advanced Edition 6.x
* * * * * * * * * * * * * * * * * * * * * * * * *


PhilZ Touch CWM Advanced Edition is developed by XDA Recognized Developer Phil3759 now fully supports MediaTek devices . . .

Supports Five generations of MediaTek SoC in One-Porting-Tool.
  1. Arm11
  2. Cortex-A9
  3. Cortex-A7
  4. big.LITTLE
  5. Cortex-A53
Video Preview
For full features & functions, refer to Main Thread here . . .

Credits
Phil3759
Michfood
suhas.holla
shoxxy
Last but not least, my Master Shifu Carliv who has taught me how to compile & continuously guiding me to the right direction & also many DEVs that shared & published their findings on the World Wide Web on various subject . . . . . .

Updated Credits - Added support for MTK big.LITTLE & Cortex-A53
Huge Credits to . . .
Russian Master Shifu Javum
Master Shifu Carliv

Huge Thanks to Xpeca1 for confirming all the porting tool features & functions is working correctly on his Cortex-A53 & not forgetting NiksSkersts too . . .

This updates has the most beta-tester, never the less, thanks for all their contributions too . . .

XDA:DevDB Information
Easy Magic PhilZ Touch Installer for MediaTek Devices ONLY (Developers ONLY), Tool/Utility for all devices (see above for details)

Contributors
yuweng
Source Code: https://github.com/PhilZ-cwm6/philz_touch_cwm6


Version Information
Status: Stable
Current Stable Version: Final Release 6.59.0
Stable Release Date: 2015-03-09

Created 2014-05-11
Last Updated 2015-04-09
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	752350
Size:	75.1 KB
ID:	3215395   Click image for larger version

Name:	2.png
Views:	562414
Size:	71.7 KB
ID:	3215396   Click image for larger version

Name:	3.png
Views:	560190
Size:	68.7 KB
ID:	3215397   Click image for larger version

Name:	4.png
Views:	558428
Size:	97.9 KB
ID:	3215398  
The Following 118 Users Say Thank You to yuweng For This Useful Post: [ View ] Gift yuweng Ad-Free
 
 
11th May 2014, 04:54 PM |#2  
yuweng's Avatar
OP Senior Member
Thanks Meter: 3,965
 
More
Terms & Conditions of Use

Quote:
Originally Posted by codeworkx

DEAR KANGERS
If you're going to reuse our work, which we're doing for free, be fair and give proper credits.
This is the only payment we're really demanding and we deserve it to be mentioned because of the countless hours we've put into this project.
Open-Source doesn't meant Out-of-Respect!!!

Thanks to all contributors!!!

As Master Shifu codeworkx says, the same applies here . . .

All i'm asking is for you to give proper credits to me & the DEVs that i mentioned on the porting tool, without them sharing, this porting tool wouldn't have exists !

i have seen many that took my work, got a ported working PhilZ Touch on their MTKs & shared it directly even here on XDA ! while some at other forum threads BUT not a single word mentioning this thread, me or the porting tool or the DEVs that has contributed to this project . . .

Many just make a new thread with the ported PhilZ Touch & shared it with their followers, fooling their followers by not mentioning credits so that their followers thinking that the ported PhilZ Touch is built from source & is their own work, collected all the Thanks & that will make them look cool while some even solicit for Donations !

Anyone can just download this porting tool, run the exe & they will get a ported PhilZ Touch on their MTK, what is so cool about that . . .

Do you know how many hours i have put into this, not mentioned is the time studying & building PhilZ Touch from source, PC hardware upgrading, broadband fee, electricity fee, time to study & building this porting tool exe & i'm sharing this all for FOC & i don't solicit for Donations or Thanks in return, i don't even post my Donate button . . .

If you wanna start a new thread to support specific MTK devices with the ported PhilZ Touch, i have absolutely no problem with that, it will be your responsibility to response & provide support to your followers but pls give proper credits . . .

If you think this porting tool is too complicated & you would wanna start a new thread/ guide/ video or whatever either here or else where, again i have absolutely no problem with that BUT pls pls don't mirror the porting tool. i'm sure you have seen this all the time at XDA here by other DEVs, the logic is very simple, when you mirror the files, there is no way of tracking which version has bugs. Most importantly, i need direct feedback from users & when you mirror the files, your followers will download that version from your link & they complain & feedback to you but you won't be able to fix it so pls put a link direct to this thread so that i can improve on this porting tool.

If you wanna post this porting tool on your blog, website or anything at all, again i have absolutely no problem with that BUT again post a link directly to this thread so that users can always post a bug report here & they will always get the new, bug free porting tool as i will fix it when i receive bug report.

Credits mentioning & redirecting link to original threads won't make you low standard, in fact your followers will be thanking you for sharing with them a great new tool that you found. Credits mentioning & redirecting link to original threads also means that you give respect & honor the original DEVs of the tool, this would also enable feedbacks on new ideas, new features & improvement of that particular tool too.

If you are a company then pls get my permission first or the least you can do is Donate to Phil3759 for a job well done & if you are an end user, you are also encourage to do so too, fyi, i did . . .
Features

Auto mode
- You don't need to know a thing & it'll port a working PhilZ Touch for your MTK & that is why it is called Magic . . .

Manual mode
- Let you choose either to use your boot.img or recovery.img for porting.
- Let you manually choose your device res, MTK fixes, Flip screen/ Flip Touch, different font size & uses all files from your stock recovery when using recovery.img. For boot.img porting, this tool will only use its kernel only. Refer to here for more info . . .
- device resolutions
- flipped screen

UnPack/ RePack mode
- Let you mod whatever you want with option to install it right away to your MTK

Requirement
- Requires Root
- Install adb driver
- Enable USB debugging
- Disable UAC
- Disable driver signature
- Works from Gingerbread to Lollipop but NOT on encrypted data partition on Lollipop but why you enable it back ?
- No need ro.secure=0 to run
recovery.fstab How-to


Preface
As mentioned few times, i don't own all the MTK devices available on the market so a few things might not work on your MTK. So use the UnPack/ RePack mode to edit necessary files typically the init.rc & recovery.fstab.

UnPack other MTK PhilZ Touch by other DEVs & see how they did it.

As mentioned few times, the porting tool now is AIO so go ahead & play with it.

Intro
What is recovery.fstab

The actual require backup partition for MTKs or any android devices are actually ONLY just the boot, cache, data & system partition.

When you encounter any problems such as doesn't boot/ bootloop issues after a new app installation or anything at all, a Wipe Data/ Factory Reset or Restore with ONLY the system & data partition & you'll be able to revert to previous working state in a short while. Thats why its very important to make a backup before modding anything at all !

For bootloop issues with new firmware installation (update.zip) then its best to restore everything. Having said that, if you flash preloader using SP Flash Tool then PhilZ Touch restore would not be able to restore it or for that matter, your device wouldn't even be able to boot at all (brick), thats why it is important to backup your Factory ROM with MTK Droid Root & Tools first.

For latest MTK armv8
Since the latest MTK armv8 is using direct device path, below is possible as i've seen it on msm devices but personally i think it is unnecessary to have those partition backed up as it will take alot of space & typically you only brick the system or data partition but then again, that is entirely up to you on what you wanna backup. Below example is taken from Master Shifu Carliv github, added all various armv8 devices direct device path partition for reference. To find out the actual MTK armv8 partition info on your device, use the command adb shell cat /proc/partinfo & adb shell ls -al /dev/block/platform/mtk-msdc.0/by-name
Code:
# 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/block/platform/mtk-msdc.0/by-name/boot      /boot      emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/nvram     /nvram     emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/flashinfo /flashinfo emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/expdb     /expdb     emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/recovery  /recovery  emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/secro     /secro     ext4 relatime wait,check
/dev/block/platform/mtk-msdc.0/by-name/seccfg    /seccfg    emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/proinfo   /proinfo   emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/para      /para      emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/logo      /logo      emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/tee1      /tee1      emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/tee2      /tee2      emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/otp       /otp       emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/lk        /lk        emmc defaults defaults
/dev/block/platform/mtk-msdc.0/by-name/system    /system    ext4 ro,noatime wait
/dev/block/platform/mtk-msdc.0/by-name/preload   /preload   ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check
/dev/block/platform/mtk-msdc.0/by-name/cache     /cache     ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check
/dev/block/platform/mtk-msdc.0/by-name/userdata  /data      ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,resize,encryptable=/dev/block/platform/mtk-msdc.0/by-name/metadata
/dev/block/platform/mtk-msdc.0/by-name/protect1  /protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,autoformat
/dev/block/platform/mtk-msdc.0/by-name/protect2  /protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,autoformat
/dev/block/platform/mtk-msdc.0/by-name/persist   /persist   ext4 relatime wait,check
/dev/block/platform/mtk-msdc.0/by-name/custom    /custom    ext4 relatime wait,check

/devices/mtk-msdc.0/11240000.MSDC1/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto
To manually make a SP Flash Tool backup of your MTK armv8 Factory ROM then refer to here & you can also use the following empty cache secro userdata since a Factory Reset/ Wipe Data will wipe data partition anyway.

Updates
Refer to here & here for custom partition backup/ restore on armv8 Thanks to Katinatez . . . :good:

Refer to this the only lead shared by BachMinuetInG . . . :good:

Aroma File Manager
It is a known problem that aromafm will not to work properly on flip-screen, this is not a PhilZ Touch problem as it has never been updated for almost a year.

Flip Screen/ Flip Touch/ Font size

It is a known problem that MTK manufacturer uses non-standard design & uses different Flip Screen/ Non-Flip LCD with different combinations of Flip/ Non-Flip Touch Screen on various Portrait & especially Landscape Android devices.

There is absolutely no way that the porting tool could detect whether your MTK's Touch is FlipX or FlipY or SwapXY so i build all possible combinations into the porting tool -> Manual-mode -> Try all combinations one at a time until one that works for your device.

Typical Flip Screen device then choose either Flip Screen Only or Flip Screen FlipX-FlipY. For Landscape devices (tabs), typically is SwapXY FlipY.

As said, i don't own all MTK devices so i donno which font size is suitable for your device so again, you'll need to play around with the different selection. Below are available fonts as demonstrated on my 480x854 res . . .

Click image for larger version

Name:	font_7x16.png
Views:	2190
Size:	69.8 KB
ID:	3215484 Click image for larger version

Name:	font_10x18.png
Views:	2198
Size:	75.2 KB
ID:	3215485 Click image for larger version

Name:	courier_extended_15x24.png
Views:	2152
Size:	75.4 KB
ID:	3215486 Click image for larger version

Name:	roboto_10x18.png
Views:	2056
Size:	73.3 KB
ID:	3215502 Click image for larger version

Name:	roboto_15x24.png
Views:	2016
Size:	75.2 KB
ID:	3215487 Click image for larger version

Name:	roboto_23x41.png
Views:	2006
Size:	72.0 KB
ID:	3215488 Click image for larger version

Name:	fonten55_33x84.png
Views:	2032
Size:	76.1 KB
ID:	3215490
Bug report <- No support if you don't attach it to your post.

Please always attach recovery.log & log.txt from the porting tool or i'll be giving the wrong advice based on assumption & that might brick your device !

How to obtain recovery log
  1. adb pull /tmp/recovery.log -> Attach to your post
  2. At PhilZ Touch -> Advanced Functions -> Report Error -> Copy log from /sdcard/clockworkmod/philz_recovery.log -> Attach to your post

If you don't see me replying means either the answer is already at this thread so start reading every page, its not like there are 100 over pages, as of 18 March 2015, there are only 14 pages . . .

The 2nd reason you don't see me replying is i donno the answer then head up to PhilZ Touch development thread & get help from Phil3759 directly . . .
Questions & Answers

Q : Your tool doesn't work.
A : Its already explained at the OP, pls read EVERYTHING at Page 1 !

Q : I can't get adb to work on my PC.
A : Then get one of your device forum DEV to look at this porting tool.

Q : I have a MTK model xxx SoC YYY, does your porting tool support it.
A : The title already said it, for all MediaTek Devices ONLY

Q : I have a MTK but i'm afraid the porting tool would brick my device.
A : Then don't use it ! Its for Developers ONLY !

Q : OP said DO NOT USE IT ON LOCKED BOOTLOADER but the link doesn't say much for MTK devices.
A : There isn't any guide to identify locked bootloader on MTKs, generally you'll have to flash the recovery.img to find out whether it bricks ! However, farenheith has confirmed by flashing back the original stock 3e recovery.img & his locked bootloader MTK Motorola boots back !

To check your bootloader
Code:
adb reboot-bootloader or adb reboot bootloader or adb reboot fastboot
fastboot getvar all
Code:
(bootloader)  unlocked: NO
To unlock it, use below command.
Code:
fastboot oem unlock
Source

As explained BRANDED at the OP, UNBRANDED MTKs are generally MTKs directly from China, have unlock bootloaders.

Updates
MTK armv7/ armv8 LP refer to this workaround, make sure to unlock your bootloader first !

List of supported MTK devices . . .
The Following 44 Users Say Thank You to yuweng For This Useful Post: [ View ] Gift yuweng Ad-Free
11th May 2014, 04:54 PM |#3  
yuweng's Avatar
OP Senior Member
Thanks Meter: 3,965
 
More
Installation
Installation How-to

Where is the Downloads . . .

WARNING

Even though wrong installation of custom recovery normally will bricks the recovery only however it is better to be safe than sorry.

PhilZ Touch is packed with many features so typically it will work on MTK devices with above 6Mb recovery partition however you can try your luck.

Tested working perfectly on my legacy MTK device, MT6573 & MT6577.
  1. Make a Factory ROM backup first with MTK Droid Tools. My old guide here.
  2. Install Flashify & make another backup of your current recovery first & also the boot.img too
  3. Extract, double-click PhilZ Setup & follow the on-screen for instructions.
YOUR TOOL DOESN'T WORK . . .
i've seen this at many threads & also mentioned this many times at my other threads, most frequent reply is it doesn't work, you have given nothing at all to figure out what went wrong . . .

Please list out as many info as possible then it'll be easier to trouble-shoot & read EVERYTHING before hands-on, fyi, tested working on XP to Win10 Technical Preview . . .
  1. What OS you are using on the PC & your MTK...
  2. Did you disable UAC & Anti-Virus
  3. Did you execute the porting tool at C: drive if you're using XP else then at your Desktop
  4. Did you try Run as Administrator
  5. Could it be some other software that you installed that interfere with the porting tool then uninstall it
  6. Did you try it on other PC with other version OS or even different USB port
  7. Try uninstall all previous adb driver -> Device Manager -> View -> Show hidden devices -> uninstall all ADB Interface/ Android device -> reboot -> re-install. Refer to screenshot -> Attachment 3018860
  8. Did you try latest google ADB driver while for XP try this one
The Following 15 Users Say Thank You to yuweng For This Useful Post: [ View ] Gift yuweng Ad-Free
11th May 2014, 04:55 PM |#4  
yuweng's Avatar
OP Senior Member
Thanks Meter: 3,965
 
More
Known problems on MTK devices
Known problems on MTK devices

E: failed to mount /cache
  • Mostly older intermediate MediaTek devices such as MT6589, MT6572 that comes with only 6Mb recovery partition, most probably won't work. However, it works on my legacy MT6573, MT6577 because its kernel is much smaller. There has been feedback from fellow xda members that some latter MediaTek devices comes with 7Mb & 8Mb. Latest MT6592 has a recovery partition of more than 8Mb.
  • PhilZ Touch does not support ubifs
  • PhilZ Touch does not support MTK Alcatel devices with /custpack partition. Added support at beta version
  • Haven't identify latest voldmanaged mount points for Internal SD that uses /storage/usbdisk voldmanaged=usbdisk:auto so it won't mount Internal SD on such layouts. Thanks to adhamamar for sharing the solution.
  • In the past, there has been reports that Touch doesn't work at recovery on some MTK devices, try using different releases of kernels from your device. Recovery is independent so GB, ICS or JB kernel will work provided they are from your device.
  • Thanks to shoxxy for the tip, flip screen works on PhilZ Touch with added Flip screen flag. However, it has a small glitches that is the screen will flashes & flip upside down when using the virtual keys. Since Touch is fully working either don't use the virtual keys or just disable it permanently. PhilZ Settings -> GUI Preferences -> Toggle Virtual Keys

    Updates
    Fixed flip screen flickering, Thanks to Teamwin updated flip screen codes . . .
  • # Even though the MTK SoC is designed by MediaTek but the one that produces it is hundreds if not thousands of factories so some might use other combinations to boot up the recovery. It is a known problem that some MTK doesn't wanna boot up PhilZ Touch the normal way so try Popey900 technique. Standard procedure : Take out the battery, wait a while, put it back, hold Volume Up or Down, don't let go then press the Power button until it boots up PhilZ Touch #
  • Do not try this on lock bootloader MTK devices as there has been confirmed cases that it will brick it, refer to here for more info.
---------------------------------------
This tool will auto-install Aroma FileManager & it is a known problem on some MTK devices that Aroma FileManager refuses to start & complains about E:Can't make /tmp/update_binary -> Installation aborted . . .

On Flip screen MTK device, Aromafm will always be flipped & the answer is here

Work around - Built-in to porting tool
  1. Use the Auto mode first & it will auto make a backup of your current recovery.
  2. Pull out the USB cable & use the Manual mode, copy recovery.img from BackUp-MTK-Recovery folder to Stock & it will ask you to plug-in the USB to PC.
  3. Now open Stock/recovery/rmdisk/init.rc with Notepad++ & add the line as below & save it.
  4. Plug-in USB cable to PC, press OK, select your device res & it'll auto install it.
    Code:
        mkdir /emmc
        mkdir /system
        mkdir /data
        mkdir /cache
        mkdir /tmp  <- add this line to init.rc
        mount tmpfs tmpfs /tmp
    
        chown root shell /tmp
        chmod 0775 /tmp
  5. Aroma FileManager shall work now.
---------------------------------------
On my friend's old ICS 4.0.4 MT6577 with 480x854 res, ported PhilZ Touch doesn't boot & later i found out its something to do with the kernel not supporting PhilZ res more than 320x480.


Work around - Built-in to porting tool
  1. At Windows Explorer -> Show Hidden Files & Folders -> MTK_PhilZ -> bin -> extract out 240x320_bg.png from res.7z, rename it to stitch.png
  2. Plug-in the USB cable & use the manual mode, select your device res & it will ask whether you have flipped screen.
  3. Copy & paste extracted 240x320 stitch.png to Stock/recovery/rmdisk/res/images folder to replace it & answer the flipped screen question
  4. At PhilZ Settings -> GUI Preferences -> Change Background -> Reset Koush Background



The Following 27 Users Say Thank You to yuweng For This Useful Post: [ View ] Gift yuweng Ad-Free
11th May 2014, 04:56 PM |#5  
yuweng's Avatar
OP Senior Member
Thanks Meter: 3,965
 
More
Trouble-shooting
Trouble-shooting the mount USB storage
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. . .
i don't own every MediaTek devices out there so most probably some will not mount USB storage for both of the storage while at recovery b'cos of different voldmanaged path.

Updates - Built-in to porting tool
Refer to below on how to identify it & correct this problem.
Open a new Notepad & save the below to MTK_PhilZ folder for unpack/ repack of ported PhilZ Touch recovery.img.

MTK_unpack.bat
Code:
@echo off
cd %~dp0
chcp 1251
if (%1)==() (
	echo Select image
		goto end
)

setlocal enabledelayedexpansion
COLOR 0A
mode con:cols=65 lines=31
bin\sfk166.exe hexfind %1 -pat -bin /88168858/ -case >bin\offset.txt
bin\sfk166.exe hexfind %1 -pat -bin /FFFFFFFF1F8B08/ -case >>bin\offset.txt 
bin\sfk166.exe find bin\offset.txt -pat offset>bin\off2.txt
bin\sfk166.exe replace bin\off2.txt -binary /20/0A/ -yes

if exist %~N1 rd /s /q %~N1 >nul

set /A N=0
:loop
FOR /F %%G IN (bin\off2.txt) DO (
	if !N!==1 (
		set /A ofs1=%%G
		set /A N+=1
	)
	if !N!==3 (
		set /A ofs2=%%G
		set /A N+=1
	)
	if !N!==5 (
		set /A ofs3=%%G+4
		set /A N+=1
	)	
	if `%%G` EQU `offset` (
		set /A N+=1
	)
)
FOR %%i IN (%1) DO ( set /A boot_size=%%~Zi )
echo.
echo - size of %1 %boot_size% byte
echo - kernel offset     - %ofs1%
echo - ram_header offset - %ofs2%
echo - ram_disk offset   - %ofs3%
echo.

del bin\offset.txt
del bin\off2.txt
md %~N1
echo - extracting kernel_header...
bin\sfk166.exe partcopy %1 -fromto 0x0 %ofs1% %~N1\kernel_header -yes
echo - extracting kernel...
bin\sfk166.exe partcopy %1 -fromto %ofs1% %ofs2% %~N1\kernel -yes
echo - extracting ram_header...
bin\sfk166.exe partcopy %1 -fromto %ofs2% %ofs3% %~N1\ram_header -yes
echo - extracting ram_disk...
bin\sfk166.exe partcopy %1 -fromto %ofs3% %boot_size% %~N1\ram_disk.gz -yes

echo - unpack ram_disk.gz...

bin\7za.exe -tgzip x -y %~N1\ram_disk.gz -o%~N1 >nul
echo - unpack ram_disk.cpio...

md %~N1\rmdisk
cd %~N1
cd rmdisk
%~dp0bin\cpio.exe -i <../ram_disk
cd ..
cd ..

copy %1 %~N1 
echo.
echo - Done ^^!
echo.
pause
:end
MTK_pack.bat
Code:
@echo off
cd %~dp0
chcp 1251
if (%1)==() (
	echo Select folder
	goto end
)
setlocal enabledelayedexpansion
COLOR 0A
mode con:cols=60 lines=39
set pt=%~N1%~X1
echo %pt%
copy %pt%\ram_header %~N1\new_ram_with_header >nul
cd %pt%
%~dp0bin\chmod og=xr rmdisk
cd rmdisk

echo - pack rmdisk to cpio...
%~dp0bin\find . | %~dp0bin\cpio.exe -o -H newc -F ../new_ram_disk.cpio >nul
move ..\ram_disk ..\ram_disk_old >nul
copy ..\new_ram_disk.cpio ..\ram_disk
echo - pack rmdisk to gzip...
%~dp0bin\gzip -n -f ../ram_disk
echo - add header...
%~dp0bin\dd if=../ram_disk.gz >> ../new_ram_with_header
FOR %%i IN (../ram_disk.gz) DO ( set /A size=%%~Zi )
echo - new ramdisk %size% byte
%~dp0bin\sfk166 hex %size% -digits=8 >../../size.txt
FOR %%i IN (../../size.txt) DO ( set /A size=%%~Zi )
%~dp0bin\sfk166 split 1 ../../size.txt ../../1 >nul
FOR /F  %%i IN (../../1.part7) DO (set a1=%%i)
FOR /F  %%i IN (../../1.part8) DO (set a2=%%i)

FOR /F  %%i IN (../../1.part5) DO (set a3=%%i)
FOR /F  %%i IN (../../1.part6) DO (set a4=%%i)

FOR /F  %%i IN (../../1.part3) DO (set a5=%%i)
FOR /F  %%i IN (../../1.part4) DO (set a6=%%i)

FOR /F  %%i IN (../../1.part1) DO (set a7=%%i)
FOR /F  %%i IN (../../1.part2) DO (set a8=%%i)
echo %a7%%a8%>size.txt
echo %a5%%a6%>>size.txt
echo %a3%%a4%>>size.txt
echo %a1%%a2%>>size.txt
echo - add new size in header 0x%a1%%a2% 0x%a3%%a4% 0x%a5%%a6% 0x%a7%%a8%
%~dp0bin\sfk166.exe echo %a1%%a2% %a3%%a4% %a5%%a6% %a7%%a8% +hextobin ../../tmp1.dat
%~dp0bin\sfk166.exe partcopy ../../tmp1.dat 0 4 ../new_ram_with_header 4 -yes>nul

echo - make image...
%~dp0bin\mkbootimg.exe --kernel ../kernel --ramdisk ../new_ram_with_header -o ../new_image.img 
del size.txt >nul
copy ..\new_image.img %~dp0\new_image.img
move ..\ram_disk_old ..\ram_disk >nul
cd ..
cd ..
del size.txt >nul
del tmp1.dat>nul
del 1.part*>nul

echo.
echo - Done ^^!
echo.
pause
:end
Just Drag&Drop ported PhilZ Touch recovery.img to MTK_unpack.bat to unpack it & Drag&Drop unpack recovery folder to MTK_pack.bat to repack it back. Disable UAC first.

Or you can also download the original Boot/Recovery repack utils for WINDOWS to unpack/ repack the ported PhilZ Touch recovery. Basically it operates exactly the same except for this porting tool, it is using the standalone 7za.exe instead of 7z.exe that requires the 7z.dll to operate.


Huge Credits to Russian Master Shifu Michfood for sharing his unpack/ repack MTK boot/ recovery algorithm or this porting tool would not have exists & you will have do all this on a NIX box . . .

recovery.fstab for MT65xx
Code:
# 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:6 
/devices/platform/mtk-sd.1/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto
Code:
# For MT65xx
/devices/platform/mtk-msdc.0/mmc_host/mmc0 auto auto defaults voldmanaged=sdcard0:6 
/devices/platform/mtk-msdc.1/mmc_host/mmc1 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 . . .

Update it to fstab.${ro.hardware} too.

The correct way to check ${ro.hardware} -> adb shell getprop ro.hardware -> mt6577 then it should be rename to fstab.mt6577
------------------------------------------------
Updates - Built-in to porting tool
Some MTK don't use fat mount points for Internal sdcard then this tool will fail to identify it & ported PhilZ Touch will not boot/ bootloop . . .

Code:
/devices/platform/mtk-msdc.0/mmc_host/mmc0 auto auto defaults voldmanaged=sdcard0:    <- Empty
/devices/platform/mtk-msdc.1/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto
Solution - Put a # at the beginning of that line or just delete it & it'll boot . . .

Code:
#/devices/platform/mtk-msdc.0/mmc_host/mmc0 auto auto defaults voldmanaged=sdcard0:    <- Empty
/devices/platform/mtk-msdc.1/mmc_host/mmc1 auto auto defaults voldmanaged=sdcard1:auto

------------------------------------------------

To identify USB voldmanaged mount points for Internal SD -> adb shell su -c "ls -R" > c:\users\YOUR USER NAME\desktop\usb.txt

Look for anything usb in it & try it at the fstab.${ro.hardware} & also update it to recovery.fstab too. Both must be identical or it will not work.

An example below, confirmed by shoxxy that can be view at PhilZ Touch -> Install Zip but doesn't mount it at mount USB storage.

Code:
/devices/platform/mt_usb/usb1 auto auto defaults voldmanaged=usbdisk:auto
Also look for various example here on voldmanaged for USB storage & hopefully someone will get it working one day.

if yours is a /data/media device then it would not work . . .

Refer to here credits to RD chrmhoffmann
As mentioned many times, i don't own all MTK devices out there so some features might not work. To fix it & to learn more about modding recovery refer to my Master Shifu thread here & here . . .

When everything fails then try your hands on building one yourself with the optional build flags here for your MTK . . .
The Following 27 Users Say Thank You to yuweng For This Useful Post: [ View ] Gift yuweng Ad-Free
11th May 2014, 06:23 PM |#6  
Senior Member
Flag New Delhi
Thanks Meter: 65
 
More
This is awesome man....
The Following 5 Users Say Thank You to Gauraav For This Useful Post: [ View ] Gift Gauraav Ad-Free
12th May 2014, 01:23 PM |#7  
suhas.holla's Avatar
Recognized Contributor
Flag Bangalore
Thanks Meter: 1,420
 
Donate to Me
More
Yeah...Finally a support thread of philz touch for mediatek devices ...Great initiative by master @yuweng for bringing simple tool to install philz touch on many mediatek devices

Sent from my A250 using Tapatalk
The Following 5 Users Say Thank You to suhas.holla For This Useful Post: [ View ] Gift suhas.holla Ad-Free
12th May 2014, 04:23 PM |#8  
Popey900's Avatar
Member
Thanks Meter: 3
 
More
Hi there. Does it work with the Jiayu G5S ?

Is there a simple guide?


Gesendet von meinem JY-G5S mit Tapatalk
The Following User Says Thank You to Popey900 For This Useful Post: [ View ] Gift Popey900 Ad-Free
13th May 2014, 02:50 AM |#9  
yuweng's Avatar
OP Senior Member
Thanks Meter: 3,965
 
More
Bro, everything is already stated clearly at post #1 to 5, make backup x3, double-click PhilZ.exe & follow on-screen instructions, that's the guide . . .
The Following 11 Users Say Thank You to yuweng For This Useful Post: [ View ] Gift yuweng Ad-Free
13th May 2014, 06:00 AM |#10  
Member
Flag Banglore
Thanks Meter: 68
 
More
manual porting ?
SIR Thanks a lot for creating the tool

BTW I tried on my mt6577 in both the ways but it says recovery.img is too large and it is aborting

my question is How to do manual porting for this recovery as we did for carliv touch recovery ( i tried to merge the A9,7z with my ramdisk but it didnt worked)

so pls assist me Sir
Attached Thumbnails
Click image for larger version

Name:	err.png
Views:	1836
Size:	15.3 KB
ID:	2740844  
The Following 2 Users Say Thank You to pavan kr For This Useful Post: [ View ] Gift pavan kr Ad-Free
13th May 2014, 09:34 AM |#11  
yuweng's Avatar
OP Senior Member
Thanks Meter: 3,965
 
More
Updates - Built-in to porting tool

Temporary work around is to use the same technique at post #3 most bottom . . . When ask whether you have flipped screen, that is the time to delete the files. Binary files at Stock/recovery/rmdisk/sbin as listed below are safe to be deleted to save some space. List below starts with less critical to critical & i have absolutely no idea what will happened in the long run but definitely it'll boots.

Most of them are utilities for formatting the sdcard while at recovery. Try one at a time starting with Item 1, if still it complains about oversize then delete 1+2 , 1+2+3 & so on until it auto-install . . .
  1. Parted
  2. sdparted
  3. fb2png
  4. mount.exfat
  5. adbd
  6. e2fsck & tune2fs

Updates
You can also try tinypng.com the tips from EnerJon to resize all images at Stock\recovery\rmdisk\res\images to a much smaller size that might just be enough for it to boot PhilZ Touch on your MTK . . .
--------------------------------
Refer to updates of the updates here . . .
The Following 11 Users Say Thank You to yuweng For This Useful Post: [ View ] Gift yuweng Ad-Free
Post Reply Subscribe to Thread

Tags
mediatek, mtk, philz touch, porting tool, recovery
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes