[Redmi Note 2 Android Development] unicunic8:
earlier apologize to ibilux master.

to deal with the processor jumping at will, which results in overheating, only for everyday use,

edit/delete n paste, file location ; /system/vendor/etc/init/hw/init.mt6795.rc

code ;

import /vendor/etc/init/hw/init.mt6795.usb.rc

on early-init

mount debugfs /sys/kernel/debug /sys/kernel/debug mode=755

start ueventd

on init

# Protect

mkdir /protect_f 0771 system system

mkdir /protect_s 0771 system system

# Kernel logs

chown root system /dev/kmsg

chmod 0660 /dev/kmsg

# change lk_env permission

chown root system /proc/lk_env

chmod 0660 /proc/lk_env

on fs

mount_all /vendor/etc/fstab.mt6795

on post-fs

# Internal storage

symlink /sdcard /storage/sdcard0

# Protect

chown system system /protect_f

chmod 0770 /protect_f

chown system system /protect_s

chmod 0770 /protect_s

on post-fs-data

# Create nvram folder

mkdir /data/nvram 0771 root system

mkdir /data/nvram/media 0771 media camera

copy /vendor/etc/fstab.mt6795 /data/nvram/fstab.mt6795

chown root system /data/nvram/fstab.mt6795

chmod 0644 /data/nvram/fstab.mt6795

# Create for muxd pts device node to operate without root

mkdir /dev/radio 0770 radio radio

write /proc/bootprof "post-fs-data: on modem start"

# GPS

mkdir /data/gps_mnl 0771 gps system

mkdir /data/misc/gps 0770 gps system

mkdir /data/agps_supl 0771 gps system

mkdir /data/vendor/gps 0770 gps system

chown gps gps /sys/class/gpsdrv/gps/pwrctl

chown gps gps /sys/class/gpsdrv/gps/suspend

chown gps gps /sys/class/gpsdrv/gps/state

chown gps gps /sys/class/gpsdrv/gps/pwrsave

chown gps gps /sys/class/gpsdrv/gps/status

# Watch dog kicker

write /proc/wdk "0 20 30"

# Set ptmx group to non-root

chown root radio /dev/ptmx

# Set mlock limit to infinate (for m4u operation)

setrlimit 8 -1 -1

# Sensors

chmod 0660 /dev/hwmsensor

chmod 0660 /dev/gyroscope

chmod 0660 /dev/gsensor

chmod 0660 /dev/als_ps

chmod 0660 /dev/aal_als

chown system system /dev/gyroscope

chown system system /dev/hwmsensor

chown system system /dev/gsensor

chown system system /dev/als_ps

chown system system /dev/aal_als

chmod 0660 /sys/class/misc/m_acc_misc/accenablenodata

chmod 0660 /sys/class/misc/m_acc_misc/accactive

chmod 0660 /sys/class/misc/m_acc_misc/accdelay

chmod 0660 /sys/class/misc/m_acc_misc/accbatch

chmod 0660 /sys/class/misc/m_acc_misc/accflush

chown system system /sys/class/misc/m_acc_misc/accenablenodata

chown system system /sys/class/misc/m_acc_misc/accactive

chown system system /sys/class/misc/m_acc_misc/accdelay

chown system system /sys/class/misc/m_acc_misc/accbatch

chown system system /sys/class/misc/m_acc_misc/accflush

chmod 0660 /sys/class/misc/m_alsps_misc/alsactive

chmod 0660 /sys/class/misc/m_alsps_misc/alsdelay

chmod 0660 /sys/class/misc/m_alsps_misc/alsbatch

chmod 0660 /sys/class/misc/m_alsps_misc/alsflush

chmod 0660 /sys/class/misc/m_alsps_misc/psactive

chmod 0660 /sys/class/misc/m_alsps_misc/psdelay

chmod 0660 /sys/class/misc/m_alsps_misc/psbatch

chmod 0660 /sys/class/misc/m_alsps_misc/psflush

chown system system /sys/class/misc/m_alsps_misc/alsactive

chown system system /sys/class/misc/m_alsps_misc/alsdelay

chown system system /sys/class/misc/m_alsps_misc/alsbatch

chown system system /sys/class/misc/m_alsps_misc/alsflush

chown system system /sys/class/misc/m_alsps_misc/psactive

chown system system /sys/class/misc/m_alsps_misc/psdelay

chown system system /sys/class/misc/m_alsps_misc/psbatch

chown system system /sys/class/misc/m_alsps_misc/psflush

chmod 0660 /sys/class/misc/m_gyro_misc/gyroenablenodata

chmod 0660 /sys/class/misc/m_gyro_misc/gyroactive

chmod 0660 /sys/class/misc/m_gyro_misc/gyrodelay

chmod 0660 /sys/class/misc/m_gyro_misc/gyrobatch

chmod 0660 /sys/class/misc/m_gyro_misc/gyroflush

chown system system /sys/class/misc/m_gyro_misc/gyroenablenodata

chown system system /sys/class/misc/m_gyro_misc/gyroactive

chown system system /sys/class/misc/m_gyro_misc/gyrodelay

chown system system /sys/class/misc/m_gyro_misc/gyrobatch

chown system system /sys/class/misc/m_gyro_misc/gyroflush

chmod 0660 /sys/class/misc/m_mag_misc/magactive

chmod 0660 /sys/class/misc/m_mag_misc/magdelay

chmod 0660 /sys/class/misc/m_mag_misc/magbatch

chmod 0660 /sys/class/misc/m_mag_misc/magflush

chmod 0660 /sys/class/misc/m_mag_misc/magoactive

chmod 0660 /sys/class/misc/m_mag_misc/magodelay

chmod 0660 /sys/class/misc/m_mag_misc/magobatch

chmod 0660 /sys/class/misc/m_mag_misc/magoflush

chown system system /sys/class/misc/m_mag_misc/magactive

chown system system /sys/class/misc/m_mag_misc/magdelay

chown system system /sys/class/misc/m_mag_misc/magbatch

chown system system /sys/class/misc/m_mag_misc/magflush

chown system system /sys/class/misc/m_mag_misc/magoactive

chown system system /sys/class/misc/m_mag_misc/magodelay

chown system system /sys/class/misc/m_mag_misc/magobatch

chown system system /sys/class/misc/m_mag_misc/magoflush

chmod 0660 /sys/class/misc/m_step_c_misc/step_cenablenodata

chmod 0660 /sys/class/misc/m_step_c_misc/step_cactive

chmod 0660 /sys/class/misc/m_step_c_misc/step_cdelay

chmod 0660 /sys/class/misc/m_step_c_misc/step_cbatch

chmod 0660 /sys/class/misc/m_step_c_misc/step_cflush

chown system system /sys/class/misc/m_step_c_misc/step_cenablenodata

chown system system /sys/class/misc/m_step_c_misc/step_cactive

chown system system /sys/class/misc/m_step_c_misc/step_cdelay

chown system system /sys/class/misc/m_step_c_misc/step_cbatch

chown system system /sys/class/misc/m_step_c_misc/step_cflush

# VideoCodec

chmod 0666 /dev/Vcodec

chown system media /dev/Vcodec

chmod 0664 /proc/mcdi/sodi_en

chown media /proc/mcdi/sodi_en

# MJC

chmod 0666 /dev/MJC

chown system media /dev/MJC

# Boot mode

chmod 0666 /sys/class/BOOT/BOOT/boot/boot_mode

chown system system /sys/class/BOOT/BOOT/boot/boot_mode

# Graphic

chmod 0660 /dev/mtk_disp_mgr

chmod 0666 /dev/sw_sync

chmod 0660 /sys/devices/platform/mtk_disp_mgr.0/rgb

chown system graphics /dev/mtk_disp_mgr

chown system graphics /dev/sw_sync

chown system system /sys/devices/platform/mtk_disp_mgr.0/rgb

# Autok

chown root system /sys/autok/debug

chown root system /sys/autok/param_count

chown root system /sys/autok/ready

chown root system /sys/autok/ss_corner

chown root system /sys/autok/suggest_vol

chown root system /sys/autok/stage1/3/DONE

chown root system /sys/autok/stage1/3/PARAMS

chown root system /sys/autok/stage1/3/VOLTAGE

chown root system /sys/autok/stage1/3/LOG

chown root system /sys/autok/stage2/3

# Device info /proc interface

chmod 0666 /dev/devmap

chown root system /dev/devmap

# SMI

chmod 0666 /dev/MTK_SMI

chown system media /dev/MTK_SMI

chmod 0666 /sys/bus/platform/drivers/mem_bw_ctrl/concurrency_scenario

chown system media /sys/bus/platform/drivers/mem_bw_ctrl/concurrency_scenario

# MTK_SCHED

chmod 0660 /dev/mtk_sched

chown system media /dev/mtk_sched

# AGPS

restorecon_recursive /data/misc/gps

restorecon_recursive /data/vendor/gps

# /dev/ttyMT2 for Connectivity BT/FM/GPS usage

chmod 0660 /dev/ttyMT2

chown system system /dev/ttyMT2

#/dev/ttyMT1 for GPS 3337 usage

chmod 0660 /dev/ttyMT1

chown system system /dev/ttyMT1

# Thermal

mkdir /data/vendor/.tp 0775 system system

# Consumerir

chmod 0660 /dev/consumerir

chown system system /dev/consumerir

# Modem related nodes

mkdir /data/nvram/md 0770 root system

mkdir /data/ccci_cfg 0770 system radio

chown radio radio /sys/kernel/ccci/boot

# Selinux

restorecon /data/ccci_cfg

restorecon_recursive /protect_f

restorecon_recursive /protect_s

# Ignore permission check

write /data/ccci_cfg/md_new_ver.1 "flag"

chmod 0660 /data/ccci_cfg/md_new_ver.1

setprop vold.post_fs_data_done 1

# Clear the sim switch flag

setprop persist.radio.simswitch ""

on boot

# default is root radio 0440

chmod 0644 /proc/cmdline

write /proc/cpufreq/cpufreq_ptpod_temperature_time "1 5"

chown system system /proc/cpufreq/cpufreq_ptpod_temperature_time

chmod 444 /proc/cpufreq/cpufreq_ptpod_temperature_time

write /proc/cpufreq/cpufreq_ptpod_temperature_limit "60000 60000"

chown system system /proc/cpufreq/cpufreq_ptpod_temperature_limit

chmod 444 /proc/cpufreq/cpufreq_ptpod_temperature_limit

write /proc/sys/vm/dirty_writeback_centisecs 300

# Screen brightness

chmod 0664 /sys/class/leds/lcd-backlight/brightness

chown system system /sys/class/leds/lcd-backlight/brightness

# Buttons backlight

chmod 0664 /sys/class/leds/button-backlight/brightness

chown system system /sys/class/leds/button-backlight/brightness

# Leds

chown system system /sys/class/leds/red/brightness

chown system system /sys/class/leds/red/trigger

chown system system /sys/class/leds/green/brightness

chown system system /sys/class/leds/green/trigger

chown system system /sys/class/leds/blue/brightness

chown system system /sys/class/leds/blue/trigger

chown system system /sys/class/leds/yellow/brightness

chown system system /sys/class/leds/yellow/trigger

chown system system /sys/class/leds/white/brightness

chown system system /sys/class/leds/white/trigger

chown system system /sys/class/leds/cyan/brightness

chown system system /sys/class/leds/cyan/trigger

chown system system /sys/class/leds/violet/brightness

chown system system /sys/class/leds/violet/trigger

# RIL

chown radio system /sys/power/vcorefs/pwr_ctrl

# Perfservice

chown system system /proc/hps/num_base_perf_serv

chown system system /proc/hps/num_limit_power_serv

chown system system /proc/cpufreq/cpufreq_limited_by_hevc

chown system system /proc/cpufreq/cpufreq_limited_max_freq_by_user

chown system system /d/ged/hal/total_gpu_freq_level_count

chmod 0660 /d/ged/hal/total_gpu_freq_level_count

chown system system /d/ged/hal/custom_boost_gpu_freq

chmod 0660 /d/ged/hal/custom_boost_gpu_freq

chown system system /d/ged/hal/custom_upbound_gpu_freq

chmod 0660 /d/ged/hal/custom_upbound_gpu_freq

# change default prebuilt kernel settings

write /sys/module/alarm_dev/parameters/debug_mask 0

write /sys/module/alarmtimer/parameters/debug_mask 0

write /sys/module/binder/parameters/debug_mask 0

write /sys/module/earlysuspend/parameters/debug_mask 0

write /sys/module/sbsuspend/parameters/sbsuspend_debug_mask 0

write /sys/module/snd/parameters/debug 0

write /sys/module/pvrsrvkm/parameters/gPVRDebugLevel 0

write /sys/module/musb_hdrc/parameters/debug_level 0

write /sys/module/lowmemorykiller/parameters/debug_level 0

# WMT loader

chown shell system /proc/driver/wmt_aee

chown shell system /proc/driver/wmt_dbg

####### JUST SOME ADD ON FROM OLD TREE ##############

####### CHECK THIS FOR ANY BUGS ##############

# Boot info

chmod 0664 /proc/bootprof

chown system system /proc/bootprof

# BATTERY proc

chown radio system /proc/mtk_battery_cmd/current_cmd

chown radio system /proc/mtk_battery_cmd/discharging_cmd

chown radio system /proc/mtk_battery_cmd/battery_cmd

chmod 0664 /proc/mtk_battery_cmd/current_cmd

chmod 0664 /proc/mtk_battery_cmd/discharging_cmd

chmod 0664 /proc/mtk_battery_cmd/battery_cmd

# BT relayer mode used VCOM

chmod 0660 /dev/ttyGS2

chown bluetooth bluetooth /dev/ttyGS2

#Charging Battery

chown radio radio /sys/devices/platform/battery/Charging_CallState

#EM eint

#chown root diag /sys/bus/platform/drivers/eint/current_eint

#pmu

chown root radio /sys/devices/platform/mt-pmic/pmic_access

chmod 0664 /sys/devices/platform/mt-pmic/pmic_access

# Display

chmod 0660 /dev/graphics/fb0

chown system graphics /dev/graphics/fb0

# Perfservice

chown system system /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_base

chmod 0666 /sys/devices/system/cpu/cpufreq/hotplug/cpu_num_base

chown system system /proc/hps/num_base_perf_serv

chmod 0666 /proc/hps/num_base_perf_serv

chown system system /proc/hps/num_limit_power_serv

chmod 0666 /proc/hps/num_limit_power_serv

chown system system /proc/hps/rush_boost_enabled

chmod 0666 /proc/hps/rush_boost_enabled

chown system system /proc/cpufreq/cpufreq_limited_by_hevc

chmod 0666 /proc/cpufreq/cpufreq_limited_by_hevc

chown system system /proc/cpufreq/cpufreq_limited_max_freq_by_user

chmod 0666 /proc/cpufreq/cpufreq_limited_max_freq_by_user

chown system system /d/ged/hal/total_gpu_freq_level_count

chmod 0666 /d/ged/hal/total_gpu_freq_level_count

chown system system /d/ged/hal/custom_boost_gpu_freq

chmod 0666 /d/ged/hal/custom_boost_gpu_freq

chown system system /d/ged/hal/custom_upbound_gpu_freq

chmod 0666 /d/ged/hal/custom_upbound_gpu_freq