Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
ungaze
Old
(Last edited by ungaze; 10th April 2011 at 08:46 PM.) Reason: Update
#1  
ungaze's Avatar
Senior Member - OP
Thanks Meter 156
Posts: 316
Join Date: Jul 2010
Location: manila
Default SD Tweakz - Run your scripts on SD at boot-time. (Plus few battery tweaks)

SD Tweakz v2
Only works on custom ROMs with init.d(aka busybox runparts) support

UPDATED 04/11/11(added a few battery tweaks)

Wondering around on XDA will sometimes lead you to threads with scripts/tweaks that may or may not help you improve your android device in one way or another. Now most of these scripts/tweaks are not boot resistant. Meaning, after rebooting the tweaks gets disabled and you need to enter/execute them once again.

Well here's another script that would help you initialize those scrips/tweaks every time you restart/reboot you phone and make your life a lot more easier.

Instructions / How does it work?

1. Download the initial script here (SD Tweakz v2)
2. Flash via recovery This will install/copy the initial script into a portion of your android system which initializes/runs every time the phone boots
3. Create a folder on SD called "scriptz" (/sdcard/scriptz)
4. Place your tweaks/scripts inside "scriptz" folder. Usefull scripts/tweaks with explanation below
5. Reboot and see your script run on boot time By this point, every time you boot, the initial script will check your sdcard(/sdcard/sctiptz) if any scripts/tweaks are present. Once found it will then run the scripts for you each and every time you boot

What is it good for

Well there are lots of tweaks out there just waiting to be discovered. Some can yield great performance and some can provide you with a better battery management that can extend your battery life for hours. Unfortunately, some tweaks can only give you one of the benefits above and a bad performance on the other. Meaning you just can't have 'em all. Here you can choose which tweaks/scripts to apply, modify the values as you want as well as debugging which script provides the benefits that you expect. Another reason for using this mod is compatibility as some tweaks/scripts can be ROM dependent. Most of the time it's a kernel issue but some libraries can get involved too.

The Scripts
Scripts are just plain linux compliant text document which has certain linux commands that can be issued using adb/terminal.

You can make one yourself using some android text editors(from es file explorer, dropbox, root explorer etc.). Don't forget to add a ".sh" file extension.

Here's a few example of the scripts I use:
Code:
#These scripts are from various sources from different sites including Samdroid.net
#And of course in collaboration with FranciscoFranco
#
#My approach in the scripts/tweaks that I use is basically just to
#squeeze more juice out of my phone. So in contrast to the tweaks
#included in FranciscoFranco's thread, the tweaks/scripts I use are less
#aggressive in terms of performance and more inclined to save battery.
#

#non-rotational.sh
#this script tells android that you are not using spinning disks
DM=`ls -d /sys/block/dm*`;
MTD=`ls -d /sys/block/mtd*`;
LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;

for j in $DM $MTD $LOOP $RAM;
do
	echo 0 > $j/queue/rotational;
done

#noatime.sh
#Remount all partitions with noatime, for more info visit http://forum.xda-developers.com/show...25&postcount=1
for k in $(busybox mount | grep relatime | cut -d " " -f3)
do
sync
busybox mount -o remount,noatime $k
done

#scheduler.sh
#Changes the scheduler used by the system, for more info visit http://forum.xda-developers.com/show...56&postcount=1
for i in `busybox ls -1 /sys/block/mtdblock*`
do
	echo "noop" > $i/queue/scheduler;
done

echo "noop" > /sys/block/mmcblk0/queue/scheduler;
echo "noop" > /sys/block/dm-0/queue/scheduler;
echo "noop" > /sys/block/dm-1/queue/scheduler;

#setprop.sh (currently testing)
#various build.prop settings
setprop wifi.supplicant_scan_interval 600
These are few of the tweaks that I have tested(and using right now), I will update it every time I test something out and will eventually add some of FranciscoFranco's tweaks for you to try out.

You can get some useful scripts from here - Performance and battery tweaks - by Franciscofranco (just read along)

Note: These scripts are no different from the scripts in FranciscoFranco's thread, I just categorized each individual tweaks and separated them for you to be able to apply each one separately. I will be more inclined to describe only battery saving tweaks as I am only interested with tweaks that could extend battery life(this includes performance tweaks that doesn't seem to affect the battery behavior at all)


Here's the my initial script again: SD Tweakz v2
Here's the downloadable version of each tweak mentioned above:
non-rotational.sh
scheduler.sh
noatime.sh
setprop.sh

If anything bad happens, just flash this Undo.zip(unsigned so just toggle signature verification) and everything should be back as it was before.

Huge thanks to NervGaz for providing a solution to the mount point conflict issue and of course Franciscofranco for those lively discussions and ideas we exchange.
The Following 9 Users Say Thank You to ungaze For This Useful Post: [ Click to Expand ]
 
franciscofranco
Old
#2  
franciscofranco's Avatar
Recognized Developer
Thanks Meter 45153
Posts: 10,392
Join Date: Dec 2010
Location: Mountain View, CA

 
DONATE TO ME
Awesome job, I already linked this on my first page
franco.Kernel - Galaxy Nexus
franco.Kernel - Nexus 4
franco.Kernel - Nexus 7
franco.Kernel - Nexus 10


Google+ | Twitter | Portfolio

CruzerLite franco.Kernel case for the Nexus 4
CruzerLite franco.Kernel case for the Galaxy Nexus

You don't like my reply? Read this

However, if you put any trust in Quadrant scores you could use them to prove that dancing naked for 5 minutes in your garden affects device performance. By Chainfire
 
bluviper
Old
#3  
bluviper's Avatar
Senior Member
Thanks Meter 15
Posts: 260
Join Date: Oct 2010
Location: MKTICBD
@Ungaze
what is the difference from Tweakz V2?
 
ungaze
Old
#4  
ungaze's Avatar
Senior Member - OP
Thanks Meter 156
Posts: 316
Join Date: Jul 2010
Location: manila
Quote:
Originally Posted by bluviper View Post
@Ungaze
what is the difference from Tweakz V2?
almost everything. Flashing this script alone won't do anything. You need to get your tweaks from here first and save it to /sdcard/tweakz folder. reboot and this way it will do exactly what Tweakz V2 did. Now if you notice any lag or performance drop, apply each tweak/script one by one to debug/troubleshoot which one is causing it.

Additionally if you found anything useful, you can make your own script.sh and place it on the /tweakz folder to run it on every boot.
 
franciscofranco
Old
#5  
franciscofranco's Avatar
Recognized Developer
Thanks Meter 45153
Posts: 10,392
Join Date: Dec 2010
Location: Mountain View, CA

 
DONATE TO ME
Quote:
Originally Posted by ungaze View Post
almost everything. Flashing this script alone won't do anything. You need to get your tweaks from here first and save it to /sdcard/tweakz folder. reboot and this way it will do exactly what Tweakz V2 did. Now if you notice any lag or performance drop, apply each tweak/script one by one to debug/troubleshoot which one is causing it.

Additionally if you found anything useful, you can make your own script.sh and place it on the /tweakz folder to run it on every boot.
Yes please, keep posting feedback either here or the other thread. Anything is useful since some users say they suffer some ocasional lag, others don't notice improvements, others say their phone became super fast...
 
bluviper
Old
#6  
bluviper's Avatar
Senior Member
Thanks Meter 15
Posts: 260
Join Date: Oct 2010
Location: MKTICBD
ok now i get it... so the first batch of scripts on zip cannot be run on boot...
thats why you created this...

..ok i have finally applied everything! hehehe since i love smorgasbords...
and its very hard to tell that its there.... hehehe.. seems like fine to me.
no hiccups whatsoever..

but i feel its OK... thanks again man..
 
ungaze
Old
#7  
ungaze's Avatar
Senior Member - OP
Thanks Meter 156
Posts: 316
Join Date: Jul 2010
Location: manila
Quote:
ok now i get it... so the first batch of scripts on zip cannot be run on boot...
thats why you created this...
the first batch of scripts had to be manually moved to init.d and had to be in a specific filename with a specific header and containing all the tweaks altogether in order to run on boot.

now what I did with the update.zips(Tweakz V1, Tweakz V2) was make moving it to init.d, renaming and fixing the header all easier for you guys but it still contain all the tweaks with no option for you guys to modify/add/remove lines that you want. This time it already runs on boot.

with this tweak, everything is easily manipulated through the sd card and a simple file explorer for more flexibility and easy troubleshooting. This should also work on most phones with init.d support.

Quote:
Yes please, keep posting feedback either here or the other thread.
And to make things neater, just post stuff regarding only this script here and everything about tweaks on the other thread mentioned above.
 
NervGaz
Old
#8  
NervGaz's Avatar
Member
Thanks Meter 20
Posts: 79
Join Date: Jan 2010
Location: Bournemouth
You don't really need to move the scripts to the data partition, just invoke the with sh, ie. "sh /sdcard/scriptz/script.sh" it would make your for loop something like this:

for script in $list
do
sh /sdcard/scriptz/$script
done

Also I'd be careful with mounting SD ahead of vold, atleast on /sdcard or /mnt/sdcard make a tempfolder somewhere as a mount point instead and you shouldn't to worry about vold throwing up on you... Just a thought.
 
ungaze
Old
#9  
ungaze's Avatar
Senior Member - OP
Thanks Meter 156
Posts: 316
Join Date: Jul 2010
Location: manila
Quote:
You don't really need to move the scripts to the data partition, just invoke the with sh, ie. "sh /sdcard/scriptz/script.sh" it would make your for loop something like this:
didn't work last time i tried running the scripts directly from sdcard but will try it with your script.

Quote:
Also I'd be careful with mounting SD ahead of vold, atleast on /sdcard or /mnt/sdcard make a tempfolder somewhere as a mount point instead and you shouldn't to worry about vold throwing up on you... Just a thought.
I don't really have a choice right now but to use the same method as "VOID rom" is using when loading modules. Any ideas?

BTW thanks so much
 
NervGaz
Old
#10  
NervGaz's Avatar
Member
Thanks Meter 20
Posts: 79
Join Date: Jan 2010
Location: Bournemouth
A quick and simple solution would be to just add something along the lines of

mount -o rw,remount auto /
mkdir /tmp
<mount the sdcard>
<run the scripts>
<unmount the sdcard>
rmdir /tmp
mount -o ro,remount auto /

Not the cleanest solution of all time, but it should work and no risk of conflicting mount points. Another solution is to just have people install the scripts on the /data partition in a directory there as /data is mounted rw.

Sent from my LG-P500 using Tapatalk

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...

XDA PORTAL POSTS

Auto Test Your Android Apps with Robotium

You’ve just finished coding your very first app, but before you release it to the wild, you … more

Open Source CPU Info App for Windows

So you’re playing with your shiny new Windows 8 tablet PC, when one of your like-minded geeky … more

Guide to Using Adobe Air on Android

When writing an app with performance in mind, you most likely want to write it native code using the … more