[Android Apps and Games] frap129:
How to add Spectrum support to your kernel:

Original documentation: GitHub

You'll need to add these 2 files to your devices ramdisk:

init.spectrum.rc

init.spectrum.sh

These files can be found on Github https://github.com/frap129/spectrum/tree/master/ramdisk

Now we have to include these ramdisk files. To do this, add

import /init.spectrum.rc

to the top of your devices main ramdisk file, usually called init.DEVICENAME.rc.

Next let's add your kernel name to the app. Open init.spectrum.rc and change "Electron" in

setprop persist.spectrum.kernel Electron

to your kernel's name.

Now just customize the 4 profiles in init.spectrum.rc to your liking! Profile 0 (Balanced) is the default, however, this can be changed in init.spectrum.sh. Here's my init.spectrum.rc file as an example:

# SPECTRUM KERNEL MANAGER
# Ramdisk file for profile based kernel management
# Implimentation inspired by Franco's fku profiles

# Initialization
on property:sys.boot_completed=1
# Set default profile on first boot
exec u:r:init:s0 root root -- /init.profiles.sh
exec u:r:su:s0 root root -- /init.profiles.sh
# Enable Spectrum support
setprop spectrum.support 1

# Balance (default profile)
on property:persist.spectrum.profile=0
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor relaxed
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 302400
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1708000
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor chill
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 633600
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq 1958400
write /sys/module/cpu_boost/parameters/input_boost_enabled 1
write /sys/module/cpu_boost/parameters/input_boost_freq "0:960000 1:960000 2:960000 3:960000 4:0 5:0 6:0 7:0"
write /sys/module/cpu_boost/parameters/boost_ms 0
write /sys/module/cpu_boost/parameters/input_boost_ms 40
write /sys/module/cpu_boost/parameters/migration_load_threshold 15
write /sys/module/cpu_boost/parameters/sync_threshold 0
write /sys/module/msm_performance/parameters/touchboost 0
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/boost_count 5
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/boost_ceiling 10
write /sys/devices/system/cpu/cpu4/cpufreq/chill/boost_count 10
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/freq_step 6
write /sys/devices/system/cpu/cpu4/cpufreq/chill/freq_step 4
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/down_threshold 60
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/down_threshold_suspended 85
write /sys/devices/system/cpu/cpu4/cpufreq/chill/down_threshold 75
write /sys/devices/system/cpu/cpu4/cpufreq/chill/down_threshold_suspended 99
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/up_threshold 70
write /sys/devices/system/cpu/cpu4/cpufreq/chill/up_threshold 90
write /sys/class/leds/lcd-backlight/max_brightness 255
write /sys/class/kgsl/kgsl-3d0/devfreq/governor msm-adreno-tz
write /sys/module/adreno_idler/parameters/adreno_idler_active 1
write /dev/cpuset/foreground/cpus 0-2,4-7
write /dev/cpuset/foreground/boost/cpus 4-7
write /dev/cpuset/top-app/cpus 0-7
write /sys/module/lazyplug/parameters/nr_possible_cores 8

# Performance (based on DrunkSauce Lite)
on property:persist.spectrum.profile=1
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 302400
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load 75
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay 0
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate 40000
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq 960000
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_slack -1
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads 80 384000:33 460800:25 600000:50 672000:65 787200:70 864000:85 960000:90 1248000:92
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time 50000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boost 1
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/align_windows 0
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis 166667
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor interactive
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 633600
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load 90
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay 0
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate 20000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq 1440000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_slack -1
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads 74 768000:73 864000:64 960000:80 1248000:61 1344000:69 1440000:64 1536000:74 1632000:69 1689600:67 1824000:72
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time 30000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boost 1
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/align_windows 0
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif 1
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load 1
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis 20000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boostpulse_duration 80000
write /sys/module/cpu_boost/parameters/input_boost_enabled 1
write /sys/module/cpu_boost/parameters/input_boost_freq "0:1248000 1:1248000 2:1248000 3:1248000 4:0 5:0 6:0 7:0"
write /sys/module/cpu_boost/parameters/boost_ms 80
write /sys/module/cpu_boost/parameters/input_boost_ms 420
write /sys/module/msm_performance/parameters/touchboost 0
write /sys/class/leds/lcd-backlight/max_brightness 255
write /sys/class/kgsl/kgsl-3d0/devfreq/governor msm-adreno-tz
write /sys/module/adreno_idler/parameters/adreno_idler_active 1
write /dev/cpuset/foreground/cpus 0-2,4-7
write /dev/cpuset/foreground/boost/cpus 4-7
write /dev/cpuset/top-app/cpus 0-7
write /sys/module/lazyplug/parameters/nr_possible_cores 8

# Battery
on property:persist.spectrum.profile=2
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor relaxed
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 302400
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1248000
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor relaxed
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 633600
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq 768000
write /sys/module/cpu_boost/parameters/input_boost_enabled 0
write /sys/module/cpu_boost/parameters/input_boost_freq "0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0"
write /sys/module/cpu_boost/parameters/boost_ms 0
write /sys/module/cpu_boost/parameters/input_boost_ms 40
write /sys/module/cpu_boost/parameters/migration_load_threshold 15
write /sys/module/cpu_boost/parameters/sync_threshold 0
write /sys/module/msm_performance/parameters/touchboost 0
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/boost_count 6
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/boost_ceiling 12
write /sys/devices/system/cpu/cpu4/cpufreq/chill/boost_count 12
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/freq_step 6
write /sys/devices/system/cpu/cpu4/cpufreq/chill/freq_step 4
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/down_threshold 70
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/down_threshold_suspended 85
write /sys/devices/system/cpu/cpu4/cpufreq/chill/down_threshold 75
write /sys/devices/system/cpu/cpu4/cpufreq/chill/down_threshold_suspended 99
write /sys/devices/system/cpu/cpu0/cpufreq/relaxed/up_threshold 75
write /sys/devices/system/cpu/cpu4/cpufreq/chill/up_threshold 90
write /sys/class/kgsl/kgsl-3d0/devfreq/governor powersave
write /sys/class/leds/lcd-backlight/max_brightness 100
write /dev/cpuset/foreground/cpus 0-2,4-5
write /dev/cpuset/foreground/boost/cpus 4-5
write /dev/cpuset/top-app/cpus 0-5
write /sys/module/lazyplug/parameters/nr_possible_cores 6

# Gaming
on property:persist.spectrum.profile=3
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 302400
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load 75
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay 0
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate 40000
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq 960000
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_slack -1
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads 80 384000:33 460800:25 600000:50 672000:65 787200:70 864000:85 960000:90 1248000:92
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time 50000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boost 1
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/align_windows 0
write /sys/devices/system/cpu/cpu0/cpufreq/interactive/max_freq_hysteresis 166667
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor interactive
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_min_freq 633600
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/go_hispeed_load 90
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/above_hispeed_delay 0
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_rate 20000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/hispeed_freq 1440000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/timer_slack -1
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/target_loads 74 768000:73 864000:64 960000:80 1248000:61 1344000:69 1440000:64 1536000:74 1632000:69 1689600:67 1824000:72
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/min_sample_time 30000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boost 1
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/align_windows 0
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_migration_notif 1
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/use_sched_load 1
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/max_freq_hysteresis 20000
write /sys/devices/system/cpu/cpu4/cpufreq/interactive/boostpulse_duration 80000
write /sys/module/cpu_boost/parameters/input_boost_enabled 1
write /sys/module/cpu_boost/parameters/input_boost_freq "0:1248000 1:1248000 2:1248000 3:1248000 4:0 5:0 6:0 7:0"
write /sys/module/cpu_boost/parameters/boost_ms 80
write /sys/module/cpu_boost/parameters/input_boost_ms 420
write /sys/module/msm_performance/parameters/touchboost 0
write /sys/class/leds/lcd-backlight/max_brightness 255
write /sys/class/kgsl/kgsl-3d0/devfreq/governor msm-adreno-tz
write /sys/module/adreno_idler/parameters/adreno_idler_active 0
write /dev/cpuset/foreground/cpus 0-2,4-7
write /dev/cpuset/foreground/boost/cpus 4-7
write /dev/cpuset/top-app/cpus 0-7
write /sys/module/lazyplug/parameters/nr_possible_cores 8

Recompile and your ready to go!

Some tips for profiles:

Make sure all profiles tweak the same parameters. Parameters don't get reset, when profile changes, so you have to make sure to change them back.

Not all profiles have to be complex! You could have one profile for your kernel and just use spectrum for minor tweaks