[APP] Zipalign binary and script - Optimize installed applications - G1 Android Development

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!

Related

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.

[DEV] Apps2SD and Darchstar-2.1 ROM

The focus of this thread is to sort out the Apps2SD issue in cyanogenmod-darch 2.1 ROM (like the title says). Please do not post here unless it relates to this issue.
That being said, here is where I was at in the original darchstar 2.1 thread:
watzone69 said:
Taken from the instructions darchstar gave in the first post of his thread...
Code:
adb remount
adb push e2fsck /system/bin
adb shell
cd /system/bin
chmod a+x e2fsck
a2sd
reboot
First, the "chmod a+x e2fsck" command doesn't work for me (EDIT: I discovered that it WILL work in recovery mode). I had to use "chmod 777 e2fsck". After entering "a2sd" it gets enabled. After rebooting, apps2SD is NOT enabled anymore. I realized this by doing this test:
Code:
adb shell
cd /data/app
pwd
If your apps2sd is enabled, you will get "/system/sd/app" returned to you.
If you get "/data/app" returned instead then apps2sd is NOT enabled!
Click to expand...
Click to collapse
Gbhil then replied...
gbhil said:
After you restart, can you re-enable a2sd by running a2sd from a terminal as root?
If so, do all your apps still appear and are they usable?
If the above is true, try adding this to the end of gumbo.sh
Code:
su -C a2sd
for a quick fix.
Start a thread (to keep things less cluttered) about it and I'll help you guys dig into the boot image and see why it's not sticking.
Click to expand...
Click to collapse
So, I rebooted and tried to run "a2sd" from the android terminal but it spits out a long string of errors:
Code:
--- Checking ext filesystems
e2fsck 1.41.6 (30-May-2009)
ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /dev/block/mmcblk0p2 is mounted.
/dev/block/mmcblk0p2: clean, 13/249856 files, 31387/499713 blocks
mount: permission denied. (are you root?)
chown: /system/sd: Read-only file system
chmod: /system/sd: Read-only file system
mkdir failed for /system/sd/app, Read-only file system
chown: /system/sd/app: No such file or directory
chmod: /system/sd/app: No such file or directory
cp: cannot create '/system/sd/app/android.tether.apk': No such file or directory
cp: cannot create '/system/sd/app/android.tether.usb.apk': No such file or directory
cp: cannot create '/system/sd/app/at.abraxas.mountusb.apk': No such file or directory...
(etc.)
...rm: cannot remove '/data/app/org.gmote.client.android.apk': Permission denied
rm: cannot remove '/data/app/org.hermit.substrate.apk': Permission denied
rm: cannot remove '/data/app/org.iplatform.android.apk': Permission denied
rm: cannot remove '/data/app/org.mikeyin.livewallpaper.apk': Permission denied
mkdir failed for /system/sd/app-private, Read-only file system
chown: /system/sd/app-private: No such file or directory
chmod: /system/sd/app-private: No such file or directory
cp: can't open '/data/app-private/com.android.aldiko.apk': Permission denied
cp: can't open '/data/app-private/com.protocol.x.su.fbs.apk': Permission denied
cp: can't open '/data/app-private/com.rerware.android.MyBackupPro.apk': Permission denied
rm: cannot remove '/data/app-private/com.android.aldiko.apk': Permission denied
rm: cannot remove '/data/app-private/com.protocol.x.su.fbs.apk': Permission denied
rm: cannot remove '/data/app-private/com.rerware.android.MyBackupPro.apk': Permission denied
ln: /data/app/app: Permission denied
ln: /data/app-private/app-private: Permission denied
+++ Apps-to-SD successfully enabled
So, there is no "app" or "app-private" in the "system/sd". Is a2sd supposed to generate those directories or are they supposed to be there before hand?
Anyway, the result is that I lose all of my shortcuts to the apps and market shows them as not installed even though they are.
BTW, I am not a dev or even that great at code or linux but I can usually pick stuff up fairly quickly. Just want to help fix this!
EDIT: The only thing I have found to work is to flash this kernel:
http://forum.xda-developers.com/showpost.php?p=5712377&postcount=1406
However, some people get stuck in a boot loop after flashing this.
Running into the same issues as Watzone so I can confirm that he is doing it correctly. =P
Here are all of the related commands that have been suggested whenever the question of apps2sd has come up in the darchstar 2.1 thread.
Code:
adb remount
adb shell
mkdir /system/sd
Code:
adb remount
adb shell
busybox --install /system/xbin
a2sd
Code:
cd C:\android-sdk-windows\tools
adb remount
adb shell
chown system.system /data/app
chmod 0771 /data/app
For the next command, boot into recovery and do the following:
Code:
adb shell
mount /system
exit
adb push e2fsck /system/bin
adb shell
cd /system/bin
chmod 777 e2fsck
Now, boot normally and go back to your CMD prompt...
Code:
adb remount
adb shell
a2sd
EDIT: In other threads I have seen the command...
Code:
apps2sd on
...used to enable apps2sd.
Doing all of these WILL allow the final "a2sd" command to enable (testing with the "pwd" command) but it all goes KAPUT after a reboot.
why it's not being enabled at boot time is because the init.rc isn't calling /system/etc/init.d/04apps2sd . I'll be sure that we fix that in my next release
And there you go.
It works here, but now I know why. I'm still using an old version of the boot image that looks for /system/bin/a2sd to load it, and an older version of the ROM. No sense in me to keep flashing fixes until I'm done tweaking the kernel. When darch says the kernel is good, then I'll catch up lol.
We might as well use this thread to learn to play with the boot image though, that is if you guys want to.
Awesome can't wait for the next release then! Lotsa apps out there calling out to me! Thanks guys =)
gbhil said:
We might as well use this thread to learn to play with the boot image though, that is if you guys want to.
Click to expand...
Click to collapse
You bet. It's about time I got my hands dirty.
I'm game let me know if you need me to test anything!
Cool deal. You need Linux to extract and compress the boot.img, and you need to be current with Perl and running jre5 or higher.
Ubuntu 9.04+ is set up out of the box, but any version can be made to work.
Then grab these files from Lox -
http://forum.xda-developers.com/attachment.php?attachmentid=231902&d=1254004933
http://forum.xda-developers.com/attachment.php?attachmentid=234040&d=1254622769
and extract them into your sdk/tools dir. (or any dir in your path)
get all that, then pick a boot.img from a rom and put it in a work folder.
Holler when you get that far, or if you have any q's.
I wanna learn myself. This should apply to mac os as well?
I have Mint on another machine. Gimme a bit to get caught up...
david279 said:
I wanna learn myself. This should apply to mac os as well?
Click to expand...
Click to collapse
Darwin might work. Never tried
watzone69 said:
I have Mint on another machine. Gimme a bit to get caught up...
Click to expand...
Click to collapse
np. I'm @work so going slow is better anyway lol.
ok i just ran the files in terminal. so i guess it might work.
I'm back
Inisde the work folder you dropped the boot.img into, run this from a term:
extract-kernel.pl boot.img
extract-ramdisk.pl boot.img
it will give you several files and a new directory. That dir is the unpacked ramdisk. The init.rc file is the one we're looking for. Open it with a Unicode editor and read it. It has it's own syntax, but it's almost like bash and not too hard to figure out. Hopefully you loaded a bootimg that has a2sd in it. Look near the bottom of the file for the a2sd start up line. It will have a2sd, apps2sd, a2sd004 or something like that. Once you find it so you can see the name used, search the rest of the file for that name.
Those lines will show you how a service gets declared and called at boot time.
I'm up and running now. I downloaded python 2.6.4. Do I need to install it or just extract it somewhere? Please forgive my linux noobness.
The other 2 zip files are extracted and in my tools folder. I'm getting the boot.img now.
idk if this will work as i too am a newb to android and the way they deal with the boot process is somewhat a bit different from what i'm used to, but heres a new boot.img if you guys want to flash it to see if apps2sd works. note, this is not a zip, remove that suffix.
to flash it to your phone just move the boot image to your sdcard then reboot into recovery. from there go into adb and mount your sdcard, then flash the new boot image.
Code:
adb shell
mount /sdcard
flash_image boot /sdcard/newBoot2.img
reboot
tell me if it fixes your apps2sd problem or not.
watzone69 said:
I'm up and running now. I downloaded python 2.6.4. Do I need to install it or just extract it somewhere? Please forgive my linux noobness.
The other 2 zip files are extracted and in my tools folder. I'm getting the boot.img now.
Click to expand...
Click to collapse
try it without doing anything to Python first....especially since I meant perl
Just try my last post and see if it works for ya. I'll edit my first post
gbhil said:
try it without doing anything to Python first....especially since I meant perl
Just try my last post and see if it works for ya. I'll edit my first post
Click to expand...
Click to collapse
Nope, I got "command not found" both times.
darchstar said:
idk if this will work as i too am a newb to android and the way they deal with the boot process is somewhat a bit different from what i'm used to, but heres a new boot.img if you guys want to flash it to see if apps2sd works. note, this is not a zip, remove that suffix.
to flash it to your phone just move the boot image to your sdcard then reboot into recovery. from there go into adb and mount your sdcard, then flash the new boot image.
Code:
adb shell
mount /sdcard
flash_image boot /sdcard/newBoot2.img
reboot
tell me if it fixes your apps2sd problem or not.
Click to expand...
Click to collapse
Thanks darchstar, I'll try that in a bit.
watzone69 said:
Nope, I got "command not found" both times.
Click to expand...
Click to collapse
you gotta make it executable
inside the directory with the perl scripts do this
Code:
chmod a+x ./

CUSTOM Script on Custom Roms

hey,
whenever i flash a new rom i edit the zip to replace keylayouts, apps in /system and /data , bootscreens and some other stuff......
i now want to symlink some directories with a script which will be loaded during rom flash because otherwise i would need a pc to access it through adb...
the script i want FOR NOW (i may use it for other things in the future)
is about symlinking the
/system/customize/resource/bootanimation.zip to /data/local/bootanimation.zip
/system/customize/resource/android_audio.mp3 to /data/local/android_audio.mp3
i can do this through adb as i said but i'd prefer it to be done automatically by a script during flash.... i know the commands to use but i need a way to implement the script into the rom.....
i think it's like the a2sd+ script but i am not sure....
if anyone knows please help me
you need to split open your boot.img and modify the init.rc (the file where services are initialised at Android startup)
See this link for notes on working with the boot.img
you can create the symlinks directly in this file, have a look at the syntax and you should be able to work it out. The ln command doesn't work though, use the format:
Code:
symlink /system/customize/resource/bootanimation.zip /data/local/bootanimation.zip
Or you can create a dummy 'service' which executes a file on your filesystem (like /etc/rc.local) and put your "ln -s" commands in there.
Why not just create a custom update.zip with your changes only, then you can apply it after flashing any rom.
Klutsh said:
Why not just create a custom update.zip with your changes only, then you can apply it after flashing any rom.
Click to expand...
Click to collapse
How would you do this?
Say I wanted an update.zip that would remove plurk and add a certain app. How would I go about creating that?
removing and adding is easy with the update signer app.....i just want to add a script that symlinks directories at boot in order to avoid the use of a pc.....i tried the trick st0kes said and i am waiting for the flashing now to complete and send my feedback
nope it didn't work.....is there any specific place to put the command ????
i put it at the very end of the init.rc file
ok after a lot of reading i created a service which runs a folder with scripts...where i have the script that symlinks the files.....
service myscripts /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/myscript.d
oneshot
Click to expand...
Click to collapse
this is the service code
and here is the code i have into the "bootanimation" script which is inside the myscript.d folder
#!/system/bin/sh
mount /system
mount /data
ln -s /system/customize/resource/bootanimation.zip /data/local/bootanimation.zip
ln -s /system/customize/resource/android_audio.mp3 /data/local/android_audio.mp3
Click to expand...
Click to collapse
what am i doing wrong here ????? please someone with knowledge enlighten me!! the script does not run
damn....it's been a long night and still haven't found a way to do it !!!!!!
i tried all the followings:
1) added a file called "myscript" (it contained two lines with the symlink commands) in init.d folder in order to execute when the boot is complete - FAILED
2) added the same file into another folder and added a service at the bottom of the init.rc file that called it
service myscript /system/etc/myscripts/myscript
oneshot
Click to expand...
Click to collapse
-FAILED
3) added the SYMLINK commands into the init.rc file
a)at the bottom -FAILED
b) before the bootanim, bootsound services -FAILED
c) before the bootcomplete = 1 value in init.rc -FAILED
d) after sysinit execution in init.rc -FAILED
e) before sysinit execution in init.rc - FAILED
f) at the top after some lines of code in init.rc - FAILED
i read that HTC change the boot process and to run custom scripts at boot you must add their commands in "bootcomplete.bravo.rc"
i tried that too but FAILED again....i think this is logical cause these scripts are executed after the boot and just when the phone is gonna show the pin dialog....
i think it's something to do with the init.rc file...but i dunno what else to add....
is there anything i have to mount in order to symlink ???? add busybox to something or anything ??????
PLEASE someone with success at scripting like a2sd+ please help me
Try naming your script
Code:
03BootAnim
and place it in
Code:
/system/etc/init.d
Also don't forget to chmod +x it
how to chmod +x ??? nvm i did it...i am now signing it to try it
in adb
Code:
adb shell chmod +x /system/etc/init.d/03BootAnim
chmod 755 does the same, makes it executable by the system
Klutsh said:
Try naming your script
Code:
03BootAnim
and place it in
Code:
/system/etc/init.d
Also don't forget to chmod +x it
Click to expand...
Click to collapse
hey klutsh i tried what you said but it didn't work...
look i created the file
Code:
03BootAnim
and placed it into the
Code:
/system/etc/init.d
the commands i have into the file are these
Code:
#!/system/bin/sh
ln -s /data/local/bootanimation.zip /system/customize/resource/bootanimation.zip
ln -s /data/local/android_audio.mp3 /system/customize/resource/android_audio.mp3
ok i edited the commands like these but no result too.....
Code:
#!/system/bin/sh
busybox mount /system
busybox mount /data
busybox ln -s /data/local/bootanimation.zip /system/customize/resource/bootanimation.zip
busybox ln -s /data/local/android_audio.mp3 /system/customize/resource/android_audio.mp3
i checked with the
Code:
ls -l /system/etc/init.d
command and the permissions are all the same (they are all enabled i think, -rwxr-xr-x )
i wiped everything, flashed, rebooted but no bootanimation!!! the default android logo with the moving shade appears (i have deleted the animation in the system/customize/resource folder in order for the symlink to work)
what am i doing wrong ???? is there something with the script ?
I'm trying to get this working, and so far it is running before the bootanimation, but I get
Code:
run-parts: can't execute '/system/etc/init.d/03BootAnim': No such file or directory
Yet it is available...
what commands do you have in yours ????
maybe a reboot will fix it o yours since it will rescan ?
edit: hey klutsh i logcated my boot and i see that the symlinks do not work cause it says that /system/customize/resource/bootanimation.zip and android_audio.mp3 directories are read-only file systems
That's the problem then.
Already got a fix that you apply once only to a flashed rom then the boot anim runs from /data/local and can be replaced.
http://www.asificanrememberthat.com/DeLite/BootAmin_to_Data.zip
Flash that after any Sense rom that normally has bootanimation in /system/customize
It will delete the 2 files in /system/customize/resource
flash my own bootanimation to /data/local
create the required symlinks that survive reboot's.
You can then just replace the files in /data/local as needed.
as i see you made it with the update sign and packager isn't it ????
nice idea....
BUT why can't we access /system files through boot ???? is there any way to get root access at booting ???
THANKS YOU VERY MUCH for the great effort you made....
is there a way to implement the update-script into the 03BootAnim in order not to have to flah anything ????
the reson i want this is cause i am cooking my roms on my own and i want them to have all i need inside....not having to flash mod1, mod2 etc
It's a feature of the desire, no write access to /system unless in recovery.
You can just take those bit's from my update-script and add them to your own rom's script.
oh yes...this is what i was asking i have tow update-scripts though, one old and one in the android.new folder
i am using dsixda kitchen....in which should i put it ??? does it matter where is it?
edit: found it....signing to flash
HURRAYYYYYYYYYYYYYYYYYYYYYYY
hey klutsh i thank you a lot.....
it was so easy to do it just copy paste the update-script but we (I) took the hard way of READ-ONLY file system....anw i learned A LOT (if you think that i am reading 15hours constantly about this)
PROBLEM SOLVED
You can delete the android.new folder, it isn't used.

[HOW TO] re-odex your ROM by yourself...

Big Thanks: original [email protected] [http://classic.cx/android/dexo-universal-odex-tool/]
ADVANTAGES & DISADVANTANGES OF RE-ODEX
Advantages:
-All needed things are in one apk, so modding/theming is (better) possible
-Needs less space on /system
Disavantages:
-Needs more space on /data
-Is not so stable than a odexed rom
-Slower on first boot(because a odexed rom has already execute ready .odex files, a deodexed rom needs to generate dalvik cache)
===============================================
First step, please make a nandroid if you are unsure of what you are doing.
Second step, install busybox if it is not already installed. Either from the app or
from the binary I included (ie, adb shell busybox –install /system/xbin/)
Third step, push the four files zip, zipalign, dexo and dexopt-wrapper to /system/bin/
Fourth step, give the three files executable permissions (ie, chmod 755 zip zipalign dexo dexopt-wrapper)
Fifth step, run it!
Once the script is done, your phone will reboot. Your device will appear to be “frozen” until it reboots. That is ok.
Then all you will have to do is run:
adb pull /system/framework # JUST INCASE...YOU CAN SKIP THIS STEP.
adb pull /system/app # JUST INCASE...YOU CAN SKIP THIS STEP.
You are now done! The tool will automatically remove the classes.dex from your files as well as zipalign them. So you are optimized and ready to go.
Sample Terminal/Command prompt session. Basically you can copy and paste, ignoring the text after the # of course:
# Commands on Host computer
cd Downloads/universal-odex # change to the location you unzipped the odex tool.
adb remount
adb push dexo /system/bin/
adb push dexopt-wrapper /system/bin/
adb push zip /system/xbin/
adb push zipalign /system/xbin
adb push busybox /system/xbin # you may or may not already have busybox installed, but this will ensure that you have the correct applets installed
# Commands in ADB SHELL
adb shell # you just entered your Device’s shell
chmod 755 /system/bin/dexo /system/bin/dexopt-wrapper /system/xbin/zip /system/xbin/zipalign /system/xbin/busybox
busybox –install /system/xbin # maybe fail in this step..but it seems okay,go to the next step anyway.
dexo # this will be the last command before your exit adb shell and your device reboots
# The “dexo” command executes SUPER fast. It should be done within 30s-1m, depending on ROM and device
# Commands on Host computer
cd Desktop
mkdir framework
mkdir app
adb pull /system/framework framework
adb pull /system/app app
# Rejoice.
If it doesn’t work for you, then you did something wrong. This is version 3.1 of the script and I’d like to think that I’ve fool-proofed it pretty well.
If you have any questions, comments, or suggestions, please post here.
Exclusive to theMikMik.
Tommy
enjoy the possibilities…
FILES_NEEDED:
View attachment re_odex_needed.tar.gz
Bro, you mean de-odex instead of re-odex??
Or even re-de-odex lol
Sent from my Nexus 7 using Tapatalk 2
kingCV said:
Bro, you mean de-odex instead of re-odex??
Click to expand...
Click to collapse
yesyes..

[MOD] Enable Stock Hotspot on Verizon

I have gotten the built-in wireless tether to work. I know there's been some discussion about getting Wireless tether without FoxFi and similar.
Since we cannot use the recovery method directly, you can still use the tools and everything from it.
So to begin:
Obviously, you must have root for this to work.
1) Download the patch.zip from the original thread. [here: http://forum.xda-developers.com/showthread.php?t=2768837 ]
2) extract the zip to somewhere on sdcard. I extracted mine to the Download folder. You may need to edit the script below to reflect your locations.
3) okay, this part gets a little weird, but bear with me...
Save this code as run.sh in Download folder or wherever you extracted. You can over-write the old run.sh if you save it in toggle folder where original was located-- BE SURE TO EDIT AS REQUIRED
Code:
#!/sbin/sh
cp /mnt/sdcard/Download/toggle/sqlite3 /data/local/tmp/sqlite3
chmod 0777 /data/local/tmp/sqlite3
mount -o remount,rw /dev/block/mmcblk0p23 /system
cp /system/framework/framework-res.apk /system/framework/framework-res.apk.bak
cp /mnt/sdcard/Download/system/framework/framework-res.apk /system/framework/framework-res.apk
/data/local/tmp/sqlite3 /data/data/com.android.providers.settings/databases/settings.db < /mnt/sdcard/Download/toggle/toggles.sql
4) now open up adb on pc (preferred!!! So you can still see progress and if necesary you can undo/alter/fix things) or terminal emulator (untested but should work, may be weird since you have to reboot phone while it's interface is locked up)
Run:
adb shell
su
sh /mnt/sdcard/Download/toggle/run.sh [or where ever you saved it]
5) Your phone will probably lock up now because you've just replaced the framework-res.apk while the system was running.
adb reboot or reboot by other methods.
6) Profit ;]
I DO NOT WARRANTY OR GUARANTEE THIS METHOD. USE AT YOUR OWN RISK
I believe the sqlite edits serve the purpose of showing the icon in the quick settings pull down. Otherwise, just replacing the framework-res.apk with the correct changes is enough: See this thread for the changes needed:
http://forum.xda-developers.com/showthread.php?t=2759119
Incidentally, I was attempting to make the changes on my own and recompile the framework-res.apk, and I must've done something not quite right because the phone hung at the verizon logo. Thankfully adb was up so I was able to remount system as rw to replace the edited framework-res.apk from the original thread OP linked. Interestingly enough, as soon as I finished copying the edited file, the phone continued booting just fine, and I'm posting from the native tethered connection now.
Edit: I was able to do the changes on the framework-res.apk extracted/decompiled from my phone after all. I'm guessing that the phone didn't like deflate method as opposed to store method (no compression) on the resources.arsc file in the apk file. Had to use the 7zip command line tool to save the modified resources.arsc file without compression to the original apk:
7z u -mx0 framework-res.apk.zip resources.arsc
where -mx0 means no compression (copy)
Got it enabled by just replacing the framework-res.apk, and noticed speeds were really slow. I get 1.88mbps on LTE at home (so-so coverage), but only .15mbps on my iPad connected to my phone via Wi-Fi.
I did this: http://forum.xda-developers.com/showpost.php?p=53431713&postcount=9
SO MUCH EASIER than what you guys were doing. :good:
Droid_Evo_8 said:
I did this: http://forum.xda-developers.com/showpost.php?p=53431713&postcount=9
SO MUCH EASIER than what you guys were doing. :good:
Click to expand...
Click to collapse
It's a manner of preference. In terms of overhead, this native method should technically be quicker to enable, as it does not have to wait for the exposed module to intercept the call and return an empty array of apps to execute for the provision check. That being said, we're probably talking miliseconds at most. While I use xposed for other modules sometimes, others might prefer not to, and this native method does not require it.
vacaloca said:
It's a manner of preference. In terms of overhead, this native method should technically be quicker to enable, as it does not have to wait for the exposed module to intercept the call and return an empty array of apps to execute for the provision check. That being said, we're probably talking miliseconds at most. While I use xposed for other modules sometimes, others might prefer not to, and this native method does not require it.
Click to expand...
Click to collapse
I don't know much about adb or terminal emulator so I'm fine with it. :good:
Here's to hoping for an easy tethering mod!
fillyo said:
Here's to hoping for an easy tethering mod!
Click to expand...
Click to collapse
I'm not sure how easier it can get than installing xposed framework + X Tether mod and rebooting, or replacing the framework-res.apk file on your phone with the one listed in the OP... either will work. This of course assumes you have the Verizon model. Replacing the premade framework-res.apk on any other S5 model would probably cause issues and wouldn't solve anything .
I just made it 'harder' on myself by deciding to copy the original framework-res.apk from my phone, and using the latest apktool and aapt to extract the apk, make the modifications, rebuild it, and replace it on my phone (after renaming the original to .bak). I mostly did this to refresh my memory on how to do it as I had done the process with another phone a while back to do the same mod. As I mentioned earlier, the sqlite stuff is only necessary if you want a toggle in the quick settings bar... otherwise you can just go into settings menu and enable it that way.
vacaloca said:
I'm not sure how easier it can get than installing xposed framework + X Tether mod and rebooting, or replacing the framework-res.apk file on your phone with the one listed in the OP... either will work.
Click to expand...
Click to collapse
I don't see the framework-res.apk file in OP, am I missing something? I have no idea how to decompile mine to make changes.
fillyo said:
I don't see the framework-res.apk file in OP, am I missing something? I have no idea how to decompile mine to make changes.
Click to expand...
Click to collapse
It's linked to in step (1). It's inside the zip file that's meant to be flashed in a recovery... however, because our bootloader is still locked, we cannot flash a recovery, so the way to do it is by replacing the framework-res.apk file as the filesystem is live, which as the OP mentions, will trigger a soft reboot as this file is used extensively by Android apps.
vacaloca said:
It's linked to in step (1). It's inside the zip file that's meant to be flashed in a recovery... however, because our bootloader is still locked, we cannot flash a recovery, so the way to do it is by replacing the framework-res.apk file as the filesystem is live, which as the OP mentions, will trigger a soft reboot as this file is used extensively by Android apps.
Click to expand...
Click to collapse
I got the framework-res apk from the zip package, I guess I am a little nervous since this is from a dev edition, correct? Anyone else successfully just replace framework-res from the zip package on their retail Verizon GS5?
fillyo said:
I got the framework-res apk from the zip package, I guess I am a little nervous since this is from a dev edition, correct? Anyone else successfully just replace framework-res from the zip package on their retail Verizon GS5?
Click to expand...
Click to collapse
The OP (presumably), user in post #3, and myself before I did the changes manually.
SO I followed these instructions and this is what i get both from adb and Term Em.
mount: No such file or directory
: Read-Only file systemramework-res.apk.bak
: Read-Only file systemramework-res.apk
/mnt/sdcard/download/toggle/run.sh[8]: /mnt/sdcard/download/toggle/sqlite3: can't execute: permission denied
I use the same folder structure you did, created a download folder and extracted the zip...
Thoughts?
tangoboyz said:
SO I followed these instructions and this is what i get both from adb and Term Em.
mount: No such file or directory
: Read-Only file systemramework-res.apk.bak
: Read-Only file systemramework-res.apk
/mnt/sdcard/download/toggle/run.sh[8]: /mnt/sdcard/download/toggle/sqlite3: can't execute: permission denied
I use the same folder structure you did, created a download folder and extracted the zip...
Thoughts?
Click to expand...
Click to collapse
Seems at least like 2 errors... the mount command can't find the input or output directories, thus you attempt to copy the files and get read-only file system, and it looks like sqlite3 needs to be changed to executable... chmod +x sqlite3
Also make sure you're running as root, obviously.
I saw a similar post int the android development subforum, and they seem to believe you will bootloop if you try to overwrite your framework-res. I chickened out and just did the xposed and x tether mod.
vacaloca said:
Seems at least like 2 errors... the mount command can't find the input or output directories, thus you attempt to copy the files and get read-only file system, and it looks like sqlite3 needs to be changed to executable... chmod +x sqlite3
Also make sure you're running as root, obviously.
Click to expand...
Click to collapse
I am rooted. Here's what i had in my run.sh:
#!/sbin/sh
cp /mnt/sdcard/Download/toggle/sqlite3 /data/local/tmp/sqlite3
chmod 0777 /data/local/tmp/sqlite3
mount -o remount,rw /dev/block/mmcblk0p23 /system
cp /system/framework/framework-res.apk /system/framework/framework-res.apk.bak
cp /mnt/sdcard/Download/system/framework/framework-res.apk /system/framework/framework-res.apk
/mnt/sdcard/Download/toggle/sqlite3 /data/data/com.android.providers.settings/databases/settings.db < /mnt/sdcard/Download/toggle/toggles.sql
NOW does this look right??
#!/sbin/sh
cp /mnt/sdcard/Download/toggle/sqlite3 /data/local/tmp/sqlite3
chmod +x 0777 /data/local/tmp/sqlite3
mount -o remount,rw /dev/block/mmcblk0p23 /system
cp /system/framework/framework-res.apk /system/framework/framework-res.apk.bak
cp /mnt/sdcard/Download/system/framework/framework-res.apk /system/framework/framework-res.apk
/mnt/sdcard/Download/toggle/sqlite3 /data/data/com.android.providers.settings/databases/settings.db < /mnt/sdcard/Download/toggle/toggles.sql
I'm sorry as I'm very new to this.
tangoboyz said:
I am rooted. Here's what i had in my run.sh:
#!/sbin/sh
cp /mnt/sdcard/Download/toggle/sqlite3 /data/local/tmp/sqlite3
chmod 0777 /data/local/tmp/sqlite3
mount -o remount,rw /dev/block/mmcblk0p23 /system
cp /system/framework/framework-res.apk /system/framework/framework-res.apk.bak
cp /mnt/sdcard/Download/system/framework/framework-res.apk /system/framework/framework-res.apk
/mnt/sdcard/Download/toggle/sqlite3 /data/data/com.android.providers.settings/databases/settings.db < /mnt/sdcard/Download/toggle/toggles.sql
NOW does this look right??
#!/sbin/sh
cp /mnt/sdcard/Download/toggle/sqlite3 /data/local/tmp/sqlite3
chmod +x 0777 /data/local/tmp/sqlite3
mount -o remount,rw /dev/block/mmcblk0p23 /system
cp /system/framework/framework-res.apk /system/framework/framework-res.apk.bak
cp /mnt/sdcard/Download/system/framework/framework-res.apk /system/framework/framework-res.apk
/mnt/sdcard/Download/toggle/sqlite3 /data/data/com.android.providers.settings/databases/settings.db < /mnt/sdcard/Download/toggle/toggles.sql
I'm sorry as I'm very new to this.
Click to expand...
Click to collapse
The original script should work assuming the files are in the right path... when I mentioned make sure you are running as root meant, make sure you run the 'su' command and get the # prompt before you run the script, otherwise the script won't run with root permissions and will fail.
For the third line, you (and the OP) can replace the mount command with:
Code:
mount -o,remount rw /system
----
As an aside, the chmod 0777 part in the original script already does mark the file as executable... chmod works with generic +rwx (read,write,execute) distinctions or the regular numbering permissions (777 means rwx for everyone)
Edit: the last line of the script should start with: /data/local/tmp/sqlite3
because that's the one that you set the permissions to rwx, not the one in your sdcard
vacaloca said:
The original script should work assuming the files are in the right path... when I mentioned make sure you are running as root meant, make sure you run the 'su' command and get the # prompt before you run the script, otherwise the script won't run with root permissions and will fail.
For the third line, you (and the OP) can replace the mount command with:
Code:
mount -o,remount rw /system
----
As an aside, the chmod 0777 part in the original script already does mark the file as executable... chmod works with generic +rwx (read,write,execute) distinctions or the regular numbering permissions (777 means rwx for everyone)
Edit: the last line of the script should start with: /data/local/tmp/sqlite3
because that's the one that you set the permissions to rwx, not the one in your sdcard
Click to expand...
Click to collapse
Hmm still no dice... Something isn't working right. Really I wanted the Hotspot in the pull down menu. I am currently paying for hotspot anyway....
Just found that wanam xposed has an option to skip provisioning check. Anyone tried this yet? Seems to enable native tethering but doesn't give a quick settings button.
dlscott1111 said:
Just found that wanam xposed has an option to skip provisioning check. Anyone tried this yet? Seems to enable native tethering but doesn't give a quick settings button.
Click to expand...
Click to collapse
Yes, we have tried it and it works. The quick settings button, as I have mentioned earlier in this thread, is what the sqlite3 executable and the file commands it takes in (just a simple text file of DB commands) take care of. You could also just get sqlite editor ($3 from the play store, IIRC) and do them manually if you don't like command line tools. it's basically adding "WiFiHotspot" to system -> notification_panel_active_app_list_for_reset and notification_panel_default_active_app_list in the settings.db file in /data/data/com.android.providers.settings/databases/
Or you could just do it the free with the command line sqlite3 using the tools already at your disposal

Categories

Resources