Mount external partition using rooted Z3 with locked bootloader - Xperia Z3 Q&A, Help & Troubleshooting

Hello.
I just started messing around with my Z3 and so far followed the tutorial here https://forum.xda-developers.com/z3-compact/general/recovery-root-mm-575-lb-t3418714 to install root and recovery without unlocking the bootloader. Also took the chance to make a backup of the ta partition.
My objective was being able to mount an external ext4 partition so I could move game data and free some internal space. I believe the official kernel doesn't support init.d so I searched and found a script that worked and added it to the bottom of init.qcom.post_boot.sh.
Code:
### Init.d support ###
busybox run-parts /system/etc/init.d/
It's a very simple script that creates /sd-ext folder if it's missing and mounts /dev/block/mmcblk1p2 there
Code:
#!/system/bin/sh
#
# mounts ext partition from sd card
if [ ! -d /sd-ext ];
then
mount -o rw,remount /
install -m 774 -o 1000 -g 1000 -d /sd-ext
mount -o ro,remount /
fi
if [ ! -d /sd-ext ];
then
echo sd-ext not created >> /data/Test.log
else
mount -o rw -t ext4 /dev/block/mmcblk1p2 /sd-ext
fi
It was something that I got on some forum plus some trial and error and some Linux knowledge I have.
It seemed to work. The directory was created and mounted and I was able to move the games there using Titanium Backup.
But after I rebooted, the folder was there and all the data, but the apps don't show up on the apps list. I have to reinstall them...
Am I missing something? How can I fix this?

Related

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

[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://forum.xda-developers.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 [email protected] /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 [email protected] /cache
mount yaffs2 [email protected] /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 [email protected]ystem /system
mount yaffs2 [email protected] /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
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
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://forum.xda-developers.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
Click to expand...
Click to collapse
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
Click to expand...
Click to collapse
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
Click to expand...
Click to collapse
were still short of space on system
Code:
qdu.sh /data/
46.9M /data/
46.0M /data/app_s
954.0K /data/app
Click to expand...
Click to collapse
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
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?
bubonik said:
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?
Click to expand...
Click to collapse
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
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.
Just wondering when the ErisPort rom will be available, also could you try this with the Legend Port
M..N said:
Just wondering when the ErisPort rom will be available, also could you try this with the Legend Port
Click to expand...
Click to collapse
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
Links to Modded ROMs added in second post
bubonik said:
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.
Click to expand...
Click to collapse
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
Do i just wipe and install the droideris, also has anyone tested it.
M..N said:
Do i just wipe and install the droideris, also has anyone tested it.
Click to expand...
Click to collapse
full wipe is your best bet
as for testing.. lets just say I've flashed it more than a few times
but I am on Danger, would love some feedback from None DangerSPLs
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?
It would be nice if Htc, Tmo, google could use this to make larger updates but I doubt they'll bother.
M..N said:
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?
Click to expand...
Click to collapse
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
so for danger spl ppl, ROMs will now be quicker (system apps), also roms which could not before be done now can?
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!
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.
hopefully this can make our roms faster with more apps on system.
FatBoyExtraordinaire said:
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!
Click to expand...
Click to collapse
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.

HTC Sensation, Cyanogenmod 9.1, /sd-ext Encryption with Cryptsetup

Having encrypted /data, I'd been interested in encrypting the SD card, either in full, or a full partition. As a new poster to xda, posting without citing reference links does prove a bit more challenging, but here goes:
Given an HTC Sensation, rooted, with Cyanogenmod 9.1 (ICS), and Clockwork Recovery, I partitioned (thru Clockwork) the SD card into FAT32, ext, and swap. Your milage may vary on the next step, but using Fedora, I accessed the SD card, deleted the ext partition, and recreated as an encrypted partition, type ext4. (read up on cryptsetup for alternative ways to create this) For the sake of this post, we'll use the password, "ChangeMe".
I installed LUKS Manager from Google Play, which provides lm.cryptsetup, a renamed binary of Guardian Project's cryptsetup. I didn't use LUKS Manager's implementation of creating encrypted folders, instead, the whole sd-ext partition has been encrypted.
To mount the device at startup, I have the script 99sd-extLUKinit, located at /system/etc/init.d/
#!/system/bin/sh
# Not quite sure what these do, but kept them in
sync;
setprop lk.filesystem.ready 1;
# Remount the root file system to allow changes
mount -o remount,rw rootfs /
# Create the mount point and create a symbolic link
mkdir /mnt/sd-ext
ln -s /mnt/sd-ext /sd-ext
# Decrypt the SD card via cryptsetup, device resides on /dev/block/sd-ext
# Hopefully prompt user for password, but for now, echoed in
echo ChangeMe | lm.cryptsetup luksOpen /dev/block/mmcblk1p2 sd-ext
# Clean errors
e2fsck -y /dev/mapper/sd-ext
# Mount the SD Card via cryptsetup block device
mount -t ext4 -o noatime,nodiratime,barrier=1 /dev/mapper/sd-ext /mnt/sd-ext/
# Remount the root file system to prevent changes
mount -o remount,ro rootfs /
Once verified that the system will automount the encrypted ext4 /mnt/sd-ext partition:
ls /sd-ext
should return with lost & found directory
I moved /data/app and /data/app-private to the encrypted partition:
cp -a /data/app /sd-ext/app
rm -r /data/app
ln -s /sd-ext/app /data/app
cp -a /data/app-private /sd-ext/app-private
rm -r /data/app-private
ln -s /sd-ext/app-private /sd-ext/app-private

[Q] SD-EXT script for Android 4.2.2?

Hi is there a script that increases internal storage via sd-ext for Cyanogenmod 10.1 (android 4.2.2)?
If so could someone link it to me?
gymfreak7855 said:
Hi is there a script that increases internal storage via sd-ext for Cyanogenmod 10.1 (android 4.2.2)?
If so could someone link it to me?
Click to expand...
Click to collapse
Mounts2SD worked really well for me on 4.2.2; it's my a2sd script of choice. Here's the XDA thread about it.
Syd_M said:
Mounts2SD worked really well for me on 4.2.2; it's my a2sd script of choice. Here's the XDA thread about it.
Click to expand...
Click to collapse
That worked for me too!
gymfreak7855 said:
Hi is there a script that increases internal storage via sd-ext for Cyanogenmod 10.1 (android 4.2.2)?
If so could someone link it to me?
Click to expand...
Click to collapse
cronmod's int2ext
engr_exxi said:
cronmod's int2ext
Click to expand...
Click to collapse
That isnt working for me -_-
rhar**** said:
That isnt working for me -_-
Click to expand...
Click to collapse
you must use int2extv2.
scroll my signature for link.
gymfreak7855 said:
Hi is there a script that increases internal storage via sd-ext for Cyanogenmod 10.1 (android 4.2.2)?
If so could someone link it to me?
Click to expand...
Click to collapse
I was using link2sd with King Evo ROM but not if I'm so result. Nor well but if I use function works.
If someone recommended I would appreciate any Script
Create a file name 40int2ext then paste this.
Open notepad or notepad++.
Save file as 40int2ext
delete .txt extension at filename. (note you should set your pc to show extension file names)
You must have an ext partition at your sd card. I use ext4. You could choose among ext2/3/4 though.
As cronmod suggest the maximum size for partition must be 1GB/100mb of internal storage. I used about 512mb
From cronmod's int2ext
Code:
#!/system/bin/sh
#####################################
## CronMod INT2EXT+ - 02/21/2013 ##
## Written by CronicCorey [user=243864]@xda[/user] ##
## 40int2ext ##
#####################################
## Thanks to Mastermind1024 [user=3964321]@Xda F[/user]or helping to solve the IMEI and Baseband issues on some devices
## Thanks to vvFICKvv, DK75, and Dark Passenger [user=3964321]@Xda F[/user]or help to fix compatibility issues with Android 4.2.x
## Thanks to Mortaromarcello [user=4166799]@github[/user] for code to check if mmcblk0p2 exists
## Only continue if mmcblk0p2 exists
if [ ! -e /dev/block/mmcblk0p2 ]
then
exit
fi;
## Set SD cache size
SD_CACHE=/sys/devices/virtual/bdi/179:0/read_ahead_kb
if [ -e $SD_CACHE ]
then
busybox echo "1024" > $SD_CACHE;
fi;
## Make /sd-ext directory if needed and unmount /sd-ext if it already mounted
if [ ! -e /sd-ext ]
then
busybox mount -o remount,rw /;
busybox mkdir /sd-ext;
busybox mount -o remount,ro /;
else
busybox umount /sd-ext;
fi;
## Move /data mount point to /sd-ext
INT_DATA=$(busybox mountpoint -n /data | cut -d ' ' -f1)
busybox umount /data;
busybox mount $INT_DATA /sd-ext;
## Mount mmcblk0p2 to /data
busybox mount -o noatime,nodiratime,nosuid,nodev /dev/block/mmcblk0p2 /data;
busybox chown 1000:1000 /data;
busybox chmod 771 /data;
## Move existing files
if [ ! -e /data/app ]
then
busybox mv /sd-ext/* /data;
fi;
## Move /data, /misc, /nvram, /property, and /radio back to /sd-ext
for i in data misc nvram property radio;
do
if [ ! -e /sd-ext/$i ] && [ -e /data/$i ]
then
busybox mv /data/$i /sd-ext;
busybox mkdir /data/$i;
fi;
## Make Binds
if [ -e /data/$i ]
then
busybox mount -o bind /sd-ext/$i /data/$i;
fi;
done;
## Unmount /sd-ext
busybox umount /sd-ext;
sync;
############################################################################################################################################################
########################################################
## Bind Cache by CyanogenMod ##
## bind mount /data/local/download to /cache/download ##
## if cache partition is too small ##
########################################################
CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
DATAONLY=$(getprop dalvik.vm.dexopt-data-only)
if [ "$DATAONLY" = "1" ]
then
NEEDED=60000
else
NEEDED=105000
fi;
if [ $CACHESIZE -lt $NEEDED ]
then
mount -o bind /data/local/download /cache/download;
fi;
rm /cache/download/downloadfile*.apk >/dev/null 2>&1;
sync;
############################################################################################################################################################
######################################################################
## Automatic ZipAlign by Wes Garner ##
## ZipAlign files in /data that have not been previously ZipAligned ##
## Thanks to oknowton for the changes ##
######################################################################
LOG_FILE=/data/zipalign.log
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "Starting Automatic ZipAlign" | tee -a $LOG_FILE;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk) | tee -a $LOG_FILE;
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk | tee -a $LOG_FILE;
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed | tee -a $LOG_FILE;
fi;
else
echo ZipAlign already completed on $apk | tee -a $LOG_FILE;
fi;
done;
echo "Automatic ZipAlign finished" | tee -a $LOG_FILE;
I used it and it works
engr_exxi said:
cronmod's int2ext
Click to expand...
Click to collapse
Yeah cronmod's didn't work for me.
PROBLEM!
I wanted to extend my EXT partition size. So for that, I used Mini Partition Tool Home Edition to unallocate everything and create the full partition as primary sd card. Then i rebooted into recovery (CWM) and partitioned my sd card and created ext partition of 512 mb. But now, I am unable to use that ext partition. I cant mount it, even in recovery! SD card is working fine but problem is EXT. I have tried it with TWRP too and tried to create a SWAP too. But no luck!
What to do now?
pls dont tell to buy a new SD card.
rhar**** said:
I wanted to extend my EXT partition size. So for that, I used Mini Partition Tool Home Edition to unallocate everything and create the full partition as primary sd card. Then i rebooted into recovery (CWM) and partitioned my sd card and created ext partition of 512 mb. But now, I am unable to use that ext partition. I cant mount it, even in recovery! SD card is working fine but problem is EXT. I have tried it with TWRP too and tried to create a SWAP too. But no luck!
What to do now?
pls dont tell to buy a new SD card.
Click to expand...
Click to collapse
You can't use the ext partition like the primary partition. It's either a script use it like link2sd,data2sd,ext2sd or anythingyoucanimagine2sd.
Try this method. After you partition your sdcard. and installed cronmod's int2ext. Try to reaplce the 40int2ext file with the one I provide. I also suggest to remove other scripts currently at the /system/etc/init.d folder but retain the two 00banner and 90userinit. You can use any root file browsers. Then restart your phone
engr_exxi said:
You can't use the ext partition like the primary partition. It's either a script use it like link2sd,data2sd,ext2sd or anythingyoucanimagine2sd.
Try this method. After you partition your sdcard. and installed cronmod's int2ext. Try to reaplce the 40int2ext file with the one I provide. I also suggest to remove other scripts currently at the /system/etc/init.d folder but retain the two 00banner and 90userinit. You can use any root file browsers. Then restart your phone
Click to expand...
Click to collapse
Thats fine. I have been using it before too.
But now i am unable to mount sd-ext, even through recovery! No use of scripts. They wont work and some of them may even make my phone go to bootloop.
I wanna know how do i partition it now. Some other method than CWM or TWRP.

[Completed] Cyanogenmod 12 and 2nd partition in Sdcard

Any one can tell me what I make round. I have cyanogenmod with one sdcard with 2 partitions the first is mount with ext4 and the second I try fat32 ext4 ext3 ...
I no found fuse.ko in the system but internal partition and storage is mount with fuse in /storage/....
I try to mount the second partition by many difference ways . Always is mount and show up
I copy files from internal memory or sdcard first partition to the second partition
But if I try to open the files I got permission errors . Very possible is a Selinux problem but I have in permissive mode
I look with rootexplorer and files a copy in the 2nd partition in the sdcard for the owner only can read or write
Any ideas how to make the correct mounts for the 2nd Partition on SD card
I make a simple script for make test that is the last configuration I make but still only the owner can read or write that means any app can't open the files if is not root
that is the configuration I use
#!/system/bin/sh
# Mount SD Card Ext4 Script
mkdir /storage/sdcard2
mount -r -w -o exec,dev,suid,rw -t ext4 /dev/block/vold/179:66 /storage/sdcard2
mount -r -w -o exec,dev,suid,rw -t ext4 /dev/block/mmcblk1p2 /storage/sdcard2
chown media_rw:media_rw /storage/sdcard2
chmod g+w /storage/sdcard2
ln -s /storage/sdcard2 /mnt/media_rw/sdcard2
ln -s /storage/sdcard2 /mnt/sdcard2
chown media_rw:media_rw /mnt/sdcard2
chmod g+w /mnt/sdcard2
Hi there,
I'm sorry but I can't find anything related to your question.
Please post that in the forum bellow for more answers from the experts:
> Android Development and Hacking > Android Q&A, Help & Troubleshooting
Good luck

Lollipop 5.1.1 won't use the bind mounted folders

Can anyone please explain what the <censorship> Lollipop is doing with the mount points? I made this simple test script to move the dalvik-cache folder into the "sd-ext", a secondary partition in the SD card in ext4 format:
Code:
#!/system/bin/sh
#
# Stop Android from booting
#
stop
#
#
SDEXT=/dev/block/mmcblk1p2
if [ ! -e /data/dalvik-cache ]; then
mkdir /data/dalvik-cache
chmod 771 /data/dalvik-cache
chown 0.0 /data/dalvik-cache
fi
mount -o rw,remount / && mkdir /sd-ext
mount -w -t ext4 $SDEXT /sd-ext && chmod 775 /sd-ext
mkdir /sd-ext/dalvik-cache
chmod 771 /sd-ext/dalvik-cache && chown 0.0 /sd-ext/dalvik-cache
busybox mount /sd-ext/dalvik-cache /data/dalvik-cache
mount -o ro,remount /
#
# Finished. restart Android
#
start
The problem here is that no matter if /data/dalvik-cache is mounted in /sd-ext/dalvik-cache (and it is) Android/zygote or whoever is in charge still manages to put the dalvik caches in the original /data/dalvik-cache folder. I added the stop/start commands to stop the zygote and its relatives from running. The script is started from /system/su.d as from SuperSU documentation. Which means at the moment the su daemon starts.
I mean this is a much simpler test version of a script I made for GB and worked through KK (with no need to ad the stop/start commands either). What's going on? What am I missing?
Miche1asso said:
Can anyone please explain what the <censorship> Lollipop is doing with the mount points? I made this simple test script to move the dalvik-cache folder into the "sd-ext", a secondary partition in the SD card in ext4 format:
Code:
#!/system/bin/sh
#
# Stop Android from booting
#
stop
#
#
SDEXT=/dev/block/mmcblk1p2
if [ ! -e /data/dalvik-cache ]; then
mkdir /data/dalvik-cache
chmod 771 /data/dalvik-cache
chown 0.0 /data/dalvik-cache
fi
mount -o rw,remount / && mkdir /sd-ext
mount -w -t ext4 $SDEXT /sd-ext && chmod 775 /sd-ext
mkdir /sd-ext/dalvik-cache
chmod 771 /sd-ext/dalvik-cache && chown 0.0 /sd-ext/dalvik-cache
busybox mount [color=red]--bind[/color] /sd-ext/dalvik-cache /data/dalvik-cache
mount -o ro,remount /
#
# Finished. restart Android
#
start
The problem here is that no matter if /data/dalvik-cache is mounted in /sd-ext/dalvik-cache (and it is) Android/zygote or whoever is in charge still manages to put the dalvik caches in the original /data/dalvik-cache folder. I added the stop/start commands to stop the zygote and its relatives from running. The script is started from /system/su.d as from SuperSU documentation. Which means at the moment the su daemon starts.
I mean this is a much simpler test version of a script I made for GB and worked through KK (with no need to ad the stop/start commands either). What's going on? What am I missing?
Click to expand...
Click to collapse
--bind missing?
Have you tried instead modifying boot.img to run it directly? --- add in a busybox and replace the dalvik creation with a redirect to a .sh...
HypoTurtle said:
--bind missing?
Have you tried instead modifying boot.img to run it directly? --- add in a busybox and replace the dalvik creation with a redirect to a .sh...
Click to expand...
Click to collapse
Well, I used "busymox mount" because it automatically detects that being two directories they get mounted as a bind. Or so i supposed. Still i doubled checked, now. Same thing.
Not sure what you mean about redirecting to a .sh. Anyway, I also tried (the old) mounts2sd for testing. Same thing. it's like if something in Android gets hold of /data and its subdirectory and mounting over it doesn't matter. This with zygote dead. It's driving me mad.
Well, I believe it is related to selinux and the mount namespaces. I disabled the option in SuperSU to have individual name spaces and something different did happen: the whole ART crashed, rebooting the phone (not just Android, I think even the kernel restarts).
As they usually say.. let's forget about it. Link2SD doesn't help much either, since it must keep the system dalvik caches (more than 500GB) in the internal memory.

Categories

Resources