From f700a728e20db8199d7d778f6b61c127f61830ec Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 9 Jan 2012 22:50:57 -0800 Subject: [PATCH] maguro: add support for BT firmware loading. From 'adb shell': # cat /sys/class/rfkill/rfkill0/type bluetooth # echo 1 > /sys/class/rfkill/rfkill0/state # setprop ctl.start hciattach Observe 'adb logcat' for success. --- glue/gonk/device/toro/maguro/AndroidBoard.mk | 27 +- glue/gonk/device/toro/maguro/BoardConfig.mk | 1 + .../device/toro/maguro/etc/init.qcom.bt.sh | 131 ++++++ .../toro/maguro/etc/init.qcom.post_boot.sh | 147 +++++++ glue/gonk/device/toro/maguro/extract-files.sh | 4 + .../device/toro/maguro/rootdir/init.qcom.rc | 403 ++++++++++++++++++ glue/gonk/device/toro/maguro/rootdir/init.rc | 10 +- 7 files changed, 706 insertions(+), 17 deletions(-) create mode 100644 glue/gonk/device/toro/maguro/etc/init.qcom.bt.sh create mode 100644 glue/gonk/device/toro/maguro/etc/init.qcom.post_boot.sh create mode 100644 glue/gonk/device/toro/maguro/rootdir/init.qcom.rc diff --git a/glue/gonk/device/toro/maguro/AndroidBoard.mk b/glue/gonk/device/toro/maguro/AndroidBoard.mk index 237220e8..462b2f9e 100644 --- a/glue/gonk/device/toro/maguro/AndroidBoard.mk +++ b/glue/gonk/device/toro/maguro/AndroidBoard.mk @@ -3,19 +3,18 @@ LOCAL_PATH := $(call my-dir) # files that live under /system/etc/... -#copy_from := -# -# -#copy_to := $(addprefix $(TARGET_OUT)/,$(copy_from)) -#copy_from := $(addprefix $(LOCAL_PATH)/,$(copy_from)) -# -#$(copy_to) : PRIVATE_MODULE := system_etcdir -#$(copy_to) : $(TARGET_OUT)/% : $(LOCAL_PATH)/% | $(ACP) -# $(transform-prebuilt-to-target) -# -#ALL_PREBUILT += $(copy_to) +copy_from := \ + etc/init.qcom.bt.sh \ + etc/init.qcom.post_boot.sh \ +copy_to := $(addprefix $(TARGET_OUT)/,$(copy_from)) +copy_from := $(addprefix $(LOCAL_PATH)/,$(copy_from)) +$(copy_to) : PRIVATE_MODULE := system_etcdir +$(copy_to) : $(TARGET_OUT)/% : $(LOCAL_PATH)/% | $(ACP) + $(transform-prebuilt-to-target) + +ALL_PREBUILT += $(copy_to) # files that live under /... file := $(TARGET_ROOT_OUT)/init.rc @@ -24,6 +23,12 @@ $(file) : $(LOCAL_PATH)/rootdir/init.rc | $(ACP) ALL_PREBUILT += $(file) $(INSTALLED_RAMDISK_TARGET): $(file) +file := $(TARGET_ROOT_OUT)/init.qcom.rc +$(file) : $(LOCAL_PATH)/rootdir/init.qcom.rc | $(ACP) + $(transform-prebuilt-to-target) +ALL_PREBUILT += $(file) +$(INSTALLED_RAMDISK_TARGET): $(file) + # kernel stuff... diff --git a/glue/gonk/device/toro/maguro/BoardConfig.mk b/glue/gonk/device/toro/maguro/BoardConfig.mk index 15aa970f..5fa37cd5 100644 --- a/glue/gonk/device/toro/maguro/BoardConfig.mk +++ b/glue/gonk/device/toro/maguro/BoardConfig.mk @@ -33,6 +33,7 @@ ifeq ($(QC_PROP),true) else # BOARD_USES_GENERIC_AUDIO := true USE_CAMERA_STUB := true + BOARD_HAVE_BLUETOOTH := true endif # QC_PROP diff --git a/glue/gonk/device/toro/maguro/etc/init.qcom.bt.sh b/glue/gonk/device/toro/maguro/etc/init.qcom.bt.sh new file mode 100644 index 00000000..f84c1ed9 --- /dev/null +++ b/glue/gonk/device/toro/maguro/etc/init.qcom.bt.sh @@ -0,0 +1,131 @@ +#!/system/bin/sh +# Copyright (c) 2009-2011, Code Aurora Forum. 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 Code Aurora 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. +# + +BLUETOOTH_SLEEP_PATH=/proc/bluetooth/sleep/proto +LOG_TAG="qcom-bluetooth" +LOG_NAME="${0}:" + +hciattach_pid="" + +loge () +{ + /system/bin/log -t $LOG_TAG -p e "$LOG_NAME $@" +} + +logi () +{ + /system/bin/log -t $LOG_TAG -p i "$LOG_NAME $@" +} + +failed () +{ + loge "$1: exit code $2" + exit $2 +} + +start_hciattach () +{ + /system/bin/hciattach -n $BTS_DEVICE $BTS_TYPE $BTS_BAUD & + hciattach_pid=$! + logi "start_hciattach: pid = $hciattach_pid" + echo 1 > $BLUETOOTH_SLEEP_PATH +} + +kill_hciattach () +{ + echo 0 > $BLUETOOTH_SLEEP_PATH + logi "kill_hciattach: pid = $hciattach_pid" + ## careful not to kill zero or null! + kill -TERM $hciattach_pid + # this shell doesn't exit now -- wait returns for normal exit +} + +# mimic hciattach options parsing -- maybe a waste of effort +USAGE="hciattach [-n] [-p] [-b] [-t timeout] [-s initial_speed] [speed] [flow|noflow] [bdaddr]" + +while getopts "blnpt:s:" f +do + case $f in + b | l | n | p) opt_flags="$opt_flags -$f" ;; + t) timeout=$OPTARG;; + s) initial_speed=$OPTARG;; + \?) echo $USAGE; exit 1;; + esac +done +shift $(($OPTIND-1)) + +# Note that "hci_qcomm_init -e" prints expressions to set the shell variables +# BTS_DEVICE, BTS_TYPE, BTS_BAUD, and BTS_ADDRESS. + +#Selectively Disable sleep +BOARD=`getprop ro.product.device` + +POWER_CLASS=`getprop qcom.bt.dev_power_class` + +#find the transport type +TRANSPORT=`getprop ro.qualcomm.bt.hci_transport` +logi "Transport : $TRANSPORT" + +case $POWER_CLASS in + 1) PWR_CLASS="-p 0" ; + logi "Power Class: 1";; + 2) PWR_CLASS="-p 1" ; + logi "Power Class: 2";; + 3) PWR_CLASS="-p 2" ; + logi "Power Class: CUSTOM";; + *) PWR_CLASS=""; + logi "Power Class: Ignored. Default(1) used (1-CLASS1/2-CLASS2/3-CUSTOM)"; + logi "Power Class: To override, Before turning BT ON; setprop qcom.bt.dev_power_class <1 or 2 or 3>";; +esac + +eval $(/system/bin/hci_qcomm_init -e $PWR_CLASS && echo "exit_code_hci_qcomm_init=0" || echo "exit_code_hci_qcomm_init=1") + +case $exit_code_hci_qcomm_init in + 0) logi "Bluetooth QSoC firmware download succeeded, $BTS_DEVICE $BTS_TYPE $BTS_BAUD $BTS_ADDRESS";; + *) failed "Bluetooth QSoC firmware download failed" $exit_code_hci_qcomm_init;; +esac + +# init does SIGTERM on ctl.stop for service +# TODO(mvines): In the B2G userspace, this "trap" causes sh to segfault. Comment for now. +#trap "kill_hciattach" TERM INT + +case $TRANSPORT in + "smd") + logi "Seting property to insert the hci smd transport module" + setprop bt.hci_smd.driver.load 1 + ;; + *) + logi "start hciattach" + start_hciattach + + wait $hciattach_pid + logi "Bluetooth stopped" + ;; +esac + +exit 0 diff --git a/glue/gonk/device/toro/maguro/etc/init.qcom.post_boot.sh b/glue/gonk/device/toro/maguro/etc/init.qcom.post_boot.sh new file mode 100644 index 00000000..b6365d67 --- /dev/null +++ b/glue/gonk/device/toro/maguro/etc/init.qcom.post_boot.sh @@ -0,0 +1,147 @@ +#!/system/bin/sh +# Copyright (c) 2009-2011, Code Aurora Forum. 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 Code Aurora 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.product.device` +case "$target" in + "msm7201a_ffa" | "msm7201a_surf" | "msm7627_ffa" | "msm7627_surf" | "msm7627a" | "msm7627a_sku1" | "msm7627a_sku3" |\ + "qsd8250_surf" | "qsd8250_ffa" | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "qsd8650a_st1x") + echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold + chown system /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate + ;; +esac + +case "$target" in + "msm7201a_ffa" | "msm7201a_surf") + echo 500000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate + ;; +esac + +case "$target" in + "msm7630_surf" | "msm7630_1x" | "msm7630_fusion") + echo 75000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate + echo 1 > /sys/module/pm2/parameters/idle_sleep_mode + ;; +esac + +case "$target" in + "msm7201a_ffa" | "msm7201a_surf" | "msm7627_ffa" | "msm7627_surf" | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "msm7627a" | "msm7627a_sku1" | "msm7627a_sku3" ) + echo 245760 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + ;; +esac + +case "$target" in + "msm8660_surf" | "msm8660_csfb") + echo 1 > /sys/module/rpm_resources/enable_low_power/L2_cache + echo 1 > /sys/module/rpm_resources/enable_low_power/pxo + echo 2 > /sys/module/rpm_resources/enable_low_power/vdd_dig + echo 2 > /sys/module/rpm_resources/enable_low_power/vdd_mem + echo 1 > /sys/module/rpm_resources/enable_low_power/rpm_cpu + echo 1 > /sys/module/pm_8x60/modes/cpu0/power_collapse/suspend_enabled + echo 1 > /sys/module/pm_8x60/modes/cpu1/power_collapse/suspend_enabled + echo 1 > /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/suspend_enabled + echo 1 > /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/suspend_enabled + echo 1 > /sys/module/pm_8x60/modes/cpu0/power_collapse/idle_enabled + echo 1 > /sys/module/pm_8x60/modes/cpu1/power_collapse/idle_enabled + echo 1 > /sys/module/pm_8x60/modes/cpu0/standalone_power_collapse/idle_enabled + echo 1 > /sys/module/pm_8x60/modes/cpu1/standalone_power_collapse/idle_enabled + echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor + echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate + echo 50000 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate + echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold + echo 90 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold + echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy + echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor + chown system /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate + chown system /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate + echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq + chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + chown system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq + chown system /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + chown root.system /sys/devices/system/cpu/mfreq + chmod 220 /sys/devices/system/cpu/mfreq + chown root.system /sys/devices/system/cpu/cpu1/online + chmod 664 /sys/devices/system/cpu/cpu1/online + ;; +esac + +case "$target" in + "msm8960") + echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor + echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor + echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate + echo 50000 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate + echo 90 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold + echo 90 > /sys/devices/system/cpu/cpu1/cpufreq/ondemand/up_threshold + echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy + echo 4 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor + chown system /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate + chown system /sys/devices/system/cpu/cpu1/cpufreq/ondemand/sampling_rate + echo 384000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + echo 384000 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq + chown system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq + chown system /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq + chown system /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq + chown root.system /sys/devices/system/cpu/mfreq + chmod 220 /sys/devices/system/cpu/mfreq + chown root.system /sys/devices/system/cpu/cpu1/online + chmod 664 /sys/devices/system/cpu/cpu1/online + ;; +esac + +case "$target" in + "msm7627_ffa" | "msm7627_surf" | "msm7627a" | "msm7627a_sku1" | "msm7627a_sku3") + echo 25000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate + ;; +esac + +case "$target" in + "qsd8250_surf" | "qsd8250_ffa" | "qsd8650a_st1x") + echo 50000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate + ;; +esac + +case "$target" in + "qsd8650a_st1x") + mount -t debugfs none /sys/kernel/debug + ;; +esac + +emmc_boot=`getprop ro.emmc` +case "$emmc_boot" + in "1") + chown system /sys/devices/platform/rs300000a7.65536/force_sync + chown system /sys/devices/platform/rs300000a7.65536/sync_sts + chown system /sys/devices/platform/rs300100a7.65536/force_sync + chown system /sys/devices/platform/rs300100a7.65536/sync_sts + ;; +esac diff --git a/glue/gonk/device/toro/maguro/extract-files.sh b/glue/gonk/device/toro/maguro/extract-files.sh index f06d8563..36ead3fd 100755 --- a/glue/gonk/device/toro/maguro/extract-files.sh +++ b/glue/gonk/device/toro/maguro/extract-files.sh @@ -233,7 +233,11 @@ copy_files "$COMMON_LIBS" "system/lib" "" COMMON_BINS=" rild rmt_storage + hciattach + abtfilt + hci_qcomm_init " + copy_files "$COMMON_BINS" "system/bin" "" COMMON_EGL=" diff --git a/glue/gonk/device/toro/maguro/rootdir/init.qcom.rc b/glue/gonk/device/toro/maguro/rootdir/init.qcom.rc new file mode 100644 index 00000000..d76601a3 --- /dev/null +++ b/glue/gonk/device/toro/maguro/rootdir/init.qcom.rc @@ -0,0 +1,403 @@ +# Copyright (c) 2009-2011, Code Aurora Forum. 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 Code Aurora 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. +# + +on boot-pause + exec system/bin/battery_charging + +on boot + mkdir /data/misc/bluetooth 0770 bluetooth bluetooth + chown bluetooth bluetooth /sys/module/bluetooth_power/parameters/power + chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type + chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state + chown bluetooth bluetooth /proc/bluetooth/sleep/proto + chown system system /sys/module/sco/parameters/disable_esco + chmod 0660 /sys/module/bluetooth_power/parameters/power + chmod 0660 /sys/class/rfkill/rfkill0/state + chmod 0660 /proc/bluetooth/sleep/proto + chown bluetooth bluetooth /dev/ttyHS0 + chmod 0660 /dev/ttyHS0 + chown bluetooth bluetooth /sys/devices/platform/msm_serial_hs.0/clock + chmod 0660 /sys/devices/platform/msm_serial_hs.0/clock + + # Create the directories used by the Wireless subsystem + mkdir /data/misc/wifi 0770 wifi wifi + mkdir /data/misc/wifi/sockets 0770 wifi wifi + mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi + mkdir /data/misc/dhcp 0770 dhcp dhcp + chown dhcp dhcp /data/misc/dhcp + setprop wifi.interface wlan0 + + # Create the symlink to qcn wpa_supplicant folder for ar6000 wpa_supplicant + mkdir /data/system 0775 system system + symlink /data/misc/wifi/wpa_supplicant /data/system/wpa_supplicant + + # Enable Bluetooth 802.11 PAL when Bluetooth is turned on + setprop ro.config.bt.amp no + + # Create directories for wiper services + mkdir /data/wpstiles/ 0777 shell + mkdir /data/wiper 0777 location qcom_oncrpc + + # Create directories for gpsone_daemon services + mkdir /data/misc/gpsone_d 0770 gpsone_d qcom_oncrpc + + # Create directory from IMS services + mkdir /data/shared 0777 + symlink /system/etc/qpconfig.xml /data/shared/qpconfig.xml + + + #Set SUID bit for usbhub + chmod 4755 /system/bin/usbhub + chmod 755 /system/bin/usbhub_init + + #Set SUID bit for diag_mdlog + chmod 4755 /system/bin/diag_mdlog + + #Set SUID bit for btwlancoex + chmod 4755 /system/bin/btwlancoex + + #Remove SUID bit for iproute2 ip tool + chmod 0755 /system/bin/ip + + #Provide the access to hostapd.conf only to root and group + chmod 0660 /data/hostapd/hostapd.conf + + #port-bridge + chmod 0660 /dev/smd0 + chown system system /dev/smd0 + + chmod 0660 /dev/ttyGS0 + chown system system /dev/ttyGS0 + + chmod 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state + + # Remove write permissions to video related nodes + chmod 0664 /sys/devices/virtual/graphics/fb1/hpd + chmod 0664 /sys/devices/virtual/graphics/fb1/video_mode + chmod 0664 /sys/devices/virtual/graphics/fb1/format_3d + + # Change owner and group for media server and surface flinger + chown media system /sys/devices/virtual/graphics/fb1/format_3d + + #increase dirty_writeback_interval + #write /proc/sys/vm/dirty_writeback_centisecs 60000 + #write /proc/sys/vm/dirty_expire_centisecs 60000 + + #For netmgr daemon to inform the USB driver of the correct transport + chown radio radio /sys/class/usb_composite/rmnet_smd_sdio/transport + + #To allow interfaces to get v6 address when tethering is enabled + write /proc/sys/net/ipv6/conf/rmnet0/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet1/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet2/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet3/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet4/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet5/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet6/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet7/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet_sdio0/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet_sdio1/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet_sdio2/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet_sdio3/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet_sdio4/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet_sdio5/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet_sdio6/accept_ra 2 + write /proc/sys/net/ipv6/conf/rmnet_sdio7/accept_ra 2 + +# Export GPIO56 for fusion targets to enable/disable hub +service usbhub_init /system/bin/usbhub_init + user root + disabled + oneshot + +on property:ro.product.device=msm7630_fusion + start usbhub_init + +on property:init.svc.wpa_supplicant=stopped + stop dhcpcd + +on property:init.svc.bluetoothd=running + start btwlancoex + start amp_load + +on property:init.svc.bluetoothd=stopped + start amp_unload + stop btwlancoex + +on property:persist.cne.UseCne=none + stop cnd + +service cnd /system/bin/cnd + socket cnd stream 660 root radio + +service rmt_storage /system/bin/rmt_storage /dev/block/mmcblk0p10 /dev/block/mmcblk0p11 /dev/block/mmcblk0p17 + user root +# disabled + +on property:ro.emmc=1 + start rmt_storage + +service hciattach /system/bin/sh /system/etc/init.qcom.bt.sh + user bluetooth + group qcom_oncrpc bluetooth net_bt_admin + disabled + oneshot + +on property:bt.hci_smd.driver.load=1 + insmod /system/lib/modules/hci_smd.ko + +on property:bt.hci_smd.driver.load=0 + exec /system/bin/rmmod hci_smd.ko + +service bt-dun /system/bin/dun-server /dev/smd7 /dev/rfcomm0 + disabled + oneshot + +service bt-sap /system/bin/sapd 15 + disabled + oneshot +service sapd /system/bin/sdptool add --channel=15 SAP + user bluetooth + group bluetooth net_bt_admin + disabled + oneshot +service dund /system/bin/sdptool add --channel=1 DUN + user bluetooth + group bluetooth net_bt_admin + disabled + oneshot + +service bridgemgrd /system/bin/bridgemgrd + user radio + group radio + disabled + +service port-bridge /system/bin/port-bridge /dev/smd0 /dev/ttyGS0 + user system + group system inet + disabled + +on property:ro.baseband="msm" + start port-bridge + # Enable BT-DUN only for all msms + setprop ro.qualcomm.bluetooth.dun true + +on property:ro.baseband="unknown" + start port-bridge + +service qmiproxy /system/bin/qmiproxy + user radio + group radio + disabled + +service qmuxd /system/bin/qmuxd + user radio + group radio + disabled + +service netmgrd /system/bin/netmgrd + disabled + +service sensors /system/bin/sensors.qcom + user root + group root + disabled + +on property:ro.use_data_netmgrd=false + # netmgr not supported on specific target + stop netmgrd + +# Adjust socket buffer to enlarge TCP receive window for high bandwidth +# but only if ro.data.large_tcp_window_size property is set. +on property:ro.data.large_tcp_window_size=true + write /proc/sys/net/ipv4/tcp_adv_win_scale 1 + +service btwlancoex /system/bin/sh /system/etc/init.qcom.coex.sh + user shell + group bluetooth net_bt_admin + disabled + oneshot + +service amp_init /system/bin/amploader -i + user root + disabled + oneshot + +service amp_load /system/bin/amploader -l 7000 + user root + disabled + oneshot + +service amp_unload /system/bin/amploader -u + user root + disabled + oneshot + +service wpa_supplicant /system/bin/logwrapper /system/bin/wpa_supplicant -Dwext -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf -dd + user root + group wifi inet + socket wpa_wlan0 dgram 660 wifi wifi + disabled + oneshot + +service dhcpcd_wlan0 /system/bin/dhcpcd -BKLG wlan0 + disabled + oneshot + +service wiperiface /system/bin/wiperiface + user location + group qcom_oncrpc + oneshot + +service gpsone_daemon /system/bin/gpsone_daemon + user root + group qcom_oncrpc + disabled + +service fm_dl /system/bin/sh /system/etc/init.qcom.fm.sh + user root + group system qcom_oncrpc + disabled + oneshot + +on property:crypto.driver.load=1 + insmod /system/lib/modules/qce.ko + insmod /system/lib/modules/qcedev.ko + +on property:crypto.driver.load=0 + exec /system/bin/rmmod qcedev.ko + exec /system/bin/rmmod qce.ko + +service drmdiag /system/bin/drmdiagapp + user root + disabled + oneshot + +on property:drmdiag.load=1 + start drmdiag + +on property:drmdiag.load=0 + stop drmdiag + +service qcom-sh /system/bin/sh /init.qcom.sh + user root + oneshot + +service qcom-post-boot /system/bin/sh /system/etc/init.qcom.post_boot.sh + user root + disabled + oneshot + +service qcom-wifi /system/bin/sh /system/etc/init.qcom.wifi.sh + oneshot + +on property:init.svc.bootanim=stopped + start qcom-post-boot + +service atfwd /system/bin/ATFWD-daemon + user system + group system radio + onrestart /system/bin/log -t RIL-ATFWD -p w "ATFWD daemon restarted" + +service hdmid /system/bin/hdmid + socket hdmid stream 0660 root system graphics + disabled + +on property:ro.hdmi.enable=true + start hdmid + +service abld /system/bin/mm-abl-daemon + disabled + +service hostapd /system/bin/hostapd -dddd /data/hostapd/hostapd.conf + user root + group root + oneshot + disabled + +service ds_fmc_appd /system/bin/ds_fmc_appd -p "rmnet0" -D + group radio + disabled + oneshot + +on property:persist.data.ds_fmc_app.mode=1 + start ds_fmc_appd + setprop ro.config.cwenable 1 + +service ims_regmanager /system/bin/exe-ims-regmanagerprocessnative + user system + group qcom_oncrpc net_bt_admin inet radio wifi + disabled + +on property:persist.ims.regmanager.mode=1 + start ims_regmanager + +on property:ro.data.large_tcp_window_size=true + # Adjust socket buffer to enlarge TCP receive window for high bandwidth (e.g. DO-RevB) + write /proc/sys/net/ipv4/tcp_adv_win_scale 1 + +service thermald /system/bin/thermald + user root + group root + disabled + +on property:persist.thermal.monitor=true + start thermald + +service time_daemon /system/bin/time_daemon + user root + group root + oneshot + disabled + +on property:persist.timed.enable=true + mkdir /data/time/ 0700 + start time_daemon + +service ftp /system/bin/sdptool add --psm=5257 --channel=20 FTP + user bluetooth + group bluetooth net_bt_admin + disabled + oneshot + +service map /system/bin/sdptool add --channel=16 MAS + user bluetooth + group bluetooth net_bt_admin + disabled + oneshot + +service ril-daemon1 /system/bin/rild -c 1 + socket rild1 stream 660 root radio + socket rild-debug1 stream 660 radio system + user root + disabled + group radio cache inet misc audio sdcard_rw qcom_oncrpc diag + +service profiler_daemon /system/bin/profiler_daemon + user root + group root + disabled diff --git a/glue/gonk/device/toro/maguro/rootdir/init.rc b/glue/gonk/device/toro/maguro/rootdir/init.rc index 6cfc4c91..c21533dc 100644 --- a/glue/gonk/device/toro/maguro/rootdir/init.rc +++ b/glue/gonk/device/toro/maguro/rootdir/init.rc @@ -91,11 +91,12 @@ loglevel 3 on fs wait /dev/block/mmcblk0p12 - mount ext4 /dev/block/mmcblk0p12 /system ro barrier=0 + mount ext4 /dev/block/mmcblk0p12 /system ro barrier=1 wait /dev/block/mmcblk0p13 exec /system/bin/e2fsck -p /dev/block/mmcblk0p13 - mount ext4 /dev/block/mmcblk0p13 /data nosuid nodev barrier=0 - mount ext4 /dev/block/mmcblk0p14 /persist nosuid nodev barrier=0 + mount ext4 /dev/block/mmcblk0p13 /data nosuid nodev barrier=1 noauto_da_alloc,noinit_itable,nodelalloc + mount ext4 /dev/block/mmcblk0p14 /persist nosuid nodev barrier=1 + mount ext4 /dev/block/mmcblk0p15 /cache nosuid nodev barrier=1 on post-fs # once everything is setup, no need to modify / @@ -280,9 +281,6 @@ on boot service ueventd /sbin/ueventd critical -service rmt_storage /system/bin/rmt_storage /dev/block/mmcblk0p10 /dev/block/mmcblk0p11 - user root - service console /system/bin/sh console disabled