Android 7.1.2 添加开机启动脚本

2020-06-10  本文已影响0人  双鱼大猫

需求:基于msm8953平台,在系统开机过程中的开机服务中,添加一个开机服务,并由改服务启动一个开机脚本。

以下patch验证可行

diff --git a/device/qcom/common/base.mk b/device/qcom/common/base.mk
index 91ad523..d020f23 100755
--- a/device/qcom/common/base.mk
+++ b/device/qcom/common/base.mk
@@ -284,6 +284,7 @@ INIT += init.mdm.sh
 INIT += init.qcom.uicc.sh
 INIT += fstab.qcom
 INIT += init.qcom.sensors.sh
+INIT += testScript.sh
 
 #IPROUTE2
 IPROUTE2 := ip
diff --git a/device/qcom/common/rootdir/Android.mk b/device/qcom/common/rootdir/Android.mk
index f761806..a57f0b9 100644
--- a/device/qcom/common/rootdir/Android.mk
+++ b/device/qcom/common/rootdir/Android.mk
@@ -234,6 +234,14 @@ LOCAL_SRC_FILES    := etc/init.qcom.sensors.sh
 LOCAL_MODULE_PATH  := $(TARGET_ROOT_OUT)
 include $(BUILD_PREBUILT)
 
+include $(CLEAR_VARS)
+LOCAL_MODULE       := testScript.sh
+LOCAL_MODULE_TAGS  := optional eng
+LOCAL_MODULE_CLASS := ETC
+LOCAL_SRC_FILES    := etc/testScript.sh
+LOCAL_MODULE_PATH  := $(TARGET_OUT_EXECUTABLES)
+include $(BUILD_EXECUTABLE)
+
 ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
     include $(CLEAR_VARS)
     LOCAL_MODULE       := init.qcom.test.rc
diff --git a/device/qcom/common/rootdir/etc/init.qcom.rc b/device/qcom/common/rootdir/etc/init.qcom.rc
index c38b539..2fbce87 100644
--- a/device/qcom/common/rootdir/etc/init.qcom.rc
+++ b/device/qcom/common/rootdir/etc/init.qcom.rc
@@ -1242,3 +1242,16 @@ on property:sys.boot_completed=1
         touch /sys/hdmiin1/format
         chmod 777 /sys/hdmiin0/format
         chmod 777 /sys/hdmiin1/format
+
+        #update_bq57520.sh script
+        chmod 777 /system/bin/testScript.sh
+   start testScript
+
+service testScript /system/bin/testScript.sh
+   class late_start
+   user root
+   group root shell system
+   disabled 
+   oneshot   
+
+
diff --git a/device/qcom/sepolicy/common/file_contexts b/device/qcom/sepolicy/common/file_contexts
index 3269b2d..d34f538 100755
--- a/device/qcom/sepolicy/common/file_contexts
+++ b/device/qcom/sepolicy/common/file_contexts
@@ -394,3 +394,5 @@
 
 #ethan add for wifi nv file
 /system/bin/WifiNvService                                            u:object_r:mmi_exec:s0
+
+/system/bin/testScript\.sh                                           u:object_r:qti_init_shell_exec:s0
diff --git a/device/qcom/sepolicy/common/init_shell.te b/device/qcom/sepolicy/common/init_shell.te
index 3962d29..88f2f71 100644
--- a/device/qcom/sepolicy/common/init_shell.te
+++ b/device/qcom/sepolicy/common/init_shell.te
@@ -2,6 +2,7 @@
 # Normally these are shell commands or scripts invoked via sh
 # from an init*.rc file.  No service should ever run in this domain.
 type qti_init_shell, domain, domain_deprecated;
+type qti_init_shell_exec, exec_type,file_type;
 domain_auto_trans(init, shell_exec, qti_init_shell)
 
 # For executing init shell scripts (init.qcom.early_boot.sh)
@@ -199,3 +200,14 @@ allow qti_init_shell sysfs_zram:file w_file_perms;
 
 # To get GPU frequencies
 allow qti_init_shell sysfs_kgsl:file r_file_perms;
+
+
+#added by fieger
+allow qti_init_shell sdcardfs:chr_file {read};
+allow qti_init_shell mnt_user_file:dir search;
+allow qti_init_shell mnt_user_file:lnk_file read;
+allow qti_init_shell sdcardfs:dir search;
+allow qti_init_shell storage_file:dir search;
+allow qti_init_shell storage_file:lnk_file read;
+allow qti_init_shell tmpfs:lnk_file read;
+allow qti_init_shell sysfs:file {read write};


上一篇下一篇

猜你喜欢

热点阅读