Related
Here I will post tweaks as I find them to optimize Android.
When echoing in the following sysctl settings they do not remain after reboot, so we can adb remount then create a sysctl.conf file on our pc's with these settings, then ./adb push sysctl.conf /etc/ then the kernel should apply the settings every reboot
For examples of a sysctl.conf use google: Sysctl.conf Examples
Open a Terminal and Execute these commands as root
Tweak virtual memory to conserve power when running on battery:
Code:
echo 0 > /proc/sys/vm/swappiness #can be ignored if you dont use swap
echo 0 > /proc/sys/vm/dirty_expire_centisecs #can be ignored if you dont use swap
echo 0 > /proc/sys/vm/dirty_writeback_centisecs #can be ignored if you dont use swap
echo 60 > /proc/sys/vm/dirty_background_ratio
echo 95 > /proc/sys/vm/dirty_ratio
Tweak virtual memory for running on Charger
Code:
echo 0 > /proc/sys/vm/swappiness #can be ignored if you dont use swap
echo 3000 > /proc/sys/vm/dirty_expire_centisecs #can be ignored if you dont use swap
echo 500 > /proc/sys/vm/dirty_writeback_centisecs #can be ignored if you dont use swap
echo 10 > /proc/sys/vm/dirty_background_ratio
echo 40 > /proc/sys/vm/dirty_ratio
Detecting apps/services that hog the battery/cpu:
Also while on battery, you should stop all applications that don't really stay idle when you're not using them, if you want to find which apps arent really staying idle you can:
Code:
strace -p $(pidof yourapp) # for all your running applications
ps aux | awk '{print$10,$11}' | sort -n # will list all running softs sorted by used cpu time
By default when Linux runs out of memory it goes through the process list and starts killing off processes that it thinks are using too much memory. This sysctl makes Linux kill the runaway process that made the system run out of memory instead, which is usually what you want.(this will also reduce cpu time and increase battery usage).
Code:
sysctl -w vm.oom_kill_allocating_task=1
Credit: ccpp0
vfs_cache_pressure to 10 , gives more mem to cache fs dentry and inode to save cpu
At the default value of vfs_cache_pressure = 100 the kernel will attempt to reclaim dentries and inodes at a "fair" rate with respect to pagecache and swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100 causes the kernel to prefer to reclaim dentries and inodes.
Code:
sysctl -w vm.vfs_cache_pressure=10
I'll be adding more tweaks for sysctl and basic cmd line tweaks as I find them, also these tweaks would be good integrated into roms, apps, and a power-save widget if anyone wants to get creative.
a few questions
do i enter this into the terminal emulator? also does this only need to be entered in one time? thank you in advance for any help.
great find.. will keep my eye on this thread
david1171 said:
do i enter this into the terminal emulator? also does this only need to be entered in one time? thank you in advance for any help.
Click to expand...
Click to collapse
yes you can enter it in via terminal emulator or ./adb shell, the echo'd settings are not permanent and will reset after reboot, so use the settings to test, then follow the directions to create a /etc/sysctl.conf file to make the settings permanent after you feel comfortable with the settings(if you notice improvement)
defcon
Wow, this is cool, thank you!
Could you maybe add some more comments, I don't really understand what the single commands do. Or some place, where the function of e.g. "dirty_expire_centisecs" is explained?
One more precise question though: If I don't have a swap file on sd, does the tweaking of the swappiness still change anything?
Greetings!
free-sidux said:
Wow, this is cool, thank you!
Could you maybe add some more comments, I don't really understand what the single commands do. Or some place, where the function of e.g. "dirty_expire_centisecs" is explained?
One more precise question though: If I don't have a swap file on sd, does the tweaking of the swappiness still change anything?
Greetings!
Click to expand...
Click to collapse
there is no swap space on G1, so settings related to the swap can be ignored.
echo 0 > /proc/sys/vm/dirty_expire_centisecs
echo 0 > /proc/sys/vm/dirty_writeback_centisecs
never writes out dirty pages ?
free-sidux said:
Wow, this is cool, thank you!
Could you maybe add some more comments, I don't really understand what the single commands do. Or some place, where the function of e.g. "dirty_expire_centisecs" is explained?
One more precise question though: If I don't have a swap file on sd, does the tweaking of the swappiness still change anything?
Greetings!
Click to expand...
Click to collapse
http://tinyurl.com/nlb9ws
Note: The value of vm.swappiness=0 states that no swap space will be used at all, basically it can be ignored if you dont use swap though
defconoi said:
http://tinyurl.com/nlb9ws
Note: The value of vm.swappiness=0 states that no swap space will be used at all, basically it can be ignored if you dont use swap though
Click to expand...
Click to collapse
set vfs_cache_pressure to 10 , gives more mem to cache fs dentry and inode to save cpu "wa".
how do i create a Sysctl.conf file with this script?
i tried the link of examples but all i could find was info about it.
everything else works but when i try
sysctl vm.block_dump=1
i get sysctl: error: 'vm.block_dump=1' is an unknown key
any ideas?
actually ya know what I think we can just disable sysctl all together in menuconfig->Filesystems->Pseudo Filesystems->Proc->Sysctl Support when compiling a new kernel and setting these tweaks right in the kernel.
Says in menuconfig"As it is generally a good thing, you should say Y here unless
building a kernel for install/rescue disks or your system is very
limited in memory."
So I think we can gain some memory disabling this since we dont really need it
disable /dev/mem
Also I think we can disable the Memory Device Driver, /dev/mem, it says it can be disabled for security conscious and can be disabled on memory tight systems, which we are definitely memory tight plus there's just no valid app that uses /dev/mem on actual memory.
Other popular users of /dev/mem are rootkits and the like.
(note: mmap access of memory via /dev/mem was already not allowed since
a really long time)
People who want to use /dev/mem for kernel debugging can enable the config
option.
tshizzle said:
how do i create a Sysctl.conf file with this script?
i tried the link of examples but all i could find was info about it.
everything else works but when i try
sysctl vm.block_dump=1
i get sysctl: error: 'vm.block_dump=1' is an unknown key
any ideas?
Click to expand...
Click to collapse
I have the same exact questions that u do
Unix98_ptys
Also do we really need UNIX98_PTYS enabled?
We can also use this to conserve memory if we dont need this as well...
menuconfig says:
"Unix98 PTY support UNIX98_PTYS
A pseudo terminal (PTY) is a software device consisting of two
halves: a master and a slave. The slave device behaves identical to
a physical terminal; the master device is used by a process to
read data from and write data to the slave, thereby emulating a
terminal. Typical programs for the master side are telnet servers
and xterms.
Linux has traditionally used the BSD-like names /dev/ptyxx for
masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
has a number of problems. The GNU C library glibc 2.1 and later,
however, supports the Unix98 naming standard: in order to acquire a
pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
terminal is then made available to the process and the pseudo
terminal slave can be accessed as /dev/pts/<number>. What was
traditionally /dev/ttyp2 will then be /dev/pts/2, for example.
All modern Linux systems use the Unix98 ptys. Say Y unless
you're on an embedded system and want to conserve memory."
jroid said:
I have the same exact questions that u do
Click to expand...
Click to collapse
ahhhh it looks vm.block_dump=1 isnt a valid sysctl option, disregard that, gonna remove it from the first post
defconoi said:
ahhhh it looks vm.block_dump=1 isnt a valid sysctl option, disregard that, gonna remove it from the first post
Click to expand...
Click to collapse
yea. all the other ones work though. how would we make the file??
jroid said:
yea. all the other ones work though. how would we make the file??
Click to expand...
Click to collapse
adb remount
create sysctl.conf on your system
then adb push sysctk.conf /etc and the settings will be set every reboot.
defconoi said:
adb remount
create sysctl.conf on your system
then adb push sysctk.conf /etc and the settings will be set every reboot.
Click to expand...
Click to collapse
ok so it would be something like this?
adb remount
adb shell
mkdir /system/sysctl.conf
adb push sysctl.conf /system/etc
jroid said:
ok so it would be something like this?
adb remount
adb shell
mkdir /system/sysctl.conf
adb push sysctl.conf /system/etc
Click to expand...
Click to collapse
no, adb push sysctl.conf /etc
this isn't working. i created the dir sysctl.conf in /system then tried adb pushing it but says no such file or dir. then i tried in adb shell cp /system/sysctl.conf /etc
it says cp: omitting sysctl.conf is a directory"
couldnt i just create it directly in /etc?
like this mkdir /system/etc/sysctl.conf
defconoi said:
no, adb push sysctl.conf /etc
Click to expand...
Click to collapse
on android /etc is within the /system/etc directory.
First I need to give credit to Devsk and everyone else who helped figure out the concept behind this thread http://forum.xda-developers.com/showthread.php?t=548502&page=14
I knew the idea of renicing the processes would work but I couldn't figure out a way to make it happen all of the time. Processes do not even startup necessarily when the phone starts up and if they do, they will close for no appearant reason and then restart. So I wrote a script that updates every three minutes. And it can help in other ways besides phone ring times. I've included the music player and htc music player which makes them run really smoothly and switch tracks instantly. On JacHeroSki 1.8 I include the touch flo process and smoothed out that a lot. It's up to you on what else this script can do. If you have suggestions let me know and I will add them for other people to use.
If you don't want to install this, it is built into xROM and JacHeroSki. It made a huge improvement on both of those ROMs. I was waiting for those releases to come out before I posted this. I know someone else wrote apk that does something similar but I think this is more configurable for the time being and I wrote it before the apk was written. So I wanted to shart it anyway. You can change the priority for any process that you want using this script. I strongly suggest that you don't set anything at -20 or 20 and that you keep the settings that I have there. You can severely screw up your ROM if you do the wrong things here and you might have to wipe and reinstall. I am not responsible if you brick or damage your phone in any way. Although there is no reason this script should do any permanent damage to any phone. Just be careful.
There are 2 ways to implement this script. One is to download Autostart from the market. It is the method suggested in the thread listed above. The other way is to add a line in one of your startup scripts that calls this script. To use with the Autostart application you must rename the file to autostart.sh and then copy it to the /data/opt/ directory. To do that, you can use the following instructions. Copy the file to the root of your sdcard and then type the following in terminal.
Code:
su
cp /sdcard/autstart.sh /data/opt/autostart.sh
chmod 755 /data/opt/autostart.sh
You must fix the permissions every time you copy the file to the phone if you are making changes to it. The app will look for it there by default and run it at every startup. If you want to know how to implement it in the startup script let me know. It is different for different ROMs.
Once the script is started it will update the priorities every 3 minutes. You may still see some delay the first time that a process is loaded but it won't take more than 3 minutes for it to be updated. Due to some problems with the script having problems after running for a long time, I made it restart itself every hour. So far it has worked great and has not put any extra drain on the battery. The update interval is short but it takes less than a second to execute. It even helps with .mp3 files because the mediaserver process has a higher priority too.
There are two tools that will help you know how this is working. One is to use the following command to view the log file I created for this. It will clear the file and start over everytime the script starts so that it doesn't grow out of control. It will show you when the priorities were updated last and when the script was restarted. The command to use for this is:
Code:
cat /sdcard/autostart.txt
The other tool was written by Devsk. This is an awesome script that was very helpful in my quest to figure this out. Please thank Devsk for writing it. http://forum.xda-developers.com/showthread.php?p=4365912&highlight=printPriority#post4365912
I found a possible conflict with this method and BFS on xROM. If you are using a ROM with BFS and have problems with this, please remove it and let me know.
Great work, works fine (when started manualy)
atm. i'm useing 4.1.6 from cyanogen, but the /data/opt/ folder doesn't exist...
i created the folder manually, but it doesn't get started automaticaly...
I think it's because of the changes in Donut... any ideas how to fix?
Kubax
Awesome work Mike. I didn't think it was currently possible to schedule something through linux commands on the android.
Just curious, did you figure out a way to use Cron or android alarmmanager through script?
Thanks Mike! I'm on xRom 1.5r3 and this does seem to resolve the annoying lag I've had before when switching tracks.
it says autostart.txt does not exist do I need to create it?
Kubax83 said:
Great work, works fine (when started manualy)
atm. i'm useing 4.1.6 from cyanogen, but the /data/opt/ folder doesn't exist...
i created the folder manually, but it doesn't get started automaticaly...
I think it's because of the changes in Donut... any ideas how to fix?
Kubax
Click to expand...
Click to collapse
Make sure that you run the chmod command. It can't start automatically if you don't. Other than that, make sure the file has the correct name. I added the .txt to post it here so I hope that doesn't screw people up. If none of that works, try adding this line to your a2sd file in Cyanogen (as far as I know he still has that in 4.1.6)
/system/bin/sh /data/opt/autostart.sh
That will tell the ROM to start it automatically. On xROM I named it setPriority.sh because it made more sense. The autostart is only required for people who want to use that app.
PlatinumMOTO said:
it says autostart.txt does not exist do I need to create it?
Click to expand...
Click to collapse
It probably hasn't run if you are getting that message. Try running it manually
sh /data/opt/autostart.sh
and see if that works. If it doesn't give you any errors try running the cat command again. If the script runs but isn't autostarting, look at my other post and try that stuff. If that doesn't fix it, let me knw.
miketaylor00 said:
It probably hasn't run if you are getting that message. Try running it manually
sh /data/opt/autostart.sh
and see if that works. If it doesn't give you any errors try running the cat command again. If the script runs but isn't autostarting, look at my other post and try that stuff. If that doesn't fix it, let me knw.
Click to expand...
Click to collapse
shouldn't it be sh /system/bin/autostart.sh
or
sh /system/bin/setPriority.sh
Thats how I had it configured in the Hero Roms.
ccyrowski said:
shouldn't it be sh /system/bin/autostart.sh
or
sh /system/bin/setPriority.sh
Thats how I had it configured in the Hero Roms.
Click to expand...
Click to collapse
For the autostart app to use it, it has to be in the /data/opt/ directory. It makes more sense to be in /system/bin/ directory though.
What kind of ring times are you guys getting with this?
im currently on 4.0.4 with xinvert theme. Running dangerspl and latest radio and My phones screen and ringtone comes on after one ring.
Added it to my a2sd file, but that turns my phone into a booting loop...
i've got some linux experience, so i think the rights to the file, and the name are ok, since i can run it manualy from shell.
here are the last 5 lines of my a2sd...
Code:
setprop cm.a2sd.active 0;
fi;
sync;
setprop cm.filesystem.ready 1;
/system/bin/sh /data/opt/autostart.sh
I wonder why all this loggin to sd and this recursive launching of script is needed?
Couldn't some simpler script like this do it?
Code:
#!/system/bin/sh
#
echo "Renice Daemon launched: `date`"
# Set the priority every 3 minutes
while [ 1 ]
do
busybox renice 5 `pidof com.google.process.gapps`
busybox renice -18 `pidof com.android.phone`
busybox renice -18 `pidof android.process.media`
busybox renice -18 `pidof mediaserver`
busybox renice -16 `pidof com.android.launcher`
busybox renice -15 `pidof com.htc.music`
busybox renice -15 `pidof com.android.music`
sleep 180
done;
I tested it by launching it from my userinit.sh file with:
Code:
renice_daemon &
and it seems to work.
farmatito said:
I wonder why all this loggin to sd and this recursive launching of script is needed?
Couldn't some simpler script like this do it?
Code:
#!/system/bin/sh
#
echo "Renice Daemon launched: `date`"
# Set the priority every 3 minutes
while [ 1 ]
do
busybox renice 5 `pidof com.google.process.gapps`
busybox renice -18 `pidof com.android.phone`
busybox renice -18 `pidof android.process.media`
busybox renice -18 `pidof mediaserver`
busybox renice -16 `pidof com.android.launcher`
busybox renice -15 `pidof com.htc.music`
busybox renice -15 `pidof com.android.music`
sleep 180
done;
I tested it by launching it from my userinit.sh file with:
Code:
renice_daemon &
and it seems to work.
Click to expand...
Click to collapse
The logging isn't needed, it just made it easier to see if it was running so I left it in.
I think your method probably makes more sense. I found that the script would sometimes die or stop updating all of the processes if it ran for a few hours. So I had it restart itself and that issue went away. Will that be a problem with your method?
Kubax83 said:
Added it to my a2sd file, but that turns my phone into a booting loop...
i've got some linux experience, so i think the rights to the file, and the name are ok, since i can run it manualy from shell.
here are the last 5 lines of my a2sd...
Code:
setprop cm.a2sd.active 0;
fi;
sync;
setprop cm.filesystem.ready 1;
/system/bin/sh /data/opt/autostart.sh
Click to expand...
Click to collapse
I'm not sure why you would get into a boot loop. That is strange. The last 5 lines of your a2sd look the same as mine. When you run it manuall, does it output to the log file?
-- Nevermind --
I just saw your post over the xROM thread.
That gave me the answer about my network connection problems.
Thanks.
blueheeler said:
I installed xROM this morning (r3), and it's been hit or miss every time that I reboot, I may or may not get "network connection". That started with the initial setup wizard and has gone on throughout the day.
I thought removing all the widgets would do it, but that hasn't been a solution and I had to switch back to Cyan's until this gets worked out.
Could this have anything to do with problem, and would there be a possible fix?
I'd like to try this on my installation of Cyan, but I'd like to see if I would need to make an modications should I run into the no network problem on other roms.
Click to expand...
Click to collapse
I think those are 2 different issues but they are both being addressed on xROM. It seems that this script will cause conflicts with BFS and shouldn't be run on any ROM that uses BFS, xROM or Cyan.
The radio issues are probably being caused by the new donut radio that was added to xROM. JAC is going to get this resoved as well. Look for an update later today.
ive been trying to get this to work on my jachero1.7r2 almost all day , since i loved how it work on jachero 1.8 but unfortionally there were some problems with that rom that brought me back to 1.7r2.
i follow the directions, but theres not folder in data/opt...i also notice the file was place in the "bin" folder in 1.8...should i try that ?
any help will be greatly appriciated...thxs in advance
Exilim809 said:
ive been trying to get this to work on my jachero1.7r2 almost all day , since i loved how it work on jachero 1.8 but unfortionally there were some problems with that rom that brought me back to 1.7r2.
i follow the directions, but theres not folder in data/opt...i also notice the file was place in the "bin" folder in 1.8...should i try that ?
any help will be greatly appriciated...thxs in advance
Click to expand...
Click to collapse
Ahhh, a perfect example for using this script. It will work great with 1.7r2. I'll attach an updated a2sd file for you and the same script that is used in 1.8. You will need to drop them both in the /system/bin/ folder and then run these commands from terminal
su
rwsystem
chmod 755 /system/bin/a2sd
chmod 755 /system/bin/setPriority.sh
Let me know if you need more info.
Edit: fixed the command from as2d to a2sd.
i copied both files using Root Explorer , and check they were both there....
but eveything time i get to the comands :
chmod 755 /system/bin/as2d
i get " unable to /system/bin/as2s: no such file or directory"
but it works with :chmod 755 /system/bin/setPriority.sh
is there anything im missing ?
Exilim809 said:
i copied both files using Root Explorer , and check they were both there....
but eveything time i get to the comands :
chmod 755 /system/bin/as2d
i get " unable to /system/bin/as2s: no such file or directory"
but it works with :chmod 755 /system/bin/setPriority.sh
is there anything im missing ?
Click to expand...
Click to collapse
oh crap, typo. it should be a2sd.
Here is a script i've made (had nothing to do, so...).
Phone must be rooted and have busybox installed.
What first menu looks like:
1 - enable/disable hardware acceleration
2 - enable/disable jit
3 - enable/disable stagefright player
4 - change heapsize
s - show status
r - revert to original configuration
q - quit (don't forget to reboot your phone!)
==================
enter your option:
Click to expand...
Click to collapse
Download:
http://www.4shared.com/file/gApTB6EG/tweaks.html
md5 b0865d9de67a82215913512cb644211d
Just copy the file to your sdcard. Then in a terminal emulator run:
su
cat /sdcard/tweaks > /data/tweaks
rm /sdcard/tweaks
cd /data/
./tweaks
If it doesn't run, type first:
chmod 755 /data/tweaks
Additional notes:
Script does not work if run from sdcard, must be in /data/ or /system/ (this one goes to allsalvati for testing)
---
If anything is wrong i will fix it, but only if you give me feedback
If you know any good tweaks, say it and i'll add them.
---
Changelog:
version 1.02:
backup/restore added
version 1.01d:
working again. sorry for the mess...
version 1.01c:
nothing new. just rearranging code
version 1.01b:
messages were not staying in output. fixed
version 1.01a:
small fix. v1.01 was not working
version 1.01:
added status menu
ruigui said:
Here is a script i've made (had nothing to do, so...). Phone must have busybox.
Download:
http://www.4shared.com/file/gApTB6EG/tweaks.html
md5 ea568c399c67ecd87db0dd790cdf0e93
Just copy the file to your sdcard. Then in a terminal emulator run:
cd /sdcard/
./tweaks
If it doesn't run, type first:
chmod 777 /sdcard/tweaks
Please give me some feedback. I don't own the phone so i can't test.
Click to expand...
Click to collapse
what the script does?
So script should be able to do:
enable/disable hw acceleration
enable/disable jit
enable/disable stagefright player
change heapsize
Yes. For now it's what it does.
The ideia is to be able to enable/disable a certain tweak, without reflashing zips, and rewriting files in phone.
But i need some feedback to know if it is working. I can't test it.
It will only change values in /data/local.prop, nothing else.
It seems that it is well written, so I will try that and let you know what's happened.
Thanks for testing. I'm still waiting to have some money so i can buy this phone...
Meanwhile, i'm "playing" with ROMs and files. I'm not good at scripting, but i'm trying to learn while doing something useful.
How much did you increase the heap size?
domenic_s said:
How much did you increase the heap size?
Click to expand...
Click to collapse
I didn't increase it. Script shows this message:
"default=24, recommended=32"
"enter new heapsize value (1-64): "
You can enter any value between 1 and 64.
If you enter any other value, or a string, character, symbol... script will show this message:
"wrong value"
"please input a value between 1 and 64"
For those who don't feel like editing this themselves this is great. Thanks for releasing it for people to try out more tweaks on stock ROMs.
i'm trying to run this script and gives me the following message: ./tweaks: permission denied
Before anything i typed su, then chmod 777 and it gave me error.
It should work be working...
Anyone else confirms this issue? Is this script running or not?
If it is working and there are more tweaks, i can easilly add them to the script.
If this is an isolated case, i really can't help. I don't own an android phone (yet), so i can't test....
allsalvati do you have busybox installed?
No, i don't.
Sent from my LG-P500h using XDA App
That may be your issue.
You must mount /system/ as read-write, then copy busybox binary to /system/xbin/, then run these commands in terminal emulator:
su
cd /system/xbin
/system/bin/chmod 755 busybox
./busybox --install -s /system/xbin
After that you can mount /system/ as read only again, and reboot your phone.
I don't know if there is another way to install it that is easier.
I downladed busybox installer from market and the app says that was installed. The. /tweaks gives me the same message.
How do i test if busybox was installed right?
Sent from my LG-P500h using XDA App
I found this:
That is a problem, you cannot chmod a script to executable on the SD card. (well some things can, but 99% no) the system is designed to prevent u executing scripts from an SD card
cp it to /system/xbin or /system/bin.
Or if u hate to see it in system', use /data/
THEN chmod it. should be fine to run
Click to expand...
Click to collapse
Try to copy the file to /data/ (so you don't mess with /system/), and then try to run it with:
cd /data/
chmod 777 tweaks
./tweaks
It should not need to be run as root
Moved to /data and worked.
I changed heap size to 32 and disabled hardware accelaration just to test.
With hw acc - 981 on Quadrant
Without - 820
So i think this is working.
Perhaps you should print the values so the user can see what is enabled or not before apply.
Thanks for your help
Sent from my LG-P500h using XDA App
Can you test something for me?
Make sure you have hardware acceleration disabled, and reboot you phone.
Then open terminal and run:
getprop | grep hw (see what it outputs)
then run the script, enable hardware acceleration on it, but DON'T reboot your phone yet.
Then exit script, and run again:
getprop | grep hw
Has the value changed, or is it the same?
I need to know if the system assumes immediately any changes (although they may not be functional until reboot).
This is needed to work on your request.
allsalvati said:
Perhaps you should print the values so the user can see what is enabled or not before apply.
Click to expand...
Click to collapse
I'll work on that and post an update after someone tries what i asked above.
Thanks for testing
EDIT: to test benchmarks, enable/disable jit. It gives greater differences in values
I tried what you say and both outputs are the same:
$getprop | grep hw
[debug.sf.hw]: [0]
[hw.keyboards.65537.devname]: [7k_handset]
[hw.keyboards.65540.devname]: [thunder_keypad]
[hw.keyboards.65541.devname]: [touch_mcs6000]
[hw.keyboards.65542.devname]: [atcmd_virtual_kbd]
Edit: Tested disabling JIT and it worked. Linpack Before 7.35 - After 4.3
So i can't rely on getprop to check current values...
If anything is changed, getprop won't give the right output till reboot.
Damn... Script was almost updated. Now i must find a new way and redo this section.
Thanks for testing again
EDIT:
New version for download at first post. status menu added.
I think it's all ok.
It seems work fine on my phone. But I can't see the status. When I choose to see current status or status after reboot, the screen of my emulator returns too fast to the selection menu (show curent status or after reboot) and I can't see anything !
Most Android ROMs use toolbox as primary binary with symlinks in /system/bin and /system/xbin. The problem with toolbox is that it sucks. On some ROMs it's even so limited that it does not even allow for --prefix
Busybox is a great replacement for toolbox, but in order to use it, you have to call it using 'busybox cmd'. I would much rather use it by calling 'cmd' but this would execute toolbox instead of busybox.
Most would think the command 'busybox --install' would fix this, but it does'nt. It tries to install links at /bin and /sbin.
The script below will replace any toolbox links in /system/bin and /system/xbin that is supported by the busybox version installed on the Android device running the script. This will make busybox the default binary when executing regular commands without adding 'busybox' at the beginning of the command.
For an example 'ls' instead of 'busybox ls'
Download as an update.zip
v1.3.0 (Nov 17, 2012) (MD5: c233964f0f62a16d7376739041e8b250) - busybox_installer.zip (Only for ArmV7 devices)
v1.3.0 (Nov 17, 2012) (MD5: e921a6c4119644a18d4feea565824ab1) - busybox_installer-nobin (Without binaries)
busybox.sh
Code:
#!/sbin/sh
for cmd in test find basename readlink ln rm; do
eval export "_$cmd=\"/sbin/busybox $cmd\""
done
_busybox=$($_find /system -type f -name "busybox")
_toolbox=$($_find /system -type f -name "toolbox")
if $_test -e "$_busybox" && $_test -e "$_toolbox"; then
sToolboxList="watchprops wipe vmstat date uptime reboot getevent getprop setprop id iftop ioctl ionice log lsof nandread newfs_msdos notify ps r schedtop sendevent setconsole setprop sleep smd start stop top"
sBusyboxList="`$_busybox --list`"
for applet in $sBusyboxList; do
if $_test -L /system/bin/$applet; then
if $_test "`$_basename $($_readlink -f /system/bin/$applet)`" = "toolbox"; then
$_ln -sf $_busybox /system/bin/$applet
if $_test -L /system/xbin/$applet; then
$_rm -rf /system/xbin/$applet
fi
fi
elif $_test -L /system/xbin/$applet; then
if $_test "`$_basename $($_readlink -f /system/xbin/$applet)`" = "toolbox"; then
$_ln -sf $_busybox /system/xbin/$applet
fi
elif ! $_test -e /system/bin/$applet && ! $_test -e /system/xbin/$applet; then
$_ln -sf $_busybox /system/bin/$applet
fi
done
for applet in $sToolboxList; do
$_ln -sf $_toolbox /system/bin/$applet
done
fi
Toolbox install links
watchprops, wipe, vmstat, date, uptime, reboot, getevent, getprop, setprop, id, iftop, ioctl, ionice, log, lsof, nandread, newfs_msdos, notify, ps, r, su, schedtop, sendevent, setconsole, setprop, sleep, smd, start, stop, top
Busybox install links
Whatever the currently installed busybox supports that is not in the list of toolbox install links
Change log
Dec 10 2011, 21:39 UTC:
The script will now leave skip replacing /system/bin/reboot as it needs to be pointed at toolbox
Dec 11 2011, 10:08 UTC:
Added an update zip that will configure busybox and it provides an extended 1.4MB binary instead of the regular 480KB most ROM's provide
Dec 12 2011, 09:25 UTC:
Added new busybox build (1.20.0.git 2011-12-11) since there was problem with the old one for some people
Added more busybox search dirs (/system/sbin and /sbin)
Added Toolbox install to make sure that some android specific links uses toolbox instead of busybox. See list above.
Jun 27 2012, 13:45 UTC:
Better Busybox and Toolbox search
Added symlink check to make sure that busybox only replaces toolbox links and not things like "sh -> mksh"
Nov 17 2012, 10:30 UTC:
Added a custom toolbox binary to the ArmV7 installer
Added latest CM9 busybox binary to the ArmV7 binary
Added an auto search function to locate the binaries on the device
Fixed both installers to work with newer devices that uses EXT4 file system
Thanks, dk_zero-cool. I've been looking for a guide to installing BusyBox, since I can only find an add-supported installer in the Android Market.
Thanks, nice job!!
Ran the script, worked and did fine....ONE BIG ISSUE....now if you have any script or app that relies on the "reboot" function, it no longer works. For example, rom manager & bootstrapper will not boot into recovery. I even open up terminal and typed:
Code:
$ su
# reboot
...and nothing...does the reboot in /bin need to not be linked to busybox?
KMDonlon said:
Ran the script, worked and did fine....ONE BIG ISSUE....now if you have any script or app that relies on the "reboot" function, it no longer works. For example, rom manager & bootstrapper will not boot into recovery. I even open up terminal and typed:
Code:
$ su
# reboot
...and nothing...does the reboot in /bin need to not be linked to busybox?
Click to expand...
Click to collapse
Try to relink it back to toolbox and then I will update the script to leave reboot alone.
1: mount -o remount,rw /system
2: rm -r /system/bin/reboot
3: ln -s /system/bin/toolbox /system/bin/reboot
Great! Will try again!
Cool... can I steal this?
I'd implement it with a busybox install script
I'm not a super expert on the subject but is /system/sbin a possible location?
zeppelinrox said:
Cool... can I steal this?
I'd implement it with a busybox install script
I'm not a super expert on the subject but is /system/sbin a possible location?
Click to expand...
Click to collapse
You can use this as you like.
And you can type "echo $PATH" in an adb shell, if /system/sbin is there, then it will work. But why? /system/xbin is usually the default dir for placing busybox, otherwise /system/bin. And you will have to change the script since it will only check in /system/bin and /system/xbin
All times in my scripts report UTC time instead of system time, I am sure there is one other applet in /bin that was linked to toolbox that is now linked to busybox and reporting the date wrong or at least the date/time that busybox says (UTC time).
KMDonlon said:
All times in my scripts report UTC time instead of system time, I am sure there is one other applet in /bin that was linked to toolbox that is now linked to busybox and reporting the date wrong or at least the date/time that busybox says (UTC time).
Click to expand...
Click to collapse
Do the same as before, only this time replace 'reboot' with 'date'
This must be a setting in the busybox compile menu. A new binary might fix this because busybox should be able to display system time. But for now point date back to toolbox and it will work for you.
Yup, did what you just said and all is fine. Thanks! Is there a way you can implement the reboot and date applet ignore in the script within the .zip you made.... I think it will save users some headaches.
dk_zero-cool said:
You can use this as you like.
And you can type "echo $PATH" in an adb shell, if /system/sbin is there, then it will work. But why? /system/xbin is usually the default dir for placing busybox, otherwise /system/bin. And you will have to change the script since it will only check in /system/bin and /system/xbin
Click to expand...
Click to collapse
Well bb is sometimes installed elsewhere.
At first SuperCharger only looked in those 2 locations and stopped when it wasn't found.
What would happen if there was a second version elsewhere?
I suppose it wouldn't matter because of the symlinks.
KMDonlon said:
Yup, did what you just said and all is fine. Thanks! Is there a way you can implement the reboot and date applet ignore in the script within the .zip you made.... I think it will save users some headaches.
Click to expand...
Click to collapse
The reboot fix is already in the zip file.
The date fix I don't want in it, I would much rather fix busybox to work properly.
I'm currently looking at that.
zeppelinrox said:
Well bb is sometimes installed elsewhere.
At first SuperCharger only looked in those 2 locations and stopped when it wasn't found.
What would happen if there was a second version elsewhere?
I suppose it wouldn't matter because of the symlinks.
Click to expand...
Click to collapse
No that does not mater because of the symlinks.
That's why I referrer to the complete path, f.eks, "/system/xbin/busybox" and not just the binary name "busybox".
I am going to try your binary for Busybox and see, I am currently using JRummy's BB installer which installed v1.19.3 which is about 1.06MB....
EDIT: Just flashed the .zip, my phone will not boot past the logo....did a battery pull several times and can't get into CWR....SBF time
KMDonlon said:
I am going to try your binary for Busybox and see, I am currently using JRummy's BB installer which installed v1.19.3 which is about 1.06MB....
EDIT: Just flashed the .zip, my phone will not boot past the logo....did a battery pull several times and can't get into CWR....SBF time
Click to expand...
Click to collapse
Put in your USB cable, open a terminal/console on your computer and try "adb logcat" to see what it says when it stops booting.
You must of cause have adb installed on your computer, and USB drivers if you use windows, which I don't and cant help with.
Already reflashed phone back....sorry, no logcat....
Do it again...
C'mon take one for the team... hehe...
LMFAO!!!! Sorry dude, I ain't gonna do it....will let some other poor soul ....I got honey do's today, it's Sunday!!
Whatever it was I can't recreate it. Works fine when I flash the damn thing.
Here's a thought.....make a script that reverses the toolbox links, I can undo it and try to flash again....I was unable to manually install your busybox version so I think some other toolbox applet is causing me trouble.....
There are quite a lot of users (especially in germany) who get very low download speeds at Youtube.
One solution might be to block several youtube IPs:
see here
So I created this app, which uses the iptables command to block those IP ranges.
It requires root to add blocked ips.
It may not work on your device. (Works on my Nexus 4 with latest ParanoidAndroid)
Just hit "Speed Up" once to add the IPs to the blocklist.
To undo hit "Undo" .
Let me know if you see a difference.
This is not permanent! A reboot will undo the changes.
For a permanent solution, check out this post by 5pace:
http://forum.xda-developers.com/showpost.php?p=40918388&postcount=4
-Cheers dak
You can do this in a terminal without the app aswell (this is what the app does):
switch to root, then:
"Speed Up" commands:
iptables -A INPUT -s 173.194.55.0/24 -j DROP
iptables -A INPUT -s 206.111.0.0/16 -j DROP
Undo commands:
iptables -D INPUT -s 173.194.55.0/24 -j DROP
iptables -D INPUT -s 206.111.0.0/16 -j DROP
List:
iptables -L INPUT -v -n | less
DOWNLOAD V1.01:
http://goo.gl/kXzFO
USE THIS AT YOUR OWN RISK ! The app has ZERO error handling and was coded in about 10 minutes.
Check out my other apps:
https://play.google.com/store/apps/developer?id=Stefan+Pledl
Awesome!
Tried it right now, works perfectly.
Had to restart to see the effect. Now Youtube seems to load a lot faster. Will report again after watching some videos.
Thank you a lot!
Some infos:
- Sony Xperia Z (Stock rooted)
- Tested with 3G and WiFi.
- Switzerland (Cablecom / Orange)
Thanks, but rebooting seems to undo the blocking.
Sometimes you just get lucky and get a faster download.
The init.d way
Well I already posted a 'init.d' method on Reddit, so I thought it would be just as good to share it here!
For all those rooted people out there, I created a init.d script to execute these commands at phone startup. The only pre-requisites are:
• A kernel with init.d support. (Not sure what it is? [Look for a folder called "init.d" inside "/system/etc/", if it is there you are good to go!]).
• Root Explorer
- Steps to follow:
• Download S99youtube from here: http://db.tt/hktE9rlr
• Copy over this file to "/system/etc/init.d/".
• Using any root explorer give it permissions like this: http://www.imgur.com/2GD5EGE.png
• Lastly again using Root Explorer change owner to to: http://www.imgur.com/VTGeaA3.png
• Reboot.
VOILA! No need to execute these commands after startup everytime or use any third-party app!
Click to expand...
Click to collapse
Added a link to your post in the OP.
Thanks for pointing it out!
Thanks
Used the init.d method works great. Thanks to both of you
Uploaded a minor update, which properly updates the displayed ips after adding them.
(new link in OP)