on post-fs-data
    mkdir /data/kpanic 0770 system system
    mkdir /data/kpanic/pstore 0770 system system
    # For sdcard to get right context on /data/media/0
    mkdir /data/media 0770 media_rw media_rw
    mkdir /data/media/0 0770 media_rw media_rw
    restorecon /data/media/0
    # Set indication (checked by vold) that we have finished this action
    setprop vold.post_fs_data_done 1

on boot
    write /sys/devices/platform/INT33BB:00/power/control on

    # GPS Changes
    mkdir /dev/gps 0770 gps system
    symlink /dev/ttyS2 /dev/gps/ttyGPS
    insmod /system/lib/modules/usbnet.ko
        
on init
    symlink /fstab /fstab.minnow_64p

#SWISTART
# define service of sierra_dhcpcd
service sierra_dhcpcd /system/bin/init.dhcpcd
    class main
    user root
    group radio cache inet misc
    disabled
    oneshot

service sierra_config_ip /system/bin/init.config.ip
    class main
    user root
    group radio cache inet misc
    disabled
    oneshot

service ril-daemon-qmi /system/bin/rild -l /system/lib64/libsierra-ril.so -- -a -i usb0
    socket rild stream 660 root radio
    socket rild-debug stream 660 radio system
    socket swigps stream 660 system radio
    user root
    group radio cache inet misc audio log
    disabled

service ril-daemon-at /system/bin/rild -l /system/lib64/libsierraat-ril.so -- -a -i wwan0
    socket rild stream 660 root radio
    socket rild-debug stream 660 radio system
    socket swigps stream 660 system radio
    user root
    group radio cache inet misc audio log
    disabled
    
service ril-daemon-hl /system/bin/rild -l /system/lib64/libsierrahl-ril.so -- -a -i wwan0
    socket rild stream 660 root radio
    socket rild-debug stream 660 radio system
    socket swigps stream 660 system radio
    user root
    group radio cache inet misc audio log
    disabled

on property:persist.sys.ril.type=QMI
    insmod /system/lib/modules/sierra.ko
    insmod /system/lib/modules/GobiNet.ko
    start ril-daemon-qmi

on property:persist.sys.ril.type=AT
    insmod /system/lib/modules/sierra.ko
    insmod /system/lib/modules/sierra_net.ko
    start ril-daemon-at

on property:persist.sys.ril.type=HL
    insmod /system/lib/modules/cdc_ncm.ko
    insmod /system/lib/modules/cdc_ether.ko
    start ril-daemon-hl
#SWISTOP 

# ----------------- BEGIN MIX-IN DEFINITIONS -----------------
# Mix-In definitions are auto-generated by mixin-update
##############################################################
# Source: device/intel/mixins/groups/kernel/gmin64/init.rc
##############################################################
##############################################################
# Source: device/intel/mixins/groups/boot-arch/efi/init.rc
##############################################################
on fs
    # ro.boot.hardware = TARGET_PRODUCT (set in kernel command line
    # as androidboot.hardware). Mount all the filesystems as specified
    # in the fstab.
    mount_all /fstab
    mkdir /dev/pstore 0755 root system
    mount pstore pstore /dev/pstore

on post-fs
    restorecon /dev/block/by-name/android_persistent

service pstore-clean /system/bin/pstore-clean
    user root
    group system
    class late_start
    oneshot

service watchdogd /sbin/watchdogd
    user root
    class core
    oneshot
    seclabel u:r:watchdogd:s0
##############################################################
# Source: device/intel/mixins/groups/graphics/ufo_gen7/init.rc.1
##############################################################
on boot
    # Allow the Gfx PCI device(0000:02:00) to go into D0ix states through runtime pm
    write /sys/devices/pci0000\:00/0000\:00\:02.0/power/control auto
    # Set runtime pm autosuspend delay to 500ms for VLV
    write /sys/devices/pci0000\:00/0000\:00\:02.0/power/autosuspend_delay_ms 500
##############################################################
# Source: device/intel/mixins/groups/graphics/ufo_gen7/init.rc
##############################################################
# for hardware accelerated graphics
service ufo-init /system/bin/sh /system/etc/init.ufo.sh
    class core
    oneshot

service coreu /system/bin/coreu
    class main
    seclabel u:r:coreu:s0

on post-fs-data
    mkdir /data/system 0770 system system
    restart ufo-init

on init
    mkdir /mnt/libreg 0700 root root
    mount tmpfs tmpfs /mnt/libreg size=4096,mode=0600
##############################################################
# Source: device/intel/mixins/groups/storage/4xUSB-sda-emulated/init.rc
##############################################################
on init
    # See storage config details at http://source.android.com/tech/storage/
    mkdir /mnt/shell/emulated 0700 shell shell
    mkdir /storage/emulated 0555 root root

    # make mount point for usb thumb drives
    mkdir /mnt/media_rw/usbdisk 0700 media_rw media_rw
    mkdir /storage/usbdisk 0700 root root

    # make mount point for usb thumb drives
    mkdir /mnt/media_rw/usbdisk2 0700 media_rw media_rw
    mkdir /storage/usbdisk2 0700 root root

    # make mount point for usb thumb drives
    mkdir /mnt/media_rw/usbdisk3 0700 media_rw media_rw
    mkdir /storage/usbdisk3 0700 root root

    # make mount point for usb thumb drives
    mkdir /mnt/media_rw/usbdisk4 0700 media_rw media_rw
    mkdir /storage/usbdisk4 0700 root root

    export EXTERNAL_STORAGE /storage/emulated/legacy
    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
    export EMULATED_STORAGE_TARGET /storage/emulated

    # Support legacy paths
    symlink /storage/emulated/legacy /sdcard
    symlink /storage/emulated/legacy /mnt/sdcard
    symlink /storage/emulated/legacy /storage/sdcard0
    symlink /mnt/shell/emulated/0 /storage/emulated/legacy

on fs
    setprop ro.crypto.fuse_sdcard true

on post-fs-data
    # For sdcard to get right context on /data/media/0
    mkdir /data/media 0770 media_rw media_rw
    mkdir /data/media/0 0770 media_rw media_rw
    restorecon /data/media/0

# virtual sdcard daemon running as media_rw (1023)
service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
    class late_start

#external storage
service fuse_usbdisk /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/usbdisk /storage/usbdisk
    class late_start
    disabled

#external storage
service fuse_usbdisk2 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/usbdisk2 /storage/usbdisk2
    class late_start
    disabled

#external storage
service fuse_usbdisk3 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/usbdisk3 /storage/usbdisk3
    class late_start
    disabled

#external storage
service fuse_usbdisk4 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/usbdisk4 /storage/usbdisk4
    class late_start
    disabled

##############################################################
# Source: device/intel/mixins/groups/ethernet/dhcp/init.rc
##############################################################
service dhcpcd_eth0 /system/bin/dhcpcd -ABDKL
     class main
     disabled
     oneshot

service iprenew_eth0 /system/bin/dhcpcd -n
     class main
     disabled
     oneshot
##############################################################
# Source: device/intel/mixins/groups/usb/host+acc/init.rc
##############################################################
on boot
    write /sys/devices/pci0000\:00/0000\:00\:14.0/power/control auto
##############################################################
# Source: device/intel/mixins/groups/disk-bus/mmc-minnow/init.rc
##############################################################
on init
    # Android creates by-name disk links with the disk controller
    # in the generated path, so that the names pulled out of the GPT
    # can be associated with the correct disk. Create a shortcut to
    # /dev/block/by-name so that we can use the same fstabs everywhere.
    symlink /dev/block/platform/80860F16:00/by-name /dev/block/by-name

##############################################################
# Source: device/intel/mixins/groups/memory/ksm/init.rc
##############################################################

on boot
    # KSM tuning
    write /sys/kernel/mm/ksm/pages_to_scan 100
    write /sys/kernel/mm/ksm/sleep_millisecs 500
    write /sys/kernel/mm/ksm/run 1
##############################################################
# Source: device/intel/mixins/groups/suspend/never/init.rc
##############################################################
on boot
    write /sys/power/wake_lock nosleeptillbrooklyn
##############################################################
# Source: device/intel/mixins/groups/bluetooth/btusb/init.rc
##############################################################
on post-fs-data
    # To store BT paired info
    mkdir /data/misc/hcid 0770 bluetooth bluetooth

on boot
    insmod /system/lib/modules/iptable_raw.ko
    insmod /system/lib/modules/ip6table_raw.ko
    insmod /system/lib/modules/8250_dw.ko
    insmod /system/lib/modules/6lowpan_iphc.ko
    insmod /system/lib/modules/bluetooth.ko
    insmod /system/lib/modules/btusb.ko
    insmod /system/lib/modules/ath3k.ko
    chmod 0644 /sys/kernel/debug/bluetooth/l2cap_le_max_credits
    chmod 0644 /sys/kernel/debug/bluetooth/l2cap_le_default_mps

on post-fs-data
    mkdir /data/misc/dhcp 0770 dhcp system

service dhcpcd_bt-pan /system/bin/dhcpcd -ABKL
    disabled
    oneshot

service iprenew_bt-pan /system/bin/dhcpcd -n
    disabled
    oneshot
##############################################################
# Source: device/intel/mixins/groups/adb_net/true/init.rc
##############################################################
on init
    setprop service.adb.tcp.port 5555

# Adb over Network
on property:service.adb.tcp.port=5555
    stop adbd
    start adbd

on property:service.adb.tcp.port=-1
    stop adbd
    start adbd

##############################################################
# Source: device/intel/mixins/groups/bugreport/default/init.rc
##############################################################
# bugreport is triggered by holding down volume down, volume up and power
service bugreport /system/bin/dumpstate -d -p -B \
        -o /data/data/com.android.shell/files/bugreports/bugreport
    class main
    disabled
    oneshot
    keycodes 114 115 116
##############################################################
# Source: device/intel/mixins/groups/debugfs/default/init.rc
##############################################################
on early-init
    # Mount debugfs and make it writable so that debuggerd can
    # create stack traces, required with newer kernels
    mount debugfs debugfs /sys/kernel/debug
    chmod 0755 /sys/kernel/debug


##############################################################
# Source: device/intel/mixins/groups/disk-encryption/default/init.rc
##############################################################
# Don't do this during post-fs-data since there can be multiple
# post-fs-datas in various mixins and we don't know what order they'll
# execute in. Only set this property once we know all post-fs-data sections
# are done. i.e. in load_all_props_action, which comes after post-fs-data
# in system/core/rootdir/init.rc:
on load_all_props_action
    setprop vold.post_fs_data_done 1
# ------------------ END MIX-IN DEFINITIONS ------------------
