[Galaxy S II Original Android Development] droidphile:
Dual Booting FAQs

Here are some dual-boot faqs. Some answers may not be 100% true at present since Gokhan is still working on enhancing dual-booting and implementing all the placeholder features in touch recovery dual boot options.

1) So what's dual booting?

A. Option to boot into either two ICS roms - aosp or sammy. Immediately after boot logo is displayed, you will have a 3 seconds time-out where you can boot into secondary rom by pressing the home key. To boot into primary rom, wait for 3 seconds time-out to complete. If you don't like to wait - touch the screen, or press a volume key, or press power key during time-out.

2) What's the basic architecture behind dual booting?

A. Any rom will have /system, /data, /cache partitions and requires a kernel to boot. Primary rom has all these partitions on the same location as if you were single-booting. Secondary rom uses a hidden partition (/dev/block/mmcblk0p9) to be used as /system (it's /dev/block/mmcblk0p12 for primary rom). Second rom uses sdcard to store /data and /cache partitions. They're stored in /sdcard/.secondrom directory as mountable ext4 block device images (data.img and cache.img).

Kernel partition is shared, so same kernel boots both the roms. If you switch from Siyah to a different kernel dual booting will not be available even though you have a clone of secondary rom. Internal sdcard, ofcourse external plastic sdcard, /efs, /emmc, other kernel related virtual filesystem directories, etc are shared among roms.

3) I have just one rom now. How do i setup one more rom to dual boot?

A.

-To use current rom as primary: Assuming the other rom is downloaded and copied to phone memory

i) Flash latest Siyah that supports dual boot.

ii) Nandroid backup your existing rom.

iii) Full wipe, install the rom you need to dual boot into.

iv) Boot into that rom, perform initial setups, flash whatever zip you need to flash on that rom - gapps, themes, mods, etc. (Because after setting up dual boot you don't have an easy way to flash zips onto second rom. Remember /system and /data partitions are different for both roms)

v) Flash latest siyah on this rom.

vi) Boot into recovery, under dual-boot options, select "Clone Primary ROM to Secondary". Be patient and wait about 6-7 minutes.

vii) Within recovery, restore nandroid backup.

viii) Just to be sure, flash latest Siyah again.

-To use current rom as secondary: Assuming the other rom is downloaded and copied to phone memory

i) Flash latest Siyah that supports dual boot.

ii) Boot into recovery, under dual-boot options, select "Clone Primary ROM to Secondary".

ii) Without exiting recovery, Full wipe, install the rom you need to use as primary rom.

iii) Boot into that rom, perform initial setups.

iv) Flash latest Siyah just to be sure.

Now you have two roms. Press home key to boot into second rom when time-out is shown.

4) How much time was it to clone a rom?

A. There's /system, /data/ and /cache to clone. 2 GB data + 103mb cache + 513 mb system = 2.6 gb

Shell prompt read speed = 7mb per second.

Total Time = 2.6*(1024/7) = 380 secs = 6/7 minutes.

5) If i reboot to recovery from power-off state using 3 button method, to which rom's recovery it's booted into?

A. Unified kernel, same recovery. And remember - flashing zips to second rom is not possible.

6) Any solution to flashing zips to secondary rom?

A. Not until secondary rom is "converted" to primary rom. If you know what the updater script in the zip is doing, you can do that manually using Root Explorer (replacing/copy files, setting permissions, etc).

Else, temporarily make secondary rom the primary rom. Goto recovery, dual-boot options, "Clone Secondary Rom to Primary". Now your second rom becomes primary rom. Flash your zips. When you're done, restore nandroid backup of the other rom to make it primary as before.

7) Should i have same versions of kernels on both roms?

A. Flash kernel from any rom. Both uses the same kernel partition anyway.

8) Will i get a prompt to dual-boot if i'm not using dual boot, as in i haven't cloned any rom to use as secondary?

A. NO

9) I don't like waiting for 3 seconds to boot into primary rom.

A. Touch the screen immediately upon prompt.

10) How do i swap primary and secondary roms?

A. Goto recovery, dual-boot options, "Backup secondary rom"

Under original Backup and Restore option, "Backup" to backup your primary rom.

"Restore as secondary rom" or "Restore as secondary rom from internal sd" and select the nandroid backup of what was actually your primary rom.

Then under original Backup and Restore option, "Restore" to restore the rom you backed up as secondary.

11) USB mass storage works?

A. Only external sd is mounted for second rom atm. MTP will work for internal sd also. Both will be mounted for primary rom.

12) If i had the same /data partition shared between roms, i could use same apps on both roms.

A. Data partition can not be shared as they're incompatible between roms. (Sometimes dev asks you to perform full wipe even if you're switching between versions of the same rom right). Even if they were shared, separate dalvik caches has to be used and hence every boot will take a long time to rebuild dalvik.

13) How to undo dual booting?

A. Use "Remove secondary rom" from dual-boot options in recovery.

14) How to remove secondary rom if "remove secondary rom in recovery" fails for some reason?

A. Format /system2 directory partition, remove data.img and cache.img under /sdcard/.secondrom directory manually by booting into primary rom.

15) How to upgrade primary rom?

A. As usual, goto recovery, wipe whatever you need to wipe and install the new version.

16) How to upgrade secondary rom?

A. Temporarily convert secondary rom to primary (like explained above), install new version and revert primary back to secondary.

17) How to replace secondary rom with another?

A. Perform the steps to setup dual boot as if you had only one rom which is going to be used as primary rom.

18) How to replace primary rom with another?

A. Normal procedure - wipe, install from recovery.

19) Can i have both aosp roms/both samsung roms/first aosp, second samsung/first samsung,second aosp?

A. Yes

20) Can i have one GB rom and second ICS rom?

A. No

21) Why?

A. Kernel partition is shared between roms. Dual boot functionality is implemented in ICS kernel. ICS kernel can run only ICS roms.

22) Are init.d scripts and extweaks profiles shared across the roms so that i can make changes by booting into any rom and the other rom automatically inherits the settings?

A. NO. Roms have differet /system partitions so different init.d directories. Roms uses different /data partitions and extweaks profiles are stored under /data/.siyah. So you gotta configure both separately. Initramfs scripts are shared anyway since both rom uses the same kernel.

23) So if at all i format /sdcard, my second rom is gone?

A. Yes

24) Is the size of /system partition of secondary rom re-sizable from user space?

A. NO

25) Can i have different kernels for the two roms?

A. NO

26) What're the options under dual-booting in touch recovery?

A. i) View Status

Displays secondary rom info if found.

ii) Clone Primary ROM to secondary

First time, you will have only one rom. You may clone it as secondary rom (so that another rom can be used as primary by nandroid restoring)

iii) Clone secondary rom to primary

Whatever has been cloned as secondary rom is cloned to primary rom.

iv) Remove secondary rom

Deletes /system, /data and /cache partitions of second rom. You will have normal booting.

v) Backup secondary rom

Nandroid backup secondary rom to external sd.

vi) Restore as secondary rom

Restore any nandroid backup as secondary rom from external sd.

vii) Backup secondary rom to internal SD

Nandroid backup secondary rom to internal sd.

viii) Restore as secondary rom from internal sd

Restore any nandroid backup as secondary rom from internal sd.

ix) init second rom data

Initialize /data parition of secondary rom to resize the partition to make it bigger in case you run out of space for apps. Init also wipes all the data in /data partition. So your existing apps in secondary rom will be gone.

x) wipe second rom davik cache, xi) wipe second rom cache, xii) fix permissions in second rom - self explanatory