1on early-init
2#    loglevel 8
3
4    setprop ro.hw_timeout_multiplier ${ro.boot.hw_timeout_multiplier}
5    setprop hypervisor.memory_reclaim.supported ${ro.boot.hypervisor.vm.supported}
6
7    start metrics_helper
8    # start module load in the background
9    start vendor.dlkm_loader
10    # specially load zram as it is a "leaf" GKI module
11    exec u:r:modprobe:s0 -- /system/bin/modprobe -a -d /system/lib/modules zram.ko
12
13on init
14    # ZRAM setup
15    write /sys/block/zram0/comp_algorithm lz4
16
17    # EAS uclamp interfaces
18    mkdir /dev/cpuctl/foreground
19    mkdir /dev/cpuctl/background
20    mkdir /dev/cpuctl/top-app
21    mkdir /dev/cpuctl/rt
22    chown system system /dev/cpuctl
23    chown system system /dev/cpuctl/foreground
24    chown system system /dev/cpuctl/background
25    chown system system /dev/cpuctl/top-app
26    chown system system /dev/cpuctl/rt
27    chown system system /dev/cpuctl/tasks
28    chown system system /dev/cpuctl/foreground/tasks
29    chown system system /dev/cpuctl/background/tasks
30    chown system system /dev/cpuctl/top-app/tasks
31    chown system system /dev/cpuctl/rt/tasks
32    chmod 0664 /dev/cpuctl/tasks
33    chmod 0664 /dev/cpuctl/foreground/tasks
34    chmod 0664 /dev/cpuctl/background/tasks
35    chmod 0664 /dev/cpuctl/top-app/tasks
36    chmod 0664 /dev/cpuctl/rt/tasks
37
38on fs
39    mkdir /mnt/vendor/shared 0770 system system
40
41    # Mount everything that does not require fsck
42    mount_all --early
43
44    # So GceBootReporter can print to kmsg
45    chmod 622 /dev/kmsg
46
47on post-fs-data && property:ro.vendor.disable_rename_eth0=
48    # works around framework netiface enumeration issue
49    # TODO(b/202731768): Add this `start rename_eth0` command to the init.rc for rename_netiface
50    start rename_eth0
51
52on post-fs-data && property:ro.vendor.wifi_impl=virt_wifi
53    # TODO(b/202731768): Add this `start setup_wifi` command to the init.rc for setup_wifi
54    start setup_wifi
55
56on post-fs-data
57    mkdir /data/vendor/modem_dump 0777 system system
58    mkdir /data/vendor/radio 0777 system system
59
60on late-fs
61    # Mount RW partitions which need run fsck
62    mount_all --late
63
64    write /dev/kmsg "GUEST_BUILD_FINGERPRINT: ${ro.build.fingerprint}"
65
66on post-fs-data && property:ro.vendor.wifi_impl=mac80211_hwsim_virtio
67    mkdir /data/vendor/wifi 0770 wifi wifi
68    mkdir /data/vendor/wifi/hostapd 0770 wifi wifi
69    mkdir /data/vendor/wifi/hostapd/sockets 0770 wifi wifi
70    start init_wifi_sh
71
72on boot
73    chmod 0770 /dev/cpuctl
74    mkdir /data/vendor/wifi 0770 wifi wifi
75    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
76    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
77    start socket_vsock_proxy
78    setprop ro.hardware.audio.primary goldfish
79    symlink /dev/hvc6 /dev/gnss0
80    symlink /dev/hvc7 /dev/gnss1
81
82on property:sys.boot_completed=1
83    trigger sys-boot-completed-set
84    mkdir /mnt/vendor/custom 0755 root root
85    mount ext2 /dev/block/by-name/custom /mnt/vendor/custom loop rw sync
86
87# We want one opportunity per boot to enable zram, so we
88# use a trigger we fire from the above stanza. If
89# persist.sys.zram_enabled becomes true after boot,
90# we don't want to run swapon_all at that time.
91on sys-boot-completed-set && property:persist.sys.zram_enabled=1
92    swapon_all
93
94service vendor.dlkm_loader /vendor/bin/dlkm_loader
95    class main
96    user root
97    group root system
98    disabled
99    oneshot
100
101service metrics_helper /vendor/bin/metrics_helper
102    group system
103    user root
104
105service socket_vsock_proxy /vendor/bin/socket_vsock_proxy -server_type=vsock -server_vsock_port=6520 -client_type=tcp -client_tcp_host=0.0.0.0 -client_tcp_port=5555
106    user root
107
108service bugreport /system/bin/dumpstate -d -p -z
109    class main
110    user root
111    disabled
112    oneshot
113    keycodes 30 48
114
115# TODO: disable this service once cuttlefish implements system suspend
116service suspend_blocker /vendor/bin/suspend_blocker
117    class early_hal # Start together with system_suspend HAL
118    group system
119    user root
120
121on early-init
122    setprop ro.setupwizard.mode ${ro.boot.setupwizard_mode}
123
124on early-init && property:ro.boot.enable_bootanimation=0
125    setprop debug.sf.nobootanimation 1
126
127