Home | History | Annotate | Download | only in fugu
      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 
     17 import init.fugu.usb.rc
     18 import init.intel.tools.rc
     19 import init.fugu.diag.rc
     20 
     21 on early-init
     22     mount debugfs debugfs /sys/kernel/debug mode=0755
     23 
     24     # IMG Graphics
     25     symlink /dev/dri/card0 /dev/card0
     26 
     27 on 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 
     48 on 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 
     57 on early-boot
     58     # set RLIMIT_MEMLOCK to 64MB
     59     setrlimit 8 67108864 67108864
     60     setprop ro.audio.flinger_standbytime_ms 600000
     61 
     62 on 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 on post-fs
     83     # Performance tweaks for interactive governor
     84     chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
     85     chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
     86     chown system system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
     87     chmod 0660 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
     88     chown system system /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
     89     chmod 0660 /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
     90     chown system system /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
     91     chmod 0660 /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
     92     chown system system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
     93     chown system system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
     94     chown system system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
     95     chown system system /sys/devices/system/cpu/cpufreq/interactive/touchboostpulse
     96     chown system system /sys/devices/system/cpu/cpufreq/interactive/touchboostpulse_duration
     97     chown system system /sys/devices/system/cpu/cpufreq/interactive/touchboost_freq
     98     chmod 0220 /sys/devices/system/cpu/cpufreq/interactive/touchboostpulse
     99     chmod 0220 /sys/devices/system/cpu/cpufreq/interactive/boostpulse
    100 
    101     # Tune interactive governor parameters for Android TV UI animations
    102     write /sys/devices/system/cpu/cpufreq/interactive/timer_rate 4000
    103     write /sys/devices/system/cpu/cpufreq/interactive/timer_slack 16000
    104     write /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 90
    105     write /sys/devices/system/cpu/cpufreq/interactive/target_loads 70
    106     write /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration 800000
    107 
    108     # SEP
    109     copy /system/etc/security/sep_policy.conf /sys/fs/sepfs/load
    110     chown system system /dev/dx_sep_q0
    111     chmod 0666 /dev/dx_sep_q0
    112     chown system system /dev/dx_sep_q1
    113     chmod 0666 /dev/dx_sep_q1
    114 
    115     # hdmi cec
    116     chown system system /sys/module/drm_intel_mid/parameters/hdmi_state
    117     chmod 0440 /sys/module/drm_intel_mid/parameters/hdmi_state
    118     chown system system /sys/module/drm_intel_mid/parameters/hdmi_edid_src_phy_addr
    119     chmod 0440 /sys/module/drm_intel_mid/parameters/hdmi_edid_src_phy_addr
    120 
    121 on post-fs-data
    122     # Create the directories used by the Wireless subsystem
    123     mkdir /data/misc/wifi 0770 wifi wifi
    124     mkdir /data/misc/wifi/sockets 0770 wifi wifi
    125     mkdir /data/misc/dhcp 0770 dhcp wifi
    126 
    127     # Bluetooth
    128     setprop ro.bt.bdaddr_path "/factory/bt/bd_addr.conf"
    129     chmod 0660 /sys/class/rfkill/rfkill2/state
    130     chown bluetooth net_bt_stack /sys/class/rfkill/rfkill2/state
    131     chown bluetooth net_bt_stack /sys/class/rfkill/rfkill2/type
    132 
    133     # Create directory used by audio subsystem
    134     mkdir /data/misc/audio 0770 audio audio
    135 
    136     mkdir /data/system 0775 system system
    137 
    138     setprop vold.post_fs_data_done 1
    139 
    140     setprop init.post_fs_data.bootreason ${ro.boot.bootreason}
    141 
    142     # itux
    143     # Set this property to enable Thermal service
    144     setprop persist.service.thermal 1
    145     # Properties for Thermal Service
    146     setprop persist.thermal.turbo.dynamic 1
    147     setprop ro.thermal.ituxversion 3.0
    148     setprop persist.thermal.shutdown.msg 0
    149     setprop persist.thermal.shutdown.vibra 0
    150     setprop persist.thermal.shutdown.tone 0
    151     chown system system /sys/module/intel_mid_osip/parameters/force_shutdown_occured
    152     chown system system /sys/module/intel_mid_osip/parameters/thermal_shutdown_occured
    153     chown system system /sys/devices/platform/coretemp.0/temp2_threshold1
    154     chown system system /sys/devices/platform/coretemp.0/temp2_threshold2
    155     chown system system /sys/devices/virtual/thermal/thermal_zone6/emul_temp
    156     chown system system /sys/devices/virtual/thermal/thermal_zone7/emul_temp
    157 
    158     # Stop led blinking and reduce brightness
    159     write /sys/class/leds/white/device/led_lighting_effect 1
    160     write /sys/class/leds/white/brightness 0
    161 
    162     # Playready
    163     mkdir /data/mediadrm/playready/ 0770 mediadrm mediadrm
    164     copy  /system/vendor/firmware/PR-ModelCert /data/mediadrm/playready/bgroupcert.dat
    165     chown mediadrm mediadrm /data/mediadrm/playready/bgroupcert.dat
    166     chmod 0440 /data/mediadrm/playready/bgroupcert.dat
    167 
    168 on property:init.post_fs_data.bootreason=*
    169     # Create dump dir and collect dumps. (use the same location as in init.rc)
    170     mkdir /data/dontpanic 0750 root log
    171 
    172     copy /proc/emmc_ipanic_console /data/dontpanic/ipanic_console
    173     chown root log /data/dontpanic/ipanic_console
    174     chmod 0640 /data/dontpanic/ipanic_console
    175 
    176     copy /proc/emmc_ipanic_threads /data/dontpanic/ipanic_threads
    177     chown root log /data/dontpanic/ipanic_threads
    178     chmod 0640 /data/dontpanic/ipanic_threads
    179 
    180     copy /proc/emmc_ipanic_gbuffer /data/dontpanic/ipanic_gbuffer
    181     chown root log /data/dontpanic/ipanic_gbuffer
    182     chmod 0640 /data/dontpanic/ipanic_gbuffer
    183 
    184     # Clear panic partition
    185     write /proc/emmc_ipanic_header 1
    186 
    187 service wpa_supplicant /system/bin/wpa_supplicant -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -g@android:wpa_wlan0
    188     class main
    189     socket wpa_wlan0 dgram 660 wifi wifi
    190     group system wifi inet bluetooth
    191     disabled
    192     oneshot
    193 
    194 service p2p_supplicant /system/bin/wpa_supplicant \
    195    -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
    196    -m/data/misc/wifi/p2p_supplicant.conf \
    197    -puse_p2p_group_interface=1p2p_device=1use_multi_chan_concurrent=1 \
    198    -O/data/misc/wifi/sockets \
    199    -e/data/misc/wifi/entropy.bin \
    200    -g@android:wpa_wlan0
    201     class main
    202     socket wpa_wlan0 dgram 660 wifi wifi
    203     disabled
    204     oneshot
    205 
    206 # Bluetooth related services
    207 service BtFwLoader /system/bin/BtFwLoader
    208     class main
    209     group bluetooth net_bt_stack
    210     user bluetooth
    211     oneshot
    212 
    213 # bugreport is triggered by holding down volume down, volume up and power
    214 service bugreport /system/bin/dumpstate -d -p -B -z \
    215         -o /data/user_de/0/com.android.shell/files/bugreports/bugreport
    216     class main
    217     disabled
    218     oneshot
    219     keycodes 114 115 116
    220 
    221 # interval:60s margin:20s
    222 service watchdogd /sbin/watchdogd 60 20
    223     class core
    224     oneshot
    225     seclabel u:r:watchdogd:s0
    226 
    227 # Reset the watchdog counter once boot is completed
    228 on property:sys.boot_completed=1
    229     write /sys/devices/virtual/misc/watchdog/counter "0"
    230 
    231 # Enable native bridge for target executables
    232 on early-init
    233     mount binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
    234 
    235 on property:ro.enable.native.bridge.exec=1
    236     copy /system/etc/binfmt_misc/arm_exe /proc/sys/fs/binfmt_misc/register
    237     copy /system/etc/binfmt_misc/arm_dyn /proc/sys/fs/binfmt_misc/register
    238