FORUMS
Remove All Ads from XDA

[W-I-P][DEVELOPMENT] Dual / Multi Boot Project: Devs Only

13,194 posts
Thanks Meter: 39,785
 
Post Reply Email Thread
{ LONG POST WARNING }


{ NOT FULLY WORKING YET}


{ NEEDS A LOT OF FURTHER DEVELOPMENT }




Hey everyone I had thought of making this Dual Booting system work along side recovery… because initially (with FreeX10-alpha) it was not possible to have both recovery & dual boot...

Thank you zdzihu & jerpelea for your great work on FreeX10-alpha, which booted off SDCARD… I got inspiration to try and make this work for FreeX10-beta4 based on the amazing work that u guys did! Thank you jerpelea for all your feedback on my repeated messages when I was testing this a few months back (hope I didn’t bother u too much with questions :P )...

zdzihu & jerpelea u are truly LEGENDS!!!



[This is just my personal opinion] Really hoping that some devs can take interest in this to provide compatible files (ramdisks, system files) for this to work… may be as an add-on to their main roms… please don’t keep bothering devs to create ramdisks for booting off SDCARD… they are already very busy trying to make our X10 better with faster and stable ROMS/MODS/etc… this is just an additional feature…





The basic idea was to use the chargemon booting scripts provided in FreeX10-alpha and to try and make FreeX10-beta4 to boot off SDCARD…


Initially I used the img files which came with FreeX10-alpha and wiped the image to then put FreeX10-beta4 on it… while doing so I realized that all of the symbolic links were not getting copied correctly (obviously)… so I started from scratch with blank ext2fs images…
Later I thought of using clean/base nandroid/recovery backups as they are already working/preconfigured system of FreeX10-beta4…



Following is a small How-To on converting NANDROID/RECOVERY images (with yaffs fs) to ext2 fs images keeping the symlinks intact!!

I have used Ubuntu for these steps.

I have attached blank_files.7z which contains precompiled ext2fs images:
  1. system.img [size: 256 MB]
  2. data.img [size: 512 MB]
  3. cache.img [size: 128 MB]

To resize or create newer ext2fs images:
[APP] Windows: Create Your Own Data.img Maker Application, +/- From Existing data.img

U can use the commands provided there even in linux to create/resize these images...


We will keep the NANDROID images at:
Code:
/home/user/nandroid_imgs/test1/
and EXT2 FS images at:
Code:
/home/user/ext2fs_imgs/test1/
while temporary mounts points will be made at:
Code:
/home/user/mntpts/

We will be using unyaffs from here:
[How-To] Extracting/Accessing Recovery/Nandroid backup (.img) files


Extracting files from the nandroid/recovery backups:

Code:
cd /home/user/nandroid_imgs/test1

mv system.img /home/user/nandroid_imgs/test1/system/
cd /home/user/nandroid_imgs/test1/system/
sudo unyaffs system.img
mv system.img ../.

mv data.img /home/user/nandroid_imgs/test1/data/.
cd /home/user/nandroid_imgs/test1/data/
sudo unyaffs data.img
mv data.img ../.

mv cache.img /home/user/nandroid_imgs/test1/cache/
cd /home/user/nandroid_imgs/test1/cache/
sudo unyaffs cache.img
mv cache.img ../.

Loop mounting ext2 fs files:

Code:
sudo mount -t ext2 -o loop,rw,noatime,nodiratime /home/user/ext2fs_imgs/test1/system.img /home/user/mntpts/system/
sudo mount -t ext2 -o loop,rw,noatime,nodiratime,nosuid,nodev /home/user/ext2fs_imgs/test1/data.img /home/user/mntpts/data/
sudo mount -t ext2 -o loop,rw,noatime,nodiratime,nosuid,nodev /home/user/ext2fs_imgs/test1/cache.img /home/user/mntpts/cache/

Recursively copy all files (preserving symlinks) from extracted yaffs images to mount points

Code:
sudo cp -r -p /home/user/nandroid_imgs/test1/system/* /home/user/mntpts/system/.
sudo cp -r -p /home/user/nandroid_imgs/test1/data/* /home/user/mntpts/data/.
sudo cp -r -p /home/user/nandroid_imgs/test1/cache/* /home/user/mntpts/cache/.

Unmount the mounts:

Code:
sudo umount /home/user/mntpts/system/
sudo umount /home/user/mntpts/data/
sudo umount /home/user/mntpts/cache/

Ok now that the ext2fs iamges are populated with working files copy them onto SDCARD…
I have placed it at:
Code:
/sdcard/FreeX10
lets move on to the chargemon script...

This is, as of now, based off xRecovery chargemon (modified from FreeX10-alpha)
Code:
#!/system/bin/busybox sh

# modified chargemon for recovery + dual boot from NAND/SDCARD

	/system/bin/charger

	cat /dev/input/event2 > /dev/keycheck&
	sleep 3
	kill -9 $!

	# intact recovery
	if [ -s /dev/keycheck ]
	then

	# remount rootfs rw
	mount -o remount,rw rootfs /

	# Umount MTDs
	umount -l /data
	umount -l /cache

	# Extract recovery
	cd /
	rm -r /sbin
	rm -f etc
	tar -xf /system/bin/xrecovery.tar

	# Umount system
	umount -l /system

	chroot / /init

	fi


       	echo "check if reboot into SDCARD OS was called"
	if [ -e /data/local/tmp/rebootsdcardos ]
	then

       	echo "Booting from SDCARD!"

	# FreeX10-alpha code follows with slight modifications!!!

	# remount rootfs rw
	mount -o remount,rw rootfs /

	busybox chmod 0777 /dev -R
	busybox chown 0.2000 /dev/oncrpc -R
	rm -r /sdcard

	cd /
	mkdir sd
	chmod 777 sd
	rm init*
	rm logo.rle
	rm default.prop
	tar -xf /system/bin/sdcardos_ramdisk.tar

	# Umount system,data,cache
	umount -l /system
	umount -l /data
	umount -l /cache

	# Check and mount SD Card
	dosfsck -y /dev/block/mmcblk0p1
	sleep 5
	mount -t vfat -o rw,noatime,nodiratime /dev/block/mmcblk0p1 /sd
	sleep 5
	
	# Mount system and data ext2 images
	losetup /dev/block/loop1 /sd/FreeX10/system.img
	sleep 5
	losetup /dev/block/loop2 /sd/FreeX10/data.img
	sleep 5
	losetup /dev/block/loop3 /sd/FreeX10/cache.img
	sleep 5
	e2fsck -y /dev/block/loop1
	e2fsck -y /dev/block/loop2
	e2fsck -y /dev/block/loop3
	mount -t ext2 -o rw,noatime,nodiratime /dev/block/loop1 /system
	sleep 5
	mount -t ext2 -o rw,noatime,nodiratime,nosuid,nodev /dev/block/loop2 /data
	sleep 5
	mount -t ext2 -o rw,noatime,nodiratime,nosuid,nodev /dev/block/loop3 /cache
	sleep 5

	# zdzihu: hack-fix
	if [ -e /data/data/com.android.providers.telephony/databases/telephony.db ]; then
	/system/bin/chroot / /init
	exit
	fi
	
	# Chroot :)
	chroot / /init
	
	# jump out of chargemon to skip NAND booting
	exit
	fi

	
       	echo "Booting from NAND!"

	# remount rw
	mount -o remount,rw rootfs /

	cd /
	rm -r /sdcard
	rm init*
	rm logo.rle
	rm default.prop
	tar -xf /system/bin/ramdisk.tar

	# zdzihu: hack-fix
	if [ -e /data/data/com.android.providers.telephony/databases/telephony.db ]; then
	/system/bin/chroot / /init
	exit
	fi

	chroot / /init

Recovery is intact so u can get into recovery the normal way… (press/tap back key after seeing SE text logo)

OS on NAND (normal system on MTD) will boot by default…

To reboot into OS on SDCARD issue the following commands in terminal emulator/adb shell:
Code:
touch /data/local/tmp/rebootsdcardos
reboot



NOW the OS should start booting off the SDCARD…

It completes commands in chargemon and then BootAnimation can be seen…

BUT HERE IS THE PROBLEM!

Check LOGCAT here: http://www.mediafire.com/?phxm3uqzp0dzzhb

here is wht J had to say:
Quote:
Originally Posted by jerpelea

as you can see in logcat
1.your prelink is not ok
2.you don't have something ok in initrd
3.you dont have all permisions ok on data


From my limited understanding we yet have to make a proper ramdisk (sdcardos_ramdisk.tar)… I feel the init.rc file has to be changed especially the following line (based off FreeX10-beta4 ramdisk):
Code:
mount yaffs2 [email protected] /system rw remount
mount yaffs2 [email protected] /data nosuid nodev
mount yaffs2 [email protected] /cache nosuid nodev



As for Multi-Booting:


We can keep adding different sections to chargmeon:
Code:
/data/local/tmp/rebootsdcardos1 
/data/local/tmp/rebootsdcardos2
etc…
OR
possible solution for having both recovery and dual boot


and similarly keep adding ramdisks in NAND /system:
Code:
sdcardos1_ramdisk.tar
sdcardos2_ramdisk.tar
etc
So we can have as many OS/ROMs on SDCARD as u have free space… though we need to make specific ramdisks for each…

Hope this was slightly useful… and waiting for feedback from advance users on how we can get this working....
Attached Files
File Type: 7z blank_files.7z - [Click for QR Code] (136.4 KB, 48 views)
The Following 14 Users Say Thank You to DooMLoRD For This Useful Post: [ View ] Gift DooMLoRD Ad-Free
30th April 2011, 01:15 PM |#2  
ImS0Raw's Avatar
Senior Member
Thanks Meter: 654
 
Donate to Me
More
Lol, you're working very hard Doom! Keep going!
30th April 2011, 01:20 PM |#3  
Neo.'s Avatar
Senior Member
Flag Gods Own Place
Thanks Meter: 124
 
Donate to Me
More
Doom! You are making enormous progress and helping a lot with Other Devs.

A Combination of a good rom and one of these additional Dual Boot would make x10 better than any Android mobile SE could deliver.

Thank you and I really pray to give SE a run for their money!
30th April 2011, 03:03 PM |#4  
BULL3TPR00F's Avatar
Senior Member
Flag Toronto
Thanks Meter: 150
 
More
for someone thats always saying hes not a developer you sure as hell seem to know what your doing!

Keep up the great work, i hope to see this working flawlessly that would be awesome to be able to dual boot.

Whats the next steps in the project?
30th April 2011, 04:34 PM |#5  
DooMLoRD's Avatar
OP Inactive Recognized Developer
Flag Pune
Thanks Meter: 39,785
 
Donate to Me
More
Quote:
Originally Posted by BULL3TPR00F

for someone thats always saying hes not a developer you sure as hell seem to know what your doing!

Keep up the great work, i hope to see this working flawlessly that would be awesome to be able to dual boot.

Whats the next steps in the project?

well i am not exactly a ROM developer and dont know much about how to compile libs/sources/etc...



next step is that we need to make compatible system files & ramdisk (init.rc) for dual booting
30th April 2011, 04:50 PM |#6  
Senior Member
Thanks Meter: 80
 
More
Quote:
Originally Posted by DooMLoRD

well i am not exactly a ROM developer and dont know much about how to compile libs/sources/etc...



next step is that we need to make compatible system files & ramdisk (init.rc) for dual booting

You may not be a rom developer but your an amazing commited x10 modder

Sent from my X10i TripNMiUI using XDA App
30th April 2011, 07:06 PM |#7  
Senior Member
Flag Bangalore
Thanks Meter: 321
 
Donate to Me
More
Quote:
Originally Posted by DooMLoRD

well i am not exactly a ROM developer and dont know much about how to compile libs/sources/etc...



next step is that we need to make compatible system files & ramdisk (init.rc) for dual booting

I am also excited buddy..... Once i get through my experiments i will surely like to focus on this as this will allow us to have more then one version of ROM on one machine.
30th April 2011, 07:21 PM |#8  
Senior Member
Flag Bangalore
Thanks Meter: 321
 
Donate to Me
More
Based on your first post
all i can get is we are getting the boot animation but not going after that.

i would suggest following things based on my experiments with ubuntu work.

use loops above 10 coz i suspect some loops are already in use during my ubuntu boot i am watching that loop7 is already created so i would suggest avoiding it.

also as we have been adding debug "we have reached here" style code can we do the same here that might help us.

also can we find any debug-able place i mean place where we can track the progress to get the position inside the rom so that we can understand except logcat where we are.
8th May 2011, 01:00 PM |#9  
Senior Member
Flag Bangalore
Thanks Meter: 321
 
Donate to Me
More
any progress or hurdles buddy.....

i am eager to test this .....
8th May 2011, 01:15 PM |#10  
DooMLoRD's Avatar
OP Inactive Recognized Developer
Flag Pune
Thanks Meter: 39,785
 
Donate to Me
More
Quote:
Originally Posted by anantshri

any progress or hurdles buddy.....

i am eager to test this .....

sorry man havent had time to do any further testing for this... have been very busy with some personal work and kernel manager scripts...
The Following User Says Thank You to DooMLoRD For This Useful Post: [ View ] Gift DooMLoRD Ad-Free
8th May 2011, 03:04 PM |#11  
Achotjan's Avatar
Senior Member
Flag Marseille
Thanks Meter: 11,642
 
Donate to Me
More
Quote:
Originally Posted by DooMLoRD

sorry man havent had time to do any further testing for this... have been very busy with some personal work and kernel manager scripts...

Keep up the good Work Doom. ! and thx for your work
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes