Added WORKING gprimeltecan device tree.
diff --git a/recovery/fstab.qcom b/recovery/fstab.qcom
new file mode 100644
index 0000000..e6d65ca
--- /dev/null
+++ b/recovery/fstab.qcom
@@ -0,0 +1,19 @@
+# Android fstab file.
+# The filesystem that contains the filesystem checker binary (typically /system) cannot
+# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
+
+#TODO: Add 'check' as fs_mgr_flags with data partition.
+# Currently we dont have e2fsck compiled. So fs check would failed.
+
+#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
+/dev/block/platform/7824900.sdhci/by-name/system /system ext4 ro,errors=panic wait
+/dev/block/platform/7824900.sdhci/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer,length=-16384
+/dev/block/platform/7824900.sdhci/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,journal_async_commit,errors=panic wait,check
+/dev/block/platform/7824900.sdhci/by-name/efs /efs ext4 noatime,nosuid,nodev,noauto_da_alloc,journal_async_commit,errors=panic wait
+/dev/block/platform/7824900.sdhci/by-name/persist /persist ext4 nosuid,nodev,data=ordered,nodelalloc wait
+/dev/block/platform/7824900.sdhci/by-name/modem /modem vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait
+/dev/block/platform/7824900.sdhci/by-name/boot /boot emmc defaults defaults
+/dev/block/platform/7824900.sdhci/by-name/recovery /recovery emmc defaults defaults
+
+# VOLD
+/dev/block/platform/7864900.sdhci/mmcblk1p1 auto auto defaults voldmanaged=extSdCard:auto,noemulatedsd
\ No newline at end of file
diff --git a/recovery/init.class_main.sh b/recovery/init.class_main.sh
new file mode 100755
index 0000000..236a512
--- /dev/null
+++ b/recovery/init.class_main.sh
@@ -0,0 +1,86 @@
+#!/system/bin/sh
+# Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of The Linux Foundation nor
+# the names of its contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# start ril-daemon only for targets on which radio is present
+#
+baseband=`getprop ro.baseband`
+sgltecsfb=`getprop persist.radio.sglte_csfb`
+datamode=`getprop persist.data.mode`
+multisimslotcnt=`getprop ro.multisim.simslotcount`
+
+case "$baseband" in
+ "apq")
+ setprop ro.radio.noril yes
+ stop ril-daemon
+esac
+
+case "$baseband" in
+ "msm" | "csfb" | "svlte2a" | "mdm" | "mdm2" | "sglte" | "sglte2" | "dsda2" | "unknown" | "dsda3")
+ start qmuxd
+ case "$baseband" in
+ "svlte2a" | "csfb")
+ start qmiproxy
+ ;;
+ "sglte" | "sglte2" )
+ if [ "x$sgltecsfb" != "xtrue" ]; then
+ start qmiproxy
+ else
+ setprop persist.radio.voice.modem.index 0
+ fi
+ ;;
+ "dsda2")
+ setprop persist.radio.multisim.config dsda
+ esac
+
+ multisim=`getprop persist.radio.multisim.config`
+
+ if [ "$multisim" = "dsds" ] || [ "$multisim" = "dsda" ]; then
+ stop ril-daemon
+ start ril-daemon
+ start ril-daemon1
+ elif [ "$multisim" = "tsts" ]; then
+ stop ril-daemon
+ start ril-daemon
+ start ril-daemon1
+ start ril-daemon2
+ elif [ "$multisimslotcnt" = "2" ]; then
+ stop ril-daemon
+ start ril-daemon
+ start ril-daemon1
+ fi
+ case "$datamode" in
+ "tethered")
+ start qti
+ start port-bridge
+ ;;
+ *)
+ start netmgrd
+ ;;
+ esac
+esac
diff --git a/recovery/init.mdm.sh b/recovery/init.mdm.sh
new file mode 100755
index 0000000..67e4667
--- /dev/null
+++ b/recovery/init.mdm.sh
@@ -0,0 +1,33 @@
+#!/system/bin/sh
+# Copyright (c) 2013, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of Linux Foundation nor
+# the names of its contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+baseband=`getprop ro.baseband`
+if [ "$baseband" = "mdm" ] || [ "$baseband" = "mdm2" ]; then
+ start mdm_helper
+fi
+
diff --git a/recovery/init.qcom.class_core.sh b/recovery/init.qcom.class_core.sh
new file mode 100755
index 0000000..501b27d
--- /dev/null
+++ b/recovery/init.qcom.class_core.sh
@@ -0,0 +1,227 @@
+#!/system/bin/sh
+# Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of The Linux Foundation nor
+# the names of its contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# Set platform variables
+target=`getprop ro.board.platform`
+if [ -f /sys/devices/soc0/hw_platform ]; then
+ soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
+else
+ soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
+fi
+if [ -f /sys/devices/soc0/soc_id ]; then
+ soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
+else
+ soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
+fi
+if [ -f /sys/devices/soc0/platform_version ]; then
+ soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null
+else
+ soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null
+fi
+
+
+# Dynamic Memory Managment (DMM) provides a sys file system to the userspace
+# that can be used to plug in/out memory that has been configured as unstable.
+# This unstable memory can be in Active or In-Active State.
+# Each of which the userspace can request by writing to a sys file.
+#
+# ro.dev.dmm = 1; Indicates that DMM is enabled in the Android User Space. This
+# property is set in the Android system properties file.
+#
+# If ro.dev.dmm.dpd.start_address is set here then the target has a memory
+# configuration that supports DynamicMemoryManagement.
+init_DMM()
+{
+ block=-1
+
+ case "$target" in
+ "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm8960")
+ ;;
+ *)
+ return
+ ;;
+ esac
+
+ mem="/sys/devices/system/memory"
+ op=`cat $mem/movable_start_bytes`
+ case "$op" in
+ "0")
+ log -p i -t DMM DMM Disabled. movable_start_bytes not set: $op
+ ;;
+
+ "$mem/movable_start_bytes: No such file or directory ")
+ log -p i -t DMM DMM Disabled. movable_start_bytes does not exist: $op
+ ;;
+
+ *)
+ log -p i -t DMM DMM available. movable_start_bytes at $op
+ movable_start_bytes=0x`cat $mem/movable_start_bytes`
+ block_size_bytes=0x`cat $mem/block_size_bytes`
+ block=$((#${movable_start_bytes}/${block_size_bytes}))
+
+ chown -h system.system $mem/memory$block/state
+ chown -h system.system $mem/probe
+ chown -h system.system $mem/active
+ chown -h system.system $mem/remove
+
+ case "$target" in
+ "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
+ echo $movable_start_bytes > $mem/probe
+ case "$?" in
+ "0")
+ log -p i -t DMM $movable_start_bytes to physical hotplug succeeded.
+ ;;
+ *)
+ log -p e -t DMM $movable_start_bytes to physical hotplug failed.
+ return
+ ;;
+ esac
+
+ echo online > $mem/memory$block/state
+ case "$?" in
+ "0")
+ log -p i -t DMM \'echo online\' to logical hotplug succeeded.
+ ;;
+ *)
+ log -p e -t DMM \'echo online\' to logical hotplug failed.
+ return
+ ;;
+ esac
+ ;;
+ esac
+
+ setprop ro.dev.dmm.dpd.start_address $movable_start_bytes
+ setprop ro.dev.dmm.dpd.block $block
+ ;;
+ esac
+
+ case "$target" in
+ "msm8960")
+ return
+ ;;
+ esac
+
+ # For 7X30 targets:
+ # ro.dev.dmm.dpd.start_address is set when the target has a 2x256Mb memory
+ # configuration. This is also used to indicate that the target is capable of
+ # setting EBI-1 to Deep Power Down or Self Refresh.
+ op=`cat $mem/low_power_memory_start_bytes`
+ case "$op" in
+ "0")
+ log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes not set:$op
+ ;;
+ "$mem/low_power_memory_start_bytes No such file or directory ")
+ log -p i -t DMM Self-Refresh-Only Disabled. low_power_memory_start_bytes does not exist:$op
+ ;;
+ *)
+ log -p i -t DMM Self-Refresh-Only available. low_power_memory_start_bytes at $op
+ ;;
+ esac
+}
+
+#
+# For controlling console and shell on console on 8960 - perist.serial.enable 8960
+# On other target use default ro.debuggable property.
+#
+serial=`getprop persist.serial.enable`
+dserial=`getprop ro.debuggable`
+case "$target" in
+ "msm8960")
+ case "$serial" in
+ "0")
+ echo 0 > /sys/devices/platform/msm_serial_hsl.0/console
+ ;;
+ "1")
+ echo 1 > /sys/devices/platform/msm_serial_hsl.0/console
+ start console
+ ;;
+ *)
+ case "$dserial" in
+ "1")
+ start console
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ "msm8610" | "msm8974" | "msm8226")
+ case "$serial" in
+ "0")
+ echo 0 > /sys/devices/f991f000.serial/console
+ ;;
+ "1")
+ echo 1 > /sys/devices/f991f000.serial/console
+ start console
+ ;;
+ *)
+ case "$dserial" in
+ "1")
+ start console
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ *)
+ case "$dserial" in
+ "1")
+ start console
+ ;;
+ esac
+ ;;
+esac
+
+#
+# Allow persistent faking of bms
+# User needs to set fake bms charge in persist.bms.fake_batt_capacity
+#
+fake_batt_capacity=`getprop persist.bms.fake_batt_capacity`
+case "$fake_batt_capacity" in
+ "") ;; #Do nothing here
+ * )
+ echo "$fake_batt_capacity" > /sys/class/power_supply/battery/capacity
+ ;;
+esac
+
+case "$target" in
+ "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
+ insmod /system/lib/modules/ss_mfcinit.ko
+ insmod /system/lib/modules/ss_vencoder.ko
+ insmod /system/lib/modules/ss_vdecoder.ko
+ chmod -h 0666 /dev/ss_mfc_reg
+ chmod -h 0666 /dev/ss_vdec
+ chmod -h 0666 /dev/ss_venc
+
+ init_DMM
+ ;;
+
+ "msm8960")
+ init_DMM
+ ;;
+esac
diff --git a/recovery/init.qcom.early_boot.sh b/recovery/init.qcom.early_boot.sh
new file mode 100755
index 0000000..a8bcf09
--- /dev/null
+++ b/recovery/init.qcom.early_boot.sh
@@ -0,0 +1,200 @@
+#!/system/bin/sh
+# Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of The Linux Foundation nor
+# the names of its contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+export PATH=/system/bin
+
+# Set platform variables
+if [ -f /sys/devices/soc0/hw_platform ]; then
+ soc_hwplatform=`cat /sys/devices/soc0/hw_platform` 2> /dev/null
+else
+ soc_hwplatform=`cat /sys/devices/system/soc/soc0/hw_platform` 2> /dev/null
+fi
+if [ -f /sys/devices/soc0/soc_id ]; then
+ soc_hwid=`cat /sys/devices/soc0/soc_id` 2> /dev/null
+else
+ soc_hwid=`cat /sys/devices/system/soc/soc0/id` 2> /dev/null
+fi
+if [ -f /sys/devices/soc0/platform_version ]; then
+ soc_hwver=`cat /sys/devices/soc0/platform_version` 2> /dev/null
+else
+ soc_hwver=`cat /sys/devices/system/soc/soc0/platform_version` 2> /dev/null
+fi
+
+log -t BOOT -p i "MSM target '$1', SoC '$soc_hwplatform', HwID '$soc_hwid', SoC ver '$soc_hwver'"
+
+case "$1" in
+ "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
+ case "$soc_hwplatform" in
+ "FFA" | "SVLTE_FFA")
+ # linking to surf_keypad_qwerty.kcm.bin instead of surf_keypad_numeric.kcm.bin so that
+ # the UI keyboard works fine.
+ ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
+ ;;
+ "Fluid")
+ setprop ro.sf.lcd_density 240
+ setprop qcom.bt.dev_power_class 2
+ ;;
+ *)
+ ln -s /system/usr/keychars/surf_keypad_qwerty.kcm.bin /system/usr/keychars/surf_keypad.kcm.bin
+ ;;
+ esac
+ ;;
+
+ "msm8660")
+ case "$soc_hwplatform" in
+ "Fluid")
+ setprop ro.sf.lcd_density 240
+ ;;
+ "Dragon")
+ setprop ro.sound.alsa "WM8903"
+ ;;
+ esac
+ ;;
+
+ "msm8960")
+ # lcd density is write-once. Hence the separate switch case
+ case "$soc_hwplatform" in
+ "Liquid")
+ if [ "$soc_hwver" == "196608" ]; then # version 0x30000 is 3D sku
+ setprop ro.sf.hwrotation 90
+ fi
+
+ setprop ro.sf.lcd_density 160
+ ;;
+ "MTP")
+ setprop ro.sf.lcd_density 240
+ ;;
+ *)
+ case "$soc_hwid" in
+ "109")
+ setprop ro.sf.lcd_density 160
+ ;;
+ *)
+ setprop ro.sf.lcd_density 240
+ ;;
+ esac
+ ;;
+ esac
+
+ #Set up composition type based on the target
+ case "$soc_hwid" in
+ 87)
+ #8960
+ setprop debug.composition.type dyn
+ ;;
+ 153|154|155|156|157|138)
+ #8064 V2 PRIME | 8930AB | 8630AB | 8230AB | 8030AB | 8960AB
+ setprop debug.composition.type c2d
+ ;;
+ *)
+ esac
+ ;;
+
+ "msm8974")
+ case "$soc_hwplatform" in
+ "Liquid")
+ setprop ro.sf.lcd_density 160
+ # Liquid do not have hardware navigation keys, so enable
+ # Android sw navigation bar
+ setprop ro.hw.nav_keys 0
+ ;;
+ "Dragon")
+ setprop ro.sf.lcd_density 240
+ ;;
+ *)
+ setprop ro.sf.lcd_density 320
+ ;;
+ esac
+ ;;
+
+ "msm8226")
+ case "$soc_hwplatform" in
+ *)
+ setprop ro.sf.lcd_density 320
+ ;;
+ esac
+ ;;
+
+ "msm8610" | "apq8084" | "mpq8092")
+ case "$soc_hwplatform" in
+ *)
+ setprop ro.sf.lcd_density 240
+ ;;
+ esac
+ ;;
+ "apq8084")
+ case "$soc_hwplatform" in
+ "Liquid")
+ setprop ro.sf.lcd_density 320
+ # Liquid do not have hardware navigation keys, so enable
+ # Android sw navigation bar
+ setprop ro.hw.nav_keys 0
+ ;;
+ "SBC")
+ setprop ro.sf.lcd_density 200
+ # SBC do not have hardware navigation keys, so enable
+ # Android sw navigation bar
+ setprop qemu.hw.mainkeys 0
+ ;;
+ *)
+ setprop ro.sf.lcd_density 480
+ ;;
+ esac
+ ;;
+esac
+
+# Setup HDMI related nodes & permissions
+# HDMI can be fb1 or fb2
+# Loop through the sysfs nodes and determine
+# the HDMI(dtv panel)
+for fb_cnt in 0 1 2
+do
+file=/sys/class/graphics/fb$fb_cnt
+dev_file=/dev/graphics/fb$fb_cnt
+ if [ -d "$file" ]
+ then
+ value=`cat $file/msm_fb_type`
+ case "$value" in
+ "dtv panel")
+ chown -h system.graphics $file/hpd
+ chown -h system.system $file/hdcp/tp
+ chown -h system.graphics $file/vendor_name
+ chown -h system.graphics $file/product_description
+ chmod -h 0664 $file/hpd
+ chmod -h 0664 $file/hdcp/tp
+ chmod -h 0664 $file/vendor_name
+ chmod -h 0664 $file/product_description
+ chmod -h 0664 $file/video_mode
+ chmod -h 0664 $file/format_3d
+ # create symbolic link
+ ln -s $dev_file /dev/graphics/hdmi
+ # Change owner and group for media server and surface flinger
+ chown -h system.system $file/format_3d;;
+ esac
+ fi
+done
diff --git a/recovery/init.qcom.factory.sh b/recovery/init.qcom.factory.sh
new file mode 100755
index 0000000..6ba4823
--- /dev/null
+++ b/recovery/init.qcom.factory.sh
@@ -0,0 +1,230 @@
+#!/system/bin/sh
+# Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of The Linux Foundation nor
+# the names of its contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# Actions on fast factory test mode
+ chown -h bluetooth.bluetooth /sys/module/bluetooth_power/parameters/power
+ chown -h bluetooth.bluetooth /sys/class/rfkill/rfkill0/type
+ chown -h bluetooth.bluetooth /sys/class/rfkill/rfkill0/state
+ chown -h bluetooth.bluetooth /proc/bluetooth/sleep/proto
+ chown -h system.system /sys/module/sco/parameters/disable_esco
+ chown -h bluetooth.bluetooth /sys/module/hci_smd/parameters/hcismd_set
+ chmod -h 0660 /sys/module/bluetooth_power/parameters/power
+ chmod -h 0660 /sys/module/hci_smd/parameters/hcismd_set
+ chmod -h 0660 /sys/class/rfkill/rfkill0/state
+ chmod -h 0660 /proc/bluetooth/sleep/proto
+ chown -h bluetooth.bluetooth /dev/ttyHS0
+ chmod -h 0660 /dev/ttyHS0
+ chown -h bluetooth.bluetooth /sys/devices/platform/msm_serial_hs.0/clock
+ chmod -h 0660 /sys/devices/platform/msm_serial_hs.0/clock
+
+ chmod -h 0660 /dev/ttyHS2
+ chown -h bluetooth.bluetooth /dev/ttyHS2
+
+ #Create QMUX deamon socket area
+ mkdir -p /dev/socket/qmux_radio
+ chown -h radio.radio /dev/socket/qmux_radio
+ chmod -h 2770 /dev/socket/qmux_radio
+ mkdir -p /dev/socket/qmux_audio
+ chown -h media.audio /dev/socket/qmux_audio
+ chmod -h 2770 /dev/socket/qmux_audio
+ mkdir -p /dev/socket/qmux_bluetooth
+ chown -h bluetooth.bluetooth /dev/socket/qmux_bluetooth
+ chmod -h 2770 /dev/socket/qmux_bluetooth
+ mkdir -p /dev/socket/qmux_gps
+ chown -h gps.gps /dev/socket/qmux_gps
+ chmod -h 2770 /dev/socket/qmux_gps
+
+ # Allow QMUX daemon to assign port open wait time
+ chown -h radio.radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait
+
+ setprop wifi.interface wlan0
+
+ setprop ro.telephony.call_ring.multiple false
+
+ #Set SUID bit for usbhub
+ chmod -h 4755 /system/bin/usbhub
+ chmod -h 755 /system/bin/usbhub_init
+
+ #Remove SUID bit for iproute2 ip tool
+ chmod -h 0755 /system/bin/ip
+
+ chmod -h 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state
+
+ # setup permissions for fb1 related nodes
+ chown -h system.graphics /sys/class/graphics/fb1/hpd
+ chown -h system.system /sys/class/graphics/fb1/hdcp/tp
+ chmod -h 0664 /sys/devices/virtual/graphics/fb1/hpd
+ chmod -h 0664 /sys/devices/virtual/graphics/fb1/hdcp/tp
+ chmod -h 0664 /sys/devices/virtual/graphics/fb1/video_mode
+ chmod -h 0664 /sys/devices/virtual/graphics/fb1/format_3d
+
+ # Change owner and group for media server and surface flinger
+ chown -h system.system /sys/devices/virtual/graphics/fb1/format_3d
+
+ #For bridgemgr daemon to inform the USB driver of the correct transport
+ chown -h radio.radio /sys/class/android_usb/f_rmnet_smd_sdio/transport
+
+ #To allow interfaces to get v6 address when tethering is enabled
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet0/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet1/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet2/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet3/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet4/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet5/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet6/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet7/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio0/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio1/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio2/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio3/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio4/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio5/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio6/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_sdio7/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb0/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb1/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb2/accept_ra
+ echo 2 > /proc/sys/net/ipv6/conf/rmnet_usb3/accept_ra
+
+ # To prevent out of order acknowledgements from making
+ # connection tracking to treat them as not belonging to
+ # the connection they belong to.
+ # Otherwise, a weird issue happens in which some long
+ # connections on high-throughput links get dropped when
+ # an ack packet comes out of order
+ echo 1 > /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal
+
+#TODO:
+# basic network init
+# ifup lo
+# hostname localhost
+# domainname localdomain
+
+# set RLIMIT_NICE to allow priorities from 19 to -20
+# setrlimit 13 40 40
+
+# Memory management. Basic kernel parameters, and allow the high
+# level system server to be able to adjust the kernel OOM driver
+# parameters to match how it is managing things.
+ echo 1 > /proc/sys/vm/overcommit_memory
+ echo 4 > /proc/sys/vm/min_free_order_shift
+ chown -h root.system /sys/module/lowmemorykiller/parameters/adj
+ chmod -h 0664 /sys/module/lowmemorykiller/parameters/adj
+ chown -h root.system /sys/module/lowmemorykiller/parameters/minfree
+ chmod -h 0664 /sys/module/lowmemorykiller/parameters/minfree
+
+ # Tweak background writeout
+ echo 200 > /proc/sys/vm/dirty_expire_centisecs
+ echo 5 > /proc/sys/vm/dirty_background_ratio
+
+ # Permissions for System Server and daemons.
+ chown -h radio.system /sys/android_power/state
+ chown -h radio.system /sys/android_power/request_state
+ chown -h radio.system /sys/android_power/acquire_full_wake_lock
+ chown -h radio.system /sys/android_power/acquire_partial_wake_lock
+ chown -h radio.system /sys/android_power/release_wake_lock
+ chown -h system.system /sys/power/autosleep
+ chown -h system.system /sys/power/state
+ chown -h system.system /sys/power/wakeup_count
+ chown -h radio.system /sys/power/wake_lock
+ chown -h radio.system /sys/power/wake_unlock
+ chmod -h 0660 /sys/power/state
+ chmod -h 0660 /sys/power/wake_lock
+ chmod -h 0660 /sys/power/wake_unlock
+
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/timer_rate
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/timer_rate
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boost
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/boost
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boostpulse
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/input_boost
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/input_boost
+ chown -h system.system /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
+ chmod -h 0660 /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
+
+ # Assume SMP uses shared cpufreq policy for all CPUs
+ chown -h system.system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+ chmod -h 0660 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+
+ chown -h system.system /sys/class/timed_output/vibrator/enable
+ chown -h system.system /sys/class/leds/keyboard-backlight/brightness
+ chown -h system.system /sys/class/leds/lcd-backlight/brightness
+ chown -h system.system /sys/class/leds/button-backlight/brightness
+ chown -h system.system /sys/class/leds/jogball-backlight/brightness
+ chown -h system.system /sys/class/leds/red/brightness
+ chown -h system.system /sys/class/leds/green/brightness
+ chown -h system.system /sys/class/leds/blue/brightness
+ chown -h system.system /sys/class/leds/red/device/grpfreq
+ chown -h system.system /sys/class/leds/red/device/grppwm
+ chown -h system.system /sys/class/leds/red/device/blink
+ chown -h system.system /sys/class/leds/red/brightness
+ chown -h system.system /sys/class/leds/green/brightness
+ chown -h system.system /sys/class/leds/blue/brightness
+ chown -h system.system /sys/class/leds/red/device/grpfreq
+ chown -h system.system /sys/class/leds/red/device/grppwm
+ chown -h system.system /sys/class/leds/red/device/blink
+ chown -h system.system /sys/class/timed_output/vibrator/enable
+ chown -h system.system /sys/module/sco/parameters/disable_esco
+ chown -h system.system /sys/kernel/ipv4/tcp_wmem_min
+ chown -h system.system /sys/kernel/ipv4/tcp_wmem_def
+ chown -h system.system /sys/kernel/ipv4/tcp_wmem_max
+ chown -h system.system /sys/kernel/ipv4/tcp_rmem_min
+ chown -h system.system /sys/kernel/ipv4/tcp_rmem_def
+ chown -h system.system /sys/kernel/ipv4/tcp_rmem_max
+ chown -h root radio /proc/cmdline
+
+# Set the property to indicate type of virtual display to 0
+# 0 indicates that virtual display is not a Wifi display and that the
+# session is not exercised through RemoteDisplay in the android framework
+ setprop persist.sys.wfd.virtual 0
+
+# Set this property so surfaceflinger is not started by system_init
+ setprop system_init.startsurfaceflinger 0
+
+# Start the following services needed for fftm
+ start config_bluetooth
+ start media
+ start fastmmi
+ start adbd
+ start qcom-post-boot
+ start rmt_storage
+ start qcom-c_main-sh
+ start irsc_util
+ start qcamerasvr
+ start qcom-usb-sh
+ start qcomsysd
+ start ptt_ffbm
+ start ftm_ffbm
diff --git a/recovery/init.qcom.sh b/recovery/init.qcom.sh
new file mode 100755
index 0000000..a673b5a
--- /dev/null
+++ b/recovery/init.qcom.sh
@@ -0,0 +1,201 @@
+#!/system/bin/sh
+# Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of The Linux Foundation nor
+# the names of its contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+target=`getprop ro.board.platform`
+if [ -f /sys/devices/soc0/soc_id ]; then
+ platformid=`cat /sys/devices/soc0/soc_id`
+else
+ platformid=`cat /sys/devices/system/soc/soc0/id`
+fi
+#
+# Function to start sensors for DSPS enabled platforms
+#
+start_sensors()
+{
+ if [ -c /dev/msm_dsps -o -c /dev/sensors ]; then
+ chmod -h 775 /persist/sensors
+ chmod -h 664 /persist/sensors/sensors_settings
+ chown -h system.root /persist/sensors/sensors_settings
+
+ mkdir -p /data/misc/sensors
+ chmod -h 775 /data/misc/sensors
+
+ start sensors
+ fi
+}
+
+start_battery_monitor()
+{
+ if ls /sys/bus/spmi/devices/qpnp-bms-*/fcc_data ; then
+ chown -h root.system /sys/module/pm8921_bms/parameters/*
+ chown -h root.system /sys/module/qpnp_bms/parameters/*
+ chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_data
+ chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_temp
+ chown -h root.system /sys/bus/spmi/devices/qpnp-bms-*/fcc_chgcyl
+ chmod -h 0660 /sys/module/qpnp_bms/parameters/*
+ chmod -h 0660 /sys/module/pm8921_bms/parameters/*
+ mkdir -p /data/bms
+ chown -h root.system /data/bms
+ chmod -h 0770 /data/bms
+ start battery_monitor
+ fi
+}
+
+start_charger_monitor()
+{
+ if ls /sys/module/qpnp_charger/parameters/charger_monitor; then
+ chown -h root.system /sys/module/qpnp_charger/parameters/*
+ chown -h root.system /sys/class/power_supply/battery/input_current_max
+ chown -h root.system /sys/class/power_supply/battery/input_current_trim
+ chown -h root.system /sys/class/power_supply/battery/input_current_settled
+ chown -h root.system /sys/class/power_supply/battery/voltage_min
+ chmod -h 0664 /sys/class/power_supply/battery/input_current_max
+ chmod -h 0664 /sys/class/power_supply/battery/input_current_trim
+ chmod -h 0664 /sys/class/power_supply/battery/input_current_settled
+ chmod -h 0664 /sys/class/power_supply/battery/voltage_min
+ chmod -h 0664 /sys/module/qpnp_charger/parameters/charger_monitor
+ start charger_monitor
+ fi
+}
+
+start_vm_bms()
+{
+ if [ -e /dev/vm_bms ]; then
+ chown -h root.system /sys/class/power_supply/bms/current_now
+ chown -h root.system /sys/class/power_supply/bms/voltage_ocv
+ chmod -h 0664 /sys/class/power_supply/bms/current_now
+ chmod -h 0664 /sys/class/power_supply/bms/voltage_ocv
+ start vm_bms
+ fi
+}
+
+start_msm_irqbalance()
+{
+ if [ -f /system/bin/msm_irqbalance ]; then
+ case "$platformid" in
+ "239")
+ start msm_irqbalance;;
+ esac
+ fi
+}
+
+baseband=`getprop ro.baseband`
+#
+# Suppress default route installation during RA for IPV6; user space will take
+# care of this
+# exception default ifc
+for file in /proc/sys/net/ipv6/conf/*
+do
+ echo 0 > $file/accept_ra_defrtr
+done
+echo 1 > /proc/sys/net/ipv6/conf/default/accept_ra_defrtr
+
+case "$baseband" in
+ "svlte2a")
+ start bridgemgrd
+ ;;
+esac
+
+start_sensors
+
+case "$target" in
+ "msm7630_surf" | "msm7630_1x" | "msm7630_fusion")
+ if [ -f /sys/devices/soc0/hw_platform ]; then
+ value=`cat /sys/devices/soc0/hw_platform`
+ else
+ value=`cat /sys/devices/system/soc/soc0/hw_platform`
+ fi
+ case "$value" in
+ "Fluid")
+ start profiler_daemon;;
+ esac
+ ;;
+ "msm8660" )
+ if [ -f /sys/devices/soc0/hw_platform ]; then
+ platformvalue=`cat /sys/devices/soc0/hw_platform`
+ else
+ platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
+ fi
+ case "$platformvalue" in
+ "Fluid")
+ start profiler_daemon;;
+ esac
+ ;;
+ "msm8960")
+ case "$baseband" in
+ "msm")
+ start_battery_monitor;;
+ esac
+
+ if [ -f /sys/devices/soc0/hw_platform ]; then
+ platformvalue=`cat /sys/devices/soc0/hw_platform`
+ else
+ platformvalue=`cat /sys/devices/system/soc/soc0/hw_platform`
+ fi
+ case "$platformvalue" in
+ "Fluid")
+ start profiler_daemon;;
+ "Liquid")
+ start profiler_daemon;;
+ esac
+ ;;
+ "msm8974")
+ platformvalue=`cat /sys/devices/soc0/hw_platform`
+ case "$platformvalue" in
+ "Fluid")
+ start profiler_daemon;;
+ "Liquid")
+ start profiler_daemon;;
+ esac
+ case "$baseband" in
+ "msm")
+ start_battery_monitor
+ ;;
+ esac
+ start_charger_monitor
+ ;;
+ "apq8084")
+ platformvalue=`cat /sys/devices/soc0/hw_platform`
+ case "$platformvalue" in
+ "Fluid")
+ start profiler_daemon;;
+ "Liquid")
+ start profiler_daemon;;
+ esac
+ ;;
+ "msm8226")
+ start_charger_monitor
+ ;;
+ "msm8610")
+ start_charger_monitor
+ ;;
+ "msm8916")
+ start_vm_bms
+ start_msm_irqbalance
+ ;;
+esac
diff --git a/recovery/init.qcom.ssr.sh b/recovery/init.qcom.ssr.sh
new file mode 100755
index 0000000..f144162
--- /dev/null
+++ b/recovery/init.qcom.ssr.sh
@@ -0,0 +1,137 @@
+#!/system/bin/sh
+# Copyright (c) 2013, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of The Linux Foundation nor
+# the names of its contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+ssr_str="$1"
+IFS=,
+ssr_array=($ssr_str)
+declare -i subsys_mask=0
+
+# check user input subsystem with system device
+ssr_check_subsystem_name()
+{
+ declare -i i=0
+ subsys=`cat /sys/bus/msm_subsys/devices/subsys$i/name`
+ while [ "$subsys" != "" ]
+ do
+ if [ "$subsys" == "$ssr_name" ]; then
+ return 1
+ fi
+ i=$i+1
+ subsys=`cat /sys/bus/msm_subsys/devices/subsys$i/name`
+ done
+ return 0
+}
+
+# set subsystem mask to indicate which subsystem needs to be enabled
+for num in "${!ssr_array[@]}"
+do
+ case "${ssr_array[$num]}" in
+ "1")
+ subsys_mask=0
+ ;;
+ "riva")
+ subsys_mask=$subsys_mask+1
+ ;;
+ "3")
+ subsys_mask=63
+ ;;
+ "adsp")
+ ssr_name=adsp
+ if ( ssr_check_subsystem_name ); then
+ subsys_mask=$subsys_mask+2
+ fi
+ ;;
+ "modem")
+ ssr_name=modem
+ if ( ssr_check_subsystem_name ); then
+ subsys_mask=$subsys_mask+4
+ fi
+ ;;
+ "wcnss")
+ ssr_name=wcnss
+ if ( ssr_check_subsystem_name ); then
+ subsys_mask=$subsys_mask+8
+ fi
+ ;;
+ "venus")
+ ssr_name=venus
+ if ( ssr_check_subsystem_name ); then
+ subsys_mask=$subsys_mask+16
+ fi
+ ;;
+ "external_modem")
+ ssr_name=external_modem
+ if ( ssr_check_subsystem_name ); then
+ subsys_mask=$subsys_mask+32
+ fi
+ ;;
+ esac
+done
+
+# enable selected subsystem restart
+if [ $((subsys_mask & 1)) == 1 ]; then
+ echo 1 > /sys/module/wcnss_ssr_8960/parameters/enable_riva_ssr
+else
+ echo 0 > /sys/module/wcnss_ssr_8960/parameters/enable_riva_ssr
+fi
+
+if [ $((subsys_mask & 2)) == 2 ]; then
+ echo "related" > /sys/bus/msm_subsys/devices/subsys0/restart_level
+else
+ echo "system" > /sys/bus/msm_subsys/devices/subsys0/restart_level
+fi
+
+if [ $((subsys_mask & 4)) == 4 ]; then
+ echo "related" > /sys/bus/msm_subsys/devices/subsys1/restart_level
+else
+ echo "system" > /sys/bus/msm_subsys/devices/subsys1/restart_level
+fi
+
+if [ $((subsys_mask & 8)) == 8 ]; then
+ echo "related" > /sys/bus/msm_subsys/devices/subsys2/restart_level
+else
+ echo "system" > /sys/bus/msm_subsys/devices/subsys2/restart_level
+fi
+
+if [ $((subsys_mask & 16)) == 16 ]; then
+ echo "related" > /sys/bus/msm_subsys/devices/subsys3/restart_level
+else
+ echo "system" > /sys/bus/msm_subsys/devices/subsys3/restart_level
+fi
+
+if [ $((subsys_mask & 32)) == 32 ]; then
+ echo "related" > /sys/bus/msm_subsys/devices/subsys4/restart_level
+else
+ echo "system" > /sys/bus/msm_subsys/devices/subsys4/restart_level
+fi
+
+if [ $((subsys_mask & 63)) == 63 ]; then
+ echo 3 > /sys/module/subsystem_restart/parameters/restart_level
+else
+ echo 1 > /sys/module/subsystem_restart/parameters/restart_level
+fi
diff --git a/recovery/init.qcom.syspart_fixup.sh b/recovery/init.qcom.syspart_fixup.sh
new file mode 100755
index 0000000..661b635
--- /dev/null
+++ b/recovery/init.qcom.syspart_fixup.sh
@@ -0,0 +1,79 @@
+#!/system/bin/sh
+# Copyright (c) 2012, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of The Linux Foundation nor
+# the names of its contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+target="$1"
+serial="$2"
+
+# No path is set up at this point so we have to do it here.
+PATH=/sbin:/system/sbin:/system/bin:/system/xbin
+export PATH
+
+mount_needed=false;
+
+if [ ! -f /system/etc/boot_fixup ];then
+# This should be the first command
+# remount system as read-write.
+ mount -o rw,remount,barrier=1 /system
+ mount_needed=true;
+fi
+
+# **** WARNING *****
+# This runs in a single-threaded, critical path portion
+# of the Android bootup sequence. This is to guarantee
+# all necessary system partition fixups are done before
+# the rest of the system starts up. Run any non-
+# timing critical tasks in a separate process to
+# prevent slowdown at boot.
+
+# Run modem link script
+if [ -f /system/etc/init.qcom.modem_links.sh ]; then
+ /system/bin/sh /system/etc/init.qcom.modem_links.sh
+fi
+
+# Run mdm link script
+if [ -f /system/etc/init.qcom.mdm_links.sh ]; then
+ /system/bin/sh /system/etc/init.qcom.mdm_links.sh
+fi
+
+# Run wifi script
+if [ -f /system/etc/init.qcom.wifi.sh ]; then
+ /system/bin/sh /system/etc/init.qcom.wifi.sh "$target" "$serial"
+fi
+
+# Run the sensor script
+if [ -f /system/etc/init.qcom.sensor.sh ]; then
+ /system/bin/sh /system/etc/init.qcom.sensor.sh
+fi
+
+touch /system/etc/boot_fixup
+
+if $mount_needed ;then
+# This should be the last command
+# remount system as read-only.
+ mount -o ro,remount,barrier=1 /system
+fi
diff --git a/recovery/init.qcom.usb.sh b/recovery/init.qcom.usb.sh
new file mode 100755
index 0000000..1f02257
--- /dev/null
+++ b/recovery/init.qcom.usb.sh
@@ -0,0 +1,226 @@
+#!/system/bin/sh
+# Copyright (c) 2012, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of The Linux Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+chown -h root.system /sys/devices/platform/msm_hsusb/gadget/wakeup
+chmod -h 220 /sys/devices/platform/msm_hsusb/gadget/wakeup
+
+#
+# Allow persistent usb charging disabling
+# User needs to set usb charging disabled in persist.usb.chgdisabled
+#
+target=`getprop ro.board.platform`
+usbchgdisabled=`getprop persist.usb.chgdisabled`
+case "$usbchgdisabled" in
+ "") ;; #Do nothing here
+ * )
+ case $target in
+ "msm8660")
+ echo "$usbchgdisabled" > /sys/module/pmic8058_charger/parameters/disabled
+ echo "$usbchgdisabled" > /sys/module/smb137b/parameters/disabled
+ ;;
+ "msm8960")
+ echo "$usbchgdisabled" > /sys/module/pm8921_charger/parameters/disabled
+ ;;
+ esac
+esac
+
+usbcurrentlimit=`getprop persist.usb.currentlimit`
+case "$usbcurrentlimit" in
+ "") ;; #Do nothing here
+ * )
+ case $target in
+ "msm8960")
+ echo "$usbcurrentlimit" > /sys/module/pm8921_charger/parameters/usb_max_current
+ ;;
+ esac
+esac
+
+#
+# Check ESOC for external MDM
+#
+# Note: currently only a single MDM is supported
+#
+if [ -d /sys/bus/esoc/devices ]; then
+for f in /sys/bus/esoc/devices/*; do
+ if [ -d $f ]; then
+ esoc_name=`cat $f/esoc_name`
+ if [ "$esoc_name" = "MDM9x25" -o "$esoc_name" = "MDM9x35" ]; then
+ esoc_link=`cat $f/esoc_link`
+ break
+ fi
+ fi
+done
+fi
+
+target=`getprop ro.product.device`
+target=${target:0:7}
+
+#
+# Allow USB enumeration with default PID/VID
+#
+baseband=`getprop ro.baseband`
+echo 1 > /sys/class/android_usb/f_mass_storage/lun/nofua
+usb_config=`getprop persist.sys.usb.config`
+case "$usb_config" in
+ "" | "adb") #USB persist config not set, select default configuration
+ case "$esoc_link" in
+ "HSIC")
+ setprop persist.sys.usb.config diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,mass_storage,adb
+ setprop persist.rmnet.mux enabled
+ ;;
+ "HSIC+PCIe")
+ setprop persist.sys.usb.config diag,diag_mdm,serial_hsic,rmnet_qti_ether,mass_storage,adb
+ ;;
+ "PCIe")
+ setprop persist.sys.usb.config diag,diag_mdm,serial_tty,rmnet_qti_ether,mass_storage,adb
+ ;;
+ *)
+ case "$baseband" in
+ "mdm")
+ setprop persist.sys.usb.config diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,mass_storage,adb
+ ;;
+ "mdm2")
+ setprop persist.sys.usb.config diag,diag_mdm,serial_hsic,serial_tty,rmnet_hsic,mass_storage,adb
+ ;;
+ "sglte")
+ setprop persist.sys.usb.config diag,diag_qsc,serial_smd,serial_tty,serial_hsuart,rmnet_hsuart,mass_storage,adb
+ ;;
+ "dsda" | "sglte2")
+ setprop persist.sys.usb.config diag,diag_mdm,diag_qsc,serial_hsic,serial_hsuart,rmnet_hsic,rmnet_hsuart,mass_storage,adb
+ ;;
+ "dsda2")
+ setprop persist.sys.usb.config diag,diag_mdm,diag_mdm2,serial_hsic,serial_hsusb,rmnet_hsic,rmnet_hsusb,mass_storage,adb
+ ;;
+ *)
+ case "$target" in
+ "msm8916" | "msm8939")
+ #setprop persist.sys.usb.config diag,serial_smd,rmnet_bam,adb
+ setprop persist.sys.usb.config mtp,adb
+ ;;
+ *)
+ setprop persist.sys.usb.config diag,serial_smd,serial_tty,rmnet_bam,mass_storage,adb
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ * ) ;; #USB persist config exists, do nothing
+esac
+
+#
+# Do target specific things
+#
+case "$target" in
+ "msm8974")
+# Select USB BAM - 2.0 or 3.0
+ echo ssusb > /sys/bus/platform/devices/usb_bam/enable
+ ;;
+ "apq8084")
+ if [ "$baseband" == "apq" ]; then
+ echo "msm_hsic_host" > /sys/bus/platform/drivers/xhci_msm_hsic/unbind
+ fi
+ ;;
+ "msm8226")
+ if [ -e /sys/bus/platform/drivers/msm_hsic_host ]; then
+ if [ ! -L /sys/bus/usb/devices/1-1 ]; then
+ echo msm_hsic_host > /sys/bus/platform/drivers/msm_hsic_host/unbind
+ fi
+ fi
+ ;;
+esac
+
+#
+# set module params for embedded rmnet devices
+#
+rmnetmux=`getprop persist.rmnet.mux`
+case "$baseband" in
+ "mdm" | "dsda" | "sglte2")
+ case "$rmnetmux" in
+ "enabled")
+ echo 1 > /sys/module/rmnet_usb/parameters/mux_enabled
+ echo 8 > /sys/module/rmnet_usb/parameters/no_fwd_rmnet_links
+ echo 17 > /sys/module/rmnet_usb/parameters/no_rmnet_insts_per_dev
+ ;;
+ esac
+ echo 1 > /sys/module/rmnet_usb/parameters/rmnet_data_init
+ # Allow QMUX daemon to assign port open wait time
+ chown -h radio.radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait
+ ;;
+ "dsda2")
+ echo 2 > /sys/module/rmnet_usb/parameters/no_rmnet_devs
+ echo hsicctl,hsusbctl > /sys/module/rmnet_usb/parameters/rmnet_dev_names
+ case "$rmnetmux" in
+ "enabled") #mux is neabled on both mdms
+ echo 3 > /sys/module/rmnet_usb/parameters/mux_enabled
+ echo 8 > /sys/module/rmnet_usb/parameters/no_fwd_rmnet_links
+ echo 17 > write /sys/module/rmnet_usb/parameters/no_rmnet_insts_per_dev
+ ;;
+ "enabled_hsic") #mux is enabled on hsic mdm
+ echo 1 > /sys/module/rmnet_usb/parameters/mux_enabled
+ echo 8 > /sys/module/rmnet_usb/parameters/no_fwd_rmnet_links
+ echo 17 > /sys/module/rmnet_usb/parameters/no_rmnet_insts_per_dev
+ ;;
+ "enabled_hsusb") #mux is enabled on hsusb mdm
+ echo 2 > /sys/module/rmnet_usb/parameters/mux_enabled
+ echo 8 > /sys/module/rmnet_usb/parameters/no_fwd_rmnet_links
+ echo 17 > /sys/module/rmnet_usb/parameters/no_rmnet_insts_per_dev
+ ;;
+ esac
+ echo 1 > /sys/module/rmnet_usb/parameters/rmnet_data_init
+ # Allow QMUX daemon to assign port open wait time
+ chown -h radio.radio /sys/devices/virtual/hsicctl/hsicctl0/modem_wait
+ ;;
+esac
+
+#
+# Add support for exposing lun0 as cdrom in mass-storage
+#
+cdromname="/system/etc/cdrom_install.iso"
+platformver=`cat /sys/devices/soc0/hw_platform`
+case "$target" in
+ "msm8226" | "msm8610" | "msm8916")
+ case $platformver in
+ "QRD")
+ echo "mounting usbcdrom lun"
+ echo $cdromname > /sys/class/android_usb/android0/f_mass_storage/rom/file
+ chmod 0444 /sys/class/android_usb/android0/f_mass_storage/rom/file
+ ;;
+ esac
+ ;;
+esac
+
+#
+# Initialize RNDIS Diag option. If unset, set it to 'none'.
+#
+diag_extra=`getprop persist.sys.usb.config.extra`
+if [ "$diag_extra" == "" ]; then
+ setprop persist.sys.usb.config.extra none
+fi
diff --git a/recovery/init.rc b/recovery/init.rc
new file mode 100755
index 0000000..275d250
--- /dev/null
+++ b/recovery/init.rc
@@ -0,0 +1,157 @@
+import /init.recovery.${ro.hardware}.rc
+
+on early-init
+ # Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls.
+ write /sys/fs/selinux/checkreqprot 0
+
+ # Set the security context for the init process.
+ # This should occur before anything else (e.g. ueventd) is started.
+ setcon u:r:init:s0
+
+ start ueventd
+ start healthd
+
+service set_permissive /sbin/toolbox setenforce 0
+ oneshot
+ seclabel u:r:recovery:s0
+
+on init
+ export PATH /sbin:/system/bin
+ export LD_LIBRARY_PATH .:/sbin
+ export ANDROID_ROOT /system
+ export ANDROID_DATA /data
+ export EXTERNAL_STORAGE /sdcard
+
+ symlink /system/etc /etc
+
+ mkdir /boot
+ mkdir /recovery
+ mkdir /sdcard
+ mkdir /sdcard1
+ mkdir /external_sd
+ mkdir /.system
+ mkdir /system
+ mkdir /data
+ mkdir /cache
+ mkdir /sideload
+ mkdir /preload
+ mkdir /custom
+ mkdir /efs
+ mkdir /tmp
+ mkdir /carrier
+ mkdir /firmware 0711 system system
+ mount tmpfs tmpfs /tmp
+
+ chown root shell /tmp
+ chmod 0775 /tmp
+
+ write /proc/sys/kernel/panic_on_oops 1
+ write /proc/sys/vm/max_map_count 1000000
+
+on fs
+ mount pstore pstore /sys/fs/pstore
+
+ mkdir /dev/usb-ffs 0770 shell shell
+ mkdir /dev/usb-ffs/adb 0770 shell shell
+ mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
+
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 04e8
+ write /sys/class/android_usb/android0/idProduct 6860
+ write /sys/class/android_usb/android0/f_ffs/aliases adb
+ write /sys/class/android_usb/android0/functions mtp,adb
+ write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
+ write /sys/class/android_usb/android0/iProduct ${ro.product.model}
+ write /sys/class/android_usb/android0/iSerial ${ro.serialno}
+
+on boot
+ ifup lo
+ hostname localhost
+ domainname localdomain
+
+ class_start default
+
+# Load properties from /system/ + /factory after fs mount.
+on load_all_props_action
+ load_all_props
+
+on firmware_mounts_complete
+ rm /dev/.booting
+
+# Mount filesystems and start core system services.
+on late-init
+ trigger early-fs
+ trigger fs
+ trigger post-fs
+ trigger post-fs-data
+
+ # Load properties from /system/ + /factory after fs mount. Place
+ # this in another action so that the load will be scheduled after the prior
+ # issued fs triggers have completed.
+ trigger load_all_props_action
+
+ # Remove a file to wake up anything waiting for firmware
+ trigger firmware_mounts_complete
+
+ trigger early-boot
+ trigger boot
+
+on property:sys.powerctl=*
+ powerctl ${sys.powerctl}
+
+on property:sys.storage.ums_enabled=1
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/functions adb,mass_storage
+ write /sys/class/android_usb/android0/enable 1
+
+on property:sys.storage.ums_enabled=0
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/enable ${service.adb.root}
+
+on property:sys.usb.config=none
+ stop adbd
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/bDeviceClass 0
+
+on property:sys.usb.config=mtp,adb
+ stop adbd
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/functions mtp,adb
+ write /sys/class/android_usb/android0/enable 1
+ start adbd
+
+on property:sys.usb.config=adb
+ stop adbd
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/functions adb
+ write /sys/class/android_usb/android0/enable ${service.adb.root}
+ start adbd
+
+service ueventd /sbin/ueventd
+ critical
+ seclabel u:r:ueventd:s0
+
+service healthd /sbin/healthd -n
+ critical
+ seclabel u:r:healthd:s0
+
+service recovery /sbin/recovery
+ seclabel u:r:recovery:s0
+
+service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
+ disabled
+ socket adbd stream 660 system system
+ seclabel u:r:adbd:s0
+
+# Always start adbd on userdebug and eng builds
+on property:ro.debuggable=1
+ #write /sys/class/android_usb/android0/enable 1
+ #start adbd
+ setprop service.adb.root 1
+
+# Restart adbd so it can run as root
+on property:service.adb.root=1
+ write /sys/class/android_usb/android0/enable 0
+ restart adbd
+ write /sys/class/android_usb/android0/enable 1
diff --git a/recovery/publiccert.pem b/recovery/publiccert.pem
new file mode 100644
index 0000000..f5a4a51
--- /dev/null
+++ b/recovery/publiccert.pem
@@ -0,0 +1,25 @@
+-----BEGIN CERTIFICATE-----
+MIIELTCCAxWgAwIBAgIJANEwmqM2Fs8EMA0GCSqGSIb3DQEBBQUAMGwxCzAJBgNV
+BAYTAktSMRQwEgYDVQQIEwtTb3V0aCBLb3JlYTEOMAwGA1UEBxMFU3V3b24xJjAk
+BgNVBAoTHVNhbXN1bmcgRWxlY3Ryb25pY3MgQ28uLCBMdGQuMQ8wDQYDVQQLEwZN
+b2JpbGUwHhcNMTMxMjE2MDg1MDI4WhcNMjMxMjE0MDg1MDI4WjBsMQswCQYDVQQG
+EwJLUjEUMBIGA1UECBMLU291dGggS29yZWExDjAMBgNVBAcTBVN1d29uMSYwJAYD
+VQQKEx1TYW1zdW5nIEVsZWN0cm9uaWNzIENvLiwgTHRkLjEPMA0GA1UECxMGTW9i
+aWxlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArjoOavjEbusT83Dv
+LvsSVrq4y9HhUmZYnVX5VaOgsp7qUM5ntD9zSxR5JQ9QWCbCKh5RDy+ewnXmFcAV
+L2MW5zxn6eI58e5e1Uonx9SnaID5JQHOhKImzH5/1qqVjs467nTTVpkXZOzrzLhs
+EOau34Q/AlZ5QO0gh0TDr7YYHbry7Ie+gYePA/9gcB5UzbLQPz2oNGQPlB9e4KSw
+4XNXu8BfguRltQbkJkm8/BD93vKN7MIbsxIYCzIIBjv/J79ho4NQqzpky9PFzCt/
+KL1Ts7DsoQ6r3GeDgebc1ques18UXUZ1wenHy5k4ruCl6ZJ7QaxzHyEta/RT+VOC
+j3IuwwIDAQABo4HRMIHOMB0GA1UdDgQWBBQp+BW4OYblL74MNaxtLPuKS1Ky4DCB
+ngYDVR0jBIGWMIGTgBQp+BW4OYblL74MNaxtLPuKS1Ky4KFwpG4wbDELMAkGA1UE
+BhMCS1IxFDASBgNVBAgTC1NvdXRoIEtvcmVhMQ4wDAYDVQQHEwVTdXdvbjEmMCQG
+A1UEChMdU2Ftc3VuZyBFbGVjdHJvbmljcyBDby4sIEx0ZC4xDzANBgNVBAsTBk1v
+YmlsZYIJANEwmqM2Fs8EMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEB
+AEKg+91c2q1OKoP89QAQCKlLXKQNaaGQisMLISeBAkfF8npSPmftDSu9IPMTR9ZG
+2AwCgH1SoI4cBqKJviU1M41IHTC3qJXRAv52Mjfv47AbkVyzLvE5YL/9R9zY+ER/
+4KFvye4EvsybB9l0B8eoF/Pk4olX2KrhqkP8EtcDr47VI+FloeHGFef9DSvUz3Np
+MQMp4jdNBUZ57mXwKRl1pMgz3f+Cgwi9zWmK9/lf+w0OXKBXxB+vhGMpg/7Y/Ohj
+B4OHj7fOFedOEZlSmois41gknKgxyzvd1Xig7QcpIYUgH9FMPZxzhgMElY6zOroC
+SYgfWsLmjJM+Q9nMhCMaJf0=
+-----END CERTIFICATE-----
diff --git a/recovery/twrp.fstab b/recovery/twrp.fstab
new file mode 100644
index 0000000..322eb98
--- /dev/null
+++ b/recovery/twrp.fstab
@@ -0,0 +1,45 @@
+/boot emmc /dev/block/bootdevice/by-name/boot
+/recovery emmc /dev/block/bootdevice/by-name/recovery
+/data ext4 /dev/block/bootdevice/by-name/userdata length=-16384
+/cache ext4 /dev/block/bootdevice/by-name/cache
+/system ext4 /dev/block/bootdevice/by-name/system
+/efs1 emmc /dev/block/bootdevice/by-name/efs flags=backup=1;display=EFS
+/efs2 emmc /dev/block/bootdevice/by-name/modemst1 flags=backup=1;subpartitionof=/efs1
+/efs3 emmc /dev/block/bootdevice/by-name/modemst2 flags=backup=1;subpartitionof=/efs1
+/external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="Micro SDcard";storage;wipeingui;removable
+/modem emmc /dev/block/bootdevice/by-name/apnhlos display="apnhlos"
+/mdm emmc /dev/block/bootdevice/by-name/modem display="modem"
+#/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable
+
+#apnhlos emmc /dev/block/mmcblk0p1
+#modem emmc /dev/block/mmcblk0p2
+#sbl1 emmc /dev/block/mmcblk0p3
+#ddr emmc /dev/block/mmcblk0p4
+#aboot emmc /dev/block/mmcblk0p5
+#rpm emmc /dev/block/mmcblk0p6
+#qsee emmc /dev/block/mmcblk0p7
+#qhee emmc /dev/block/mmcblk0p8
+#fsg emmc /dev/block/mmcblk0p9
+#sec emmc /dev/block/mmcblk0p10
+#pad emmc /dev/block/mmcblk0p11
+
+#/efs ext4 /dev/block/mmcblk0p13
+#param emmc /dev/block/mmcblk0p12
+#modemst1 emmc /dev/block/mmcblk0p14
+#modemst2 emmc /dev/block/mmcblk0p15
+#/boot emmc /dev/block/mmcblk0p16
+#/recovery emmc /dev/block/mmcblk0p17
+#fota emmc /dev/block/mmcblk0p18
+#backup emmc /dev/block/mmcblk0p19
+#fsc emmc /dev/block/mmcblk0p20
+#ssd emmc /dev/block/mmcblk0p21
+#persist ext4 /dev/block/mmcblk0p22
+#persdata ext4 /dev/block/mmcblk0p23
+#/system ext4 /dev/block/mmcblk0p24
+#/cache ext4 /dev/block/mmcblk0p25
+#hidden emmc /dev/block/mmcblk0p26
+#/userdata ext4 /dev/block/mmcblk0p27
+
+#/external_sd auto /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="MicroSD card";storage;wipeingui;removable
+#/sd-ext auto /dev/block/mmcblk1p2 flags=display="Second partition";storage;wipeingui;removable
+#/usb-otg auto /dev/block/sda1 /dev/block/sda flags=display="USB OTG";storage;wipeingui;removable
diff --git a/recovery/ueventd.qcom.rc b/recovery/ueventd.qcom.rc
new file mode 100644
index 0000000..763f115
--- /dev/null
+++ b/recovery/ueventd.qcom.rc
@@ -0,0 +1,204 @@
+# Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of The Linux Foundation nor
+# the names of its contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# the DIAG device node is not world writable/readable.
+/dev/diag 0660 system qcom_diag
+
+/dev/genlock 0666 system system
+/dev/kgsl 0666 system system
+/dev/kgsl-3d0 0666 system system
+/dev/kgsl-2d0 0666 root root
+/dev/kgsl-2d1 0666 root root
+/dev/ion 0664 system system
+/dev/rtc0 0600 system system
+/dev/smd0 0660 system system
+/dev/smd4 0660 system system
+/dev/smd_cxm_qmi 0640 radio radio
+/dev/smd5 0660 system system
+/dev/smd6 0660 system system
+/dev/smd7 0660 bluetooth bluetooth
+/dev/ccid_bridge 0660 system system
+
+#permissions for CSVT
+/dev/smd11 0660 radio radio
+
+/dev/radio0 0640 system fm_radio
+/dev/rfcomm0 0660 bluetooth bluetooth
+/dev/ttyUSB0 0660 bluetooth bluetooth
+/dev/smdcntl0 0640 radio radio
+/dev/smdcntl1 0640 radio radio
+/dev/smdcntl2 0640 radio radio
+/dev/smdcntl3 0640 radio radio
+/dev/smdcntl4 0640 radio radio
+/dev/smdcntl5 0640 radio radio
+/dev/smdcntl6 0640 radio radio
+/dev/smdcntl7 0640 radio radio
+/dev/smdcnt_rev0 0640 radio radio
+/dev/smdcnt_rev1 0640 radio radio
+/dev/smdcnt_rev2 0640 radio radio
+/dev/smdcnt_rev3 0640 radio radio
+/dev/smdcnt_rev4 0640 radio radio
+/dev/smdcnt_rev5 0640 radio radio
+/dev/smdcnt_rev6 0640 radio radio
+/dev/smdcnt_rev7 0640 radio radio
+/dev/smdcnt_rev8 0640 radio radio
+/dev/smuxctl32 0640 radio radio
+/dev/sdioctl0 0640 radio radio
+/dev/sdioctl1 0640 radio radio
+/dev/sdioctl2 0640 radio radio
+/dev/sdioctl3 0640 radio radio
+/dev/sdioctl4 0640 radio radio
+/dev/sdioctl5 0640 radio radio
+/dev/sdioctl6 0640 radio radio
+/dev/sdioctl7 0640 radio radio
+/dev/sdioctl8 0640 radio radio
+/dev/rmnet_mux_ctrl 0640 radio radio
+/dev/hsicctl0 0640 radio radio
+/dev/hsicctl1 0640 radio radio
+/dev/hsicctl2 0640 radio radio
+/dev/hsicctl3 0640 radio radio
+/dev/hsicctl4 0640 radio radio
+/dev/hsicctl5 0640 radio radio
+/dev/hsicctl6 0640 radio radio
+/dev/hsicctl7 0640 radio radio
+/dev/hsicctl8 0640 radio radio
+/dev/hsicctl9 0640 radio radio
+/dev/hsicctl10 0640 radio radio
+/dev/hsicctl11 0640 radio radio
+/dev/hsicctl12 0640 radio radio
+/dev/hsicctl13 0640 radio radio
+/dev/hsicctl14 0640 radio radio
+/dev/hsicctl15 0640 radio radio
+/dev/hsicctl16 0640 radio radio
+/dev/mhi_pipe_14 0640 radio radio
+/dev/mhi_pipe_16 0640 radio radio
+/dev/mhi_pipe_32 0640 radio radio
+/dev/video* 0660 system camera
+/dev/media* 0660 system camera
+/dev/v4l-subdev* 0660 system camera
+/dev/qseecom 0660 system drmrpc
+/dev/gemini0 0660 system camera
+/dev/jpeg0 0660 system camera
+/dev/jpeg1 0660 system camera
+/dev/jpeg2 0660 system camera
+/dev/adsprpc-smd 0664 system system
+/dev/msm_camera/* 0660 system camera
+/dev/gemini/ 0660 system camera
+/dev/mercury0 0660 system camera
+/dev/msm_vidc_reg 0660 system audio
+/dev/msm_vidc_dec 0660 system audio
+/dev/msm_vidc_dec_sec 0660 system audio
+/dev/msm_vidc_enc 0660 system audio
+/dev/msm_rotator 0660 system system
+/dev/hw_random 0600 root root
+/dev/adsprpc-smd 0664 system system
+
+#permissions for audio
+/dev/audio_slimslave 0660 system audio
+/dev/msm_qcelp 0660 system audio
+/dev/msm_evrc 0660 system audio
+/dev/msm_wma 0660 system audio
+/dev/msm_wmapro 0660 system audio
+/dev/msm_amrnb 0660 system audio
+/dev/msm_amrwb 0660 system audio
+/dev/msm_amrwbplus 0660 system audio
+/dev/msm_aac 0660 system audio
+/dev/msm_multi_aac 0660 system audio
+/dev/msm_aac_in 0660 system audio
+/dev/msm_qcelp_in 0660 system audio
+/dev/msm_evrc_in 0660 system audio
+/dev/msm_amrnb_in 0640 system audio
+/dev/msm_a2dp_in 0660 system audio
+/dev/msm_ac3 0660 system audio
+/dev/msm_acdb 0660 system audio
+/dev/msm_cad 0660 system audio
+/dev/msm_fm 0660 system audio
+/dev/msm_mvs 0660 system audio
+/dev/msm_pcm_lp_dec 0660 system audio
+/dev/msm_preproc_ctl 0660 system audio
+/dev/msm_rtac 0660 system audio
+/dev/msm_voicememo 0660 system audio
+/dev/radio0 0640 system fm_radio
+/dev/smd3 0660 bluetooth net_bt_stack
+/dev/smd2 0660 bluetooth net_bt_stack
+/dev/ttyHSL1 0660 system system
+/dev/ttyHS1 0660 system system
+/dev/mdm 0660 system radio
+/sys/devices/virtual/smdpkt/smdcntl* open_timeout 0664 radio radio
+/dev/sdio_tty_ciq_00 0660 system system
+/dev/tty_sdio_00 0660 system system
+/dev/ttyGS0 0660 system system
+/dev/i2c-5 0660 media media
+/dev/voice_svc 0660 system audio
+
+# DVB devices
+/dev/dvb/adapter0/demux* 0440 media media
+/dev/dvb/adapter0/dvr* 0660 media media
+/dev/dvb/adapter0/video* 0660 media media
+
+# Broadcast devices
+/dev/tsc_mux0 0660 media media
+/dev/tsc_ci0 0660 media media
+
+# sensors
+/sys/devices/i2c-12/12-* pollrate_ms 0664 system system
+/sys/devices/f9925000.i2c/i2c-0/0-* enable 0660 input system
+/sys/devices/f9925000.i2c/i2c-0/0-* poll_delay 0660 input system
+/sys/devices/soc.0/78b6000.i2c/i2c-0/0-* enable 0660 input system
+/sys/devices/soc.0/78b6000.i2c/i2c-0/0-* poll_delay 0660 input system
+/sys/devices/virtual/optical_sensors/proximity ps_adc 0660 input system
+/sys/devices/virtual/optical_sensors/proximity ps_poll_delay 0660 input system
+/sys/devices/virtual/optical_sensors/lightsensor ls_auto 0660 input system
+/sys/devices/virtual/optical_sensors/lightsensor ls_poll_delay 0660 input system
+/sys/devices/virtual/input/input* poll 0660 input system
+/sys/devices/virtual/input/input* pollrate_ms 0660 input system
+
+# vm_bms
+/dev/vm_bms 0660 system system
+/dev/battery_data 0660 system system
+
+# wlan
+/dev/wcnss_wlan 0660 system system
+/dev/wcnss_ctrl 0660 system system
+#nfc permissions
+/dev/nfc-nci 0660 nfc nfc
+/dev/assd 0660 nfc nfc
+
+# UIO devices
+/dev/uio0 0660 system system
+/dev/uio1 0660 system system
+/dev/uio2 0660 system system
+
+# ESOC devices
+/dev/subsys_esoc* 0640 system radio
+
+# Ramdump devices
+/dev/ramdump* 0640 system system
+
+#latin Mobile TV
+/dev/isdbt 0660 system system
+