[PATCH][A2SD]MT3G Friendly a2sd Patch - Firerat - G1 Android Development

EDIT: 2010-05-13
a note on this modded a2sd and CM5
This mod is *not* required , cm5 has a newer/better way of implementing a2sd
but it will do no harm, it just simply won't do anything
Firerat Patch - a2sd for MT3G users
NOTE My Modified a2sd is intended for both G1s and MT3Gs, one a2sd suits both MT3G's and G1s
Ok, I thought it was about time I gave a full explanation on my mt3g-a2sd patch
why MT3G users should not use an ext partition
why MT3G users who have just 2 Parttions ( FAT / SWAP ) get failed boots
How my modifications reslove this situation
Why should MT3G users not use an ext partition?
the answer is quite simple really, they don't need it.
a2sd was designed with G1s in mind, the G1's /data partition has a limited amount of space available, just over 74mb or 89mb with 'DangerSPL' whereas the MT3G has just over 295mb around 3 or 4 times the G1's.
Although I have not 'benchmarked' the 'speeds' of internal vs sdcard , I belive it is widely accepted that the internal memory is significantly faster than sdcards, and therefore if an MT3G can use it, it should.
So I hope we are all now agree that the MT3G's internal memory should be used for apps/dalvik-cache
Why do MT3G users who have just 2 Parttions ( FAT / SWAP ) get failed boots?
the problem is within the a2sd script, here is a section of the code, with my annotations in blue
Code:
[COLOR="Blue"]Here the script checks for second partition[/COLOR]
if [ -e /dev/block/mmcblk0p2 ];
then
[COLOR="Blue"]it exists so it does a fsck on it [/COLOR]
# fsck the sdcard filesystem first
e2fsck -fy /dev/block/mmcblk0p2;
# set property with exit code in case an error occurs
setprop cm.e2fsck.errors $?;
[COLOR="Blue"] an error is returned ( it is swap not an extfs ) error no. is just stored, no action [/COLOR]
# mount and set permsd
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sd;
[COLOR="Blue"] The above mount command fails, it is swap
<snip some link clean ups>[/COLOR]
# move apps and dalvik cache from internal memory to sdcard
for i in app app_s app-private dalvik-cache;
do
[COLOR="Blue"] here directories are normally created on sdcard
but as sdcard isn't mounted it tries to put them on the /system partition,
since /system is mounted read only , it fails[/COLOR]
if [ ! -d /system/sd/$i ];
then
mkdir /system/sd/$i;
fi
busybox chown 1000:1000 /system/sd/$i;
busybox chmod 771 /system/sd/$i
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
[COLOR="Blue"] the next line tries to copy files from internal memory to /system/sd,
which is read only, it fails[/COLOR]
busybox cp -a /data/$i/* /system/sd/$i/;
busybox rm -f /data/$i/*;
[COLOR="Blue"] BANG , that line above just deleted all your apps,
your system will not boot[/COLOR]
fi;
done;
# symlink app dirs - they must be on the same filesystem
for i in app app_s app-private;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox rm -rf /data/$i;
[COLOR="Blue"] its just removing empty directories,
and creating a link to none existent directories in /system/sd/[/COLOR]
busybox ln -s /system/sd/$i /data/$i;
fi;
done;
How my modifications reslove this situation
Quite simply by skipping the above code, with this.
Code:
# check if not a G1 ( assuming mt3g ) - Firerat 2010-03-23
rohardware=`getprop ro.hardware`
if [ "$rohardware" != "trout" ];
then
FindSwap
ReturnAppsToData
$SETPROP_CMD cm.filesystem.ready 1;
exit 0;
the != is not equal to, getprop ro.hardware will return sapphire, not trout,
so this code will run my findswap, and ReturnAppsToData Functions
you can find the ReturnAppsToData Function in my next post
Code:
FindSwap ()
{
if [ "`sed -n '$=' /proc/swaps`" -gt "1" ];
then
echo "Swap appears to be already setup, skipping checks"
return
else
for isitswap in `ls /dev/block/mmcblk0p*` ; do
swapon $isitswap 2>/dev/null
if [ "$?" = "0" ];
then
busybox mount -o rw,remount /system
sed s~/dev/block/mmcblk0p.~$isitswap~ /system/bin/user.conf -i
busybox mount -o ro,remount /system
break
else
echo "$isitswap is not swap"
fi
done
fi
return
}
next post contains my full modified a2sd
New Version 2.1
FireratModified-a2sd-2-1_S.zip
This one has the functions in the right place, so they *will* do something
################
Older versions
################
are a bit broken

Full Firerat Modified a2sd Code
It actually does a little more that just be friendly to MT3G, it will attempt to keep Dalvik-cache on /data
Code:
#!/system/bin/sh
#
# Apps2SD using symlinks and bind mounts
# [email protected] (cyanogen) Thanks Cy! & ccyrowski
# modified by Firerat 2010-03-24
# Skip a2sd functions if not a G1 ( mt3g in mind )
# Conditional added to location of Dalvik-cache, keep in internal memory where possible
# Firerat 2010-03-30 - added moving apps back to data for mt3g's
# Firerat-TODO - echo for when ran on terminal
#############################################################
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`
#############################################################
echo "+++ Welcome to Android `$GETPROP_CMD ro.build.version.release` / `getprop ro.modversion`";
sysctl -p
# check if not a G1 ( assuming mt3g ) - Firerat 2010-03-23
if [ "$rohardware" != "trout" ];
then
FindSwap
ReturnAppsToData
$SETPROP_CMD cm.filesystem.ready 1;
exit 0;
elif [ -e /dev/block/mmcblk0p2 ];
then
MountExt
# clean up any old symlinks, create data directories
for i in dalvik-cache data;
do
if [ -h /data/$i ];
then
$RM_CMD /data/$i;
fi
if [ ! -d /data/$i ];
then
$MKDIR_CMD /data/$i;
$CHOWN_CMD 1000:1000 /data/$i;
$CHMOD_CMD 771 /data/$i;
fi
done;
# don't allow /data/data on sd because of upgrade issues - move it if possible
if [ -d /system/sd/data ];
then
$CP_CMD -a /system/sd/data/* /data/data/;
$RM_CMD -rf /system/sd/data;
fi
# move apps and dalvik cache from internal memory to sdcard
# when possible keep dalvik-cache on internal memory Firerat 2010-03-23
# for i in app app_s app-private dalvik-cache;
# Firerat-TODO in the same way I try to keep Dalvik-Cache on internal, do same for apps
# therefore keeping things as fast as possible
# and if I get my head round aufs then can maybe do some moving based on priority list
# hell, could even build list based on useage if it's recorded in the dbs
for i in app app_s app-private ;
do
if [ ! -d /system/sd/$i ];
then
$MKDIR_CMD /system/sd/$i;
fi
$CHOWN_CMD 1000:1000 /system/sd/$i;
$CHMOD_CMD 771 /system/sd/$i
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
$CP_CMD -a /data/$i/* /system/sd/$i/;
$RM_CMD -f /data/$i/*;
fi
done;
# symlink app dirs - they must be on the same filesystem
for i in app app_s app-private;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
$RM_CMD -rf /data/$i;
$LN_CMD -s /system/sd/$i /data/$i;
fi
done;
# bind mount dalvik-cache so we can still boot without the sdcard
# when possible keep dalvik-cache on internal memory Firerat 2010-02-24
# $MOUNT_CMD -o bind /system/sd/dalvik-cache /data/dalvik-cache;
# $CHOWN_CMD 1000:1000 /data/dalvik-cache;
# $CHMOD_CMD 771 /data/dalvik-cache;
DalvikCache
# clean up old whiteouts
for i in local misc property system tombstones data;
do
if [ -h /system/sd/$i ]; then $RM_CMD -f /system/sd/$i; fi
done;
# please don't put odex files in the app directory people!
# it causes dexopt to crash when switching builds!
$RM_CMD -f /system/sd/app/*.odex
# Firerat 2010-03-30 , not looked at this , but wrapper dexopt to ignore *.odex ?
else
# replace symlinks with directories so we can boot without sd
for i in app app-private;
do
if [ -h /data/$i ];
then
$RM_CMD -f /data/$i;
$MKDIR_CMD /data/$i;
$CHOWN_CMD 1000:1000 /data/$i;
$CHMOD_CMD 771 /data/$i;
fi
done;
fi
$SYNC_CMD;
FindSwap
#Set Fifo - King Klick - thanks Wes Garner!
for i in ` $LS_CMD -1 /sys/block/mtdblock*` /sys/block/mmcblk0
do
echo 1 > $i/queue/iosched/fifo_batch
done
# Firerat 2010-03-30 ^ should be in init.rc , or some other post boot script
$SETPROP_CMD cm.filesystem.ready 1;
# for now this can stay
if [ -e /data/fix_permissions.sh ];
then
sh /data/fix_permissions.sh
$RM_CMD /data/fix_permissions.sh
fi
### Firerat - Begin functions
MountExt ()
{
# Firerat Check /dev/block/mmcblk0p2 is mounted , so script can be run in terminal
if [ `$MOUNT_CMD |$GREP_CMD -q "/dev/block/mmcblk0p2";echo $?` != "0" ];
then
# fsck the sdcard filesystem first
$E2FSCK_CMD -fy /dev/block/mmcblk0p2;
# set property with exit code in case an error occurs
$SETPROP_CMD cm.e2fsck.errors $?;
# mount and set perms
$MOUNT_CMD -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sd;
$CHOWN_CMD 1000:1000 /system/sd;
$CHMOD_CMD 771 /system/sd;
$SYNC_CMD
fi
return
}
FindSwap ()
{
if [ "`$SED_CMD -n '$=' /proc/swaps`" -gt "1" ];
then
echo "Swap appears to be already setup, skipping checks"
return
else
for isitswap in ` $LS_CMD /dev/block/mmcblk0p*` ; do
$SWAPON_CMD $isitswap 2>/dev/null
if [ "$?" = "0" ];
then
$MOUNT_CMD -o rw,remount /system
# Firerat 2010-03-30 - check for cache hack
if [ -d /system/csys ]; then
$MOUNT_CMD -o rw,remount /system/csys
fi
$SED_CMD s~/dev/block/mmcblk0p.~$isitswap~ /system/bin/user.conf -i
$MOUNT_CMD -o ro,remount /system
# Firerat 2010-03-30 - check for cache hack
if [ -d /system/csys ]; then
$MOUNT_CMD -o ro,remount /system/csys
fi
break
else
echo "$isitswap is not swap"
fi
done
fi
return
}
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
# Firerat-TODO - I'll finish these some other time
#echo "Data Partition size : ${DataTotal_K}K"
#echo "Free on Data Partition : ${DataFree_K}K"
#echo $DataDalvik_K
#echo $Min_Data_Free_MB
#echo $Buffer_K
#echo $DataApp_K
#echo $System_App_K
#echo $SD_Dalvik_K
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
# hmm, I should be not lazy look before I leap
$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
}
ReturnAppsToData ()
{
# Firerat 2010-03-30
# only running this for none G1s, like mt3g
# allows this patched a2sd to be used on existing install that emulates G1 with broken keyboard
# will only move apps / dalvik i\f there is enough space on /data
# I can probably use this to move apps an a G1, but for now only calling if not g1
if [ -e /dev/block/mmcblk0p2 ] && [ "$isitswap" != "/dev/block/mmcblk0p2" ];
then
Min_Data_Free_MB=10
Buffer_K=`expr $Min_Data_Free_MB \* 1024`
DataFree_K=`$DF_CMD|$GREP_CMD \/data\:|$CUT_CMD -d " " -f6|$SED_CMD s/K//`
TotalAppsOnSD="0"
MountExt
# check to make sure apps on sd are not too large
for i in app app_s app-private dalvik-cache; do
if [ ! -d /system/sd/$i ];
then
SizeOnSD$i=`busybox $DU_CMD /system/sd/$i|$CUT_CMD -f1`
else
SizeOnSD$i="0"
fi
TotalAppsOnSD=`expr "$TotalAppsOnSD" + "SizeOnSD$i"`
done
if [ "$TotalAppsOnSD" -lt "`expr "$DataFree_K" - "$Buffer_K"`" ];
then
# Firerat 2010-03-30 NB, I'm not moving Dalvik-c here , as I already have a function for that
for i in app app_s app-private; do
if [ -d /system/sd/$i ] && [ -L /data/$i ];
then
# Firerat 2020-03-31 - Copy to temp, then remove link and move temp in place
$CP_CMD -a /system/sd/$i /data/$i-temp
$RM_CMD /data/$i
$MV_CMD /data/$i-temp /data/$i
if [ "$?" = "0" ];
then
$RM_CMD -rf /system/sd/$i
fi
fi
done
DalvikToIntMem
$UMOUNT_CMD /dev/block/mmcblk0p2
return
else
DalvikComplete
return
fi
else
return
fi
}
Original Code
Code:
#!/system/bin/sh
#
# Apps2SD using symlinks and bind mounts
# [email protected] (cyanogen) Thanks Cy! & ccyrowski
#
echo "+++ Welcome to Android `getprop ro.build.version.release` / `getprop ro.modversion`";
sysctl -p
if [ -e /dev/block/mmcblk0p2 ];
then
# fsck the sdcard filesystem first
e2fsck -fy /dev/block/mmcblk0p2;
# set property with exit code in case an error occurs
setprop cm.e2fsck.errors $?;
# mount and set perms
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sd;
busybox chown 1000:1000 /system/sd;
busybox chmod 771 /system/sd;
#busybox mount /sdcard;
# clean up any old symlinks, create data directories
for i in dalvik-cache data;
do
if [ -h /data/$i ];
then
rm /data/$i;
fi;
if [ ! -d /data/$i ];
then
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
# don't allow /data/data on sd because of upgrade issues - move it if possible
if [ -d /system/sd/data ];
then
busybox cp -a /system/sd/data/* /data/data/;
busybox rm -rf /system/sd/data;
fi;
# move apps and dalvik cache from internal memory to sdcard
for i in app app_s app-private dalvik-cache;
do
if [ ! -d /system/sd/$i ];
then
mkdir /system/sd/$i;
fi
busybox chown 1000:1000 /system/sd/$i;
busybox chmod 771 /system/sd/$i
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox cp -a /data/$i/* /system/sd/$i/;
busybox rm -f /data/$i/*;
fi;
done;
# symlink app dirs - they must be on the same filesystem
for i in app app_s app-private;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox rm -rf /data/$i;
busybox ln -s /system/sd/$i /data/$i;
fi;
done;
# bind mount dalvik-cache so we can still boot without the sdcard
busybox mount -o bind /system/sd/dalvik-cache /data/dalvik-cache;
busybox chown 1000:1000 /data/dalvik-cache;
busybox chmod 771 /data/dalvik-cache;
# clean up old whiteouts
for i in local misc property system tombstones data;
do
if [ -h /system/sd/$i ]; then rm -f /system/sd/$i; fi
done;
# please don't put odex files in the app directory people!
# it causes dexopt to crash when switching builds!
busybox rm -f /system/sd/app/*.odex
else
# replace symlinks with directories so we can boot without sd
for i in app app-private;
do
if [ -h /data/$i ];
then
rm -f /data/$i;
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
fi;
sync;
setprop cm.filesystem.ready 1;

this is for if I need some more space

great job again firerat.... alot of us appreciate your hard work and thoroughness!!!!!!!!!!!!!!!!!!!!!!! looking forward to add to my mt3g.... ive been experiencing many boot failures.....

dangambino said:
great job again firerat.... alot of us appreciate your hard work and thoroughness!!!!!!!!!!!!!!!!!!!!!!! looking forward to add to my mt3g.... ive been experiencing many boot failures.....
Click to expand...
Click to collapse
the Flash update in the OP should convert an MT3G emulating a G1 with broken keyboard back into an MT3G with a spare ext partition, for a chroot linux or something, or just fix it up before messing about re-partitioning
but I have to say, I have not tested the apps back to data part, it should check if there is room, it did cross my mind that some may have hundreds of apps and it they would be too big to fit, so I try to check

Lovely, thanks! I'm going to try this now, as I'm just re-flashing King's Legend2g1

Would this be able to run properly once a ROM is already established? Like a ROM I've had for a couple days? Or would this need to be flashed on a ROM that's recently installed. For instance:
Code:
Flash ROM
Flash a2sd
reboot

nolimit78 said:
Would this be able to run properly once a ROM is already established? Like a ROM I've had for a couple days? Or would this need to be flashed on a ROM that's recently installed. For instance:
Code:
Flash ROM
Flash a2sd
reboot
Click to expand...
Click to collapse
yes, my latest will copy app, app_s, app-private and dalvik-cache from the ext partition to /data
( unless it finds that they are all too big, in which case you are still g1 with broken keyboard but your gota have *a lot* of apps before that happens )
But as I only have a G1 I have not been able to test it properly, but the logic is straight forward so fingers crossed I have not missed a typo...

Hmm. I'm having a problem with it. Well, maybe with it. So the first time I wiped, repartitioned with just a swap (190mb) and the rest as fat32. I flashed Rom, then flashed your patch, then flashed the vega kernal patch. Booted up, it all worked, past the HTC quietly brilliant screen, but then sat there on the black HTC bit. If I let the screen sleep, it looked like Sense had loaded, but when I unlocked it it was still sitting there on the black HTC screen with Clock repeatedly FC'ing. So I wiped, reflashed this time just the Rom and the Patch and this time it's getting to the setup screen. It was working fine. I connected to wifi, then signed into my google account (still on the setup) and then onto the next screen about google using my location, and then Settings FC'd. Since then I've been in a loop of going back to the start of the Setup menu, never getting further than the language screen again. I will reboot and see if that helps. Failing that, I'll re-flash with JUST the rom, and see if it sets up ok. If so, I suppose I won't need the patch afterall!
I'll keep you updated.

Firerat said:
yes, my latest will copy app, app_s, app-private and dalvik-cache from the ext partition to /data
( unless it finds that they are all too big, in which case you are still g1 with broken keyboard but your gota have *a lot* of apps before that happens )
But as I only have a G1 I have not been able to test it properly, but the logic is straight forward so fingers crossed I have not missed a typo...
Click to expand...
Click to collapse
I flashed it as I was typing, just outta curiosity, and its seeming to work properly. Good work sir!

Thanks!! I'll try it out on superD and tell you how it goes

DanGrover said:
Hmm. I'm having a problem with it. Well, maybe with it. So the first time I wiped, repartitioned with just a swap (190mb) and the rest as fat32. I flashed Rom, then flashed your patch, then flashed the vega kernal patch. Booted up, it all worked, past the HTC quietly brilliant screen, but then sat there on the black HTC bit. If I let the screen sleep, it looked like Sense had loaded, but when I unlocked it it was still sitting there on the black HTC screen with Clock repeatedly FC'ing. So I wiped, reflashed this time just the Rom and the Patch and this time it's getting to the setup screen. It was working fine. I connected to wifi, then signed into my google account (still on the setup) and then onto the next screen about google using my location, and then Settings FC'd. Since then I've been in a loop of going back to the start of the Setup menu, never getting further than the language screen again. I will reboot and see if that helps. Failing that, I'll re-flash with JUST the rom, and see if it sets up ok. If so, I suppose I won't need the patch afterall!
I'll keep you updated.
Click to expand...
Click to collapse
Further to this, I rebooted and let it sit for a while, then tried again. I got as far as the Facebook sync bit on the Setup but no dice, FC settings and back to the start. So I wiped and re-flashed just the rom, which has now been sitting on the HTC Quietly Brilliant screen for about 15 minutes. The only option I haven't tried yet is installing Legend2g1 + the Vega patch, booting and seeing if it works.

DanGrover said:
Further to this, I rebooted and let it sit for a while, then tried again. I got as far as the Facebook sync bit on the Setup but no dice, FC settings and back to the start. So I wiped and re-flashed just the rom, which has now been sitting on the HTC Quietly Brilliant screen for about 15 minutes. The only option I haven't tried yet is installing Legend2g1 + the Vega patch, booting and seeing if it works.
Click to expand...
Click to collapse
try one of my Legend for NoneDangerSPLs
link in my sig
they are using an MT3G friendly a2sd out of the box, but without the apps back to data part

Firerat! This is AWESOME!!!!! I've needed this for a while, but my experience of bash scripting is less than mediocre.
I have 3 questions:
1) To make this usable on g1, I can just remove the ro.getprop section, correct? or do I need to change it instead of removing it?
2) To guess whether or not my /data folder will even fit on the g1, can I simply extract the zip and look at the file size of "data" folder inside, or is there something more? and if that barely fits, will dalvik-cache still go on sd?
3) If I am installing a bunch of apps and it fills up /data (assuming I am using this script), then will the "move apps and dalvik-cache to sd" option in amon_ra work?
Thanks man!

jcarrz1 said:
Firerat! This is AWESOME!!!!! I've needed this for a while, but my experience of bash scripting is less than mediocre.
I have two questions:
1) To make this usable on g1, I can just remove the ro.getprop section, correct? or do I need to change it instead of removing it?
Click to expand...
Click to collapse
Out of the box it will work with G1s and MT3Gs, that's the idea One Script two phones.
jcarrz1 said:
2) To guess whether or not my /data folder will even fit on the g1, can I simply extract the zip and look at the file size of "data" folder inside, or is there something more? and if that barely fits, will dalvik-cache still go on sd?
Thanks man!
Click to expand...
Click to collapse
with a G1 I let everything go to sd,
but if I work out that dalvik-cache will fit on data , leaving 10mb free I keep it on data
I do need to tweak it a little, the Legend Cache Hacks I have done need a reboot to push dalvik-cache to sd
And , in future ( providing DEVs adopt it ) all system apps can go to system
check my Eris / Legend on NoneDangerSPL in sig for more info
I can recommend the ErisCacheHack, and Legend for NoneDanger
( DangerLegend is still wip, but I'm hoping my latest works )

jcarrz1 said:
3) If I am installing a bunch of apps and it fills up /data (assuming I am using this script), then will the "move apps and dalvik-cache to sd" option in amon_ra work?
Thanks man!
Click to expand...
Click to collapse
yeah, it should do, the a2sd will move the dalvik-cache back if it thinks there is enough space, but at the moment it won't touch the apps
I am going to develop the a2sd a little more, and get it to auto move apps between data/sd depending on size
I kind of hint at that in the comments in the last function
but one of my goals is to get unionfs going, having some apps on internal and some on SD
it will also make the cache hack much easier
I'd just flash a linux base, the android being a tarball, and extract the android on first boot into a unionfs, if I'm right, the files will automagicaly go to where space is available
failing that, I have other ideas

Firerat said:
but one of my goals is to get unionfs going, having some apps on internal and some on SD
Click to expand...
Click to collapse
If working unionfs for a2sd search XDA (in particular, this forum) first. It's been done but was found wanting from a performance standpoint--you may as well build on that experience. You might also see if you get better results from aufs.

Firerat said:
yeah, it should do, the a2sd will move the dalvik-cache back if it thinks there is enough space, but at the moment it won't touch the apps
I am going to develop the a2sd a little more, and get it to auto move apps between data/sd depending on size
I kind of hint at that in the comments in the last function
but one of my goals is to get unionfs going, having some apps on internal and some on SD
it will also make the cache hack much easier
I'd just flash a linux base, the android being a tarball, and extract the android on first boot into a unionfs, if I'm right, the files will automagicaly go to where space is available
failing that, I have other ideas
Click to expand...
Click to collapse
Thanks for the quick response. In regard to #1, if I wanted to make the script do what it usually does on mt3g happen on my g1, can I simply remove those lines?
Also, I'm testing the legend patch right now ON DANGER, but fyi the 4shared links for the prepatched rom don't work... that's why I did it myself. flashing.

hmm.. Ill flash this over the current rom im using i guess and ill see how it goes. using that SuperEclair 2.3. should i wipe before flashing or its unnecessary?

Shaquiel Harris said:
hmm.. Ill flash this over the current rom im using i guess and ill see how it goes. using that SuperEclair 2.3. should i wipe before flashing or its unnecessary?
Click to expand...
Click to collapse
this isn't something you flash, it's something you stick into /system/bin when you're cooking a rom... as far as I know...

Related

auto-launch scripts

Ok, searched and couldn't find, so if you know a thread where this is touched upon, please link to the post?
I'm trying to disable a2sd on JAC's latest rom (compcache just makes it so much more livable) and enable linux swap and compcache. what I ended up doing was modifying the a2sd script so that it checks for a third partition instead of a second, that way, I can disable a2sd by not having a third partition. I also changed the swap script to check for a second partition. I'm pretty much making a2sd optional in order to use compcache (since it's the a2sd script that launches the userinit.sh script at /system/sd, if there's no ext partition, it jumps to else and ignores the part to run userinit.sh). Anyway, I'm wondering how it is that a2sd is being launched on startup, and wether it's being launched on every single boot or just on first boot. I'm wondering because i want to replace it with my own script, now, i could either copy the contents of my script to a2sd script, or i could find out how it is that scripts are auto-launched on android so that i can add them later instead of just appending everything to the a2sd script and hoping it works (since some things will conflict).
Here's my modified script, anyway, if anybody is interested in running compcache and swap without a2sd, only need two partitions, fat32 and linux-swap, if you add a third ext2 partition, then you enable a2sd (data, dalvik-cache, and data-private, I like leaving app_s internal for speed):
notice, this is not MY script per se, just modified from jac's a2sd and the userinit.sh for cyanogen's compcache roms
Code:
#!/system/bin/sh
#
# Apps2SD using symlinks and bind mounts
# Thanks to Cyanogen modified by JAC
#
sysctl -p
if [ -e /dev/block/mmcblk0p3 ];
then
# fsck the sdcard filesystem first
e2fsck -y /dev/block/mmcblk0p3;
# set property with exit code in case an error occurs
setprop cm.e2fsck.errors $?;
# mount and set perms
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p3 /system/sd;
busybox chown 1000:1000 /system/sd;
busybox chmod 771 /system/sd;
# clean up any old symlinks, create data directories
for i in dalvik-cache data;
do
if [ -h /data/$i ];
then
rm /data/$i;
fi;
if [ ! -d /data/$i ];
then
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
# don't allow /data/data on sd because of upgrade issues - move it if possible
if [ -d /system/sd/data ];
then
busybox cp -a /system/sd/data/* /data/data/;
busybox rm -rf /system/sd/data;
fi;
# move apps and dalvik cache from internal memory to sdcard
for i in app dalvik-cache app-private;
do
if [ ! -d /system/sd/$i ];
then
mkdir /system/sd/$i;
fi
busybox chown 1000:1000 /system/sd/$i;
busybox chmod 771 /system/sd/$i
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox cp -a /data/$i/* /system/sd/$i/;
busybox rm -f /data/$i/*;
fi;
done;
# symlink app dirs - they must be on the same filesystem
for i in app dalvik-cache app-private;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox rm -rf /data/$i;
busybox ln -s /system/sd/$i /data/$i;
fi;
done;
# clean up old whiteouts
for i in local misc property system tombstones data;
do
if [ -h /system/sd/$i ]; then rm -f /system/sd/$i; fi
done;
# please don't put odex files in the app directory people!
# it causes dexopt to crash when switching builds!
busybox rm -f /system/sd/app/*.odex
# call a userinit.sh script if it's present on the sdcard
if [ -e /system/sd/userinit.sh ];
then
/system/bin/sh /system/sd/userinit.sh;
fi;
setprop cm.a2sd.active 1;
else
# replace symlinks with directories so we can boot without sd
for i in app app-private;
do
if [ -h /data/$i ];
then
rm -f /data/$i;
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
setprop cm.a2sd.active 0;
fi;
sync;
setprop cm.filesystem.ready 1;
#!/system/bin/sh
# Thanks to Denkai/Dwang
if [ -n /dev/block/mmcblk0p2 ];
then
mkswap /dev/block/mmcblk0p2;
fi;
if [ -e /dev/block/mmcblk0p2 ];
then
echo 20 > /proc/sys/vm/swappiness;
swapon /dev/block/mmcblk0p2;
fi;
insmod /system/modules/lib/modules/2.6.29-cm/compcache/xvmalloc.ko;
insmod /system/modules/lib/modules/2.6.29-cm/compcache/ramzswap.ko disksize_kb=24000;
mknod /dev/ramzswap0 b 253 0;
echo 20 > /proc/sys/vm/swappiness;
swapon /dev/ramzswap0;
exit;

[SCRIPT] 32A - 32B detection script

Hi,
I don't know how-to detect if a device is 32B or 32A automatically.... Logically, if we do a free command during recovery install, we can AUTOMATICALLY check if it's a 32B/A, then, we create a gile on sdcard called 32B/A, or a prop, and when it flash kernel, or wifi module or sound things, we include this prop in the script
Can anyone create this script?
[EDIT]
Many Thanks to Firerat who mades the script, and a little to me, who has the idea!
So the script is here:
Code:
#!/sbin/sh
# Idea : Artifex14
# script : Firerat => THE BEST!
# 28.06.10
ram=`free|awk '/Mem/ { print $2 }'`
if [ "ram" -gt "97884" ];
then
model=32a
echo "32a"
else
model=32b
echo "This device is a 32b"
fi
if [ "model" = "32a" ];
then
ln -s /tmp/boot.img /tmp/boot32a.img
ln -s /dev/null /tmp/boot32b.img
else
ln -s /tmp/boot.img /tmp/boot32b.img
ln -s /dev/null /tmp/boot32a.img
fi
I thought about this too. It could be done at the time the rom is flashed, but up to now I only know how to make update-script, not updater-script or update-binary. You could pack all sorts of boot images, and then, say, a system-dream, system-sapphire, and system-magic folder and depending on the board version property, flash the appropriate versions of files, at least in theory that should work, plus it prevents you from having to flash extra files just for cross-device compatibility.
jubeh said:
I thought about this too. It could be done at the time the rom is flashed, but up to now I only know how to make update-script, not updater-script or update-binary. You could pack all sorts of boot images, and then, say, a system-dream, system-sapphire, and system-magic folder and depending on the board version property, flash the appropriate versions of files, at least in theory that should work, plus it prevents you from having to flash extra files just for cross-device compatibility.
Click to expand...
Click to collapse
Can you do the script? For the updaterscript, it's OK!
et a script to run
Code:
free|awk '/Mem/ { print $2 }'
and test that, e.g.
Code:
#!/sbin/sh
# KernelPrep.sh
ram=`free|awk '/Mem/ { print $2 }'`
if [ "ram" -gt "97884" ];
then
model=32a
else
model=32b
fi
if [ "model" = "32a" ];
then
ln -s /tmp/boot.img /tmp/boot32a.img
ln -s /dev/null /tmp/boot32b.img
else
ln -s /tmp/boot.img /tmp/boot32b.img
ln -s /dev/null /tmp/boot32a.img
fi
get your updater script to run that, then copy your kernels to /tmp/
Code:
package_extract_dir("kernels", "/tmp");
or
Code:
copy_dir PACKAGE:kernels TMP:
next you can
Code:
write_raw_image("/tmp/boot.img", "boot"),
or
Code:
write_raw_image TMP:boot.img BOOT:
edit:
ps, you don't really need the second if statement, but its easier to read like that
oops , nearly forgot about the kernel modules
Code:
mount /system
install -d /system/lib/modules
ln -s /system/lib/modules /tmp/modules32a
ln -s /dev/null /tmp/modules32b
Firerat said:
et a script to run
Code:
free|awk '/Mem/ { print $2 }'
and test that, e.g.
Code:
#!/sbin/sh
# KernelPrep.sh
ram=`free|awk '/Mem/ { print $2 }'`
if [ "ram" -gt "97884" ];
then
model=32a
else
model=32b
fi
if [ "model" = "32a" ];
then
ln -s /tmp/boot.img /tmp/boot32a.img
ln -s /dev/null /tmp/boot32b.img
else
ln -s /tmp/boot.img /tmp/boot32b.img
ln -s /dev/null /tmp/boot32a.img
fi
get your updater script to run that, then copy your kernels to /tmp/
Code:
package_extract_dir("kernels", "/tmp");
or
Code:
copy_dir PACKAGE:kernels TMP:
next you can
Code:
write_raw_image("/tmp/boot.img", "boot"),
or
Code:
write_raw_image TMP:boot.img BOOT:
edit:
ps, you don't really need the second if statement, but its easier to read like that
oops , nearly forgot about the kernel modules
Code:
mount /system
install -d /system/lib/modules
ln -s /system/lib/modules /tmp/modules32a
ln -s /dev/null /tmp/modules32b
Click to expand...
Click to collapse
I'll try that, THANK!
oops typo
if [ "ram" -gt "97884" ];
should be
if [ "$ram" -gt "97884" ];

[Script] Chroot Control Script

One of the fun things you can do on your Android device, is to play around with different ways of getting a real distro (Debian, Ubuntu etc.) working along side the Android system. There are several (A lot) of tutorials in here on how to do this, so this part will not be covered here. This thread only contains some scripts that will help make it easier working with the chroot.
Most of the scripts that comes with the endless pool of chroot tutorials, is only made to mount and unmount the distro image in the most simple way. But nothing that helps walking in and out of the chroot without mount/unmount, and nothing that takes different services, busy devices etc. into consideration.
The debian.sh script in this thread has many tasks. It will on execution check to see if the image is mounted or not. If the image is mounted, it will just enter the chroot. If not, it will mount the image and then enter the chroot. On exit it will provide you with the option of exiting the chroot or exit and unmount.
Also it provides 4 custom scripts that is placed and executed inside the chroot. One for mount, unmount, enter chroot, leave chroot. This makes it possible to control chroot services much easier.
The script debian.sh is executed using the command "debian". You can also unmount the chroot from within the android shell by executing "debian unmount" instead of entering the chroot and then exit choosing to unmount.
The unmount process has several and different unmount attempts in case of busy devices, running services etc. which will make sure that the chroot is successfully unmounted.
File: /system/bin/debian
Code:
#!/system/bin/sh
su -c "/system/bin/debian.sh [email protected]"
File: /system/bin/debian.sh
Code:
#!/system/bin/sh
createLinuxBoot() {
if [ ! -f $FILESYSTEM ]; then
echo "Missing the $DIST filesystem image!"
return 0
elif [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# If the loop device is already mounted, we do nothing.
echo " - $DIST is already mounted. Entering chroot..."
else
echo " - Executing mount proccess of $DIST..."
if [ ! -d $MOUNTPOINT ]; then
# Create the mount point if it does not already exist
busybox mkdir -p $MOUNTPOINT 2> /dev/null
if [ ! -d $MOUNTPOINT ]; then
echo "It was not possible to create the missing mount location ($MOUNTPOINT)!"
return 0
fi
fi
# Android places loop devices in /dev/block/ instead of root /dev/
# If there are none in /dev/ we create links between /dev/loopX and /dev/block/loopX so that losetup will work as it should.
if [ ! -e /dev/loop0 ]; then
for i in 0 1 2 3 4 5 6 7
do
# Create each block device
mknod /dev/loop$i b 7 $i
done
fi
# Android also placed the frame buffer in /dev/grapichs instead of /dev
if [ ! -e /dev/fb0 ]; then
mknod /dev/fb0 b 29 0
fi
# Locate the current loop device file
if [ ! -z "$(losetup | grep "$FILESYSTEM")" ]; then
# If the filesystem file is already attached to an loop device, we get the path to the device file.
loblk=$(losetup | grep "$FILESYSTEM" | cut -d ":" -f 1)
else
# If the filesystem file is not yet attached, we attach it.
loblk=$(losetup -f)
losetup $loblk $FILESYSTEM 2> /dev/null
# Make sure that the device was successfully attached to a loop device file
if [ -z "$(losetup | grep "$FILESYSTEM")" ]; then
echo "It was not possible to attach the $DIST filesystem to a loop device!"
return 0
fi
fi
# Mount the filesystem
mount $loblk $MOUNTPOINT 2> /dev/null
if [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# Bind some Android dirs to the linux filesystem
for i in $MOUNT_BIND
do
# Bind the dirs if they are not already binded
if [ -z "$(mount | grep "$MOUNTPOINT/$i ")" ]; then
# Create any missing dirs in the mountpoint
if [ ! -d $MOUNTPOINT/$i ]; then
busybox mkdir -p $MOUNTPOINT/$i 2> /dev/zero
fi
mount --bind /$i $MOUNTPOINT/$i
fi
done
# FIX the "stdin: is not a tty" error in direct hadware case.
if [ -z "$(mount | grep "$MOUNTPOINT/dev/pts ")" ]; then
mount -t devpts devpts $MOUNTPOINT/dev/pts
fi
# For the network.
#sysctl -w net.ipv4.ip_forward=1
echo 1 > /proc/sys/net/ipv4/ip_forward
# Cleanup tmp folder.
rm -rf $MOUNTPOINT/tmp/*
else
echo "It was not possible to mount $DIST at the specified location ($MOUNTPOINT)!"
return 0
fi
if [ -f $MOUNTPOINT/etc/init.chroot/rc_mount.sh ]; then
# Execute the mount init file, if it exists
chroot $MOUNTPOINT /etc/init.chroot/rc_mount.sh
fi
echo " - $DIST was successsfully mounted. Entering chroot..."
fi
return 1
}
removeLinuxBoot() {
if [ -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# If linux is not mounted, then do nothing.
echo " - $DIST is already unmounted. Exiting..."
else
echo " - Executing unmount process of $DIST..."
if [ -f $MOUNTPOINT/etc/init.chroot/rc_unmount.sh ]; then
# Execute the unmount init script, if it exist.
chroot $MOUNTPOINT /etc/init.chroot/rc_unmount.sh
fi
sync
# The sleep part is very important. It may take some time before /dev is no longer busy
# after executing some services in the rc_unmount.sh script.
sleep 1
# Make sure that we have an loop device file to use
if [ ! -z "$(losetup | grep "$FILESYSTEM")" ]; then
# Get the loop device file
loblk=$(losetup | grep "$FILESYSTEM" | cut -d ":" -f 1)
for i in $UMOUNT_BIND
do
# Unmount all binding dirs
if [ ! -z "$(mount | grep "$MOUNTPOINT/$i ")" ]; then
umount $MOUNTPOINT/$i 2> /dev/zero
fi
done
sync
# Unmount the device
# In most cases one umount attempt will be enough.
# However it may take up to 3 tries in order to make it work.
# It depends on the types of services running or has been running before unmounting.
umount $MOUNTPOINT 2> /dev/null && sleep 1 2> /dev/zero
if [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
sync
umount $MOUNTPOINT 2> /dev/null && sleep 1 2> /dev/zero
fi
# If the device could not be unmounted
if [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
echo " - Unable to unmount $DIST. Will attempt to kill attached processes..."
# Try to kill all processes holding the device
fuser -k -9 $loblk
sync
# Use umount with the -l option to take care of the rest
umount -l $MOUNTPOINT 2> /dev/null && sleep 1
fi
# Make sure the device has been successfully unmounted
if [ -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# Try to detach the device from the loop device file
losetup -d $loblk 2> /dev/null
# Make sure that the device was successfully detached
if [ -z "$(losetup | grep "$FILESYSTEM")" ]; then
echo "$DIST has been successfully unmounted!"
else
echo "$DIST has been successfully unmounted, but was not able not detach the loop device!"
fi
else
echo "$DIST could not be successfully unmounted!"
fi
else
echo "Could not locate the loop device. $DIST was not unmounted!"
fi
fi
}
if [ -z "$EXPORTED" ]; then
export EXPORTED="TRUE"
# Basic needed variables
export TERM=linux
export HOME=/root
export USER=root
export LOGNAME=root
export UID=0
export SHELL=bash
# Here you can add all of the paths that should be binded. One list for mount and one reversed list for unmount.
export MOUNT_BIND="dev dev/pts dev/cpuctl proc sys sys/kernel/debug system d vendor acct sdcard cache sd-ext data"
export UMOUNT_BIND="dev/cpuctl dev/pts dev proc sys/kernel/debug d sys vendor acct sdcard cache sd-ext system data"
# Here you can change mount and image paths
export DIST="Debian" # The name of the distro. Is used for the messages.
export FILESYSTEM=/mnt/sdcard/debian.img # Path to the distro image file
export MOUNTPOINT=/data/debian # Path where the distro is to be mounted
fi
export OLDPATH=$PATH
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/root/bin:$PATH
if [ "$1" = "unmount" ]; then
removeLinuxBoot
else
createLinuxBoot
if [ $? -eq 1 ]; then
if [ -f $MOUNTPOINT/etc/init.chroot/rc_enter.sh ]; then
chroot $MOUNTPOINT /etc/init.chroot/rc_enter.sh
fi
chroot $MOUNTPOINT /bin/bash -i
if [ -f $MOUNTPOINT/etc/init.chroot/rc_leave.sh ]; then
chroot $MOUNTPOINT /etc/init.chroot/rc_leave.sh
fi
echo -n " - Type [Y] to unmount $DIST or random key to exit chroot ]# "
read ACTION
if [ "$ACTION" = "y" ] || [ "$ACTION" = "Y" ]; then
removeLinuxBoot
fi
fi
fi
# Restore the PATH variable when executing chroot
export PATH=$OLDPATH
By default debian.sh will look for /mnt/sdcard/debian.img and mount it at /data/debian
The script has build-in first-time-install functionality that will create missing directories etc. Just change the variable "FILESYSTEM" in debian.sh to the correct path and filename of your distro image, and it will handle the rest.
Chroot Init Scripts
Inside your chroot, you can create the directory /etc/init.chroot and create the fallowing files.
rc_mount.sh - Executed after mount
rc_unmount.sh - Executed before unmount
rc_enter.sh - Executed when entering chroot
rc_leave.sh - Executed when leaving chroot
Here are an example of a mount and unmount script used to control tightvncserver.
File: (chroot) /etc/init.chroot/rc_mount.sh
Code:
#!/bin/sh
# Make sure that the vncserver is completly stopped before starting.
if [ ! -f /tmp/.X11-unix/X1 ] && [ ! -f /tmp/.X1-lock ]; then
# Start vncserver
vncserver -geometry 800x480 :1
else
# This is in case something went wrong the last time
# it was shut down. Perhaps an uncomplete unmount.
vncserver -kill :1 2> /dev/zero
unset /tmp/.X11-unix/X1 2> /dev/zero 2> /dev/zero
unset /tmp/.X1-lock 2> /dev/zero 2> /dev/zero
vncserver -geometry 800x480 :1
fi
File: (chroot) /etc/init.chroot/rc_unmount.sh
Code:
#!/bin/sh
# Only stop this if it is started
if [ -f /tmp/.X11-unix/X1 ] || [ -f /tmp/.X1-lock ]; then
vncserver -kill :1
# Make sure that these are removed
unset /tmp/.X11-unix/X1 2> /dev/zero
unset /tmp/.X1-lock 2> /dev/zero
fi
Using these scripts, the VNC Server is started on chroot mount and stopped on chroot unmount. You can still leave and enter the chroot keeping the VNC Server running.

[Q] Ice Cream Sandwich problem on JXD S5100 console

Hello folks,
ive bought this cheap android based console like 1 year ago for my son to play android games on it. In last few weeks ive figured that many apps are lost due some reason and i can see them with 0 kb in applications list. Ive bought new SD card from Kingston to test it with but still the same issue. After moving application to SD card with A2SD III, application disapears from console and from SD card. After several days spent on google ive found possible fix but im not able to apply it since i dont have in system file where this fix can be applied. I hope somebody can help me to locate or advice what file should be possibly modified. If you have any ideas, feel free to post them (except those to throw that crap out of window)
https://github.com/nadlabak/android...mmit/e5b9b3195687e04af7a7929f8637e77e1efae9a1
Thanks alot for any helpful comments.
Aiki
Please, some Android guru help me out with this
I presume noone has any single idea?
Aikimaniac said:
Hello folks,
ive bought this cheap android based console like 1 year ago for my son to play android games on it. In last few weeks ive figured that many apps are lost due some reason and i can see them with 0 kb in applications list. Ive bought new SD card from Kingston to test it with but still the same issue. After moving application to SD card with A2SD III, application disapears from console and from SD card. After several days spent on google ive found possible fix but im not able to apply it since i dont have in system file where this fix can be applied. I hope somebody can help me to locate or advice what file should be possibly modified. If you have any ideas, feel free to post them (except those to throw that crap out of window)
https://github.com/nadlabak/android...mmit/e5b9b3195687e04af7a7929f8637e77e1efae9a1
Thanks alot for any helpful comments.
Aiki
Click to expand...
Click to collapse
Format you're mem card (in your console itself ) then factory reset it....
Sent from my K-Touch W719 using XDA Premium 4 mobile app
shreygadikar said:
Format you're mem card (in your console itself ) then factory reset it....
Sent from my K-Touch W719 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
didnt help..im still looking for the file where i can set that parameter to avoid that services start before mounting of SD card is finished..
i think the problem is the "A2SD III". take another one like my script and test.
mildwild said:
i think the problem is the "A2SD III". take another one like my script and test.
Click to expand...
Click to collapse
have been out of country for some days..will test this asap and let you know...weird is that i removed SD card and installed game from market and it happened even without app was moved to SD card..i just lost it...looks like the ROM from factory is pretty messed up as well.. will let you know how this went..thanks alot
Not sure where to place this script..or if its necessary to modify some other already existing script... btw..this the original ROM if anyone experienced is willing to check it.. http://www.jxd.hk/download.asp?id=1152&selectclassid=020001 for what i would be very grateful :fingers-crossed:
Please gurus...help me out with this issue...here is the script and i have no idea where to put it... thanks in advance
Code:
#!/system/bin/sh
#
# Apps2SD using symlinks and bind mounts
# Original Apps2SD script by [email protected] (cyanogen)
# Fixed for slow detection of SD cards by _thalamus and output a bit more debugging info so we can see where problems are arising.
# execute any postinstall script then kill it
enablea2sd () {
# mount and set perms
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /sd-ext;
busybox chown 1000:1000 /sd-ext;
busybox chmod 771 /sd-ext;
# clean up any old symlinks, create data directories
for i in data;
do
if [ -h /data/$i ];
then
rm /data/$i;
fi;
if [ ! -d /data/$i ];
then
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
# don't allow /data/data on sd because of upgrade issues - move it if possible
if [ -d /sd-ext/data ];
then
busybox cp -a /sd-ext/data/* /data/data/;
busybox rm -rf /sd-ext/data;
fi;
# move apps from internal memory to sdcard
for i in app app-private dalvik-cache;
do
if [ ! -d /sd-ext/$i ];
then
mkdir /sd-ext/$i;
fi
busybox chown 1000:1000 /sd-ext/$i;
busybox chmod 771 /sd-ext/$i
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox cp -a /data/$i/* /sd-ext/$i/;
busybox rm -f /data/$i/*;
fi;
done;
# symlink app dirs - they must be on the same filesystem
for i in app app-private dalvik-cache;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox rm -rf /data/$i;
busybox ln -s /sd-ext/$i /data/$i;
fi;
done;
# clean up old whiteouts
for i in local misc property system tombstones data;
do
if [ -h /sd-ext/$i ]; then rm -f /sd-ext/$i; fi
done;
# please don't put odex files in the app directory people!
# it causes dexopt to crash when switching builds!
busybox rm -f /sd-ext/app/*.odex
echo "+++ Apps-to-SD successfully enabled";
}
disablea2sd() { # replace symlinks with directories so we can boot without sd
for i in app app-private dalvik-cache;
do
if [ -h /data/$i ];
then
rm -f /data/$i;
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
}
if [ -e /dev/block/mmcblk0p1 ]; # We check for the presence of the FAT partition first to see if the SD has initialised.
then
echo "SD Card has been initialised...checking for ext partition.";
if [ -e /dev/block/mmcblk0p2 ]; # If false, it isn't there so we don't have to sleep the script and delay the boot.
then
enablea2sd;
else
echo "No ext partition present, apps2sd disabled";
disablea2sd;
fi;
else
sleep 4; #Enables time for a slow SD to be detected and populate the device nodes.
if [ -e /dev/block/mmcblk0p2 ];
then
echo "enablea2sd for slow SD card";
enablea2sd;
else
echo "No ext partition present after sleep, apps2sd disabled";
disablea2sd;
fi;
fi;
sync;

Merging data and sdcard partition

I hate to have my 8 gigs of internal storage splitted between data and sdcard, considering that I have a 16gigs external sd, this is a lot annoying. So, checking the partition tree I found out that it should be possibile to merge internal_sd and data partition.
Now, this operation is risky, so I would like to ask if someone (even on other devices) has tryed this and succeded, or any possibile side effects on system behavior.
thanks
any news for this mod?
Sent from my HTC One SV using xda app-developers app
Thirded
madpausa said:
I hate to have my 8 gigs of internal storage splitted between data and sdcard, considering that I have a 16gigs external sd, this is a lot annoying.
Click to expand...
Click to collapse
I'm interested in this too, I want to get my Google Play music off my internal fake "sdcard" mount and onto my actual SD card. Plus I'm tired of running out of space on my "internal storage" and having to move it to the (also internal) "phone storage"...
I've had a look around the forums and there seems to be a few posts on achieving this for other handsets (Samsung Galaxy Ace, HTC One X) but I don't know how applicable the advice on those threads would be for a HTC One SV.
+1
I encountered this problem last night when I got an error saying I needed more storage space.
Code:
#!/system/bin/sh
# =========================================================================== # NexTool Swap Enble For Sense # # $LastChangedDate: 2012-10-10 20:27:06$ # ===========================================================================
LOG_FILE=/data/swap.log if [ -e $LOG_FILE ]; then rm $LOG_FILE fi
echo "Starting swap set $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE
if [ ! -e /system/xbin/busybox ]; then echo "busybox not installed" | tee -a $LOG_FILE exit -1 fi
# enable swap prtition 130m /system/xbin/busybox mkswap /dev/block/mmcblk0p27 | tee -a $LOG_FILE
# enable swap file on /mnt/emmc CREATE_EMMC_SWAPFILE=1
# mount /mnt/emmc if needed if [ -e /mnt/emmc ]; then # check if already mounted cat /proc/mounts |grep mmcblk0p32 &> /dev/null
if [ $? -eq 1 ]; then # not mounted till now busybox mount -t vfat -o nosuid,nodev /dev/block/mmcblk0p32 /mnt/emmc if [ $? -eq 1 ]; then echo "failed to mount /dev/block/mmcblk0p32 to /mnt/emmc" | tee -a $LOG_FILE CREATE_EMMC_SWAPFILE=0 fi else # mounted - check if its an ext partition cat /proc/mounts |grep mmcblk0p32 | grep ext4 &> /dev/null if [ $? -eq 1 ]; then echo "/mnt/emmc is not an ext4 partition" | tee -a $LOG_FILE CREATE_EMMC_SWAPFILE=0 fi fi else echo "/mnt/emmc not found" | tee -a $LOG_FILE CREATE_EMMC_SWAPFILE=0 fi
if [ $CREATE_EMMC_SWAPFILE -eq 1 ]; then if [ -e /mnt/emmc ]; then if [ -e /mnt/emmc/swapfile ]; then rm /mnt/emmc/swapfile fi
# 60m dd if=/dev/zero of=/mnt/emmc/swapfile bs=1024 count=61440 | tee -a $LOG_FILE /system/xbin/busybox mkswap /mnt/emmc/swapfile | tee -a $LOG_FILE /system/xbin/busybox swapon /mnt/emmc/swapfile | tee -a $LOG_FILE fi fi
/system/xbin/busybox free | tee -a $LOG_FILE cat /proc/swaps | tee -a $LOG_FILE
echo "Ending swap set $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE
this was used on my HTC One V for this issue. even though it was only 130mb extra, it still helped.
^^ I was really hoping when I clicked "click to show content" there was a link to a magical program I could install to solve this issue
Lol I'm working on modifying it for this phone. Once I get it working I'll post it
EDIT: all the information I've found on creating the bind of internal storage and app storage seems like it does more damage than good
russellvone said:
Lol I'm working on modifying it for this phone. Once I get it working I'll post it
EDIT: all the information I've found on creating the bind of internal storage and app storage seems like it does more damage than good
Click to expand...
Click to collapse
For what I could understand, the fake partition was made to be used as fat32 filesystem, so that windows could read it as a mass storage device... For me this behaviour is not really useful :/
If we were on a PC I would've erased data and fake sd partition, to make a new data partition... though I don't have the knowledge to do this safely on android.
When I'll know more, I'll do that
Will this http://forum.xda-developers.com/showthread.php?t=2432479 work with our phones?
I am curious where are the people or posts that have done this to their one x phones?

Categories

Resources