New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
ilarrain
Old
(Last edited by ilarrain; 26th April 2011 at 04:43 AM.)
#1  
Senior Member - OP
Thanks Meter 98
Posts: 118
Join Date: Dec 2010

 
DONATE TO ME
Default [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:
Code:
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:
Code:
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:
Code:
adb shell
cp -a /int-cache/* /cache/
cp -a /int-system/* /system/
cp -a /int-data/* /data/
- In adb shell, remove the sd_ext mount script:
Code:
rm /system/etc/init.d/05mountsd
- 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 and recovery.img) from the root of the downloaded zips (signed-recovery.zip and cyanogen_thunderg-ota-eng.mik.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 and mkbootimg for your OS).
- On recovery ramdisk, change the etc/recovery.fstab file as follows:
Code:
# 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):
Code:
ignacio@ignacio-laptop:~/Descargas/bootimages$ diff boot.img-orig_ramdisk/init.rc boot.img-ramdisk/init.rc 
22d21
<     export SD_EXT_DIRECTORY /sd-ext
68,69d66
<     mkdir /sd-ext 0771 system system
< 
100,103c97,100
<     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):
Code:
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
Attached Files
File Type: zip perl-scripts.zip - [Click for QR Code] (2.5 KB, 32 views)
File Type: zip everything2sd-bootimages.zip - [Click for QR Code] (7.71 MB, 52 views)
 
franciscofranco
Old
#2  
franciscofranco's Avatar
Recognized Developer
Thanks Meter 48963
Posts: 10,784
Join Date: Dec 2010
Location: Mountain View, CA

 
DONATE TO ME
Ahaha another sleepless night ahead to test this out. Any Quadrant Advanced I/O score for comparison?
franco.Kernel - Galaxy Nexus
franco.Kernel - Nexus 4
franco.Kernel - Nexus 7
franco.Kernel - Nexus 10


Google+ | Twitter | Portfolio

CruzerLite franco.Kernel case for the Nexus 4
CruzerLite franco.Kernel case for the Galaxy Nexus

You don't like my reply? Read this

However, if you put any trust in Quadrant scores you could use them to prove that dancing naked for 5 minutes in your garden affects device performance. By Chainfire
 
ilarrain
Old
#3  
Senior Member - OP
Thanks Meter 98
Posts: 118
Join Date: Dec 2010

 
DONATE TO ME
I've updated boot images to Mik's CM7.02 beta 6.3, attached below.

I'm going to run a Quadrant Advanced and let you know. Anyway, I don't think I will get good results, as my SD card is cheap and buggy, half the time it doesn't get mounted, with or without this mod. Also, I think we'll get better scores with your tweaks, especially with the modded libsqlite.so.

The idea behind this is not to get impressive results or leave it as a definitive mod (as it is right now). Instead, the idea I have is to start moving some things back to the internal memory, for instance, mounting mtd@userdata as /data/dalvik-cache (just an idea). Basically, leaving the things that need fast reading times, but infrequent writes in the SD, and the things that are constantly being written to, in the internal memory.
Attached Files
File Type: zip everything2sd-bootimages.zip - [Click for QR Code] (7.69 MB, 45 views)
 
franciscofranco
Old
#4  
franciscofranco's Avatar
Recognized Developer
Thanks Meter 48963
Posts: 10,784
Join Date: Dec 2010
Location: Mountain View, CA

 
DONATE TO ME
Seems awesome. I already booted up perfectly with the modded .imgs, no issues.
franco.Kernel - Galaxy Nexus
franco.Kernel - Nexus 4
franco.Kernel - Nexus 7
franco.Kernel - Nexus 10


Google+ | Twitter | Portfolio

CruzerLite franco.Kernel case for the Nexus 4
CruzerLite franco.Kernel case for the Galaxy Nexus

You don't like my reply? Read this

However, if you put any trust in Quadrant scores you could use them to prove that dancing naked for 5 minutes in your garden affects device performance. By Chainfire
 
cmangalos
Old
#5  
Senior Member
Thanks Meter 10
Posts: 254
Join Date: Nov 2010
Location: Cardona, Rizal
so what class of sd card do you preffer?
still class 4 above?
well, sorry about what im going to say , but if **** happened and luckily sd card got corrupted, then the phone does as well?
ive not read all of your first post,
but if ever we are changing sd cards, like example upgrading from 4g-8g,
is it necessary to repeat the whole process or copy paste is enough?(i bet not due to ext)
 
theb3s7
Old
#6  
Senior Member
Thanks Meter 20
Posts: 130
Join Date: Jul 2010
Location: Bucharest
Quote:
Originally Posted by cmangalos View Post
so what class of sd card do you preffer?
still class 4 above?
well, sorry about what im going to say , but if **** happened and luckily sd card got corrupted, then the phone does as well?
ive not read all of your first post,
but if ever we are changing sd cards, like example upgrading from 4g-8g,
is it necessary to repeat the whole process or copy paste is enough?(i bet not due to ext)
If **** happened you could mount it in a computer with a card reader and perform a disk check + recovery. If the sd card broke, well.. I think there's still hope, since you may boot in recovery and replace the mount points back to the internal memory ( right ? )

As for the storage upgrade, well, it's not exactly copy-paste but you should be able to duplicate the partitions without much hassle..
HTC One X
 
Bytecode
Old
#7  
Bytecode's Avatar
Recognized Developer
Thanks Meter 4369
Posts: 2,496
Join Date: Dec 2010
Location: /dev/null
I really like this idea,we could get 3000+ quadrant score

But can be potentially dangerous. If anything goes wrong i think that Phone can't boot anymore.
Bytecode - fourteen years-old experienced developer.

My devices:
  • LG-P500 (qcom msm7x27t, mdpi, codename: thunderg)
  • Xperia T (msm8x60a, xhdpi, codename: mint)



Quote:
I respect GPL and other people - you can find all my sources at github.com/BytecodeX
Quote:
I am a androidarmv6 contributor - helping old legacy devices get a better Android experience. https://github.com/androidarmv6
 
sarfaraz1989
Old
#8  
Senior Member
Thanks Meter 42
Posts: 566
Join Date: Jan 2011
Location: New Delhi
how abt two separate roms in 6 separate partitions ???? is the bootloader cracked ??? Can we have a grub like menu to select two roms ???Way 2: Maybe somebody cud mod android's initramfs and add options there to select two different fstabs ...just a thought
 
d3s3rt_eagle
Old
#9  
Senior Member
Thanks Meter 123
Posts: 282
Join Date: Jan 2011
a dual boot would be cool... one rom on the internal nand memory and the other on SD card...
 
Bytecode
Old
#10  
Bytecode's Avatar
Recognized Developer
Thanks Meter 4369
Posts: 2,496
Join Date: Dec 2010
Location: /dev/null
Having fastboot disabled is such a pain in the ass...
Bytecode - fourteen years-old experienced developer.

My devices:
  • LG-P500 (qcom msm7x27t, mdpi, codename: thunderg)
  • Xperia T (msm8x60a, xhdpi, codename: mint)



Quote:
I respect GPL and other people - you can find all my sources at github.com/BytecodeX
Quote:
I am a androidarmv6 contributor - helping old legacy devices get a better Android experience. https://github.com/androidarmv6


XDA PORTAL POSTS

What’s Possible with CASUAL & How to Make Your Own CASUAL – XDA Developer TV

XDA Elite Recognized Developer AdamOutler is known … more

Pearl Chen to Talk NFC Development at XDA:DevCon 2013

From HTML to LEDs or Android to Arduino, Hardware Hacking is a pastime of many people … more

Avoid Framework Bootloops on Xperias Running Jelly Bean

If you’re a Sony device owner running a stock Android Jelly Bean firmware and … more

Forum Added for the Samsung Galaxy Mega

What do you do when the Galaxy Note line is simply not big enough? You get theSamsung Galaxy Mega. … more