Hello Guys,
Here is my last toy, it's a dual boot system for the xperia S:
It lets you start two different kernels with their associated cpio with a third kernel that handles the boot menu and embeds cwm. It works with any kernel, this is not kexec based. As a demo in the video, I have stock firmware on regular partitions on one and cm9 on the other one with loopbacks on internal storage. I'll experiment later on with partitioning to see if we could have two sets of native partitions to make it more comfortable.
As it it's, it's quite rough, but if anyone has interest in it I will release it as it is and try to improve usability.
This is for devs and advanced users only, you would have to fiddle a lot to get the second build to run, you need an arm toolchain to embed both kernels and you have to modify its cpio.
I'm working on tools to flash kernels directly on device, but they're not ready yet. And ideally, CWM would need to be extended to support two environments. Don't expect quick progress, I don't have much free time to work on this.
Here are some details on how it works:
I trimmed down a stock kernel to remove some fat and add a driver to set a specific memory location.
I embed a small assembly loader with this kernel and its cpio plus the other 2.
The tiny kernel is loaded first, it displays the menu and eventually starts cwm. The menu will set the memory location with the kernel choice, then reboot.
At next reboot, the assembly loader will detect the kernel choice and start the appropriate kernel.
So, in fact, you're booting two times, first the small loader, then the real boot.
It adds some boot time, but it's not dramatic. The advantage is that it's easy to build the loader, it's a simple init. Second advantage, the second kernel is running on a "fresh" start, no left-over in memory, no kexec patch to apply, it works with any kernel. Last, cwm can be embedded with the tiny kernel, so it's finally independent from the build kernel.
First a disclaimer: I'm not responsible if you fry your phone using this, it's very experimental and I'm not 100% sure running a build on loopback won't reduce internal flash lifetime. I don't expect problem, but proceed with caution!
* Updates *
2012-09-07: Trimmed kernel uploaded to gitorious here , branch bootloader_kernel, boot menu (FBMenu, thanks to openAOS for initial release!) source added here.
2012-09-06, more details here :
1) on-device kernel flasher attached (kf_v0.1.zip). It let you flash kernel 1 or kernel 2 directly from device (adb from recovery for instance). You must have previously flashed dual.elf in fastboot!
And again, all of this is highly experimental! Be careful.
syntax:
kf [1|2] kernel_zimage_file cpio_file
Source code at: https://gitorious.org/sony-tools/dual_loader_kf
2) Loader source code uploaded to: https://gitorious.org/sony-tools/sony-tools, in dual directory.
2012-09-04:
If you have a 6.1.A.2.45 stock firmware, you can try the setup displayed in the video:
Download package here (mirror) and extract it on your PC.
Copy the 3 ext4 files at the root of the phone internal storage.
Reboot in fastboot mode
Flash dual.elf in fastboot mode with "fastboot flash boot dual.elf".
Reboot with "fastboot reboot"
You should now have the boot menu at each phone start. If you want to get rid of it, just reflash your original firmware kernel.
Note:
- I'm not sure cwm is working completely properly, I barely tested it.
- it may work with another stock firmware version, but the embedded stock kernel is 6.1.A.2.45 one, I'm not sure how it behaves on other builds.
Don't hesitate to give feedback here!
http://forum.xda-developers.com/showthread.php?t=1869487