1#
2# Copyright 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17import init.fugu.usb.rc
18import init.intel.tools.rc
19import init.fugu.diag.rc
20
21on early-init
22    mount debugfs debugfs /sys/kernel/debug mode=0755
23
24    # IMG Graphics
25    symlink /dev/dri/card0 /dev/card0
26
27on init
28    # Android creates by-name disk links with the disk controller
29    # in the generated path, so that the names pulled out of the GPT
30    # can be associated with the correct disk. Create a shortcut to
31    # /dev/block/by-name so that we can use the same fstabs everywhere.
32    symlink /dev/block/pci/pci0000:00/0000:00:01.0/by-name /dev/block/by-name
33
34    symlink /sdcard /storage/sdcard0
35
36    # ZRAM options
37    write /sys/block/zram0/comp_algorithm lz4
38    write /sys/block/zram0/max_comp_streams 2
39
40    # KSM options
41    write /sys/kernel/mm/ksm/pages_to_scan 100
42    write /sys/kernel/mm/ksm/sleep_millisecs 500
43    write /sys/kernel/mm/ksm/run 1
44
45    #  Mount the sep filesystem
46    mount sepfs sepfs /sys/fs/sepfs
47
48on fs
49    mkdir /logs 0770 system log
50    mkdir /factory 0775 system system
51
52    mount_all ./fstab.fugu
53    swapon_all ./fstab.fugu
54
55    restorecon_recursive /factory
56
57on early-boot
58    # set RLIMIT_MEMLOCK to 64MB
59    setrlimit 8 67108864 67108864
60    setprop ro.audio.flinger_standbytime_ms 600000
61
62on boot
63    # Assign TCP buffer thresholds to be ceiling value of technology maximums
64    # Increased technology maximums should be reflected here.
65    write /proc/sys/net/core/rmem_max  1500000
66    write /proc/sys/net/core/wmem_max  1500000
67    write /proc/sys/net/ipv4/tcp_limit_output_bytes 1500000
68    setprop net.tcp.buffersize.wifi 500000,1000000,1500000,500000,1000000,1500000
69
70    chown system system /sys/class/backlight/psb-bl/brightness
71    chown system system /sys/class/backlight/psb-bl/max_brightness
72    chown system system /sys/class/backlight/psb-bl/actual_brightness
73    chmod 0664 /sys/class/backlight/psb-bl/brightness
74    chmod 0664 /sys/class/backlight/psb-bl/max_brightness
75    chmod 0664 /sys/class/backlight/psb-bl/actual_brightness
76
77    # Wifi
78    setprop wifi.interface wlan0
79    # Set correct country code
80    exec - root root system -- /system/bin/init.fugu.countrycode.sh
81
82    # Wifi firmware reload path
83    chown wifi wifi /sys/module/bcmdhd/parameters/firmware_path
84
85on post-fs
86    # Performance tweaks for interactive governor
87    chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
88    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
89    chown system system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
90    chmod 0660 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
91    chown system system /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
92    chmod 0660 /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
93    chown system system /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
94    chmod 0660 /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
95    chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
96    chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
97    chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
98    chown system system /sys/devices/system/cpu/cpufreq/interactive/touchboostpulse
99    chown system system /sys/devices/system/cpu/cpufreq/interactive/touchboostpulse_duration
100    chown system system /sys/devices/system/cpu/cpufreq/interactive/touchboost_freq
101    chmod 0220 /sys/devices/system/cpu/cpufreq/interactive/touchboostpulse
102    chmod 0220 /sys/devices/system/cpu/cpufreq/interactive/boostpulse
103
104    # Tune interactive governor parameters for Android TV UI animations
105    write /sys/devices/system/cpu/cpufreq/interactive/timer_rate 4000
106    write /sys/devices/system/cpu/cpufreq/interactive/timer_slack 16000
107    write /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 90
108    write /sys/devices/system/cpu/cpufreq/interactive/target_loads 70
109    write /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration 800000
110
111    # SEP
112    copy /system/etc/security/sep_policy.conf /sys/fs/sepfs/load
113    chown system system /dev/dx_sep_q0
114    chmod 0666 /dev/dx_sep_q0
115
116    # hdmi cec
117    chown system system /sys/module/drm_intel_mid/parameters/hdmi_state
118    chmod 0440 /sys/module/drm_intel_mid/parameters/hdmi_state
119    chown system system /sys/module/drm_intel_mid/parameters/hdmi_edid_src_phy_addr
120    chmod 0440 /sys/module/drm_intel_mid/parameters/hdmi_edid_src_phy_addr
121
122on post-fs-data
123    # Create the directories used by the Wireless subsystem
124    mkdir /data/misc/wifi 0770 wifi wifi
125    mkdir /data/misc/wifi/sockets 0770 wifi wifi
126    mkdir /data/misc/dhcp 0770 dhcp wifi
127
128    # Bluetooth
129    setprop ro.bt.bdaddr_path "/factory/bt/bd_addr.conf"
130    chmod 0660 /sys/class/rfkill/rfkill2/state
131    chown bluetooth bluetooth /sys/class/rfkill/rfkill2/state
132    chown bluetooth bluetooth /sys/class/rfkill/rfkill2/type
133
134    # Create directory used by audio subsystem
135    mkdir /data/misc/audio 0770 audio audio
136
137    mkdir /data/system 0775 system system
138
139    setprop vold.post_fs_data_done 1
140
141    setprop init.post_fs_data.bootreason ${ro.boot.bootreason}
142
143    # itux
144    # Set this property to enable Thermal service
145    setprop persist.service.thermal 1
146    # Properties for Thermal Service
147    setprop persist.thermal.turbo.dynamic 1
148    setprop ro.thermal.ituxversion 3.0
149    setprop persist.thermal.shutdown.msg 0
150    setprop persist.thermal.shutdown.vibra 0
151    setprop persist.thermal.shutdown.tone 0
152    chown system system /sys/module/intel_mid_osip/parameters/force_shutdown_occured
153    chown system system /sys/module/intel_mid_osip/parameters/thermal_shutdown_occured
154    chown system system /sys/devices/platform/coretemp.0/temp2_threshold1
155    chown system system /sys/devices/platform/coretemp.0/temp2_threshold2
156    chown system system /sys/devices/virtual/thermal/thermal_zone6/emul_temp
157    chown system system /sys/devices/virtual/thermal/thermal_zone7/emul_temp
158
159    # Stop led blinking and reduce brightness
160    write /sys/class/leds/white/device/led_lighting_effect 1
161    write /sys/class/leds/white/brightness 0
162
163    # Playready
164    mkdir /data/mediadrm/playready/ 0770 mediadrm mediadrm
165    copy  /system/vendor/firmware/PR-ModelCert /data/mediadrm/playready/bgroupcert.dat
166    chown mediadrm mediadrm /data/mediadrm/playready/bgroupcert.dat
167    chmod 0440 /data/mediadrm/playready/bgroupcert.dat
168
169on property:init.post_fs_data.bootreason=panic
170    # Create dump dir and collect dumps. (use the same location as in init.rc)
171    mkdir /data/dontpanic 0750 root log
172
173    copy /proc/emmc_ipanic_console /data/dontpanic/ipanic_console
174    chown root log /data/dontpanic/ipanic_console
175    chmod 0640 /data/dontpanic/ipanic_console
176
177    copy /proc/emmc_ipanic_threads /data/dontpanic/ipanic_threads
178    chown root log /data/dontpanic/ipanic_threads
179    chmod 0640 /data/dontpanic/ipanic_threads
180
181    copy /proc/emmc_ipanic_gbuffer /data/dontpanic/ipanic_gbuffer
182    chown root log /data/dontpanic/ipanic_gbuffer
183    chmod 0640 /data/dontpanic/ipanic_gbuffer
184
185    # Clear panic partition
186    write /proc/emmc_ipanic_header 1
187
188service wpa_supplicant /system/vendor/bin/hw/wpa_supplicant \
189   -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
190   -m/data/misc/wifi/p2p_supplicant.conf \
191   -puse_p2p_group_interface=1p2p_device=1use_multi_chan_concurrent=1 \
192   -O/data/misc/wifi/sockets \
193   -e/data/misc/wifi/entropy.bin \
194   -g@android:wpa_wlan0
195    class main
196    socket wpa_wlan0 dgram 660 wifi wifi
197    disabled
198    oneshot
199
200# Bluetooth related services
201service BtFwLoader /system/bin/BtFwLoader
202    class main
203    group bluetooth
204    user bluetooth
205    oneshot
206
207# bugreport is triggered by holding down volume down, volume up and power
208service bugreport /system/bin/dumpstate -d -p -B -z \
209        -o /data/user_de/0/com.android.shell/files/bugreports/bugreport
210    class main
211    disabled
212    oneshot
213    keycodes 114 115 116
214
215# interval:60s margin:20s
216service watchdogd /sbin/watchdogd 60 20
217    class core
218    oneshot
219    seclabel u:r:watchdogd:s0
220
221# Reset the watchdog counter once boot is completed
222on property:sys.boot_completed=1
223    write /sys/devices/virtual/misc/watchdog/counter "0"
224
225# Enable native bridge for target executables
226on early-init
227    mount binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
228
229on property:ro.enable.native.bridge.exec=1
230    copy /system/etc/binfmt_misc/arm_exe /proc/sys/fs/binfmt_misc/register
231    copy /system/etc/binfmt_misc/arm_dyn /proc/sys/fs/binfmt_misc/register
232