[HTC One SV] Modding.MyMind:
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.

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.

Requirements:

Device SPECIFIC boot.img and custom recovery.img

A text editor of the sorts - I use Quoda Code Editor

A Class 6 or better SDCard (I am talking about the external)

Partition Table from the Play Store

Working roms for your device

A compression tool (I use ZArchiver from the Play Store)

AParted (SD Card Partition) from the Play Store

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):

# mount point	fstype	device	[device2]

/boot	emmc	/dev/block/mmcblk0p20
/cache	ext4	[COLOR="darkred"]/dev/block/mmcblk0p36[/COLOR]
/data	ext4	[COLOR="darkred"]/dev/block/mmcblk0p37[/COLOR]
/devlog	ext4	/dev/block/mmcblk0p25
/misc	emmc	/dev/block/mmcblk0p22
/int_sd	vfat	/dev/block/mmcblk0p38
/recovery	emmc	/dev/block/mmcblk0p21
/sdcard	vfat	/dev/block/mmcblk1p1	/dev/block/mmcblk1
/system	ext4	[COLOR="darkred"]/dev/block/mmcblk0p35[/COLOR]

to this

# mount point	fstype	device	[device2]

/boot	emmc	/dev/block/mmcblk0p20
/cache	ext4	[COLOR="red"]/dev/block/mmcblk1p4[/COLOR]
/data	ext4	[COLOR="red"]/dev/block/mmcblk1p3[/COLOR]
/devlog	ext4	/dev/block/mmcblk0p25
/misc	emmc	/dev/block/mmcblk0p22
/int_sd	vfat	/dev/block/mmcblk0p38
/recovery	emmc	/dev/block/mmcblk0p21
/sdcard	vfat	/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.