• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright 2015 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17import init.bullhead.usb.rc
18import init.bullhead.diag.rc
19import init.bullhead.fp.rc
20import init.bullhead.sensorhub.rc
21import init.bullhead.ramdump.rc
22
23on early-init
24    mount debugfs debugfs /sys/kernel/debug
25    chown system system /sys/kernel/debug/kgsl/proc
26
27on charger
28    # disable FPS clk
29    write /sys/bus/spi/drivers/fpc1020/spi1.2/clk_enable 0
30
31    # low power governing
32    write /sys/devices/system/cpu/cpu1/online 0
33    write /sys/devices/system/cpu/cpu2/online 0
34    write /sys/devices/system/cpu/cpu3/online 0
35    write /sys/devices/system/cpu/cpu4/online 0
36    write /sys/devices/system/cpu/cpu5/online 0
37    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave
38
39    # Disable CPU retention
40    write /sys/module/lpm_levels/system/a53/cpu0/retention/idle_enabled 0
41    write /sys/module/lpm_levels/system/a53/cpu1/retention/idle_enabled 0
42    write /sys/module/lpm_levels/system/a53/cpu2/retention/idle_enabled 0
43    write /sys/module/lpm_levels/system/a53/cpu3/retention/idle_enabled 0
44    write /sys/module/lpm_levels/system/a57/cpu4/retention/idle_enabled 0
45    write /sys/module/lpm_levels/system/a57/cpu5/retention/idle_enabled 0
46    # Disable L2 retention
47    write /sys/module/lpm_levels/system/a53/a53-l2-retention/idle_enabled 0
48    write /sys/module/lpm_levels/system/a57/a57-l2-retention/idle_enabled 0
49
50on property:sys.boot_completed=1
51    # allow CPUs to go in deeper idle state than C0
52    write /sys/module/lpm_levels/parameters/sleep_disabled 0
53
54on init
55    # Load persistent dm-verity state
56    verity_load_state
57
58    # Set permissions for persist partition
59    mkdir /persist 0771 system system
60    mkdir /firmware 0771 system system
61
62    # Support legacy paths
63    symlink /sdcard /mnt/sdcard
64    symlink /sdcard /storage/sdcard0
65
66    # NXP HAL expects /dev/pn54x
67    symlink /dev/pn548 /dev/pn54x
68
69    write /sys/block/zram0/comp_algorithm lz4
70    write /sys/block/zram0/max_comp_streams 4
71
72    write /proc/sys/vm/page-cluster 0
73
74on fs
75    mount_all ./fstab.bullhead
76    swapon_all ./fstab.bullhead
77
78    restorecon_recursive /persist
79
80on early-boot
81    # set RLIMIT_MEMLOCK to 64MB
82    setrlimit 8 67108864 67108864
83
84    # Allow subsystem (modem etc) debugging
85    write /sys/module/subsystem_restart/parameters/enable_debug ${persist.sys.ssr.enable_debug}
86    write /sys/module/pil_msa/parameters/pbl_mba_boot_timeout_ms ${persist.sys.mba_boot_timeout}
87    write /sys/module/pil_msa/parameters/modem_auth_timeout_ms ${persist.sys.modem_auth_timeout}
88    write /sys/module/peripheral_loader/parameters/proxy_timeout_ms ${persist.sys.pil_proxy_timeout}
89
90    # Adjust parameters for dm-verity device
91    write /sys/block/dm-0/queue/read_ahead_kb 2048
92
93    # Update dm-verity state and set partition.*.verified properties
94    verity_update_state
95
96on boot
97    symlink /dev/block/platform/soc.0/f9824900.sdhci /dev/block/bootdevice
98
99    # execute script to set initial CPU settings
100    # don't run as a service to avoid race conditions
101    exec - root root system -- /system/bin/init.bullhead.power.sh
102
103    # update foreground cpuset now that processors are up
104    write /dev/cpuset/foreground/cpus 0-5
105    write /dev/cpuset/foreground/boost/cpus 4-5
106    write /dev/cpuset/background/cpus 0
107    write /dev/cpuset/system-background/cpus 0-3
108
109    # Bluetooth
110    chown bluetooth net_bt /sys/class/rfkill/rfkill0/type
111    chown bluetooth net_bt /sys/class/rfkill/rfkill0/state
112    chmod 0660 /sys/class/rfkill/rfkill0/state
113    chown bluetooth net_bt /dev/ttyHS0
114    chmod 0660 /dev/ttyHS0
115    chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo
116    chmod 0660 /sys/class/rfkill/rfkill0/device/extldo
117
118    # Fingerprint
119    chown system system /sys/bus/spi/drivers/fpc1020/spi1.2/clk_enable
120    chown system system /sys/bus/spi/drivers/fpc1020/spi1.2/wakeup_enable
121    chown system system /sys/bus/spi/drivers/fpc1020/spi1.2/irq
122
123    # create symlink for fb1 as HDMI
124    symlink /dev/graphics/fb1 /dev/graphics/hdmi
125
126    # setup permissions for fb1 related nodes
127    chown system graphics /sys/class/graphics/fb1/hpd
128    chown system graphics /sys/class/graphics/fb1/vendor_name
129    chown system graphics /sys/class/graphics/fb1/product_description
130    chmod 0664 /sys/devices/virtual/graphics/fb1/hpd
131    chmod 0664 /sys/devices/virtual/graphics/fb1/vendor_name
132    chmod 0664 /sys/devices/virtual/graphics/fb1/product_description
133
134    # Allow QMUX daemon to assign port open wait time
135    chown radio radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait
136
137    #Create QMUX deamon socket area
138    mkdir /dev/socket/qmux_radio 0770 radio radio
139    chmod 2770 /dev/socket/qmux_radio
140    mkdir /dev/socket/qmux_audio 0770 media audio
141    chmod 2770 /dev/socket/qmux_audio
142    mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth
143    chmod 2770 /dev/socket/qmux_bluetooth
144    mkdir /dev/socket/qmux_gps 0770 gps gps
145    chmod 2770 /dev/socket/qmux_gps
146
147    # Subsytem Restart
148    write /sys/bus/msm_subsys/devices/subsys0/restart_level "related"
149    write /sys/bus/msm_subsys/devices/subsys1/restart_level "related"
150    write /sys/bus/msm_subsys/devices/subsys2/restart_level "related"
151    write /sys/bus/msm_subsys/devices/subsys3/restart_level "related"
152
153    # Subsytem Ramdump collection
154    write /sys/module/subsystem_restart/parameters/enable_ramdumps 1
155    write /sys/module/msm_poweroff/parameters/download_mode 0
156
157    # Adjust socket buffer to enlarge TCP receive window for high bandwidth
158    write /proc/sys/net/ipv4/tcp_adv_win_scale 1
159
160    # Assign TCP buffer thresholds to be ceiling value of technology maximums
161    # Increased technology maximums should be reflected here.
162    write /proc/sys/net/core/rmem_max  8388608
163    write /proc/sys/net/core/wmem_max  8388608
164
165    # Leds
166    chown system system /sys/class/leds/red/on_off_ms
167    chown system system /sys/class/leds/green/on_off_ms
168    chown system system /sys/class/leds/blue/on_off_ms
169    chown system system /sys/class/leds/red/rgb_start
170
171on post-fs-data
172    # Mark the copy complete flag to not completed
173    mkdir /data/misc/radio 0770 radio radio
174    write /data/misc/radio/copy_complete 0
175    chown radio radio /data/misc/radio/copy_complete
176    chmod 0660 /data/misc/radio/copy_complete
177
178    write /sys/kernel/boot_adsp/boot 1
179
180    #Update touch firmware if required
181    write /sys/bus/i2c/devices/2-0020/check_fw 1
182    write /sys/devices/soc.0/f9924000.i2c/power/control on
183
184    mkdir /persist/data 0700 system system
185    mkdir /persist/data/sfs 0700 system system
186    mkdir /persist/data/tz 0700 system system
187    mkdir /persist/data/app_g 0700 system system
188    mkdir /persist/widevine 0770 drm system
189
190    # Create /data/time folder for time-services
191    mkdir /data/time/ 0700 system system
192
193    # Create the directories used by CnE subsystem
194    mkdir /data/connectivity 0771 system system
195
196    # NFC: create data/nfc for nv storage
197    mkdir /data/nfc 0770 nfc nfc
198    mkdir /data/nfc/param 0770 nfc nfc
199
200    # use qcril.db to handle Ecc and load MBN
201    copy /system/etc/qcril.db /data/misc/radio/qcril.db
202    chown radio radio /data/misc/radio/qcril.db
203    chmod 0600 /data/misc/radio/qcril.db
204
205    # Create folder for mm-qcamera-daemon
206    mkdir /data/misc/camera 0770 camera camera
207
208    # change permission for ldaf
209    chown input system /persist/calibration
210    chmod 0650 /persist/calibration
211    chown input system /persist/calibration/offset
212    chmod 0640 /persist/calibration/offset
213    chown input system /persist/calibration/xtalk
214    chmod 0640 /persist/calibration/xtalk
215
216    #Create directories for Location services
217    mkdir /data/misc/location 0770 gps gps
218    mkdir /data/misc/location/mq 0770 gps gps
219    mkdir /data/misc/location/xtwifi 0770 gps gps
220    mkdir /data/misc/location/gpsone_d 0770 system gps
221
222    # Audio
223    mkdir /data/misc/audio 0770 audio audio
224
225    # perf daemon
226    mkdir /data/misc/perfd 0755 root system
227    chmod 2755 /data/misc/perfd
228    rm /data/misc/perfd/default_values
229
230    # Subsytem Ramdump collection
231    mkdir /data/ramdump 0700 root root
232
233    setprop vold.post_fs_data_done 1
234
235service irsc_util /system/bin/irsc_util "/etc/sec_config"
236    class main
237    user root
238    oneshot
239
240service rmt_storage /system/bin/rmt_storage
241    class core
242    user root
243    group system
244
245service start_hci_filter /system/bin/wcnss_filter
246    class late_start
247    user bluetooth
248    group bluetooth system
249    disabled
250
251on property:wc_transport.start_hci=true
252    start start_hci_filter
253
254on property:wc_transport.start_hci=false
255    stop start_hci_filter
256
257service dhcpcd_bt-pan /system/bin/dhcpcd -BKLG
258    disabled
259    oneshot
260
261service iprenew_bt-pan /system/bin/dhcpcd -n
262    disabled
263    oneshot
264
265# QMUX must be in multiple groups to support external process connections
266service qmuxd /system/bin/qmuxd
267    class main
268    user radio
269    group radio audio bluetooth gps
270
271service perfd /system/bin/perfd
272    class main
273    user root
274    group system
275    writepid /dev/cpuset/system-background/tasks
276
277service qti /system/vendor/bin/qti
278    class main
279    user radio
280    group radio net_raw diag usb net_admin
281
282service netmgrd /system/bin/netmgrd
283    class main
284    group radio system
285
286service per_mgr /system/bin/pm-service
287    class core
288    user system
289    group system net_raw
290
291service per_proxy /system/bin/pm-proxy
292    class core
293    user system
294    group system net_raw
295    disabled
296
297on property:init.svc.per_mgr=running
298    start per_proxy
299
300on property:sys.shutdown.requested=*
301    stop per_proxy
302
303on property:ro.boot.hardware.sku=LGH790
304    setprop ro.boot.wificountrycode US
305
306on property:ro.boot.hardware.sku=LGH791
307    setprop ro.boot.wificountrycode 00
308
309on property:ro.boot.hardware.sku=LGH791F
310    setprop ro.boot.wificountrycode 00
311
312on property:ro.boot.hardware.sku=LGH798
313    setprop ro.boot.wificountrycode 00
314
315service thermal-engine /system/bin/thermal-engine
316    class main
317    user root
318    socket thermal-send-client stream 0666 system system
319    socket thermal-recv-client stream 0660 system system
320    socket thermal-recv-passive-client stream 0666 system system
321    group root
322
323on property:init.svc.wpa_supplicant=stopped
324    stop dhcpcd
325
326service wpa_supplicant /system/bin/wpa_supplicant \
327    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
328    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
329    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
330    #   we will start as root and wpa_supplicant will switch to user wifi
331    #   after setting up the capabilities required for WEXT
332    #   user wifi
333    #   group wifi inet keystore
334    class main
335    socket wpa_wlan0 dgram 660 wifi wifi
336    disabled
337    oneshot
338
339service p2p_supplicant /system/bin/wpa_supplicant \
340    -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
341    -I/system/etc/wifi/p2p_supplicant_overlay.conf -N \
342    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
343    -I/system/etc/wifi/wpa_supplicant_overlay.conf \
344    -puse_p2p_group_interface=1 \
345    -e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
346#   we will start as root and wpa_supplicant will switch to user wifi
347#   after setting up the capabilities required for WEXT
348#   user wifi
349#   group wifi inet keystore
350    class main
351    socket wpa_wlan0 dgram 660 wifi wifi
352    disabled
353    oneshot
354
355service dhcpcd_wlan0 /system/bin/dhcpcd -aABDKL
356    class late_start
357    disabled
358    oneshot
359
360service dhcpcd_p2p /system/bin/dhcpcd -aABKL
361    class late_start
362    disabled
363    oneshot
364
365service iprenew_wlan0 /system/bin/dhcpcd -n
366    class late_start
367    disabled
368    oneshot
369
370service iprenew_p2p /system/bin/dhcpcd -n
371    class late_start
372    disabled
373    oneshot
374
375service dhcpcd_eth0 /system/bin/dhcpcd -aABDKL
376    class late_start
377    disabled
378    oneshot
379
380service iprenew_eth0 /system/bin/dhcpcd -n
381    class late_start
382    disabled
383    oneshot
384
385service loc_launcher /system/bin/loc_launcher
386    #loc_launcher will start as root and set its uid to gps
387    class late_start
388    group gps inet net_raw diag net_admin wifi
389
390service cnss-daemon /system/bin/cnss-daemon -n -l
391    class late_start
392
393service qseecomd /vendor/bin/qseecomd
394    class core
395    user root
396    group root
397
398service msm_irqbalance /system/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf
399    socket msm_irqbalance seqpacket 660 root system
400    class core
401    user root
402    group root
403    writepid /dev/cpuset/system-background/tasks
404
405service time_daemon /system/bin/time_daemon
406    class late_start
407    user root
408    group root
409
410service charger /sbin/healthd -c
411    class charger
412    critical
413    seclabel u:r:healthd:s0
414
415service qcamerasvr /vendor/bin/mm-qcamera-daemon
416    class late_start
417    user camera
418    group camera system inet input graphics
419    writepid /dev/cpuset/system-background/tasks
420
421on property:persist.radio.atfwd.start=false
422    stop atfwd
423
424service atfwd /system/bin/ATFWD-daemon
425    class late_start
426    user system
427    group system radio
428
429on property:ro.debuggable=1
430    start ss_ramdump
431
432service ss_ramdump /system/bin/subsystem_ramdump
433    class main
434    user root
435    group root system
436    disabled
437
438service cnd /system/bin/cnd
439    class late_start
440    socket cnd stream 660 root inet
441
442service imsqmidaemon /system/bin/imsqmidaemon
443    class main
444    user system
445    socket ims_qmid stream 0660 system radio
446    group radio net_raw log diag
447
448service imsdatadaemon /system/bin/imsdatadaemon
449    class main
450    user system
451    socket ims_datad stream 0660 system radio
452    group system wifi radio inet net_raw log diag net_admin
453    disabled
454
455on property:sys.ims.QMI_DAEMON_STATUS=1
456    start imsdatadaemon
457
458service imscmservice /system/bin/imscmservice
459    class main
460    user system
461    group radio net_raw diag log
462
463service bullhead-sh /system/bin/init.bullhead.sh
464    class late_start
465    user radio
466    group system
467    oneshot
468
469# bugreport is triggered by holding down volume down, volume up and power
470service bugreport /system/bin/dumpstate -d -p -B \
471        -o /data/data/com.android.shell/files/bugreports/bugreport
472    class main
473    disabled
474    oneshot
475    keycodes 114 115 116
476
477service fingerprintd /system/bin/fingerprintd
478    class late_start
479    user system
480    group system input
481
482