From 6c2913c9b89454a3a0631f961b2d2b36348a6bf0 Mon Sep 17 00:00:00 2001 From: Vol Zhdanov Date: Sun, 18 Nov 2018 16:35:43 +0000 Subject: [PATCH] sdm660-common: add qcom early boot script * to control power off alarm feature Change-Id: I0d2f5b96f8604d459130aec5f20f87cc75c7bad0 --- rootdir/Android.mk | 9 ++++++++ rootdir/bin/init.qcom.early_boot.sh | 36 +++++++++++++++++++++++++++++ rootdir/etc/init.qcom.rc | 1 + sdm660.mk | 3 ++- 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 rootdir/bin/init.qcom.early_boot.sh diff --git a/rootdir/Android.mk b/rootdir/Android.mk index b22a1e00..2cfb2c3b 100644 --- a/rootdir/Android.mk +++ b/rootdir/Android.mk @@ -10,6 +10,15 @@ LOCAL_MODULE_CLASS := ETC LOCAL_SRC_FILES := bin/init.qcom.post_boot.sh LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := init.qcom.early_boot.sh +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_SRC_FILES := bin/init.qcom.early_boot.sh +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) +include $(BUILD_PREBUILT) + include $(CLEAR_VARS) LOCAL_MODULE := init.qcom.rc LOCAL_MODULE_TAGS := optional diff --git a/rootdir/bin/init.qcom.early_boot.sh b/rootdir/bin/init.qcom.early_boot.sh new file mode 100644 index 00000000..b3fa432b --- /dev/null +++ b/rootdir/bin/init.qcom.early_boot.sh @@ -0,0 +1,36 @@ +#!/vendor/bin/sh + +# Copyright (c) 2012-2013,2016,2018 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. +# + +boot_reason=`cat /proc/sys/kernel/boot_reason` +reboot_reason=`getprop ro.boot.alarmboot` +if [ "$boot_reason" = "3" ] || [ "$reboot_reason" = "true" ]; then + setprop ro.vendor.alarm_boot true +else + setprop ro.vendor.alarm_boot false +fi diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index ecf56a1d..f26eb09a 100755 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -84,6 +84,7 @@ on early-boot write /sys/kernel/boot_cdsp/boot 1 write /sys/devices/virtual/npu/msm_npu/boot 1 write /sys/kernel/boot_slpi/boot 1 + exec u:r:qti_init_shell:s0 -- /vendor/bin/init.qcom.early_boot.sh setprop ro.alarm_boot false # SSR Setup diff --git a/sdm660.mk b/sdm660.mk index 62eb66bc..18c1d3ed 100644 --- a/sdm660.mk +++ b/sdm660.mk @@ -296,6 +296,7 @@ PRODUCT_PACKAGES += \ init.goodix.sh \ init.msm.usb.configfs.rc \ init.qcom.post_boot.sh \ + init.qcom.early_boot.sh \ init.qcom.rc \ init.qcom.sh \ init.qcom.usb.rc \ @@ -313,7 +314,7 @@ PRODUCT_PACKAGES += \ libqcomfm_jni \ qcom.fmradio \ qcom.fmradio.xml - + PRODUCT_BOOT_JARS += \ qcom.fmradio endif