[MOD]user configurable userinit.sh V0.1.5.3 for CM. [UPDATED 9/05] - G1 Android Development

The purpose of this script to allow user to define their own set of configuration in a easier way. You can play with the parameters (user.conf)
to find out what suits you best.
Please check the third post for change log and rom compatibility list
Code:
echo "Usage:"
echo "/system/sd/userinit.sh [-s|-c config.file|-i]"
echo
echo "Default:"
echo "Sets system configuration based on the paratermers"
echo "that listed in /system/sd/user.conf"
echo
echo " -s: check configuration status and cross"
echo " verifiction with user configurations "
echo " -c config.file: use user parameters that defined"
echo " in config.file "
echo " -i: Current system settings and info "
Install using ADB:
Code:
adb push userinit.sh /system/sd
adb shell chmod 755 /system/sd/userinit.sh
adb push user.conf /system/sd
adb shell chmod 755 /system/sd/user.conf
adb shell reboot
Install using terminal emulator
download the file and unzip it to your sdcard
Code:
su
mount -o remount,rw /dev/block/mtdblock3 /system
cp /sdcard/userinit.sh /system/sd
cp /sdcard/user.conf /system/sd
chmod 755 /system/sd/user.conf
chmod 755 /system/sd/userinit.sh
reboot
testing via ADB
Code:
adb shell sh /system/sd/userinit.sh -s
testing via terminal emulator
Code:
su
sh /system/sd/userinit.sh -s
Expected output for compcache 0.5
Code:
=== CompCache status ===
CompCache version 0.5
Compcache enabled
CompCache: DiskSize 32768(system) 32768(user)
CompCache: cc_swappiness - 30(system) 30(user)
=== CompCache status output ===
DiskSize: 32768 kB
NumReads: 1
NumWrites: 11
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 1
GoodCompress: 70 %
NoCompress: 0 %
PagesStored: 10
PagesUsed: 4
OrigDataSize: 40 kB
ComprDataSize: 10 kB
MemUsedTotal: 16 kB
the (system) beside the number means the value is gather from system and user means from user.conf
example out for compcache 0.6+
Code:
=== CompCache status ===
CompCache version 0.6+
Compcache enabled
CompCache: DiskSize 32768(system) 32768(user)
CompCache: cc_swappiness - 30(system) 30(user)
=== CompCache status output ===
DiskSize: 32768 kB
NumReads: 1
NumWrites: 3
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 0
GoodCompress: 100 %
NoCompress: 0 %
PagesStored: 3
PagesUsed: 1
OrigDataSize: 12 kB
ComprDataSize: 0 kB
MemUsedTotal: 4 kB
This is the default user.conf. By default, the 32MB of compcache is enabled.
Code:
# General parameters
general{
apps2sd=0 # this is useless here, require a modified a2sd script
CONF_FILE="/system/sd/user.conf" #location of user.conf
media2sd=1 # moves the medias to sd if /system/sd/media exists
permission_fix=0 # perform permission fix at start up (this parameter sets to 0 after script is executed)
odex_auto=0 # perform auto create or del odex for applications installed or removed within 3 days
odex_apk=0 # creates odex for apk that does not have odex yet (this parameter sets to 0 after script is executed)
odex_all=0 # creates odexes for all apks (this parameter sets to 0 after script is executed)
}
#compcache related parameters
compcache{
compcache_en=1 # enable(1) or disable(0) compcache
cc_disksize=32 # Ram swap disksize - any number between 1 to 95 should work; default is 1/4 of the RAM (24)
cc_memlimit=16 # 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/mmcblk0p3 # pointing to the backingswap partition device, swap
cc_swappiness= # default 60
}
#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=/system/sd/swap.file # 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/mmcblk0p3 # swap partition device
swappiness=30 # default 60
}
#virtual memory
sys_vm{
sys_vm_en=0 # enable(1) or disable(0) virtual memory configurations
page_cluster=0 # default 3, (0 since CM3.9.6+)
laptop_mode=0 # default 0
dirty_expire_centisecs=3000 # default 3000
dirty_writeback_centisecs=500 # default 500
dirty_background_ratio=5 # default 5
dirty_ratio=10 # default 10
}
#cpu clock
proc_cpu{
proc_cpu_en=0 # enable(1) or disable(0) user cpu configurations
# freqency options
# 19200
# 122880
# 128000
# 245760
# 384000
# 528000
scaling_min_freq=245760 # default 245760
scaling_max_freq=528000 # default 528000
sampling_rate=2000000 # default 2000000 depending on kernel version
powersave_bias=200 # default 0, (200 since CM3.9.6+ )
up_threshold=40 # default 40, percent cpu usage before going up a speed step
}
# custom shell commands, these commands run last
custom_shells{
#echo "Hello!!!" # example
#echo "You can create your own cmmands here" # example
}
To enable linux swap
Code:
linux_swap_en=1
To enable virtual memory configurations
Code:
sys_vm_en=1
To enable CPU related configurations
Code:
proc_cpu_en=1
some sample configurations
To use only linux-swap
-set compcache=0
-set cc_backingswap_en=0
-set linux_swap_en=1
To use only compcache without backing_swap
-set compcache=1
-set cc_backingswap_en=0
-set linux_swap_en=0
-set cc_disksize=32 (32*1024 = 32768kb = 32MB)
-set cc_memlimit=0
To use compcache with backing_swap
-set compcache=1
-set cc_backingswap_en=1
-set linux_swap_en=0
-set cc_disksize=0
-set cc_memlimit=8
To use compcache with linux swap
-set compcache=1
-set cc_backingswap_en=0
-set cc_disksize=32
-set cc_memlimit=0
-set linux_swap_en=1
originally posted by uwonsum
To use compcache + backingswap with swap file
-set swap_file_en=1
-set linux_swap_file_size=32
-set linux_swap_file=/system/sd/swap.file
-set cc_memlimit=8
-set cc_backingswap=/system/sd/swap.file
To use compcache with linux swap file * Does not work
-set swap_file_en=1
-set linux_swap_file_size=32
-set linux_swap_file=/system/sd/swap.file
-set compcache=1
-set cc_backingswap_en=0
-set cc_disksize=32
-set linux_swap_en=1
-set linux_swap_partition=/system/sd/swap.file
Click to expand...
Click to collapse
Equivalent user.conf settings to CM 3.9.10+ compcache default settings
Code:
compcache_en=1
cc_disksize=24
cc_backingswap_en=0
Please do not use notepad to edit the user.conf or userinit.sh because you could end up some funny error due to format differences between unix and windows. A good example of unix format compatible editor for windows is notepad++
If you had any problem with the script please post the error log. This way its much easier to identify the problem
If there any other parameters/configurations that you wish to add, msg me! I will try to add them when i got time.

Which version of CM will this work for? The stable ones of the experimental also

If you upgrade from V0.1.1 to V0.1.3+ make sure you reboot your phone after install.
ROM compatibility list report by users
CM 3.6.8.1 tested by Me
CM 3.9.2 tested by MrBlueEyez
CM 3.9.3 tested by Me *requires couple lines of hacking to a2sd , Detailed instruction please see http://forum.xda-developers.com/showpost.php?p=4246619&postcount=36
CM 3.9.4 tested by sacredsoul, ShatBag1105
CM 3.9.5 tested by ShatBag1105, me
CM 3.9.6 tested by sacredsoul, uwonsum
CM 3.9.7 tested by uwonsum
Known issues
To work with CM3.9.3, couple lines of hacking to a2sd is required, Detailed instruction please see http://forum.xda-developers.com/showpost.php?p=4246619&postcount=36
~ CC backingswap with swapfile does not work
Application upgrade or reinstall may causing force close as the odex file is incompatible. Please rerun the script to create the new odex.
Change log
version 0.1.5.3
* fix missing cc_swappinessmissing in user.conf
version 0.1.5.2
* fix && error at line 649
version 0.1.5.1
* auto rebuilds the odex if the application is reinstalled or upgraded
* removes odexes if application is uninstalled
version 0.1.5
* fix permission for applications
* rebuild/create odexes
* custom user shell command support in user.conf
version 0.1.4.1
* Fix linux swappiness overwrites cc_swappiness value
* Fix duplication of mkswap for swap file
* Fix status output function turns off swap file/partition
version 0.1.4
* add userinit.sh symbolic link to system/bin/userinit
* support swap file for linux swap
version 0.1.3.7
* enables user configuration output with minor output tweaks
* fix typo in user.conf
version 0.1.3.6
* fix blank proc_cpu status output
* disable user configuration output
version 0.1.3.5
* disable sys_vm and proc_cpu by default
* some minor output tweaks
version 0.1.3.3
* Add up_threshold suggested by smeat @ #202
* Turn off Compcache/linux swap when compcache_en/linux_swap_en is set to 0
* Linux swap swappiness error message fix
Changes in v0.1.3.2
* auto detection for compcache version which means cc_version is no longer required. Detection method provided by uwonsum
Changes in v0.1.3.1
* Display cc_version for status check
Changes in v0.1.3
* support compcache version 0.6, make sure you set cc_version=0.6 in your user.conf file
* fix unable to remove kernel module errors
* fix compcache status check error
I haven't personally test the script with CM 3.9.6 yet.
Changes in v0.1.1
* fix file not found issue when the script is not executed from "/" directory
* -i only display the system information instead setting the parameters before display it
Changes in v0.1
* introduce cc_swappiness (replacement of compcache swappiness in user.conf) to fix swappiness overwrite issues.
* Fix backing swap issues
* Fix "cat /proc/ramzswap0" report not found issues
* Fix compcache detection error
thanks to uwonsum for pointing out these issues

I used the file from the thread for 3.6.7. whould u say urs is better. Even with my g1 overclocked and with compcache and it still lags little bit. Seedy for the find question u clearly state that its for 3.6.8.1. Was his wondering if it works with the experimental becuase not haveing compcache is a deal breaker.
Edit: are you sure about the experimental version because he said he is using a new kernal. S

Tried the script and my Android on CM 3.9.2 works smoothly. Checked with free on Terminal, seems to swap nicelly. What i don't get is the configuration... I downloaded the userinit.sh and user.conf, pushed to /system/sd and did the chmod stuff...
Do i have to change my user.conf to change the configuration? And what configuration works best for 3.9.2?
Nice work though! Finally after 5 months i had the guts to root and update SPL, recovery and mod my phone. Want to get the best out of it!

Ok, with the file in this post you have a compcache actived in swap partition without swap in CM ROM, thats correct?
And fixt the clock of CPU in MAX=528 and MIN=245, if i want to manage CPU status with set CPU what lines must to delete?
I only want to activate compcache in my 32mb swap partition, no swap, no CPU overcloack...
Thanks for your help and sorry for my english

For some reason this is the only one that word on the experimental builds...the others didn't work well even tho it said good compress 74 percent all the time..i would go to "tunewiki" cause that thing is the biggest memory hog, play some music see if it would load fast and then press back to go to the playlist...w/ compcache and swap off it would just go to a black screen and ask to wait or force close...but when the userinit stuff worked it would play stuff fast and go to the playlist without a hitch and no wait time...aka no killing the task in the background because of low memory....hurray..my compcache is working again..it might have had something to do w/ a .conf file...the others didn't have that file....hmmm, anyways thanks huanyu for this and whoever started playing w/ compcache in the first place!!! ha...

huanyu said:
The purpose of this script to allow user to define their own set of configuration in a easier way. You can play with the parameters (user.conf)
to find out what suits you best.
I have only test it with stable version of CM 3.6.8.1.
the by default, the 32MB of compcache is enabled. It should just work after you push the files to /system/sd
If there any other parameters that you wish to add, msg me! I will try to add them when i got time.
Click to expand...
Click to collapse
Very very nice, you basically re-wrote the whole thing from your original. Great work and thanks!
edit: The minimum usable cpu frequency is 128000, anything lower will cause the phone to freeze once power plug is removed.
here the available options:
19200
122880
128000
245760
384000
528000

I don't get it...what's the point of a config file for a config file?

jus to clairify to test it the command should be
adb shell /system/sd/userinit.sh -s
Click to expand...
Click to collapse
instead of
adb shell chmod 755 /system/sd/userinit.sh -s
Click to expand...
Click to collapse

ah wat the duece, double post

alapapa said:
I don't get it...what's the point of a config file for a config file?
Click to expand...
Click to collapse
There is a good reason to have a user config file for an init script.
One simple example; the previous less functional script had options to enable compcache and linux-swap. If you wanted just linux-swap, you would have to go into the init script and edit out the lines you don't want and then add lines you do want--this makes things a little confusing for some users. With user config file, you simply set one to 0 and the other to 1. You could call this encapsulation.

Soo what are the commands to do these while on the phone
i can get the files into the phone but im not at home so i cant use my ADB

Tested with CM 3.9.2 and this works wonderfully.

fallinprince said:
Soo what are the commands to do these while on the phone
i can get the files into the phone but im not at home so i cant use my ADB
Click to expand...
Click to collapse
Check this out. May be huanyu will consider adding these steps...

I had compcache working with 3.9 and upgraded to 3.9.1 then 3.9.2 and it stopped working somewhere in that time frame. I searched and tried two other userinit.sh files from other threads, including one that was supposed to work regardless of the kernel and couldn't get it to work again.
Threw these files on my sdcard, remounted system/sd, copied them over. Changed permissions, ran it manually and it worked fine. Rebooted to test and it worked perfect.
I spent about 2 hours yesterday searching through posts and trying to get this working again. Found this one today and not a single issue, thanks

fridlack said:
Ok, with the file in this post you have a compcache actived in swap partition without swap in CM ROM, thats correct?
And fixt the clock of CPU in MAX=528 and MIN=245, if i want to manage CPU status with set CPU what lines must to delete?
I only want to activate compcache in my 32mb swap partition, no swap, no CPU overcloack...
Thanks for your help and sorry for my english
Click to expand...
Click to collapse
if you don't wanna to enable CPU overclock or change the virtual memory configuration, you can basically set the follows
sys_vm_en=0
proc_cpu_en=0
Click to expand...
Click to collapse

Can I have your opinions on which is the best option in the performance point of view. I have a swap partition. Should I enable backing swap or the swap partition? Thanks!

If you could maintain a version numbered system for your compcache scripts that would rock, so every time you modify it and we try different setups we could know which "version" we like and use that one....I would love this...I never know what i'm getting w/ all these compcache/swap scripts..but this is the best working one by far..and which roms it works w/...like tested w/ 2.4.1 kinda stuff...IDK just some random thoughts....and would love to see a maintained compcache thread!!!

Ok I tried but hanged at the G1 screen for 3.9.3. Apparently, the exit command have to be removed from the userinit.sh. I removed the last "exit;" in the file but still got stuck. Any idea guys?

Related

[MOD]Auto Compcache & backup Swap for CM.

Many people having issues getting compcache/swap working, so here we go.
Replace the content of your userinit.sh with this code. This code was created by uwonsom and modified by yours truely and lastely by Alapapa. to see the original work click Here.
I've also attached the file ready for you to throw directly into /system/sd.
{from original post}
The current setting enables compcache with backing_swap (a physical partition). It can also be tested with linux-swap only--just comment out lines beginning with insmod, mknod, and swapon /dev/ramzswap0. Then uncomment swapon /dev/block/mmcblk0p3.
If you wish to test it out only with compcache, comment out the insmod line with backing_swap and uncomment the insmod line with disksize_kb.
{/from original post}
Code:
#!/system/bin/sh
##adb push userinit.sh /system/sd/
uname_r=`uname -r`
moddir=`find /system/modules -type d -name $uname_r`
insmod=/system/bin/insmod
$insmod $moddir/compcache/xvmalloc.ko;
#$insmod $moddir/compcache/ramzswap.ko disksize_kb=32768;
$insmod $moddir/compcache/ramzswap.ko backing_swap=/dev/block/mmcblk0p3;
mknod /dev/ramzswap0 b 253 0;
echo 20 > /proc/sys/vm/swappiness;
# Experimental settings
echo 1 > /proc/sys/vm/page-cluster; # default: 3 Changes Page clustering from 8 to 2.
echo 5 > /proc/sys/vm/laptop_mode; # default: 0 Helps keep SSD from getting worn.
echo 5000 > /proc/sys/vm/dirty_expire_centisecs; # default: 3000
echo 800 > /proc/sys/vm/dirty_writeback_centisecs; # default: 500
echo 10 > /proc/sys/vm/dirty_background_ratio; # default: 5
echo 16 > /proc/sys/vm/dirty_ratio; # default: 10
#
swapon /dev/ramzswap0;
#swapon /dev/block/mmcblk0p3;
#Over Clock CPU when in use, puts at lower freq when idol. # if you don't want it.
echo 128000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 528000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
Edit: Thank Alapapa for the new code, will now work with all versions of CM 3.6.7 and higher!
Thanks! But it's not going to work if Cyanogen changes the kernal again.
2.6.29.6 is current... but probably not for long.
does the attached userinit come with those changes already or do u have to modd theose changes over to it
here's the code that will work if kernel version changes:
Code:
#!/system/bin/sh
##adb push userinit.sh /system/sd/
uname_r=`uname -r`
moddir=`find /system/modules -type d -name $uname_r`
insmod=/system/bin/insmod
$insmod $moddir/compcache/xvmalloc.ko;
#$insmod $moddir/compcache/ramzswap.ko disksize_kb=32768;
$insmod $moddir/compcache/ramzswap.ko backing_swap=/dev/block/mmcblk0p3;
mknod /dev/ramzswap0 b 253 0;
echo 20 > /proc/sys/vm/swappiness;
# Experimental settings
echo 1 > /proc/sys/vm/page-cluster; # default: 3 Changes Page clustering from 8 to 2.
echo 5 > /proc/sys/vm/laptop_mode; # default: 0 Helps keep SSD from getting worn.
echo 5000 > /proc/sys/vm/dirty_expire_centisecs; # default: 3000
echo 800 > /proc/sys/vm/dirty_writeback_centisecs; # default: 500
echo 10 > /proc/sys/vm/dirty_background_ratio; # default: 5
echo 16 > /proc/sys/vm/dirty_ratio; # default: 10
#
swapon /dev/ramzswap0;
#swapon /dev/block/mmcblk0p3;
#Over Clock CPU when in use, puts at lower freq when idol. # if you don't want it.
echo 128000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 528000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
thanks Alapapa, changed the script uptop and the one attached to your modifed script.
Denkai said:
thanks Alapapa, changed the script uptop and the one attached to your modifed script.
Click to expand...
Click to collapse
De nada...I got the kernel version magic from some thread on here at some point.
Cheers!
Denkai said:
# Experimental settings
echo 1 > /proc/sys/vm/page-cluster; # default: 3 Changes Page clustering from 8 to 2.
echo 5 > /proc/sys/vm/laptop_mode; # default: 0 Helps keep SSD from getting worn.
echo 5000 > /proc/sys/vm/dirty_expire_centisecs; # default: 3000
echo 800 > /proc/sys/vm/dirty_writeback_centisecs; # default: 500
echo 10 > /proc/sys/vm/dirty_background_ratio; # default: 5
echo 16 > /proc/sys/vm/dirty_ratio; # default: 10
#
swapon /dev/ramzswap0;
#swapon /dev/block/mmcblk0p3;
#Over Clock CPU when in use, puts at lower freq when idol. # if you don't want it.
echo 128000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq;
echo 528000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
Click to expand...
Click to collapse
Any reason for setting page cluster to 1 instead of 0, as I think i saw earlier in the thread being recommended? Have you had better performance w/ setting it to 1? Thanks
I personally haven't screwed around with the paging. you may get better, you may not.
You could do away with this line since the CPU already scales to 528MHz:
Code:
echo 528000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
Click to expand...
Click to collapse
Add the following.:
Code:
echo 200 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias; # default: 0
#echo 2000000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate; # For build <=3.9.1
"The powersave_bias parameter modifies the behavior of the ondemand governor to save more power by reducing the target frequency by a specified percentage. By default, (powersave_bias = 0), the ondemand governor selects the minimum processor frequency that can still complete a workload with minimal idle time. Doing so should result in the highest performance to power efficiency ratio. In some cases, you might prefer a greater emphasis on power efficiency than performance. In this case, set the powersave_bias parameter to a value between 1 and 1000 to reduce the target frequency by one-thousandth of that value. For example, set powersave_bias to 100 for a one-tenth reduction in target frequency. In this case, if the governor chooses a target frequency of 2 GHz (with powersave_bias = 100), the governor instead will request 1.8GHz – a one-tenth reduction. If 1.8 GHz is an exact match with an available hardware frequency (listed in the scaling_available_freq parameter), the processor is set to this frequency. If 1.8 GHz is not available, the processor fluctuates between the closest available upper and lower frequencies for an average frequency of 1.8 GHz."
If you notice lag, I would set it to 150; 100 was not much of a benefit. 250 will give you longer battery life for sure, but anything over that could result in major lag.
I pushed the file to /system/sd
I run cmd #free and there's 0 under swap
I run cmd #cat /proc/ramzswap and get an error
When I look in /system/sd the userinit.sh file is in lost+found... Did I do something wrong?
bhilgeman said:
I pushed the file to /system/sd
I run cmd #free and there's 0 under swap
I run cmd #cat /proc/ramzswap and get an error
When I look in /system/sd the userinit.sh file is in lost+found... Did I do something wrong?
Click to expand...
Click to collapse
Yeah same here (except my userinit.sh is not being moved to lost+found).
I ensured the permissions were fine... what am I doing wrong?
runderekrun said:
Yeah same here (except my userinit.sh is not being moved to lost+found).
I ensured the permissions were fine... what am I doing wrong?
Click to expand...
Click to collapse
Did you execute it or reboot? Just putting it there does nothing by itself.
In a shell, just do /system/sd/userinit.sh
What happens?
ttabbal said:
Did you execute it or reboot? Just putting it there does nothing by itself.
In a shell, just do /system/sd/userinit.sh
What happens?
Click to expand...
Click to collapse
you should not have to execute it.
ttabbal said:
Did you execute it or reboot? Just putting it there does nothing by itself.
In a shell, just do /system/sd/userinit.sh
What happens?
Click to expand...
Click to collapse
uwonsum said:
you should not have to execute it.
Click to expand...
Click to collapse
Yeah I thought Cyanogen's roms would auto-run userinit.sh?
Anyway trying to manually run it just throws up errors.
Is this correct for a linux swap partition?
I was unsure about lines
$insmod $moddir/compcache/xvmalloc.ko;
$insmod $moddir/compcache/ramzswap.ko
Does the $ mean i do not comment them out?
Code:
#!/system/bin/sh
## adb push userinit.sh /system/sd
#insmod /system/modules/lib/modules/2.6.29-cm/compcache/xvmalloc.ko;
#insmod /system/modules/lib/modules/2.6.29-cm/compcache/ramzswap.ko disksize_kb=32768;
#insmod /system/modules/lib/modules/2.6.29-cm/compcache/ramzswap.ko memlimit_kb=32768
#backing_swap=/dev/block/mmcblk0p3;
#insmod /system/modules/lib/modules/2.6.29-cm/compcache/ramzswap.ko
#backing_swap=/dev/block/mmcblk0p3;
#mknod /dev/ramzswap0 b 253 0;
echo 16 > /proc/sys/vm/swappiness; # default: 60
## Experimental settings
echo 1 > /proc/sys/vm/page-cluster; # default: 3
echo 5 > /proc/sys/vm/laptop_mode; # default: 0
echo 5000 > /proc/sys/vm/dirty_expire_centisecs; # default: 3000
echo 800 > /proc/sys/vm/dirty_writeback_centisecs; # default: 500
echo 10 > /proc/sys/vm/dirty_background_ratio; # default: 5
echo 16 > /proc/sys/vm/dirty_ratio; # default: 10
##
#swapon /dev/ramzswap0;
swapon /dev/block/mmcblk0p3;
## Additional experimental settings
echo 128000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq; # default: 245760
##
exit;
## commands to display useful system info
## **Do not uncomment**
# free
# top -m 8; displays only 8 processes
# cat /proc/swaps
# cat /proc/ramzswap0
# cat /proc/meminfo
# sysctl -a | grep vm
# cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
# vmstat -d 5 -n 10
Also i am stuck at work, so not ADB for me (don't want to install drivers on work pc)
Can i do this with userinit.sh on root of card
Code:
Code:
# su
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
# cp /sdcard/userinit.sh /system/sd/userinit.sh
# chmod 755 /system/sd/userinit.sh
ekeefe41 said:
Is this correct for a linux swap partition?
Click to expand...
Click to collapse
Yes, and you should also comment out this backing_swap=/dev/block/mmcblk0p3;
uwonsum said:
Yes, and you should also comment out this backing_swap=/dev/block/mmcblk0p3;
Click to expand...
Click to collapse
ok, how about now ^^ i edited it
runderekrun said:
Yeah I thought Cyanogen's roms would auto-run userinit.sh?
Anyway trying to manually run it just throws up errors.
Click to expand...
Click to collapse
You have to execute it somehow. Cyanogen's roms do it on boot, that's why I said "execute OR reboot".
If you can't run it manually, it's probably not working on boot either. What errors is it throwing up?
ekeefe41 said:
ok, how about now ^^ i edited it
Click to expand...
Click to collapse
It's fine the way it is. But if you look at this thread, some of my experimental settings have been implemented into a new userinit.sh script with a user.conf file that makes things so easy where you wont ever have to touch the userinit.sh script.
Now, I have edited this new script. I corrected a line that could potentially pose a problem for people using a different kernel. I also added a few more options to the script that can be set in the user.conf file. I will post it on that thread in a few minutes.
ttabbal said:
You have to execute it somehow. Cyanogen's roms do it on boot, that's why I said "execute OR reboot".
If you can't run it manually, it's probably not working on boot either. What errors is it throwing up?
Click to expand...
Click to collapse
Sorry I missed the reboot comment.
I just don't understand it. It will not run the userinit.sh. It is saying it can't find it. If I try to run it with the wrong permissions it gives me a "Permission denied" but as soon as I chmod it too 755 it suddenly can't find the file...
I accidentally pasted the whole userinit.sh text the shell and it started working, so I have no idea whats wrong with this file. None what so ever.

[KERNEL MOD] keytimer user setting script for mkasick Epic 4G keyboard patch

After having shared this on the #epic channel, I decided to share it here... This is for kernel devs who've incorporated mkasick's sysfs keyboard patch, located here.
This kernel mod and accompanying script are meant to be used in conjunction with mkasick's epic keyboard patch, and will perform the following:
1) Allow the kernel developer to easily choose the initial timer_delay value for the patch
2) Allow the end user to adjust the setting, and have it persist past boot
3) Checks user input for the setting, and not allow settings to occur that will make the keyboard unresponsive, or unusable
Files:
keytimer_initscript.sh
keytimer
Instructions for kernel devs:
1) Take the script inside keytimer_initscript.sh, and add it to your custom initscript called from init.rc
Note: place after the init.d section, or theimpaler747 script will overwrite the keytimer script.
2) Place the keytimer script inside your initramfs /sbin
Instructions for users:
1) Have a kernel with this mod inside, like mine:
DRockstar.Clean.Kernel.EC05.v1.02.zip
Note: Other kernel devs have this now, so it should come to your favorite kernel soon!
Also: If your current kernel has the mkasick sysfs keyboard patch, but not my kernel mod, you can take the keytimer script, and place it /system/xbin, and chmod 755 /system/xbin/keytimer. Without my kernel mod, the setting won't persist through a reboot, but it will give you an easy way to change the setting.
2) Open Connectbot or Android Terminal, and type su
3) type command: keytimer
it will show usage and the current value, the default is 7.
example use to change to theimpaler747 value of 5:
keytimer 5
Accepted values are 1 through 16.
The change will be immediate, and will persist after reboot.
Hope you all like this one, enjoy it!
CODE:
keytimer_initscript.sh :
Code:
#!/system/bin/sh
# keytimer script to be called by init.rc, written by DRockstar for the Epic 4G
# assumes busybox is already installed
# kernel developers may just copy script to existing custom init script
# can be adjusted by accompanied keytimer script in /sbin
# keyboard patch sysfs call 7 for snappy keyboard performance
if [ ! -f "/data/local/timer_delay" ]; then
echo 7 > /data/local/timer_delay
fi
cat /data/local/timer_delay > /sys/devices/platform/s3c-keypad/timer_delay
keytimer :
Code:
#!/system/bin/sh
# keytimer shortcut script by DRockstar
usage()
{
echo "keytimer: shortcut for Epic 4G keyboard response time"
echo "usage: keytimer , 7 is default, 1 - 16 accepted"
}
error()
{
usage
echo "error: $1"
exit
}
mount -t rootfs -o remount,rw / /
if [ "$1" = "" ]; then
timer="`cat /sys/devices/platform/s3c-keypad/timer_delay`"
usage
echo "current keytimer value is $timer"
exit
fi
case $1 in *[!0-9]*)
error "input is not a positive number"
esac
if [ $1 -gt 16 ]; then
error "only numbers 1 - 16 are accepted"
fi
echo $1 > /sys/devices/platform/s3c-keypad/timer_delay
echo $1 > /data/local/timer_delay
mount -t rootfs -o remount,ro / /
yeeeah
Good job DRockstar ....This is saweet
good **** DRockstar....i already have it commited to my source for the next version
keep up the good work!
OK, links fixed, with code also posted.
Posted instructions for those who just want to use keytimer script, in case your favorite kernel doesn't have the keytimer mod installed yet, but has the keyboard patch installed.
Thanks to Rodderik for server space, after fossnet server got toasted.
Peace!
I'm pleased that folks are making good use of the sysfs patch, and making the user-side keytimer configuration much more approachable and useful. Thanks for doing this, it means a lot.
DRockstar said:
After having shared this on the #epic channel, I decided to share it here... This is for kernel devs who've incorporated mkasick's sysfs keyboard patch, located here.
This kernel mod and accompanying script are meant to be used in conjunction with mkasick's epic keyboard patch, and will perform the following:
1) Allow the kernel developer to easily choose the initial timer_delay value for the patch
2) Allow the end user to adjust the setting, and have it persist past boot
3) Checks user input for the setting, and not allow settings to occur that will make the keyboard unresponsive, or unusable
Files:
keytimer_initscript.sh
keytimer
Instructions for kernel devs:
1) Take the script inside keytimer_initscript.sh, and add it to your custom initscript called from init.rc
Note: place after the init.d section, or theimpaler747 script will overwrite the keytimer script.
2) Place the keytimer script inside your initramfs /sbin
Instructions for users:
1) Have a kernel with this mod inside, like mine:
DRockstar.Clean.Kernel.EC05.v1.01.zip
Note: Other kernel devs have this now, so it should come to your favorite kernel soon!
Also: If your current kernel has the mkasick sysfs keyboard patch, but not my kernel mod, you can take the keytimer script, and place it /system/xbin, and chmod 755 /system/xbin/keytimer. Without my kernel mod, the setting won't persist through a reboot, but it will give you an easy way to change the setting.
2) Open Connectbot or Android Terminal, and type su <enter>
3) type command: keytimer
it will show usage and the current value, the default is 7.
example use to change to theimpaler747 value of 5:
keytimer 5
Accepted values are 1 through 16.
The change will be immediate, and will persist after reboot.
Hope you all like this one, enjoy it!
CODE:
keytimer_initscript.sh :
Code:
#!/system/bin/sh
# keytimer script to be called by init.rc, written by DRockstar for the Epic 4G
# assumes busybox is already installed
# kernel developers may just copy script to existing custom init script
# can be adjusted by accompanied keytimer script in /sbin
# keyboard patch sysfs call 7 for snappy keyboard performance
if [ ! -f "/data/local/timer_delay" ]; then
echo 7 > /data/local/timer_delay
fi
cat /data/local/timer_delay > /sys/devices/platform/s3c-keypad/timer_delay
keytimer :
Code:
#!/system/bin/sh
# keytimer shortcut script by DRockstar
usage()
{
echo "keytimer: shortcut for Epic 4G keyboard response time"
echo "usage: keytimer <number>, 7 is default, 1 - 16 accepted"
}
error()
{
usage
echo "error: $1"
exit
}
mount -t rootfs -o remount,rw / /
if [ "$1" = "" ]; then
timer="`cat /sys/devices/platform/s3c-keypad/timer_delay`"
usage
echo "current keytimer value is $timer"
exit
fi
case $1 in *[!0-9]*)
error "input is not a positive number"
esac
if [ $1 -gt 16 ]; then
error "only numbers 1 - 16 are accepted"
fi
echo $1 > /sys/devices/platform/s3c-keypad/timer_delay
echo $1 > /data/local/timer_delay
mount -t rootfs -o remount,ro / /
Click to expand...
Click to collapse
Sorry for asking this noob question but I just want to clarify. This is the stock Kernel with mkasicks fix to allow for the keyboard tweaks correct?
Nothing else is different about the kernel? If so, this is exactly what I was looking for.
Updated the kernel download to v1.02... which fixed some apps like metamorph not working with the location I set for busybox.
I need to make a post for the kernel now... sources are now posted at github.com/DRockstar.
to answer the previous question, yes, this kernel is intended to be a simple rooted kernel, based off samsung stock, with only simple mods ... its feature are:
* Root and busybox with minimal system mods
* designed to allow OTA update after flashing back the stock kernel
* mkasick sysfs keyboard patch, with my keytimer script
* voodoo sound 7 by supercurio, controlled by voodoo control app in android market
* additonal custom scripts in /sbin for cleaning root, busybox, and flash kernels and recoveries
This kernel was built to replace the traditional one click root method for my all in one root and recovery script.
Sent from my SPH-D700 using Tapatalk

[Tut] Fast Change Kernel Paramteres

This is a very simple guide for build a script that manipulates the kernel parameters. Using SManager we will add it on us home or dock.
No specific skills are required, only patient.
What You Need:
- Root Permissions
- a customizable kernel
- SManager & SMWidgets
- Busybox
------------------------------------------------
1) First make your personal script for manipulating the kernel parameters.
Make a new file without extension on your computer and open it with a text editor
a) write this two line (IMPORTANT !!!)
#!/system/bin/sh
busybox mount -o remount,rw /system
the first line is the standard initialization of a sh script in Linux-Unix system. The second line allows the writing of the file system.
b) Now add the code. All the kernel parameters are text file located in the /sys/ folder. Is possible to edit such parameters writing
echo NEWVALUE > / PATH / OF / THE / DESTINATION / PARAMETER
for example, for changing the minimum frequency
# CPU Min Freq
echo 700000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
In sh scripts the line with # symbol won't be execute, so you can write whatever you wants.
c) The most important parameters are located in:
# CPU Min Freq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
# CPU Max Freq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# CPU Governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# IO Scheduler (ALL THIS PARAMETERS MUST BE CHANGED FOR THE SCHEDULER)
/sys/block/mmcblk0/queue/scheduler
/sys/block/mmcblk0boot0/queue/scheduler
/sys/block/mmcblk0boot1/queue/scheduler
/sys/block/mtdblock0/queue/scheduler
I attached a simple script in this form here. You can found other parameters here, or A complete documentation of a kernel linux here. Other scripts and information about the Android kernel can be found here, here. A complete documentation of a kernel linux is here
BE CAREFUL WITH EDITING KERNEL PARAMETERS. ALWAYS READ THE DOCUMENTATION OF YOUR KERNEL AND CHECK THE PARAMETERS
d) Add this line at the end of the file for remount the system folder as read-able only
busybox mount -o remount,ro /system
now your script is done.
You can check and control the parameters by typing on the terminal or via ADB
cat / PATH / OF / THE / PARAMETER / YOU / ARE / CHECKING
------------------------------------------------
2) push the file on your phone. Set executable permission of file with an explorer or with chmod comand. Now open SManager, navigate to the path of the script and add it on its database. You can check it and test if everything works fine.
------------------------------------------------
3) the last step consists to add the shortcut of the script your home. With the most advanced launcher you can change the icon and the name and personalize it.
------------------------------------------------
4) optional: after the execution of the script with SWmanager the terminal will be open. To automatically return on the home you must add at the end of the script a line with the activity of your launcher related to the home button (this is a method I found, if someone has a better idea please tell me )
For Nova Launcher the code is:
am start -a android.intent.action.MAIN -n com.teslacoilsw.launcher/com.android.launcher2.Launcher
The method is used to found this activity was:
a) Open an app, and then return the to the home by pusching the central button
b) With the terminal emulator, or via adb, launch the logcat command
c) look for the last activity related to your launcher
d) replace the part after the -n with the string you have found
------------------------------------------------
All is done, if you have questions or some advice please contact me.
...The english will improve during my android experience :angel:

RAM Dumping to SD in Sony Miro...!!!

Hi
Getting RAM Dumping to SD in my sony miro. It takes 5 mins then ti automatically gets rebooted & this is happening frequently. Please be advise, what to do
Thanks in advance
Abhishek
for GOD sake...XDA team please reply solution...
You must have busybox installed. To disable core dumps for all users, open /etc/security/limits.conf, enter:
Code:
# vi /etc/security/limits.conf
Make sure the following config directive exists:
Code:
* hard core 0
Save and close the file. Once a hard limit is set in /etc/security/limits.conf, the user cannot increase that limit within his own session. Add fs.suid_dumpable = 0 to /etc/sysctl.conf file:
Code:
# echo 'fs.suid_dumpable = 0' >> /etc/sysctl.conf
# sysctl -p
This will make sure that core dumps can never be made by setuid programs. Finally, add the following to /etc/profile to set a soft limit to stop the creation of core dump files for all users (which is default and must be disabled):
Code:
# echo 'ulimit -S -c 0 > /dev/null 2>&1' >> /etc/profile

LEAGOO Shark 1 - Development & Support

In order to keep this thread clean, please use this one to discuss about Development, Support or Software Updates.​
ROMs:
Custom ROMs (based on Android 5.1)
AOSP-like 5.1 ROM - by GearLabs: https://mega.nz/#!lBtSBaDC!Jh1PXA_jEn8ynrISB8GeupVn-lJbHTlHtozhggb3UOg
Features:
- Clean Nexus-Like UI (get rid of the LEAGOO OS)
- Updated Google Apps (and most of them replace crappy Mediatek ones)
- Optimized for Maximum Performance
- with Root, Busybox & init.d support
What you'll lose compared to LEAGOO OS? (missing features)
- Miravision Menu
If you notice something else that is missing, just let me know.
Flashable Touchscreen Delay Fix: http://forum.xda-developers.com/attachment.php?attachmentid=3823450&d=1469457127​
Stock (Android 6.0)
160729: https://yadi.sk/d/tPz_sgnRtyqdA (Thanks @seraser for the report)
Stock (Android 5.1)
160712: https://mega.nz/#!UBFTzILY!Ympxl5aTRg1x5cAeEha12XgLHxXZ_kYPKDuYvlZUpIo
Previous Releases:
160620: https://yadi.sk/d/fp5sDnfJsvHve | Mirror
160530 (official): http://leagooftp.com.my/Shark 1/t87...10_LEAGOO_Shark_1_OS1.2_160530_release.tar.gz | Mirror
Flash Tools:
SP Flash Tool v5.1628 for Windows & Linux: https://mega.nz/#F!dYUm0TbB!SWeMLb5Wu1NbRzTPQ8-s_A
Flash Tool with Drivers provided by LEAGOO (Windows Only): http://leagooftp.com.my/Flashtool Elite Series, Shark 1/Flashtool Elite series, Shark 1.rar | Mirror
Choose the one that works better for you.
Recovery:
TWRP 3.0.2-1 - by GearLabs: https://mega.nz/#!9UsUXDJZ!b3-LhR8FfXpo9mPoN-vXxreVkMtJU0c1Y0_AGsPilvg
Previous Releases:
TWRP 3.0.0 - by @megthebest (buggy and outdated): https://mega.nz/#!0A8AlK7Y!yVXgeQksrVTe83IGQZdEY2FPC1dHmyvtcdpRmDtOPgE
Root:
SuperSU (flashable using TWRP): http://forum.xda-developers.com/apps/supersu
Extras (Root-Only):
Xposed Framework: http://forum.xda-developers.com/showthread.php?t=3034811
Useful Third-Party Apps:
Battery Life
Amplify: https://play.google.com/store/apps/details?id=com.ryansteckler.nlpunbounce&hl=en
Greenify: https://play.google.com/store/apps/details?id=com.oasisfeng.greenify&hl=en
Alberto96 said:
....... As soon as I have more time, I'll work on a CM ROM for this device.
Click to expand...
Click to collapse
Allready working on CM ROM?
I allways thought, CM is not possible for Mediatek Devices, because of Mediatek not opening Sources for its SoCs?
And also Leagoo doesnt seem to be very helpfull with CustomROMs.....
Robot12 said:
Allready working on CM ROM?
I allways thought, CM is not possible for Mediatek Devices, because of Mediatek not opening Sources for its SoCs?
And also Leagoo doesnt seem to be very helpfull with CustomROMs.....
Click to expand...
Click to collapse
Not yet, without kernel sources it will be hard.
Alberto96 said:
Not yet, without kernel sources it will be hard.
Click to expand...
Click to collapse
If I'm not wrong, you can use @bluefame CM12.1 sources for Elephone P8000, same SoC. Just need to change to our device parameters.
Btw, I dunno if the fact that Shark has 32bit Rom affects anything.
Sent from my s3 using Tapatalk
TWRP 3.0 for 160620 firmware
Hello guys,
I have flashed the full 160620 firmware as the OTA didn't work in my phone, even after exchanging TWRP with the stock recovery.
The Leagoo OTAs doesn't come as zip files so they can't be installed from TWRP either.
Now on 160620 fw I can't install TWRP 3.0.0 by @megthebest. It looks ok in SP_Flash_Tool but when I try to boot from TWRP I just get the dead Android robot on the screen and a message saying something like "No data available" or something like that.
Can it be that the partition map has changed and that the scatter file needs to be edited, or do I have something wrong in my phone?
Has anyone tried to do what I did? Flashed a full 160620 fw and tried to install TWRP 3.0.0 by @megthebest? If so, did you succeed?
---------- Post added at 08:42 AM ---------- Previous post was at 08:17 AM ----------
genesisalgor said:
If I'm not wrong, you can use @bluefame CM12.1 sources for Elephone P8000, same SoC. Just need to change to our device parameters.
Btw, I dunno if the fact that Shark has 32bit Rom affects anything.
Sent from my s3 using Tapatalk
Click to expand...
Click to collapse
The question I'd like to have an answer to is why they choose to go for a 32-bit Android 5.1, when it wouldn't have meant more work for them to go for the 64-bit version instead. There are many MT6753 devices at half the price of the Shark 1 on 64-bit Android. Could it be that there are some hardware in the Shark 1 that limits them to use 32-bit Android? The SoC is 64-bit for sure but how about bus controllers and other chips around the SoC?
If there are some 32-bit hardware in Shark 1 then the CM12.1 for Elephone P8000 won't be very useful as a starting point for a CM for Shark 1.
(Admin: this is partly a device question and maybe it should be in the other Shark 1 thread, but I answer with further questions to the quoted post about CM ROM)
The question I'd like to have an answer to is why they choose to go for a 32-bit Android 5.1, when it wouldn't have meant more work for them to go for the 64-bit version instead. There are many MT6753 devices at half the price of the Shark 1 on 64-bit Android. Could it be that there are some hardware in the Shark 1 that limits them to use 32-bit Android? The SoC is 64-bit for sure but how about bus controllers and other chips around the SoC?
If there are some 32-bit hardware in Shark 1 then the CM12.1 for Elephone P8000 won't be very useful as a starting point for a CM for Shark 1.
(Admin: this is partly a device question and maybe it should be in the other Shark 1 thread, but I answer with further questions to the quoted post about CM ROM)
Click to expand...
Click to collapse
No differences, the same MT6753 on both devices, or any other with the MT6753. What happens is, to compile/develop in 64bit its about twice of the work, storage, everything on theses socs demands more power than old MTKs.
Leagoo did this to avoid the work, and save money with the development. The SoC is able to run at 64Bit, but they put a 32bit software just to save with development, so theorically we don't have 64bit files on our Rom (I have a Jiayu S3 MT6752 it haves in example /system/libs and libs64. Leagoo and some other brands usually do this. But the processor/hardware is exact the same as P8000.
Sent from my s3 using Tapatalk
genesisalgor said:
No differences, the same MT6753 on both devices, or any other with the MT6753. What happens is, to compile/develop in 64bit its about twice of the work, storage, everything on theses socs demands more power than old MTKs.
Leagoo did this to avoid the work, and save money with the development. The SoC is able to run at 64Bit, but they put a 32bit software just to save with development, so theorically we don't have 64bit files on our Rom (I have a Jiayu S3 MT6752 it haves in example /system/libs and libs64. Leagoo and some other brands usually do this. But the processor/hardware is exact the same as P8000.
Sent from my s3 using Tapatalk
Click to expand...
Click to collapse
Unfortunately if they choose to use a 32-bit OS, then it isn't possible to run a 64-bit version due to bootloader incompatibilities.
Anyway, the new devices from LEAGOO will have a 64-bit OS. (just check my LEAGOO Z5L review, that ultra-low cost device has a 64-bit OS haha)
MacArthur67 said:
Hello guys,
I have flashed the full 160620 firmware as the OTA didn't work in my phone, even after exchanging TWRP with the stock recovery.
The Leagoo OTAs doesn't come as zip files so they can't be installed from TWRP either.
Now on 160620 fw I can't install TWRP 3.0.0 by @megthebest. It looks ok in SP_Flash_Tool but when I try to boot from TWRP I just get the dead Android robot on the screen and a message saying something like "No data available" or something like that.
Can it be that the partition map has changed and that the scatter file needs to be edited, or do I have something wrong in my phone?
Has anyone tried to do what I did? Flashed a full 160620 fw and tried to install TWRP 3.0.0 by @megthebest? If so, did you succeed?
Click to expand...
Click to collapse
I flashed the 160620 with SP-flashtool, but unticked "recovery" before flashing.
So after flashing, I still had TWRP.
Then reboot to TWRP, flashed super-su, everything ok.
So, i didnt do EXACTLY what you did, because I didnt had to install TWRP new after flashing 160620, but TWRP is working on my Phone with 160620.
When you flash, does it flash the stock-recovery? Maybe your recovery-partition got messed up, when you used Flashify to get Stock-recovery for the OTA-update?
Dont know, i am not that much of an expert........:silly:
Robot12 said:
I flashed the 160620 with SP-flashtool, but unticked "recovery" before flashing.
So after flashing, I still had TWRP.
Then reboot to TWRP, flashed super-su, everything ok.
So, i didnt do EXACTLY what you did, because I didnt had to install TWRP new after flashing 160620, but TWRP is working on my Phone with 160620.
When you flash, does it flash the stock-recovery? Maybe your recovery-partition got messed up, when you used Flashify to get Stock-recovery for the OTA-update?
Dont know, i am not that much of an expert........:silly:
Click to expand...
Click to collapse
Yes, Flashify messed up my phone badly. But since then I formated the internal storage except the bootloader so then with a clean install of 160620, invluding stock recovery it should be ok. Maybe I flash 160509 again because I know I can install TWRP in that fw. Then do like you, flash 160620 without stock recovery.
Has anybody use sp flash latest 11th july 2016 rom in needrom.com ?
some tips...
Well after 2 months with this phone, I think it's time to share some tips and improvements I found usefull.
** Please notify me if it's the wrong thread for posting these kind of stuff, but I thought it doesn't belong to the other leagoo shark thread... **
I personnally think it's a very good phone, good hardware, and you got a lot for the price. But like with other phones, some improvements doesn't hurt
(1)--> At first, you need to install TWRP recovery and you have to root the phone. You need it to tweak this beast.
Everything you need is in first post.
Important: For superSu, you have to untick "mount namespace separation", because most of the init.d tweaks won't work with this option activated. And you have to tick "activate su during boot" for the same reason
(2)--> Second step, install busybox (let's say with the stericson installer, install it directly -no need to wait for the "smart install" process-, and remove the installer apk after, because we doesn't need it anymore)
(3)--> Third step, let's add init.d support:
like I explained in the other leagoo shark thread, just search for the file install-recovery.sh In the directory /etc/ and modify it like that:
Code:
#!/system/bin/sh
/system/xbin/daemonsu --auto-daemon &
#init.d support
run-parts /system/etc/init.d/
All you have to do now, is to create a folder "init.d" (without the quotes) in /etc/ folder with 0777 permissions.
(4)--> Now that we have init.d support, here are some scripts I collected & adapted for our phone:
00opti:
This one increase sdcard0/sdcard1 -if any installed- read_ahead value for faster i/o, removes some debug flags, tunes oom, disable ipv6 and tunes ipv4 parameters
Code:
#!/system/bin/sh
echo 512 > /sys/block/mmcblk0/queue/read_ahead_kb
echo 512 > /sys/block/mmcblk1/queue/read_ahead_kb
setprop profiler.debugmonitor false
setprop profiler.launch false
setprop profiler.hung.dumpdobugreport false
setprop debugtool.anrhistory 0
setprop profiler.force_disable_ulog 1
setprop profiler.force_disable_err_rpt 1
setprop logcat.live disable
setprop dalvik.vm.debug.alloc 0
setprop dalvik.vm.checkjni false
echo 0 > /sys/module/alarm_dev/parameters/debug_mask
echo 0 > /sys/module/alarmtimer/parameters/debug_mask
echo 0 > /sys/module/binder/parameters/debug_mask
echo 0 > /sys/module/kernel/parameters/initcall_debug
echo 0 > /sys/module/xt_qtaguid/parameters/debug_mask
echo 0 > /sys/module/sbsuspend/parameters/sbsuspend_debug_mask
echo 0 > /sys/module/earlysuspend/parameters/debug_mask
echo 0 > /sys/module/lowmemorykiller/parameters/debug_level
sysctl -w vm.block_dump=0
sysctl -e -w vm.oom_dump_tasks=1
sysctl -e -w vm.oom_kill_allocating_task=1
echo "1" > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo "1" > /proc/sys/net/ipv6/conf/default/disable_ipv6
/system/bin/ip6tables -P INPUT DROP
/system/bin/ip6tables -P OUTPUT DROP
/system/bin/ip6tables -P FORWARD DROP
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_dsack
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling
echo "1" > /proc/sys/net/ipv4/tcp_moderate_rcvbuf
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all
echo "1" > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
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
01rmt:
This one does classics 'perfect" remounts, tunes some fs parameters,ipv4 tweaks and fstrim function
Code:
#!/system/bin/sh
mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0,nobh,errors=continue,nomblk_io_submit,ro /system
mount -o remount,commit=19,nomblk_io_submit,errors=continue,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh,rw /data
mount -o remount,commit=19,nomblk_io_submit,errors=continue,noatime,noauto_da_alloc,nosuid,nodev,nodiratime,barrier=0,nobh,rw /cache
echo 0 > /sys/kernel/debug/tracing/tracing_on
sysctl -e -w fs.lease-break-time=10
sysctl -e -w fs.inotify.max_queued_events=32000
sysctl -e -w fs.inotify.max_user_instances=256
sysctl -e -w fs.inotify.max_user_watches=10240
sysctl -e -w fs.file-max=165164
sysctl -w vm.laptop_mode=0
sysctl -w net.ipv4.icmp_echo_ignore_all=1
sysctl -w net.ipv4.route.flush=1
busybox fstrim -v /cache
busybox fstrim -v /system
busybox fstrim -v /data
02touch:
touch tuning **thanks seraser
Code:
#!/system/bin/sh
echo 20 > /sys/module/tpd_setting/parameters/tpd_em_auto_time_interval
echo 25 > /sys/module/tpd_setting/parameters/tpd_em_pressure_threshold
echo 4 > /sys/module/tpd_setting/parameters/tpd_em_debounce_time
echo 5 > /sys/module/tpd_setting/parameters/tpd_em_debounce_time0
echo 9 > /sys/module/tpd_setting/parameters/tpd_em_debounce_time1
03others:
disabling Zram, some other tweaks, temporary folders cleaning, scrolling and touch tuning
Code:
#!/system/bin/sh
swapoff /dev/block/zram0
setprop persist.sys.scrollingcache 3
setprop ro.min.fling_velocity 8000
setprop ro.max.fling_velocity 12000
echo "1" > /sys/module/tpd_setting/parameters/tpd_mode
echo "63" > /sys/module/hid_magicmouse/parameters/scroll_speed
setprop ENFORCE_PROCESS_LIMIT false
setprop MAX_SERVICE_INACTIVITY false
setprop MIN_HIDDEN_APPS false
setprop MAX_HIDDEN_APPS false
setprop CONTENT_APP_IDLE_OFFSET false
setprop EMPTY_APP_IDLE_OFFSET false
setprop MAX_ACTIVITIES false
setprop ACTIVITY_INACTIVE_RESET_TIME false
setprop MAX_RECENT_TASKS false
setprop MIN_RECENT_TASKS false
setprop APP_SWITCH_DELAY_TIME false
setprop MAX_PROCESSES false
setprop PROC_START_TIMEOUT false
setprop CPU_MIN_CHECK_DURATION false
setprop GC_TIMEOUT false
setprop SERVICE_TIMEOUT false
setprop MIN_CRASH_INTERVAL false
setprop touch.pressure.scale 0.001
busybox rm -f /data/*.log
busybox rm -f /data/tombstones/*
busybox rm -f /data/system/dropbox/*
busybox rm -f /storage/sdcard0/LOST.DIR/*
busybox rm -f /storage/sdcard1/LOST.DIR/*
busybox rm -f /data/system/usagestats/*
busybox rm -r /data/system/appusagestats/*
busybox rm -f /data/anr/*
busybox rm -f /cache/*.apk
busybox rm -f /cache/*.tmp
busybox rm -f /data/backup/pending/*
busybox rm -f /data/local/tmp/*
busybox rm -r /data/tmp/*
setprop media.stagefright.enable-player true
setprop media.stagefright.enable-meta true
setprop media.stagefright.enable-scan true
setprop media.stagefright.enable-http true
setprop media.stagefright.enable-aac true
setprop media.stagefright.enable-qcp true
04gsf:
disabling some google services functions, use it at your own risks ^^^ Can't remember where I find these tweaks, so all credits goes to the author(s)
For this script to work, you need sqlite3 binary, you can use the one I attached (put it in system/xbin/ with according 0777 permissions)
Code:
#!/system/bin/sh
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'perform_market_checkin' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'market_force_checkin' and value = -1"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'checkin_interval'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet_gcore' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet_idle' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:snet_launch_service' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:SYSTEM_RECOVERY_KMSG' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:event_log' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'checkin_dropbox_upload:SYSTEM_RECOVERY_LOG' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'ads:jams:is_enabled' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 'false' where name = 'analytics.service_enabled' and value = 'true'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = '127.0.0.1' where name = 'url:feedback_url'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'market_force_checkin' and value = 1"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'secure:bandwidth_checkin_stat_interval'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'secure:send_action_app_error'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update main set value = 0 where name = 'send_action_app_error'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update saved_secure set value = '0' where name = 'send_action_app_error'"
/system/xbin/sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "update saved_global set value = '0' where name = 'send_action_app_error'"
05renice:
renice processes, especially fingerprint scanner service. Please note this two lines:
- busybox renice -19 `pidof com.teslacoilsw.launcher` <--- because I use Nova launcher instead of the stock launcher, wich I personally recommend.
- busybox renice -19 `pidof com.mrbimc.udn.lite:udn_service` <----- I'm using Ultimate Dynamic Navbar instead of the stock one, I will explain this later.
If you doesn't use this two apps, you can remove these lines. (well, if you don't, it will not hurt either)
Code:
#!/system/bin/sh
sleep 80
pid=$(busybox pgrep zygote 2>/dev/null)
busybox renice -1 $pid
busybox ionice -c 1 -n 0 -p $pid
for pid in `dumpsys activity services | busybox grep -i app=ProcessRecord | busybox awk '{ print $2 }' | busybox grep -v '/100[0-9]}' | busybox cut -d: -f1`; do
busybox renice 7 $pid
busybox ionice -c 2 -n 7 -p $pid
done;
busybox renice -20 `pidof com.android.phone`
busybox renice -19 `pidof egistec.fingerauth.host.service`
busybox renice -19 `pidof egistec.fingerauth.host.service:remote`
busybox renice -19 `pidof com.teslacoilsw.launcher`
busybox renice -19 `pidof com.mrbimc.udn.lite:udn_service`
busybox renice -19 `pidof com.android.mms`
busybox renice -15 `pidof com.android.systemui`
busybox renice -3 `pidof android.process.acore`
busybox renice -3 `pidof android.process.media`
(5)--> Now let's tweak the build.prop file a bit...
I added this lines to the build.prop file:
Code:
#seb tweaks
ro.media.enc.jpeg.quality=100
profiler.force_disable_err_rpt=1
profiler.force_disable_ulog=1
logcat.live=disable
wifi.supplicant_scan_interval=240
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
ro.config.nocheckin=1
persist.sys.scrollingcache=3
net.rmnet0.dns1=8.8.8.8
net.rmnet0.dns2=8.8.4.4
net.dns1=8.8.8.8
net.dns2=8.8.4.4
net.ppp0.dns1=8.8.8.8
net.ppp0.dns2=8.8.4.4
net.wlan0.dns1=8.8.8.8
net.wlan0.dns2=8.8.4.4
net.eth0.dns1=8.8.8.8
net.eth0.dns2=8.8.4.4
net.gprs.dns1=8.8.8.8
net.gprs.dns2=8.8.4.4
#seb experimental
mot.proximity.delay=25
windowsmgr.max_events_per_sec=90
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
debugtool.anrhistory=0
profiler.debugmonitor=false
profiler.launch=false
profiler.hung.dumpdobugreport=false
ro.config.hw_quickpoweron=true
net.tcp.mss.wlan=491520
net.tcp.mss.rmnet=491520
persist.service.zram=0
ro.zram.default=0
persist.sys.use_dithering=0
pm.sleep_mode=1
power.saving.mode=1
(6)-->Xposed
Let's install xposed, you need this for Amplify and Greenify, wich I strongly recommend against the stock power saver (I removed it).
You can also install the module "Deny location Consent", very usefull as I doesn't want other localisation than the gps one (very good with this phone by the way) and I'm tired of clicking "disagree" to the google popup when I activate location.
(7)-->Launcher
I doesn't like the stock launcher. At all. I prefer to use Nova Launcher and remove "Launcher3". Your choice
With my firmware version (20160530), there is no tts settings in "settings" :-/ ... But with Nova, and the widget "activity", you can access tts settings (.Settings$TextToSpeechActivity ;see image attachement). I found other interresting activities in parameters too like :
.RadioInfo
.Settings$NotificationsStationActivity
.Settings$GestureSettingsHct ("Somatosensoriel intelligente" ?....)
.Settings$CaptioningSettingsActivity
.Settings$HeadsetSettingActivity
.MonitoringCertInfoActivity
(8)-->Debloating
Use a file explorer (with root access granted) to remove some system apps and titanium backup (or another tool with similar functionnality) to freeze some others.
I removed:
-All the themes (related to launcher 3, wich I doesn't use) : cn.sh.hct.themeOtdColors, cn.sh.hct.themeOtdNusiness, cn.sh.hct.themeOtdEasyFlat, cn.sh.hct.themeOtd, cn.sh.hct.themeOtdluxurious. I keep the main app "Themes" because It allows us to easily change the lockscreen wallpaper. (via the app or via the galery app)
-UpgradeSys, Tags, Power On/Off scheduler, Power Saver, Pico sv (I installed google tts), MTKLogger, MTKNlpServices, MTK android suite daemon, ConfigUpdater, FWupgrade, FWUpgradeProvider, RockClient, Music (I prefer another player), MusicFx.
I froze:
-BSPTelephonyDevTool, com.mediatek.batteryWarning, FastCamera (doesn't know what it is for ?), MTK Thermal manager
(9)-->The navbar
Well, I think there are two problems with the leagoo navbar.
At First, I doesn't like the resolution changing when you activate/desactivate the navbar wich occurs with certain apps. It can even crash some very specific apps (like Igo primo).
And the second thing very annoying is that you have to hide it manually. Too bad there isn't a "auto hide feature".
I solved these two issues with "Ultimate Dynamic Navbar", http://forum.xda-developers.com/showthread.php?t=2270198
Now the navbar is superposed with anything on the screen, without changing the resolution of the running app. And you can specify a timeout for it to automatically hide.
Very customizable, very good and far better than the leagoo or the android stock navbar. You can use the integrated xposed module to hide the leagoo navbar; or modifying these two lines in build.prop (thanks to genesisalgor) :
ro.hct_navigationbar=0
qemu.hw.mainkeys=1
...... more to come if you are interrested
(like customizing the clock view with the flip cover -by modifyng framework-res.apk-,services disabling, optimizing system apks, bootanimation, .... and other tweaks).
Great stuff for helping other.
BTW related to navbar, the navbar in Shark isn't the stock Android Navbar, is another implementation. There is a line on build.prop called hct navbar or something, set it to 0 then the leagoo navbar goes away.
Then
qemu.hw.mainkeys=0
And you get stock Android navbar, which is a bit smaller, so I use Xstana to get a better one.
Sent from my s3 using Tapatalk
genesisalgor said:
BTW related to navbar, the navbar in Shark isn't the stock Android Navbar, is another implementation. There is a line on build.prop called hct navbar or something, set it to 0 then the leagoo navbar goes away.
Then
qemu.hw.mainkeys=0
And you get stock Android navbar, which is a bit smaller, so I use Xstana to get a better one.
Click to expand...
Click to collapse
Thanks a lot ! I still prefer to use Ultimate Dynamic Navbar as I found it more convenient and customizable than the "real" android stock navbar, but now I doesn't need to use the Xposed module, I only have to modify the build.prop like this:
ro.hct_navigationbar=0
qemu.hw.mainkeys=1
Hi.
@seb3773
From here...
http://forum.xda-developers.com/showthread.php?p=67860377
Can you check values of touch after init.d boot?
Thanks.
Enviado desde mi Shark 1 mediante Tapatalk
seraser said:
Hi.
@seb3773
From here...
http://forum.xda-developers.com/showthread.php?p=67860377
Can you check values of touch after init.d boot?
Thanks.
Enviado desde mi Shark 1 mediante Tapatalk
Click to expand...
Click to collapse
Yes, I checked the values (both with terminal and engineer mode) after boot and it's working, I mean the values are those mentionned in the script.
for testing purposes, can you install terminal emulator app, then open a windows, type "su" to get root and then type "run-parts", just to check there isn't something wrong with the busybox install ?
You should then see something like that:
Code:
[email protected]_35gu_l:/ # run-parts
BusyBox v1.24.1-Stericson (2015-11-06 19:11:24 EST) multi-call binary.
Usage: run-parts [-a ARG]... [-u UMASK] [--reverse] [--test] [--exit-on-error] [--list] DIRECTORY
Run a bunch of scripts in DIRECTORY
-a ARG Pass ARG as argument to scripts
-u UMASK Set UMASK before running scripts
--reverse Reverse execution order
--test Dry run
--exit-on-error Exit if a script exits with non-zero
--list Print names of matching files even if they are not executable
If it's ok, then try the command "run-parts --list /etc/init.d/ : you should get the listing of the scripts in init.d folder
seb3773 said:
Yes, I checked the values (both with terminal and engineer mode) after boot and it's working, I mean the values are those mentionned in the script.
for testing purposes, can you install terminal emulator app, then open a windows, type "su" to get root and then type "run-parts", just to check there isn't something wrong with the busybox install ?
You should then see something like that:
Code:
[email protected]_35gu_l:/ # run-parts
BusyBox v1.24.1-Stericson (2015-11-06 19:11:24 EST) multi-call binary.
Usage: run-parts [-a ARG]... [-u UMASK] [--reverse] [--test] [--exit-on-error] [--list] DIRECTORY
Run a bunch of scripts in DIRECTORY
-a ARG Pass ARG as argument to scripts
-u UMASK Set UMASK before running scripts
--reverse Reverse execution order
--test Dry run
--exit-on-error Exit if a script exits with non-zero
--list Print names of matching files even if they are not executable
If it's ok, then try the command "run-parts --list /etc/init.d/ : you should get the listing of the scripts in init.d folder
Click to expand...
Click to collapse
Run parts works fine, showme 02touch, I don't understand.
You feel the touch sensitive only with init.d and without settings fresh boot activation?
Thanks.
Enviado desde mi Shark 1 mediante Tapatalk
Guys instead of doing so many tweaks, all can be implemented into the ramdisk. Coming soon
Alberto96 said:
Guys instead of doing so many tweaks, all can be implemented into the ramdisk. Coming soon
Click to expand...
Click to collapse
Right. I was thinking of doing it as it is not a problem to decompile/compile mtk img files, but having these tweaks in scripts files/build.prop allow me to test, modify, remove some of them or add others tweaks without the hassle of playing with the ramdisk.
But you're definitively right, maybe we can make a list of the "good" working tweaks for the shark, and when we are sure it's ok and working properly, then integrate all of them in ramdisk.
---------- Post added at 01:28 PM ---------- Previous post was at 01:25 PM ----------
seraser, to be honnest, I already feel the touch enough sensitive for me without the tweaks, so I'm maybe not the good person to do this kind of test
Maybe others can try and tell us if there's a difference or not...
Shark 1 20160711 ROM: https://mega.nz/#!tV0DXRDI!7qEXPptHmC9eA9WORwzomdl3vy2nUrZzlTkJkewkcMo
- Rooted using SuperSU
- Busybox Support
- De-Bloated (just a bit)
- Improved Performance
Flashable using TWRP Recovery.
Touchscreen Sensitivity tweak hasn't been added because it seems that this last update doesn't have that issue.
I'm now working on an AOSP variant in order to get rid of the LEAGOO OS UI. UPDATE: Done, coming soon.
Alberto96 said:
Shark 1 20160711 ROM: https://mega.nz/#!tV0DXRDI!7qEXPptHmC9eA9WORwzomdl3vy2nUrZzlTkJkewkcMo
- Rooted using SuperSU
- Busybox Support
- De-Bloated (just a bit)
- Improved Performance
Flashable using TWRP Recovery.
Touchscreen Sensitivity tweak hasn't been added because it seems that this last update doesn't have that issue.
I'm now working on an AOSP variant in order to get rid of the LEAGOO OS UI.
Click to expand...
Click to collapse
Great work man!
And yeeeess, please AOSP it, I l don't like this UI [emoji14]
Sent from my s3 using Tapatalk

Categories

Resources