1import init.${ro.hardware}.usb.rc
2import init.${ro.hardware}.power.rc
3
4on init
5    # mount debugfs
6    mount debugfs /sys/kernel/debug /sys/kernel/debug mode=755
7
8    # disable transparent huge pages
9    write /sys/kernel/mm/transparent_hugepage/enabled "never"
10
11    # Initialize cpusets to boot-time values
12    write /dev/cpuset/foreground/cpus 0-7
13    write /dev/cpuset/background/cpus 0-7
14    write /dev/cpuset/system-background/cpus 0-7
15    write /dev/cpuset/top-app/cpus 0-7
16
17    start watchdogd
18
19on fs
20    mount_all /vendor/etc/fstab.${ro.hardware}
21    setprop ro.crypto.fuse_sdcard false
22
23on post-fs
24
25    # set RLIMIT_MEMLOCK to 8MB
26    setrlimit 8 8388608 8388608
27
28    # For legacy support
29    # See storage config details at http://source.android.com/tech/storage/
30    # since /storage is mounted on post-fs in init.rc
31    symlink /sdcard /storage/sdcard0
32
33    # BT LED sysfs entry
34    write /sys/class/leds/bt_active/trigger "hci1rx"
35
36    chmod 0666 /dev/ump
37    chmod 0666 /dev/ion
38    chmod 0666 /dev/graphics/fb0
39
40# fake some battery state
41    setprop status.battery.state Slow
42    setprop status.battery.level 5
43    setprop status.battery.level_raw  50
44    setprop status.battery.level_scale 9
45
46# If an app forces screen rotation, revert it once the apps closes
47    setprop persist.demo.rotationlock 1
48
49# enable Google-specific location features,
50# like NetworkLocationProvider and LocationCollector
51    setprop ro.com.google.locationfeatures 1
52
53# enable test harness
54    setprop ro.test_harness true
55
56on post-fs-data
57    mkdir /data/media 0770 media_rw media_rw
58    mkdir /data/misc/gatord 0700 root root
59    # Set SELinux security contexts for files used by lava.
60    restorecon_recursive /data/local/tmp/lava
61
62on zygote-start
63    mkdir /data/vendor/wifi 0770 wifi wifi
64    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
65    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
66
67on property:sys.boot_completed=1
68    # update cpuset now that processors are up
69    # Foreground should contain most cores (7 is reserved for top-app)
70    write /dev/cpuset/foreground/cpus 0-6
71
72    # top-app gets all cpus (including reserved #7)
73    write /dev/cpuset/top-app/cpus 0-7
74
75    #background contains a small subset (generally one little core)
76    write /dev/cpuset/background/cpus 0
77
78    # add system-background cpuset, a new cpuset for system services
79    # that should not run on larger cores
80    # system-background is for system tasks that should only run on
81    # little cores, not on bigs to be used only by init
82    write /dev/cpuset/system-background/cpus 0-3
83
84on property:usb_speed.switch=high
85    write /sys/kernel/debug/f72c0000.usb/config "0"
86
87on property:usb_speed.switch=full
88    write /sys/kernel/debug/f72c0000.usb/config "1"
89
90#userspace daemon needed for bluetooth
91service uim /vendor/bin/uim
92    class main
93    user bluetooth
94    group bluetooth net_bt_admin system
95    oneshot
96
97service wpa_supplicant /system/vendor/bin/hw/wpa_supplicant \
98     -g@android:wpa_wlan0
99     interface [email protected]::ISupplicant default
100     interface [email protected]::ISupplicant default
101     socket wpa_wlan0 dgram 660 wifi wifi
102     class main
103     disabled
104     oneshot
105
106# Set watchdog timer to 30 seconds and pet it every 10 seconds to get a 20 second margin
107service watchdogd /system/bin/watchdogd 10 20
108    class core
109    oneshot
110    seclabel u:r:watchdogd:s0
111
112service bugreport /system/bin/dumpstate -d -p -z
113    class main
114    disabled
115    oneshot
116