In the process of trying to improve my kernel, I've found that some of the potential improvements available for various kernels are sysfs tweaks that can be achieved in init.d - Some of these are things I was semi-aware of but didn't have the time to play around with until recently.
I'm going to start an archive of various scripts, categorized by "safe", "should be OK", and "dangerous but high payoff".
This post will link to individual posts in the thread, each with their own script.
For short scripts, I will simply put them here as code that can be copied and pasted, allowing for easier review and discussion. For longer scripts, I will attach them. I have started including downloadable versions of each script to avoid CR/LF issues. It is not possible to upload an attachment without an extension - before installing any attached scripts, you must remove the .txt extension
To install a script:
Put the contents into a file. I suggest an editor that can save in UNIX format (different linefeeds than DOS...)
Save the file - Save it without any extension. e.g. "governor_ondemand", not "governor_ondemand.sh"
Push the file as follows:
Code:
adb remount
adb push <file> /system/etc/init.d/<file>
adb chmod 755 /system/etc/init.d/<file>
The current script list:
Setting a CPU governor on boot
Remount all partitions with noatime
Disable per-file fsync()
Tweak I/O scheduler
Increase ext4 commit interval
Filesystem cache settings
Enabling AFTR (Exynos Only)
GPU Clock/Voltage Control (Exynos Only)
Setting a CPU governor on boot
This one's simple, and mainly for ROM developers. It sets the CPU governor as desired upon bootup. Most users will just use SetCPU instead.
Safety category: SAFE
Code:
#!/sbin/sh
log "Changing governor to ondemand"
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Replace "ondemand" with the supported governor of your choice
Remount all partitions with noatime
One feature of ext4 is an "access time" attribute per file, aka atime. This attribute is not useful to very many people (mainly, I think, those doing security audits of sensitive systems). Updating the access time can slow filesystem access down.
The following script (Credit goes to gokhanmoral of SiyahKernel for this one) will remount all partitions with noatime set.
Safety category: SAFE
Code:
#!/sbin/sh
for k in $(/sbin/busybox mount | /sbin/busybox grep relatime | /sbin/busybox cut -d " " -f3)
do
sync
/sbin/busybox mount -o remount,noatime $k
done
Edit: garyd9 has pointed out that this may not actually be very beneficial - /data is already mounted noatime, doesn't matter on /system since that's read-only.
Enabling AFTR
AFTR is a deep-idle state supported by Exynos CPUs - it turns out that it is disabled by default. This script enables it. Credit to gokhanmoral of SiyahKernel for discovering this.
It is somewhat disconcerting that this feature is disabled by default and prints out a lot of debugging info by default. It may have issues. As a result,
Safety Category: SHOULD BE OK
Code:
#!/sbin/sh
log "Enabling AFTR"
echo "3" > /sys/module/cpuidle/parameters/enable_mask
Note that AFTR will cause your dmesg log to be spammed quite a bit by default. Daily Driver 12/8/2011 and newer have a fix for this, as do newer SiyahKernel releases.
This script is OBSOLETE on Daily Driver 1/29/2012 and later releases. AFTR is enabled by default on them.
Disable per-file fsync()
This capability is currently only supported in my kernel and (I think) knzo's void series for the I9100. It is based on patches from Andrea Righi (arighi). It disables per-file sync(), so that even if an application asks for data to be immediately flushed to disk, it won't be. This is most obvious with sqlite - this achieves the same goals as the modded sqlite you see in some tweaks, but in a runtime-controllable fashion.
However, this means that in a crash, you are much more likely to have unwritten database data. This can do things like cause a database to become corrupt, leading to force close loops. I had it happen all the time on xdandroid due to the way xdandroid handled filesystem writes on loop mounts.
Safety category: DANGEROUS (but potentially high payoff in database I/O workloads - this one is good for around 600 points of Quadrant epeen, for example)
Code:
#!/sbin/sh
log "Disabling per-file fsync()"
echo "1" > /sys/module/sync/parameters/fsync_disabled
Tweak I/O scheduler
This changes filesystem I/O scheduler parameters, and also changes the I/O scheduler if desired. This was included in many Infuse kernels, and is currently included in Daily Driver - However, as I believe that the user should have as much control as possible, this script will be removed from DD in favor of living "outside the kernel" where it should be within 1-2 releases.
While I discovered it in the Infuse community, its origin appears to be Bonsai.
Right now it defaults to BFQ. Change the "SCHEDULER=bfq" line to noop, deadline, or cfq as desired.
Safety category: SAFE (After all, it's been in DD almost since the beginning)
Code:
#!/sbin/sh
#
# Copyright (C) 2011 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
#
#################################
# BonsaiROM
#################################
MMC=`ls -d /sys/block/mmc*`
SCHEDULER=bfq
# Optimize non-rotating storage;
log "INIT.scheduler BEGIN:setting scheduler parameters for $SCHEDULER"
case "$SCHEDULER" in
noop)
for i in $MMC; do
echo "noop" > $i/queue/scheduler
done
;;
deadline)
for i in $MMC; do
echo "deadline" > $i/queue/scheduler
echo 80 > $i/queue/iosched/read_expire # untested
echo 1 > $i/queue/iosched/fifo_batch # untested
echo 1 > $i/queue/iosched/front_merges # untested
done
;;
cfq)
for i in $MMC; do
echo "cfq" > $i/queue/scheduler
echo "0" > $i/queue/rotational
echo "1" > $i/queue/iosched/back_seek_penalty
echo "1" > $i/queue/iosched/low_latency
echo "3" > $i/queue/iosched/slice_idle
echo "4096" > $i/queue/read_ahead_kb # default: 128; (recomended: 128)
echo 1000000000 > $i/queue/iosched/back_seek_max
echo "16" > $i/queue/iosched/quantum # default: 4 (recomended: 16)
echo "2048" > $i/queue/nr_requests # default:128 (recomended: 2048)
done
echo "0" > /proc/sys/kernel/sched_child_runs_first
;;
bfq)
for i in $MMC; do
echo "bfq" > $i/queue/scheduler
echo "0" > $i/queue/rotational
echo "1" > $i/queue/iosched/back_seek_penalty
echo "3" > $i/queue/iosched/slice_idle
echo "2048" > $i/queue/read_ahead_kb # default: 128
echo 1000000000 > $i/queue/iosched/back_seek_max
echo "16" > $i/queue/iosched/quantum # default: 4 (recomended: 16)
echo "2048" > $i/queue/nr_requests # default:128 (recomended: 2048)
done
;;
*)
log "INIT.scheduler ERROR:failed to set parameters for unknown scheduler: $SCHEDULER"
exit -1;
;;
esac
log "INIT.scheduler END:setting $SCHEDULER scheduler parameters"
Increase ext4 commit interval
This script increases the ext4 commit interval to 20 seconds (Default: 5) - by delaying journal writes longer, it can help performance, but lengthens the window during which a crash will cause unwritten data to be lost.
Credit goes to gokhanmoral of SiyahKernel for this one
Safety category: SHOULD BE OK
Code:
#!/sbin/sh
log "Increasing ext4 commit interval to 20 seconds
for k in $(/sbin/busybox mount | /sbin/busybox grep ext4 | /sbin/busybox cut -d " " -f3)
do
sync
/sbin/busybox mount -o remount,commit=20 $k
done
Filesystem cache settings
This one will be an external link. There are choices - battery-optimized or performance-optimized.
http://www.android-devs.com/?p=31
Safety category: SAFE
Excellent write up, thanks for sharing. Just a note, I think you typoed post #4 from post #2 (the code part).
Ken
Entropy512 said:
One feature of ext4 is an "access time" attribute per file, aka atime. This attribute is not useful to very many people (mainly, I think, those doing security audits of sensitive systems). Updating the access time can slow filesystem access down.
The following script (Credit goes to gokhanmoral of SiyahKernel for this one) will remount all partitions with noatime set.
Safety category: SAFE
Code:
#!/sbin/sh
for k in $(/sbin/busybox mount | /sbin/busybox grep relatime | /sbin/busybox cut -d " " -f3)
do
sync
/sbin/busybox mount -o remount,noatime $k
done
Click to expand...
Click to collapse
Thank you soo much for this script, Entropy!
ran it and noticed within moments ....
guys in the forum just a heads up ... in case you hadn't thought of it ... for ease of managing these scripts, you can download rom toolbox pro and enter a script (i think they're here for us to copy straight in to Terminal() + save new scripts etc etc. very convenient
Entropy512 said:
One feature of ext4 is an "access time" attribute per file, aka atime....
Click to expand...
Click to collapse
I'm surprised this is not off by default in Android. noatime is one of the first things recommended to turn off on file-operation-busy unix servers...
*redundancy edit*
Entropy512 said:
AFTR is a deep-idle state supported by our CPU....
Code:
#!/sbin/sh
log "Changing governor to ondemand"
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
...
Click to expand...
Click to collapse
the code above changes governor... is this a typo?
---------- Post added at 10:56 PM ---------- Previous post was at 10:47 PM ----------
Entropy512 said:
This script increases the ext4 commit interval to 20 seconds (Default: 5)
Click to expand...
Click to collapse
I wonder if anyone has confirmed real-life benefit of this? I mean it's a phone on (essentially) SSD drive with relatively little disk IO (especially on write) right?. It's not like we run Oracle on spindles where postponing commit longer may present kernel a chance to optimize/re-order IO operations with disks for better performance (but unsafer)....
vladm7 said:
I'm surprised this is not off by default in Android. noatime is one of the first things recommended to turn off on file-operation-busy unix servers...
Click to expand...
Click to collapse
Surprising
You can use terminal but.pretty sure They are for scripts in system/etc/init.d
You can use script manager if.your kernel does not support init.d
Amplified said:
Thank you soo much for this script, Entropy!
ran it and noticed within moments ....
guys in the forum just a heads up ... in case you hadn't thought of it ... for ease of managing these scripts, you can download rom toolbox pro and enter a script (i think they're here for us to copy straight in to Terminal() + save new scripts etc etc. very convenient
Click to expand...
Click to collapse
Sent from my SAMSUNG-SGH-I777 using xda premium
Entropy512 said:
This changes filesystem I/O scheduler parameters, and also changes the I/O scheduler if desired. This was included in many Infuse kernels, and is currently included in Daily Driver - However, as I believe that the user should have as much control as possible, this script will be removed from DD in favor of living "outside the kernel" where it should be within 1-2 releases.
While I discovered it in the Infuse community, its origin appears to be Bonsai.
Right now it defaults to BFQ. Change the "SCHEDULER=bfq" line to noop, deadline, or cfq as desired.
Safety category: SAFE (After all, it's been in DD almost since the beginning)
Code:
#!/sbin/sh
#
# Copyright (C) 2011 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
# License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
#
#################################
# BonsaiROM
#################################
MMC=`ls -d /sys/block/mmc*`
SCHEDULER=bfq
# Optimize non-rotating storage;
log "INIT.scheduler BEGIN:setting scheduler parameters for $SCHEDULER"
case "$SCHEDULER" in
noop)
for i in $MMC; do
echo "noop" > $i/queue/scheduler
done
;;
deadline)
for i in $MMC; do
echo "deadline" > $i/queue/scheduler
echo 80 > $i/queue/iosched/read_expire # untested
echo 1 > $i/queue/iosched/fifo_batch # untested
echo 1 > $i/queue/iosched/front_merges # untested
done
;;
cfq)
for i in $MMC; do
echo "cfq" > $i/queue/scheduler
echo "0" > $i/queue/rotational
echo "1" > $i/queue/iosched/back_seek_penalty
echo "1" > $i/queue/iosched/low_latency
echo "3" > $i/queue/iosched/slice_idle
echo "4096" > $i/queue/read_ahead_kb # default: 128; (recomended: 128)
echo 1000000000 > $i/queue/iosched/back_seek_max
echo "16" > $i/queue/iosched/quantum # default: 4 (recomended: 16)
echo "2048" > $i/queue/nr_requests # default:128 (recomended: 2048)
done
echo "0" > /proc/sys/kernel/sched_child_runs_first
;;
bfq)
for i in $MMC; do
echo "bfq" > $i/queue/scheduler
echo "0" > $i/queue/rotational
echo "1" > $i/queue/iosched/back_seek_penalty
echo "3" > $i/queue/iosched/slice_idle
echo "2048" > $i/queue/read_ahead_kb # default: 128
echo 1000000000 > $i/queue/iosched/back_seek_max
echo "16" > $i/queue/iosched/quantum # default: 4 (recomended: 16)
echo "2048" > $i/queue/nr_requests # default:128 (recomended: 2048)
done
;;
*)
log "INIT.scheduler ERROR:failed to set parameters for unknown scheduler: $SCHEDULER"
exit -1;
;;
esac
log "INIT.scheduler END:setting $SCHEDULER scheduler parameters"
Click to expand...
Click to collapse
Installed this script verbatim, swapped bfq with the code noop (after a bit of reading up on these commands (within "Scheduler=bfq)) ~ and was unable to sucessfully run the script. Was wondering what else i should try to set scheduler to noop
*edit*
seperate mod, same useful init.d script thread oirigin
Also ~ after getting adb working i started attempting to tackle the sysctl.conf but after all a few hours of reading i have a couple of questions before i proceed to create this file / adb push it to my phone.
these are the only qs i have:
- Possible to create a file using windows? I assume possible, next q is how to create a *.conf file on a windows PC (at this hour i am not thinking outside of the box lol)
- once i create the sysctl.conf file, if i understand the process properly, i will simply add the codei chose into the file and then adb push the file to my phone which leads to couple sub questions (trying to learn - haters make like bee with no stinger): Should I simply cut / paste snipets of this code in whatever order ?
have it on my mind to complete this mod including new file - dev help is greatly appreciated.
Amplified said:
Surprising
Click to expand...
Click to collapse
well, yeah: i777 is my first Android.
Disabling atime is a widely used (safe) tuning in unix-servers world to increase performance of operations with the file system.
So, yes, I find it odd that Sammy didn't have that off by default in their ROMs.
Or am I missing the point of irony?
vladm7 said:
the code above changes governor... is this a typo?
Click to expand...
Click to collapse
I'll fix it tonight, that one's a copypasta error
vladm7 said:
I wonder if anyone has confirmed real-life benefit of this? I mean it's a phone on (essentially) SSD drive with relatively little disk IO (especially on write) right?. It's not like we run Oracle on spindles where postponing commit longer may present kernel a chance to optimize/re-order IO operations with disks for better performance (but unsafer)....
Click to expand...
Click to collapse
I haven't poked at that one much. It depends partly on if the phone will enter deep sleep with uncommitted data. It may only be good for benchmark epeen
As to scripts in /system/etc/init.d not running:
They must be executable (chmod 755 is recommended)
They must not have a .sh extension - for some reason run-parts won't run them if they do (annoying...)
If created in Windows there might be line-ending issues (CR vs CR/LF)
a couple of small scripts to remount in RW/RO
I know, this is not directly related to kernel params tuning, but I think not worth a new thread.
Since I often mess in terminal, and need to remount /system in RW mode, I wrote those two small scripts to save some extra typing.
Remounts given file system in RW, /system by default. Save as /system/xbin/rw and then chmod +rx /system/xbin/rw:
Code:
#!/sbin/sh
disk=/system
if [ -n "$1" ]; then
if [ $(busybox grep -c $1 /proc/mounts) -gt 0 ]; then
disk="$1"
else
echo "Can't find '$1' mount"
exit
fi
fi
echo "Remounting '$disk' in Read-Write access mode"
busybox mount -o rw,remount $disk
Save as /system/xbin/ro. Remounts given file system in RO, /system by default:
Code:
#!/sbin/sh
disk=/system
if [ -n "$1" ]; then
if [ $(busybox grep -c $1 /proc/mounts) -gt 0 ]; then
disk="$1"
else
echo "Can't find '$1' mount"
exit
fi
fi
echo "Remounting '$disk' in Read-Only access mode"
busybox mount -o ro,remount $disk
Entropy,
Can you attach these scripts please.
Related
I've been building a list of commands that gets executed into froyo.user.conf. Use this as a reference, as I won't be responsible for your Rhodium exploding.
# Dealing with incomplete swapfile support in userinit.sh
swapon /sdcard/swapfile
# busybox /bin/sh is 10000x better than what's in /system
mount --bind /bin/sh /system/bin/sh
# I use F22's b1home setup, not only do I get needed symbols, it doesn't do idiotic stuff like define SMS to GRAVE, then redefine GRAVE to 0x03 (Ctrl-C) in the kcm file - read my post below on how to do this
mkdir -p /init.etc/keymaps/custom
cp -a /sdcard/*.kcm* /sdcard/*.kl /init.etc/keymaps/custom
# Create /data/local if it doesn't exist, then symlink bin to /sdcard/bin if that doesn't exist
mkdir -p /data/local
[ -e /data/local/bin ] || ln -s /sdcard/bin /data/local/bin
There is now a file that is called /sdcard/local.prop that gets copied on boot. Anything related to setprop can be set there, ie. I have:
dalvik.vm.execution-mode = int:jit
dalvik.vm.heapsize = 32m
ro.cdma.home.operator.alpha seems unnecessary now, but you must still have a valid eri.xml (again residing in /sdcard) to get the system to show you the provider.
-- Starfox
---
This is for legacy FRX06 or earlier, kept as reference:
# Readahead for /sdcard as per hyc
echo 2048 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
# Dealing with incomplete swapfile support in userinit.sh, I use a 32mb file
swapon /sdcard/swapfile
# CDMA stuff, /etc gets rebuilt on every boot for now
echo "ro.cdma.home.operator.alpha = Sprint" >> /etc/default.prop
echo "ro.cdma.home.operator.numeric = 31000" >> /etc/default.prop
# CDMA stuff since I keep the Sprint SIM in & changing dalvik to jit
sed -e 's/default_network = 0/default_network = 4/' -e 's/vm.execution-mode = int:fast/vm.execution-mode = int:jit/' /system/build.prop > /sdcard/build.prop
# Bigger heapsize
echo "dalvik.vm.heapsize = 32m" >> /sdcard/build.prop
# /system/build.prop is mounted from /tmp, bindmount mine instead
umount -f /system/build.prop; mount --bind /sdcard/build.prop /system/build.prop
# GPS (0,0) fix
umount -f /system/lib/libhardware_legacy.so; mount --bind /sdcard/libhardware_legacy.so /system/lib/libhardware_legacy.so
# Using hyc RIL
mount --bind /sdcard/libhtcgeneric-ril.so /lib/froyo/libhtcgeneric-ril.so
# hyc's injection RIL lib
mount --bind /sdcard/libril.so /system/lib/libril.so
# Use /bin/sh (Busybox) over statically compiled sh, esp. for arrow key support
mount --bind /bin/sh /system/bin/sh
# I keep eri.xml and serialno in /sdcard/conf, and an empty dir called local
cp -a /sdcard/conf/* /data
# Term emu puts /data/local/bin in path first, I keep some binaries in /sdcard/bin, need to /data/local first
ln -s /sdcard/bin /data/local/bin
Nice. May want to note that the GPS 0,0 fix requires a fixed library.
Two sources for this:
1) Use the one on my testing thread
2) Extract it from system.ext2 of FRX06 (It may be difficult to do this with a running system due to the bindmounts. Although I see you're effectively unmounting the existing bindmount prior to mounting the new one - I should try this weekend to see if that is enough to get the fix to work with FRX06.)
2) is preferable as it's the official release, although it should be identical to mine.
Thanks alot for doing this.
Any chance you could attach the files you are showing to replace in some of your commands? Like some I see are 'build.prop', 'libhardware_legacy.so', 'libhtcgeneric-ril.so' and 'libril.so'.
Or possibly link to the original thread/post you got this from?
where do we put these in froyo.user.conf
anish88 said:
where do we put these in froyo.user.conf
Click to expand...
Click to collapse
Most go in CustomCommands...
Starfox said:
I've been building a list of commands that gets executed into froyo.user.conf. Use this as a reference, as I won't be responsible for your Rhodium exploding.
Click to expand...
Click to collapse
I hope to see most of these already incorporated in the next release...
# Readahead for /sdcard as per hyc
echo 2048 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
Click to expand...
Click to collapse
I've requested this readahead patch to be merged.
# Dealing with incomplete swapfile support in userinit.sh, I use a 32mb file
swapon /sdcard/swapfile
Click to expand...
Click to collapse
Current Android system_server is too stupid to work well with swap. And I think our low_memory_killer settings need to be tweaked to work well with it. I haven't spent any time investigating but it definitely slows down too much. I would recommend against using swap for now.
# CDMA stuff, /etc gets rebuilt on every boot for now
echo "ro.cdma.home.operator.alpha = Sprint" >> /etc/default.prop
echo "ro.cdma.home.operator.numeric = 31000" >> /etc/default.prop
# CDMA stuff since I keep the Sprint SIM in & changing dalvik to jit
sed -e 's/default_network = 0/default_network = 4/' -e 's/vm.execution-mode = int:fast/vm.execution-mode = int:jit/' /system/build.prop > /sdcard/build.prop
Click to expand...
Click to collapse
CDMA stuff is going to be automated in next ril. No more manual prop settings needed.
# Bigger heapsize
echo "dalvik.vm.heapsize = 32m" >> /sdcard/build.prop
Click to expand...
Click to collapse
Good idea.
# GPS (0,0) fix
umount -f /system/lib/libhardware_legacy.so; mount --bind /sdcard/libhardware_legacy.so /system/lib/libhardware_legacy.so
# Using hyc RIL
mount --bind /sdcard/libhtcgeneric-ril.so /lib/froyo/libhtcgeneric-ril.so
Click to expand...
Click to collapse
These should no longer be needed when my rootfs requests are merged.
# hyc's injection RIL lib
mount --bind /sdcard/libril.so /system/lib/libril.so
Click to expand...
Click to collapse
I've requested that this be merged too.
# I keep eri.xml and serialno in /sdcard/conf, and an empty dir called local
cp -a /sdcard/conf/* /data
Click to expand...
Click to collapse
New system image will have a nicer default eri.xml ...
Does this look right? It's hard tell because it's all a jumble in notepad. I highlighted the two items I added in red.
Code:
# General parameters
general{
renice=1 # Run the renice script to inprove call answering
}
#compcache related parameters
compcache{
compcache_en=1 # enable(1) or disable(0)20 compcache
cc_disksize=100 # Ram swap disksize - any number between 1 to 98 should
work; default is 1/4 of the RAM (24)
cc_memlimit=64 # Limit the memory usage for backing swap (cc .5x known issue-defaults to
15% of total RAM)
cc_backingswap_en=0 # enable(1) or disable(0) backing swap
cc_backingswap=/dev/block/mmcblk0p4 # pointing to
the backingswap partition device, swap
}
#create swap file for compcache or linux swap
swap_file{
swap_file_en=0 # set to 1 to
create swap file
# set to 0 to del the swap file
linux_swap_file_size=32 # swap file size in MB
linux_swap_file=/sdcard/swapfile # pointing to the swap file location ( must be /system/sd/)
}
#Linux swap parameters
#
# linux
swap can only be enabled if cc_backingswap_en is set to "0"
#
linux_swap{
linux_swap_en=0 # enable(1) or disable(0) linux swap
linux_swap_partition=/dev/block/mmcblk0p4 # swap partition device
}
#virtual memory
sys_vm{
sys_vm_en=1 # enable(1) or disable(0)
virtual memory configurations
swappiness=0 # default 60
page_cluster=0 # default 3, (0 since CM3.9.6+)
laptop_mode=5 #
default 0
dirty_expire_centisecs=3000 # default 3000
dirty_writeback_centisecs=1500 # default 500
dirty_background_ratio=3 #
default 5
dirty_ratio=5 # default 10
vfs_cache_pressure=200 # default 100 (tendency of the kernel to reclaim cache memory)
overcommit_memory=1 # default 0 (0=Heuristic 1=Always overcommit 2=Don't overcommit)
overcommit_ratio=80 # default 50 (% of
Physical+Virtual memory to allow allocation)
}
# custom shell commands, these commands run last
custom_shells{
chmod 777
/etc/dbus.conf
#echo 2 > /sys/devices/platform/msm_hsusb/usb_function_switch
rm -f /sdcard/fsck*.rec
modprobe ipv6
mount --bind
/sdcard/Android/libhtcgeneric-ril.so /lib/froyo/libhtcgeneric-ril.so
[COLOR=Red]# Bigger heapsize
echo "dalvik.vm.heapsize = 32m" >> /sdcard/build.prop# /system/build.prop is mounted from /tmp, bindmount mine instead
umount -f /system/build.prop; mount --bind /sdcard/build.prop /system/build.prop[/COLOR]#echo "Hello!!!" # example
#echo "You can create
your own commands here" # example
}
Avatar28 said:
Does this look right? It's hard tell because it's all a jumble in notepad. I highlighted the two items I added in red.
Click to expand...
Click to collapse
Looks fine - use Notepad++ if you're on Windows.
arrrghhh said:
Looks fine - use Notepad++ if you're on Windows.
Click to expand...
Click to collapse
Hmm, you're right. MUCH better.
System wouldn't boot into Android at first. Just went black when it should load the animated xdandroid splash screen. Finally realized that I wasn't thinking and needed to copy the build.prop file from the system folder to the SD card before I could call it. Oops.
would anyone care to provide some info on what each command does? benefits?
manny05 said:
would anyone care to provide some info on what each command does? benefits?
Click to expand...
Click to collapse
He's commented each line... if you're not sure then don't use it. highlandsun also went thru them pretty thoroughly.
I think the only thing that isn't in the category of "soon to be obsolete" or "explained by highlandsun" is the vm.heapsize tweak
I believe that vm.heapsize sets the maximum amount of memory a single app can use. As a result, it can sometimes fix applications that claim to be running out of memory when there is plenty of system RAM. (Traffic features in Google Maps are one thing that frequently breaks with the default setting of 12-16M)
Entropy512 said:
I think the only thing that isn't in the category of "soon to be obsolete" or "explained by highlandsun" is the vm.heapsize tweak
I believe that vm.heapsize sets the maximum amount of memory a single app can use. As a result, it can sometimes fix applications that claim to be running out of memory when there is plenty of system RAM. (Traffic features in Google Maps are one thing that frequently breaks with the default setting of 12-16M)
Click to expand...
Click to collapse
how much memory do you think an app needs? i mean how would i know what to set it to.
manny05 said:
how much memory do you think an app needs? i mean how would i know what to set it to.
Click to expand...
Click to collapse
If you read the OP, that value seems good. AFAIK the default is 12, in the OP it's set to 32.
manny05 said:
how much memory do you think an app needs? i mean how would i know what to set it to.
Click to expand...
Click to collapse
Most of the Android forums I've read seem to recommend 32m - which seems to be more than enough for any app I am aware of. I think the majority of cooked Android ROMs for other devices use that value.
Added support for bluetooth:
sed -e "s% /system/bin/hciattach % /data/local/bin/brcm_patchram_plus -r --enable_hci %" -e "s%-n -s 115200 /dev/ttyHS1 texas 115200 flow%--enable_lpm --baudrate 4000000 --patchram /sdcard/BCM4325.hcd /dev/ttyHS1%" -i /etc/init.rc
This of course assumes you have patchram and the hcd files in their respective place.
-- Starfox
Starfox said:
# Bigger heapsize
echo "dalvik.vm.heapsize = 32m" >> /sdcard/build.prop
Click to expand...
Click to collapse
If this heapsize line is all I want to use from the thread, should I omit the ">> /sdcard/build.prop"? This stuff is all over my head, but I'm thinking that portion might refer to other commands I'm not using and a file I might not have. Any illumination would be appreciated.
___________________
The following two commands from elsewhere (as pulled from manekineko's custom conf) enable droidwall. This seemed like a good thread for them to be in.
modprobe xt_owner
modprobe ipt_REJECT
Click to expand...
Click to collapse
For those using F22's rootfs with the new keymaps and would like to use it over the somewhat braindead one residing in FRX07, these commands will help you keep the mappings:
1) While using F22's rootfs with the correct physkeyboard, copy raph_navi_pad.* and microp-keypad.* from /etc/keymaps to /sdcard
2) Rename raph_navi_pad.kl to qwerty.kl
3) Switch over to FRX07, and add these lines to froyo.user.conf
cp -a /sdcard/*.kcm.bin /sdcard/*.kl /init.etc/keymaps/default
4) Then go to startup.txt, and delete any reference to physkeyboard=
This prevents the init from overwriting "our" keymaps with theirs, as keylayout processing occurs after parsing froyo.user.conf. The init copies whatever is in /init.etc/keymaps/default to the proper place in /system/usr/key*, then checks /init.etc/keymaps/$physkeyboard/ exist, then does the same for that directory.
If you want to preserve the default keymaps directory for some reason, you could also do:
mkdir -p /init.etc/keymaps/custom
cp -a /sdcard/*.kcm.bin /sdcard/*.kl /init.etc/keymaps/custom
And use physkeyboard=custom for steps 3 and 4.
Now time for a rant:
Really why even bother defining a key to GRAVE (microp*.kl) then defining GRAVE as 0x03 (aka Ctrl-C) in the .kcm file. You can see the generated .kcm.bin has that included, by hd microp*.kcm.bin, at the bottom. Also why take away a useable SYM popup with 0x09 (aka Ctrl-I or TAB), again in the .kcm file.
Also, the choice of b1home vs b4home. IMHO Android is too unstable to lose ENDCALL. I can recall a number of times the system became unusable with an active phone call. Relying on touch screen interaction to end a call, on a what is still an unstable port, is quite idiotic. Not to mention you lose that nice end button feature in Spare Parts. You still need the same keypress to get to the dialer with either (as pressing takes you to either the home or contact list, and another to go to dialer).
-- Starfox
Updated post for FRX07, first and last post has been edited.
-- Starfox
For those of you who like to do additional tweaks to your phone, what init.d and build.prop tweaks do you use? I've noticed some of them try to override crpalmer and Zarboz's kernel settings so I removed them. Also, I've read that some of these tweaks don't help at all.
So what tweaks do you recommend, if any, that play well with the DNA and with custom kernels?
Currently I have speedscript in my init.d folder but I noticed no benefit or detriment so I may just remove it. I also reduced the WiFi scan interval in the build.prop. I would like to add more tweaks since I can't leave well enough alone.
I'm looking for speed and battery improvements which can he a fine balancing act. I also want to increase the scroll speed as wel as change the autobrightness settings so it's more biased to lower brightness. I'm not sure if those could be achieved with init.d or build.prop tweaks.
#Render graphics with GPU&CPU
debug.composition.type=cpu
debug.composition.type=gpu
#For Faster Startups Disable Boot Animation
debug.sb.nobootanimation=1<<< faster
[QOUTE]Many build.prop tweaks set this value to 300, but it seems this is a bad idea. As Google points out, Android maxes out at 60fps. The default value is already allow for a possible max_events_per_sec of 90. Even if you allow for 300 max_events_per_sec, you’ll only ever see 60 of these events in any given second. Therefore, any value much higher than 90 is unlikely to have any noticeable impact on your experience in general. Additionally, setting this value too high can starve other UI events that need to get processed, viz. touch inputs. You’re not likely to feel like your device is running very smoothly when it is busy processing thousands of scroll events instead of responding immediately to you clicking to try and open a link or an app. There may be some specific scenarios where increasing this value does appear to improve system feedback, but changing this value for all UI events across the board will likely cause more problems than it will solve.[/QOUTE]
# faster Scrolling
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
# improve voice call clarity
ro.ril.enable.amr.wideband=1
# disable error checking
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
# faster youtube?
ro.ril.hep=0
# Faster boot
persist.sys.shutdown.mode=hibernate
# does not need to be on if not a dev
persist.android.strictmode=0
# disable USB debugging icon from status bar
persist.adb.notify=0
# Qualcomm display settings
debug.qctwa.statusbar=1
debug.qctwa.preservebuf=1
com.qc.hardware=true
# BATTERY SAVING-----------------
ro.ril.disable.power.collapse=1
ro.mot.eri.losalert.delay=1000 #smooths out network disconnects. breakes tethering in CM7.
ro.config.nocheckin=1 #disable sending usage data to google
# sleep modes
pm.sleep_mode=3<<< thats my personal mode used
#usage:
#pm.sleep_mode=0 -> collapse suspend
#pm.sleep_mode=1 -> collapse (will totally power off the cpu)
#pm.sleep_mode=2 -> sleep (cpu is still on, but put into low power mode (registers are still saved)
#pm.sleep_mode=3 -> slow Clock and Wait for Interrupt (lowered frequency and voltage)
#pm.sleep_mode=4 -> wait for interrupt (no change in cpu clock or voltage)
# locks launcher in memory (not recommended on low RAM devices)
#ro.HOME_APP_ADJ=1
check some of thoses out and maybe that will help in what your looking for
internet speed tweaks
Code:
echo "0" > /proc/sys/net/ipv4/tcp_timestamps;
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse;
echo "1" > /proc/sys/net/ipv4/tcp_sack;
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle;
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling;
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo "30" > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout;
echo "404480" > /proc/sys/net/core/wmem_max;
echo "404480" > /proc/sys/net/core/rmem_max;
echo "256960" > /proc/sys/net/core/rmem_default;
echo "256960" > /proc/sys/net/core/wmem_default;
echo "4096,16384,404480" > /proc/sys/net/ipv4/tcp_wmem;
echo "4096,87380,404480" > /proc/sys/net/ipv4/tcp_rmem;
vm management tweaks
Code:
echo "4096" > /proc/sys/vm/min_free_kbytes
echo "0" > /proc/sys/vm/oom_kill_allocating_task;
echo "0" > /proc/sys/vm/panic_on_oom;
echo "0" > /proc/sys/vm/laptop_mode;
echo "0" > /proc/sys/vm/swappiness
echo "50" > /proc/sys/vm/vfs_cache_pressure
echo "90" > /proc/sys/vm/dirty_ratio
echo "70" > /proc/sys/vm/dirty_background_ratio
misc kernel tweaks
Code:
echo "8" > /proc/sys/vm/page-cluster;
echo "64000" > /proc/sys/kernel/msgmni;
echo "64000" > /proc/sys/kernel/msgmax;
echo "10" > /proc/sys/fs/lease-break-time;
echo "500,512000,64,2048" > /proc/sys/kernel/sem;
5. battery tweaks
Code:
echo "500" > /proc/sys/vm/dirty_expire_centisecs
echo "1000" > /proc/sys/vm/dirty_writeback_centisecs
6. EXT4 tweaks (greatly increase I/O)
(needs /system, /cache, /data partitions formatted to EXT4)
removes journalism
Code:
tune2fs -o journal_data_writeback /block/path/to/system
tune2fs -O ^has_journal /block/path/to/system
tune2fs -o journal_data_writeback /block/path/to/cache
tune2fs -O ^has_journal /block/path/to/cache
tune2fs -o journal_data_writeback /block/path/to/data
tune2fs -O ^has_journal /block/path/to/data
b) perfect mount options
Code:
busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier =0,nobh /system
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodir atime,barrier=0,nobh /data
busybox mount -o remount,noatime,noauto_da_alloc,nosuid,nodev,nodir atime,barrier=0,nobh /cache
Flags blocks as non-rotational and increases cache size
Code:
LOOP=`ls -d /sys/block/loop*`;
RAM=`ls -d /sys/block/ram*`;
MMC=`ls -d /sys/block/mmc*`;
for j in $LOOP $RAM
do
echo "0" > $j/queue/rotational;
echo "2048" > $j/queue/read_ahead_kb;
done
microSD card speed tweak
Code:
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
Defrags database files
Code:
for i in \
`find /data -iname "*.db"`
do \
sqlite3 $i 'VACUUM;';
done
Auto change governor and I/O Scheduler
a) I/O Scheduler (Best: MTD devices - VR; EMMC devices - SIO) - needs kernel with these
Code:
echo "vr" > /sys/block/mmcblk0/queue/scheduler
or
echo "sio" > /sys/block/mmcblk0/queue/scheduler
b) Governor (Best: Minmax > SavagedZen > Smoothass > Smartass > Interactive) - needs kernel with these
Code:
echo "governor-name-here" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
Move dalvik-cache to cache partition to free up data partition space <<< do this only if room is availble
Code:
CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
if [ $CACHESIZE -gt 80000 ]
then
echo "Large cache detected, moving dalvik-cache to /cache"
if [ ! -d /cache/dalvik-cache ]
then
busybox rm -rf /cache/dalvik-cache /data/dalvik-cache
mkdir /cache/dalvik-cache /data/dalvik-cache
fi
busybox chown 1000:1000 /cache/dalvik-cache
busybox chmod 0771 /cache/dalvik-cache
# bind mount dalvik-cache so we can still boot without the sdcard
busybox mount -o bind /cache/dalvik-cache /data/dalvik-cache
busybox chown 1000:1000 /data/dalvik-cache
busybox chmod 0771 /data/dalvik-cache
else
echo "Small cache detected, dalvik-cache will remain on /data"
fi
Disable normalize sleeper
Code:
mount -t debugfs none /sys/kernel/debug
echo NO_NORMALIZED_SLEEPER > /sys/kernel/debug/sched_features
there does those 2 posts help you out orange
---------- Post added at 08:52 AM ---------- Previous post was at 08:51 AM ----------
also some of these are just examples so just modify for your needs cool?
---------- Post added at 08:54 AM ---------- Previous post was at 08:52 AM ----------
autobrightness you need to decompile framework-res.apk
What good app you preffer for underclocking SD625? I want an app thar can underclock and if posible undervolt CPU and turn off some cpu cores. I have RR 5.8.5 with Electrablue 7 kernel.
If you are after an app, then Kernel Adiutor should do some of what you want.
However, if you want full manual control, then you can run commands from a root terminal, or use a script - eg
Code:
# reduce max freq to 1.68ghz
echo "1689600" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# reduce cores running foreground operations
echo "0-3" > /dev/cpuset/foreground/cpus # default=0-6
echo "0-3" > /dev/cpuset/foreground/boost/cpus # default=0-6
# reduce cores running background operations
echo "0" > /dev/cpuset/background/cpus # default=0-1
echo "0-1" > /dev/cpuset/system-background/cpus # default=0-3
# turn off the last 4 cores
echo "0" > /sys/devices/system/cpu/cpu7/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu4/online
DarthJabba9 said:
If you are after an app, then Kernel Adiutor should do some of what you want.
However, if you want full manual control, then you can run commands from a root terminal, or use a script - eg
Code:
# reduce max freq to 1.68ghz
echo "1689600" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# reduce cores running foreground operations
echo "0-3" > /dev/cpuset/foreground/cpus # default=0-6
echo "0-3" > /dev/cpuset/foreground/boost/cpus # default=0-6
# reduce cores running background operations
echo "0" > /dev/cpuset/background/cpus # default=0-1
echo "0-1" > /dev/cpuset/system-background/cpus # default=0-3
# turn off the last 4 cores
echo "0" > /sys/devices/system/cpu/cpu7/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu4/online
Click to expand...
Click to collapse
Very nice commands, these remain after reboot?
Do you know the command for checking current cpu speed and current number of cores online? Or better, one command to show all running cores with their speed.
nikkky said:
Very nice commands, these remain after reboot?
Do you know the command for checking current cpu speed and current number of cores online? Or better, one command to show all running cores with their speed.
Click to expand...
Click to collapse
The commands are not persistent. If you want them to be applied automatically after reboots, you need to put them in a script that is executed via init.d (see https://forum.xda-developers.com/re...o-initd-ad-blocking-bad-audio-videos-t3626661).
To see the values, simply run "cat" on each of the files being written to in the above examples - eg
Code:
cat /sys/devices/system/cpu/cpu7/online
DarthJabba9 said:
The commands are not persistent. If you want them to be applied automatically after reboots, you need to put them in a script that is executed via init.d (see https://forum.xda-developers.com/re...o-initd-ad-blocking-bad-audio-videos-t3626661).
To see the values, simply run "cat" on each of the files being written to in the above examples - eg
Code:
cat /sys/devices/system/cpu/cpu7/online
Click to expand...
Click to collapse
Do you know the command for changing governors?
nikkky said:
Do you know the command for changing governors?
Click to expand...
Click to collapse
Unfortunately, no.
DarthJabba9 said:
If you are after an app, then Kernel Adiutor should do some of what you want.
However, if you want full manual control, then you can run commands from a root terminal, or use a script - eg
Code:
# reduce max freq to 1.68ghz
echo "1689600" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# reduce cores running foreground operations
echo "0-3" > /dev/cpuset/foreground/cpus # default=0-6
echo "0-3" > /dev/cpuset/foreground/boost/cpus # default=0-6
# reduce cores running background operations
echo "0" > /dev/cpuset/background/cpus # default=0-1
echo "0-1" > /dev/cpuset/system-background/cpus # default=0-3
# turn off the last 4 cores
echo "0" > /sys/devices/system/cpu/cpu7/online
echo "0" > /sys/devices/system/cpu/cpu6/online
echo "0" > /sys/devices/system/cpu/cpu5/online
echo "0" > /sys/devices/system/cpu/cpu4/online
Click to expand...
Click to collapse
When I try for example echo "0" > /sys/devices/system/cpu/cpu6/online I got permission denied. I used Material Terminal app.
Edit:
It worked by tiping su before, to convert $ to # for becoming root.
nikkky said:
Edit:
It worked by tiping su before, to convert $ to # for becoming root.
Click to expand...
Click to collapse
Yes. Running the "su" command is what converts your terminal session into a root terminal session
Hello, I decided to publish some guide + scripts I already use for a while, which allows you to use all CPU cores and boost GPU performance.
Battery consumption using this configuration surprisingly does not change much or even did not change at all, with default as well with new config my watch stays alive for ~32h with daily usage.
Some theory:
Sparrow is sold with Qualcomm Snapdragon 400 1.2GHz, which is 4 core CPU. ASUS AW2.0 official kernel though supports only 600MHz and 787MHz, as Asus probably thinks this is good balance between battery life and performance.
GPU is Adreno 302/305, which is capable running up to 450MHz, which is also supported by ASUS AW2.0 kernel.
Where is the catch?
During boot there are all four CPU cores enabled, however there is post-init script, disabling two of those and setting frequency as fixed 738MHz with performance governor (no frequency scaling). GPU is set to fix 200MHz:
/system/bin/init.asus.post_boot.sh
Code:
#!/system/bin/sh
PATH=/system/bin
cd /sys
echo 4 > module/lpm_levels/enable_low_power/l2
echo 1 > module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu0/power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu1/power_collapse/idle_enabled
#Put all other cores offline
echo 0 > devices/system/cpu/cpu2/online
echo 0 > devices/system/cpu/cpu3/online
governor="performance"
scaling_min_freq="787200"
if [[ `grep "oem_perf_change" /proc/cmdline` ]];then
if [[ `grep "oem_perf_on" /proc/cmdline` ]];then
oem_perf_stats="1"
else
oem_perf_stats="0"
fi
echo -n $oem_perf_stats > /factory/oem_perf_stats
fi
echo $governor > devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $governor > devices/system/cpu/cpu1/cpufreq/scaling_governor
#below ondemand parameters can be tuned
echo 50000 > devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 90 > devices/system/cpu/cpufreq/ondemand/up_threshold
echo 1 > devices/system/cpu/cpufreq/ondemand/io_is_busy
echo 2 > devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 10 > devices/system/cpu/cpufreq/ondemand/down_differential
echo 70 > devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
echo 10 > devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
echo 787200 > devices/system/cpu/cpufreq/ondemand/optimal_freq
echo 300000 > devices/system/cpu/cpufreq/ondemand/sync_freq
echo 80 > devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
echo $scaling_min_freq > devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $scaling_min_freq > devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo 787200 > devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 787200 > devices/system/cpu/cpu1/cpufreq/scaling_max_freq
#Below entries are to set the GPU frequency and DCVS governor
echo 200000000 > class/kgsl/kgsl-3d0/devfreq/max_freq
echo 200000000 > class/kgsl/kgsl-3d0/devfreq/min_freq
echo performance > class/kgsl/kgsl-3d0/devfreq/governor
chown -h system devices/system/cpu/cpu[0-1]/cpufreq/scaling_max_freq
chown -h system devices/system/cpu/cpu[0-1]/cpufreq/scaling_min_freq
chown -h root.system devices/system/cpu/cpu[1-3]/online
chmod 664 devices/system/cpu/cpu[1-3]/online
It is indeed required just to alter this script and you can enable all 4 cores with "ondemand" governor, scaling 600-738MHz and GPU scaling 200-450MHz using "msm-adreno-tz" governor:
(and this requires root of course)
Code:
#!/system/bin/sh
PATH=/system/bin
cd /sys
echo 4 > module/lpm_levels/enable_low_power/l2
echo 1 > module/msm_pm/modes/cpu0/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu1/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu2/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu3/power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu0/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu1/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu2/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu3/standalone_power_collapse/suspend_enabled
echo 1 > module/msm_pm/modes/cpu0/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu1/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu2/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu3/standalone_power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu0/power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu1/power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu2/power_collapse/idle_enabled
echo 1 > module/msm_pm/modes/cpu3/power_collapse/idle_enabled
governor="ondemand"
scaling_min_freq="600000"
if [[ `grep "oem_perf_change" /proc/cmdline` ]];then
if [[ `grep "oem_perf_on" /proc/cmdline` ]];then
oem_perf_stats="1"
else
oem_perf_stats="0"
fi
echo -n $oem_perf_stats > /factory/oem_perf_stats
fi
echo $governor > devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $governor > devices/system/cpu/cpu1/cpufreq/scaling_governor
echo $governor > devices/system/cpu/cpu2/cpufreq/scaling_governor
echo $governor > devices/system/cpu/cpu3/cpufreq/scaling_governor
#below ondemand parameters can be tuned
echo 50000 > devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 90 > devices/system/cpu/cpufreq/ondemand/up_threshold
echo 1 > devices/system/cpu/cpufreq/ondemand/io_is_busy
echo 2 > devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 10 > devices/system/cpu/cpufreq/ondemand/down_differential
echo 70 > devices/system/cpu/cpufreq/ondemand/up_threshold_multi_core
echo 10 > devices/system/cpu/cpufreq/ondemand/down_differential_multi_core
echo 787200 > devices/system/cpu/cpufreq/ondemand/optimal_freq
echo 300000 > devices/system/cpu/cpufreq/ondemand/sync_freq
echo 80 > devices/system/cpu/cpufreq/ondemand/up_threshold_any_cpu_load
echo $scaling_min_freq > devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo $scaling_min_freq > devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo $scaling_min_freq > devices/system/cpu/cpu2/cpufreq/scaling_min_freq
echo $scaling_min_freq > devices/system/cpu/cpu3/cpufreq/scaling_min_freq
echo 787200 > devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 787200 > devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo 787200 > devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo 787200 > devices/system/cpu/cpu3/cpufreq/scaling_max_freq
#Below entries are to set the GPU frequency and DCVS governor
echo 450000000 > class/kgsl/kgsl-3d0/devfreq/max_freq
echo 200000000 > class/kgsl/kgsl-3d0/devfreq/min_freq
echo msm-adreno-tz > class/kgsl/kgsl-3d0/devfreq/governor
chown -h system devices/system/cpu/cpu[0-3]/cpufreq/scaling_max_freq
chown -h system devices/system/cpu/cpu[0-3]/cpufreq/scaling_min_freq
chown -h root.system devices/system/cpu/cpu[0-3]/online
chmod 664 devices/system/cpu/cpu[0-3]/online
(both files also attached to this post)
To exchange files in your watch, you can easily use following bash script in linux:
First push desired file into sdcard and go to ADB shell:
Code:
adb push init.asus.post_boot.sh /sdcard/
adb shell
In ADB shell remount system to RW, replace the file and fix privileges, than remount system back to RO:
Code:
su
mount -o rw,remount /system
mv /sdcard/init.asus.post_boot.sh /system/bin/
chown root:shell /system/bin/init.asus.post_boot.sh
chmod 755 /system/bin/init.asus.post_boot.sh
mount -o ro,remount /system
Update 2018/09/05:
In case you want to experiment, I'm also sending "full_power" script, setting all cores to max frequency and performance governor. There should be no issues, except probably less battery life. Just test yourself, how battery life is affected if it is affected at all. Just unpack the zip file, rename the sh script from init.asus.post_boot_full_power.sh to init.asus.post_boot.sh. Rest of the procedure is still the same.
Without kernel sources, this is probably the maximum performance you can get from the watch. Obtaining kernel sources we might get up still twice of current maximum, as the HW is there, but locked on kernel level.
I just swapped the files and I'll give this a try over the next few days. It would be awesome to destroy lag without needing a kernel tweak app to make it happen. You are the man!
Update: I followed your directions, then I wiped cache and dalvik in TWRP. I have only used the watch for a few minutes with this tweak and it is noticeably faster/smoother already. Text messages display lightning fast after being received on the phone. I'm currently on WiFi in my office. The times I notice most lag on my watch is when I'm on 4G, have music playing, and get a call. The phone may ring for 5-10 seconds before the watch displays. I'm excited to see how helpful this tweak is under those conditions. I'll know later today and keep you posted.
I have not experienced any Bluetooth lag since enabling this. This is a must have mod. Thanks for this!
Glad to hear that @CVertigo1. This is just simple SW enablement of things already present in kernel, so even no cache cleans are required. You can play with it on the go even without watch restart.
Amazing will be getting some kernel with much more CPU freq. steps, like 300-768 or even to 1.2GHz (yes, our chip is capable doing so, it is just not enabled in kernel). With proper governor battery will be still ok, resting CPU most of the time in low clocks. It is pity we have great HW, but it is taken out from us with stock kernel.
It would be nice if Asus would upload the kernel source for AW2.0.
CVertigo1 said:
It would be nice if Asus would upload the kernel source for AW2.0.
Click to expand...
Click to collapse
Well we do have latest kernel source
https://www.asus.com/us/ZenWatch/ASUS_ZenWatch_2_WI501Q/HelpDesk_Download/
Or directly here:
http://dlcdnet.asus.com/pub/ASUS/Wearable/ASUS_WI501Q/ASUS_WI501Q-5.2003.1603.10-kernel-src.zip
We just need some handy guy able to compile it and add more governors and frequencies. That is something what overlapping my skills.
That is the latest kernel source for 1.5. They have not released their source for 2.0, nor any firmware for 2.0. I have contacted Asus about it multiple times and none of their reps have any idea what I'm talking about.
CVertigo1 said:
That is the latest kernel source for 1.5. They have not released their source for 2.0, nor any firmware for 2.0. I have contacted Asus about it multiple times and none of their reps have any idea what I'm talking about.
Click to expand...
Click to collapse
Ah, I see I thought 2017/05/12 stated as a release day was after AW20 concluding this had to be the new one. Pity.
Maybe they'll release it eventually...at an Asus speed, like next year.
please help me(rom Sparrow_7.1.1_Debloat ROM ):
adb shell
sparrow:/ $ su
Permission denied
htduy11 said:
please help me(rom Sparrow_7.1.1_Debloat ROM ):
adb shell
sparrow:/ $ su
Permission denied
Click to expand...
Click to collapse
Hi there, you are missing super user in your ROM. Did you installed SuperSU and Busybox thru TWRP after flashing the ROM?
Do this in TWRP, not Android.
'the command can be used in adb in windows or are different? watch must be in recovery or bootloader? wrote a step by step for noob guide please
You must boot in the TWRP recovery. You need the ADB drivers installed on your computer and is easier to use your computer for this.
mastermoon said:
'the command can be used in adb in windows or are different? watch must be in recovery or bootloader? wrote a step by step for noob guide please
Click to expand...
Click to collapse
Actually it is quite simple, what you need:
* in case you use Windows, you need drivers for android (not needed with Linux)
* working ADB
* rooted watch
Then just connect normally booted watch and in command line (Windows) or terminal (Linux), execute:
Code:
adb push init.asus.post_boot.sh /sdcard/
adb shell
Second command above will enter adb shell, when you are in, just copy paste and execute following:
Code:
su
mount -o rw,remount /system
mv /sdcard/init.asus.post_boot.sh /system/bin/
chown root:shell /system/bin/init.asus.post_boot.sh
chmod 755 /system/bin/init.asus.post_boot.sh
mount -o ro,remount /system
LeeonLee said:
Actually it is quite simple, what you need:
* in case you use Windows, you need drivers for android (not needed with Linux)
* working ADB
* rooted watch
Then just connect normally booted watch and in command line (Windows) or terminal (Linux), execute:
Code:
adb push init.asus.post_boot.sh /sdcard/
adb shell
Second command above will enter adb shell, when you are in, just copy paste and execute following:
Code:
su
mount -o rw,remount /system
mv /sdcard/init.asus.post_boot.sh /system/bin/
chown root:shell /system/bin/init.asus.post_boot.sh
chmod 755 /system/bin/init.asus.post_boot.sh
mount -o ro,remount /system
Click to expand...
Click to collapse
yeah worked perfectly... after 9 month the zenwatch is back on my wrist....
---------- Post added at 05:31 PM ---------- Previous post was at 05:29 PM ----------
LeeonLee said:
Actually it is quite simple, what you need:
* in case you use Windows, you need drivers for android (not needed with Linux)
* working ADB
* rooted watch
Then just connect normally booted watch and in command line (Windows) or terminal (Linux), execute:
Code:
adb push init.asus.post_boot.sh /sdcard/
adb shell
Second command above will enter adb shell, when you are in, just copy paste and execute following:
Code:
su
mount -o rw,remount /system
mv /sdcard/init.asus.post_boot.sh /system/bin/
chown root:shell /system/bin/init.asus.post_boot.sh
chmod 755 /system/bin/init.asus.post_boot.sh
mount -o ro,remount /system
Click to expand...
Click to collapse
worked perfectly.... after 9 months zenwatch is back on my wrist
Hey guys,
do i need to do it every time i booted up ?
And can i messure this Overclocking anywhere ?
Greetings
Namelocked said:
Hey guys,
do i need to do it every time i booted up ?
And can i messure this Overclocking anywhere ?
Greetings
Click to expand...
Click to collapse
Hi, this is permanent solution. To revert you need to replace the file with original one.
I am also not aware of any reliable Wear benchmark, but you can see HW info using e.g. AIDA64 for Wear.
LeeonLee said:
Hi, this is permanent solution. To revert you need to replace the file with original one.
I am also not aware of any reliable Wear benchmark, but you can see HW info using e.g. AIDA64 for Wear.
Click to expand...
Click to collapse
I dont even find the AIDA64 for my smartwatch :/ ?
how can i check core, cpu speed etc... aida64 isn't compatible .. tnx..
Dear developers,
I have an issue in my script switching from Android 9 to 10 (devices from a Umidigi s3 Pro to a Umidigi F2)
I have installed Bosybox App on the first and Busybox Magisk module on the latter
Now the script does not work because the command
list=(`busybox find "$dirs" -type f -name *.$ext`)
returns an empty array
This is the complete script:
Bash:
#!/system/bin/sh
echo
if test "$1" = ""; then
echo "Randomfile script by Uranya <[email protected]> v1.4 01.01.2021"
echo "Usage:"
echo "sh randomfile.sh <sourcedir> <extension> <destdir>"
exit 1
fi
dirs=$1
ext=$2
dird=$3'/'
dest=$dird'random'
delim1=""
delim2=""
last='last.txt'
# create filename's array
IFS=$'\n'
# here we have the ISSUE
list=(`busybox find "$dirs" -type f -name *.$ext`)
# count number of files
num=${#list[@]}
# initialize random generator
RANDOM=$$
# generate random number in range 1-NUM
let "ran=(${RANDOM} % ${num})+ 1"
echo Random from $num files is $ran
sour=${list[ran]}
sourn=${sour#$dirs}
sourn=${sourn:1:${#sourn}}
date=$(date +"%Y.%m.%d %H:%M")
day=$(date +"%d")
hour=$(date +"%H")
minute=$(date +"%M")
message='---------------------------------------\n'$date' - '$num' >>> '$ran'\n'$delim1$sourn$delim2
if ([ "$day" = "01" ] && [[ "$minute" < "29" ]]) || [ ! -f $dird$last ]; then
echo >$dird$last $message
else
sed -i '1i'$message $dird$last
fi
echo $delim1$sourn$delim2
# rename the old file
cp $dest.$ext $dest'_back.'$ext
# copy the file
cat "$sour" >$dest.$ext
echo File copied as $delim1$dest.$ext$delim2
Can you please help me why this happens, and how to fix it?
Thank you very much for your attention!
Uranya said:
[...]
Click to expand...
Click to collapse
Having done some tests I have found this:
opening a root privileged terminal and executing
---
echo `find /storage/7BC3-1805/Music/MP3/Abba -type f -name *.mp3`
---
it returns two strings containing the names of files inside that folder, but putting it in my script continues to return an empty array, so the issue is not in the access to the folder, but in the syntax, I guess
try putting that *.$ext into quotes...
Dear friends, CXZa, after a couple of hours debugging the script, finally, I have found the mistake!
The line to be used is:
list=( `find "$dirs" -type f -name "*.$ext"` )
it is a very subtle difference: the space after and before the parenthesis!
(even the word busybox is useless)
Oddly in the Busybox app (I have had on my S3 Pro) the spaces are not mandatory, whilst in the Busybox Magisk module those spaces ARE mandatory!
I'm using that script for almost 8 years to have an every day different music for my wake up.
I'm using Tasker to call it just before my alarm get off, so the same file contains every day, a different song.
I have done a change also in the array index that did not began by 0...
So, here it is the right script:
Bash:
#!/system/bin/sh
echo
if test "$1" = ""; then
echo "Randomfile script by Uranya <@uranya7x> v1.5 26.03.2021"
echo "Usage:"
echo "sh randomfile.sh <sourcedir> <extension> <destdir>"
exit 1
fi
dirs=$1
ext=$2
dird=$3'/'
dest=$dird'random'
delim1=""
delim2=""
last='last.txt'
# create filename's array
IFS=$'\n'
list=( `find "$dirs" -type f -name "*.$ext"` )
# count number of files
num=${#list[@]}
# generate random number in range 1-NUM
let "ran=(${RANDOM} % ${num})+ 1"
echo Random from $num files is $ran
sour=${list[$ran-1]}
sourn=${sour#$dirs}
sourn=${sourn:1:${#sourn}}
date=$(date +"%Y.%m.%d %H:%M")
day=$(date +"%d")
hour=$(date +"%H")
minute=$(date +"%M")
message='---------------------------------------\n'$date' - '$num' >>> '$ran'\n'$delim1$sourn$delim2
if ([ "$day" = "01" ] && [[ "$minute" < "29" ]]) || [ ! -f $dird$last ]; then
echo >$dird$last $message
else
sed -i '1i'$message $dird$last
fi
echo $delim1$sourn$delim2
# rename the old file
cp $dest.$ext $dest'_back.'$ext
# copy the file
cat "$sour" >$dest.$ext
echo File copied as $delim1$dest.$ext
I hope it will be useful to someone else that loves to be waked up by music...
Peace everywhere!