[HTC 10 ROMs, Kernels, Recoveries, & Other Developm] Eliminater74:
One of the major parts of this kernel is EAS, and since EAS is setup from a script.. Well here is the issue, im not that great with shell script coding.....

I am requesting that anyone have some skills in this area, and have a little idea on how android runs, Then please msg me........

I have ran into more problems then anything with this boot script... and I am tired of spending my time on that then other dev work on the kernel it self.

Its my understanding that I cant attach to the ramdisk anymore on N, cause I need a domain which I dont know how to create, so I work off the system/su.d that supersu works off of.......

Any help plz.

Here is what I use now:

#!/system/bin/sh

BB="/sbin/bb/busybox"
# TIMESTAMP=$(date +%Y-%m-%d.%H.%M.%S)
LOG="/data/nebula.txt"
# LOGS="/sdcard/nebula/Logs"
export PATH=${PATH}:/sbin:/system/sbin:/system/bin:/system/xbin
###########################################################################################
### -=[ The NebuliX Project: The NebuliXKernel Post Boot Script ]=- ###
### ----------------------------------------------------------------------------------- ###
### UpDated: 12/05/2016 Custom Kernel Settings ###
### ###
###-------------------------------------------------------------------------------------###
###########################################################################################
# helper functions to allow Android init like script
function write() {
$BB echo -n "$2" > "$1"
}

function copy() {
cat "$1" > "$2"
}

function lmsg() {
$BB echo -n "[Nebula] " + "$1" | tee /dev/kmsg
}
################################################################################
$BB echo "-----------------------------------------------------------" | tee /dev/kmsg
$BB echo "[Nebulix] Boot Script Started" | tee /dev/kmsg
$BB echo "nebulix-post_boot.sh Started" "$(date)" > $LOG;

# Mount root as RW to apply tweaks and settings
REMOUNT_SYSTEM() {
$BB mount -o remount,rw /;
$BB mount -o rw,remount /system;
#lmsg "Remount System for Read/Write Permissions"
}
REMOUNT_SYSTEM;

CRITICAL_PERM_FIX()
{
# critical Permissions fix
$BB chmod -R 06755 /sbin/bb/;
$BB chmod -R 06755 /system/xbin/;
chmod 666 /sys/block/mmcblk0/queue/scheduler
chmod 666 /sys/block/mmcblk0/queue/read_ahead_kb
chmod 666 /sys/class/leds/button-backlight/bln
chmod 666 /sys/class/leds/button-backlight/bln_speed
chmod 666 /sys/class/leds/button-backlight/bln_number
chmod 666 /sys/fpf/fpf
chmod 666 /sys/fpf/vib_strength
chmod 666 /sys/fpf/fpf_dt_wait_period
chmod 666 /sys/module/mdss_fb/parameters/backlight_dimmer
chmod 666 /sys/backlight_dimmer/backlight_min
chmod 666 /sys/class/leds/button-backlight/bln_rgb_batt_colored
chmod 666 /sys/class/leds/button-backlight/bln_rgb_blink_light_level
chmod 666 /sys/class/leds/button-backlight/bln_rgb_pulse
echo "[NebuliX] Permissions to execute are now set" | tee /dev/kmsg
}
CRITICAL_PERM_FIX;

# -----------------------------------------------------------------------------------------#
# -----------------------------------------------------------------------------------------#

CREATE_EAS_TUNING_NODES() {
# Create energy-aware scheduler tuning nodes
echo "[NebuliX] Creating energy-aware scheduler tuning nodes" | tee /dev/kmsg
mkdir /dev/stune
mount -t cgroup none /dev/stune schedtune
mkdir /dev/stune/foreground
mkdir /dev/stune/background
mkdir /dev/stune/top-app
chown system system /dev/stune
chown system system /dev/stune/foreground
chown system system /dev/stune/background
chown system system /dev/stune/top-app
chown system system /dev/stune/tasks
chown system system /dev/stune/foreground/tasks
chown system system /dev/stune/background/tasks
chown system system /dev/stune/top-app/tasks
chmod 0664 /dev/stune/tasks
chmod 0664 /dev/stune/foreground/tasks
chmod 0664 /dev/stune/background/tasks
chmod 0664 /dev/stune/top-app/tasks
}
CREATE_EAS_TUNING_NODES;

CREATE_EAS_CGROUPS_STUNE_TUNING_NODES() {
# Create energy-aware scheduler tuning nodes
echo "[NebuliX] Creating energy-aware scheduler cgroup tuning nodes" | tee /dev/kmsg
mount -t tmpfs cgroups /sys/fs/cgroup
mkdir /sys/fs/cgroup/stune
mount -t cgroup -o schedtune stune /sys/fs/cgroup/stune
mkdir /sys/fs/cgroup/stune/foreground
mkdir /sys/fs/cgroup/stune/background
mkdir /sys/fs/cgroup/stune/top-app
mkdir /sys/fs/cgroup/stune/performance
chown system system /sys/fs/cgroup/stune
chown system system /sys/fs/cgroup/stune/foreground
chown system system /sys/fs/cgroup/stune/background
chown system system /sys/fs/cgroup/stune/top-app
chown system system /sys/fs/cgroup/stune/tasks
chown system system /sys/fs/cgroup/stune/foreground/tasks
chown system system /sys/fs/cgroup/stune/background/tasks
chown system system /sys/fs/cgroup/stune/top-app/tasks
chmod 0664 /sys/fs/cgroup/stune/tasks
chmod 0664 /sys/fs/cgroup/stune/foreground/tasks
chmod 0664 /sys/fs/cgroup/stune/background/tasks
chmod 0664 /sys/fs/cgroup/stune/top-app/tasks
chmod 0664 /sys/fs/cgroup/stune/performance/tasks
}
CREATE_EAS_CGROUPS_STUNE_TUNING_NODES;

CREATE_CPUSETS() {
# Make sure CPUSET is set right
echo "[NebuliX] Create CPUSET tuning nodes" | tee /dev/kmsg
mkdir /dev/cpuset
mount cpuset none /dev/cpuset
mkdir /dev/cpuset/foreground
write /dev/cpuset/foreground/cpus 0
write /dev/cpuset/foreground/mems 0
mkdir /dev/cpuset/foreground/boost
write /dev/cpuset/foreground/boost/cpus 0
write /dev/cpuset/foreground/boost/mems 0
mkdir /dev/cpuset/background
write /dev/cpuset/background/cpus 0
write /dev/cpuset/background/mems 0
# system-background is for system tasks that should only run on
# little cores, not on bigs
# to be used only by init, so don't change system-bg permissions
mkdir /dev/cpuset/system-background
write /dev/cpuset/system-background/cpus 0
write /dev/cpuset/system-background/mems 0
mkdir /dev/cpuset/top-app
write /dev/cpuset/top-app/cpus 0
write /dev/cpuset/top-app/mems 0
# change permissions for all cpusets we'll touch at runtime
chown system system /dev/cpuset
chown system system /dev/cpuset/foreground
chown system system /dev/cpuset/foreground/boost
chown system system /dev/cpuset/background
chown system system /dev/cpuset/system-background
chown system system /dev/cpuset/top-app
chown system system /dev/cpuset/tasks
chown system system /dev/cpuset/foreground/tasks
chown system system /dev/cpuset/foreground/boost/tasks
chown system system /dev/cpuset/background/tasks
chown system system /dev/cpuset/system-background/tasks
chown system system /dev/cpuset/top-app/tasks
# set system-background to 0775 so SurfaceFlinger can touch it
chmod 0775 /dev/cpuset/system-background
chmod 0664 /dev/cpuset/foreground/tasks
chmod 0664 /dev/cpuset/foreground/boost/tasks
chmod 0664 /dev/cpuset/background/tasks
chmod 0664 /dev/cpuset/system-background/tasks
chmod 0664 /dev/cpuset/top-app/tasks
chmod 0664 /dev/cpuset/tasks
}
CREATE_CPUSETS;

SET_EAS_CGROUP_STUNE() {
echo "[NebuliX] Set stune tuning nodes" | tee /dev/kmsg
write /sys/fs/cgroup/stune/cgroup.clone_children 0
# write /sys/fs/cgroup/stune/cgroup.procs
write /sys/fs/cgroup/stune/cgroup.sane_behavior 1
write /sys/fs/cgroup/stune/notify_on_release 0
# write /sys/fs/cgroup/stune/release_agent
write /sys/fs/cgroup/stune/schedtune.boost 4
write /sys/fs/cgroup/stune/schedtune.prefer_idle 1
# write /sys/fs/cgroup/stune/tasks

### Perfomance ###
write /sys/fs/cgroup/stune/performance/cgroup.clone_children 0
# write /sys/fs/cgroup/stune/performance/cgroup.procs
write /sys/fs/cgroup/stune/performance/notify_on_release 0
write /sys/fs/cgroup/stune/performance/schedtune.boost 100
write /sys/fs/cgroup/stune/performance/schedtune.prefer_idle 0
# write /sys/fs/cgroup/stune/performance/tasks

write /proc/sys/kernel/sched_child_runs_first 0
write /proc/sys/kernel/sched_cstate_aware 1
write /proc/sys/kernel/sched_initial_task_util 0
write /proc/sys/kernel/sched_is_big_little 1
write /proc/sys/kernel/sched_latency_ns 10000000
write /proc/sys/kernel/sched_migration_cost_ns 500000
write /proc/sys/kernel/sched_min_granularity_ns 900000
write /proc/sys/kernel/sched_nr_migrate 24
write /proc/sys/kernel/sched_rr_timeslice_ms 10
write /proc/sys/kernel/sched_rt_period_us 1000000
write /proc/sys/kernel/sched_rt_runtime_us 950000
write /proc/sys/kernel/sched_shares_window_ns 10000000
write /proc/sys/kernel/sched_sync_hint_enable 1
write /proc/sys/kernel/sched_time_avg_ms 1000
write /proc/sys/kernel/sched_tunable_scaling 0
write /proc/sys/kernel/sched_use_walt_cpu_util 1
write /proc/sys/kernel/sched_use_walt_task_util 1
write /proc/sys/kernel/sched_wakeup_granularity_ns 250000
write /proc/sys/kernel/sched_walt_cpu_high_irqload 10000000
write /proc/sys/kernel/sched_walt_init_task_load_pct 10
}
SET_EAS_CGROUP_STUNE;

SET_CPUSETS() {
# Update foreground and background cpusets
echo "[NebuliX] Set CPUSETS configurations" | tee /dev/kmsg
write /dev/cpuset/foreground/cpus 0-3
write /dev/cpuset/foreground/boost/cpus 0-3
write /dev/cpuset/background/cpus 0-3
write /dev/cpuset/system-background/cpus 0-3
write /dev/cpuset/top-app/cpus 0-3
# set default schedTune value for foreground/top-app (only affects EAS)
write /dev/stune/foreground/schedtune.prefer_idle 1
write /dev/stune/schedtune.boost 20
write /dev/stune/schedtune.prefer_idle 1
}
SET_CPUSETS;

SIMPLE_THERMAL_DISABLE() {
# disable thermal hotplug to switch governor
echo "[Nebulix] disable thermal hotplug to switch governor" | tee /dev/kmsg
write /sys/kernel/msm_thermal/enabled 0
}
SIMPLE_THERMAL_DISABLE;

CPU_ONLINE() {
# bring back main cores CPU 0,2
echo "[Nebulix] Bring CPU0 and cpu2 Online" | tee /dev/kmsg
write /sys/devices/system/cpu/cpu0/online 1
write /sys/devices/system/cpu/cpu2/online 1
}
CPU_ONLINE;

CPU0_INTERACTIVE() {
echo "[Nebulix] CPU0 interactive Governor Settings" | tee /dev/kmsg
echo "[NebuliX] EAS: Configure governor settings for little cluster.." | tee /dev/kmsg
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "interactive"
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_sched_load 1
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/use_migration_notif 1
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay 19000
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load 90
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate 20000
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq 960000
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy 1
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads 80
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time 19000
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis 79000
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 307200
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/ignore_hispeed_on_notif 1
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/enable_prediction 1
}
CPU0_INTERACTIVE;

CPU0_CAP() {
# EAS: Capping the max frequency of silver core to 1.6GHz
echo "[Nebulix] CPU0 Capping Max Frequency Of Silver Core to 1.6GHz" | tee /dev/kmsg
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1593600
}
CPU0_CAP;

CPU2_INTERACTIVE() {
echo "[Nebulix] CPU2 interactive Governor Settings" | tee /dev/kmsg
echo "[NebuliX] EAS: Configure governor settings for big cluster.." | tee /dev/kmsg
write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "interactive"
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/use_sched_load 1
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/use_migration_notif 1
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/above_hispeed_delay "19000 1400000:39000 1700000:19000 2100000:79000"
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/go_hispeed_load 90
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/timer_rate 20000
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/hispeed_freq 1248000
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/io_is_busy 1
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/target_loads "85 1500000:90 1800000:70 2100000:95"
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/min_sample_time 19000
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/max_freq_hysteresis 79000
write /sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq 307200
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/ignore_hispeed_on_notif 1
write /sys/devices/system/cpu/cpu2/cpufreq/interactive/enable_prediction 1
}
CPU2_INTERACTIVE;

CPU_SWITCH_GOVERNOR() {
#	sleep 60
# if EAS is present, switch to sched governor (no effect if not EAS)
echo "[Nebulix] EAS: Switch To < sched > governor" | tee /dev/kmsg
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "sched"
write /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor "sched"
}
CPU_SWITCH_GOVERNOR;

SIMPLE_THERMAL_ENABLE() {
# disable thermal hotplug to switch governor
echo "[Nebulix] Simple Thermal Enabled and set" | tee /dev/kmsg
# Set light thermal restrictions while optimizing apps
# [throttle_freq_LITTLE, throttle_freq_big, throttle_temp, unthrottle_temp]
write /sys/kernel/msm_thermal/zone0 "1478400 1920000 50 45"
write /sys/kernel/msm_thermal/zone1 "1478400 1824000 53 50"
write /sys/kernel/msm_thermal/zone2 "1401600 1824000 55 53"
write /sys/kernel/msm_thermal/zone3 "1324800 1824000 57 55"
write /sys/kernel/msm_thermal/zone4 "1324800 1708800 58 57"
write /sys/kernel/msm_thermal/zone5 "1324800 1555200 59 58"
write /sys/kernel/msm_thermal/zone6 "1324800 1324800 60 59"
write /sys/kernel/msm_thermal/zone7 "1190400 1248000 63 60"
write /sys/kernel/msm_thermal/zone8 "1036000 1036000 70 63"
write /sys/kernel/msm_thermal/enabled 1
}
SIMPLE_THERMAL_ENABLE;

CPU_BUS_DCVS() {
# Enable bus-dcvs
echo "[Nebulix] Configure bus-dcvs" | tee /dev/kmsg
for cpubw in /sys/class/devfreq/*qcom,cpubw* ; do
write $cpubw/governor "bw_hwmon"
write $cpubw/polling_interval 50
write $cpubw/min_freq 1525
write $cpubw/bw_hwmon/mbps_zones "1525 5195 11863 13763"
write $cpubw/bw_hwmon/sample_ms 4
write $cpubw/bw_hwmon/io_percent 34
write $cpubw/bw_hwmon/hist_memory 20
write $cpubw/bw_hwmon/hyst_length 10
write $cpubw/bw_hwmon/low_power_ceil_mbps 0
write $cpubw/bw_hwmon/low_power_io_percent 34
write $cpubw/bw_hwmon/low_power_delay 20
write $cpubw/bw_hwmon/guard_band_mbps 0
write $cpubw/bw_hwmon/up_scale 250
write $cpubw/bw_hwmon/idle_mbps 1600
done
}
CPU_BUS_DCVS;

CPU_MEMLAT() {
# Enable memlat
echo "[Nebulix] Configure memlat" | tee /dev/kmsg
for memlat in /sys/class/devfreq/*qcom,memlat-cpu* ; do
write $memlat/governor "mem_latency"
write $memlat/polling_interval 10
done
}
CPU_MEMLAT;

LPM_ENABLE() {
# Enable all LPMs by default
# This will enable C4, D4, D3, E4 and M3 LPMs
echo "[Nebulix] Enable all LPMs by default" | tee /dev/kmsg
write /sys/module/lpm_levels/parameters/sleep_disabled N
}
LPM_ENABLE;

SET_LMK() {
echo "[NebuliX] EAS Enable Adaptive LMK........" | tee /dev/kmsg
write /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk 1
write /sys/module/lowmemorykiller/parameters/vmpressure_file_min 81250
}
SET_LMK;

SET_SCHED_READ_AHEAD() {
echo "[NebuliX] EAS Scheduler and Read Ahead........." | tee /dev/kmsg
write /sys/block/mmcblk0/queue/scheduler fiops
write /sys/block/mmcblk0/bdi/read_ahead_kb 512
}
SET_SCHED_READ_AHEAD;

SET_VM_TUNING() {
echo "[NebuliX] EAS VM Tuning.........." | tee /dev/kmsg
write /proc/sys/vm/dirty_background_ratio 20
write /proc/sys/vm/dirty_expire_centisecs 200
write /proc/sys/vm/dirty_ratio 40
write /proc/sys/vm/swappiness 0
write /proc/sys/vm/vfs_cache_pressure 100
}
SET_VM_TUNING;

SET_GPU_POWERLEVEL() {
echo "[NebuliX] Set Defaut GPU Power Level" | tee /dev/kmsg
write /sys/class/kgsl/kgsl-3d0/default_pwrlevel 6
}
SET_GPU_POWERLEVEL;

# -----------------------------------------------------------------------------------------#

# Input boost configuration
#	echo "[NebuliX] EAS: Input Boost Configuration......" | tee /dev/kmsg
# write /sys/module/cpu_boost/parameters/input_boost_freq "0:1113600 2:960000"
# write /sys/module/cpu_boost/parameters/input_boost_ms 1000

# Misc Mods
MISC(){
write /sys/module/sync/parameters/fsync_enabled 0
write /sys/module/mdss_fb/parameters/backlight_dimmer 0
write /sys/module/hall_sensor/parameters/disable_cover 0
write /sys/homebutton/enable 0
write /sys/class/leds/button-backlight/bln 0
write /sys/block/mmcblk0/queue/scheduler cfq
}
#MISC;

#
# Stop Google Service and restart it on boot
# This removes high CPU load and ram leak!
#
GOOGLE_RELATED() {
if [ "$($BB pidof com.google.android.gms | wc -l)" -eq "1" ]; then
$BB kill $($BB pidof com.google.android.gms);
fi;
if [ "$($BB pidof com.google.android.gms.unstable | wc -l)" -eq "1" ]; then
$BB kill $($BB pidof com.google.android.gms.unstable);
fi;
if [ "$($BB pidof com.google.android.gms.persistent | wc -l)" -eq "1" ]; then
$BB kill $($BB pidof com.google.android.gms.persistent);
fi;
if [ "$($BB pidof com.google.android.gms.wearable | wc -l)" -eq "1" ]; then
$BB kill $($BB pidof com.google.android.gms.wearable);
fi;
echo "[Nebulix] Google Services have been temp killed" | tee /dev/kmsg
}
GOOGLE_RELATED;

# remount sysfs+sdcard with noatime,nodiratime since that's all they accept
REMOUNTS() {
$BB mount -o remount,nosuid,nodev,noatime,nodiratime -t auto /;
$BB mount -o remount,nosuid,nodev,noatime,nodiratime -t auto /proc;
$BB mount -o remount,nosuid,nodev,noatime,nodiratime -t auto /sys;
$BB mount -o remount,nosuid,nodev,noatime,nodiratime -t auto /sys/kernel/debug;
echo "[Nebulix] Remounted sysfs+sdcard With noatime, nodiratime" | tee /dev/kmsg
}
# REMOUNTS;

sleep 3

# fix permissions for any included governors (and older underlying ramdisks)
GOV_FIX() {
governor=reset;
while sleep 3; do
current=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`;
if [ $governor != $current ]; then
governor=$current;
for i in /sys/devices/system/cpu/cpufreq/*; do
$BB chown system:system $i/*;
$BB chmod 664 $i/*;
done;
fi;
done&
echo "[NebuliX] fix permissions for any included governors (and older underlying ramdisks)" | tee /dev/kmsg
}
GOV_FIX;

BATTERY_DATA_FIX() {
dumpsys battery unplug
dumpsys battery reset
echo "[Nebulix] Fix Battery Data By Resetting it.." | tee /dev/kmsg
}
BATTERY_DATA_FIX;

###########################################################################################
##### EAS END #####
###########################################################################################

$BB echo "[NebuliX] Boot Script Completed!" | tee /dev/kmsg
$BB echo "-----------------------------------------------------------" | tee /dev/kmsg
$BB echo "nebulix-post_boot.sh Finished Loading" "$(date)" >> $LOG;

$BB mount -o remount,ro /system;

exit 0