Android is one of the biggest platforms in the world for both smartphones and tablet compared to Apple iOS, Blackberry and even Window mobile. Lately, dual booting is getting more common among Android users and have you ever wonder what dual booting is all about?



What is dual boot?
Dual boot is a feature specially for several big kernel developers which are willing to take the trouble to get that fixed in your release. In other words, dual boot feature is a method where you can run your android smartphone with two different roms without needing to reflash or reinstall. And yes, this means that you can easily install two roms at the same time!

Imagine you want to have:

1. Sammy rom now. Want to use aosp as secondary.
2. Sammy rom now. Want to use aosp as primary.
3. Aosp rom now. Want to use sammy as secondary.
4. Aosp rom now. Want to use sammy as primary.

What you need to install dual boot feature?

1. Flash latest siyah (at the moment only Siyah has dual boot option)
2. Flash alternate recovery provided by GokhanMoral.
3. Have any sammy rom zip downloaded.
4. At least 90% battery left (optional but recommended).
5. 2 GB free on internal SD (at least).

Here is how you do it the right way:

1) Present sammy, setup aosp as secondary:-
Method 1:
i) Reboot to recovery. Clone 1st rom to 2nd rom. (Sammy is now secondary as well as primary)
ii) Flash ICS rom with a full wipe. Boot to the rom. Reboot to recovery.
iii) Full wipe and install the JB aosp.
iv) Swap 1st Rom and 2nd Rom in recovery.
OR
Method 2:
i) Nandroid backup sammy rom.
ii) Flash ICS rom with a full wipe. Boot to the rom. Reboot to recovery.
iii) Full wipe and install the JB aosp.
iv) Clone 1st Rom to 2nd Rom in recovery.
v) Restore the nandroid of sammy rom.

2) Present sammy, setup aosp as primary:-
Carry out first three steps in Method 1

3) Present aosp, setup sammy as secondary:-
i) Nandroid backup your aosp rom.
ii) (Without exiting recovery) Full wipe and install sammy rom. Boot to rom.
iii) Reboot to recovery. Clone 1st Rom to 2nd rom in recovery.
iv) Flash ICS rom with a full wipe. Boot to the rom. Reboot to recovery.
v) Restore nandroid of aosp rom.

4) Present aosp, setup sammy as primary:-
Carry out steps as above, then swap 1st rom and 2nd rom from recovery.

NOTE: Makes sure to flash your zips (themes/scripts/mods/apps) to your second rom before cloning it to secondary using "clone 1stRom to 2ndRom" option. And flash Siyah again after setting up db, just to be sure.

4. "How to boot into primary rom?"
A. Wait for the 3 second timeout or press volume up to skip 3 second timeout.

5. "How to boot into secondary rom?"
A. During the 3 second timeout, press volume down or power button.

6. "Is kernel partition shared?"
A. Yes. Same kernel boots both roms.

7. "If I flash another kernel (that doesn't support db) do I lose dual booting?"
A. Yes

8. "I lost dualbooting after flashing another kernel. I didn't do anything to second rom files in sdcard/.secondrom. How can I get db back?"
A. Just flash the latest Siyah.

9. "Will there be any performance degradation on the rom used as secondary?"
A. NO

10. "Will my phone run slow overall because of db?"
A. NO

11. "How to flash a newer version of 1st rom?"
A. As usual, just flash it from recovery.

12. "How to flash newer version of 2nd rom?"
A. Swap 1st and 2nd rom in recovery, flash the newer version, swap again.

13. "I miss the recovery I used before, so much.."
A. After you have setup dual booting, you can odin flash any recovery you like. It won't break dualbooting. But when you wanna play with db settings later on, you need GM's alternate recovery.

14. "User apps of 1st rom are automatically available for second rom?"
A. NO. However, if you had backed them up using Titanium Backup or similar apps, just restore apps while on second rom.

15. "I wanna keep separate backup for apps in both the roms, since I use one Rom for say entertainment and other productivity."
A. Setup different backup directory in Titanium Backup in 1st and 2nd rom.

16. "I don't see Stweaks app in second rom."
A. Delete /system/.siyah/stweaks-installed file in 2nd rom. Reboot to second rom.

17. "Do I need to anything special before flashing a newer Siyah?"
A. NO. Just flash kernel as tar or in recovery - whichever you used to do. Kernel image is copied to the unified kernel partition.

18. "How can I run same STweaks settings of 1st Rom in 2nd Rom?"
A. While on 1st rom, copy /data/.siyah/default.profile to /data/media/data/.siyah directory.

19. "How do I remove everything related to DB and run single boot again?"
A. Delete .secondrom directory in /data/media while on 1st Rom.

20. "DB architecture?"
A. Like you know, every rom has a /data, /system, /cache partition and a kernel to boot.
For primary rom, it's
mmcblk0p12 = /data
mmcblk0p9 = /system
mmcblk0p8 = /cache
And these won't change whether you're single booting or dual booting.

For secondary rom, data and system is stored in internal sd, cache in hidden partition. Note that internal sd in our device is mounted to /data/media.
We have data as a directory, System as an image in data/media/.secondrom. Cache in mmcblk10 which is hidden partition and not used otherwise.

- When second rom is booting, second rom data is bind mounted to mmcblk0p12 as /data/
- data/media/.secondrom/system.img partition is mounted as /system.
- mmcblk0p10 is mounted as /cache.

21. "If second rom files are kept in /data/media, will wiping data in recovery erase second rom files?"
A. NO. /data/media is skipped in CWM recovery.

Credits goes to droidpile for the hard work for this tip from XDA forum