I have developed this for froyo dual-booting, but I think it's worth a separate thread, because this can be used for any other android(in fact, I think for any linux os).
A little summary of the functions:
- It supports up to 20 OS’s on SD Card
- If there is at least one installed, a boot loader comes up before recovery and let you choose which OS you want to manage.
- If there isn't, the recovery for internal memory comes up
- Every OS can be managed by the recovery
- That means you can install update packages, wipe data and cache, make and restore backups on any of the installed Operating Systems.
- You can choose between operating system in recovery without having to reboot
- You can boot every OS, except the internal one, with the Boot menu.
My idea behind this, is to use the standard android init as a second init inside recovery. In other words, the android system will start inside the recovery system.
Source:
The required changes for initramfs can be found here: Xmister's i5700-leshak-initramfs at froyo - GitHub
And the recovery changes here: Xmister's i5700-leshak-recovery2 at master - GitHub
And here is a precompiled kernel by myself(for Odin): Xmister_PDA.tar at master from Xmister's i5700-leshak-kernel - GitHub (View raw to download)
The changes in recovery was started by mik_os, and almost completely rewritten by me.(Different idea, different functionality.)
Some kind of "specification":
If you want to create a new boot line in the menu, you should create a directory for it on SD-card with the following structure:
Code:
data.img - Recommended ext4 FS and completely free
system.img - Recommended ext4 FS and should contain the system files of the new OS
init.sh - Explained later
init.rc - Delete mount commands for system,data and sd card, and replace "symlink /mnt/sdcard /sdcard" with "symlink /sdcard /mnt/sdcard"(for froyo)
Then add a line of the directory name to /sdcard/.bootlst
Example shell command:
Code:
echo "froyo" >> /sdcard/.bootlst
Example of init.sh:
Code:
#!/xbin/ash
LOG="boot_os.log"
mknod /dev/loop0 b 7 0
echo $? > $LOG
mknod /dev/loop1 b 7 1
echo $? >> $LOG
echo "Mounting data..." >> $LOG
mount -t ext4 -o loop,rw,noatime,nodiratime,nosuid,nodev,data=ordered,barrier=1 data.img /data
echo $? >> $LOG
echo "Mounting system..." >> $LOG
mount -t ext4 -o loop,ro,noatime,nodiratime,nosuid,nodev,data=ordered,barrier=1 system.img /system
echo $? >> $LOG
cp init.rc /init.rc
echo $? >> $LOG
Note: Don't forget the cp init.rc /init.rc !
The Method of the booting:
0. User selects which OS to manage. (running update zips, formatting, etc).
1. After the finish of managing, the user selects "Boot <os>" menu, where <os> is the name of the os 
2. Recovery runs init.sh inside the given directory, and waits until it's finish.
3. Recovery executing /init_new, which is a standard android init and thus capable of booting a system inside recovery with the actual init.rc (Which has been overwritten for the session by init.sh).
Bookmarks