[Tutorial] How to setup dual boot on MTK - Printable Version +- www.chinaphonearena.com (https://www.chinaphonearena.com/forum) +-- Forum: Phone & Tablet Root, Hack and Develop (https://www.chinaphonearena.com/forum/Forum-Phone-Tablet-Root-Hack-and-Develop) +--- Forum: *Tech support* General Phone & Tablet Root, Hack and Develop Root IMEI NVRAM CWM TWRP BRICKED (https://www.chinaphonearena.com/forum/Forum-Tech-support-General-Phone-Tablet-Root-Hack-and-Develop-Root-IMEI-NVRAM-CWM-TWRP-BRICKED) +--- Thread: [Tutorial] How to setup dual boot on MTK (/Thread-Tutorial-How-to-setup-dual-boot-on-MTK) |
How to setup dual boot on MTK - vampirefo - 2014-04-09 This Tutorial is about setting up a dual booting Phone. Why would anyone want to do this? The reasons are many, to try out new roms, to fix a nonbooting device, to always have a booting device ready when you are ready to use it. To be able to make your data partition are large as you want same with system, even though 1 GB is more than enough for system, data is where apps and person setting are stored. The data partition is the one people are always filling up, well with this method one could make data as large as their sdcard, example data could be up to 32 GB, depends on what size sdcard you have and what size limit your phone has. I am using a 16 GB sdcard, My data is 3 GB and system is 1 GB on this sdcard card the rest of the sdcard is fat32 and used just like any normal sdcard would be used. I recommend using a class 10 sdcard, I buy mine at bestbuy cost $17 for a 16 GB Ultra Plus ScanDisk class 10. Ok before we start I recommend doing five different types of backups, your phone must be rooted and have custom recovery already installed, as well as having adb installed and working. Most of the work will be done via CMD ie adb command line, this project for newbies might seem time consuming, for more experienced users it won't take that long. I am a Linux guy, so this Tutorial with all be done on Linux, adb commands for Linux and windows are the same, the biggest difference is going to be how windows users partition their sdcard, I am going to recommend the only tool I use and know, it's a Linux tool but it can be used via livecd. Gparted can be downloaded from here. Ok let's start with the backups. 1. NexusTrix has posted how to backup via MTK Droid Tools 2. Khonshu has posted how to backup NVRAM 3. Use your Custom recovery and make a backup. 4. Download Online Nandroid Backup and use it to make a backup. 5. Manual backup, this is the method we use to make the dual boot work. *note don't make this backup til I tell you later on in the Tutorial. Code: busybox tar -czvf /sdcard/C30_system.tgz /system Number 5 is where everything happens, the magic if you will, we are going to issue adb commands to not only backup the current system and data, we are going to preserve permissions, which means as soon as they are restored they are in full working order just like when first backed up. They will last forever in this state until needed, I recommend also placing a copy on your pc for safe keeping, incase you wipe your sdcard in the future. Ok you are going to need a calculator and a hex to dec converter, the calculator should be installed on your pc, the hex to dec I use this online one. first step is to partition your sdcard, I have uploaded two pics one before and one after the partition, The partitioning is done via Gparted, all 3 partitions are primary. you can make your partitions what ever size you want, I make my data 3 GB and system 1 GB, you decide what size you want yours, you can always at a later point format the sdcard and remake it if the partition size you used doesn't suite you. I use a sdcard reader to plug the sdcard into the pc, I don't plug the phone itself into the pc during this process I make 3 partitions on my sdcard. 1. Fat32 2. Ext4 3. Ext4 Once you have partitioned your sdcard, put the sdcard into the phone and connect the phone to your pc. We need to get a few thing from the phone now. open cmd window Code: adb remount Code: adb shell Code: cat /proc/dumchar_info > /sdcard/dumchar_info.txt Code: cat /proc/partitions > /sdcard/partitions.txt open another cmd window Code: adb pull /sdcard/dumchar_info.txt Code: adb pull /sdcard//partitions.txt no close the second cmd window, open partitions.txt with a good text editor not windows notepad. look for below or something similar, 179 is the target for sdcard, then you want to find the correct partitions in my case mmcblk1p2 and mmcblk1p3 yours should be the same provided all MTK use same partition structure. Code: 179 96 15558144 mmcblk1 now open /dumchar_info.txt look for bootimg Code: bootimg 0x0000000000600000 0x0000000001d80000 2 /dev/block/mmcblk0 copy this info as well as the two partition names from partitions.txt into a new txt file, in new text file you should have Code: mmcblk1p2 and save close all text files for now. now open calculator, new text file and website time to do some math. ok from new file copy first hex and paste into Type hex value here box on website then click covert now copy the numbers from Decimal value box into the new text file. example copy Code: 0x0000000000600000 Code: 6291456 repeat for second hex. So now in new text file you have below keep in mind your numbers on bootimg most likely will be different than mine. Code: mmcblk1p2 ok now put the first dec number in calculator and divide by 4096, and repeat for second number copy answer to new text file. example Code: 6291456÷4096=1536 so now new text file looks similar to below. Code: mmcblk1p2 Ok now time to pull boot.img from phone, in cmd window, using my dec numbers, use your own numbers if different than mine. Code: dd if=/dev/block/mmcblk0 of=/sdcard/boot.img bs=4096 count=1536 skip=7552 now open another cmd window Code: adb pull /sdcard/boot.img close this cmd window, Now you need tools to extract boot.img and rebuild it. download to unpack boot.img open cmd window Code: ./unpack-MT65xx.pl ./boot.img go to boot.img-ramdisk folder open default.prop in a text editor edit first line, change below Code: ro.secure=1 Code: ro.secure=0 now open init.rc in text editor find and replace all /emmc@android with /dev/block/mmcblk1p2 find and replace all /emmc@usrdata with /dev/block/mmcblk1p3 now save init.rc, now time to repack boot.img Code: ./repack-MT65xx.pl -boot ./boot.img-kernel.img ./boot.img-ramdisk ./sdcard.img now make a folder on your sdcard called dual_boot. Code: mkdir /storage/sdcard0/dual_boot open another cmd window and push both boot.img to /storage/sdcard0/dual_boot, during adb push we are renaming boot.img to phone.img Code: adb push ./boot.img /storage/sdcard0/dual_boot/phone.img now you need to make two scripts just copy and paste both below each script. *note if your dec numbers are different than mine, make sure both scripts reflects your dec numbers. reboot-sdcard Code: #!/system/bin/sh reboot-phone Code: #!/system/bin/sh now push to system and chmod Code: adb push reboot-phone /system/bin/reboot-phone Code: chmod 755 /system/bin/reboot-phone Code: reboot recovery now in cwm recovery or another custom recovery mount system data sdcard in cmd window you can calls yours something other C30, I have C30 so my back ups are called C30 Code: adb shell once both backups are made, unmount system and data via recovery. now mount new partitions via adb Code: mount -t ext4 /dev/block/mmcblk1p2 /system make sure they are mounted Code: busybox df -h you should see similar to below, mine already has system and data installed yours don't so Used Available Use will be much different than yours, mount points are what's important here. Code: busybox df -h if mounted correctly, time to install, this will take time, when one finished type command for second one. Code: busybox tar -xzvf /sdcard/C30_system.tgz Now clean up Code: rm -r /cache/* reboot download and install Android Terminal Emulator once done time to test dual boot open Android Terminal Emulator *note you need to give root permission. Code: su to boot from phone open Android Terminal Emulator Code: su on each after fully booted up open Android Terminal Emulator Code: busybox df -h this will show you if you are on phone or sdcard look at the system and data mount points and size. this is from my phone. Code: vampirefo@vampirefo-GA-MA78GM-US2H:~/Desktop$ adb shell this is from sdcard Code: root@hct82_wet_jb5:/ # busybox df -h RE: How to setup dual boot on MTK - Sniper47 - 2014-04-10 Hi Vampire, awesome tutorial. I'm sure there will be more questions, but to start, could you explain some about busybox. This is already installed on the phone or is part of the ADB directory on PC? Or both. And, are the two installs sharing any logical storage? Normally with MTK there is phone storage and internal storage And is there more to come, or this is it for now? RE: How to setup dual boot on MTK - vampirefo - 2014-04-10 RE: How to setup dual boot on MTK - linr76 - 2014-04-10 this absolutely deserves to be stickied... great tutorial, thank you! RE: How to setup dual boot on MTK - Sniper47 - 2014-04-11 RE: How to setup dual boot on MTK - vampirefo - 2014-04-11 (2014-04-11, 16:41)Sniper47 Wrote:I mean. Do the separate installations share the same logical partitions for phone storage? Busybox is installed on the phone or on PC or both as required by this tutorial? Is your custom busybox required or standard busybox can do the job? Busybox is only installed on Phone, any busybox will work for this project, The separate installs don't share settings, each install has it's own settings, install an app or change something on one install wont effect the other install. Now at first when you copy the data partition over both installs will look the same cause they are, you just cloned your install, but any changes after that point will only be on the one you made the change on. Example on my Lenovo a2109 tablet, I Run JB from the sdcard and ICS from phone, these are different OS so they can't share same settings. Another example, you could only install system and not data, you need to make both data and system partition, but just don't Code: busybox tar -xzvf /sdcard/C30_data.tgz Code: busybox tar -xzvf /sdcard/C30_system.tgz, RE: How to setup dual boot on MTK - andreya108 - 2014-04-12 Seems I missed something, but what if cache and dalvik-cache of roms are not compatible? One rom may mount internal fat, other not. Or one may be stock and other are custom like miui or lewa? Or even it can be different android version which also require different radio? RE: How to setup dual boot on MTK - vampirefo - 2014-04-12 (2014-04-12, 22:18)andreya108 Wrote: Seems I missed something, but what if cache and dalvik-cache of roms are not compatible? You could make another ext4 partition for cache if you need one, I have never had problems with dual boots sharing cache. But if your install requires one, just make it. So you would have 4 partitions rather than 3, also you need to change the cache mount from phone to sdcard. dalvik-cache is in data partition, which is not shared with other install.each individual install has it's own, data partition and dalvik-cache, which is in data partition not cache partition. RE: How to setup dual boot on MTK - SO69 - 2014-04-13 Dear vampirefo... great job! I started the process and everything went fine thanks to your detailed explanation although I am very unfamiliar to linux. But I stuck on the use of mtk-tools. I 've download them but I cant use them. I double click on "mkbootimg.exe" and I see a window trying to open but it finally doesn't. Should it be a cmd window? I open a cmd window from the "start" but when I enter [./unpack-MT65xx.pl ./boot.img] it doesn't recognise this command. So I can't unpack and modify the boot.img. Can you please give me some help with this because I 've spend all my night trying to find a solution but with no succes. Thank you in advance. RE: How to setup dual boot on MTK - vampirefo - 2014-04-13 (2014-04-13, 14:25)SO69 Wrote: Dear vampirefo... great job!Yes the upacking and packing commands are typed into terminal, below are scripts I use. Hi, on my pc, ( Linux box) I make scripts to automate the packing and unpacking of boot.img. below are the two scripts I use. copy and paste each, name one script unpack. the other repack set permission, double click unpack Linux will ask what to do with file select run the boot.img will unpack. once you have made your change double click repack, Linux will ask what to do with script select run, the new boot.img will be made. upack Code: #!/bin/bash repack Code: #!/bin/bash On xda, michfood has posted some scripts for windows users, to unpack mtk boot.img. Perhaps these might work for you better. |