[Proof of concept] Everything2SD
The basic idea of this mod is moving all partitions to the SD card, and running the full OS from the SD card.
There are many reasons why not to do this and probably is a bad idea, but the main reason behind this mod is just a proof of concept that can potentially result in a better internal and external memory utilization and speed improvements.
Reasons I can think of for not doing this:
- Reduced responsiveness and overall speed.
- Over stress on the SD card that can potentially leed to permanent damage to the card.
- The need to use modified boot and recovery images, thus leading to an install incompatible with any rom update (as it is) out there.
- Reduced battery autonomy.
- Many more I can't think of right now.
Reasons to do this:
- Because we can.
- As a proof of concept.
- For developing purposes.
- We get the ability to switch between 2 installations just by switching the SD card (of the same rom or roms with compatible boot images: kernel+ramdisk).
Don't do any of this if you don't know what you are doing!!!
Simplified steps (I've only tested this with Mik's CM7 (betas 6.2 and 6.3) + ClockWorkMod recovery on a Ubuntu machine):
- Download and flash ClockWorkMod recovery.
- Download and flash Mik's CM7.
- Do a full backup from recovery.
- Turn the phone off.
- Take out the SD card and put it on a Card reader on your PC.
- Backup the SD Card contents (including the full backup).
- Use Gparted (or any partition manager that has support for ext4 partition creation) to create the following partition structure:
num mount point size type
1: /sdcard REST fat32
2: /data 500M ext4
3: /system 190M ext4
4: /cache 64M ext4
The partition number is important, so you should calculate the fat32 partition beforehand or resize the existing one.
- Put new boot and recovery images on the fat32 partition. *
- Put the card on the phone and boot into recovery.
- Mount the sdcard trough menu.
- Connect the phone to your pc and start adb shell.
- Flash custom boot and recovery images:
flash_image boot /sdcard/boot-everything2sd.img
flash_image recovery /sdcard/recovery-everything2sd.img
- Reboot recovery.
- Through menu, mount all partitions.
- Connect trough adb shell and copy your data:
cp -a /int-cache/* /cache/
cp -a /int-system/* /system/
cp -a /int-data/* /data/
- In adb shell, remove the sd_ext mount script:
- Reboot the phone.
Off course, no other method of storing the apps on the SD is desired as they are already there.
* I've attached custom boot and recovery images for Mik's CWM and CM7 beta 6.2 (updated boot images to Mik's CM7.02 beta 6.3 in post #3), but, the steps for creating them are next:
- Extract the original images (boot.img
) from the root of the downloaded zips (signed-recovery.zip
- Unpack the images following this guide: HOWTO: Unpack, Edit, and Re-Pack Boot Images: Alternative Method
(Perl scripts are attached, you'll need compiled mkbootfs
for your OS).
- On recovery ramdisk, change the etc/recovery.fstab
file as follows:
# mnt pnt fstype device [device2] [fstype2]
/boot mtd boot
/cache ext4 /dev/block/mmcblk0p4
/data ext4 /dev/block/mmcblk0p2
/misc mtd misc
/recovery mtd recovery
/sdcard vfat /dev/block/mmcblk0p1 /dev/block/mmcblk0 ext4
/system ext4 /dev/block/mmcblk0p3
/int-cache yaffs2 cache
/int-data yaffs2 userdata
/int-system yaffs2 system
- On boot ramdisk, change the init.rc
file as follows (diff output):
ignacio@ignacio-laptop:~/Descargas/bootimages$ diff boot.img-orig_ramdisk/init.rc boot.img-ramdisk/init.rc
< export SD_EXT_DIRECTORY /sd-ext
< mkdir /sd-ext 0771 system system
< mount yaffs2 mtd@system /system
< mount yaffs2 mtd@system /system ro remount
< mount yaffs2 mtd@userdata /data nosuid nodev
< mount yaffs2 mtd@cache /cache nosuid nodev
> mount ext4 /dev/block/mmcblk0p3 /system
> mount ext4 /dev/block/mmcblk0p3 /system ro remount
> mount ext4 /dev/block/mmcblk0p2 /data nosuid nodev
> mount ext4 /dev/block/mmcblk0p4 /cache nosuid nodev
- Recreate the ramdisks and images following the guide posted above, changing the mkbootimg
command line to (notice the base and cmdline parameters; for recovery, change boot to recovery on all instances):
mkbootimg --base 0x12800000 --cmdline 'mem=471M console=ttyMSM2,115200n8 androidboot.hardware=thunderg' --kernel boot.img-kernel --ramdisk boot.img-ramdisk.gz -o boot-new.img