summaryrefslogtreecommitdiff
path: root/init.ranchu.rc
blob: 870947e8ba5f12958d303b2a3bd785ad4ce1b750 (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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
on early-fs
    start vold

on fs
    mount_all /vendor/etc/fstab.ranchu --early

on late-fs
    # Mount RW partitions which need run fsck
    mount_all /vendor/etc/fstab.ranchu --late

on early-init
    mount proc proc /proc remount hidepid=2,gid=3009
    setprop ro.hardware.vulkan ranchu

    # true if ram is <= 2G
    setprop ro.config.low_ram ${ro.boot.config.low_ram}
    setprop dalvik.vm.dex2oat64.enabled 1

    setprop ro.soc.manufacturer AOSP
    setprop ro.soc.model ranchu

    # DEPRECATED, use ro.boot.qemu instead. The GTS tests still refer to
    # ro.kernel.qemu to decide if a device is emulator. Should be removed once
    # GTS tests are migrated to ro.boot.qemu.
    setprop ro.kernel.qemu 1

on init
    # set RLIMIT_MEMLOCK to 8MB for BPF network statistics
    setrlimit memlock 8388608 8388608

    symlink /dev/goldfish_pipe /dev/android_pipe
    symlink /dev/goldfish_pipe /dev/qemu_pipe

    write /sys/block/zram0/comp_algorithm lz4
    write /proc/sys/vm/page-cluster 0

    #
    # EAS uclamp interfaces
    #
    mkdir /dev/cpuctl/foreground
    mkdir /dev/cpuctl/background
    mkdir /dev/cpuctl/top-app
    mkdir /dev/cpuctl/rt
    chown system system /dev/cpuctl
    chown system system /dev/cpuctl/foreground
    chown system system /dev/cpuctl/background
    chown system system /dev/cpuctl/top-app
    chown system system /dev/cpuctl/rt
    chown system system /dev/cpuctl/tasks
    chown system system /dev/cpuctl/foreground/tasks
    chown system system /dev/cpuctl/background/tasks
    chown system system /dev/cpuctl/top-app/tasks
    chown system system /dev/cpuctl/rt/tasks
    chmod 0664 /dev/cpuctl/tasks
    chmod 0664 /dev/cpuctl/foreground/tasks
    chmod 0664 /dev/cpuctl/background/tasks
    chmod 0664 /dev/cpuctl/top-app/tasks
    chmod 0664 /dev/cpuctl/rt/tasks

    setprop ro.hardware.audio.tinyalsa.period_count 4
    setprop ro.hardware.audio.tinyalsa.period_size_multiplier 4
    setprop ro.hardware.audio.tinyalsa.host_latency_ms 30

    start qemu-props

on post-fs-data
    setprop vold.post_fs_data_done 1
    mkdir /data/vendor/adb 0755 root root
    mkdir /data/vendor/devicestate 0755 root root
    mkdir /data/vendor/var 0755 root root
    mkdir /data/vendor/var/run 0755 root root

    start qemu-adb-keys
    start qemu-device-state

on zygote-start
    # Create the directories used by the Wireless subsystem
    mkdir /data/vendor/wifi 0771 wifi wifi
    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi

on boot
    setprop ro.hardware.egl ${ro.boot.hardwareegl:-emulation}
    setprop debug.sf.vsync_reactor_ignore_present_fences true
    setprop debug.hwui.renderer opengl
    setprop debug.hwui.renderer ${ro.boot.debug.hwui.renderer}
    setprop ro.opengles.version ${ro.boot.opengles.version}
    setprop ro.surface_flinger.supports_background_blur 1
    setprop ro.zygote.disable_gl_preload 1

    setprop debug.stagefright.ccodec ${ro.boot.debug.stagefright.ccodec}

    setprop dalvik.vm.heapsize 192m
    setprop dalvik.vm.heapsize ${ro.boot.dalvik.vm.heapsize}
    setprop dalvik.vm.checkjni ${ro.boot.dalvik.vm.checkjni}
    chown root system /sys/power/wake_lock
    chown root system /sys/power/wake_unlock
    setprop ro.hardware.audio.primary goldfish

    setprop wifi.interface wlan0
    setprop wifi.direct.interface p2p-dev-wlan0

    # Create an unused USB gadget to allow sysfs testing
    mkdir /config/usb_gadget/g1 0770 root root

service ranchu-setup /vendor/bin/init.ranchu-core.sh
    class core
    user root
    group root
    oneshot

service qemu-adb-setup /system_ext/bin/init.qemu-adb-keys.sh
    class core
    user root
    group shell
    disabled  # Started when qemu-adb-keys is stopped
    oneshot

on property:vendor.qemu.vport.gnss=*
    symlink ${vendor.qemu.vport.gnss} /dev/gnss0

on property:vendor.qemu.timezone=*
    setprop persist.sys.timezone ${vendor.qemu.timezone}

on property:ro.boot.debug.sf.nobootanimation=1
    setprop debug.sf.nobootanimation 1

on property:dev.bootcomplete=1
    setprop vendor.qemu.dev.bootcomplete 1
    start ranchu-setup

on post-fs-data && property:ro.boot.qemu.virtiowifi=1
    start ranchu-net

on property:ro.boot.qemu.cpuvulkan.version=*
    setprop ro.cpuvulkan.version ${ro.boot.qemu.cpuvulkan.version}

service ranchu-net /vendor/bin/init.ranchu-net.sh
    class late_start
    user root
    group root wakelock wifi
    oneshot
    disabled    # Started on post-fs-data

service dhcpclient_wifi /vendor/bin/dhcpclient -i wlan0 --no-gateway
    user root
    group root
    disabled

service dhcpclient_def /vendor/bin/dhcpclient -i eth0 --no-gateway
    user root
    group root
    disabled

# The qemu-props program is used to set various system
# properties on boot. It must be run early during the boot
# process to avoid race conditions with other daemons that
# might read them (e.g. surface flinger), so define it in
# class 'core'
#
service qemu-props /vendor/bin/qemu-props
    class core
    user root
    group root
    oneshot

service qemu-adb-keys /vendor/bin/qemu-adb-keys
    class core
    user root
    group root
    oneshot

service qemu-device-state /vendor/bin/qemu-device-state
    class core
    user root
    group root
    oneshot

service goldfish-logcat /system/bin/logcat -f /dev/hvc1 ${ro.boot.logcat}
    class main
    user logd
    group root logd

service bugreport /system/bin/dumpstate -d -p -z
    class main
    disabled
    oneshot
    keycodes 114 115 116

service wpa_supplicant /vendor/bin/hw/wpa_supplicant -Dnl80211 -iwlan0 -c/vendor/etc/wifi/wpa_supplicant.conf -g@android:wpa_wlan0
    interface aidl android.hardware.wifi.supplicant.ISupplicant/default
    socket wpa_wlan0 dgram 660 wifi wifi
    group system wifi inet
    oneshot
    disabled

on property:vendor.qemu.vport.bluetooth=*
    symlink ${vendor.qemu.vport.bluetooth} /dev/bluetooth0


service bt_vhci_forwarder /vendor/bin/bt_vhci_forwarder -virtio_console_dev=/dev/bluetooth0
    class main
    user bluetooth
    group root bluetooth

# Enable zram only once per boot. From:

# We want one opportunity per boot to enable zram, so we
# use a trigger we fire from the above stanza. If
# persist.sys.zram_enabled becomes true after boot,
# we don't want to run swapon_all at that time.

on property:sys.boot_completed=1
    trigger sys-boot-completed-set

on sys-boot-completed-set && property:persist.sys.zram_enabled=1
    swapon_all /vendor/etc/fstab.${ro.hardware}