[KERNELFIX] damageless/Fresh 2.0b2 kernel w/ Apps2sd REV 3 - Hero CDMA Android Development

I have tested the following with the frest 2.1 2.0b2 build and it does enable Apps2SD.
Ver 3 now should work on fresh fine, and damageless (sometimes I found enabling apps2sd on damageless causes lockups at boot, these can be fixed by doing WIPE for DATA for now) :/
MAKE NANDROID BACKUP
This has been tested on: Fresh 2.0b2
ADDED INSTRUCTIONS TO ENABLE ON DAMAGELESS
Also this has been edited so the first few pages refer to the old style before I had signed zips working. xD
Flash the Update Zip Attached VIA recovery menu. That means copy it to the root of your sdcard (aka /sdcard/).
I tested this after a fresh wipe with a blank ext2 partition and one vfat (normal). I did not even boot it first run but you should be able to flash this on an existing rom. Others can test on other roms but I am using this for now on fresh 2.1 2.0b2.
Afterwards run the following after booting
FOR VER 3 SIGNED
Code:
[B]
adb remount
adb shell
cd /system/bin
ln -s /system/xbin/busybox /system/bin/sed
ls -l /system/bin/sed # make sure it exists
cd /
apps2sd on
# should say apps2sd enabled
reboot[/B]
FOR VER 1 SIGNED
Code:
[B]
adb remount
adb shell
cd /system/bin
busybox --install /system/bin
ls -l sed # make sure it exists
cd /
chmod 755 /system/bin/apps2sd
chmod 755 /system/xbin/apps2sd
apps2sd on
# should say apps2sd enabled
reboot[/B]
FOR VER 3 SIGNED for DAMAGELES
Code:
[B]
adb remount
adb shell
cd /
apps2sd on
# should say apps2sd enabled
# below fixes up the scripts generated by the 'apps2sd on' line.. who ever wrote that had it put DOS CR/LF on the ends and thats whats breaking APPS2SD on damageless!
cd /system/etc/init.d
dos2unix 04apps2sd
dos2unix 05userinit
reboot[/B]
Enjoy

Will this work on the other 2.1 ROMs?

I have only tested on fresh 2.1 2.0B . I would think that logically this should work on the other fresh 2.1 2.0 and perhaps Damageless's. As for darchstar's try it I havent run that rom in a few days.

kkruse said:
I have only tested on fresh 2.1 2.0B . I would think that logically this should work on the other fresh 2.1 2.0 and perhaps Damageless's. As for darchstar's try it I havent run that rom in a few days.
Click to expand...
Click to collapse
If someone could test this out and let me know if it works on my ROM then I would love to just use the same method to get it going with the author's permission (credit will be given).

i keep no space left on device when i do this command
cat /dev/zero > /dev/mtd/mtd2

networx2002 said:
i keep no space left on device when i do this command
cat /dev/zero > /dev/mtd/mtd2
Click to expand...
Click to collapse
same for me
cat: write error: No space left of device

If I remember right it is a different file than what he posted...
I will have to check.

Maybe you can help me w/ this... When I adb shell in recovery I get "/#" instead of "#" & I can't "mount -a"...

networx2002 said:
i keep no space left on device when i do this command
cat /dev/zero > /dev/mtd/mtd2
Click to expand...
Click to collapse
Another one with this issue.
Running Fresh 2.1 2.0b2 on a clean install.
Already have a partitioned SD card with apps installed (from fresh 1.1 rom)
Has anyone besides OP gotten this to work?

mrcharlesiv said:
Maybe you can help me w/ this... When I adb shell in recovery I get "/#" instead of "#" & I can't "mount -a"...
Click to expand...
Click to collapse
/# would mean you are adb into recovery......I think

Aye, / # means you are in recovery mode on the phone is all.
Not sure why you aren't able to mount -a. I'm curious if anyone has gotten this method to work yet..?

So I went ahead and did every step despite the errors it gave just to see what happens... It's booting....
EDIT: Seems like it worked. My internal memory dropped by a/b 20 megs and I'm reinstalling everything. Idk.

mrcharlesiv said:
So I went ahead and did every step despite the errors it gave just to see what happens... It's booting....
EDIT: Seems like it worked. My internal memory dropped by a/b 20 megs and I'm reinstalling everything. Idk.
Click to expand...
Click to collapse
K, I attempted to reboot and it hangs at the HTC screen, so I'm going to boot back into recovery and try to continue from the out of space error.

Last night I tried adding a2sd, e2fsck to /system/bin of Fresh and made a directory SD in /system
Then I added to the init.rc
on property:cm.filesystem.ready=1
class_start default
start a2sd
and
service a2sd /system/bin/logwrapper /system/bin/sh /system/bin/a2sd
disabled
oneshot
then mkbootimg and placed that boot.img into fresh's zip and resigned it.
It flashed ok. But still didn't take. I'm still learning, the stuff I did to iniit.rc I was just basically copying and pasting from other roms with a2sd init.rc's I was going to start a thread until I saw this one.

I was able to boot back into recovery and complete the setup past the out of space error (I still get it though) and reboot. It booted up, but apps are still installing to the internal memory, so it did not work.

mrcharlesiv said:
So I went ahead and did every step despite the errors it gave just to see what happens... It's booting....
EDIT: Seems like it worked. My internal memory dropped by a/b 20 megs and I'm reinstalling everything. Idk.
Click to expand...
Click to collapse
Try this from CMD Prompt
Adb remount
Adb shell
# cd /data/app
#pwd
let us know what you get
if data/app it didnt work.

So I've reinstalled about 15 apps and my internal memory is staying at 73...
I'm still kinda worried about those errors I got.

mrcharlesiv said:
Maybe you can help me w/ this... When I adb shell in recovery I get "/#" instead of "#" & I can't "mount -a"...
Click to expand...
Click to collapse
same here... anyone know where to go from here?

mrcharlesiv said:
So I've reinstalled about 15 apps and my internal memory is staying at 73...
I'm still kinda worried about those errors I got.
Click to expand...
Click to collapse
did you try doing what swaze said?
swaze said:
Try this from CMD Prompt
Adb remount
Adb shell
# cd /data/app
#pwd
let us know what you get
if data/app it didnt work.
Click to expand...
Click to collapse

kashb91 said:
did you try doing what swaze said?
Click to expand...
Click to collapse
Way to rain on my parade! Yeah it didn't work. Idk why my memory dropped and stayed lower then?

Related

GScript * Easily launch/save shell scripts from within Android UI * - Useful scripts

As some of you might have seen or even used, I have created an application that allows executing of shell scripts from within Android and it will even allow you to create a direct shortcut on your homescreen to a script ( for example to start Debian or reboot your phone ).
I know a lot of developers ( I also didnt at first ) don't look in the "applications and games" section, but i thought it was the best place to post the actual application.
I will keep updating that post with the actual application process/updates, but ive created this thread to see if people ( I think most of the actual linux experienced people are in this section ) would like to share their linux knowledge to other peoples uploading useful .sh files ( for backing up stuff etc etc ), so that less experienced can just load them in to my application, without risking all typos.
So if you have a nice script that is useful please upload it so we can all benefit from it.
The actual application can be found here:
http://forum.xda-developers.com/showthread.php?t=486486
Please dont ask question or place suggestions about the application in this thread, but use the one Ive created for the actual development and keep this thread for scripts only.
Regards,
Rob
I was thinking about starting a thread just like this one-- for everyone to post up their scripts. Don't know why I didn't. Anyway, I asked the question awhile back how to create a script for remounting the file system as read/write, which led to my discovery of GScript. In any case, here's what I was told to use:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
Be advised that I have no idea if this actually works or not. Perhaps someone could test and post the results?
tubaking182 said:
that takes to long, i find it easier when i am using the comp to just click my terminal(which is almost always up and running) and type reboot_phone(i have a script on the computer that contains the comand adb shell reboot) and also another for rebooting into recovery and one more for bootloader
i guess i'm lazy but if i can find a way to automate anything i do in life i go ahead and do it. i have a script for nearly everything i do to my phone.
on a more on-topic note, i was hoping someone would post the command to reboot and apply an update.zip, i know it is in the JF autoupdater, but i just want to be able to hit a shortcut on my home screen to apply themes as well.
Click to expand...
Click to collapse
Code:
su
echo "boot-recovery
--update_package=/sdcard/update.zip" > /cache/recovery/command
reboot recovery
Untested, you might have to play around with the /sdcard/update.zip to get it to load properly, I'm not sure exactly how you put the path in there. This will, for sure, reboot it into recovery mode, and tries to automatically apply an update.zip.
Edit:
--update_package=sdcard:update.zip
Should do it. I hope.
Here's a script I built to make a rom into the "lite" version needed by many of the themes. It's not much but it's my first one.
Code:
mount -o rw,remount -t yaffs2, /dev/block/mtdblock /system
rm -r /system/media/audio/ringtones
rm -r /system/media/audio/notifications
reboot
Gary13579 said:
Code:
su
echo "boot-recovery
--update_package=/sdcard/update.zip" > /cache/recovery/command
reboot recovery
Untested, you might have to play around with the /sdcard/update.zip to get it to load properly, I'm not sure exactly how you put the path in there. This will, for sure, reboot it into recovery mode, and tries to automatically apply an update.zip.
Edit:
--update_package=sdcard:update.zip
Should do it. I hope.
Click to expand...
Click to collapse
You don't need the "su" at the beginning. Gscript has a checkbox to indicate if SU is needed and will add it on it's own. Putting it in causes the script to hang.
Anyway to make it close the script window when the script completes? Right now I have it doing an app backup and echoing DONE. But I'd like to automate the process if possible.
Exit doesn't seem to work.
Gary13579 said:
Code:
su
echo "boot-recovery
--update_package=/sdcard/update.zip" > /cache/recovery/command
reboot recovery
Untested, you might have to play around with the /sdcard/update.zip to get it to load properly, I'm not sure exactly how you put the path in there. This will, for sure, reboot it into recovery mode, and tries to automatically apply an update.zip.
Edit:
--update_package=sdcard:update.zip
Should do it. I hope.
Click to expand...
Click to collapse
It does reboot into recovery mode but I get the error "Can't mount /sdcard/Update.zip Installation aborted."
I'm able to just apply the update by pressing Alt+S but would be nice if it was all automated.
wpbcubsfan said:
It does reboot into recovery mode but I get the error "Can't mount /sdcard/Update.zip Installation aborted."
I'm able to just apply the update by pressing Alt+S but would be nice if it was all automated.
Click to expand...
Click to collapse
Same result for me.
Got it!!!
ok!
used this as script to change theme
cp /sdcard/themes/aero/update.zip /sdcard/
echo "boot-recovery
--update_package=SDCARD:update.zip" > /cache/recovery/command
reboot recovery
Needed to use caps for SDCARD!!!
found it poking around the recovery.c file
better still no need to copy over update.zip in root Just in case of emergency.
Code:
echo "boot-recovery
--update_package=SDCARD:themes/aero/update.zip" > /cache/recovery/command
reboot recovery
beagz said:
ok!
used this as script to change theme
cp /sdcard/themes/aero/update.zip /sdcard/
echo "boot-recovery
--update_package=SDCARD:update.zip" > /cache/recovery/command
reboot recovery
Needed to use caps for SDCARD!!!
found it poking around the recovery.c file
better still no need to copy over update.zip in root Just in case of emergency.
Code:
echo "boot-recovery
--update_package=SDCARD:themes/aero/update.zip" > /cache/recovery/command
reboot recovery
Click to expand...
Click to collapse
Dude, you rock! Thanks!
Clear Caches
I use this script to clear almost all of the app caches
Code:
#Deletes all caches in one fell swoop :]
#Locations of the caches were taken from various sites, including xda and androidcommunity.com
#written by indiekid97
#Deletes browser cache
rm -R /data/data/com.android.browser/cache/webviewCache
#Deletes Maps cache
rm -R /data/data/com.google.android.apps.maps/files
#Deletes StreetView
rm -R /data/data/com.google.android.street/cache
#Deletes Market cache
rm -R /data/data/com.android.vending/cache
#Deletes Tunewiki cache
rm -R /data/data/com.tunewiki.lyricplayer.android/cache/webviewCache
#Deletes Myspace cache
rm -R /data/data/com.myspace.android/files
#Deletes GMail cache
rm -R /data/data/com.google.android.gm/cache/webviewCache
Copy from /system/app
I get get the phone to copy from data app and private however, when I try to copy apps from /system/app it does nothing.
Mod_edit
any ideas?
I also tried to cd in the script to navigate to the data and still it only runs the first two copy commands.
removed copyright procedureYou can not display procedures concerning the two app folders being transferred to Fat32 portion of card.
a1t said:
I get get the phone to copy from data app and private however, when I try to copy apps from /system/app it does nothing.
Mod_edit
any ideas?
I also tried to cd in the script to navigate to the data and still it only runs the first two copy commands.
Click to expand...
Click to collapse
Woops
Sorry dudes. If we can still talk about any possibilities, I'm down. if not, oh well. now on eggshells
looking for script to move a specific directory on /system to a location on my sdcard
if anyone is interested PM me.
What would the script be to disable USB mounting to the computer? It's a hassle for me to have to un-plug the USB cable when I want to unmount, it would be very beneficial to have a quick press of an icon on the Home screen to do this
*Edit: after tinkering around with it for a bit, I see that this cannot be done- I tried mounting the SD card to computer and then running a script, *any* script will not load because GScript requires /sdcard/gscript_tmp.sh to be accessable in order to run a script.
Mounting to computer and then running a script from GScript simply shows an error:
Code:
Error:
/sdcard/gscript_tmp.sh
SO, in order for it to work, GScript would probably have to be configured to search for the script elsewhere to load while the SD card is mounted.
Here is a small script to back up current system sounds to the SD card, probably most useful if you do this prior to using the Make Lite script:
Code:
cp -r /system/media/audio /sdcard/audio
If there are any errors please let me know.
Once they're backed up, you can merge the folder into /sdcard/media for proper use with Ringdroid.
I'm not sure whether to use cp -r or cp -a, so I will stick with -r for now and see if anyone has any other suggestion.
quick question....
where can i find out what the "flags" mean.
-a
-t
and so on.
Mikey1022 said:
quick question....
where can i find out what the "flags" mean.
-a
-t
and so on.
Click to expand...
Click to collapse
I found this link useful to your question, might want to scroll down a bit to see the most direct answer to what you were wondering:
http://www.freeos.com/articles/4414/
Hope that helps
a start
http://www.computerhope.com/unix/ucp.htm
a1t said:
http://www.computerhope.com/unix/ucp.htm
Click to expand...
Click to collapse
Proxin said:
I found this link useful to your question, might want to scroll down a bit to see the most direct answer to what you were wondering:
http://www.freeos.com/articles/4414/
Hope that helps
Click to expand...
Click to collapse
Thank you to both of you

Ash as login shell

Hi All,
The Ash shell provides a few advantages over the Android default sh shell such as command history and cursor handling at the prompt. There are other benefits, but these are the first that come in most handy (to me).
The following tutorial will get you ash as the login shell with as yet no ill effects:
Note: that in my case, I'm using my android2sd construct and thus this modification is being done to my active overlay profile setup, thus to undo it I can simply boot into "safe\\normal" mode and undo the changes without possibly locking me out of the console should it have failed (which it didn't) But you can edit the Android /system/bin/sh file in this manner directly.
Ash as Login Shell:
OK, make the /system fs read-write:
mount -o remount,rw /system
Click to expand...
Click to collapse
Note: that the fs type is not needed, and in my case is not yaffs but ext3, Android will figure it out proper.
Next,
cp -a /system/bin/sh /system/bin/sh0
Click to expand...
Click to collapse
(this is for backup purposes and allows us to undo the change if so desired, or delete it if no longer needed).
Note: I'm using JF1.51 roms, so busybox ash is available as /system/xbin/bb/ash, so that is what I am using here; use ash however you are able to access it.
echo "#!/system/xbin/bb/ash">/system/bin/sh
echo "/system/xbin/bb/ash \[email protected]">>/system/bin/sh
Click to expand...
Click to collapse
Please note the use of (redirect\\overwrite)> and (redirect\\append)>>.
This will overwrite sh with a script to load the desired shell, executing any command-line arguments passed, and preserve the permissions of the original sh file. You can manually set the permissions the same as they are for our sh0 backup if the permissions (root.shell)(0755) don't seem to keep.
Finally reset the read-only state of /system:
mount -o remount,ro /system
Click to expand...
Click to collapse
Now if you shell-in\\telnet-in you should get the ash prompt which unlike the Android sh default prompt, includes the present working directory(pwd) ie: '/#' instead of just '#'.
Note: A reboot should not cause the loss of the modification, but if does, copy the new sh script to your /data/local/bin location or something and copy it back via boot script or something.
Shell Scripts:
If you're like me, you discovered that Android didn't need the interpreter declaration comment in scripts, and thus may not have used them...Well, you will need to update your scripts to include them by adding something similar to the following as the first line of your scripts:
#!/system/xbin/bb/ash
Click to expand...
Click to collapse
Again, please note that I am using JF1.51 roms and the location of the busybox ash shell is what I'm listing; put the full location to the shell you intend to use as this location.
Without the interpreter declaration, ash simply complains 'not found' at the first command, as ash doesn't know how to interpret the script, and doesn't seem to default to the login shell.
Hope someone finds this helpful!
sweet. This is going to be very useful
BAM. thats sexy. i just did this on CM3.6.7.1. works like a charm.
scratches head. i'm lost. what does this do and how does this make my g1 better?
temporizer said:
scratches head. i'm lost. what does this do and how does this make my g1 better?
Click to expand...
Click to collapse
im not sure about the other features, but the one i installed it for is to have your working directory in front of ur prompt. ex:
Code:
/# cd /sdcard
/sdcard # cd /system/sd
/system/sd #
etc...
EDIT: Also, if you use ConnectBot, you'll notice with the regular sh, if u scroll up with tracball, you get BS characters on the prompt. with THIS one, when you scroll up, you get last command entered. VERY handy for when you mistype one character on a long-ass command.
I love you
Couldn't you do this?
Code:
mv /system/bin/sh /system/bin/sh0
ln -s /system/xbin/bb/ash /system/bin/sh
great job, i'm going to get ash working on my G1 (CM-3.6.7.1)
Thanks.
kanstin said:
Couldn't you do this?
Code:
mv /system/bin/sh /system/bin/sh0
ln -s /system/xbin/bb/ash /system/bin/sh
Click to expand...
Click to collapse
I tried this and it worked even after a reboot...
Sweet, I love the scroll back with trackball in the terminal!!! Me thinks this should get absorbed into the next Cyan release.
kanstin said:
Couldn't you do this?
Code:
mv /system/bin/sh /system/bin/sh0
ln -s /system/xbin/bb/ash /system/bin/sh
Click to expand...
Click to collapse
Yes, I reckon you could. Though I had done a few experiments where the symlink failed, but I'm fairly sure it was do to the link: /system/xbin/bb/ash -->../busybox and /system/bin/../busybox not existing...so I did it via script. Many ways to skin a cat they say.
Thank you all... this is fricken awesome!!
temporizer said:
scratches head. i'm lost. what does this do and how does this make my g1 better?
Click to expand...
Click to collapse
It gives a more advanced shell for when you use the command line interface or telnet into your G1. If you don't use the command line a lot, it won't help you.
As for specific benefits to the advanced version, it was listed in the first post.
Hi,
imho this is rather a hack that exposes you to the risk at least on CM to loose your
shell during boot as xbin.sqf the compressed squashfs filesystem containing
busybox is mounted rather late in the boot process. A cleaner solution would be to
move busybox to system/bin and link it to sh. That way you ensure that sh will
always be accessible during boot and also later on, thus not interfering with
further developments. A alternative could be to compile a standalone version
of busybox containing only ash (for size reasons, as size in /system/bin is precious)
copy that to /system/bin and link sh to it.
Seems to work fine on Dude's. Not really sure how it should open, but I type "ash" at the prompt and I get the /$ and /# if superuser. I also get the command history by rolling the trackball, which is a very nice feature.
Can i install this without using my PC?
temporizer said:
Can i install this without using my PC?
Click to expand...
Click to collapse
Should work using terminal.
Tried it on JACHero 2.7.1
I tried the hard link one and I get a read only fs error on the first move command. What should I chmod to get past that?
mugafuga said:
I tried the hard link one and I get a read only fs error on the first move command. What should I chmod to get past that?
Click to expand...
Click to collapse
Do this first before the mv and the symlink.
mount -o remount,rw /system
farmatito said:
Hi,
imho this is rather a hack that exposes you to the risk at least on CM to loose your
shell during boot as xbin.sqf the compressed squashfs filesystem containing
busybox is mounted rather late in the boot process. A cleaner solution would be to
move busybox to system/bin and link it to sh. That way you ensure that sh will
always be accessible during boot and also later on, thus not interfering with
further developments. A alternative could be to compile a standalone version
of busybox containing only ash (for size reasons, as size in /system/bin is precious)
copy that to /system/bin and link sh to it.
Click to expand...
Click to collapse
Is this in any way accurate? I dedicate my g1 to cyan's roms and wouldn't want anything to hinder any of the goodness that is cyanogenMod. Advice?
Load ash when terminal is started?
temporizer said:
Is this in any way accurate? I dedicate my g1 to cyan's roms and wouldn't want anything to hinder any of the goodness that is cyanogenMod. Advice?
Click to expand...
Click to collapse
Safest method will be to change to ash shell once terminal app is started (same as typing "ash" to switch shell from sh to ash). I don't know how to do it in android (in linux you could add it to your login script).
So if someone knows how to execute a command when we login using the terminal app, then switching to ash shell would work without fear of breaking any other functionality.

[APP] Zipalign binary and script - Optimize installed applications

Hey everyone,
wesgarner said:
Zip Align reduces the amount of RAM used during processing running for a major speed increase in running the apps: http://developer.android.com/guide/developing/tools/zipalign.html
Click to expand...
Click to collapse
I had been messing about with a script to pull apks off my phone, zipalign them and then push them back, but then I saw wesgarner's CM build with a binary and script for use on your phone. I don't really want to mess round with flashing a ROM just for that though, so I've ripped them out and uploaded them below. Another reason is I want to run this manually (with GScript) rather than on boot (as it does in wesgarner's ROM).
I take no credit for this, the binary and script were both taken from wesgarner's CM buiild.
To "install" this, just adb push the two files in the zip below onto your phone with:
Code:
adb shell mount -o remount,rw /system
adb push zipalign /system/bin
adb push zipalign_apks /system/sd/zipalign_apks.sh
adb shell chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.sh
adb shell mount -o remount,ro /system
Then anytime you want to run the script just do:
Code:
adb shell sh /system/sd/zipalign_apks.sh
Or in terminal:
Code:
su
sh /system/sd/zipalign_apks.sh
Has been tested on CM 4.2.7.1
ZipAlign
senab said:
Hey everyone,
I had been messing about with a script to pull apks off my phone, zipalign them and then push them back, but then I saw wesgarner's CM build with a binary and script for use on your phone. I don't really want to mess round with flashing a ROM just for that though, so I've ripped them out and uploaded them below. Another reason is I want to run this manually (with GScript) rather than on boot (as it does in wesgarner's ROM).
I take no credit for this, the binary and script were both taken from wesgarner's CM buiild.
To "install" this, just adb push the two files in the zip below onto your phone with:
Code:
adb shell mount -o remount,rw /system
adb push zipalign /system/bin
adb push zipalign_apks.sh /system/sd
adb shell chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.sh
adb shell mount -o remount,ro /system
Then anytime you want to run the script just do:
Code:
adb shell /system/sd/zipalign_apks.sh
Or in terminal:
Code:
su
sh /system/sd/zipalign_apks.sh
Has been tested on CM 4.2.7.1
Click to expand...
Click to collapse
i do not even know what zipalign does .. but i did add this to my script
# lucid -z
so .. what does it do exactly?
Sweet... Thanks...
I was surprised that more than half of the Apps I have were already ZipAligned...
LucidREM said:
i do not even know what zipalign does .. but i did add this to my script
# lucid -z
so .. what does it do exactly?
Click to expand...
Click to collapse
APKs (as you probably already know) are just zip files. zipalign simply aligns the APK on 4-byte boundaries which Android is more efficient wrt memory access.
You can read more from Jean-Baptiste Queru at http://android-developers.blogspot.com/2009/09/zipalign-easy-optimization.html
Vermithrax said:
Sweet... Thanks...
I was surprised that more than half of the Apps I have were already ZipAligned...
Click to expand...
Click to collapse
Since the 1.6 SDK was released, the ADT does this automatically on APK export. Therefore any app which has been updated since ~September (and was developed using the ADT Eclipse plugin) will be zipalign'd. I was more surprised that 12 out of the 43 apps on my phone weren't aligned!
ZipAlign
senab said:
APKs (as you probably already know) are just zip files. zipalign simply aligns the APK on 4-byte boundaries which Android is more much efficient wrt memory access.
You can read more from Jean-Baptiste Queru at http://android-developers.blogspot.com/2009/09/zipalign-easy-optimization.html
Click to expand...
Click to collapse
that's awesome .. thanks for the link .. i hadn't read about that
Thanks much for this!
Here is a simple gscript to install zipalign after a wipe or new build flash.
You must first create directory /sdcard/zipalign and place zipalign from the zip in the OP there. Path to the file should now be /sdcard/zipalign/zipalign.
Place this script in your gscript folder (after removing .txt from the name) and load it in gscript with su permissions.
I also find it easier to run the script in the zip from the OP in Gscript as well. Instead of placing it in /system/sd run this (assumes zipalign_apks.sh is at root of C:\)
Code:
adb remount
adb push C:\zipalign_apks.sh /sdcard/gscript/zipalign_apks.sh
Then just load it into Gsrcipt with su permissions as with the other script.
Easiest of all may just be to use the commands within Lucid's script. But, I'm comfortable with Gscript, and I can make it 2 clicks away.
EDIT: First execution, you may want to run the original way, because guess what? Gscript isn't zipaligned. But it worked fine just the same.
worked great thanks.
Thanks. I didn't want to flash whole ROM to zipalign apps, so script was very handy.
Actually I've zipaligned only 2 apps, one of them was everybody loved Linda
so anyone wanna bless me with a terminal code to install the script?
garz said:
so anyone wanna bless me with a terminal code to install the script?
Click to expand...
Click to collapse
Read, its on the first post....xD
ZipAlign
garz said:
so anyone wanna bless me with a terminal code to install the script?
Click to expand...
Click to collapse
# lucid -z
yeah so su? then #lucid -z? cause that did nothing for me...
LucidREM said:
i do not even know what zipalign does .. but i did add this to my script
# lucid -z
so .. what does it do exactly?
Click to expand...
Click to collapse
I put a quick explanation of my script on my ROM page: here ya go (rough explanation)
Zip Align reduces the amount of RAM used during processing running for a major speed increase in dex-opt and running the apps, along with the RAM hack and a CC (or your userinit) boots speeds incredibly and better usability of apps (boot and system) in Android: http://developer.android.com/guide/d.../zipalign.html
Most developers have not used this yet (CM does ZipAlign his apps), but this does for the system apps provided from the now old Google Apps
Click to expand...
Click to collapse
senab said:
Since the 1.6 SDK was released, the ADT does this automatically on APK export. Therefore any app which has been updated since ~September (and was developed using the ADT Eclipse plugin) will be zipalign'd. I was more surprised that 12 out of the 43 apps on my phone weren't aligned!
Click to expand...
Click to collapse
Agreed. The Market won't let non-zipaligned apps be uploaded.
AndroidAppCritic said:
Agreed. The Market won't let non-zipaligned apps be uploaded.
Click to expand...
Click to collapse
it will really, it doesn't detect the diff
Also, SDK4 didn't really include an enforced ZipAlign like SDK5 (eclair) does
Plus I built the ZipAlign from source from eclair - so this script may not update them all perfectly
garz said:
yeah so su? then #lucid -z? cause that did nothing for me...
Click to expand...
Click to collapse
Unzip the files to your SD Card, then:
Code:
su
mount -o remount,rw /system
mv /sdcard/zipalign /system/bin
mv /sdcard/zipalign_apks /system/sd/zipalign_apks.sh
chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.sh
mount -o remount,ro /system
Post deleted becoz it was redundant
can someone make a script for windows or a bat file that can zipalign a batch of apks? I am not that ofay with line commands and when i create a new theme (which i often do), i then have to go and zipalign every single apk i have altered 1 at a time..... i do:
Code:
zipalign -f -v 4 E:\app\theapp.apk E:\app\theapp.apk.out
senab said:
Unzip the files to your SD Card, then:
Code:
su
mount -o remount,rw /system
cp /sdcard/zipalign /system/bin
cp /sdcard/zipalign_apks.sh /system/sd
chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.sh
mount -o remount,ro /system
Click to expand...
Click to collapse
This isnt working for me bc of the .sh after zipalign_apks .. do i rename the zipalign_apks to zipalign_apks.sh after unzipping?
edit:that worked THANKS!

[GUIDE] How to Flash a ROM WITHOUT an SD Card

How to Flash a ROM Without an SD Card
​
This is for all those who don't have a working sdcard, sdcard slot, etc. but want still to flash a new rom
Prerequisites:
Flash an Amon_RA recovery if you're using Clockwork - I recommend Darch's unofficial (CDMA Hero refer to my signature if you need it)
Access to a computer that had AndroidSDK tools on it - you'll be using ADB
Put whichever ROM.zip you want to flash in your android-sdk\tools folder - I would rename it to something simple. (My example which I'll be using for this tut is: C:\AndroidSDK\toosl\ROM.zip)
Directions:
Reboot into the Amon_RA recovery
Wipe data/factory reset, cache, and dalvik via the recovery menu
Open up cmd/terminal on your computer
Navigate to your android-sdk\tools directory
Enter the following in cmd/terminal:
Code:
adb shell
mount data
*wait a second or two* You may or may not get the "/ #" line returned.
Despite what happens press "Ctrl+C" to break the command and get back to the standard AndroidSDK\tools> directory
Enter the following in cmd/terminal:
(replace "ROM.zip" with the name you're using)
Code:
adb push ./ROM.zip /data/
*this will take anywhere from 30sec to a min depending on the rom.zip size*
Then we do this in cmd:
Code:
adb shell
recovery --update_package=DATA:ROM.zip
Wait for it to finish flashing/updating
Reboot
ENJOY
Brief rundown of what we just did:
Wiped /data/ to free up space for the zip
Put our ROM.zip onto the /data/ partition since we don't have an SD Card to work with.
Told the recovery to flash from our /data/ partition instead of /sdcard/
I did some digging around the AmonRA github to look for the commands it actually performs while in recovery I figured out exactly how to do what I wanted.
(namely THIS PAGE for those of you who are interested in seeing the exact page I found them on)
Good knowledge man. Thanks for the guide
Root-Hack-Mod-Always™
I got excited when i read the title having lost my sdcard, unfortunately my lap top in Frys customers service n i never went back for it, bs they said it was water damage lol idiots are wrong so my guarantee didnt cover it,anyways i think most of us knew this method, thnkz anyways........WHAT I WANT TO KNOW IS HOW OR IF POSSIBLE TO CHANGE THE PATH TO THE STOCK BROWSER DOWNLOADS TO INTERNAL STORAGE????????????? PLS IF ANY1 KNOWZ LET ME KNOW
gotablunt said:
I got excited when i read the title having lost my sdcard, unfortunately my lap top in Frys customers service n i never went back for it, bs they said it was water damage lol idiots are wrong so my guarantee didnt cover it,anyways i think most of us knew this method, thnkz anyways........WHAT I WANT TO KNOW IS HOW OR IF POSSIBLE TO CHANGE THE PATH TO THE STOCK BROWSER DOWNLOADS TO INTERNAL STORAGE????????????? PLS IF ANY1 KNOWZ LET ME KNOW
Click to expand...
Click to collapse
/sigh. I'd try to help if I knew what this post was even about. All I got was something about a laptop at Frys.
Anyway, nice post OP.
gotablunt said:
I got excited when i read the title having lost my sdcard, unfortunately my lap top in Frys customers service n i never went back for it, bs they said it was water damage lol idiots are wrong so my guarantee didnt cover it,anyways i think most of us knew this method, thnkz anyways........WHAT I WANT TO KNOW IS HOW OR IF POSSIBLE TO CHANGE THE PATH TO THE STOCK BROWSER DOWNLOADS TO INTERNAL STORAGE????????????? PLS IF ANY1 KNOWZ LET ME KNOW
Click to expand...
Click to collapse
Fail. Put the blunt DOWN.
+1 OP
You first mentioned
kyouko said:
My example which I'll be using for this tut is: C:\AndroidSDK\toosl\kyoukoROM.zip
...
Code:
adb push ./kyoukoROM.zip /data/
Click to expand...
Click to collapse
But later, you use this:
Code:
adb shell
recovery --update_package=DATA:mau5.zip
Click to expand...
Click to collapse
I am confused on whether we use 'mau5.zip' as it is in the final command or change it to the name of our rom, which would be kyoukoROM.zip in your case?
HQRaja said:
You first mentioned
But later, you use this:
I am confused on whether we use 'mau5.zip' as it is in the final command or change it to the name of our rom, which would be kyoukoROM.zip in your case?
Click to expand...
Click to collapse
It would be the name of the file you are trying to flash.
How do you flash the recovery without an SD card tho?
EDIT: I figured it out. I will post my steps later.
Here is what I did:
Rooted phone
Attempted to push Flash_image - failed due to filesystem permissions
Steps for Flash_Image:
adb shell
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system/bin
chmod 777 /system/bin
exit/ctrl+c
adb shell
adb push flash_image.zip /system/bin/flash_image
adb shell chmod 0755 /system/bin/flash_image
Flashing Recovery:
adb push Recovery.img /system/bin/
adb shell
flash_image recovery /system/bin/Recovery.img
rm /system/bin/Recovery.img
reboot recovery
Then proceeded to follow the steps in this guide successfully
Stuke00 said:
Here is what I did:
Rooted phone
Attempted to push Flash_image - failed due to filesystem permissions
Steps for Flash_Image:
adb shell
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system/bin
chmod 777 /system/bin
exit/ctrl+c
adb shell
adb push flash_image.zip /system/bin/flash_image
adb shell chmod 0755 /system/bin/flash_image
Flashing Recovery:
adb push Recovery.img /system/bin/
adb shell
flash_image recovery /system/bin/Recovery.img
rm /system/bin/Recovery.img
reboot recovery
Then proceeded to follow the steps in this guide successfully
Click to expand...
Click to collapse
tip: use 'adb remount' instead of the manual mount commands. Do that before you adb shell. Just saves a bit of typing.
good work!
HQRaja said:
in the final command or change it to the name of our rom, which would be kyoukoROM.zip in your case?
Click to expand...
Click to collapse
I changed the OP to make it more consistent.
But see the quote below
sirmx said:
It would be the name of the file you are trying to flash.
Click to expand...
Click to collapse
Stuke00 said:
How do you flash the recovery without an SD card tho?
EDIT: I figured it out. I will post my steps later.
Click to expand...
Click to collapse
Good to hear you got it. I realized later that I should have mentioned how to flash it without an SD card
Cool! Favorited in case I ever need it. Really useful I would imagine!
sirmx said:
tip: use 'adb remount' instead of the manual mount commands. Do that before you adb shell. Just saves a bit of typing.
Click to expand...
Click to collapse
So would that be like this:
Code:
adb remount
adb shell
adb push flash_image.zip /system/bin/flash_image
adb shell chmod 0755 /system/bin/flash_image
Just confirming because I am about to feature this method on the blog I write for (with credit to Stuke00 and a link to his post) and don't wanna mess up. =)
EDIT: Forgot to mention that you rock! Thanks for the earlier help too.
EDIT 2: Nevermind, did some reading on what 'adb remount' does and found out it remounts /system with read+write access so I guess this is it. Though please do correct me if I am still wrong (which I am often).
Covered this method
Oh and in case you guys are interested in seeing my coverage of your methods, here it is...
The original method by kyouko: http://www.addictivetips.com/mobile/how-to-install-a-rom-to-an-android-phone-device-without-sd-card/
The recovery method by Stuke00: http://www.addictivetips.com/mobile/how-to-flash-a-recovery-to-an-android-device-without-sd-card/
Thank you guys, I can't do my work and earn my living without you. Keep it up! =)
EDIT: I'll have this last line as a part of my signature now.
Is this possible with Clockwork?
refthemc said:
Is this possible with Clockwork?
Click to expand...
Click to collapse
Dunno, I don't have plans for using it ever again nor have I looked at Clockwork's github - if there is one.
But it should be able to if you can find out what scripts/commands are run when you use the menu. If you want to you can check the github link I have in the OP to see where I found the commands that are run, and then look for something similar in clockwork's source.
You'd be looking for something similar to:
Code:
--update_package=root:path - verify install an OTA package file
Thanks for the awesome guide! Saves me a lot of trouble, I don't have to take out my sdcard or manually enable USB in recovery anymore!
for me
for me it did not work in data but it worked in cache
kyouko said:
Brief rundown of what we just did:
Wiped /data/ to free up space for the zip
Put our ROM.zip onto the /data/ partition since we don't have an SD Card to work with.
Told the recovery to flash from our /data/ partition instead of /sdcard/
Click to expand...
Click to collapse
Hi, I try to install a ROM from CACHE but I'm getting this in my command line:
recovery --update_package=CACHE:rom.zip
sh: /sbin/postrecoveryboot.sh: not found
Click to expand...
Click to collapse
And my phone do nothing, how many time it take to install? normally using sdcard took no more than 5 minutes but using ADB nothing happens. Any help?
reynierpm said:
Hi, I try to install a ROM from CACHE but I'm getting this in my command line:
And my phone do nothing, how many time it take to install? normally using sdcard took no more than 5 minutes but using ADB nothing happens. Any help?
Click to expand...
Click to collapse
what recovery are you using?

Cant mount SD in twrp

I know there are a few threads seemingly related but please bare with me. There's nothing wrong with my rom at all. I'm looking for a way to mount my sdcard as a usb disk on the computer to play with the files. Because JB 4.2 only allows mtp, this can't be done anymore. I figured if I mounted the sdcard in twrp, I should be ok. However, the button is unclickable. The reason I want to play with it is because I've flashed CM10 a couple of times and each time, it has moved all of my files into a subfolder called zero as per this page. I can't seem to get TiBu to properly restore because of this so I wanted to move them all back to the root folder as they should be and it would be fine because I did it before I switched to 4.2. So, any ideas as to why I can't click it?
Edit. Im using twrp 2.3.1.1
You can do the same thing from terminal.
Code:
su
cd /data/media/0/0
mv * ../
cd ../
rm -rf 0
No idea why you can't click the button though.
You can do the same thing from terminal.
Click to expand...
Click to collapse
Wow I never thought of that. It failed though because a directory wasn't empty.
It probably failed because there was a directory with the same name when you moved it.
I guess to be sure you could do something like...
Code:
su
cd /data/media/0/0
cp -R * ../
cd ../
rm -rf 0
but before you rm -rf make sure the CP worked. I know android commands sometimes don't have the normal options that linux commands do, so the "cp -R" part may not have worked.
Worst case, you can "adb pull" the files to your computer, remove everything then adb push them back.
Lethe6 said:
It probably failed because there was a directory with the same name when you moved it.
I guess to be sure you could do something like...
Code:
su
cd /data/media/0/0
cp -R * ../
cd ../
rm -rf 0
but before you rm -rf make sure the CP worked. I know android commands sometimes don't have the normal options that linux commands do, so the "cp -R" part may not have worked.
Worst case, you can "adb pull" the files to your computer, remove everything then adb push them back.
Click to expand...
Click to collapse
I'll give it a shot. I wish I could just use my computer dammit.
Edit. Still fails with that original error.
Edit 2: I tried using adb and it fails too. Says adb is in "/usr/bin" but not thats not included in $PATH environment variable.
adb will only be in $PATH if you added it, otherwise you need to manually run the full path or from the directory.
Something like:
adb pull /data/media/0/0 .
Then with adb shell you can cd to that directory:
adb shell
cd /data/media/0/
and remove 0
rm -rf 0
I thought i had gone into the adb folder and just ran ./adb pull yada yada. Im off to work now so ill have to try again laterm
Sent from my HTC One XL using Tapatalk 2
If you did I'm wondering what the $PATH issue is then? On the device itself, cp and rm will be in $PATH unless maybe you forgot to su?
I'm not entirely sure. I was using my laptop to run the adb command. Or am I doing it wrong? I could've forgotten. Anyway this thing's really got me confused. This morning I flashed back to JB 4.1.2 to see if I could fix it using usb. Well I rebooted to recovery to flash gapps and another kernel but I couldn't find the files on my sdcard anywhere. So I tried to reboot and it wouldn't get past the CyanogenMod loading screen (their logo). I've flashed JB 4.2 again and got it back up. This thing is really freaking confusing. I'm gonna try to flash back once again and see what happens.
Edit: Apparently I was wrong in thinking that 4.1 still had the ability to use USM
Using your laptop for adb was correct. It happened to me a few times until I got TWRP installed that I had to flash a couple of times for things to work properly, not sure why but I've seen other people report the same here. Once it was installed most the issues went away.
So I've got 4.1.2 back on it and still can't get USM to work. I thought it was removed in 4.2? I'm using the same rom I had used back in December which can be found here
Ok so yes, I had forgotten to run as root on my laptop. It tells me that it can't find the device though.
Edit: Updating the SDK, making sure I have everything I need.
Edit 2: Ok I've updated the SDK but it's still not detecting the tablet. When I run adb devices, it comes up blank. I set the rules using this page. I'm wondering is this something like having to run modprobe or maybe a reboot to initialize it?
Edit 3: I forgot to enable debugging. Now it says the remote file does not exist.
Kreuger said:
I know there are a few threads seemingly related but please bare with me. There's nothing wrong with my rom at all. I'm looking for a way to mount my sdcard as a usb disk on the computer to play with the files. Because JB 4.2 only allows mtp, this can't be done anymore. I figured if I mounted the sdcard in twrp, I should be ok. However, the button is unclickable. The reason I want to play with it is because I've flashed CM10 a couple of times and each time, it has moved all of my files into a subfolder called zero as per this page. I can't seem to get TiBu to properly restore because of this so I wanted to move them all back to the root folder as they should be and it would be fine because I did it before I switched to 4.2. So, any ideas as to why I can't click it?
Edit. Im using twrp 2.3.1.1
Click to expand...
Click to collapse
You need to update to twrp 2.3.2.3 for proper flashing of 4.2 roms. If you don't you will get the nested 0/0/0 directory copies each time you flash.
Sent from my SGH-I997 using xda premium
I have updated now. Ive gone back to ics to correct it. I may just stick with it to keep ums support.
Sent from my HTC One XL using Tapatalk 2
I did a superwipe and installed cm10 but i have no sound.
Sent from my Transformer using Tapatalk 2

Categories

Resources