This is totally out of date now
new easier and much better way of doing things can be found here
Just wanted to 'get out' what I have been working on the last couple of days, and give back to the community.
This is an intro of my Cache 'Hack'
it was inspired by Speedysilwady's thread [HOW-TO] Flash *MOST* ROMs on Stock/Any SPL
What follows should be considered BETA or even ALPHA.
I don't belive there is any risk of permanent damage to your phone, worst that will happen is a bootloop.
However, any ROM or Hack carries a risk, there could be something I have missed which will destroy your phone after 2 days.
I can't think what that would be, maybe I missed it
So... If your wife is due to go into labour anytime soon, or you need your phone for work/alarm to get up for work.
Don't do it.
Not my fault if it messes up your phone or life..
OK, disclaimer over with...
The Primary goal was to give the guys with 'Stock'SPLs ROMs which normally require 'DangerSPL'
The DangerSPL basically chops /cache down a bit and shares it between /system and /data,
but this is operating on the phones firmware at a lower level, and is risky so people are reluctent to do it.
I have a solution, and as a bounus the 'DangerSPL' guys get an extra 30mb on /system.
The Idea is very simple, utilise the space available on /cache
Below I detail a way of using *all* of /cache in a ROM, without risking a 'brick' ( softbricks excluded )
So, how do we do it?
Well, intially ( in recovery ) I was just moving directories from /system into /cache and symlinking them
This didn't work all that well because of the way the init.rc mounts cache
mount yaffs2 mtd@cache /cache nosuid nodev chown system cache /cache chmod 0770 /cache
mount yaffs2 mtd@cache /cache mount yaffs2 mtd@cache /cache ro remount
I found out what cache is used for
The Market uses cache to save 'incoming' apks, you could say it uses /cache as a cache, lol..
maybe other things use it, I didn't look to hard.
anyway, this is what we do to solve that
# mount mtd partitions # Mount /system rw first to give the filesystem a chance to save a checkpoint mount yaffs2 mtd@system /system mount yaffs2 mtd@system /system ro remount # Firerat 2010-03-22 - Mount Cache in the same way as system # Firerat 2010-03-24 - Market uses /cache, if its full it fails, so... # Firerat 2010-03-24 - mount mtdblock4 on /system, and bind mount to cache in userland script # Firerat 2010-03-24 - /system/bin/data-cache.sh mount yaffs2 /dev/block/mtdblock4 /system/csys chmod 0770 /system/csys/lost+found mount yaffs2 /dev/block/mtdblock4 /system/csys ro remount
#!/system/bin/sh # bind mount /data/cache to /cache - Firerat 2010-03-24 # check /data/cache exists, if not create if [ ! -d /data/cache ]; then mkdir /data/cache fi # check cache is not already mounted if [ "`mount |grep -q \/cache;echo $?`" = "0" ]; then echo "/cache is already mounted.. exiting" exit 1; else busybox mount -o bind /data/cache /cache fi
I could of course do this in the init.rc, but this offers greater flexibility
for instance we could check for ext partition and use that.
(cyanogen) Thanks Cy! & ccyrowski
in the a2sd script which does this with Dalvik-cache
Oh, nearly forgot, since /system/csys is now the new /cache you have to fix your symlinks
Da Dar!, it boots and you can download from the Market ( as long as you have space on data )
Above via a 'ROM flash'
OK, so it's all well and good moving stuff around in recovery,but how do we do this with a 'ROM' flash?
because I can't flash a Requires DangerSPL I can't move things in recovery Grrrr..
Within the ROM package I created a new Directory, cache with sub directory system
and moved things into it, stuff like system/media system/bin system/xbin
upto a Max of 28mb ( ish ) see Partiton table below
I'm linux , so I use a script to quickly show me the sizes
for i in `find $1 -maxdepth 1 -type d|sed -e :a -e '$!N; s/\n/ /; ta'` do du -hs $i done
format CACHE: copy_dir PACKAGE:cache CACHE: show_progress 0.2 0 symlink csys/system/bin SYSTEM:bin symlink csys/system/etc SYSTEM:etc symlink csys/system/media SYSTEM:media symlink csys/system/usr SYSTEM:usr symlink csys/system/xbin SYSTEM:xbin symlink csys/system/fonts SYSTEM:fonts symlink toolbox CACHE:system/bin/start symlink toolbox CACHE:system/bin/getevent < snip > symlink toolbox CACHE:system/bin/renice symlink toolbox CACHE:system/bin/setconsole symlink /system/csys/system/xbin/busybox CACHE:system/bin/sh symlink busybox CACHE:system/xbin/zcip symlink busybox CACHE:system/xbin/zcat symlink busybox CACHE:sys< snip > set_perm_recursive 0 0 0755 0644 SYSTEM: set_perm_recursive 0 0 0755 0644 CACHE:system set_perm_recursive 0 2000 0755 0755 CACHE:system/bin set_perm 0 3003 02755 CACHE:system/bin/netcfg set_perm 0 3004 02755 CACHE:system< snip >
is probably easier to 'see'
Zip it up and sign
and well, thats it really...
flash it, find it won't boot, go to recovery , fix it, boot it , fix package, zip, sign, flash it..
Eventually it boots
I have to admit , I have DangerSPL, and I'm reluctant to revert to stock
Speedysilwady of the thread which inspired me
[HOW-TO] Flash *MOST* ROMs on Stock/Any SPL
has given me some sizes
/system: 67.5M /data: 74.7M /cache: 67.5M
/system: 90M /data: 89.7M /system/csys: 30M
hmm, we have lots of space in cache on a 'none danger spl' and we probably have some room on /system on a 'dangerSPL'
we can move things on firstboot, keeping the 'ROM' compatible with both 'Danger' and 'NonDanger' SPLs
here is an extended version of the mount cache I hastily put together for King's Eris Port
DangerSPL , the 'framework' gets moved to the system partition
NoDanger the 'framework' gets moved to the 'cache' partition
################### # What follows is specific to King Eris Port 1.x.x # mind you the logic will work in any rom ################### if [ -d /system/system-framework ] || [ ! -L /system/framework ]; then exit 0; fi RM_CMD="busybox rm" MV_CMD="busybox mv" CP_CMD="busybox cp" LS_CMD="busybox ls" LN_CMD="busybox ln" MKDIR_CMD="busybox mkdir" MOUNT_CMD="busybox mount" UMOUNT_CMD="busybox umount" SWAPON_CMD="busybox swapon" # nb the df sticks out, toolbox df output is easier to cut up DF_CMD="toolbox df" DU_CMD="busybox du" SED_CMD="busybox sed" GREP_CMD="busybox grep" CUT_CMD="busybox cut" GETPROP_CMD="getprop" SETPROP_CMD="setprop" E2FSCK_CMD="e2fsck" CHMOD_CMD="busybox chmod" CHOWN_CMD="busybox chown" SYNC_CMD="sync" rohardware=`$GETPROP_CMD ro.hardware` if [ -d /data/system-framework ] && [ ! -L /data/system-framework ]; then CsysFree_K=`$DF_CMD|$GREP_CMD \/csys\:|$CUT_CMD -d " " -f6|$SED_CMD s/K//` SysFree_K=`$DF_CMD|$GREP_CMD \/system\:|$CUT_CMD -d " " -f6|$SED_CMD s/K//` SysFramework_K=`$DU_CMD /data/system-framework/|$CUT_CMD -f1` if [ $SysFramework_K -gt "1024" ] && [ $CsysFree_K -gt $SysFramework_K ]; then $MOUNT_CMD -o rw,remount /system $MOUNT_CMD -o rw,remount /system/csys $CP_CMD -a /data/system-framework/ /system/csys/system-framework # being very lazy here, I should look before I leap $RM_CMD /system/framework $LN_CMD -s /system/csys/system-framework /system/framework $SYNC_CMD $MOUNT_CMD -o ro,remount /system $MOUNT_CMD -o ro,remount /system/csys $RM_CMD -rf /data/system-framework exit 0; elif [ $SysFramework_K -gt "1024" ] && [ $SysFree_K -gt $SysFramework_K ]; then $MOUNT_CMD -o rw,remount /system $CP_CMD -a /data/system-framework/ /system/system-framework # being very lazy here, I should look before I leap $RM_CMD /system/framework $LN_CMD -s /system/system-framework /system/framework $SYNC_CMD $MOUNT_CMD -o ro,remount /system $RM_CMD -rf /data/system-framework exit 0; else exit 0 fi fi
I try to keep dalvik-cache on Data, I hope to expand this to both system and user apps.
and with unionfs ( or aufs ) maybe set up something to handle priority apps on internal memory
Currently the Recovery Backups ignore /cache, so after a restore it aint going to boot.
Speedysilwady did say Bart worked for him, not tried it myself
a while back I had a look at the nandroid-mobile.sh in Amon's RA-1.5.2
I think I did see that cache was an option
anyway, I don't think it would take much to 'turn it on'
Edit : 2010-04-16
[UTIL] BART-1.2.0 Backup and Restore Tool
Now has cache backup!
not sure if its packed in a recovery.img yet
- CaNNon's Complete Eclair 1.2
- King's Eris Port 1.1.2 - ( Warez removed - afaik its just the QuickOffice )
Pre Flash Patch
I have played with this before, you can see how I do it in Speedysilwady's thread
[HOW-TO] Flash *MOST* ROMs on Stock/Any SPL
so , my idea is the update script just formats /system and /cache and sets up symlinks from system to cache
making sure we have everything mounted ( mount -a ) we flash the ROM
we then flash a second Patch which re-creates the links, and flashes the boot.img along with supporting scripts.
I'm even toying with the idea of Pathcing a pre-installed system ( to get the extra 30mb )
Not tried this yet, but I think something like this will work
copy_dir SYSTEM:bin CACHE:/system/bin delete SYSTEM:bin symlink csys/system/bin SYSTEM:bin copy_dir PACKAGE:cache CACHE: symlink < all them links > format BOOT: write_raw_image PACKAGE:boot.img BOOT:
and I'll post the ROMs I modded a little later, I shoud check a few things first