[Sony Xperia P, U, Sola, Go] AGONTUK:
Hello Guys,

This is my first thread in XDA and probably the most important one too. As the title says, I would like to introduce the awesome multiboot capabilities of Xperia U, Sola, Go, P developed by our favourite dev munjeni :D. Here is the original thread

http://xdaforums.com/showthread.php?t=2418241

. Go there & give thanks to him for this awesome feature.

So, What is Multiboot ?

Ever got tired of flashing ROM again & again because of bootloop or to choose a good ROM?? Well news flash, now u don't have to. U can install multiple operating system in your ROM just like you do in your computer. Don't like the new ROM? Just switch your ROM to previous one with just a click. No flashing, wiping needed. The secondary ROM will be loaded from the sdcard partition.​

WARNING: Your warranty is already void. You will do this at your own risk. Me or XDA will take no responsibility if you brick your device while attempting to do these.

Requirements

ADB connection. Please check if you can connect adb in normal mode, recovery mode, fastboot mode. It's mandatory.

Rooted phone with unlocked bootloader

Any text editor except notepad, microsoft word or wordpad.

It is recommended to edit all files in PC with text editors and with unix/utf-8 format.

Brain & Brave heart :)

This is a step by step guide to enable multiboot intended for all users including noobs like me :cool:. The whole process is divided into several parts. First I'll guide you to boot your current rom (primary rom) through boot menu. Then I'll cover how to boot the second rom.

So, Let's Get Started !!!!

Booting Into Primary/Current ROM​

Part 1: Configure BootMenu Settings

So, the basic is this: when you power on your device, a menu will appear containing the list of ROMs' you have installed in your device. You browse it and select which ROM you want to boot. Then it'll be loaded. Pretty simple, eh ? But how will this menu figure out which ROM you have in your device? That's right, we have to define them.

Create a folder named "bootmenu" in your sdcard

Inside the folder, create a file named "settings.ini"

Now say you have stock JB 4.1.2 installed. So create a folder inside "bootmenu" named "StockJB". Also we have to create another folder "recovery" so that we have cwm recovery in Boot.

Don't use space while naming the folder. Otherwise bootmenu will show error at startup.

Now we have to edit the settings.ini file. Copy it to desktop and open it with text editor. Write these code....

[rom-1]
menutitle=Stock JB
kernel=/sdcard/bootmenu/StockJB/zImage
ramdisk=/sdcard/bootmenu/StockJB/initrd.gz
cmdline=[COLOR="Red"]your_cmdline[/COLOR]
[rom-2]
menutitle=CWM Touch Recovery
kernel=/sdcard/bootmenu/recovery/zImage
ramdisk=/sdcard/bootmenu/recovery/initrd.gz
cmdline=[COLOR="Red"]your_cmdline[/COLOR]

Let's explain these. "menutitle" is the name that'll appear in the menu when you power on the device. kernel, ramdisk, cmdline will be extracted from the boot.img that is provided with the ROM. More info about extracting them will be discussed later. You can see that in the kernel,ramdisk we have to set the path to the StockJB and recovery folder we created earlier. There are 2 rom settings for stock jb & recovery. If you want to have more ROM, you have to add another rom settings here. "cmdline" is kernel command line. You can find it when you extract boot.img or kernel.elf (see part 2). Open it with editor and copy-paste the whole text in your_cmdline. Now, ROM1 here will be the default rom i.e if you don't select any rom to load in 10 seconds, bootmenu will automatically load the ROM1 defined here :good:. After you're done editing simply overwrite the settings.ini with your new settings.ini in bootmenu folder. That's the end of first part. We'll come back to these folder again later.

Part 2: Extracting boot.img

Now we'll dive into more complex steps. We'll extract the kernel(zImage) and ramdisk(initrd.gz) from the boot.img that is provided with the rom.zip package. We'll need some tools to do that. Download the

image_tools.rar

from download section. Extract the files and copy them to your /system/bin folder. Make sure to give them permission 755 or rwx r-x r-x. Reboot your phone to apply the changes.

Now extract your current ROMs' boot.img and copy it to /data/local/tmp folder. Now connect your phone with pc, establish adb connection and follow the given code:

adb shell
su
cd /data/local/tmp
mkdir boot
kernel_dump ./boot boot.img

this will dump kernel(zImage), ramdisk(initrd.gz) and cmdline to your /data/local/tmp/boot folder. For elf based kernel, just change the boot.img with kernel.elf.

Part 3: Ready the ROM For Booting

We will be using ramdisk(initrd.gz) only from the dumped folder since the kernel(zImage) inside it is not kexec patched!!! (If zImage is kexec patched, then use that one rather than from download section). Download the

zImage, bootmenu, recovery ramdisk

from download section. Extract it, you will find zImage inside it along with another initrd.gz and a modules folder. Copy both zImage & initrd.gz from the downloaded folder and paste it in /sdcard/bootmenu/recovery folder that you created earlier. Now copy the recently dumped initrd.gz from /data/local/tmp/boot to /sdcard/bootmenu/StockJB that you created. For zImage copy the appropriate one for ICS/JB from downloads and paste in here. The folder structure will look like these:

/sdcard/bootmenu

Stock_JB

initrd.gz (from /data/local/tmp/boot folder)

zImage (from downloads)

recovery

initrd.gz (from downloads)

zImage (from downloads)

settings.ini

Note: When custom kernel with kexec patch will be released, you will use zImage, initrd.gz from that kernel.

We're nearly there. Only two thing remains. Since we'll use munjenis' JB kernel(zImage) or DevSwift1s' ICS kernel we need to flash the proper module for that kernel. Otherwise wifi & other module will not work. So copy the modules from modules folder and paste it in /system/lib/modules folder. Give them permission 644 or rw- r-- r--. Now you have to flash the boot_menu.img to get the menu at startup. That's simple, download the boot_menu.img from download section and flash it by fastboot.

That's it!!! Your current ROM (primary rom) is ready for booting. Reboot your device and you'll enter bootmenu. You'll find options for your Stock JB and CWM Touch Recovery. Simply select your rom and you'll boot into your Primary ROM :laugh::laugh:. Your bootmenu will look like these except you'll have Stock JB option (I'm using SlimBean & CM 10.1 :D).

Downloads

​

::Credits::​

[MENTION=4120742]munjeni[/MENTION] bro for this awesome feature in our awesome device. ALL HAIL MUNJENI

[MENTION=4318865]DevSwift1[/MENTION] for providing ICS kexec patched kernel

[MENTION=4913184]percy_g2[/MENTION] for his work on Xperia P

Me, for writing this guide :)