Easy Magic TWRP Installer for all MediaTek Devices ONLY (Developers ONLY) - Miscellaneous Android Development

Credits
TWRP Lead Developer Dees_Troy for continuously developing, improving & maintaining TWRP, TeamWin team & numerous developers that has contributed to TWRP & many doesn't know its Igor Sorocean initially submitted MrJavum codes so that TWRP officially supports MediaTek devices & most importantly MrJavum for discovering TWRP works on MediaTek devices & written codes to support proper backup formatting for MTK device . . .
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This tool uses EnJens for repack based on the original Unpack/ Repack concept by Russian Master Shifu Michfood . . .
Not forgetting my Master Shifu Carliv who has taught me how to compile & continuously guiding me to the right direction, dhinesh77 for sharing his super simple technique to patch ubifs for TWRP, awaaas for sharing his tips & findings for building TWRP from source for MTK devices ( Updates ), cyberangel22k for beta-testing custpack backup/restore on MTK Alcatel, yazidkucrit for discovering that TWRP also works on MT6573 & all MTK Developers that has contributed to the MTK platform . . . :highfive:
Screenshot
Video Preview
Installation How-to
Double-click TWRP Setup.exe & read the on-screen instructions
Where is the Downloads . . .
Known problems on MTK devices
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.
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. If you don't have different kernels from your device manufacturer either live without Touch or try porting other recovery, it might work.
This TWRP was compiled from source without adding any sauce or spice & it works for most MTK devices. However, if the mount USB doesn't work then refer to a.marduk solution . . . :good:
# 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 recovery 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 #
WARNING
DO NOT USE IT ON LOCKED BOOTLOADER MTK DEVICES SUCH AS ASUS, HTC, LG, SONY, MOTOROLA & OTHERS <- Click Here. IT WILL BRICK IT, refer to here for more info . . .
Even though wrong installation of custom recovery normally will bricks the recovery only however it is better to be safe than sorry.
TWRP 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.
Make a Factory ROM backup first with MTK Droid Tools. My old guide here.
Install Flashify & make another backup of your current recovery first & also the boot.img too
Extract downloaded files to your Desktop, disable UAC & restart PC, double-click TWRP.exe & 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 . . .
What OS you are using on the PC & your MTK...
Did you disable UAC & Anti-Virus
Did you execute the porting tool at C: drive if you're using XP else then at your Desktop
Did you try Run as Administrator
Could it be some other software that you installed that interfere with the porting tool then uninstall it
Did you try it on other PC with other version OS or even different USB port
Try uninstall all previous adb driver -> Device Manager -> View -> Show hidden devices -> uninstall all ADB Interface/ Android device -> reboot -> re-install
Did you try latest google ADB driver while for XP try this one
Attach both log.txt from porting tool & recovery.log from TWRP, attach also stock recovery.img/ boot.img & ported TWRP recovery.img too so that i can compare it to see where it went wrong
Please bear in mind that this tool has been PROVEN to work & many has ported it to their MTK device so try to do you own trouble-shooting first & when you found the solution then you are most welcome to post it here . . . :good:
And if you do found a bug on this porting tool, please do report it here too so that i can fix it . . .
And pls do not quote the whole OP when replying . . .
Updates 03 July 2014
Great news, TWRP ubifs patch has been officially submitted to omni for review . . .
Attention all MTK ubifs users,
Guys, please hit the thanks button for dhinesh77 to show your gratitude & appreciation, he has taken all the trouble to get ubifs officially supported on TWRP even though he uses a Samsung nowadays . . .
Thanks bro for doing all this & going thru the hassle for the whole MTK ubifs community, you're the best . . . :highfive:
i've released AIO Compile TWRP script for MediaTek devices on BBQLinux so that you can build it on your own since i don't use MTK nowadays...
Changelog
XDA:DevDB Information
Easy Magic TWRP Installer for MediaTek Devices ONLY (Developers ONLY), Tool/Utility for all devices (see above for details)
Contributors
yuweng
Source Code: https://github.com/omnirom/android_bootable_recovery
Version Information
Status: Stable
Current Stable Version: 2.8.2.0
Stable Release Date: 2014-12-07
Created 2014-06-28
Last Updated 2016-03-27

Features
Auto mode
- You don't need to know a thing & it'll port a working TWRP 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, data/media device, flipped screen & uses all files from your stock recovery. Refer to here for more info . . .
- device resolutions
- data/media
- 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
- Compatibility with KitKat
- No need ro.secure=0 to run
recovery.fstab How-to
Updates
This porting tool is build on jellybean repo so that it can support three generation of MTK SoC with non-device specific build flags to maintain compatibility. Below specific build flags are not use & it seem that the 2.8.1.0 porting tool doesn't work across MTK device. However, fyi, it works fine on mine
TW_INTERNAL_STORAGE_PATH := "/data/media"
TW_INTERNAL_STORAGE_MOUNT_POINT := "data"
TW_EXTERNAL_STORAGE_PATH := "/sdcard"
TW_EXTERNAL_STORAGE_MOUNT_POINT := "sdcard"
TW_INTERNAL_STORAGE_PATH := "/emmc"
TW_INTERNAL_STORAGE_MOUNT_POINT := "emmc"
TW_EXTERNAL_STORAGE_PATH := "/sdcard"
TW_EXTERNAL_STORAGE_MOUNT_POINT := "sdcard"
SP1_NAME := "uboot"
SP1_DISPLAY_NAME := "uboot"
SP1_BACKUP_METHOD := image
SP1_MOUNTABLE := 0
SP2_NAME := "nvram"
SP2_DISPLAY_NAME := "nvram"
SP2_BACKUP_METHOD := image
SP2_MOUNTABLE := 0
SP3_NAME := "custpack"
SP3_DISPLAY_NAME := "custpack"
SP3_BACKUP_METHOD := image
SP3_MOUNTABLE := 0
So pls refer to here <- *RECOVERY.FSTAB* to use the different flags to properly support your MTK device.
With non-device specific build flags, compatibility can be maintained across MTK SoC, you only need to mod the recovery.fstab. Having said that, i need users feedback so that i can incorporate those changes or this porting tool will remain as it is on every new release.
It seems that you need to label Sdcard as Internal Storage or External Storage to properly support proper BackUp/ Restore function. Refer to here for more info . . .
TTF font is also disable to maintain compatibility across MTK SoC.
-------------------------------------------
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 TWRP by other DEVs & see how they did it.
google your device info & search github & see how they did it, Eg. here for USB-OTG Thanks to hehua2008 the only one that published/ i can find for MTK TWRP.
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 TWRP restore would not be able to restore it, thats why it is important to backup your Factory ROM with MTK Droid Root & Tools first.
How to identify MTK partition
WARNING : Might corrupt or brick your MTK when you specify the wrong partition at recovery.fstab ! You have been fore-warned . . .
adb shell cat /proc/dumchar_info OR adb shell cat /proc/mtd
Below are typical MTK partition layout
Code:
Part_Name Size StartAddr Type MapTo
preloader 0x0000000000040000 0x0000000000000000 2 /dev/misc-sd
dsp_bl 0x00000000005c0000 0x0000000000040000 2 /dev/misc-sd
mbr 0x0000000000004000 0x0000000000000000 2 /dev/block/mmcblk0
ebr1 0x0000000000004000 0x0000000000004000 2 /dev/block/mmcblk0p1
pmt 0x0000000000400000 0x0000000000008000 2 /dev/block/mmcblk0
[COLOR="Blue"]nvram[/COLOR] 0x0000000000500000 0x0000000000408000 2 /dev/block/mmcblk0
seccfg 0x0000000000020000 0x0000000000908000 2 /dev/block/mmcblk0
[COLOR="blue"]uboot[/COLOR] 0x0000000000060000 0x0000000000928000 2 /dev/block/mmcblk0
bootimg 0x0000000000600000 0x0000000000988000 2 /dev/block/mmcblk0
recovery 0x0000000000800000 0x0000000000f88000 2 /dev/block/mmcblk0
sec_ro 0x0000000000400000 0x0000000001788000 2 /dev/block/mmcblk0p2
misc 0x0000000000060000 0x0000000001b88000 2 /dev/block/mmcblk0
logo 0x0000000000300000 0x0000000001be8000 2 /dev/block/mmcblk0
expdb 0x0000000000200000 0x0000000001ee8000 2 /dev/block/mmcblk0
android 0x0000000020100000 0x00000000020e8000 2 /dev/block/mmcblk0p[COLOR="blue"]3[/COLOR]
cache 0x0000000020100000 0x00000000221e8000 2 /dev/block/mmcblk0p[COLOR="blue"]4[/COLOR]
usrdata 0x0000000020100000 0x00000000422e8000 2 /dev/block/mmcblk0p[COLOR="blue"]5[/COLOR]
fat 0x0000000085338000 0x00000000623e8000 2 /dev/block/mmcblk0p[COLOR="blue"]6[/COLOR]
bmtpool 0x0000000001500000 0x00000000ff9f00a8 2 /dev/block/mmcblk0
Part_Name:Partition name you should open;
Size:size of partition
StartAddr:Start Address of partition;
Type:Type of partition(MTD=1,EMMC=2)
MapTo:actual device you operate
Standard TWRP recovery.fstab for MTK devices
Code:
# mount point fstype device [device2]
/boot emmc /dev/bootimg
/recovery emmc /dev/recovery
/system ext4 /dev/block/mmcblk0p[COLOR="Blue"]3[/COLOR]
/cache ext4 /dev/block/mmcblk0p[COLOR="blue"]4[/COLOR]
/data ext4 /dev/block/mmcblk0p[COLOR="blue"]5[/COLOR]
/emmc vfat /dev/block/mmcblk0p[COLOR="blue"]6[/COLOR]
/sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1
/sd-ext auto /dev/block/mmcblk1p2
/nvram emmc /dev/nvram flags=display="[COLOR="blue"]Nvram[/COLOR]";backup=1
/uboot emmc /dev/uboot flags=display="[COLOR="blue"]Uboot[/COLOR]";backup=1
Thanks to MrJavum who discover that we can also backup Nvram & Uboot for MTK devices . . . :good:
MTK Uboot also consist of camera driver & this feature is extremely useful when you upgrade your device firmware, typically it will replace the Uboot & your camera doesn't work after that. A simple restore & you'll have your camera working again in no time.
MTK Nvram consist of your IMEI & this feature is extremely useful when you have corrupted it, a simple restore & you'll have your phone in working state again.
Below format was discovered by bgcngm & it has saved me a few lines of codes as MTK manufacturer tends to use different partition no. from each other. Eg. Some might be using mmcblk0p6 for system & some uses mmcblk0p3 while [email protected] will work on all MTK devices.
Code:
# mount point fstype device [device2]
/boot emmc /dev/bootimg
/recovery emmc /dev/recovery flags=display="recovery";backup=1
/uboot emmc /dev/uboot flags=display="uboot";backup=1
/nvram emmc /dev/nvram flags=display="nvram";backup=1
/cache ext4 /[COLOR="blue"][email protected][/COLOR]
/data ext4 /[COLOR="blue"][email protected][/COLOR]
/system ext4 /[COLOR="blue"][email protected][/COLOR]
/emmc vfat /[COLOR="blue"][email protected][/COLOR]
/sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1
/sd-ext auto /dev/block/mmcblk1p2
Having said that, few has reported back that its not compatible for their MTK then you'll need to unpack it & use the device block path /dev/block/mmcblk0pX instead of this soft-link [email protected] format. Use Notepad++ for editing. Updates : Porting tool now uses direct device block path.
Below examples are some of MrJavum TWRP recovery.fstab for MTKs
Code:
# mount point fstype device [device2]
/boot emmc /dev/bootimg
/cache ext4 /[email protected]
/data ext4 /[email protected]
/misc emmc /dev/misc
/recovery emmc /dev/recovery
/system ext4 /[email protected]
[COLOR="blue"]/preload[/COLOR] ext4 /[COLOR="blue"][email protected][/COLOR] flags=display="[COLOR="blue"]Preload[/COLOR]";backup=1;wipeingui
/external_sd vfat /dev/block/mmcblk1p1 flags=display="External SD-card";storage;wipeingui;removable
/nvram emmc /dev/nvram flags=display="Nvram";backup=1
/uboot emmc /dev/uboot flags=display="Uboot";backup=1
/logo emmc /dev/logo flags=display="Boot Logo";backup=1
#mt6582/recovery_emmc.fstab
To support preload partition you'll need to specify it at init.rc too.
Code:
[COLOR="Blue"]mkdir /preload[/COLOR]
mkdir /external_sd
mkdir /system
mkdir /data
mkdir /cache
mount /tmp /tmp tmpfs
Code:
/boot emmc /dev/bootimg
/cache ext4 /[email protected]
/data ext4 /[email protected]
/misc emmc /dev/misc
/recovery emmc /dev/recovery
/emmc vfat /[email protected] flags=display="Internal SD-card";storage;wipeingui;backup=1
/system ext4 /[email protected]
/sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="External SD-card";storage;wipeingui;removable
/nvram emmc /dev/nvram flags=display="Nvram";backup=1
/uboot emmc /dev/uboot flags=display="Uboot";backup=1
/[COLOR="blue"]logo[/COLOR] emmc [COLOR="blue"]/dev/logo[/COLOR] flags=display="[COLOR="blue"]Boot Logo[/COLOR]";backup=1
Awaaas is so kind to shared with me his findings. He got help from bigbiff on the IRC & now TWRP can also backup EBR1 & SECRO. Refer to updates here.
CodeLover has added cust partition for his Huawei.
Code:
# mount point fstype device [device2]
/boot emmc /dev/bootimg flags=display="boot"
/misc emmc /dev/misc
/recovery emmc /dev/recovery flags=display="recovery";backup=1
/uboot emmc /dev/uboot flags=display="uboot";backup=1
/nvram emmc /dev/nvram flags=display="nvram";backup=1
/cache ext4 /[email protected] flags=display="cache"
/data ext4 /[email protected] flags=display="data"
[COLOR="Blue"]/cust[/COLOR] ext4 /[COLOR="blue"][email protected][/COLOR] flags=display="[COLOR="blue"]cust[/COLOR]";backup=1
/system ext4 /[email protected] flags=display="system"
/sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1
init.rc with cust partition support.
Code:
mkdir /boot
mkdir /recovery
mkdir /system
mkdir /data
[COLOR="blue"]mkdir /cust[/COLOR]
mkdir /cache
mkdir /sdcard
mount tmpfs tmpfs /tmp
So its entirely up to you to specify what you want TWRP to backup on your MTK no need to compile a new one, just mod the recovery.fstab
For further info refer to the main thread here . . . :good:
For MTK Alcatel devices, besides /custpack there is also /mobile_info partition, again its entirely up to you whether you would wanna backup it too, credits to MrJavum for compiling the first TWRP version for it . . .
Code:
# mount point fstype device [device2]
/boot emmc /dev/bootimg
/recovery emmc /dev/recovery
/cache ext4 /e[email protected]
/data ext4 /[email protected]
/system ext4 /[email protected]
/emmc vfat /[email protected]
[COLOR="Blue"]/custpack[/COLOR] ext4 /[email protected] flags=display=[COLOR="blue"]custpack[/COLOR];backup=1
[COLOR="blue"]/mobile_info[/COLOR] ext4 /[email protected]_info flags=display=[COLOR="blue"]mobile_info[/COLOR];backup=1
/nvram emmc /dev/nvram flags=display=Nvram;backup=1
/uboot emmc /dev/uboot flags=display=Uboot;backup=1
/sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1
/sd-ext auto /dev/block/mmcblk1p2
Code:
mkdir /boot
mkdir /recovery
mkdir /system
mkdir /data
mkdir /cache
[COLOR="blue"] mkdir /custpack
mkdir /mobile_info[/COLOR]
mkdir /sdcard
mount tmpfs tmpfs /tmp
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 . . . :good:
Ported recovery.img is too large & causes region overlap !
This tool is AIO so use the UnPack/ RePack feature to remove below known files that are safe to be deleted to save a few Kb. ( rmdisk/sbin folder ) Below list starts with less critical to critical
Use awaaas technique to use basic theme
Parted
All *exfat*
erase_image, dump_image
flash_image <- You will not be able to flash modded EBR, MBR
rmdisk/supersu folder <- You will not be able to Root via TWRP
adbd <- No adb shell & mount USB storage but you still can use MTP
In fact in the past i have tested, there are quite a few more binary that you can safely remove from rmdisk/sbin folder. Of course you'll loose a few features but at least you can still use TWRP for basic backup & restore.
Delete one file at a time at rmdisk/sbin folder, repack it, until it let you auto-install it.
Updates
Found out that you can also zip the whole content of res folder, move it to /sdcard/TWRP/theme/ui.zip, delete whole res folder & that will work too but no splash screen . . .
if you want then remain res/images/curtain.jpg then splash screen will work . . .
TWRP Materialised Theme
Huge Credits to z31s1g, TWRP has never look so elegant & sophisticated ever before . . . :good:
As mentioned many times, this tool is AIO so unpack the ported recovery.img, download the various custom splash screen that you like, resize it to your device res, copy & paste it to res/images/curtain.jpg, Credits to PünchUp . . . :good:
i have ported to 480x854 res Dark Theme & Light Theme, credits to thewisenerd & Modding.MyMind & don't forget to hit the Thanks button for them . . . :good:
Dark & Light Theme porting to MTK
If you're using other themes other than 480x854 which is ported by me then Dark & Light Theme will not work properly on MTK . . .
Solution to Change Color on Dark & Light Themes to work on MTK
Open ui.zip -> ui.xml & change all /sdcard/TWRP to /emmc/TWRP EXCEPTIONAL for two -> tw_filename=/sdcard/TWRP/aromafm/aromafm.zip & save it first.
Tips : Use the search function -> Ctrl + f to search for above keyword & if you're a Windows users then use Notepad++ for editing . . .
There are two occurrence -> ./zip -0 -r -u "/emmc/TWRP/theme/ui.zip" *; <- You'll need to delete both the -u.
Code:
mkdir "/cache/twrp";
if [ -f "/emmc/TWRP/theme/ui.zip" ];
then unzip -o "/emmc/TWRP/theme/ui.zip" -d "/cache/twrp";
chmod 777 "/cache/twrp/zip";
cp -r /cache/twrp/%tw_folder%/* "/cache/twrp/images";
busybox mv "/cache/twrp/ui.xml" "/cache/twrp/ui_temp.xml";
busybox sed "s/%text_highlight%/#%tw_text_color_highlight%/g" "/cache/twrp/ui_temp.xml" > "/cache/twrp/ui_temp2.xml";
rm -f "/cache/twrp/ui_temp.xml";
busybox sed "s/%text_actionbar%/#%tw_text_actionbar%/g" "/cache/twrp/ui_temp2.xml" > "/cache/twrp/ui.xml";
rm -f "/cache/twrp/ui_temp2.xml";
cd "/cache/twrp";
[COLOR="blue"]./zip -0 -r "/emmc/TWRP/theme/ui.zip" *;[/COLOR]
cd /;
rm -r "/cache/twrp"
else
Updates
/data/media device refer to here . . . :good:
Solution to Install Image on Dark & Light Themes to work on MTK
WARNING : Does not check whether the boot.img or recovery.img you're about to flash is oversize & that might brick your MTK if you have only 6Mb partition, you have been fore-warned . . .
When you select Install -> Top Menu Install Zip -> Install Zip or Install Image
Open ui.zip -> flashify -> META-INF -> com -> google -> android -> update-binary & edit as below . . .
Replace Line 41 to 53 with below & save it first.
Code:
# Modded to work on MediaTek devices only
case $image in
boot*)
imgtype="boot.img";;
*recovery*)
imgtype="recovery.img";;
*)
ui_print "No image file found to flash.";
abort;;
esac;
Now at Line 66 to 74 replace with below, save it & now flashing MTK boot.img or recovery.img will work on Dark & Light Theme.
Code:
# Modded to work on MediaTek devices only
if [ "$imgtype" == "boot.img" ]; then
block=/dev/bootimg;
elif [ "$imgtype" == "recovery.img" ]; then
block=/dev/recovery;
fi;
Aroma File Manager
It is a known problem that aromafm will not to work properly on flip-screen, this is not a TWRP problem as it has never been updated for almost a year.
Flip Touch on Flip Screen
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 here -> View attachment 3039567, read the How-to use it. Built-in to porting tool -> Manual-mode
Bug report <- No support if you don't attach it to your post, pls refer to post #1 YOUR TOOL DOESN'T WORK . . .
Refer to here on how to submit a proper bug report . . . :good:
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
adb pull /tmp/recovery.log -> Attach to your post
At TWRP -> BackUp -> After Backup go to Advanced -> Copy Log to SDCard
Typically you will find the recovery.log at
Typical Internal SdCard
/emmc/TWRP/BACKUPS/ [Your Device Name] / [Backup date] [ro.mediatek.version.release]
or
Typical External SdCard
/sdcard/TWRP/BACKUPS/ [Your Device Name] / [Backup date] [ro.mediatek.version.release]
Attach it to your post.
At TWRP console (Square button at button) -> You can view the log
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 10 Jan 2014, there are only 24 pages . . .
The 2nd reason you don't see me replying is i donno the answer then head up to the TWRP IRC channel to get help, refer to here for more info . . .
TWRP FAQ

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 except latest big.LITTLE/ Cortex-A53 use PhilZ Touch
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 !
As explained BRANDED at the OP, UNBRANDED MTKs are generally MTKs directly from China, have unlock bootloaders.
List of supported MTK devices . . .

@yuweng Simply Awesome....

Haha, you are most welcome, my friend . . . :highfive:
Any feedbacks on ubifs & if everything is working well then i'll contact Master Shifu Dees_Troy to submit dhinesh77 patch to have ubifs officially supported by TWRP . . .

Amazing work!
It's been a while since i googled about MTK Devices. I've already compiled TWRP for Oppo Find Muse, which has the MTK6572. It's really pleasure to see that you've made a good job! :laugh::good:
Keep up the good work!
I'm not able to update my TWRP recovery coz my device already given to my mom :crying:
But i'm still browsing about the MTK Devices :laugh:

It says that my recovery partition its to small(6291456) and that i can lose my IMEI. How can i make the partition recovery bigger?

As mentioned at the OP, it will most probably works on the latest MTK devices with above 6Mb, Eg : The latest MT6582, MT6592 or the obsolete MT6573, MT6575, MT6577 b'cos the kernel is so much smaller in size on these legacy devices . . .
i've published my findings on how to increase MTK recovery partition to 7Mb or 8Mb last year but many couldn't get it to work on their MT6589 . . .
Those that got it to work never shared it . . . Hunt for key work 7Mb_TWRP.pdf. WARNING : You might brick your device in doing so . . .

yuweng said:
As mentioned at the OP, it will most probably works on the latest MTK devices with above 6Mb, Eg : The latest MT6582, MT6592 or the obsolete MT6573, MT6575, MT6577 b'cos the kernel is so much smaller in size on these legacy devices . . .
i've published my findings on how to increase MTK recovery partition to 7Mb or 8Mb last year but many couldn't get it to work on their MT6589 . . .
Those that got it to work never shared it . . . Hunt for key work 7Mb_TWRP.pdf. WARNING : You might brick your device in doing so . . .
Click to expand...
Click to collapse
:good:
I prefer not to test it

Works with MT6572? :/

Great Work Bro!! :highfive:

Hello sir, I have a "mtk 6589t xolo q3000 with 4.4.2 kitkat os.
My stock recovery.imgs size is 6Mb and my stock boot.imgs size is also 6mb.
Is it possible to port twrp in my device ?
Will my mobile support your tool?
Sent from my Q3000 using XDA Premium 4 mobile app

Please upload it to some file sharing site rather than torrent..no seeds and leechers..
Sent from my Micromax A58 using xda app-developers app

daoodshah said:
....no seeds and leechers....
Click to expand...
Click to collapse
if you wanna download, do it the simple way. see the part "Where is the Downloads . . . " in the op.
"click to show content". can't get any simpler/better than that.

Dwnload is nt getting any speed..thats the problem..as there are no seeds..
Sent from my Micromax A58 using xda app-developers app

daoodshah said:
Dwnload is nt getting any speed....as there are no seeds..
Click to expand...
Click to collapse
no seeds required. click direct download. don't you see the pic and the circled icon? just do a 1-2-3.

Working perfectly for UBIFS..just tested right now..
Sent from my Micromax A58 using xda app-developers app

Wanna try this

which can delete files from folder "sbin"? Turned to run on 6589, but still works incorrectly.

Is there a way to increase size of recovery partition. I have 6mb partition, ported recovery is 6.4mb

Related

[Q] Noob Question + Help needed

I started learning Rom cooking and when I learn that ( more or less ) I am thinking on moving on to theming , CWM cooking ( if that's how it's done ) kernels etc . I used dsixda's kitchen , and so far I made roms for my G Note 2 , my friend's note , wife's flyer .... so i am getting the hang of it ... until I tried making Rom for my Galaxy note n8013 . I am getting status 0 on flash . ( Flashing it with darkman's CWM ) . N8013 being great tablet right out of the box don't need much work . I just want to root it , deodex zipalign theme it a bit and that's it .
I am on windows 8 x 64 usng Cygwin ( FULL Install . ALL options )
This is what I did so far :
I changed api level to 17 for deodexing ,
I extracted recovery.fstab it looks like this
Code:
mount point fstype device device2
/efs ext4 /dev/block/mmcblk0p3
/boot emmc /dev/block/mmcblk0p5
/recovery emmc /dev/block/mmcblk0p6
/cache ext4 /dev/block/mmcblk0p8
/system ext4 /dev/block/mmcblk0p9
/data ext4 /dev/block/mmcblk0p12 length=-16384
/preload ext4 /dev/block/mmcblk0p10
/sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1
#/modem emmc /dev/block/mmcblk0p7
and followed guide to add device in edify.defs folder
( I beleve it should look like this )
Code:
# Samsung Galaxy Note 10.1 GT-N8013
change_mnt=yes <-- I tried with NO and other combos with fix boot with same results
param1=ext4 <-- I tried changing emmc and ext for param 2 it's a no-go
param2=EMMC
param1_sdcard=vfat
param2_sdcard=MTD
sys_mnt=\/dev\/block\/mmcblk0p9
cache_mnt=\/dev\/block\/mmcblk0p8
boot_mnt=\/dev\/block\/mmcblk0p5
data_mnt=\/dev\/block\/mmcblk0p12 length=-16384
sdcard_mnt=\/dev\/block\/mmcblk1p1 /dev/block/mmcblk1
modem_mnt=\/dev\/block\/mmcblk0p7
fix_boot=yes
I did everything kitchen tells me to do and at the end it ask me to
convert update script to updater-script
I did that too and voila! Status 0 on flashing
I followed some more guides and PM-d few devs , it all comes to Update binary and updater script , but the guides that I am finding online are
not that clear to noob like me . ( it's basically like you are in the dark and you ask for flashlight , and somebody hands you a flashlight without batteries ) . Any developer that has made n8013 rom , can you share some wisdom , or files ? ( Like updater_script , binary , device support file for edify_defs folder so I can add N8013 to supported devices ) ANY and ALL help is welcome )

[GUIDE]Adding Support for Different ROMs for Dual Boot

#THIS GUIDE IS ONLY FOR ADVANCED USERS, WHO KNOW HOW TO COMPILE AND MAKE MODIFICATIONS TO KERNEL AND MODIFYING VARIOUS PARAMETERS IN RAMDISK IN THE RAMDISK LEVEL #
Hey guys this guide will tell you how to add support for Dual bootinga as primary ROM.
YOU MUST USE ATLEAST CLASS 6 OR ABOVE SDCARD WITH MINIMUM 8GB CAPACITY
First you need 3 EXT4 partitions on SD-card, using minitool partition wizard
1) around 400 MB - SD-SYSTEM (ext4)
2) around 1 GB (or can be less) - SD-DATA(ext4 format),
3)around 75MB (can be less) SD-CACHE(ext4 format) (refer to the screenshot):
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This is very important : You should remove any memory increasing script that you were using. Because /data partition is now on SDcard, using memory increasing script will cause conflict and makes ROM unbootable.
Now making kernel level Changes :
Step 1- open the defconfig of your kernel source and make this change in it
Enable LBDAF (for multiple partitions to work)
Code:
[COLOR="Navy"]CONFIG_LBDAF=y[/COLOR]
Now compile the kernel.
Step 2- Ramdisk level changes:
All modifications are performed on init.rc file.
Step 1- Search for this line :
Code:
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system ro remount
Replace it with this :
Code:
[COLOR="Navy"]# Mount SD-SYSTEM
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
mount ext4 /dev/block/mmcblk0p2 /system
mount ext4 /dev/block/mmcblk0p2 /system ro remount[/COLOR]
Step 2 - find this line :
Code:
mount yaffs2 [email protected] /data nosuid nodev
Now replace it with :
Code:
[COLOR="navy"]# Mount SD-DATA
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
mount ext4 /dev/block/mmcblk0p3 /data nosuid nodev noatime nodiratime barrier=0 data=ordered commit=15 noauto_da_alloc nouser_xattr errors=continue[/COLOR]
Step 3- Find this line :
Code:
mount yaffs2 [email protected] /cache nosuid nodev
Replace it with :
Code:
[COLOR="navy"]# Mount SD-CACHE
wait /dev/block/mmcblk0p4
wait /dev/block/mmcblk0p4
wait /dev/block/mmcblk0p4
wait /dev/block/mmcblk0p4
mount ext4 /dev/block/mmcblk0p4 /cache nosuid nodev noatime nodiratime barrier=0 data=ordered commit=15 noauto_da_alloc nouser_xattr errors=continue[/COLOR]
That's it now pack the ramdisk with the kernel you made earlier
All of this is much similar like pll2 Oc by cute_prince.
Now the Updater-script changes
This was the real pain in finding out, It took me nearly a month to figure out how to extract system on the partition, and learn the mount function.. If you are using it PLEASE give me some credits
Step 1- one the updater-script of the ROM find these lines :
Code:
format("yaffs2", "MTD", "system", "0", "/system");
mount("yaffs2", "MTD", "system", "/system");
package_extract_dir("system", "/system");
Replace them with these:
Code:
[COLOR="navy"]run_program("/sbin/busybox", "mount", "-t", "auto", "/dev/block/mmcblk0p2", "/system");
run_program("/sbin/busybox", "rm", "-rf", "/system/*");
package_extract_dir("system", "/system");[/COLOR]
That's it you've Successfully added support for the rom as primary ROM !!
Head Over here : http://forum.xda-developers.com/showthread.php?t=2409236
for flashing instructions ,dual boot app by galaxy freak and switching mechanisms
IF YOU WANT TO PLL2 OC BOTH PRIMARY AND SECONDARY ROMs GO TO THE GUIDE BY @Arslankirmani HERE : http://forum.xda-developers.com/showpost.php?p=45063954&postcount=84
Now if you are using it for adding support for ROM , please PM either me,adityalahiri13 or galaxyfreak the download link so that we can add on the dual boot thread.. IF you are a ROM developer ,i kindly request you to let us also keep the download link for the primary enable ROM.
The Yin-Yang Way!
Procedure
You MUST know how to unpack/repack kernels, and their ramdisks.
If you unpack your kernel, you would find the folder named sbin where you'd unpacked the ramdisk. Place these two files busybox.7z and bootsdcard.txt in the folder. Rename them to "busybox" and "bootsdcard.sh" respectively.
Additionally, you will need to create a folder named "tmp" where you've unpacked the ramdisk.
Now, open up init.rc and find the lines:
Code:
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system ro remount
mount yaffs2 [email protected] /data nosuid nodev
mount yaffs2 [email protected] /cache nosuid nodev
After these lines, you are most likely to find these lines (or similar lines):
Code:
# once everything is setup, no need to modify /
mount rootfs rootfs / ro remount
Add the following lines to the above:
Code:
chmod 0777 /sbin/busybox
chmod 0777 /sbin/bootsdcard.sh
exec /sbin/busybox sh /sbin/bootsdcard.sh
En total, it should look like this:
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system ro remount
mount yaffs2 [email protected] /data nosuid nodev
mount yaffs2 [email protected] /cache nosuid nodev
on post-fs
chmod 0777 /sbin/busybox
chmod 0777 /sbin/bootsdcard.sh
exec /sbin/busybox sh /sbin/bootsdcard.sh
# once everything is setup, no need to modify /
mount rootfs rootfs / ro remount
Click to expand...
Click to collapse
Now, you can repack the ramdisk, and repack the kernel. In most cases, you should be able to flash the kernel with the busybox included. If you are not able to flash the repacked boot.img, please post the boot.img along with thread from which obtained/sources.
P.S. For the curious, this is what bootsdcard.sh looks like:
Code:
#!/sbin/busybox sh
MOUNT="/sbin/busybox mount"
UMOUNT="/sbin/busybox umount"
MKDIR="/sbin/busybox mkdir"
RMDIR="/sbin/busybox rmdir"
TOUCH="/sbin/busybox touch"
$MKDIR /tmp/sdcard
$CHMOD 0770 /dev/block/mmcblk0p1
$MOUNT /dev/block/mmcblk0p1 /tmp/sdcard
if [ -f /tmp/sdcard/.bootsdcard ];
then
$TOUCH /tmp/.bootsdcard
fi
$UMOUNT /tmp/sdcard
$RMDIR /tmp/sdcard
if [ -f /tmp/.bootsdcard ];
then
$UMOUNT /data;
$CHMOD 0770 /dev/block/mmcblk0p2
$MOUNT -t ext3 -o nosuid,nodev /dev/block/mmcblk0p2 /data
$UMOUNT /system
$CHMOD 0770 /dev/block/mmcblk0p3
$MOUNT -t ext3 /dev/block/mmcblk0p3 /system
$MOUNT -t ext3 -o remount,ro /dev/block/mmcblk0p3 /system
$UMOUNT /cache
$CHMOD 0770 /dev/block/mmcblk0p4
$MOUNT -t ext3 /dev/block/mmcblk0p4 /cache
fi
Now, to switch to the other ROM, please create a file named ".bootsdcard", and to switch to primary ROM, delete the ".bootsdcard" from your sdcard.
I know this post looks wierd, and outta place. the busybox.7z and bootsdcard.sh file can be obtained from here: http://forum.xda-developers.com/showthread.php?t=2413642
until I edit this post...
P.s. @omerjerk made an app for this purpose... he'd release it shortly.
What if?
@ayushrox
U said on facebook that the sd-data is only for primary rom and the data for the secondary rom is on the NAND Partition ....
So , can't we make changes in the boot.img of Secondary Rom so that it uses the SD-DATA Partition for its data ......?
So our apps can be used in both the roms......
ayushrox atleast can you make CM10.1 as primary rom for who dont know how to compile , etc... and please make primary rom support Pll2 OC.
good work!!!!!
thelegend10 said:
@ayushrox
U said on facebook that the sd-data is only for primary rom and the data for the secondary rom is on the NAND Partition ....
So , can't we make changes in the boot.img of Secondary Rom so that it uses the SD-DATA Partition for its data ......?
So our apps can be used in both the roms......
Click to expand...
Click to collapse
I can do this.. but it may cause errors since we can dual boot even GB with 4.3 so the app's a pi level may cause conflict .. but anyways I'll try it
Boyka123 said:
ayushrox atleast can you make CM10.1 as primary rom for who dont know how to compile , etc... and please make primary rom support Pll2 OC.
good work!!!!!
Click to expand...
Click to collapse
OK I'll add cm 10.1 as primary ROM.with pll2OC ... And BTW devs : u can add pll2OC easily by using the edited acpuclock or editing the ramdisk of pll2 OC Kernels just as I indicated
..
That f*cking awesome!!!!!!!!!!! If we use pll2 oc, does we need extra partition or just partition order on dual boot thread?
Sent from my HTC Explorer A310e using XDA Premium 4 mobile app
Boyka123 said:
That f*cking awesome!!!!!!!!!!! If we use pll2 oc, does we need extra partition or just partition order on dual boot thread?
Sent from my HTC Explorer A310e using XDA Premium 4 mobile app
Click to expand...
Click to collapse
if you enable pll2 .. then only primary rom can be used as pll2 Oc .. so yes only the partition order i mentioned on dual boot thread !!!!
ayushrox said:
if you enable pll2 .. then only primary rom can be used as pll2 Oc .. so yes only the partition order i mentioned on dual boot thread !!!!
Click to expand...
Click to collapse
nice guide :good::good:
is that CONFIG_LBDAF=y enabled in sense 4.1 kernel cause it uses multiple partitions?
if not can u provide kernel with it enabled
edit : solved
Just signed in, and thought I'd check up on how far you've gotten up to on this project... I think it should be easy enough to adapt the script I made for the HD2 to automate this quicker. I'll put up a file and instructions in a day or two; all being well, if anyone wants to test...
In terms of having the same data file/folder between different ROMs - this isn't something that we managed on the HD2 as there seemed to be permissions issues caused as well as the issue of differnt api levels, it's still worth a try though.
any chance for a noob guide?????
balajithegreat said:
any chance for a noob guide?????
Click to expand...
Click to collapse
Not a guide but yes.. i'll be posting edited updater-scripts and premade kernels.. for adding support
and guys LBDAF is enabled in all pll2 OC kernels(pandora,aries,etc.) you can take their boot.img ,unpack them,edit the init.rc file as i said and repack it.. and rest the updater-script thing should be easy !!
and @HypoTurtle i thought of giving our script a try..but didn't have time for it.. you can PM me the script , i'll test it
@ayushrox
can u build a kernel that can work with the boot manager app
with it we can boot up to 5 or more roms
is it possible???....
One question. What about gapps for primary rom? If we flash gapps just like that wouldnt they go to /system..! we need then in sd-system!
UPDATE: I compiled a kernel doing the ramdisk changes, enabling lbdaf and also edited updater-script. Formatted the partitions as SD-SYSTEM(EXT4) (455mb)---- SD-DATA(EXT4) (900mb)---- SD-CACHE(eXT4) (85mb)
Rom flashes. But it kinda finishes very early. I checked the sd-system partition using mini partition tool just after flashing and it doesnt seem to have changed..I double checked updater-script. It just stays at HTC logo.
7alvi said:
One question. What about gapps for primary rom? If we flash gapps just like that wouldnt they go to /system..! we need then in sd-system!
UPDATE: I compiled a kernel doing the ramdisk changes, enabling lbdaf and also edited updater-script. Formatted the partitions as SD-SYSTEM(EXT4) (455mb)---- SD-DATA(EXT4) (900mb)---- SD-CACHE(eXT4) (85mb)
Rom flashes. But it kinda finishes very early. I checked the sd-system partition using mini partition tool just after flashing and it doesnt seem to have changed..I double checked updater-script. It just stays at HTC logo.
Click to expand...
Click to collapse
On which ROM did you try ? Did you make the kernel changes correctly ?
ayushrox said:
On which ROM did you try ? Did you make the kernel changes correctly ?
Click to expand...
Click to collapse
Im trying on my aokp 4.2 build. Yep I did make the changes correctly.. But i think its something with updater-script as it flashes and finishes too soon and i checked sd-system just after flashing rom and the 'used' field is unchanged!
7alvi said:
Im trying on my aokp 4.2 build. Yep I did make the changes correctly.. But i think its something with updater-script as it flashes and finishes too soon and i checked sd-system just after flashing rom and the 'used' field is unchanged!
Click to expand...
Click to collapse
Please upload your updater-script.. i'll try to find problems..
ayushrox said:
Please upload your updater-script.. i'll try to find problems..
Click to expand...
Click to collapse
http://pastebin.com/wqfD8Xyk
7alvi said:
http://pastebin.com/wqfD8Xyk
Click to expand...
Click to collapse
thanks for the script... but i have already made it ... so i'll put in on pastebin shortly..
ayushrox said:
thanks for the script... but i have already made it ... so i'll put in on pastebin shortly..
Click to expand...
Click to collapse
Thank you. Can you tell me if I didn't do it correctly?
7alvi said:
Thank you. Can you tell me if I didn't do it correctly?
Click to expand...
Click to collapse
I found that your updater-script was fine.. the problem must be with the kernel.. here's my kernel : http://d-h.st/q91
Download it just take out the boot.img(its named "boot3.img" --rename it to1)boot.img use in rom 2) cm.img (put it in sd-card)
Now, also take the modules part.. then i think it should work fine.. if problem still persistes.. i'll also attach the updater-script !!
And guys the kernel i have uploaded will work for all android 4.2.2 roms .. just use the modules and boot.img
*wifi may not work
and the kernel source is same as mine pandora kernel's

[GUIDE]How To Dual Boot Two Roms almost ANY Device

Ever wanted to try a new rom without having to waste our time on making backups then trying the rom and then again restoring it, and if another rom pleases you at the moment , you'll have to perform the same drill again and again ... Well Now NO MORE of this frustrating business.
Here i present you my very own method of Dual Booting almost ANY two roms you like on YOUR device.
But make sure to try at your risk.. as per DoomLord many devices can be hardbricked too.
Do Not use this method
on newer (post 2012) qualcomm chipsets the TA and Bootloader, reside on similar partitions... if u screw with these partitions device gets HARD BRICKED!
As the partition maps vary from device to device it may not work for you and you may get your device hard bricked!
Also your device must use older bootloader bypass based kernels i.e boot.img format and has SD-card slots for this method to work !!
Before we begin here's what Dual Booting means :
- Dual booting is the process through which you can switch between any two or more roms without the need of wiping data or making backups before flashing ,all you need to do is switch between the roms ,meanwhile all the apps you've insatlled remain intact in their specific rom.
for ex- If you are using cm10 and you have installed a lot of apps, and you want to test other rom ,but you don't want the fuss of backing up then flashing.. This dual booting method is for you !!​
So to begin with make sure you meet the following prerequisites :
Your Device which can run android
an class 6 or above SD-Card
an Os on the PC to make partitions on the SD-card
ubuntu for kernel specific changes
notepad ++
ConCentRation
If you meet all the above requirements you are good to go
Now to Before we get our hand in the filth remember : You need to have and an SD-Card that's class 6 or above because we would be using it extensively , and slow cards may not keep up
SO LET'S ROLL :
In this method [/CENTER]
Primary Rom = The rom which is modded and remains on the Sd-ext partitons
Secondary Rom = any rom you wish (any android version for ex- cm9 , cm10.1 and even stock !) [ make sure that the secondary rom doesn't use sd-ext partitions]​
I would be dividing the process in tow steps : 1) Kernel level changes and 2)SD-card and Rom level changes
1- Kernel Level Changes :
Get the source of any kernel for your device (if you don't know what's kernel compilation you can go to xda-university to learn it.)
-Now open the defconfig file (usually present in : "arch/arm/config" -folder)
-Search for LBDAF and then change the line consisting it as follows :
Code:
CONFIG_LBDAF=y
and now compile the kernel
This is done so that our Primary Rom can support multiple SD-ext partitons
-Now grab the boot.img of your Primary Rom , unpack it using any tool of your convenience(Google : chanpionwimmer's kernel tools -- i use it ) now open the ramdisk part , then open init.rc
-Search for the rom's mounting functions it will be like:
Code:
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system ro remount
it will vary from device to device.. proceed only if you know the correct mount points for your device.. otherwise you WILL hardbrick your device
-Now replace the following lines from the mounting functions to this Make sure you know the correct mount points of your device :
Code:
# Mount SD-SYSTEM
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
mount ext4 /dev/block/mmcblk0p2 /system
mount ext4 /dev/block/mmcblk0p2 /system ro remount
# Mount SD-DATA
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
mount ext4 /dev/block/mmcblk0p3 /data nosuid nodev noatime nodiratime barrier=0 data=ordered commit=15 noauto_da_alloc nouser_xattr errors=continue
# Mount SD-CACHE
wait /dev/block/mmcblk0p4
wait /dev/block/mmcblk0p4
wait /dev/block/mmcblk0p4
wait /dev/block/mmcblk0p4
mount ext4 /dev/block/mmcblk0p4 /cache nosuid nodev noatime nodiratime barrier=0 data=ordered commit=15 noauto_da_alloc nouser_xattr errors=continue
-Now recompile the kernel and you are good to go
more in the 2nd post ..​
Here now comes the SD-Card and Rom level changes :
YOU MUST USE ATLEAST CLASS 6 OR ABOVE SDCARD WITH MINIMUM 8GB CAPACITY
First you need 3 EXT4 partitions on SD-card, using minitool partition wizard
1) around 400 MB - SD-SYSTEM (ext4)
2) around 1 GB (or can be less) - SD-DATA(ext4 format),
3)around 75MB (can be less) SD-CACHE(ext4 format) (refer to the screenshot):
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Rom level changes :
Get the updater-script of your Primary rom and find for these lines (Will differ from device to device - but basically the format is same )
Code:
format("yaffs2", "MTD", "system", "0", "/system");
mount("yaffs2", "MTD", "system", "/system");
package_extract_dir("system", "/system");
Now replace it with :
Code:
run_program("/sbin/busybox", "mount", "-t", "auto", "/dev/block/mmcblk0p2", "/system");
run_program("/sbin/busybox", "rm", "-rf", "/system/*");
package_extract_dir("system", "/system");
-what we are doing here is extracting the sustem files to the sd-ext partition we just created earlier
save it and replace this updater-script in the original Primary rom and also replace the boot.img with the one you made earlier.
That's it.If you have followed the guide correctly you can Dual boot any Rom on your device
Now flash the primary rom first.. and then any rom you choose as the secondary rom (PROVIDED IT DOESN"T USE SD-Ext partitions..) and flash it
REMEMBER DO NOT wipe data before installing the secondary rom
If you want to change your secondary rom DO NOT WIPE DATA instead goto recovery -
if in CWM or philz -go to mounts and storage and format system , data and cache
For Switching roms :
-put the boot.img of primary rom in the root of your sd-card(not in any directory) reanme it primary.img
-put the boot.img of secondary rom in the root of your sd-card(not in any directory) reanme it sec.img
-get terminal emulator app
-type
Code:
su
flash_image boot /sdcard/primary.img (or secondary.img)
But STOP here are some restrictions of this method :
You must make sure your device uses boot.img format and you know your device's correct mount points !! if you do it wrong you WILL hard brick your device !!
1. For The secondary rom you CANNOT use scripts like int2ext, etc.
2. Also you CANNOT use pll2 OC method in Secondary ROM
3. The edited cm10beta 6 (primary rom) is clocked at 600mhz, so NO chances of burnt nand.
4. You can choose ANY rom as secondary ROM provided it does not violate the first 2 clauses, that is, it should not use sd-ext partitions
5. The process is only for people having class 6 or higher sd card.
PS : This has taken a lot of effort and time so please don't go on commenting "This is useless" , "i don't like it" ,etc. If you don't like it, you are free to leave.
<JohnCarter> said:
...
-Now grab the boot.img of your Primary Rom , unpack it using any tool of your convenience(Google : chanpionwimmer's kernel tools -- i use it ) now open the ramdisk part , then open init.rc
-Search for the rom's mounting functions it will be like:
Code:
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system ro remount
it can vary from device to device..
-Now replace the following lines from the mounting functions to this :
Code:
# Mount SD-SYSTEM
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
mount ext4 /dev/block/mmcblk0p2 /system
mount ext4 /dev/block/mmcblk0p2 /system ro remount
# Mount SD-DATA
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
mount ext4 /dev/block/mmcblk0p3 /data nosuid nodev noatime nodiratime barrier=0 data=ordered commit=15 noauto_da_alloc nouser_xattr errors=continue
# Mount SD-CACHE
wait /dev/block/mmcblk0p4
wait /dev/block/mmcblk0p4
wait /dev/block/mmcblk0p4
wait /dev/block/mmcblk0p4
mount ext4 /dev/block/mmcblk0p4 /cache nosuid nodev noatime nodiratime barrier=0 data=ordered commit=15 noauto_da_alloc nouser_xattr errors=continue
..
Click to expand...
Click to collapse
PLEASE DONT POST INCORRECT INFORMATION!
the partition maps vary from device to device!
on newer (post 2012) qualcomm chipsets the TA and Bootloader, reside on similar partitions... if u screw with these partitions device gets HARD BRICKED!
also not all devices use standard boot.img format...
if u were able to get it to work on a particular device atleast test it out on 8-10 different devices from different vendors and different platforms before posting such threads...
DooMLoRD said:
PLEASE DONT POST INCORRECT INFORMATION!
the partition maps vary from device to device!
on newer (post 2012) qualcomm chipsets the TA and Bootloader, reside on similar partitions... if u screw with these partitions device gets HARD BRICKED!
also not all devices use standard boot.img format...
if u were able to get it to work on a particular device atleast test it out on 8-10 different devices from different vendors and different platforms before posting such threads...
Click to expand...
Click to collapse
I truly second that. The information on this thread is valid only for some devices. You can seriously screw a number of devices.
DooMLoRD said:
PLEASE DONT POST INCORRECT INFORMATION!
the partition maps vary from device to device!
on newer (post 2012) qualcomm chipsets the TA and Bootloader, reside on similar partitions... if u screw with these partitions device gets HARD BRICKED!
also not all devices use standard boot.img format...
if u were able to get it to work on a particular device atleast test it out on 8-10 different devices from different vendors and different platforms before posting such threads...
Click to expand...
Click to collapse
Ok thanks for the info... i'll give a caution for not using this method on newer devices

Genius wanted: TWRP for LENOVO TB-X104F

Could a genius with some time on there hands make TWRP for this device, its driving me insane, everything provided below.
Android 8.1
2GB RAM
Snapdragon 210
MSM8909
GPU Adreno 304
Times like these i wish i could follow a tutorial correctly.
Thanks in advance!
I had to archive the recovery as the IMG was over 8MB.
frankieuk said:
Could a genius with some time on there hands make TWRP for this device, its driving me insane, everything provided below.
Android 8.1
2GB RAM
Snapdragon 210
MSM8909
GPU Adreno 304
Times like these i wish i could follow a tutorial correctly.
Thanks in advance!
I had to archive the recovery as the IMG was over 8MB.
Click to expand...
Click to collapse
I know this reply is a little late... but have you tried twrp builder app? Search xda... got a working recovery for an obscure UMX budget phone... I have this tablet but I haven't bothered trying to do anything with it.
i have ported the Lenovo Tab 10 TB-X103F twrp to {TB-X104F}
tdawgg777 said:
I know this reply is a little late... but have you tried twrp builder app? Search xda... got a working recovery for an obscure UMX budget phone... I have this tablet but I haven't bothered trying to do anything with it.
Click to expand...
Click to collapse
i have ported the Lenovo Tab 10 TB-X103F twrp to {TB-X104F}but.... i having problems with partitions when i boot into it
i think my problems has to do with recovery.FSTAB file
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
heres my current recovery.fstab for twrp
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#device mount point fstype [device2] [length=]
/boot emmc /dev/block/bootdevice/by-name/boot flags=display="Boot";backup=1
/recovery emmc /dev/block/bootdevice/by-name/recovery flags=display="Recovery";backup=1
/system ext4 /dev/block/bootdevice/by-name/system flags=display="System";backup=1;wipeingui
/misc emmc /dev/block/bootdevice/by-name/misc flags=display="Misc";backup=0
/cache ext4 /dev/block/bootdevice/by-name/cache flags=display="Cache";backup=1;wipeingui;wipeduringfactoryreset
/data ext4 /dev/block/bootdevice/by-name/userdata flags=display="Data";backup=1;wipeingui;wipeduringfactoryreset;length=-16384
/sdcard0 vfat /dev/block/mmcblk1p1 flags=display="Micro SDCard";storage;wipeingui;removable;backup=0
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
______________________________________________________________________________________________________________________
heres he stock recovery.fstab
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#device mount point fstype [device2] [length=]
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/bootdevice/by-name/vendor /vendor ext4 ro,barrier=1 wait
/dev/block/bootdevice/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered wait,check
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc wait,check,encryptable=footer
/dev/block/mmcblk1p1 /sdcard vfat nosuid,nodev wait
/dev/block/bootdevice/by-name/boot /boot emmc defaults defaults
/dev/block/bootdevice/by-name/recovery /recovery emmc defaults defaults
/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
none of the partitions show up except (microsd card)
what am i doing wrong
Interested in recovery for this tablet also. Any luck?
Sent from my SM-N960U using Tapatalk
Hello Good People,
Is there a working TWRP for this tablet?
T.I.A.
Hello again,
Is there any working recovery for this tablet.
Its very very difficult to find a custom ROM.
Are people using LineageOS ?
T.I.A.

[guide]_[mtk]_[boot_modifications]

Thought id post today on how to set your SELinux to permissive on boot within your boot.img along with some other mods aswell
DISCLAIMER
Make sure you have at least basic knowledge decompiling boot.img & basic understanding of the files contained within, I will not be held responsible if you mess this up, following my instructions to the tee you will have no problems though,
PRE REQUISTES
* MTK extractor or similar program to decompile the boot.img
* Notepad ++
* A copy of your devices boot.img or BOOTIMG.file
* SP flash tool to flash boot.img to device
"alternatively you can add to a flashable zip if you have a custom recovery available for your device using android script generator here on xda-developers"
GUIDE
1. If your boot file is named BOOTIMG.file rename it to boot.img
2. Copy the boot.img to the program folder youll be using to decompile for this guide ill be using MTK extractor as it has a simple gui interface for all the newbs
3. MTK EXTRACTOR ONLY
Open mtk extractor application select the BOOT option from the left, in the bottom left you will see an off switch toggle it to ON
Click start at the top under unpack boot, in the mtk extractor folder will be your boot.img files
4. SETTING THE KERNEL TO PERMISSIVE
( PART 1 )
NOTE
Not all mtk devices are the same some can be set to permissive without the need for all the files using only some and some require all the files it depends on the kernel the device uses the extra files wont make a difference if anything will enforce the state even more
In this tutorial you will be using all the files to set the SELinux contexts to permissive to ensure it is enforced.
PART 1 - STEP 1.
open the INITRD folder then open your default.prop using notepad++
Set the following :
ro.secure=1 >
ro.secure=0
(This renders the boot.img insecure)
ro.selinux=0 >
ro.selinux=1
(NOTE) UBIFS MTK does not have this option
ro.security.perf_harden=1 > ro.security.perf_harden=0
(If you also want insecure adb)
ro.adb.secure=1 >
ro.adb.secure=0
(only newer mtk devices use this ro. Code )
ro.storage_manager.enabled=1 >
ro.storage_manager.enabled=0
Additionally if your device also has a low ram size you should add this to the default prop also to reduce the amount of ram usage while enabling high-end gfx also
# begin ram properties
# for low ram device to return true
ro.config.low_ram=true
# force high-end graphics in low ram mode
persist.sys.force_highendgfx=true
# ram inhaler
ro.HOME_APP_ADJ=1
# end ram properties
Now save and exit the default.prop
PART 1 - STEP 2.
Open your init.rc & init.charging.rc file with notepad++ scroll to the very bottom of the init.rc ( if you have init.target.rc add to this also)
Place this code exactly as shown
# SELinux
on property:/system/bin/setenforce $permissive u:r:kernel:s0
on property:selinux.echo $permissive > /sys/fs/selinux/enforce u:r:kernel:s0
on property:selinux.reload_policy=0
restart ueventd
restart installd
on property:selinux.setsebool debugfs 0
setenforce 0
setprop selinux.reload_policy 0
seclabel u:r:kernel:s0
Now save & exit the init.rc
PART 1 - STEP 3.
Open your fstab/s
To remove DM-Verity if present in your fstab look for the /system line & change to the following
/system ro wait,verify >
/system ro wait
Now look for /data then remove the force encryption of meta-data on data it will look something like this for exapmle
/dev/block/mmcblk0p2 /data ext4 nosuid,nodev,wait,forceencrypt=/dev/block/mmcblk0p3 ext4 /metadata >
/dev/block/mmcblk0p2 /data ext4 nosuid,nodev,wait
To remove encrypted footers from devices which use this instead of DM-Verity, change as follows using the example below,
/[email protected] /data ext4 noatime,nosuid wait,check,encryptable=footer >
/[email protected] /data ext4 noatime,nosuid, wait (check is optional & can be removed also if wanted)
PART 2 - STEP 1
( if you have init.target.rc already no need for this step)
open a new blank page in notepad++
On the first line add
On init
Space out 1 line so your now on line 3
Copy the #SELinux code we placed from init.rc to the new blank page, now save as init.target.rc
Do the above again but this time name it as init.kernel.rc
Now copy theese files to your INITRD folder
PART 2 - STEP 2.
open your init.rc & init.charging.rc once again
Add the following to the import section at the very top of the page,
import /init.kernel.rc
Import/init.target.rc
Save & exit now, your probably wondering why youve added so many files with the same code, on some devices it is necessary as i have found especially on NAND + UBIFS or JFFS2 devices.
PART 2 - STEP 3.
exit the INITRD Folder now open up the bootinfo.txt file
Change from the following
cmdline: >
cmdline: bootopt= androidboot.selinux=permissive
NOTE
FOR MT67**** 32 BIT DEVICES CHANGE FROM
cmdline: bootopt=64S3,32N2,32N2 >
TO
cmdline: bootopt=64S3,32N2,32N2 androidboot.selinux=permissive
FOR MT67**** 64 BIT DEVICES CHANGE FROM
cmdline: bootopt=64S3,32N2,64S3 >
TO
cmdline: bootopt=64S3,32N2,64S3 androidboot.selinux=permissive
Now save & exit the bootinfo.txt
PART 2 - STEP 4
open the cpiolist
Add the following at the bottom or add wherever dosent matter as long as its there
file init.kernel.rc initrd/init.kernel.rc 0750
file init.target.rc initrd/init.target.rc 0750
(Add this option only if you origninally didnt have the init.target.rc file)
Save & exit the cpiolist.
PART 2 - STEP 5
Recompile & flash if you did everything right youve now got an insecure boot.img without dm-verity encryption or data footer enceyption, with insecure adb & SElinux set as permissive,
To make sure its permissive go into settings and about device then scroll to bottom you should now see it,
If you found this useful you know where the thanks button is.
Matty1993 said:
Open your fstab/s
To remove DM-Verity if present in your fstab look for the /system line & change to the following
/system ro wait,verify >
/system ro wait
Now look for /data then remove the force encryption of meta-data on data it will look something like this for exapmle
/dev/block/mmcblk0p2 /data ext4 nosuid,nodev,wait,forceencrypt=/dev/block/mmcblk0p3 ext4 /metadata >
/dev/block/mmcblk0p2 /data ext4 nosuid,nodev,wait
To remove encrypted footers from devices which use this instead of DM-Verity, change as follows using the example below,
/[email protected] /data ext4 noatime,nosuid wait,check,encryptable=footer >
/[email protected] /data ext4 noatime,nosuid, wait (check is optional & can be removed also if wanted)
Click to expand...
Click to collapse
Hi Matty1993,
These are also in dtb of the kernel which I think may cause some issues if not removed. Magisk normally removes it from /system but on newer Android versions 8.0 > 8.1 /vendor is also wait,verify by default.
To edit these yourself you need a good hex editor and replace the ",verify" with zero bytes do not just delete it or type zero's or it will not boot.
I have not seen any forceencrypt in the dtb of the boot.img's I have seen as yet.
bigrammy said:
Hi Matty1993,
These are also in dtb of the kernel which I think may cause some issues if not removed. Magisk normally removes it from /system but on newer Android versions 8.0 > 8.1 /vendor is also wait,verify by default.
To edit these yourself you need a good hex editor and replace the ",verify" with zero bytes do not just delete it or type zero's or it will not boot.
I have not seen any forceencrypt in the dtb of the boot.img's I have seen as yet.
Click to expand...
Click to collapse
Wow i didnt even see this till now i need an assistant or something to organise and mark all my threads because im useless at it haha anyhow maybe could be a vendor related thing then as mine has all the info in dtb of kernel aswell as i was able to remove just "verify" from system and metadata completely and got it to boot.
I also found an easier way to get kernel permissive also as my first older method dosent seem to work with newer mtk models but my newer method works across most mtk platform from mt6572 up to mt6737m
What i did is decompiled my twrp i built for the same phone and copied the busybox applet from /sbin in the initrd then decompiled my boot.img added it to sbin gave it necessary permission of 04555 in the cpiolist whilst i had cpio list open i added below "file init initrd/init 0750"
"file init2 initrd/init2 0750" then went back to the initrd and changed the name of the "init" file to "init2" opened notepad++ to a new page and added the following
#!/sbin/busybox sh
cd/
/sbin/busybox mkdir /tmp
/sbin/busybox mount -t tmpfs tmpfs /tmp
/sbin/busybox mount -t proc proc /proc
/sbin/busybox sed -e 's/printk\.disable_uart\=1/printk\disable_uart\=1 androidboot\.selinux\=permissive/' /proc/cmdline > /tmp/cmdline
/sbin/busybox mount --bind -o -ro /tmp/cmdline /proc/cmdline
/sbin/busybox settings put global captive_portal_detection_enabled 0
/sbin/busybox chmod 755 /init2
/sbin/busybox mv /init2 /init
/bin/su settings put global captive_portal_detection_enabled 0
exec /init
All i did then was save it under the name .init to the bootimg directory then remove the "." from the file name so that it became init.file instead of .INIT format file
After that opened up the bootinfo.txt and added under cmd=bootopt=androidboot.selinux=permissive
Recompiled bootimg and had no dramas so thought id chuck it up here in case anyone else couldnt get there kernel to setenforce 0 through /bin/setenforce or any other way youve tried on these newer mtk models, do remember though results may vary this may or may not work for everyones device, no this will no permanently brick your device doing this if it dosent work you will simply still have an enforcing kernel. Have fun all
Help
tell me how to do selinux = permisive on my firmware and all permissions? Google search does not help. Doogee bl9000 Android 8.1 kernel 4.4.95+ Please help.
waryag said:
tell me how to do selinux = permisive on my firmware and all permissions? Google search does not help. Doogee bl9000 Android 8.1 kernel 4.4.95+ Please help.
Click to expand...
Click to collapse
Hey bud sorry for late reply,
What board make type is it running 6580, 6735/6737 or 6763/6737 depending on which it should be pretty straight forward to get you unlocked and what not as your BL will be by default locked down either way on 6580 or 67xx
I dont recommend you pushing permissive selinux on 8.1 however as this will compromise your security integrity what were you looking to do anyhow regarding permissive selinux,
Rooting or custom recovery ??

Categories

Resources