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