summaryrefstree
path: root/bootimg/ramdisk/init.common.rc
blob: 409e9136e04edcd3071f0e825192566ceed385db (plain)
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# Originally device/intel/common/init.common.rc

import /init.watchdog.rc
import /init.firmware.rc
import /init.ksm.rc
import /init.readahead.rc
import /init.dirtybackground.rc
import /init.silentlake.rc
import /init.zram.rc

on early-init
    # set permission for charger-mode
    chmod 0750 /charger
    chown system system /dev/dri/card0
    chmod 0666 /dev/dri/card0
    symlink /dev/dri/card0 /dev/card0
    # Enable native bridge for target executables
    mount binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
    #  Mount debugfs for systrace settings
    mount debugfs none /sys/kernel/debug mode=0755

on init
    mkdir /mnt/shell 0700 shell shell

    # set usb serial number
    write /sys/class/android_usb/android0/iSerial ${ro.serialno}

    # support legacy paths
    symlink /sdcard /mnt/sdcard
    symlink /sdcard /storage/sdcard0

on boot
    #Change mmc queue nr_requests from 128 to 32 to reduce write latencies
    write /sys/block/mmcblk0/queue/nr_requests 32


# Change TCP Net-Core buffers sizes to improve cellular data throughput
     write /proc/sys/net/core/rmem_default 1048576
     write /proc/sys/net/core/rmem_max 2097152
     write /proc/sys/net/core/wmem_max 1048576

    #Set freezing timeout value as 2000ms
    write /sys/power/pm_freeze_timeout 2000

on fs
    mkdir /factory 0775 system system
    mkdir /config 0775 system system
    mkdir /media 0775 media media
    mount_all /fstab
    mkdir /config/wifi
    chown system wifi /config/wifi
    chmod 0770 /config/wifi
    mkdir /config/em
    chown system system /config/em
    chmod 0770 /config/em
    chown system system /sys/class/usb_otg/otg0/a_bus_drop
    restorecon_recursive /config
    restorecon_recursive /factory
    restorecon_recursive /logs

on post-fs
# create virtual SD card at /mnt/sdcard, based on the /data/media directory
# daemon will drop to user/group system/media_rw after initializing
# underlying files in /data/media will be created with user and group media_rw (1023)

# Performance tweaks for interactive governor
    chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
    chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
    chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
    chown system system /sys/devices/system/cpu/cpufreq/interactive/touchboostpulse
    chown system system /sys/devices/system/cpu/cpufreq/interactive/touchboostpulse_duration
    chown system system /sys/devices/system/cpu/cpufreq/interactive/touchboost_freq
    chmod 0220 /sys/devices/system/cpu/cpufreq/interactive/touchboostpulse
    chmod 0220 /sys/devices/system/cpu/cpufreq/interactive/boostpulse
    write /sys/devices/system/cpu/cpufreq/interactive/irq_load_threshold 2

on post-fs-data
    mkdir /data/system/ 0770 system system
    write /proc/sys/kernel/ctrl-alt-del 0

    mkdir /mnt/asec/media 0770 media media

    # Disable data roaming option enabled by default
    setprop ro.com.android.dataroaming false

    # Set indication (checked by vold) that we have finished this action
    setprop vold.post_fs_data_done 1

    # Set this property to force the camera shutter sound to play on speaker
    setprop ro.camera.sound.forced 1

    # Set this property to avoid fm rx to be muted
    setprop ro.fmrx.sound.forced 1

    chown system system /sys/class/drm/card0/gt_max_freq_mhz

    # Collect panic data systematically
    copy /proc/emmc_ipanic_header /data/dontpanic/emmc_ipanic_header
    chown root log /data/dontpanic/emmc_ipanic_header
    chmod 0640 /data/dontpanic/emmc_ipanic_header

    copy /proc/emmc_ipanic_console /data/dontpanic/emmc_ipanic_console
    chown root log /data/dontpanic/emmc_ipanic_console
    chmod 0640 /data/dontpanic/emmc_ipanic_console

    copy /proc/emmc_ipanic_threads /data/dontpanic/emmc_ipanic_threads
    chown root log /data/dontpanic/emmc_ipanic_threads
    chmod 0640 /data/dontpanic/emmc_ipanic_threads

    copy /proc/emmc_ipanic_gbuffer /data/dontpanic/emmc_ipanic_gbuffer
    chown root log /data/dontpanic/emmc_ipanic_gbuffer
    chmod 0640 /data/dontpanic/emmc_ipanic_gbuffer

on property:sys.boot_completed=1
    start bcu_cpufreqrel

on charger
    #set properties in COS
    start intel_prop

    setprop thermal.lite.crash 0

    chown system system /dev/dri/card0
    chmod 0666 /dev/dri/card0
    symlink /dev/dri/card0 /dev/card0

    # The permissions below should be tighter.
    chown system system /dev/card0

    #default setting to enable charging in COS
    setprop sys.usb.config charging

    start thermald

    trigger firmware_mounts_complete

service thermald /sbin/thermald
    class core
    disabled
    user root
    seclabel u:r:thermald:s0

service bcu_cpufreqrel /system/bin/bcu_cpufreqrel
    group system
    oneshot
    disabled

service ct_monitor /system/bin/ct_monitor
    class core
    oneshot
    user root

service charger_app /charger
    class charger
    user root
    seclabel u:r:healthd:s0

# Enable native bridge for target executables
on property:ro.enable.native.bridge.exec=1
    copy /system/vendor/etc/binfmt_misc/arm_exe /proc/sys/fs/binfmt_misc/register
    copy /system/vendor/etc/binfmt_misc/arm_dyn /proc/sys/fs/binfmt_misc/register

on property:ro.enable.native.bridge.exec64=1
    copy /system/vendor/etc/binfmt_misc/arm64_exe /proc/sys/fs/binfmt_misc/register
    copy /system/vendor/etc/binfmt_misc/arm64_dyn /proc/sys/fs/binfmt_misc/register

# This property trigger has added to imitiate the previous behavior of "adb root".
# The adb gadget driver used to reset the USB bus when the adbd daemon exited,
# and the host side adb relied on this behavior to force it to reconnect with the
# new adbd instance after init relaunches it. So now we force the USB bus to reset
# here when adbd sets the service.adb.root property to 1.  We also restart adbd here
# rather than waiting for init to notice its death and restarting it so the timing
# of USB resetting and adb restarting more closely matches the previous behavior.
on property:service.adb.root=1
    write /sys/class/android_usb/android0/enable 0
    restart adbd
    write /sys/class/android_usb/android0/enable 1

on property:sys.property_forcedshutdown=1
    write /sys/module/intel_mid_osip/parameters/force_shutdown_occured 1

on property:sys.shutdown.requested=0
    write /sys/devices/virtual/misc/watchdog/shutdown_ongoing 1

on property:sys.shutdown.requested=1
    write /sys/devices/virtual/misc/watchdog/reboot_ongoing 1

on property:sys.shutdown.requested=1recovery
    write /sys/devices/virtual/misc/watchdog/reboot_ongoing 1

on property:sys.shutdown.requested=1bootloader
    write /sys/devices/virtual/misc/watchdog/reboot_ongoing 1

# bugreport is triggered by holding down volume down, volume up and power
service bugreport /system/bin/dumpstate -d -p -B \
        -o /data/data/com.android.shell/files/bugreports/bugreport
    class main
    disabled
    oneshot
    keycodes 114 115 116