[HACK][ROM][BOOT.IMG][CACHE]-Stk SPL ROMs with Danger SPL size & extra 30mb! any SPL!

Search This thread

Firerat

Senior Member
Feb 24, 2009
3,848
185
[HACK][ROM][BOOT.IMG][CACHE]-Stk SPL ROMs with Danger SPL size & extra 30mb! any SPL!

###########################
EDIT: 2010-06-24
This is totally out of date now :)
new easier and much better way of doing things can be found here
http://xdaforums.com/showthread.php?t=704560
###########################

Hi All,

Just wanted to 'get out' what I have been working on the last couple of days, and give back to the community.

Introduction
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
Code:
    mount yaffs2 mtd@cache /cache [b]nosuid nodev[/b]                                                   
    chown system cache /cache                                                                           
    chmod 0770 /cache

nosuid nodev, resrticts what it can be used for

so,,
Code:
    mount yaffs2 mtd@cache /cache
    mount yaffs2 mtd@cache /cache ro remount
got around that, basically I mount /cache in the same way as system

Next problem,
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

Code:
# 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

and here is the userland script ( be sure to get init.rc to execute it )

Code:
#!/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
hmm, I should check permisions on that, could have sworn I had a chmod in it

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.
ref
(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
i.e. cache/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
Code:
for i in `find $1 -maxdepth 1 -type d|sed -e :a -e '$!N; s/\n/ /; ta'`                         
do                                                                                             
du -hs $i                                                                                      
done

then in the update-script
Code:
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 >

symlink /system/csys/system/bin SYSTEM:bin
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 :)


Partition Tables
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

Code:
/system: 67.5M
/data: 74.7M  
/cache: 67.5M

and here are the totals for mine, DangerSPL'd
Code:
/system: 90M                                  
/data: 89.7M                                  
/system/csys: 30M

Further movement

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

Code:
###################
# 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 actally use this same free space checking logic in my modified a2sd when it comes to moving dalvik-cache
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


Backups
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

Coming soon

Example ROMs
  • 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

Code:
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:



So, Enjoy
and I'll post the ROMs I modded a little later, I shoud check a few things first

Firerat
 
Last edited:

Firerat

Senior Member
Feb 24, 2009
3,848
185
Cache Hack Modded ROMS ( demo )

As Promised a couple of Modded ROMs to showcase my 'Hack'
Please note the disclaimer in the OP under introduction

Full Credit for these ROMs goes to the Original DEVs , namely CaNNon202 and King

First up we have CaNNoN's Complete Eclair
original link CaNNoN202 Complete Eclair [v1.2]
as I'm sure many of you will know this was the ROM I made the 3D YouTube Patch for,
This is that ROM , Repackaged in Full
i.e. 3D Kernel, HQ Youtube/ mp4 along with the fixes for the WiFi FC and Facebook contact sync.

This should work fine as a *no wipe* update to a current CE12
if you have problems then do a wipe
Change log
  • system apps now on system
  • Gallery3D
  • New Camera.apk
    The Camera.apk removes duplicate Gallery Icon in the Tray, and I have disabled video recording, since it didn't work anyway and most of the time cause freeze and FC )
  • new (rw/ro)system scripts
    they know about the new cache thing
  • data-cache.sh
    bind mount cache, runs on boot
  • modified a2sd
    MT3G friendly, will skip apps to SD and setup swap automagically
    additionally will keep Dalvik-cache on data if space available* keeping apps fast
  • oem-reset script
    I neglected to mention, data wipe in recovery will kill the ROM (it wipes cache) , so I made a script to clear personal data
* if you get space low messages, try a cache cleaner from the Market
if you still have problems delete apps you don't need
still not enough space? either reboot phone, or run a2sd from terminal
but a Reboot / a2sd run will move cache to SD if available

Guys, I have left Launcher2 in this, but I really wouldn't recommend using it with 3D

################################
### Download ### since CE2.0 is now CacheHack AnySPL link has been removed
################################
MD5SUM = 97dfb9756bb553cf3cb42519483da3cc
################################

NOTE this is *not* CE 2.0


Second up Yet another King's Eris Port Mod
original link King's Eris2G1 v1.1.2
Change Log
  • 2010-03-28 12:40 gmt - bug fix
    fixed the issue with the framework not being moved on NoneDangerSPL
    no more space warning, and Market works
  • system apps now on system
  • new (rw/ro)system scripts
    they know about the new cache thing
  • data-cache.sh
    bind mount cache, runs on boot, additonally moves system framework when 'SPL Known'
  • modified a2sd
    MT3G friendly, will skip apps to SD and setup swap automagically
    additionally will keep Dalvik-cache on data if space available* keeping apps fast
  • QuickOffice removed (Warez)
    ( FAO Mods, I hope I'm right in thinking that QO was the only Warez )
* if you get space low messages, try a cache cleaner from the Market
if you still have problems delete apps you don't need
still not enough space? either reboot phone, or run a2sd from terminal
but a Reboot / a2sd run will move cache to SD if available

tbh I haven't tested this as a no wipe,
Data is 66MB so you might get away with it if you are on DangerSPL

################################
### Download ###FR-KingErisP-112-CacheHack_S.zip
################################
MD5SUM = 735cde1f21e14b91ad20d65a7009c569
################################

Its probably going to get all confusing with two ROMs in one thread
These are intended as examples of what can be done with cache

we know that things like footprints don't work so try to keep on topic with posts
i.e. relating to the using cache for system files

if it does get too confusing I will perhaps give each its own thread.
but again, on topic would be nice :)
Cheers
 
Last edited:

Firerat

Senior Member
Feb 24, 2009
3,848
185
Very Quick install instructions ( Danger Only, sorry NoneDanger, manual patching further down post )

First install Vega's Legend 0.9.0, boot that, then flash the You Tube Fixes, boot that

Then Flash
FR-VegaLegend091-CH_S.zip
You can try flashing all three at once, but for some reason you don't get a mobile data connection, no idea why.

As well as being CacheHack the above includes Loccy's KB Lights
http://xdaforums.com/showthread.php?t=661343
be sure to drop by and thank them all
They are also working on a better solution, I believe the final solution will be within the system framework
But for now a while loop script will do ;)

Edit : [UTIL] BART-1.2.0 Backup and Restore Tool
Now has cache backup!

Patching a fresh Vega Legend 0.9.1 DangerSPL

Fresh flash of Vega's Legend 0.9.0 with the 0.9.1 fixes over the top
Code:
Filesystem                Size      Used Available Use% Mounted o
n
/dev/block/mtdblock3     90.0M     89.5M    560.0K  99% /system
/dev/block/mtdblock5     89.8M     48.4M     41.4M  54% /data
/dev/block/mtdblock4     30.0M      1.2M     28.8M   4% /cache
a quick size up tool
Code:
[quote]
adb push Patch/cache/system/bin/qdu.sh /sbin/
[/quote]
Code:
chmod 755 /sbin/qdu.sh

its setup with a sha bang for an android ROM, to get it to work in recovery
Code:
sed s~system/~s~  /sbin/qdu.sh -i


now qd<tab><enter>
will show you the size of the directories of the directory your in
or
qd<tab>/syst<tab>
will show you the size of everything in /system ;)

in an other term on your PC
Code:
[quote]adb shell watch "busybox df -h"[/quote]

will let you keep an eye on the space being used and avalilabe to you

ok, so lets begin
mount everything
Code:
mount -a

first we need to create a mount point for mtdblock4
Code:
mkdir /system/csys

and then we need to bind mount /cache to it

Code:
busybox mount -o bind /cache /system/csys

ok, lets start moving stuff
Code:
/ # qdu.sh /system/
86.3M	/system/
89.5K	/system/csys
1.3M	/system/xbin
2.1M	/system/usr
1.0K	/system/sd
2.8M	/system/media
[COLOR="Red"]44.4M	/system/lib [/COLOR]
19.6M	/system/framework
5.3M	/system/fonts
2.6M	/system/etc
2.8M	/system/customize
5.3M	/system/bin
2.0K	/system/lost+found
lib is too big for DangerSPL
lets just move some of the other stuff and see what happens

Code:
cd /system/
mkdir csys/system
for i in usr/ xbin/ media/ fonts/ etc/ customize/ bin/;do
mv $i csys/system/
done
Code:
Filesystem                Size      Used Available Use% Mounted on
/dev/block/mtdblock3     90.0M     65.7M     24.3M  73% /system
/dev/block/mtdblock5     89.8M     48.4M     41.4M  54% /data
/dev/block/mtdblock4     30.0M     24.9M      5.1M  83% /system/csys
were still short of space on system
Code:
qdu.sh /data/
46.9M	/data/
46.0M	/data/app_s
954.0K	/data/app
Code:
mv framework/ /data/
lets stick a few apps on /system/csys

after using
ls /data/app_s/ -Slh
I'm going to pick these
Code:
mv /data/app_s/Phone.apk csys/system/app/
mv /data/app_s/Mail.apk csys/system/app/
then move the system apps to system
Code:
mv /data/app_s/ app

and now, before we forget create links
Code:
ln -s csys/system/* .
cd app/
ln -s ../csys/system/app/* .
cd ../
ln -s /data/framework .[code]

now get the boot.img onto the phone and use
Code:
flash_image boot /sdcard/boot-cachehack.img
don't forget the kernel modules
Reboot, and you done.......

Patching Vega Legend 0.9.1 NoneDanger SPL
you guys have a harder and at the same time easier task in getting a sense ROM onto your phone, essentially you have more space available, but you can't flash direct.
you going to need to unzip the ROM on your PC , and have a look at the sizes
Decide what you need to put on cache, and make links
see lib and framework in the DangerSPL Walkthrough?
44.4M /system/lib
19.6M /system/framework
1.3M /system/xbin
65.3 mb right there
so in recovery
Code:
mount /system
rm -r /system/*
mkdir /system/sd
mount -a
mkdir /system/csys
mount -o bind /cache /system/csys
for i in lib framework xbin ;do
     install -d /system/csys/system/$i
done
ln -s /system/csys/system/* /system/

now, on your PC zip up the ROM, don't sign it
get it onto your sdcard

Code:
unzip /sdcard/rezippedROM.zip system data -d  /
that will unzip everything beginning with system and data to the / directory
when lib, framework xbin hit the links we made, they will end up on cache :)

links, a messy business
but I have a script for that
Code:
unzip /sdcard/rezippedROM.zip META-INF -d /data/

now, attachced is NoneDangerDIY-linksandperms.txt
( Edot 2010-04-19 Fixed the script so it works in recovery )
get that onto your sdcard and
Code:
sh /sdcard/NoneDangerDIY-linksandperms.txt
( Tip sh /sd<tab>/None<tab> )
this will translate the ROM's update-script links and permissions into unix commands, it spits them to screen and should save them in memory

do
Code:
cat /dev/install.sh
to make sure its there
then
Code:
sh /dev/install.sh

Ok, next is kernel Modules
the zip above ( FR-VegaLegend091-CH_S.zip ) contains the directories
sdcard/kernels/
and in that are 3D and RamHack kernels
choose one and
cp -a /sdcard/kernels/<kernel>/system to /system/
flash_image boot /sdcard//kernels/<kernel>/boot.img

other files, in cache/system/bin are
a2sd
rwsystem
rosystem
data-cache.sh
qdu.sh

Do not install a2sd, its modified to patch Danger, it might do strange things, I didn't think about NoneDanger when I was doing it :)

copy the others to /system/bin/
an then
Code:
chmod 755 /system/bin/*system

Last thing, system app_s
Code:
df
du /data/app_s
hopefully the du for app_s is less than the df of /system
if so
Code:
mv /data/app_ /system/app

if not, then use the same trick as I did for DangerSPL , and link an app from /system/csys/system/app to /system/app/

I think you will be ok though

Oh, nearly forgot , in cache/system of the zip is a file called patch
cp that to /system/
its Loccy's KB lights


yeay , woo hoo, were done
Code:
reboot

Hope that this is useful,
I know its still awkward for NoneDanger, soon I will try to make it a doddle for a dev zip up a ROM which is truly ready for AnySPL, and maybe optimise for mt3g

Coming sometime in the future..
I will do some more work on NoneDanger Sense I'm hoping to do a generic Patch to detect which SPL and install optimised for Danger, NoneDanger , and maybe I figure out something that will improve things for MT3G
 

Attachments

  • NoneDangerDIY-linksandperms.txt
    3.2 KB · Views: 33
Last edited:

bubonik

Senior Member
Apr 19, 2006
348
6
Portland
So im trying to do something a little different. I am trying to transfer my Dalvik-cache from /cache to /system. Is there a way to do it after the rom is installed and functioning?
 

Firerat

Senior Member
Feb 24, 2009
3,848
185
So im trying to do something a little different. I am trying to transfer my Dalvik-cache from /cache to /system. Is there a way to do it after the rom is installed and functioning?

in a word, no

at the moment a2sd puts dalvik-cache on the SD card partition 2 ( if ext2,3,4)
via a bind mount
if no ext2,3,4 partition it remains on data

the above hack will not affect /data/dalvik-cache or the bind mount
but the partition /dev/block/mtdblock4 ( /cache now /system/csys )
will be 'full'

Anything going into /cache will go into the bind mount instead
in the original post I bind mount to /data/cache
but as I mentioned, we can bind mount any directory to /cache
I didn't look at what else uses cache, as far as I know nothing else does

putting dalvik-cache on /system is going to cause a few problems.
/system is mounted (ro) by init.rc , and tbh it should stay ro unless we really need to do something to the system files, Dalvik-cache needs to be writable

I mentioned my modified a2sd and Dalvik-cache

I commented out this
Code:
# bind mount dalvik-cache so we can still boot without the sdcard
    busybox mount -o bind /system/sd/dalvik-cache /data/dalvik-cache;    
    busybox chmod 1000:1000 /data/dalvik-cache;                          
    busybox chmod 771 /data/dalvik-cache;

and insterted this

Code:
        DalvikCache

DalvikCache ()
{             
# doubt they are going to change, but shoud set the 'paths' as variables
        DataTotal_K=`$DF_CMD|$GREP_CMD \/data\:|$CUT_CMD -d " " -f2|$SED_CMD s/K//`
        DataFree_K=`$DF_CMD|$GREP_CMD \/data\:|$CUT_CMD -d " " -f6|$SED_CMD s/K//` 
        DataDalvik_K=`$DU_CMD /data/dalvik-cache/|$CUT_CMD -f1`                    
# Pickup min free on data from config in future                                    
        Min_Data_Free_MB=10                                                        
        Buffer_K=`expr $Min_Data_Free_MB \* 1024`                                  
        DataApp_K=`$DU_CMD /system/app/|$CUT_CMD -f1`                              
        System_App_K=`$DU_CMD /data/app/|$CUT_CMD -f1`                             
if [ -d /system/sd/dalvik-cache ];                                                 
then                                                                               
        SD_Dalvik_K=`busybox $DU_CMD /system/sd/dalvik-cache|$CUT_CMD -f1`         
else                                                                               
        SD_Dalvik_K="0"                                                            
fi                                                                                 

if [ ! -d /system/sd/dalvik-cache ] && [ "$DataDalvik_K" -lt "1024" ] && [ "`expr \( $DataApp_K + $System_App_K \) \/2`" -lt "$DataFree_K" ];                                                                                                   
then                                                                                                                    
        DalvikToIntMem                                                                                                  
else                                                                                                                    
        # if DalvikCache + a bit is too big, move to SD card                                                            
        if [ "`expr $DataDalvik_K + $Buffer_K`" -gt "`expr $DataFree_K + $DataDalvik_K`" ];                             
        then                                                                                                            
                DalvikToSdCard                                                                                          
        else                                                                                                            
                if [ "`expr "$SD_Dalvik_K" + "$Buffer_K"`" -lt "$DataFree_K" ];                                         
                then                                                                                                    
                DalvikToIntMem                                                                                          
                fi                                                                                                      
        fi                                                                                                              
fi                                                                                                                      
DalvikComplete                                                                                                          
return                                                                                                                  
}                                                                                                                       

DalvikToIntMem ()
{                

if [ -d /system/sd/dalvik-cache ];
then                              
        $MKDIR_CMD /data/dalvik-cache-temp    
        $CHOWN_CMD 1000:1000 /data/dalvik-cache-temp
        $CHMOD_CMD 771 /data/dalvik-cache-temp      
        $CP_CMD -a /system/sd/dalvik-cache/* /data/dalvik-cache-temp/
        $UMOUNT_CMD /data/dalvik-cache                               
        $RM_CMD -rf /data/dalvik-cache                               
        $MV_CMD /data/dalvik-cache-temp /data/dalvik-cache           
        $RM_CMD -rf /system/sd/dalvik-cache                          
else                                                                 
        if [ ! -d /data/dalvik-cache ];                              
        then                                                         
        $MKDIR_CMD /data/dalvik-cache                                
        fi                                                           
        $CHOWN_CMD 1000:1000 /data/dalvik-cache                      
    $CHMOD_CMD 771 /data/dalvik-cache                                
fi                                                                   
return                                                               
}                                                                    

DalvikToSdCard ()
{                
                        $MKDIR_CMD /system/sd/dalvik-cache/
                        $CP_CMD -a /data/dalvik-cache/* /system/sd/dalvik-cache/
                        $RM_CMD /data/dalvik-cache/*                            
return                                                                          
}                                                                               

DalvikComplete ()
{                
        if [ -d /system/sd/dalvik-cache ] && [ "`$MOUNT_CMD |$GREP_CMD -q "/data/dalvik-cache";echo $?`" != "0" ];
        then                                                                                                      
                $MOUNT_CMD -o bind /system/sd/dalvik-cache /data/dalvik-cache;                                    
        fi                                                                                                        
                $CHOWN_CMD 1000:1000 /data/dalvik-cache;                                                          
                $CHMOD_CMD 771 /data/dalvik-cache;                                                                
return                                                                                                            
}

oh, in the 'header' I have things like
MKDIR_CMD="busybox mkdir"
DF_CMD="toolbox df"

you can see that while we have space I keep the dalvik-cache bytecode on the fast internal memory, unless space is limited, in which case bind mount to sd partition2 as per Cyanogen's original script
if we get space back, move dalvik-cache back
 

bubonik

Senior Member
Apr 19, 2006
348
6
Portland
Thats my bad, I should have been more specific. I have a G1 and I dont use a2sd. Currently sd 1.10.2 uses /cache/dalvik-cache, but with 1.33.2005 that leaves only 3500 kb available for downloading apps. A huge problem.

So im trying to dump it somewhere else, the /data partition would be fine since I only have about 15 apps. I tried doing a symlink to /data/dalvik-cache after it was functioning but got boot loops. Which is why im here.
 

M..N

Senior Member
Jul 14, 2009
1,212
99
Just wondering when the ErisPort rom will be available, also could you try this with the Legend Port
 

Firerat

Senior Member
Feb 24, 2009
3,848
185
Just wondering when the ErisPort rom will be available, also could you try this with the Legend Port

soon, I'm uploading now

and yes, you can use it with any rom
I had a quick look at Vega's Legend port,

Bold should be linked to system

Code:
29M     ./cache
65M     ./system
53M     ./data

data/:
app  app_s  fix_permissions.sh  [B]fonts[/B]

system/:
bin  build.prop  csys  etc  fonts  lib  sd  usr  xbin

cache/system/:
[B]customize  framework  media[/b]
all apps are going to go to sd here,
but around 30mb worth can be put back, to either /system or /system/csys
after boot, when we know how much space we have and where
so around 18mb on SD

leaving plenty of space for Dalvik-Cache
should be fast, no matter what SPL you have :)
 
Last edited:

Firerat

Senior Member
Feb 24, 2009
3,848
185
Thats my bad, I should have been more specific. I have a G1 and I dont use a2sd. Currently sd 1.10.2 uses /cache/dalvik-cache, but with 1.33.2005 that leaves only 3500 kb available for downloading apps. A huge problem.

So im trying to dump it somewhere else, the /data partition would be fine since I only have about 15 apps. I tried doing a symlink to /data/dalvik-cache after it was functioning but got boot loops. Which is why im here.

ahh, sorry I nearly missed your follow up post

I wasn't aware that Dalvik-cache ever ended up on /cache, which tbh that has always confused me a little

if you look at Cyanogen's a2sd , he does mention in the comments that a bind mount is used so the system will still boot, even when no SD card ( since you don't have a dead link )

so I think the solution to your problem is to bind mount something to /cache/dalvik-cache
you should do this early in the boot process, else it will just get filled up
for instance a2sd is executed by init.rc , so it happens before the Android system kicks in, it doesn't matter if it fails to bind mount as you still have the directory available
 

M..N

Senior Member
Jul 14, 2009
1,212
99
it loads ok. although when im presented with low memory notification. i try downloading an app from the market, but it stays on the start downloading. Do you think you could make a port of the Legend Rom?
 

Firerat

Senior Member
Feb 24, 2009
3,848
185
it loads ok. although when im presented with low memory notification. i try downloading an app from the market, but it stays on the start downloading. Do you think you could make a port of the Legend Rom?

:(
Maybe my script isn't moving the framework
That's around 30mb
( script is
/system/csys/system/bin/data-cache.sh
If anyone wants to have a look )

I'm not at home right now, but will have a proper look later

In the meantime if you reboot the dalvik cache should get moved to the sdcard
Giving you some space back.
I forgot the hero doesn't have term
 

asb123

Senior Member
Dec 15, 2009
1,214
34
Vancouver
so for danger spl ppl, ROMs will now be quicker (system apps), also roms which could not before be done now can?
 

FatBoyExtraordinaire

Senior Member
Jun 24, 2008
1,597
8
Philadelphia
So the 2 modded roms you posted above should work for us with Stock SPLS and if that is proven true, you have pretty much made any rom flashable on a Stock SPL'd G1. Is that correct? If so, you have just made a lot of people very happy. Great work, although that entire initial post was foreign language to me!
 

sianaka

Senior Member
Jul 28, 2007
317
24
thank you...

I haven't tried this yet, but I am super excited to see this is being worked out. I don't have the danger spl, and I can't wait to see this work with some of the new eclair 2.1 roms. Thanks for your hard work.
 

speedysilwady

Senior Member
Oct 9, 2009
830
92
So the 2 modded roms you posted above should work for us with Stock SPLS and if that is proven true, you have pretty much made any rom flashable on a Stock SPL'd G1. Is that correct? If so, you have just made a lot of people very happy. Great work, although that entire initial post was foreign language to me!

yes theoretically any rom should fit any spl but as you can see in the first post,
it takes a lot of work to port a rom to stock using this method, but wow its very well put together and firerat def knows what he's doing with this, i was shocked to be the first to have a 2.1 Eclair Sense on a G1 with Hard/Stock/Engineering SPL thanks to Firerat who implemented the idea very well and lbcoder who suggested the general idea on my thread a while back.

Also Firerat as mentioned earlier, the script to move framework seems to have some kinda kink cuz the low spaace error exists on the eris port. Also google sync is still broken.