1on early-init
2#    loglevel 8
3    mkdir /var/run 0755 root root
4    mkdir /var/run/media 0755 media root
5    mkdir /var/run/system 0755 system root
6    mkdir /dev/gce 0750
7    chown system system /dev/gce
8
9    mount securityfs securityfs /sys/kernel/security
10
11    # For KCOV
12    mount debugfs debugfs /sys/kernel/debug
13    chmod 0755 /sys/kernel/debug
14
15    setprop ro.sf.lcd_density ${ro.boot.lcd_density}
16    setprop ro.hardware.egl ${ro.boot.hardware.egl}
17    setprop ro.hardware.gralloc ${ro.boot.hardware.gralloc}
18    setprop ro.hardware.hwcomposer ${ro.boot.hardware.hwcomposer}
19    setprop ro.hardware.vulkan ${ro.boot.hardware.vulkan}
20
21    # start module load in the background
22    start vendor.insmod_sh
23
24on init
25    # ZRAM setup
26    write /sys/block/zram0/comp_algorithm lz4
27    #
28    # EAS uclamp interfaces
29    #
30    mkdir /dev/cpuctl/foreground
31    mkdir /dev/cpuctl/background
32    mkdir /dev/cpuctl/top-app
33    mkdir /dev/cpuctl/rt
34    chown system system /dev/cpuctl
35    chown system system /dev/cpuctl/foreground
36    chown system system /dev/cpuctl/background
37    chown system system /dev/cpuctl/top-app
38    chown system system /dev/cpuctl/rt
39    chown system system /dev/cpuctl/tasks
40    chown system system /dev/cpuctl/foreground/tasks
41    chown system system /dev/cpuctl/background/tasks
42    chown system system /dev/cpuctl/top-app/tasks
43    chown system system /dev/cpuctl/rt/tasks
44    chmod 0664 /dev/cpuctl/tasks
45    chmod 0664 /dev/cpuctl/foreground/tasks
46    chmod 0664 /dev/cpuctl/background/tasks
47    chmod 0664 /dev/cpuctl/top-app/tasks
48    chmod 0664 /dev/cpuctl/rt/tasks
49
50
51on fs
52    mkdir /mnt/vendor/shared 0770 system system
53
54    # Mount everything that does not require fsck
55    mount_all --early
56    restorecon_recursive /vendor
57
58    start setup_wifi
59    # works around framework netiface enumeration issue
60    start rename_eth1
61
62    # TODO(ender): Find better way to talk to serial port.
63    chmod 622 /dev/kmsg
64
65    # for GCE camera HAL
66    mkdir /var/media 0770 audio media
67
68    chmod 0664 /sys/kernel/debug/ieee80211/phy1/hwsim/group
69    chmod 0664 /sys/kernel/debug/ieee80211/phy1/hwsim/ps
70    chmod 0664 /sys/kernel/debug/ieee80211/phy0/rc/fixed_rate_idx
71    chmod 0664 /sys/kernel/debug/ieee80211/phy0/hwsim/group
72    chmod 0664 /sys/kernel/debug/ieee80211/phy0/hwsim/ps
73    chmod 0664 /sys/kernel/debug/ieee80211/phy1/rc/fixed_rate_idx
74
75
76on post-fs
77    # set RLIMIT_MEMLOCK to 64MB
78    setrlimit 8 67108864 67108864
79
80
81on post-fs-data
82    mkdir /data/vendor/modem_dump 0777 system system
83    mkdir /data/vendor/radio 0777 system system
84
85
86on late-fs
87    # Wait for keymaster
88    exec_start wait_for_keymaster
89
90    # Mount RW partitions which need run fsck
91    mount_all --late
92
93    write /dev/kmsg "GUEST_BUILD_FINGERPRINT: ${ro.build.fingerprint}"
94
95
96on boot
97    chmod 0660 /dev/cpuctl
98    mkdir /data/vendor/wifi 0770 wifi wifi
99    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
100    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
101    start socket_vsock_proxy
102
103
104service setup_wifi /vendor/bin/setup_wifi
105    oneshot
106
107
108service rename_eth1 /vendor/bin/rename_netiface eth1 rmnet0
109    oneshot
110
111
112on property:sys.boot_completed=1
113    trigger sys-boot-completed-set
114
115
116# We want one opportunity per boot to enable zram, so we
117# use a trigger we fire from the above stanza. If
118# persist.sys.zram_enabled becomes true after boot,
119# we don't want to run swapon_all at that time.
120on sys-boot-completed-set && property:persist.sys.zram_enabled=1
121    swapon_all
122
123service vendor.insmod_sh /vendor/bin/init.insmod.sh
124    class main
125    user root
126    group root system
127    disabled
128    oneshot
129
130service socket_vsock_proxy /vendor/bin/socket_vsock_proxy -server=vsock -tcp_port=5555 -vsock_port=6520
131
132
133service seriallogging /system/bin/logcat -b all -v threadtime -f /dev/hvc2 *:V
134    class main
135    user logd
136    group root logd
137
138
139on property:ro.boot.tpm_vsock_port=*
140  enable vtpm_manager
141
142service vtpm_manager /vendor/bin/vtpm_manager -tpm_vsock_port=${ro.boot.tpm_vsock_port}
143  class main
144  user root
145  disabled
146
147
148service vsoc_input_service /vendor/bin/vsoc_input_service -touch_port=${ro.boot.vsock_touch_port} -keyboard_port=${ro.boot.vsock_keyboard_port}
149    group root uhid
150    disabled
151
152on early-boot && property:ro.boot.vsock_touch_port=*
153   enable vsoc_input_service
154   start vsoc_input_service
155
156on early-boot && property:ro.boot.vsock_keyboard_port=*
157   enable vsoc_input_service
158   start vsoc_input_service
159
160service wpa_supplicant /vendor/bin/hw/wpa_supplicant -g@android:wpa_wlan0
161    interface android.hardware.wifi.supplicant@1.0::ISupplicant default
162    interface android.hardware.wifi.supplicant@1.1::ISupplicant default
163    interface android.hardware.wifi.supplicant@1.2::ISupplicant default
164    socket wpa_wlan0 dgram 660 wifi wifi
165    group system wifi inet
166    disabled
167    oneshot
168
169
170service bugreport /system/bin/dumpstate -d -p -B -z -o /sdcard/bugreport
171    class main
172    disabled
173    oneshot
174    keycodes 30 48
175