Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,804,641 Members 43,910 Now Online
XDA Developers Android and Mobile Development Forum

[script][any][Jubei's unified init.d script]

Tip us?
 
jubei_mitsuyoshi
Old
(Last edited by jubei_mitsuyoshi; 31st March 2014 at 12:17 AM.)
#1  
Member - OP
Thanks Meter 67
Posts: 50
Join Date: Mar 2013
Default [script][any][Jubei's unified init.d script]

While doing stuff on Fenris ( http://w11.zetaboards.com/Pwnie_Expr...0168884/1/#new ) i discovered a LOT of init.d scripts out there so decided to unify all the useful and working tweaks into one single bash script

EDIT.......... after a massive ammount of testing and tweaking, the result is the modifications to the script
it is mostly universal and includes functions for direct config of the elemental x kernel and glitch kernel,

The speed benefits are noticeable but not massive


Please note bin previous version since it was full of bugs inherited from script snippets had picked up from xda roms



Code:
#!/system/bin/sh


BBox="/system/xbin/busybox"
LC="log -p i -t cm"



##########################################################################################
#elemental x 2.10.1 kernel settings 

elex_settings() {
	$LC "Jubei-->Function--> ENTER......elementalx_kernel"
	##########Set FASTCHARGE
	#echo 1 > /sys/kernel/fast_charge/force_fast_charge
	#$LC "Jubei-->USB Fastcharge enabled"
	echo 0 > /sys/kernel/fast_charge/force_fast_charge
	$LC "Jubei-->USB Fastcharge disabled"
	
	###########Set SWEEP2WAKE
	echo 0 > /sys/android_touch/sweep2wake
	$LC "Jubei-->Sweep2wake disabled"
	#echo 2 > /sys/android_touch/sweep2wake
	#$LC "Jubei-->Sweep2sleep enabled"
	#echo 1 > /sys/android_touch/sweep2wake
	#$LC "Jubei-->Sweep2wake/Sweep2sleep enabled"
	
	########Set S2W SHORTSWEEP
	#echo 1 > /sys/android_touch/shortsweep;
	#$LC "Jubei-->Sweep2wake shortsweep enabled"
	echo 0 > /sys/android_touch/shortsweep
	$LC "Jubei-->Sweep2wake shortsweep disabled"
	
	#Set S2W ORIENTATION
	#echo 1 > /sys/android_touch/orientation
	#$LC "Jubei-->Disabled sweep2sleep in landscape mode"
	#echo 2 > /sys/android_touch/orientation
	#$LC "Jubei-->Disabled sweep2sleep in portrait mode"
	echo 0 > /sys/android_touch/orientation
	$LC "Jubei--> sweep2sleep disabled"
	
	#Set DOUBLETAP2WAKE
	#echo 1 > /sys/android_touch/doubletap2wake
	#$LC "Jubei--> DoubleTap2Wake enabled"
	echo 0 > /sys/android_touch/doubletap2wake
	$LC "Jubei--> DoubleTap2Wake disabled"
	
	
	#Set S2W/DT2W Power key toggle
	#echo 1 > /sys/android_touch/pwrkey_suspend;
	#$LC "Jubei--> Power key toggle for S2W/DT2W enabled"
	echo 0 > /sys/android_touch/pwrkey_suspend
	$LC "Jubei--> Power key toggle for S2W/DT2W disabled"
	
	
	#Set S2W/DT2W Magnetic cover toggle
	#echo 1 > /sys/android_touch/lid_suspend;
	#$LC "Jubei--> Magnetic cover toggle for S2W/DT2W enabled"
	echo 0 > /sys/android_touch/lid_suspend;
	$LC "Jubei--> Magnetic cover toggle for S2W/DT2W disabled"
	
	#Set Magnetic on/off
	#echo 0 > /sys/module/lid/parameters/enable_lid;
	#$LC "Jubei--> Magnetic on/off disabled"
	echo 1 > /sys/module/lid/parameters/enable_lid;
	$LC "Jubei--> Magnetic on/off enabled"
	
	
	#battery life extender
	
	#echo 4200 > /sys/devices/i2c-0/0-006a/float_voltage;
	#Lower charge voltage to 4.2V
	#echo 4100 > /sys/devices/i2c-0/0-006a/float_voltage;
	#Lower charge voltage to 4.1V
	#echo 4000 > /sys/devices/i2c-0/0-006a/float_voltage;
	#Lower charge voltage to 4.0V
	$LC "Jubei--> battery life extender disabled"
	
	
	#max scroff
	#echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/max_screen_off;
	#$LC "Jubei--> Max screen off disabled"
	
	$LC "Jubei--> Max screen off enabled"
	
	
	#Set fsync
	echo 0 > /sys/module/sync/parameters/fsync_enabled;
	$LC "Jubei--> fsync disabled"
	#echo 1 > /sys/module/sync/parameters/fsync_enabled;
	#$LC "Jubei--> fsync enabled"
	
	
	#exFAT support
	
	insmod /system/lib/modules/exfat.ko;
	$LC "Jubei--> exFAT module loaded"
	
	
	#Color/gamma support
	insmod /system/lib/modules/msm_kcal_ctrl.ko;
	$LC "Jubei-->Color/gamma module loaded"
	
	
	#USB Host mode charging
	
	#echo Y > /sys/module/msm_otg/parameters/usbhost_charge_mode;
	#USB OTG+Charge mode enabled
	
	$LC "Jubei-->Function--> EXIT......elementalx_kernel"
	
	#Backlight dimmer option
	#echo 10 > /sys/module/msm_fb/parameters/backlight_dimmer;
	#$LC "Jubei-->Backlight dimmer enabled\: $BLD"

	
	
	
	#thermal settings
	echo 80,82,90,100 > /sys/module/msm_thermal/parameters/limit_temp_degC;
	$LC "Jubei--> run cool"
	#echo 85,90,97,105 > /sys/module/msm_thermal/parameters/limit_temp_degC;
	#run hot
	
	
	#GPU Frequency settings
	
	#Stock GPU
	
	#echo 450000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#$LC "Jubei-->GPU freq 450MHz"
	
	echo 477000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	$LC "Jubei-->GPU freq 477MHz"
	
	#echo 490500000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#$LC "Jubei--> GPU freq 491MHz"
	
	#echo 504000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#GPU freq 504MHz
	
	#echo 531000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#GPU freq 531MHz
	
	#echo 558000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#GPU freq 558MHz
	
	#echo 585000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#GPU freq 585MHz
	
	
	#GPU Governor settings
	
	#echo simple > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
	#$LC "Jubei--> Simple GPU Governor"
	
	#echo performance > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
	#$LC "Jubei--> Performance GPU Governor"
	
	echo ondemand > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
	$LC "Jubei--> Ondemand GPU Governor"
	
	
	#io scheduler settings
	
	#echo cfq > /sys/block/mmcblk0/queue/scheduler;
	#$LC "Jubei--> CFQ io scheduler"
	
	#echo row > /sys/block/mmcblk0/queue/scheduler;
	#$LC "Jubei--> ROW io scheduler"
	
	#echo fiops > /sys/block/mmcblk0/queue/scheduler;
	#$LC "Jubei--> FIOPS io scheduler"
	
	#echo sio > /sys/block/mmcblk0/queue/scheduler;
	#$LC "Jubei--> SIO io scheduler"
	
	echo deadline > /sys/block/mmcblk0/queue/scheduler;
	$LC "Jubei--> deadline io scheduler"
	
	
	#ElementalX Governor
	echo 1 > /sys/devices/system/cpu/cpu0/online;
	echo elementalx > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
	echo 1 > /sys/devices/system/cpu/cpu1/online;
	echo elementalx > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor;
	echo 1 > /sys/devices/system/cpu/cpu2/online;
	echo elementalx > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor;
	echo 1 > /sys/devices/system/cpu/cpu3/online;
	echo elementalx > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor;
	$LC "Jubei--> ElementalX CPU governor"
	
	
	#Readahead settings
	echo 1024 > /sys/block/mmcblk0/queue/read_ahead_kb
	$LC "Jubei-->Readahead size 1024"
	
	
	#gboost settings
	
	#echo 0 > /sys/devices/system/cpu/cpufreq/elementalx/gboost;
	#$LC "Jubei--> gboost disabled"
	
	$LC "Jubei--> gboost enabled"
	
	
	$LC "Jubei-->Function--> EXIT......elementalx_kernel"
	
	

}


##########################################################################################
#glitch 142 kernel settings 

glitch_kernel() {

	$LC "Jubei-->Function--> ENTER......glitch_kernel"
	
	#Max CPU_FREQ
	#set safe value for boot and early processes
		MAXF="`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`"
		$LC "Jubei-->Maximum kern freq is $MAXF"
		$LC "Jubei-->Boot Maximum kern freq is 1512000hz"
		echo 1512000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq;
		echo 1512000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq;
		echo 1512000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq;
		echo 1512000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq;
		
	#Min CPU_FREQ
	#set safe value for boot and early processes
		MINF="`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`"
		$LC "Jubei-->Min kern freq is $MINF"
		$LC "Jubei-->Boot Min kern freq is 384000hz"
		echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq; 
		echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq;
		echo 384000 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq;
		echo 384000 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq;
		
		#I/O scheduler
		#echo "cfq" > /sys/block/mmcblk0/queue/scheduler;
		#$LC "Jubei-->io scheduler: cfq"
		
		#echo "row" > /sys/block/mmcblk0/queue/scheduler;
		#$LC "Jubei-->io scheduler: row"
		
		#echo "deadline" > /sys/block/mmcblk0/queue/scheduler;
		#$LC "Jubei-->io scheduler: deadline"
		
		#echo "fiops" > /sys/block/mmcblk0/queue/scheduler;
		#$LC "Jubei-->io scheduler: fiops"
		
		#echo "sio" > /sys/block/mmcblk0/queue/scheduler;
		#$LC "Jubei-->io scheduler: sio"
		
		echo "noop" > /sys/block/mmcblk0/queue/scheduler;
		$LC "Jubei-->io scheduler: noop"
		
	#Read-ahead
		#echo 128 > /sys/block/mmcblk0/queue/read_ahead_kb;
		#$LC "Jubei-->Read-ahead: 128"
		
		echo 256 > /sys/block/mmcblk0/queue/read_ahead_kb;
		$LC "Jubei-->Read-ahead: 256"
		
		#echo 512 > /sys/block/mmcblk0/queue/read_ahead_kb;
		#$LC "Jubei-->Read-ahead: 512"
		
		#echo 1024 > /sys/block/mmcblk0/queue/read_ahead_kb;
		#$LC "Jubei-->Read-ahead: 1024"
		
		#echo 2048 > /sys/block/mmcblk0/queue/read_ahead_kb;
		#$LC "Jubei-->Read-ahead: 2048"
	
	
	#FAST CHARGE
	#echo 1 > /sys/kernel/fast_charge/force_fast_charge;
	#$LC "Jubei-->fast charge enabled"
	
	echo 0 > /sys/kernel/fast_charge/force_fast_charge;
	$LC "Jubei-->fast charge disabled"
	
	
	#Set HOTPLUGDRV
	#echo 1 > /sys/kernel/msm_mpdecision/conf/enabled;
	#echo 0 > /sys/module/intelli_plug/parameters/intelli_plug_active;
	#$LC "Jubei-->msm_mpdecision enabled"
	
	#echo 0 > /sys/kernel/msm_mpdecision/conf/enabled;
	#echo 1 > /sys/module/intelli_plug/parameters/intelli_plug_active;
	#$LC "Jubei-->intelli_plug enabled"
	
	echo 0 > /sys/kernel/msm_mpdecision/conf/enabled;
	echo 0 > /sys/module/intelli_plug/parameters/intelli_plug_active;
	$LC "Jubei-->qualcomm_mpdecision enabled"
	
	
	#Set SWEEP2WAKE
	echo 0 > /sys/android_touch/sweep2wake;
	$LC "Jubei-->Sweep2wake disabled"
	
	#echo 2 > /sys/android_touch/sweep2wake;
	#$LC "Jubei-->Sweep2sleep enabled"
	
	#echo 1 > /sys/android_touch/sweep2wake;
	#$LC "Jubei-->Sweep2wake enabled"
	
	
	#Set S2S_ORIENTATION
	#echo 1 > /sys/android_touch/orientation;
	#$LC "Jubei-->orientation portrait"
	
	#echo 2 > /sys/android_touch/orientation;
	#$LC "Jubei-->orientation landscape"
	
	echo 0 > /sys/android_touch/orientation;
	$LC "Jubei-->orientation both"
	
	
	#Set PWR_TOGGLE
	#echo 1 > /sys/android_touch/pwrkey_suspend;
	#$LC "Jubei-->power_toggle enabled"
	
	echo 0 > /sys/android_touch/pwrkey_suspend;
	$LC "Jubei-->power_toggle disabled"
	
	
	#Set SHORTSWEEP
	#echo 1 > /sys/android_touch/shortsweep;
	#$LC "Jubei-->Shortsweep enabled"
	
	echo 0 > /sys/android_touch/shortsweep;
	$LC "Jubei-->Shortsweep disabled"
	
	
	#Set DOUBLETAP2WAKE
	#echo 1 > /sys/android_touch/doubletap2wake;
	#$LC "Jubei-->DoubleTap2Wake enabled"
	
	echo 0 > /sys/android_touch/doubletap2wake;
	$LC "Jubei-->DoubleTap2Wake disabled"
	
	
	#Set Magnetic on/off
	#echo 0 > /sys/module/lid/parameters/enable_lid;
	#$LC "Jubei-->Magnetic on/off disabled"
	
	echo 1 > /sys/module/lid/parameters/enable_lid;
	$LC "Jubei-->Magnetic on/off enabled"
	
	
	#USB Host mode charging
	#echo Y > /sys/module/msm_otg/parameters/usbhost_charge_mode;
	#$LC "Jubei-->USB OTG+Charge mode enabled"
	
	
	#Input boost
	#echo 0 > /sys/kernel/msm_mpdecision/conf/boost_enabled;
	#$LC "Jubei-->Input-Boost disabled"
	
	echo 1 > /sys/kernel/msm_mpdecision/conf/boost_enabled;
	$LC "Jubei-->Input-Boost enabled"
	
	
	#Gentle Fair Sleepers
	#echo 0 > /sys/kernel/sched/gentle_fair_sleepers;
	#$LC "Jubei-->Gentle Fair Sleepers disabled"
	
	echo 1 > /sys/kernel/sched/gentle_fair_sleepers;
	$LC "Jubei-->Gentle Fair Sleepers enabled"
	
	
	#MC Power savings
	#echo 2 > /sys/devices/system/cpu/sched_mc_power_savings;
	#$LC "Jubei-->Maximum MC power savings"
	
	$LC "Jubei-->MC power savings disabled"
	
	
	#thermal settings
	
	#echo 80,82,90,100 > /sys/module/msm_thermal/parameters/limit_temp_degC;
	#$LC "Jubei-->run cool"
	
	#echo 85,90,97,105 > /sys/module/msm_thermal/parameters/limit_temp_degC;
	#$LC "Jubei-->run hot"
	
	$LC "Jubei-->run normal"
	
	
	#GPU Clock settings
	
	#echo 320000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#$LC "Jubei-->320MHz GPU"
	
	echo 450000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	$LC "Jubei-->450MHz GPU"
	
	#echo 504000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#$LC "Jubei-->504MHz GPU"
	
	#echo 545000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#$LC "Jubei-->545MHz GPU"
	
	#echo 600000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#$LC "Jubei-->600MHz GPU"
	
	#echo 627000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#$LC "Jubei-->627MHz GPU"
	
	#echo 400000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk;
	#$LC "Jubei-->400MHz GPU"
	
	
	#GPU Governor settings
	#echo interactive > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
	#$LC "Jubei-->Interactive GPU Governor"
	
	#echo performance > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
	#$LC "Jubei-->Performance GPU Governor"
	
	echo ondemand > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/pwrscale/trustzone/governor;
	$LC "Jubei-->Ondemand GPU Governor"
	
	
	#GPU uV settings
	
	#printf "920000\n1025000\n1125000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
	#$LC "Jubei-->-25mV GPU uV"
	
	#printf "895000\n1000000\n1100000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
	#$LC "Jubei-->-50mV GPU uV"
	
	#printf "870000\n975000\n1075000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
	#$LC "Jubei-->-75mV GPU uV"
	
	#printf "845000\n950000\n1050000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
	#$LC "Jubei-->-100mV GPU uV"
	
	#printf "820000\n925000\n1025000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
	#$LC "Jubei-->-125mV GPU uV"
	
	#printf "795000\n900000\n1000000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
	#$LC "Jubei-->-150mV GPU uV"
	
	printf "945000\n1050000\n1150000\n" > /sys/devices/system/cpu/cpufreq/vdd_table/vdd_levels_GPU;
	$LC "Jubei-->Stock GPU voltage"
	
	
	#max scroff
	#echo 594000 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq;
	#$LC "Jubei-->594MHz max screen off"
	
	#echo 702000 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq;
	#$LC "Jubei-->702MHz max screen off"
	
	#echo 810000 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq;
	#$LC "Jubei-->810MHz max screen off"
	
	#echo 1026000 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq;
	#$LC "Jubei-->1026MHz max screen off"
	
	#echo 1242000 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max_freq;
	#$LC "Jubei-->1242MHz max screen off"
	
	echo 0 > /sys/devices/system/cpu/cpu0/cpufreq/screen_off_max;
	$LC "Jubei-->max screen off freq disabled"
	
	#Battery life extender
	
	#echo 4200 > /sys/devices/i2c-0/0-006a/float_voltage;
	#$LC "Jubei-->4.2V charge voltage"
	
	#echo 4100 > /sys/devices/i2c-0/0-006a/float_voltage;
	#$LC "Jubei-->4.1V charge voltage"
	
	#echo 4000 > /sys/devices/i2c-0/0-006a/float_voltage;
	#$LC "Jubei-->4.0V charge voltage"
	
	echo 4300 > /sys/devices/i2c-0/0-006a/float_voltage;
	$LC "Jubei-->Stock charge voltage"
	
	
	#exFAT support
		insmod /system/lib/modules/exfat.ko;
		$LC "Jubei-->exFAT module loaded"
		
	#Wait a bit before applying governor changes
		sleep 2
		
	#CPU governor
		
		#interactive
		
		#intellidemand
		
		#smartmax
		
		#ondemand
		
		echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor;
		$LC "Jubei-->CPU Governor: $governor"
	
	
		$LC "Jubei-->Function--> EXIT......glitch_kernel"

}

##########################################################################################


# ICUP FUNI CULURSZ
	$LC "Jubei--> Vanir first"

	# ICUP FUNI CULURSZ
	[ -e /sys/class/misc/colorcontrol/v1_offset ] && chown system.system /sys/class/misc/colorcontrol/v1_offset && chmod 0666 /sys/class/misc/colorcontrol/v1_offset
	[ -e /sys/class/misc/colorcontrol/multiplier ] && chown system.system /sys/class/misc/colorcontrol/multiplier && chmod 0666 /sys/class/misc/colorcontrol/multiplier
	[ -e /sys/devices/platform/omapdss/manager0/gamma ] && chown system.system /sys/devices/platform/omapdss/manager0/gamma && chmod 0666 /sys/devices/platform/omapdss/manager0/gamma
	
	# Expand kernel perms
	[ -e /dev/cpuctl/apps/cpu.notify_on_migrate ] && chown system.system /dev/cpuctl/apps/cpu.notify_on_migrate && chmod 0666 /dev/cpuctl/apps/cpu.notify_on_migrate

	
	#use ksm
	[ -e /sys/kernel/mm/uksm ] && echo 1 > /sys/kernel/mm/uksm/run && echo 0 > /sys/kernel/mm/ksm/run  || echo 1 > /sys/kernel/mm/ksm/run


	$LC "Jubei--> ......merge_sysctl"
	sysctl -p /system/etc/sysctl.conf




##########################################################################################crond


	$LC "Jubei-->......cron_deamon"

	# crond has "/bin/sh" hardcoded
	mount -o remount,rw rootfs
	if [ ! -h /bin ]; then
		ln -s /system/bin /bin
	fi
	mount -o remount,ro rootfs /
	
	# set timezone (if you're not between -0500 and -0800 you get PST)
	# todo - support other timezones
	local timezone=`date +%z`
	if [ $timezone = "-0800" ]; then
	TZ=PST8PDT
	elif [ $timezone = "-0700" ]; then
	TZ=MST7MDT
	elif [ $timezone = "-0600" ]; then
	TZ=CST6CDT
	elif [ $timezone = "-0500" ]; then
	TZ=EST5EDT
	else
		TZ=PST8PDT
	fi
	export TZ
	
	# use /data/cron, call the crontab file "root"
	if [ -e /data/cron/root ]; then
		mkdir -p /data/cron
		cat > /data/cron/root << EOF
0 20 * * * sync; echo 3 > /proc/sys/vm/drop_caches
0 20 * * * sync; fstrim -v /system
0 20 * * * sync; fstrim -v /data
0 20 * * * sync; fstrim -v /cache
0 20 * * * sync; sysctl -w vm.drop_caches=3

01 * * * * run-parts /system/etc/cron/cron.hourly
02 4 * * * run-parts /system/etc/cron/cron.daily
22 4 * * 0 run-parts /system/etc/cron/cron.weekly
EOF
	fi
	crond -c /data/cron




##########################################################################################

	sync
	mount -o remount,rw /system


	$LC "Jubei-->......boost_sd"
	if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
		echo 1024 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
	fi		


	$LC "Jubei-->......vacume_sqlite"
	for i in `find /data -iname "*.db"`; do 
		/system/xbin/sqlite3 $i 'VACUUM;'
		/system/xbin/sqlite3 $i 'REINDEX;'
	done
	
	if [ -d "/dbdata" ]; then
		for i in `find /dbdata -iname "*.db"`; do
			/system/xbin/sqlite3 $i 'VACUUM;'
			/system/xbin/sqlite3 $i 'REINDEX;'
		done
	fi
	
	if [ -d "/datadata" ]; then
		for i in `find /datadata -iname "*.db"`; do
			/system/xbin/sqlite3 $i 'VACUUM;'
			/system/xbin/sqlite3 $i 'REINDEX;'
		done
	fi
	
	for i in `find /sdcard -iname "*.db"`; do
		/system/xbin/sqlite3 $i 'VACUUM;'
		/system/xbin/sqlite3 $i 'REINDEX;'
	done


	
##########################################################################################setrenice

	$LC "Jubei-->......set_renice"
	renice 18 `pidof kswapd0` 
	
	for i in {1..20}; do
		sleep 1
		renice -20 `pidof mediaserver`;
		renice -20 `pidof admsrv`;
		renice -20 `pidof android.process.media`;
		renice -19 `pidof com.android.inputmethod.latin`
		renice -18 `pidof com.sec.android.app.controlpanel` # Task manager
		renice -17 `pidof com.android.systemui`
		renice -10 `pidof com.google.android.apps.googlevoice`
		renice -9 `pidof com.android.settings`
		renice -9 `pidof com.android.vending`
		renice -6 `pidof com.sec.android.app.camera`
	
	done

	
	ionice `pidof mediaserver` rt 0;
	ionice `pidof admsrv` rt 0;
	ionice `pidof android.process.media` rt 0;
	
	sleep 3

#####################################################################################selinux relable

	$LC "Jubei-->......selinux relable"
	LABELDATA=0
	LABELDALVIKCACHE=0
	
	# Test /data
	ls -Zd /data/system | grep -q unlabeled
	if [ $? -eq 0 ]; then
		$LC "Jubei....userdata is unlabeled, fixing..."
		LABELDATA=1
	fi
	
	# Double-check other files under /data
	ls -Z /data/misc/wifi/wpa_supplicant.conf | grep -q "wifi_"
	if [ $? -eq 1 ]; then
		$LC "Jubei....data is mis-labeled, fixing..."
		LABELDATA=1
	fi
	
	ls -Zd /data/dalvik-cache | grep -q unlabeled
	if [ $? -eq 0 ]; then
		$LC "Jubei....dalvik-cache is unlabeled, fixing..."
		LABELDALVIKCACHE=1
	fi
	
	ls -Zd /cache/dalvik-cache | grep -q unlabeled
	if [ $? -eq 0 ]; then
		$LC "Jubei....dalvik-cache is unlabeled, fixing..."
		LABELDALVIKCACHE=1
	fi
	
	
	if [ $LABELDATA = "1" ]; then
		$LC "Jubei..../data relabel starting..."
		restorecon -R /data
		$LC "Jubei..../data relabel complete"
		$LC "Jubei..../cache relabel starting..."
		restorecon -R /cache
		$LC "Jubei..../cache relabel complete"
	fi
	
	if [ $LABELDALVIKCACHE = "1" ]; then
		$LC "Jubei....dalvik-cache relabel starting..."
		restorecon -R /data/dalvik-cache
		restorecon -R /cache/dalvik-cache
		$LC "Jubei....dalvik-cache relabel complete"
	fi
	
	
##########################################################################################
#
# General Queue Tweaks
#

	$LC "Jubei-->......queue_tweaks"
	for i in /sys/block/*/queue; do
		echo 512 > $i/nr_requests
		echo 2 > $i/rq_affinity
		echo 0 > $i/nomerges
		echo 0 > $i/add_random
		echo 0 > $i/rotational
	done
	
	# kill iostats hardbad
	for i in `find /sys/devices/platform -name iostats`; do 
		echo "0" > $i
	done
	
	##########################################################################################sound mod
	$LC "Jubei-->......sound"
	#Full Access To ALSA
	chmod 777 /dev/snd/*
	chown 0.0 /dev/snd/*

	#Using ALSA Drivers
	export AUDIODRIVER=alsa


##########################################################################################
	$LC "Jubei-->......remount"
	busybox mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0 /system
	for m in "/data" "/cache"; do
	busybox mount -o remount,barrier=0,nomblk_io_submit,noauto_da_alloc,errors=continue,noatime,nodiratime,nosuid,nodev $m
	done
	
	sync
	
	

##########################################################################################

	$LC "Jubei-->......trim_drop"
	sync
	fstrim -v /system
	fstrim -v /data
	fstrim -v /cache
	sysctl -w vm.drop_caches=3
	sync

Results
Noticeable increase in speed and smoothness of the ui, especially when using nova for a launcher ( gpu rendering support ? )
The Following User Says Thank You to jubei_mitsuyoshi For This Useful Post: [ Click to Expand ]
 
jubei_mitsuyoshi
Old
#2  
Member - OP
Thanks Meter 67
Posts: 50
Join Date: Mar 2013
To emphasise DO NOT USE PREVIOUS VERSION, it has bugs inherited from foreign scripts
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes