From 385037aa458717c61e792980098b79ed069dd2f3 Mon Sep 17 00:00:00 2001 From: Shashank Mittal Date: Mon, 23 Jul 2012 16:19:06 -0700 Subject: [PATCH] init: Add init.qcom.post_fs.sh script. Some of the qcom services require to remount system partition with read-write permission. But since all of them running as independent asyncronous services so this can cause some issue. init.post_fs.sh is responsible to call all such services syncronously and in the end remount system partition as read-only. Change-Id: I4c03a67df5eb429b2ede633f81135e8b5c457673 --- common.mk | 1 + rootdir/Android.mk | 7 +++++ rootdir/etc/init.qcom.post_fs.sh | 48 ++++++++++++++++++++++++++++++++ rootdir/etc/init.qcom.rc | 11 +++++--- rootdir/etc/init.qcom.wifi.sh | 16 ----------- 5 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 rootdir/etc/init.qcom.post_fs.sh diff --git a/common.mk b/common.mk index 858f9a16..99915fb5 100644 --- a/common.mk +++ b/common.mk @@ -118,6 +118,7 @@ INIT += init.qcom.bt.sh INIT += init.qcom.coex.sh INIT += init.qcom.fm.sh INIT += init.qcom.post_boot.sh +INIT += init.qcom.post_fs.sh INIT += init.qcom.rc INIT += init.qcom.sdio.sh INIT += init.qcom.sh diff --git a/rootdir/Android.mk b/rootdir/Android.mk index a3d9b7ad..23cc8b82 100644 --- a/rootdir/Android.mk +++ b/rootdir/Android.mk @@ -108,3 +108,10 @@ LOCAL_SRC_FILES := etc/ueventd.qcom.rc LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) include $(BUILD_PREBUILT) +include $(CLEAR_VARS) +LOCAL_MODULE := init.qcom.post_fs.sh +LOCAL_MODULE_TAGS := optional eng +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := etc/init.qcom.post_fs.sh +include $(BUILD_PREBUILT) + diff --git a/rootdir/etc/init.qcom.post_fs.sh b/rootdir/etc/init.qcom.post_fs.sh new file mode 100644 index 00000000..8e194ac7 --- /dev/null +++ b/rootdir/etc/init.qcom.post_fs.sh @@ -0,0 +1,48 @@ +#!/system/bin/sh +# Copyright (c) 2012, 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. +# + +# This should be the first command +# remount system as read-write. +mount -o rw,remount,barrier=1 /system + +# Run modem link script +/system/bin/sh /system/etc/init.qcom.modem_links.sh + +# Run mdm link script +/system/bin/sh /system/etc/init.qcom.mdm_links.sh + +# Run thermal script +/system/bin/sh /system/etc/init.qcom.thermald_conf.sh + +# Run wifi script +/system/bin/sh /system/etc/init.qcom.wifi.sh + +# This should be the last command +# remount system as read-only. +mount -o ro,remount,barrier=1 /system + diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index e99547fe..54795502 100755 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -140,6 +140,7 @@ on boot # import cne init file on post-fs export_rc /persist/init.cne.rc + start qcom-post-fs # msm specific files that need to be created on /data on post-fs-data @@ -463,6 +464,12 @@ on property:drmdiag.load=1 on property:drmdiag.load=0 stop drmdiag +service qcom-post-fs /system/bin/sh /system/etc/init.qcom.post_fs.sh + class core + user root + disabled + oneshot + service qcom-sh /system/bin/sh /init.qcom.sh class late_start user root @@ -474,10 +481,6 @@ service qcom-post-boot /system/bin/sh /system/etc/init.qcom.post_boot.sh disabled oneshot -service qcom-wifi /system/bin/sh /system/etc/init.qcom.wifi.sh - class late_start - oneshot - service wifi-sdio-on /system/bin/sh /system/etc/init.qcom.sdio.sh class late_start group wifi inet diff --git a/rootdir/etc/init.qcom.wifi.sh b/rootdir/etc/init.qcom.wifi.sh index eaef6186..fb6de682 100755 --- a/rootdir/etc/init.qcom.wifi.sh +++ b/rootdir/etc/init.qcom.wifi.sh @@ -42,23 +42,19 @@ case "$target" in case "$wlanchip" in "AR6004-USB") setprop wlan.driver.ath 2 - mount -t vfat -o remount,rw,barrier=0 /dev/block/mtdblock1 /system rm /system/lib/modules/wlan.ko rm /system/lib/modules/cfg80211.ko ln -s /system/lib/modules/ath6kl-3.5/ath6kl_usb.ko /system/lib/modules/wlan.ko ln -s /system/lib/modules/ath6kl-3.5/cfg80211.ko /system/lib/modules/cfg80211.ko - mount -t vfat -o remount,ro,barrier=0 /dev/block/mtdblock1 /system ;; *) echo "*** WI-FI chip ID is not specified in /persist/wlan_chip_id **" echo "*** Use the default WCN driver. **" setprop wlan.driver.ath 0 - mount -t vfat -o remount,rw,barrier=0 /dev/block/mtdblock1 /system rm /system/lib/modules/wlan.ko rm /system/lib/modules/cfg80211.ko ln -s /system/lib/modules/prima/prima_wlan.ko /system/lib/modules/wlan.ko ln -s /system/lib/modules/prima/cfg80211.ko /system/lib/modules/cfg80211.ko - mount -t vfat -o remount,ro,barrier=0 /dev/block/mtdblock1 /system # The property below is used in Qcom SDK for softap to determine # the wifi driver config file @@ -114,30 +110,24 @@ case "$target" in case "$wlanchip" in "ATH6KL") setprop wlan.driver.ath 1 - mount -t vfat -o remount,rw,barrier=0 /dev/block/mtdblock1 /system rm /system/lib/modules/wlan.ko rm /system/lib/modules/cfg80211.ko ln -s /system/lib/modules/ath6kl/ath6kl_sdio.ko /system/lib/modules/wlan.ko ln -s /system/lib/modules/ath6kl/cfg80211.ko /system/lib/modules/cfg80211.ko - mount -t vfat -o remount,ro,barrier=0 /dev/block/mtdblock1 /system ;; "WCN1314") setprop wlan.driver.ath 0 - mount -t vfat -o remount,rw,barrier=0 /dev/block/mtdblock1 /system rm /system/lib/modules/wlan.ko rm /system/lib/modules/cfg80211.ko ln -s /system/lib/modules/volans/WCN1314_rf.ko /system/lib/modules/wlan.ko ln -s /system/lib/modules/volans/cfg80211.ko /system/lib/modules/cfg80211.ko - mount -t vfat -o remount,ro,barrier=0 /dev/block/mtdblock1 /system ;; *) setprop wlan.driver.ath 1 - mount -t vfat -o remount,rw,barrier=0 /dev/block/mtdblock1 /system rm /system/lib/modules/wlan.ko rm /system/lib/modules/cfg80211.ko ln -s /system/lib/modules/ath6kl/ath6kl_sdio.ko /system/lib/modules/wlan.ko ln -s /system/lib/modules/ath6kl/cfg80211.ko /system/lib/modules/cfg80211.ko - mount -t vfat -o remount,ro,barrier=0 /dev/block/mtdblock1 /system echo "********************************************************************" echo "*** Error:WI-FI chip ID is not specified in /persist/wlan_chip_id **" echo "******* WI-FI may not work ***********************************" @@ -150,16 +140,12 @@ case "$target" in echo "The WLAN Chip ID is $wlanchip" case "$wlanchip" in "WCN1314") - mount -t vfat -o remount,rw,barrier=0 /dev/block/mtdblock1 /system ln -s /system/lib/modules/volans/WCN1314_rf.ko /system/lib/modules/wlan.ko - mount -t vfat -o remount,ro,barrier=0 /dev/block/mtdblock1 /system ;; "WCN1312") - mount -t vfat -o remount,rw,barrier=0 /dev/block/mtdblock1 /system ln -s /system/lib/modules/libra/libra.ko /system/lib/modules/wlan.ko ln -s /data/hostapd/qcom_cfg.ini /etc/firmware/wlan/qcom_cfg.ini ln -s /persist/qcom_wlan_nv.bin /etc/firmware/wlan/qcom_wlan_nv.bin - mount -t vfat -o remount,ro,barrier=0 /dev/block/mtdblock1 /system ;; *) echo "********************************************************************" @@ -169,10 +155,8 @@ case "$target" in esac ;; msm7627*) - mount -t vfat -o remount,rw,barrier=0 /dev/block/mtdblock1 /system ln -s /data/hostapd/qcom_cfg.ini /etc/firmware/wlan/qcom_cfg.ini ln -s /persist/qcom_wlan_nv.bin /etc/firmware/wlan/qcom_wlan_nv.bin - mount -t vfat -o remount,ro,barrier=0 /dev/block/mtdblock1 /system ;; *)