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.
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
*note if this commands fails on your phone you need to use another command after adb shell.
*note you should see # if not, you will then need to type su, also if adb remount failed from above, once you see # type mount -o remount,rw / system
open another cmd window
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.
now open /dumchar_info.txt look for bootimg
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
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 to Type hex value here box then copy from Decimal value box to new text file.
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.
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
so now new text file looks similar to below.
Ok now time to pull boot.img from phone, in cmd window, using my dec numbers, use your own numbers if different than mine.
now open another cmd window
close this cmd window, Now you need tools to extract boot.img and rebuild it.
download
to unpack boot.img open cmd window
go to boot.img-ramdisk folder open default.prop in a text editor
edit first line, change below
to and save
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
now make a folder on your sdcard called 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
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
reboot-phone
now push to system and chmod
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
once both backups are made, unmount system and data via recovery.
now mount new partitions via adb
make sure they are mounted
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.
if mounted correctly, time to install, this will take time, when one finished type command for second one.
Now clean up
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.
to boot from phone
open Android Terminal Emulator
on each after fully booted up open Android Terminal Emulator
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.
this is from sdcard
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
busybox tar -czvf /sdcard/C30_data.tgz /data
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
179 97 11363328 mmcblk1p1
179 98 1048576 mmcblk1p2
179 99 3144704 mmcblk1p3
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
mmcblk1p3
bootimg 0x0000000000600000 0x0000000001d80000 2 /dev/block/mmcblk0
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
mmcblk1p3
bootimg 0x0000000000600000 0x0000000001d80000 2 /dev/block/mmcblk0
6291456
30932992
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
30932992÷4096=7552
so now new text file looks similar to below.
Code:
mmcblk1p2
mmcblk1p3
bootimg 0x0000000000600000 0x0000000001d80000 2 /dev/block/mmcblk0
6291456
30932992
1536
7552
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
adb push ./sdcard.img /storage/sdcard0/dual_boot/sdcard.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
if busybox test ! -f /storage/sdcard0/dual_boot/sdcard.img; then
echo no storage/sdcard0/dual_boot/sdcard.img
exit 1
fi
dd if=/storage/sdcard0/dual_boot/sdcard.img of=/dev/block/mmcblk0 bs=4096 seek=7552
sync; sync; sync
echo rebooting to Sdcard
sleep 2
reboot
reboot-phone
Code:
#!/system/bin/sh
if busybox test ! -f /storage/sdcard0/dual_boot/phone.img; then
echo no /storage/sdcard0/dual_boot/phone.img
exit 1
fi
dd if=/storage/sdcard0/dual_boot/phone.img of=/dev/block/mmcblk0 bs=4096 seek=7552
sync; sync; sync
echo rebooting to Phone
sleep 2
reboot
now push to system and chmod
Code:
adb push reboot-phone /system/bin/reboot-phone
adb push reboot-sdcard /system/bin/reboot-sdcard
Code:
chmod 755 /system/bin/reboot-phone
chmod 755 /system/bin/reboot-sdcard
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
busybox tar -czvf /sdcard/C30_system.tgz /system
busybox tar -czvf /sdcard/C30_data.tgz /data
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
mount -t ext4 /dev/block/mmcblk1p3 /data
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
Filesystem Size Used Available Use% Mounted on
tmpfs 231.1M 48.0K 231.1M 0% /dev
/dev/block/mmcblk0p6 123.1M 4.1M 119.0M 3% /cache
/dev/block/mmcblk1p2 1021.4M 509.3M 460.9M 52% /system
/dev/block/mmcblk1p3 3.0G 656.3M 2.2G 23% /data
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
busybox tar -xzvf /sdcard/C30_data.tgz
Now clean up
Code:
rm -r /cache/*
rm -r /data/dalvik-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
reboot-sdcard
to boot from phone
open Android Terminal Emulator
Code:
su
reboot-phone
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
root@hct82_wet_jb5:/ # busybox df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 231.1M 52.0K 231.1M 0% /dev
tmpfs 231.1M 0 231.1M 0% /mnt/secure
tmpfs 231.1M 0 231.1M 0% /mnt/asec
tmpfs 231.1M 0 231.1M 0% /mnt/obb
/emmc@android 689.8M 475.1M 214.7M 69% /system
/emmc@usrdata 1008.3M 590.4M 417.9M 59% /data
/emmc@cache 123.1M 4.1M 119.0M 3% /cache
/emmc@protect_f 8.9M 4.1M 4.8M 46% /protect_f
/emmc@protect_s 8.9M 4.1M 4.8M 46% /protect_s
/dev/block/loop0 1.2M 1.2M 0 100% /mnt/cd-rom
/dev/block/vold/179:8
1.7G 3.3M 1.7G 0% /storage/sdcard1
/dev/block/vold/179:97
10.8G 5.2G 5.6G 48% /storage/sdcard0
/dev/block/vold/179:97
10.8G 5.2G 5.6G 48% /mnt/secure/asec
this is from sdcard
Code:
root@hct82_wet_jb5:/ # busybox df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 231.1M 52.0K 231.1M 0% /dev
tmpfs 231.1M 0 231.1M 0% /mnt/secure
tmpfs 231.1M 0 231.1M 0% /mnt/asec
tmpfs 231.1M 0 231.1M 0% /mnt/obb
/dev/block/mmcblk1p2 1021.4M 509.3M 460.9M 52% /system
/dev/block/mmcblk1p3 3.0G 682.0M 2.2G 23% /data
/emmc@cache 123.1M 4.1M 119.0M 3% /cache
/emmc@protect_f 8.9M 4.1M 4.8M 46% /protect_f
/emmc@protect_s 8.9M 4.1M 4.8M 46% /protect_s
/dev/block/loop0 1.2M 1.2M 0 100% /mnt/cd-rom
/dev/block/vold/179:8
1.7G 3.3M 1.7G 0% /storage/sdcard1
/dev/block/vold/179:97
10.8G 5.2G 5.6G 48% /storage/sdcard0
/dev/block/vold/179:97
10.8G 5.2G 5.6G 48% /mnt/secure/asec
If you use my scripts or work in your own scripts, your scripts or license should reflect that.
ZTE Open C
ZTE Open C