• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [GUIDE][DEVS] Dual Boot Android Roms

M

ModdingMyMind

Guest
- 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 installed remain intact in their specific rom.

Strictly put forth by Developers for Developers! If you are inexperienced with Android Development then proceed forward with extreme caution! As for the experienced, this will be easy for you.

***DISCLAMER***
I am not responsible for bricked devices, dead SD cards, thermonuclear war, or you getting fired because the alarm app failed. YOU are choosing to make these modifications!

As always, do anything at your own risk. The above warning/disclaimer is only there because unfortuantely there will be someone who messes this up. The following guide will be conducted straight from the phone so if you are more comfortable using a computer then you will need to adapt this guide to your prefered surroundings. Please insure you have multiple ways to go about restoring your device in case you failed to follow the instructions or misunderstood something within the instructions - A Nandroid Backup, and/or RUU, and/or a ROM fitted for your specific device which you can apply via adb sideload.

Credit goes to [MENTION=2863096]dreccon[/MENTION] for bringing this to my attention with a more clear understanding over at his thread,
[GUIDELINES]Dual-Boot on (theoretically) any Android device. He was very helpful to opening my mind and thus putting up this thread. This thread is initially based around working with K2 Variant devices, but I am also aware that this will work on many other devices too.

The following numbers I will be using for partitioning the SD Card is based on maximum used space from a Stock Rom of my own K2_CL device using 4.1.2 Jelly Bean! These numbers are not to be taken literally, so USE COMMON SENSE, and insure you know the sizes for your System, Data, and Cache Partitions!

To determine the proper sizes of your partitions you can use the apk called, Partition Table, mentioned for requirements below. That APK is literally self explanatory so I will not be going over it. You will use this APK to determine the size of each partition and its current format. Do this and take note of them.

The Secondary Rom should be equal to or greater than the Primary Rom OS.



Steps:

  • A. PARTITIONING YOUR SD CARD:
    Plug your memory card (SD Card) in to your computer using either a card reader or by plugging your device in via usb, and copy everything from it over to your PC as we are going to partition your SD Card (which means it WILL be wiped out). Be sure to unmount your device from your pc if plugged in via usb or any other known method.

    Unmount your SD Card on your device by going to, settings > storage > unmount sdcard,on your phone and then proceed to open up the apk, AParted.

    Grant root access when prompted. Decline the "Agreement" because it will just try to install junk. Tap configuration, then tap the drop box under Detected devices. You should see mmcblk0, mmcblk1, and usbdisk. If you don't have both "mmcblk0", & "mmcblk1", then stop here, because either something is wrong on your end or this guide isnt for you. If you do, then select mmcblk1 from the list, tap Save, then OK. Tap TOOLS, you should now see parts 1 through 4. "Part: 1" should say fat32, and say the size in MB of your external SD card. If it does, then tap the checkbox next to "Part: 1", next tap the drop box that says Create, select Delete and tap apply. Once done, all parts should say empty. We're going to create 4 partitions. The first partition is going to be the standard external sd partition that will show up in both roms. Tap Create on the top, tap "+", tap the box with "0MB" in it, set it to the size you want the card to be, keeping in mind, that we need space for the second ROMs' partitions. Repeat these steps for System, Data, and Cache as seen below and once completed you will tap the menu button, and tap Apply changes, when done we are finished with the partition setup.

    • Partition it as followed:
    • First Partition-FAT32 (total memory card size - I recommend at least 20mb or more depending upon the actual size of your SD Card as a whole) <----- SD CARD
      This is the space you will see as your memory card (external sd) in both of your roms (Primary and Secondary).
    • Second Partition-EXT4 (1339mb) <------ SYSTEM
      This will be the System Partition of your Secondary Rom
    • Third Partition-EXT4 (1165mb) <----- DATA
      This is Data Partition of your Secondary Rom, apps will go here
    • Fourth Partition-EXT4 (220mb) <----- CACHE
      You can reduce it a bit more if you want to.



  • B. PREPARING SECONDARY ROM'S ZIP:
    Get the updater-script of the rom you want to dual boot and open it up using Quoda as mentioned in the requirements or with anything else similar to a text editor which won't disrupt the unix coding of that file when you save it later.


    SEARCH FOR-mmcblk0p35 (may vary for different devices, look for "mount("ext4", "EMMC", "/dev/block/mmcblk0p35");" in the updater script in order to know what yours is)
    Replace with-mmcblk1p2

    Save it and move it back to its location in the rom zip (META-INF\com\google\android).
    Note: if there is a data folder in the rom's zip then you also have to replace the data partition block with mmcblk1p3, like: mmcblk0p37-->mmcblk1p3



  • C. PREPARING SECONDARY ROM'S BOOT.IMG:
    Unpack the boot.img of the rom you want to dual boot using the proper unpacking and packing binaries. This can be done using your PC and/or phone. There is also the dsixda Kitchen via Windows using Cygwin and/or Linux. However, my guide will be based on doing this directly from my phone so for those who qualify may use this thread - Unpack, Edit, Repack Boot.img/Recovery.img. Otherwise, you will need to approach this differently.

    You will need to go through all files which are feasible to view and read within the ramdisk of your boot.img.
    • Then find and replace:
    • Find-emmc@system
    • Replace with-/dev/block/mmcblk1p2
    • Find-emmc@userdata
    • Replace with-/dev/block/mmcblk1p3
    • Find-emmc@cache
    • Replace with-/dev/block/mmcblk1p4

    Save all the files that have had these changes made to them and then repack the ramdisk with the kernel to your new dualboot.img.



  • D. PREPARING SECONDARY ROM'S RECOVERY (OPTIONAL IF YOU DON'T WANT TO CHANGE THE SECONDARY ROM AGAIN):
    Unpack the recovery.img like you unpacked your boot.img and open '/etc/recovery.fstab'.

    • Edit from this (May vary with other devices):
      Code:
      # mount pointfstypedevice[device2]
      
      /bootemmc/dev/block/mmcblk0p20
      /cacheext4[COLOR="darkred"]/dev/block/mmcblk0p36[/COLOR]
      /dataext4[COLOR="darkred"]/dev/block/mmcblk0p37[/COLOR]
      /devlogext4/dev/block/mmcblk0p25
      /miscemmc/dev/block/mmcblk0p22
      /int_sdvfat/dev/block/mmcblk0p38
      /recoveryemmc/dev/block/mmcblk0p21
      /sdcardvfat/dev/block/mmcblk1p1 /dev/block/mmcblk1
      /systemext4[COLOR="darkred"]/dev/block/mmcblk0p35[/COLOR]
    • to this
      Code:
      # mount pointfstypedevice[device2]
      
      /bootemmc/dev/block/mmcblk0p20
      /cacheext4[COLOR="red"]/dev/block/mmcblk1p4[/COLOR]
      /dataext4[COLOR="red"]/dev/block/mmcblk1p3[/COLOR]
      /devlogext4/dev/block/mmcblk0p25
      /miscemmc/dev/block/mmcblk0p22
      /int_sdvfat/dev/block/mmcblk0p38
      /recoveryemmc/dev/block/mmcblk0p21
      /sdcardvfat/dev/block/mmcblk1p1/dev/block/mmcblk1
      /system        ext4[COLOR="red"]/dev/block/mmcblk1p2[/COLOR]

    Save the file and repack the modified ramdisk with the kernel as dualrecovery.img.



  • E. MAKING THE UPDATE.ZIP FOR YOUR BOOT.IMG:
    By now, you should have your edited boot.img (dualboot.img) and your edited updater-script. Just place both of them within the Secondary rom zip and you are now good to go to flash and/or share to others (but you better test it prior to sharing it!).



  • F. FLASHING/SWITCHING ROMS:
    Just reboot to your recovery and flash the Secondary rom and after that flash your dualboot.img, unless you have already added it to the rom zip then you wont be required to flash the dualboot.img unless you are S-On.


    To Switch between Roms just reboot to your recovery and flash your Boot for primary rom and DualBoot for secondary rom.
    NOTE: you can literally flash just your stock boot.img and your primary stock rom will appear as if nothing ever happened.

Sent from my C525c using Tapatalk
 
Have you looked into being able to do this without the need to destructively partition the sdcard?

I'm thinking of the way some "safe strap" type recoveries work (note 3 comes to mind)
In that recovery you can create virtual "rom slots" you can switch between as well as flash to the individual slots

THE LINK BELOW IS FOR THE GALAXY NOTE 3 AND WILL NOT WORK WITH OUR PHONE. DO NOT INSTALL THIS ON YOUR PHONE
Link:
http://forum.xda-developers.com/showthread.php?t=2607258
 
I wouldn't say partitioning your sdcard is destructive lol. Would be no different when you wipe your system, data, cache, etc from your custom recovery lol. It's doing the same thing ;-).

I have looked in to it, but I haven't found a solution to making it work for this device. Was reviewing the source a couple months back and decided to leave it alone.
 
I checked out that link you provided and it's initially designed to make room on your internal SD Card partition. That is great, but our device is small in size for that partition and using an external sdcard opens more room for more slots when partitioning it accordingly. Even further, using the external would be safer if by any reason it becomes corrupted. A simple new card and voila. With the internal, the complications could be devastating however, the odds of it happening are VERY small, but regardless the odds are still there.

I will look at the source again. If I come to understand it I will try and bring it to device but I have no intentions of letting it work off of our internal sdcard. Will definitely be the external.
 
To add to this lol, using the guide above, you can actually do more than just a dual boot. If the Sd card has more room you can make three, four or even more slots if applicable and if taken in to consideration, the left over space which the user chooses not to use can be swapped for more ram. :-)
 
But Regardless if using this guide or Safe Strap, the user still has to make a sacrifice on either partition to make room for a slot or slots.
 
I wouldn't say partitioning your sdcard is destructive lol. Would be no different when you wipe your system, data, cache, etc from your custom recovery lol. It's doing the same thing ;-).
I meant "destructive" in the way that partitioning the card wipes its contents. :D:p

With that method you suffer no data loss. (Meaning that you do not need to first backup your card and can easily create/remove ROM slots) It creates a "virtual ROM slot" and doing so doesn't wipe the card (or in the case of the note 3, the internal memory)
 
No, it doesn't. It just takes what is available and uses that while still keeping the pre formatted side of that partition untouched. I'm currently reviewing the source again and it is definitely more clearer to me that I have come a long way with android lol. I am understanding it's operation way better than before. Some methods it is using is rather interesting and has me wanting to experiment some ideas lol.
 
I meant "destructive" in the way that partitioning the card wipes its contents. :D:p
No, it doesn't.
  • A. PARTITIONING YOUR SD CARD:
    Plug your memory card (SD Card) in to your computer using either a card reader or by plugging your device in via usb, and copy everything from it over to your PC as we are going to partition your SD Card (which means it WILL be wiped out). Be sure to unmount your device from your pc if plugged in via usb or any other known method.


  • Come again?
    :confused::confused::confused:
 
Hahaha, I was referring to when you stated that it doesn't wipe the entire partition. I was agreeing with you :-P.
 
I'm thinking of the way some "safe strap" type recoveries work (note 3 comes to mind)
In that recovery you can create virtual "rom slots" you can switch between as well as flash to the individual slots.

Hey Lordvincent 90, so HashCode is abandoning the project for bootstrap/safestrap. He has been hired by Linaro and in order for him to provide for them he had to let go a few things. So, I'm dropping that little project on porting it to our device. No need since it will be dead in no time. He did mention that he hopes to find a maintainer for some of his work but he wasn't sure if it would happen.
 
Back
Top Bottom