From 55146455d0cd21d866190ecd6fd59a128adb9b14 Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Tue, 8 Jan 2019 01:51:52 +0200 Subject: [PATCH] miatoll: rootdir: Import init.qcom.early_boot.sh * We used to have an init extension, which breaks treble and since P it requires custom SELinux rules to allow init reading /proc/sys/kernel/boot_reason * Remove the init extension and set the property like QCOM does through init.qcom.early_boot.sh * Update the property with vendor prefix while we are at it Change-Id: I238f754a17c9a548c6c90503bfa4b21763d1b4c4 Signed-off-by: Sonal Singh --- device.mk | 3 ++- rootdir/etc/init.qcom.rc | 2 ++ rootdir/init.qcom.early_boot.sh | 37 +++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 rootdir/init.qcom.early_boot.sh diff --git a/device.mk b/device.mk index d19f5bc..3ccd6ed 100644 --- a/device.mk +++ b/device.mk @@ -211,7 +211,8 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/rootdir/bin/init.qcom.post_boot.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.post_boot.sh \ $(LOCAL_PATH)/rootdir/bin/init.qcom.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.sh \ - $(LOCAL_PATH)/rootdir/bin/init.qti.chg_policy.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qti.chg_policy.sh + $(LOCAL_PATH)/rootdir/bin/init.qti.chg_policy.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qti.chg_policy.sh \ + $(LOCAL_PATH)/rootdir/init.qcom.early_boot.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.early_boot.sh # Input PRODUCT_COPY_FILES += \ diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index 7173152..f6c5d38 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -88,6 +88,8 @@ on early-boot chown system system /mnt/vendor/persist/data/pfm/licenses chmod 0775 /mnt/vendor/persist/data/pfm/licenses + exec u:r:vendor_qti_init_shell:s0 -- /vendor/bin/init.qcom.early_boot.sh + on boot chown bluetooth bluetooth /sys/module/bluetooth_power/parameters/power chown bluetooth net_bt /sys/class/rfkill/rfkill0/type diff --git a/rootdir/init.qcom.early_boot.sh b/rootdir/init.qcom.early_boot.sh new file mode 100644 index 0000000..51a85ab --- /dev/null +++ b/rootdir/init.qcom.early_boot.sh @@ -0,0 +1,37 @@ +#!/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. +# + +export PATH=/vendor/bin + +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