aboutsummaryrefslogtreecommitdiff
path: root/rootdir/etc/init.qti.kernel.rc
blob: a1f8c626c8ebd486f7dd0b0c633d85689721a0d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#=============================================================================
# Copyright (c) 2019-2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# Copyright (c) 2009-2012, 2014-2019, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of The Linux Foundation nor
#       the names of its contributors may be used to endorse or promote
#       products derived from this software without specific prior written
#       permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
import /vendor/etc/init/hw/init.qti.kernel.test.rc

on early-init
    mount debugfs debugfs /sys/kernel/debug
    chmod 0755 /sys/kernel/debug

    # Mount tracefs in /sys/kernel/tracing as CONFIG_DEBUG_FS might be
    # disabled and /sys/kernel/debug/tracing might not be available
    mount tracefs tracefs /sys/kernel/tracing
    chmod 0755 /sys/kernel/tracing

    chown root system /dev/kmsg
    chmod 0620 /dev/kmsg

    write /proc/sys/kernel/sched_boost 1

    write /proc/sys/kernel/firmware_config/force_sysfs_fallback 1

on init
    # Create cgroup mount point for memory
    mkdir /sys/fs/cgroup/memory/bg 0750 root system
    write /sys/fs/cgroup/memory/bg/memory.swappiness 140
    write /sys/fs/cgroup/memory/bg/memory.move_charge_at_immigrate 1
    chown root system /sys/fs/cgroup/memory/bg/tasks
    chmod 0660 /sys/fs/cgroup/memory/bg/tasks

    # update scheduler tunables
    write /dev/cpuctl/foreground/cpu.uclamp.sched_boost_no_override 1
    write /dev/cpuctl/top-app/cpu.uclamp.sched_boost_no_override 1
    write /dev/cpuctl/background/cpu.uclamp.colocate 0
    write /dev/cpuctl/foreground/cpu.uclamp.colocate 0
    write /dev/cpuctl/top-app/cpu.uclamp.colocate 1

on post-fs
    chmod 0755 /sys/kernel/debug/tracing

    # set aggressive read ahead for dm-0 and dm-1 during boot up
    write /sys/block/dm-0/queue/read_ahead_kb 2048
    write /sys/block/dm-1/queue/read_ahead_kb 2048
    write /sys/block/dm-2/queue/read_ahead_kb 2048

on early-boot
    # Allow subsystem (modem etc) debugging
    write /sys/kernel/boot_adsp/boot 1
    write /sys/kernel/boot_cdsp/boot 1
    write /sys/kernel/boot_slpi/boot 1
    write /sys/devices/virtual/cvp/cvp/boot 1

on boot
    # Set the console loglevel to < KERN_WARN
    # Set the default message loglevel to KERN_INFO
    write /proc/sys/kernel/printk "4 6 1 7"

    # Allow access to emmc rawdump block partition and dload sysfs node
    chown root system /dev/block/bootdevice/by-name/rawdump
    chmod 0660 /dev/block/bootdevice/by-name/rawdump
    chown root system /sys/kernel/dload/emmc_dload
    chmod 0660 /sys/kernel/dload/emmc_dload
    chown root system /dev/block/bootdevice/by-name/ramdump
    chmod 0660 /dev/block/bootdevice/by-name/ramdump
    chown root system /sys/kernel/dload/dload_mode
    chmod 0660 /sys/kernel/dload/dload_mode

    # set the io-scheduler to bfq on all mq support devices
    write /sys/block/sda/queue/scheduler bfq
    write /sys/block/sdb/queue/scheduler bfq
    write /sys/block/sdc/queue/scheduler bfq
    write /sys/block/sdd/queue/scheduler bfq
    write /sys/block/sde/queue/scheduler bfq
    write /sys/block/sdf/queue/scheduler bfq
    write /sys/block/sdg/queue/scheduler bfq
    write /sys/block/sdh/queue/scheduler bfq
    write /sys/class/block/mmcblk0/queue/scheduler bfq
    write /sys/class/block/mmcblk1/queue/scheduler bfq

    # update io-scheduler tunables
    write /sys/block/sda/queue/iosched/slice_idle 0
    write /sys/block/sdb/queue/iosched/slice_idle 0
    write /sys/block/sdc/queue/iosched/slice_idle 0
    write /sys/block/sdd/queue/iosched/slice_idle 0
    write /sys/block/sde/queue/iosched/slice_idle 0
    write /sys/block/sdf/queue/iosched/slice_idle 0
    write /sys/block/sdg/queue/iosched/slice_idle 0
    write /sys/block/sdh/queue/iosched/slice_idle 0
    write /sys/class/block/mmcblk0/queue/iosched/slice_idle 0
    write /sys/class/block/mmcblk1/queue/iosched/slice_idle 0

on post-fs-data
    # Create directory used for dump collection
    mkdir /data/vendor/ssrdump 0770 root system

on property:persist.sys.ssr.enable_debug=*
    write /sys/module/subsys_pil_tz/parameters/enable_debug ${persist.sys.ssr.enable_debug}

on property:persist.sys.mba_boot_timeout=*
    write /sys/module/pil_msa/parameters/pbl_mba_boot_timeout_ms ${persist.sys.mba_boot_timeout}

on property:persist.sys.modem_auth_timeout=*
    write /sys/module/pil_msa/parameters/modem_auth_timeout_ms ${persist.sys.modem_auth_timeout}

on property:persist.sys.pil_proxy_timeout=*
    write /sys/module/peripheral_loader/parameters/proxy_timeout_ms ${persist.sys.pil_proxy_timeout}

on property:persist.vendor.ssr.enable_ramdumps=1
    write /sys/module/subsystem_restart/parameters/enable_ramdumps 1

on property:persist.vendor.ssr.enable_ramdumps=0
    write /sys/module/subsystem_restart/parameters/enable_ramdumps 0

on property:persist.vendor.sys.rawdump_copy=1
    write /sys/kernel/dload/emmc_dload 1

on property:persist.vendor.sys.rawdump_copy=0
    write /sys/kernel/dload/emmc_dload 0

service kernel-boot /vendor/bin/sh /vendor/bin/init.qti.kernel.sh
    class core
    user root
    group root
    disabled
    oneshot

service kernel-post-boot /vendor/bin/sh /vendor/bin/init.kernel.post_boot.sh
    class core
    user root
    group root system wakelock graphics
    disabled
    oneshot

on property:sys.boot_completed=1
    write /dev/kmsg "Boot completed "
    #Reset read ahead for dm-0, dm-1 and dm-2 to 512kb
    write /sys/block/dm-0/queue/read_ahead_kb 512
    write /sys/block/dm-1/queue/read_ahead_kb 512
    write /sys/block/dm-2/queue/read_ahead_kb 512
    write /proc/sys/vm/page-cluster 0
    start kernel-boot
    start kernel-post-boot

service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /system/vendor/etc/msm_irqbalance.conf
    class core
    user root
    group root
    disabled