[TWEAK] Kernel tuning script -- UPDATED! - Motorola Milestone Android Development

Hi all,
since I've said goodbye to my Milestone, in these days, prior to selling it, my good behavior said to me "okay, no customkernel, you can't help with RSA...so Milestone owners are ****ed...ouh, no, wait!"
...and then prior to selling it I've tested some things and I've found that sysctl is working!
Since sysctl is working and I'm on Linux from about 10 years, I've been played with our kernel in Milestone and tested some parameters.. and I've had a speedup in my daily operations: browse the net with Dolphin Browser HD, play some games, sync email, make calls, sms etc... and I've found that my Milestone is way more responsive and feels smoother!
Sysctls tested on the great CyanogenMod port by nadlabak.
So, well, here's the script. Feel free to execute it at boot (if you execute it at boot, your phone will boot slightly faster) and/or to integrate in your custom nandroid ROMs
Code:
#!/system/bin/sh
sysctl -p
#
#Disable normalized sleeper
#
mount -t debugfs none /sys/kernel/debug
echo NO_NORMALIZED_SLEEPER > /sys/kernel/debug/sched_features
#
# Memory management
#
echo 2048 > /proc/sys/kernel/msgmni
echo 64000 > /proc/sys/kernel/msgmax
echo 268435456 > /proc/sys/kernel/shmmax
echo "500 512000 64 2048" > /proc/sys/kernel/sem
sysctl -w net.core.wmem_max=524288
sysctl -w net.core.rmem_max=524288
sysctl -w net.ipv4.tcp_tw_recycle=1
sysctl -w net.ipv4.tcp_rmem='6144 87380 524288'
sysctl -w net.ipv4.tcp_wmem='6144 87380 524288'
sysctl -w kernel.sched_latency_ns=600000
sysctl -w kernel.sched_min_granularity_ns=400000
sysctl -w kernel.sched_wakeup_granularity_ns=400000
EDIT: UPDATE N.3
This script makes the Linux kernel to take a little more RAM, so I don't recommend to use it in HTC Sense builds, since Sense is already crashing because of heavy RAM usage, but with CM and LauncherPro, with a lot of progs open in background I've never went out of RAM!
NOTE: Make sure that you've got echo and sysctl in /system/xbin/ otherwise this won't have any effect!
Even if I'm returning to HTC I'm sad for my old Milestone, I like its shell so much...it's a really beautiful device!
Hoping for the best for u, Milestone users
-kholk

Very interesting. Could you please advice what I need to do to execute the script at boot?

kholk said:
I've found that sysctl is working!
Code:
#!/system/bin/sh
/system/xbin/echo 2048 > /proc/sys/kernel/msgmni
/system/xbin/echo 64000 > /proc/sys/kernel/msgmax
/system/xbin/echo 268435456 > /proc/sys/kernel/shmmax
/system/xbin/echo 500 512000 64 2048 > /proc/sys/kernel/sem
/system/xbin/sysctl -w net.core.wmem_max=524288
/system/xbin/sysctl -w net.core.rmem_max=524288
/system/xbin/sysctl -w net.ipv4.tcp_tw_recycle=1
/system/xbin/sysctl -w net.ipv4.tcp_rmem='6144 87380 524288'
/system/xbin/sysctl -w net.ipv4.tcp_wmem='6144 87380 524288'
Hoping for the best for u, Milestone users
-kholk
Click to expand...
Click to collapse
ciao kholk
Want to know if you put a sysctl binary in xbin?
Cause your script suppose to have sysctl in xbin right?
Can you make a download of it? Or is a symlink from busybox?
Grazie per questa drittona per il pietrone
EDIT: okok resolved, had to --install busybox -s xD
NO PROBLEM now testing!!

This script is supposing that you've got echo and sysctl in /system/xbin/
If you haven't got echo and sysctl in /system/xbin/ this script won't have any effect.

And how would i go about obtaining those?
Sent from my Milestone using XDA App

Install busybox and with it you should have installed those.

I didn't think sysctl would work on this kernel. Since it does, here's some more optimizations that I know work for Eclair and earlier:
Code:
/system/xbin/sysctl -w kernel.sched_latency_ns=600000
/system/xbin/sysctl -w kernel.sched_min_granularity_ns=400000
/system/xbin/sysctl -w kernel.sched_features=24188
The default latencies were a little ridiculous. And the CFS features disabled here are pointless, even on desktops.
That said, thanks for pointing out that it works! Much appreciated. Best of luck with your HTC device.

Very nice, thanks kholk!
Thanks xslntx!

Script updated.
-- Absolute path not needed.
-- Added scheduler tuning for granularity latencies
-- Normalized sleeper disabled.

Testing it with great results (in combination with xlsntx parameters)
graphic performance are improved, usage is clearly improved,
in opposition to that bench are lower, I mean, I donot understan:
In Quadrant, I have nearly 3\4 fps MORE than normal in EACH test (except for the planet one) -wich is nealrly the performance a droid2 has...- and have a result like 20\25 point lower...dunno...another dimostration that benchs aren't much reliable...

Sounds great!
So, I have Busybox installed. How do I actually activate the script file?
Just placing a file, for example "optimize" in system/xbin with the script content and thats it? Or do I have to do anything else to actually load the optimization from boot?

@89luca89
Can you add this modification in next update to your OpenRecovery with andrea???
As you have more knowledge, plsease make your test and put the best combination in next update to your OpenRecovery...

Just a question - can I use these commands also with the stock(rooted) ROM? I don't have CM6 and actually I'm pretty satisfied with the my stone. But I would like to have the performance a little bit more improved
Is this only for CM6 or what?

TheSSJ said:
Just a question - can I use these commands also with the stock(rooted) ROM? I don't have CM6 and actually I'm pretty satisfied with the my stone. But I would like to have the performance a little bit more improved
Is this only for CM6 or what?
Click to expand...
Click to collapse
here is the answer from the previous page of thios thread:
xslntx said:
I didn't think sysctl would work on this kernel. Since it does, here's some more optimizations that I know work for Eclair and earlier:
Code:
/system/xbin/sysctl -w kernel.sched_latency_ns=600000
/system/xbin/sysctl -w kernel.sched_min_granularity_ns=400000
/system/xbin/sysctl -w kernel.sched_features=24188
The default latencies were a little ridiculous. And the CFS features disabled here are pointless, even on desktops.
That said, thanks for pointing out that it works! Much appreciated. Best of luck with your HTC device.
Click to expand...
Click to collapse

thanks for the nice script

fantastic job - works great on my CM6 MS.

Can somebody upload the neccesary files for make it work...
And some instractions please....
I suppose all have the "echo" file in system/xbin. So as i understand we need the "sysctl" file to put it in system/xbin and the propiate script...
So if everyone could upload these 2 it would be nice...
Thanks
Edit: Sorry "sysctl" file already excists in my /system/xbin....
So i have to create a script file without the .sh extention and put in in system/etc/init.d right?

Yeah, I'd like to know as well where to put the file... and with extension or without. I got the files needed in the mentioned folders.

I'd like to point out that the tweaks that have to deal with the network connection seem rather pointless for mobile devices. We simply don't have the bandwidth to necessitate giving such functions any more of our (limited) memory. It also appears to cause a sluggish startup.
Removing
Code:
sysctl -w net.core.wmem_max=524288
sysctl -w net.core.rmem_max=524288
sysctl -w net.ipv4.tcp_tw_recycle=1
sysctl -w net.ipv4.tcp_rmem='6144 87380 524288'
sysctl -w net.ipv4.tcp_wmem='6144 87380 524288'
actually yields noticeably snappier performance.

Tutorial please

Related

[DEV][TEST][UPDATED 2010-04-02] 2.6.32.11 kernel for cyanogenmod 4.2.15.1

I've been working on tweaking the 2.6.32.11 kernel to boot on my G1
and so far have a working setup that seems to be stable on cyanogenmod 4.2.15.1.
What works:
Phone
Bluetooth
Wifi
GPS
ADB
What doesn't work:
Camera: the kernel has a driver for the Video/Camera but the userspace
doesn't like it. I've tried to forwardport the old camera from
2.6.29 but I was not able to make it fully functional due to
the big differences in the code paths. So some more work of
java gurus is needed to match android camera and kernel camera
driver.
What I've used:
kernel source: android-msm-2.6.32 from http://android.git.kernel.org/?p=ke...e6e272c600d7fa3d8722351129b04b0697e608;sf=tgz
wifi driver: sta_dk_4_0_4_32 from http://android.git.kernel.org/?p=pl...aef43e0d0454b3119a5299561073700d2c7e14;sf=tgz
compcache-0.6.2: http://compcache.googlecode.com/files/compcache-0.6.2.tar.gz
BFS 313: http://www.kernel.org/pub/linux/ker...6.32/2.6.32-ck2/2.6.32-ck2-broken-out.tar.bz2
What patches I've applied:
Code:
# cd to your kernel source dir
patch -p1 -E < 001_fix_kpanic_warning.patch
# Revert net_dev_ops removal for sta_dk_4_0_4_32 driver
patch -p0 -R -E < 002_REVERT_compat_net_dev_ops.patch
patch -p1 -E < 003_2.6.32-sched-bfs-313.patch
patch -p1 -E < 004_patch-2.6.32.9-10.patch
patch -p1 -E < 005_remove_dream_staging.patch
patch -p1 -E < 006_update_sysctl_blackfin.uclinux.org.patch
patch -p1 -E < 007_sched_no_newline.patch
patch -p1 -E < 008_msm_smd_fix.patch
patch -p1 -E < 009_msm_evlog_fix.patch
patch -p1 -E < 010_export_init_task_for_wlan.patch
# For compcache with CONFIG_SWAP_FREE_NOTIFY uncommented in compat.h
patch -p1 -E < 011_swap_notify_core_support.patch
# For BFS
patch -p1 -E < 012_sched-add-above-background-load-function.patch
# No improvements in performance, rather a decrease empirically
# measured, so I removed them, maybe they could be applied after more testing
# patch -p1 -E < 013_mm-make_swappiness_really_mean_it.patch
# patch -p1 -E < 014_mm-kswapd_inherit_prio.patch
# patch -p1 -E < 015_mm-background_scan.patch
# patch -p1 -E < 016_mm-idleprio_prio.patch
# patch -p1 -E < 017_mm-lru_cache_add_lru_tail.patch
# patch -p0 -E < 018_no_bfs_vmscan_fix.patch
patch -p1 -E < 019_patch-2.6.32.10-11
patch -p0 -E < 020_2.6.32.11_rfcomm_fix.patch
patch -p0 -E < 021_fix_wakelock_warning.patch
patch -p0 -E < 022_partitions_check_warning_fix.patch
My config is: BFS enabled, compcache enabled, SLOB allocator, CFQ elevator (see attached config.txt for details).
Attached to test with Cyanogenmod 4.2.15.1 you will find zipped copies of:
Code:
new_boot.img
wlan.ko
modules.sqf
patches/
TAKE A BACKUP FIRST AND TEST IT ONLY IF YOU KNOW WHAT YOU ARE DOING!!!
To test it:
Code:
sudo adb shell
umount /system/modules/
cp /system/modules/modules.sqf /sdcard/
cp /system/lib/modules/wlan.ko /sdcard/
exit
adb remount
adb push wlan.ko /system/lib/modules/
adb push modules.sqf /system/modules/
adb shell
reboot
Enter fastboot mode
Code:
sudo fastboot boot new_boot.img
To restore your old system:
Code:
sudo adb remount
adb shell
umount /system/modules/
cp /sdcard/modules.sqf /system/modules/modules.sqf
cp /sdcard/wlan.ko /system/lib/modules/wlan.ko
reboot
This instructions are as I recall them, I hope that I didn't forget some steps...
The kernel worked fine during the last days of testing, interactivity is
good and with BFS very fluid. Probably it could be tweaked further.
The main problem is the camera not working but my java skills are not enough
to fix it.
Enjoy it and USE AT YOUR OWN RISK!
farmatito
;-)
excellent , thanks I'll take a look at this
I did try 2.6.33 a few weeks back, but the Old Network API got dropped in 2.6.31 and I never got round to having a proper look for a patch or patching myself.
at the moment I'm interested in the ksm, and I'm wondering if that will be of any benefit to us.
Not looked at the Dalvik Code, so no idea if it will run 'out of the box' yet.
If I understand it right we could get a reduction in memory usage, as each dvm will have pages of memory in common, the Kernel will essentially drop all the extra copies and share one with all the dvms.
But be honest I have no idea how large this effect will be, it might be negligible as we simple don't have all that many vms in comparison with the huge servers its aimed at.
Nice I had the .32 kernel booting but no wifi or BT if i remember right, its fast as hell
Ill be watching this thread!
The speeds...oh my goodness.
Firerat said:
excellent , thanks I'll take a look at this
I did try 2.6.33 a few weeks back, but the Old Network API got dropped in 2.6.31 and I never got round to having a proper look for a patch or patching myself.
at the moment I'm interested in the ksm, and I'm wondering if that will be of any benefit to us.
Not looked at the Dalvik Code, so no idea if it will run 'out of the box' yet.
If I understand it right we could get a reduction in memory usage, as each dvm will have pages of memory in common, the Kernel will essentially drop all the extra copies and share one with all the dvms.
But be honest I have no idea how large this effect will be, it might be negligible as we simple don't have all that many vms in comparison with the huge servers its aimed at.
Click to expand...
Click to collapse
I've took a look at the KSM but dalvik or libdvm.so need to patched at the point where it creates a new instance of virtual machine but the code base is big and a cold dive in it isn't exactly easy. Somebody more used to the code should be able to do it.
There is also a memory compaction patch floating around, but maybe the overhead is to big.....
farmatito
farmatito said:
I've been working on tweaking the 2.6.32 kernel to boot on my G1
and so far have a working setup that seems to be stable
on cyanogenmod 4.2.15.1.
What works:
Phone
Bluetooth
Wifi
GPS
ADB
What doesn't work:
Camera: the kernel has a driver for the Video/Camera but the userspace
doesn't like it. I've tried to forwardport the old camera from
2.6.29 but I was not able to make it fully functional due to
the big differences in the code paths. So some more work of
java gurus is needed to match android camera and kernel camera
driver.
What I've used:
kernel source: android-msm-2.6.32 from http://android.git.kernel.org/?p=ke...e6e272c600d7fa3d8722351129b04b0697e608;sf=tgz
wifi driver: sta_dk_4_0_4_32 from http://android.git.kernel.org/?p=pl...aef43e0d0454b3119a5299561073700d2c7e14;sf=tgz
compcache-0.6.2: http://compcache.googlecode.com/files/compcache-0.6.2.tar.gz
BFS 313: http://www.kernel.org/pub/linux/ker...6.32/2.6.32-ck2/2.6.32-ck2-broken-out.tar.bz2
What patches I've applied:
Code:
# cd to your kernel source dir
patch -p1 -E < 001_fix_kpanic_warning.patch
# Revert net_dev_ops removal for sta_dk_4_0_4_32 driver
patch -p0 -R -E < 002_REVERT_compat_net_dev_ops.patch
patch -p1 -E < 003_2.6.32-sched-bfs-313.patch
patch -p1 -E < 004_patch-2.6.32.9-10.patch
patch -p1 -E < 005_remove_dream_staging.patch
patch -p1 -E < 006_update_sysctl_blackfin.uclinux.org.patch
patch -p1 -E < 007_sched_no_newline.patch
patch -p1 -E < 008_msm_smd_fix.patch
patch -p1 -E < 009_msm_evlog_fix.patch
patch -p1 -E < 010_export_init_task_for_wlan.patch
# For compcache with CONFIG_SWAP_FREE_NOTIFY uncommented in compat.h
patch -p1 -E < 011_swap_notify_core_support.patch
# For BFS
patch -p1 -E < 012_sched-add-above-background-load-function.patch
# No improvements in performance, rather a decrease empirically
# measured, so I removed them, maybe they could be applied after more testing
# patch -p1 -E < 013_mm-make_swappiness_really_mean_it.patch
# patch -p1 -E < 014_mm-kswapd_inherit_prio.patch
# patch -p1 -E < 015_mm-background_scan.patch
# patch -p1 -E < 016_mm-idleprio_prio.patch
# patch -p1 -E < 017_mm-lru_cache_add_lru_tail.patch
# patch -p0 -E < 018_no_bfs_vmscan_fix.patch
My config is: BFS enabled, compcache enabled, SLOB allocator, CFQ elevator (see attached config.txt for details).
Attached to test with Cyanogenmod 4.2.15.1 you will find zipped copies of:
Code:
new_boot.img
wlan.ko
modules.sqf
patches/
TAKE A BACKUP FIRST AND TEST IT ONLY IF YOU KNOW WHAT YOU ARE DOING!!!
To test it:
Code:
sudo adb shell
umount /system/modules/
cp /system/modules/modules.sqf /sdcard/
cp /system/lib/modules/wlan.ko /sdcard/
exit
adb remount
adb push wlan.ko /system/lib/modules/
adb push modules.sqf /system/modules/
adb shell
reboot
Enter fastboot mode
Code:
sudo fastboot boot new_boot.img
To restore your old system:
Code:
sudo adb remount
adb shell
umount /system/modules/
cp /sdcard/modules.sqf /system/modules/modules.sqf
cp /sdcard/wlan.ko /system/lib/modules/wlan.ko
reboot
This instructions are as I recall them, I hope that I didn't forget some steps...
The kernel worked fine during the last days of testing, interactivity is
good and with BFS very fluid. Probably it could be tweaked further.
The main problem is the camera not working but my java skills are not enough
to fix it.
Enjoy it and USE AT YOUR OWN RISK!
farmatito
If you like my work...
;-)
Click to expand...
Click to collapse
Im sure someone will further and continue your great work, and get the camera working
Awesome, been waiting for this kernel to play with.
I had the same thing happen as Bebbuchacher
great work!
PM me Id love to take a look a tthat src code
on a side note, you dont need the BFS line in the .config for BFS to be functioning, its for our use so we know which configs are which
kingklick said:
I had the same thing happen as Bebbuchacher
great work!
PM me Id love to take a look a tthat src code
on a side note, you dont need the BFS line in the .config for BFS to be functioning, its for our use so we know which configs are which
Click to expand...
Click to collapse
Just download the sources as listed and apply the patches as listed
and you're there.
BFS is now fully integrated in the kernel Kconfig infrastructure in the sense that with that option you can turn it on and off so the option is needed.
farmatito
farmatito said:
Just download the sources as listed and apply the patches as listed
and you're there.
BFS is now fully integrated in the kernel Kconfig infrastructure in the sense that with that option you can turn it on and off so the option is needed.
farmatito
Click to expand...
Click to collapse
Pwned.
13chars.
protomanez said:
The speeds...oh my goodness.
Click to expand...
Click to collapse
Hi protomanez,
You tested this kernel on top of what rom?
Could I test this with SuperD?
I'll make a backup and give it a go
Thanks!
I repacked this into superfast 1.2,
I saw overall boot time go down by a few seconds (boot time being from device off, to all widgets loaded, ready to actually use state), but didn't see really any gains over wg's kernel from there. Compcache was broken (as I expected it to be), but everything else was nice and fluid.
I wish I had time to kernel dev. I've built a few kernels for my laptops in the past, but never even looked into it for android. Life just doesn't have enough time.
How would i go about giving this a whirl with a rogers 32B/EBI1 Dream.
alongenemylines said:
I repacked this into superfast 1.2,
.... Compcache was broken (as I expected it to be), but everything else was nice and fluid.
Click to expand...
Click to collapse
I have compcache working on my G1:
Code:
DiskSize: 32120 kB
NumReads: 329
NumWrites: 682
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
NotifyFree: 371
ZeroPages: 37
GoodCompress: 73 %
NoCompress: 5 %
PagesStored: 548
PagesUsed: 195
OrigDataSize: 2192 kB
ComprDataSize: 733 kB
MemUsedTotal: 780 kB
total used free shared buffers
Mem: 96732 92020 4712 0 76
Swap: 64232 7380 56852
Total: 160964 99400 61564
vm.swappiness = 40
Filename Type Size Used Priority
/dev/block/ramzswap0 partition 32112 7380 2
/dev/block/mmcblk0p3 partition 32120 0 1
To make it work you need to unsquashfs modules.sqf
copy ramzaswap.ko over to your phone to /system/lib/modules
and manually start it with:
insmod /path to modules/ramzswap.ko
rzscontrol /dev/block/ramzswap0 --disksize_kb=32120 --init
swapon /dev/block/ramzswap0
Enjoy
farmatito said:
I have compcache working on my G1
To make it work you need to unsquashfs modules.sqf
copy ramzaswap.ko over to your phone to /system/lib/modules
and manually start it with:
insmod /path to modules/ramzswap.ko
rzscontrol /dev/block/ramzswap0 --disksize_kb=32120 --init
swapon /dev/block/ramzswap0
Enjoy
Click to expand...
Click to collapse
awesome! I'll set that later tonight. I wasn't thinking earlier about unsquashing the .sqf . too much php today
jey, some real development going on sounds very nice.
i dont really understand much about linux kernels and stuff... always thought linux other than android sucked. far too complicated and never just... working... (some of you will probably hate me right now. )
anyway ive got a question.
compcache is not kernelspecivic, is it?
so i can use the compcache provided on the first page on any rom, am i right?
i will check out the new kernel later
thanks a lot for your effort.
domenukk said:
jey, some real development going on sounds very nice.
i dont really understand much about linux kernels and stuff... always thought linux other than android sucked. far too complicated and never just... working... (some of you will probably hate me right now. )
anyway ive got a question.
compcache is not kernelspecivic, is it?
so i can use the compcache provided on the first page on any rom, am i right?
i will check out the new kernel later
thanks a lot for your effort.
Click to expand...
Click to collapse
I think compcache is kernel specific so you need to use the one in modules.sqf.
If you want to extract it from modules.sqf you need the unsquashfs program:
Code:
unsquashfs modules.sqf
then pick the file called ramzswap.ko
domenukk said:
jey, some real development going on sounds very nice.
i dont really understand much about linux kernels and stuff... always thought linux other than android sucked. far too complicated and never just... working... (some of you will probably hate me right now. )
anyway ive got a question.
compcache is not kernelspecivic, is it?
so i can use the compcache provided on the first page on any rom, am i right?
i will check out the new kernel later
thanks a lot for your effort.
Click to expand...
Click to collapse
Linux can certainly be scary to new users. You probably mostly just had a bad experience with a certain gui. Unless you're a hardcore PC gamer, there's not a single reason that a GNU/Linux desktop can't do anything you want it to.
alongenemylines said:
Linux can certainly be scary to new users. You probably mostly just had a bad experience with a certain gui. Unless you're a hardcore PC gamer, there's not a single reason that a GNU/Linux desktop can't do anything you want it to.
Click to expand...
Click to collapse
There's a chance that there won't be proper drivers for you machine from your manufacture and there could be programs you need too.
I only would use Win/OSX.
Ace42 said:
There's a chance that there won't be proper drivers for you machine from your manufacture and there could be programs you need too.
I only would use Win/OSX.
Click to expand...
Click to collapse
Video card is the only issue I've ever come across in my last 4 years of installing and running various Linux distro's on many different machines. Worst case scenario on any of them has been lack of 3d acceleration (and this was with a VIA chrome and a SiS 760 gpu). This really didn't affect the systems at all, just no fancy compiz effects. You name an application, there's either a FOSS version of it, or it can be made to run using crossover, wine, etc. I'll stick by my point of saying 3d gaming is linux's only caveat.
It just takes most people a while to really wrap their head around linux and understand it. You can't think of it the same way as you would about Windows or OSX. It took me a couple years of trying it, hating it, trying it again, hating it again, etc etc, until it all just finally struck me. Now I dont now how I could happily use a computer without GNU / Linux.

REQUEST/IDEA for a safety script for tweaking/OC

I had an Idea for a script that would run at bootup, and if a certain variable had a "value" of NOT 1.
then the script would change the CHMOD of a userinit.sh located in the sd-ext from 050 or 777 to 750 then it would change the variable "value" to 0 were it would stay untill another script that runs at shut down or reboot setts the variable to 1 and changes CHMOD back to 050 or 777 so that the userinit.sh is not run.
That way if a change is made during operating the phone that causes the phone to crash with out shutting down properly the script runs which causes the userinit.sh to run and "resets" userinit.sh values to a "default". Otherwise if shut down properly nothing happens.
This could be expanded on to include repairing the EXT or clearing some special cache or other stuff I am unfamiliar with but that you might want to run after a crash.(like logcat?)
any way what do you think? any promise?
I think, for overclocking purposes anyway, making the userinit.sh unrunnable would make the phone break immediately, as I think it would go to the highest available frequency. However, I like the idea, though I'm not sure how to run scripts on shutdown. I think for overclocking, it would check if the shutdown was clean on startup, and if not change the applicable line to the next lowest number, which it would get either from a seperate file or maybe it could be stuffed in the script itself. (Just my somewhat uneducated thoughts)
TheNewGuy said:
I had an Idea for a script that would run at bootup, and if a certain variable had a "value" of NOT 1.
then the script would change the CHMOD of a userinit.sh located in the sd-ext from 050 or 777 to 750 then it would change the variable "value" to 0 were it would stay untill another script that runs at shut down or reboot setts the variable to 1 and changes CHMOD back to 050 or 777 so that the userinit.sh is not run.
That way if a change is made during operating the phone that causes the phone to crash with out shutting down properly the script runs which causes the userinit.sh to run and "resets" userinit.sh values to a "default". Otherwise if shut down properly nothing happens.
This could be expanded on to include repairing the EXT or clearing some special cache or other stuff I am unfamiliar with but that you might want to run after a crash.(like logcat?)
any way what do you think? any promise?
Click to expand...
Click to collapse
Keep it simple. If a change in userinit.sh breaks your system, reboot to recovery and edit it and reboot again.
TheNewGuy said:
I had an Idea for a script that would run at bootup, and if a certain variable had a "value" of NOT 1.
then the script would change the CHMOD of a userinit.sh located in the sd-ext from 050 or 777 to 750 then it would change the variable "value" to 0 were it would stay untill another script that runs at shut down or reboot setts the variable to 1 and changes CHMOD back to 050 or 777 so that the userinit.sh is not run.
That way if a change is made during operating the phone that causes the phone to crash with out shutting down properly the script runs which causes the userinit.sh to run and "resets" userinit.sh values to a "default". Otherwise if shut down properly nothing happens.
This could be expanded on to include repairing the EXT or clearing some special cache or other stuff I am unfamiliar with but that you might want to run after a crash.(like logcat?)
any way what do you think? any promise?
Click to expand...
Click to collapse
most rom devs/tweakers launch userinit.sh by calling it with a sh
e.g.
/system/bin/sh /system/sd/userinit.sh
so it will still run !! ( as init doesn't care about permissions, it is god )
don't believe me?
Code:
echo "echo I ran" > /data/test.sh
chmod 000 /data/test.sh
sh /data/test.sh
Keep it simple. If a change in userinit.sh breaks your system, reboot to recovery and edit it and reboot again.
Click to expand...
Click to collapse
Yea thats the easy way!...
(Seriously I'm not that good at Linux Command Line code,wording,but i'm getting there.)
I think, for overclocking purposes anyway, making the userinit.sh unrunnable would make the phone break immediately, as I think it would go to the highest available frequency. However, I like the idea, though I'm not sure how to run scripts on shutdown. I think for overclocking, it would check if the shutdown was clean on startup, and if not change the applicable line to the next lowest number, which it would get either from a seperate file or maybe it could be stuffed in the script itself. (Just my somewhat uneducated thoughts)
Reply With Quote
Click to expand...
Click to collapse
And I know that most roms now have a script called something like in /system/etc/init.d/20userinit that runs at startup and checks to see if a userinit.sh is present in sd-ext,if so it runs it.Also I noticed that the script can be there but if it is CHMOD to 777 it wont run. This is the "Reset script" Set to restet to something you like and run other tasks to help Fix/Diagnose probs.
The OC changes would be made from a different script such as 86supersettings
Or a userinit located in system/sd maybe ?
The thing is making sure one is read before the other.
Any way I probably will just learn the language better and do it from recovery console.
Thanks again
TheNewGuy said:
Yea thats the easy way!...
(Seriously I'm not that good at Linux Command Line code,wording,but i'm getting there.)
And I know that most roms now have a script called something like in /system/etc/init.d/20userinit that runs at startup and checks to see if a userinit.sh is present in sd-ext,if so it runs it.Also I noticed that the script can be there but if it is CHMOD to 777 it wont run. This is the "Reset script" Set to restet to something you like and run other tasks to help Fix/Diagnose probs.
The OC changes would be made from a different script such as 86supersettings
Or a userinit located in system/sd maybe ?
The thing is making sure one is read before the other.
Any way I probably will just learn the language better and do it from recovery console.
Thanks again
Click to expand...
Click to collapse
chmod 777 makes it rw and executable by everyone!!!!!!!!
have a look here
http://www.comptechdoc.org/os/linux/usersguide/linux_ugfilesp.html
but as I mentioned above, init ( the initial progam runs as root and doesn't care about permissions, ( it wouldn't be very good at doing initialising the system if it had to seek permission )
Yea your right. Well I said I wasn't that good at this linux stuff! Now I Proved it.
Any way as you can see this is more of a request..... I still think it's a good Idea.
Thanks for your help FireRat.
Keep it simple. If a change in userinit.sh breaks your system, reboot to recovery and edit it and reboot again.
Click to expand...
Click to collapse
I understand how I could manualy Replace the modified script with a default one that was on my sdcard from within recovery after a faild OC change...but..
Are you saying I could actualy modify the original script from recover? Do you have any info on how? A link?
TheNewGuy said:
I understand how I could manualy Replace the modified script with a default one that was on my sdcard from within recovery after a faild OC change...but..
Are you saying I could actualy modify the original script from recover? Do you have any info on how? A link?
Click to expand...
Click to collapse
If you have RA-Recovery, adb works, so you can pull/push the userinit.sh script. You can also enter the terminal and use vi to edit it from recovery. You may have to mount the ext partition first, but that's pretty easy. "mount /system/sd" will do it, if /system/sd doesn't exist, "mkdir /system/sd".
Ok, Thanks that makes sense. I'm still learning adb though. And I tried vi once before with no luck. But now I know what to learn about.
Thanks a lot I appreciate it.
TheNewGuy said:
Ok, Thanks that makes sense. I'm still learning adb though. And I tried vi once before with no luck. But now I know what to learn about.
Thanks a lot I appreciate it.
Click to expand...
Click to collapse
ok, this would do what you want
/system/bin/shutdown
bold is new
Code:
#!/system/bin/sh
stop;
stop dhcpcd;
sleep 1;
[B]echo "1" > /data/cleanshutdown[/B]
for i in `cat /proc/mounts | cut -f 2 -d " "`;
do
busybox mount -o remount,ro $i 2>&1 > /dev/null;
done
sync;
if [ "$1" = "-r" ];
then
toolbox reboot -f;
else
toolbox reboot -fp;
fi
your script
Code:
#!/system/bin/sh
if [ "`cat /data/cleanshutdown`" != "1" ];
then
echo "shutdown was not clean"
[B]your tweaks[/B]
else
echo "shutdown was clean"
[B]your tweaks[/B]
fi
echo "0" > /data/cleanshutdown
I'm not sure you need it,
this is for education value, if you want to play ^^^ is where to start
Thank You!
That is perfect
I need to add all of this to the startup script right?
if [ "`cat /data/cleanshutdown`" != "1" ];
then
echo "shutdown was not clean"
your tweaks
else
echo "shutdown was clean"
your tweaks
fi
echo "0" > /data/cleanshutdown
Click to expand...
Click to collapse
I am going to use the beta boot up script from ZKX called 86Supersettings, but I could use a userinit/user.conf like most do. Correct?
TheNewGuy said:
Thank You!
That is perfect
I need to add all of this to the startup script right?
I am going to use the beta boot up script from ZKX called 86Supersettings, but I could use a userinit/user.conf like most do. Correct?
Click to expand...
Click to collapse
well, a .conf file should be just that
a file with configurations , not an executable script
well, a .conf file should be just that
a file with configurations , not an executable script
Click to expand...
Click to collapse
OK. I guess I meant both together. I would use the user.conf to make tweaks. Then have to modify the userinit.sh with the part you made. Something like.
#!/system/bin/sh--LEAVE THIS OUT. ITS ALL READY AT THE BEGINNING
if [ "`cat /data/cleanshutdown`" != "1" ];
then
echo "shutdown was not clean"
Dont run user.conf
and set cpu or other stuff to "default"
else
echo "shutdown was clean"
Run user.conf for tweaked settings
fi
echo "0" > /data/cleanshutdown
Click to expand...
Click to collapse
If I'm way off then I guess I need to re-read the Userinit thread.
TheNewGuy said:
OK. I guess I meant both together. I would use the user.conf to make tweaks. Then have to modify the userinit.sh with the part you made. Something like.
If I'm way off then I guess I need to re-read the Userinit thread.
Click to expand...
Click to collapse
well, in practise it doesn't matter
the file extension is only for use humans, if I'm looking in a directory and I see .conf I expect it to be a configuration file, I see .sh, its a shell script, .py python, pl perl .......
I see. Well Thanks again for your help. Your script does work. I tried it. crash on purpose.
I still have a lot to learn.
Folks;
1) If you're OC'ing via SetCPU, remember that this doesn't change the recovery kernel, and you can uninstall SetCPU from Recovery. From there, all you need is a "safe" userinit.sh.
3) If you're OC'ing via userinit.sh -- same deal. Your phone crashes on you and you just edit it to a safe config from recovery.
Tweak away.
This is what I ended up with
Thanks to
XxKolohexX
FireRat
Licknuts
Code:
#!/system/bin/sh
#
echo 255 >/sys/class/leds/blue/brightness;
echo "+++ Now entering the speedy madness of Z.X.D.!"
echo "----- let's clear that Cache first."
echo "----- Too much DBs make System go sloow..."
echo "----- Also be shure to check out CacheMate"
echo "----- It's in the Market. (Made by Android AppCritic)."
echo "----- It's way more powerfull than this script!"
echo "----- (Times 10 or 100... Clears everything :P)"
echo "----- And this script already took hours to build..."
echo "----- domenukk - 2010."
find /data/data -name app_admob_cache | while read line; do du -s $line/* | cut -f1; rm -Rf $line/*; done;
find /data/data -name cache | while read line; do du -s $line/* | cut -f1; rm -Rf $line/*; done;
find /data/data -name google_analytics.db | while read line; do du -s $line | cut -f1; rm -Rf $line; done;
find /data/data -name webviewCache.db | while read line; do du -s $line | cut -f1; rm -Rf $line; done;
rm -rf /data/data/com.facebook.katana/files
rm -rf /data/data/com.google.android.apps.genie.geniewidget/app_news_image_cache
rm -rf /data/data/com.code.i.music/app_admob_cache
rm -rf /data/data/fm.last.android/databases/google_analytics.db
echo "--- All the Cache has been cleared."
sleep 10
echo 0 >/sys/class/leds/blue/brightness;
####determin if shutdown was clean####
if [ "`cat /data/cleanshutdown`" != "1" ];
then
####RUN CLEAN SHUTDOWN SCRIPT####
echo 255 >/sys/class/leds/green/brightness;
####Turbo Script by [email protected]####
####Prioritize everyting ####
echo "----- Enabling Turbo."
dirty_writeback_centisecs=500
/system/bin/prior &
#
# Linux-SWAP
#
if [ -e /dev/block/mmcblk0p3 ];
then
if [ -n /dev/block/mmcblk0p3 ];
then
echo "+++ Set Linux Swap"
busybox mkswap /dev/block/mmcblk0p3;
fi;
if [ -e /dev/block/mmcblk0p3 ];
then
echo "+++ Set Swapiness"
echo 100 > /proc/sys/vm/swappiness;
echo "+++ Activate Swap"
busybox swapon /dev/block/mmcblk0p3;
fi;
fi;
####Better CPU Settings...####
echo "----- Speed up the CPU"
echo 633600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo 122800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 95 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold;
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load;
echo 100000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate;
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias;
echo 0 >/sys/class/leds/green/brightness;
echo 255 >/sys/class/leds/blue/brightness;
else
####RUN DIRTY SHUTDOWN SCRIPT####
echo 255 >/sys/class/leds/red/brightness;
####Turbo Script by [email protected]####
####Prioritize everyting ####
echo "----- Enabling Turbo."
dirty_writeback_centisecs=500
/system/bin/prior &
#
# Linux-SWAP
#
if [ -e /dev/block/mmcblk0p3 ];
then
if [ -n /dev/block/mmcblk0p3 ];
then
echo "+++ Set Linux Swap"
busybox mkswap /dev/block/mmcblk0p3;
fi;
if [ -e /dev/block/mmcblk0p3 ];
then
echo "+++ Set Swapiness"
echo 83 > /proc/sys/vm/swappiness;
echo "+++ Activate Swap"
busybox swapon /dev/block/mmcblk0p3;
fi;
fi;
####Better CPU Settings...####
echo "----- Speed up the CPU"
echo 576000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
echo 122800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 45 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold;
echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load;
echo 2000000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate;
echo 200 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias;
fi;
echo "0" > /data/cleanshutdown
echo "+++ continue on lame stock SuperD boot "
##Clearing Davlik-Cache##
for dc in dalvik-cache;
do
umount /cache/$dc;
rm -fr /cache/$dc;
mkdir /cache/$dc;
chown 1000:1000 /cache/$dc;
chmod 771 /cache/$dc;
mount -o bind /data/$dc /cache/$dc;
done;
Named 86supersettings so it runs after userinit.sh if one exists.
I put some Led indicators in so you can tell if it ran right at boot up. (about all I did besides copy and paste) Thinking about adding some other stuff like repair ext, or some kind of log to help me see what happed... any suggestions.
OK, here's another Idea for another safety feature...
I would like to "hard code" a temp fail-safe in to the code. I would like to get rid of SetCPU and when OC-ing it's nice to have a temp failsafe.SHUTDOWN!LOL
Any way I guess I would just add a few lines to some existing script in my phone?.... Any suggestions.
Thanks for your time.

[Script]Sick Speed Tweaks

This gives a really nice boost to performance. I use it in my rom and thought i would share.
Just put them in init.d
02sicktweaks:
Code:
#!/system/bin/sh
#Sick Tweaks
rm -f /cache/*.apk
rm -f /cache/*.tmp
rm -f /data/dalvik-cache/*.apk
rm -f /data/dalvik-cache/*.tmp
busybox rm -f /data/system/userbehavior.db
busybox chmod 400 /data/system/usagestats/
busybox chmod 400 /data/system/appusagestats/
busybox mount -o remount,rw,noatime,noauto_da_alloc,nodiratime,barrier=0,nobh /system
busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,nodev,barrier=0,nobh /data
busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,nodev,barrier=0,nobh /cache
export sampling_rate=10000
export up_threshold=65
export READ_AHEAD_KB=3072
if [ -n ${up_threshold} ];
then echo ${up_threshold} > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
fi
if [ -n ${sampling_rate} ];
then echo ${sampling_rate} > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
fi
if [ -e /sys/module/lowmemorykiller/parameters/adj ]; then
echo "0,1,2,4,7,15" > /sys/module/lowmemorykiller/parameters/adj
fi
if [ -e /sys/module/lowmemorykiller/parameters/minfree ]; then
echo "2560,4096,6144,12288,14336,18432" > /sys/module/lowmemorykiller/parameters/minfree
fi
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo "3072" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi
# Set io scheduler tweaks for mmc
echo "deadline" > /sys/block/mmcblk0/queue/scheduler
echo "0" > /sys/block/mmcblk0/queue/rotational
echo "2048" > /sys/block/mmcblk0/queue/nr_requests
echo ${READ_AHEAD_KB} > /sys/block/mmcblk0/queue/read_ahead_kb
echo "deadline" > /sys/block/mmcblk1/queue/scheduler
echo "0" > /sys/block/mmcblk1/queue/rotational
echo "2048" > /sys/block/mmcblk1/queue/nr_requests
echo ${READ_AHEAD_KB} > /sys/block/mmcblk1/queue/read_ahead_kb
for i in \ `find /data -iname "*.db"` do \ sqlite3
$i 'VACUUM;'
done
echo "6144 87380 524288" > /proc/sys/net/ipv4/tcp_wmem
echo "6144 87380 524288" > /proc/sys/net/ipv4/tcp_rmem
setprop ro.telephony.call_ring.delay 0
setprop ring.delay 0
#setprop windowsmgr.max_events_per_sec 100
setprop windowsmgr.support_rotation_270 true
setprop ro.HOME_APP_ADJ 1
setprop ro.HOME_APP_MEM 2048
setprop dalvik.vm.heapsize 72m
06sysctl:
Code:
#!/system/bin/sh
#sysctl stuff
sync
sysctl -w vm.oom_kill_allocating_task=0
sysctl -w fs.nr_open=1053696
sysctl -w fs.inotify.max_queued_events=32000
sysctl -w fs.inotify.max_user_instances=256
sysctl -w fs.inotify.max_user_watches=10240
sysctl -w fs.lease-break-time=10
sysctl -w fs.file-max=165164
sysctl -w vm.swappiness=0
sysctl -w vm.overcommit_memory=1
sysctl -w vm.page-cluster=3
sysctl -w vm.drop_caches=3
sysctl -w vm.min_free_kbytes=4096
sysctl -w vm.dirty_ratio=15
sysctl -w vm.dirty_background_ratio=4
sysctl -w vm.vfs_cache_pressure=10
sysctl -w vm.panic_on_oom=0
sysctl -w vm.dirty_expire_centisecs=200
sysctl -w vm.dirty_writeback_centisecs=500
sysctl -w kernel.sem=500,512000,64,2048
sysctl -w kernel.msgmax=64000
sysctl -w kernel.msgmni=64000
sysctl -w kernel.threads-max=525810
sysctl -w kernel.random.write_wakeup_threshold=256
sysctl -w kernel.random.read_wakeup_threshold=128
sysctl -w kernel.panic=5
sysctl -w kernel.shmall=16777216
sysctl -w kernel.shmmax=268435456
sysctl -w kernel.sched_latency_ns=10000000
sysctl -w kernel.sched_min_granularity_ns=2000000
sysctl -w kernel.sched_wakeup_granularity_ns=0
sysctl -w kernel.sched_compat_yield=1
sysctl -w net.ipv6.conf.default.use_tempaddr=2
sysctl -w net.ipv6.conf.all.use_tempaddr=2
sysctl -w net.ipv6.conf.all.temp_prefered_lft=3600
sysctl -w net.ipv6.conf.default.temp_prefered_lft=3600
setprop cm.filesystem.ready 1
setprop dc.filesystem.ready 1
setprop oxygen.filesystem.ready 1
does this work on all phones?
nice! very good! thanks!
edit: this is working on my htc evo 4g running cm7 nightly 215 w/ savagedzen kernel
edit 2: i made a cwm/RA flashable zip for the sick tweaks. download at www.unvisible.org/sicktweaksflashable.zip
Is it working on galaxy sl i9003?
Sent from my GT-I9003 using xda premium
sysctl -w kernel.sched_latency_ns=10000000
sysctl -w kernel.sched_min_granularity_ns=2000000
for performance, this values must be this big ?
vladnosferatu said:
sysctl -w kernel.sched_latency_ns=10000000
sysctl -w kernel.sched_min_granularity_ns=2000000
for performance, this values must be this big ?
Click to expand...
Click to collapse
nanoseconds
So what phones/roms does this work on....
Sent from my SCH-I500 using XDA Premium App
this turned off every thing disabled my root and killed superuser do not use its something strange about it
seems fine on my Arc running cm7.
Sent from my LT15i using XDA App
Applied on my Xperia Arc .. It works great! Thanks
going to try this mod, going to flash it with cwm. any way to delete the mod if i wanted to?
kistigun said:
going to try this mod, going to flash it with cwm. any way to delete the mod if i wanted to?
Click to expand...
Click to collapse
Delete the two files that are in
system/etc/init.d foler
Look in the zip for the file names.
ShyamSasi said:
Applied on my Xperia Arc .. It works great! Thanks
Click to expand...
Click to collapse
does the stock .42 arc rom support init.d access?
lastword112 said:
does the stock .42 arc rom support init.d access?
Click to expand...
Click to collapse
No...!!! You need a custom kernel...!!!
flash DoomLord's Kernel v13...!!!
just applied these tweaks to my htc heroc, can't really tell the difference yet. Would it be bad too have juwe's ram optimization tweak along with yours?
Do I just flash this in CWM?
SuperCharged GingerVolt B-) R U?
bhp117 said:
Do I just flash this in CWM?
SuperCharged GingerVolt B-) R U?
Click to expand...
Click to collapse
Yes, you can
Thanx
Would it work with v6 supercharger and KAK scripts?
SuperCharged GingerVolt B-) R U?
Will this work on the DInc2 with the tiamat oc kernel?
Thanks for the script.
My Xperia Arc S got a real nice boost.

[MOD JB, ICS, GB / 31/01] CrossBreeder (uRandom) for entropy based lag reduction

Hi,
This is a combination of 3 different methodologies to reduce Android lag due to low entropy.
1. Change wakeup threshold kernel parameters ala KAK.
2. Run rngd ala Seeder but not in intensive feed mode.
3. Remove /dev/random as it's blocking. Link it to non-blocking /dev/urandom. Since /dev/random is blocking and designed to protect us from Quantum alien cryptographers with mathematical certainty and urandom is non blocking pseudo-random device that most apps and OSs are using anyway.
I'm getting some good results on all Android devices I've tried this on.
You can check your results with this tool:
http://play.google.com/store/apps/de...ndentropyavail
You should get consistent values around the maximum 4096 with this mod.
This is the listing of /etc/init.d/00CrossBreeder (Can be run manually too) :
Code:
#!/system/bin/sh
busybox sysctl -w kernel.random.write_wakeup_threshold=4096
busybox sysctl -w kernel.random.read_wakeup_threshold=1333
rm /dev/random && ln /dev/urandom /dev/random
busybox mknod -m 666 /dev/random.fake c 1 8
busybox chown root.root /dev/random.fake
rngd -t 10 -T 1 -s 256 -W 80% -o /dev/random.fake
sleep 2
echo -8 > /proc/$(busybox pgrep rngd)/oom_adj
renice 5 `busybox pidof rngd`
rm /dev/random.fake
Your thoughts and experiences welcome.
Notes:
1. You can put the code in /etc/init.d/00CrossBreeder and make it executable with:
chmod 755 /etc/init.d/00CrossBreeder
This should run on every boot if you have init.d support. You can also run it manually.
2. You'll need to rename the attached rngd.img binary to /system/xbin/rngd and make it executable with:
cp rngd.img /system/xbin/rngd
chmod 755 /system/xbin/rngd
3. You'll need to stop the seeder service and disable auto start ( IMPORTANT as seeder rngd can take high cpu with the link enabled). Though you can run the app to see available entropy.
or flash zip ( update 31/01/13 ) => CrossBreederByMick.zip
CREDITS:
1. Seeder. This rngd binary is from the seeder util. ( http://forum.xda-developers.com/show...php?p=33999592 )
2. KAK ( http://forum.xda-developers.com/show...php?p=12058585 ).
rngd.img.......
http://forum.xda-developers.com/showthread.php?t=2113150
naudmick said:
Hi,
This is a combination of 3 different methodologies to reduce Android lag due to low entropy.
1. Change wakeup threshold kernel parameters ala KAK.
2. Run rngd ala Seeder but not in intensive feed mode.
3. Remove /dev/random as it's blocking. Link it to non-blocking /dev/urandom. Since /dev/random is blocking and designed to protect us from Quantum alien cryptographers with mathematical certainty and urandom is non blocking pseudo-random device that most apps and OSs are using anyway.
I'm getting some good results on all Android devices I've tried this on.
You can check your results with this tool:
http://play.google.com/store/apps/de...ndentropyavail
You should get consistent values around the maximum 4096 with this mod.
This is the listing of /etc/init.d/00CrossBreeder (Can be run manually too) :
Code:
#!/system/bin/sh
busybox sysctl -w kernel.random.write_wakeup_threshold=4096
busybox sysctl -w kernel.random.read_wakeup_threshold=1333
rm /dev/random && ln /dev/urandom /dev/random
busybox mknod -m 666 /dev/random.fake c 1 8
busybox chown root.root /dev/random.fake
rngd -t 30 -T 1 -s 256 -W 80% -o /dev/random.fake
sleep 2
echo -8 > /proc/$(busybox pgrep rngd)/oom_adj
renice 5 `busybox pidof rngd`
rm /dev/random.fake
Your thoughts and experiences welcome.
Notes:
1. You can put the code in /etc/init.d/00CrossBreeder and make it executable with:
chmod 755 /etc/init.d/00CrossBreeder
This should run on every boot if you have init.d support. You can also run it manually.
2. You'll need to rename the attached rngd.img binary to /system/xbin/rngd and make it executable with:
cp rngd.img /system/xbin/rngd
chmod 755 /system/xbin/rngd
3. You'll need to stop the seeder service and disable auto start ( IMPORTANT as seeder rngd can take high cpu with the link enabled). Though you can run the app to see available entropy.
or flash zip ( update 29/01/13 ) => CrossBreederByMick.zip
CREDITS:
1. Seeder. This rngd binary is from the seeder util. ( http://forum.xda-developers.com/show...php?p=33999592 )
2. KAK ( http://forum.xda-developers.com/show...php?p=12058585 ).
Click to expand...
Click to collapse
had this running on flinnys cm10.1 since the morning and so far so good
DuTY09 said:
had this running on flinnys cm10.1 since the morning and so far so good
Click to expand...
Click to collapse
Can you translate it to "human language" ?
Or is it for devs only ?
remusator said:
Can you translate it to "human language" ?
Or is it for devs only ?
Click to expand...
Click to collapse
basically all this does is free up more resources which helps reduce lag well that's what I've gathered anyways I'm probably wrong but I'm not a dev either I just flashed the zip lol
well, just use Seeder. End of story.
btw, are you a leecher or what? kinda same post like the one on this thread by idcrisis .
This yarn is a non-development? If yes what is the Idcrisis with a tweak added!
But said that everyone does not parcour Forum fro!
R: [MOD ICS, GB / 29/01] CrossBreeder (uRandom) for entropy based lag reduction
It feels better and smoother than with seeder only. Running fine on JellyTime 4.2
Inviato dal mio Desire S
What's the difference between this and the version by idcrisis?
What's the difference between this and the version by idcrisis?
Click to expand...
Click to collapse
Script IdCrisis :
init.d => 00CrossBreeder
xbin => haveged
#!/system/bin/sh
busybox sysctl -w kernel.random.write_wakeup_threshold=4096
busybox sysctl -w kernel.random.read_wakeup_threshold=1333
rm /dev/random && ln /dev/urandom /dev/random
if pgrep haveged > /dev/null; then
echo Haveged already running. Not starting another instance.
exit 1
fi
haveged -w 4096
Click to expand...
Click to collapse
Script me :
init.d => 00CrossBreeder + 04ramtweaks + 30sdcardspeedfix + 93zipalign
xbin => rngd
#!/system/bin/sh
busybox sysctl -w kernel.random.write_wakeup_threshold=4096
busybox sysctl -w kernel.random.read_wakeup_threshold=1333
rm /dev/random && ln /dev/urandom /dev/random
busybox mknod -m 666 /dev/random.fake c 1 8
busybox chown root.root /dev/random.fake
rngd -t 10 -T 1 -s 256 -W 80% -o /dev/random.fake
sleep 2
echo -8 > /proc/$(busybox pgrep rngd)/oom_adj
renice 5 `busybox pidof rngd`
rm /dev/random.fake
Click to expand...
Click to collapse
OK... It's not very clear in the OP. What should I do to use this mod? Should I just flash the ZIP? And if yes, how can I find the service and stop it?
Thanks a lot in advance!
So all we need is to flash the crossbreed zip? What about the rngd.img? fastboot flash?
Sorry but, i can't understand @[email protected]
leimrey said:
So all we need is to flash the crossbreed zip? What about the rngd.img? fastboot flash?
Sorry but, i can't understand @[email protected]
Click to expand...
Click to collapse
Yes flash the zip, it's in the OP
Sent from my supercharged :tank:
Just for anyone who hasn't seen it. This was posted by arcee on his G+
https://plus.google.com/115049428938715274412/posts/GWr72W9zmY2
I should've learned by now that sarcasm doesn't translate well on the internet
So to be clear... IMNSHO, the recent entropy pool fad is bull****. The only users of /dev/random are libcrypto (used for cryptographic operations like SSL connections, ssh key generation, and so on), wpa_supplicant/hostapd (to generate WEP/WPA keys while in AP mode), and the libraries that generate random partition IDs when you do an ext2/3/4 format. None of those 3 users are in the path of app execution, so feeding random from urandom does nothing except make random... well... less random
The only conceivable reason some devices may feel faster is because by constantly polling the PRNG, it keeps the device's I/O in constant use (which in turn, depending on device, will make the CPU stick to higher clock frequencies to keep up and/or ramp up the IO scheduler).
Click to expand...
Click to collapse
I'm not hating on the OP or anything, just thought I'd share the info.
dan-fish said:
Just for anyone who hasn't seen it. This was posted by arcee on his G+
https://plus.google.com/115049428938715274412/posts/GWr72W9zmY2
I'm not hating on the OP or anything, just thought I'd share the info.
Click to expand...
Click to collapse
Gosh so happy...
The day my exam ends am gonna post a thread...on all placebo effects and atleast make desire s users smart to not believe in placebo effects...
Entropy bingo just keeps cell at higher frequency thereby making cell feel responsive...
You can achieve same by keeping lower frequency to say 768 or something rather than 245 and upper limit 1200 as always...and voila everythings flying
Gosh entropy, lag reduction, build prop tweaks (setting some values which are not even used post GB still people say set some windows manager event or debug.some value as 1 makes rom feel smoother which ain't even used in code)
I am gonna do that 1st than port some rom...so people are a bit smart rather than live in placebo world
Atleast desire S users for heaven sake are

Sysctl tweaks

I was wondering how to start a sysctl tweak,,just got it now.I thought I share it with you.I even don't know how it will be helpful for our device.Anyway let's learn .
Make a new file in /system/etc/
init.d, name it sysctl_tweaks,,,,,
insert these codes
#!/system/bin/sh
# grep sysctl /etc/init.d/*
/etc/init.d/02vm:# Load /sys/etc/
sysctl.conf
/etc/init.d/02vm:sysctl -p
This will make sysctl -p to load at start up.
Now make a new file in /system/etc,
name it sysctl.conf and put this inside
#sysctl.conf file
,,thereafter put any tweaks after it here .
Like .
#sysctl.conf
net.ipv4.tcp_ecn=0
net.ipv4.route.flush = 1
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_rmem = 4096 39000
187000
net.ipv4.tcp_wmem = 4096 39000
187000
net.ipv4.tcp_mem = 187000 187000
187000
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_moderate_rcvbuf = 1
If you set it right ,,when you type sysctl -p in terminal ,,all tweaks will be displayed immediately.
you don't have to do it with such complicated way. instead of it you can make a file in init.d contain
Code:
#!/system/bin/sh
sysctl -p
it will configure our system based on your sysctl.conf file. you can also make it more easier by using a file in init.d directly. the content of your file will be something like this
Code:
#!/system/bin/sh
sysctl -w net.ipv4.tcp_ecn=0
sysctl -w net.ipv4.route.flush = 1
sysctl -w net.ipv4.tcp_rfc1337 = 1
# or you can make it in this form
echo 0 > /proc/sys/net/ipv4/tcp_ecn
echo 1 > /proc/sys/net/ipv4/route.flush
echo 1 > /proc/sys/net/ipv4/tcp_rfc1337
# both of them have same effect
Oh that's cool.Can I still put those codes like yours in sysctl.conf file ?
you can't. if you want to use those codes you should put it on a file in init.d
What this actually do...
kurotsugi said:
you can't. if you want to use those codes you should put it on a file in init.d
Click to expand...
Click to collapse
The benefit of putting codes in sysctl.conf is that you can see in terminal if it is working or not.Any wrong code or error will be reported.
you can debug your tweak anytime with "busybox run-parts /etc/init.d/" or if you want to debug a single tweak you can use "su -c sh /etc/init.d/<your tweak>". if you're using linux then you must use "sysctl -w <address>" or "sysctl -p" to ensure the tweak is running. but, in android there's no difference between using "sysctl" or "echo". the main reason why did most of tweakers use echo command is that it also applicable to other file outside /proc/sys. i.e: if you want to change the gov or iosched, you can't do it via sysctl. instead of it you'll use echo command to change the parameter.
anyway, basicly it depends on the devs choice. both of them working on android. I personally choose doing it via init.d script since I can merge it with several another tweak thus I only need to open one file to edit my tweak.
I agree with you kuro.
It's up to them which script does stick with the tweak.
For me, echoing is the easiest.
@Kuro,does ur tweaks have it inside?have last changed tweak1 which u have posted and there are many sysctl files inside or are these ones others and is it usefull to change some files or use it with ur tweaks together?anyway i must say that last kuro1 is very good. :good:..
Thanx to Premolikes for usefull thread!!! :good:
it already inside kuro1 tweak. anything in kuro1 similar with 'sysctl -w bla.blabla' is part of sysctl tweak. I use sysctl instead of echo command to ensure that the command will work on every device.

Categories

Resources