当前位置: 首页 > news >正文

RK3399 开机自启一个shell脚本,一直起不来BUG

开机自启shell脚本如下:

diff --git a/device/rockchip/common/sepolicy/file_contexts b/device/rockchip/common/sepolicy/file_contexts
index eb6b5e4bb4..0bbe781a7c 100755
--- a/device/rockchip/common/sepolicy/file_contexts
+++ b/device/rockchip/common/sepolicy/file_contexts
@@ -165,3 +165,4 @@/system/vendor/bin/camera_test   u:object_r:camera_test_exec:s0/system/bin/xone-agent u:object_r:xone-agent_exec:s0
+/system/bin/myshell.sh u:object_r:myshell_exec:s0
diff --git a/device/rockchip/common/sepolicy/myshell.te b/device/rockchip/common/sepolicy/myshell.te
new file mode 100644
index 0000000000..11fc663901
--- /dev/null
+++ b/device/rockchip/common/sepolicy/myshell.te
@@ -0,0 +1,18 @@
+type myshell, domain;
+type myshell_exec, exec_type, file_type;
+ 
+ 
+init_daemon_domain(myshell)
+ 
+allow myshell init_tmpfs:file create_file_perms;
+allow myshell self:capability { dac_override net_admin net_raw setgid setuid };
+allow myshell device:dir { open read };
+allow myshell shell:lnk_file { read };
+allow myshell rootfs:lnk_file { getattr };
+allow myshell socket_device:sock_file { write };
+ 
+allow myshell shell_exec:file { getattr read};
+allow myshell fuse:dir { search write add_name getattr};
+allow myshell fuse:file { create write open getattr};
+allow myshell system_file:file { execute_no_trans};
+permissive myshell;diff --git a/device/rockchip/rk3399/init.rk3399.rc b/device/rockchip/rk3399/init.rk3399.rc
index 805ce6f79e..743e6d3aa2 100755
--- a/device/rockchip/rk3399/init.rk3399.rc
+++ b/device/rockchip/rk3399/init.rk3399.rc
@@ -31,10 +31,18 @@ on bootchmod 0777 /system/bin/xone-agentstart xone-agent+    chown root shell /system/bin/myshell.sh
+    chmod 0777 /system/bin/myshell.sh
+    start myshell
+service xone-agent /system/bin/xone-agentuser rootgroup rootdisabledoneshot-
+service myshell /system/bin/myshell.sh
+    user root
+       group root
+       disabled
+       oneshot
diff --git a/device/rockchip/rk3399/myshell.sh b/device/rockchip/rk3399/myshell.sh
new file mode 100644
index 0000000000..c5505b6adc
--- /dev/null
+++ b/device/rockchip/rk3399/myshell.sh
@@ -0,0 +1,6 @@
+#!/system/bin/sh
+while [ true ] 
+do
+        echo "123"
+done
diff --git a/device/rockchip/rk3399/rk3399_all.mk b/device/rockchip/rk3399/rk3399_all.mk
index 8bbcdef3a3..db7136f077 100755
--- a/device/rockchip/rk3399/rk3399_all.mk
+++ b/device/rockchip/rk3399/rk3399_all.mk
@@ -103,6 +103,7 @@ PRODUCT_COPY_FILES += \device/rockchip/rk3399/rockchip_test/rockchip_test.sh:/system/bin/rockchip_test.shPRODUCT_COPY_FILES += \
+       device/rockchip/rk3399/myshell.sh:/system/bin/myshell.sh \device/rockchip/rk3399/top:/system/bin/top \device/rockchip/rk3399/xone-agent:/system/bin/xone-agent \device/rockchip/rk3399/xoneagent.sh:/system/bin/xoneagent.sh \
diff --git a/system/sepolicy/file_contexts b/system/sepolicy/file_contexts
index d64e67d29b..01e69da280 100644
--- a/system/sepolicy/file_contexts
+++ b/system/sepolicy/file_contexts
@@ -220,7 +220,7 @@/system/bin/update_engine        u:object_r:update_engine_exec:s0/system/bin/bspatch              u:object_r:update_engine_exec:s0/system/bin/selectrildlib      u:object_r:selectrildlib_exec:s0
-
+/system/bin/myshell             u:object_r:myshell_exec:s0 

然后就是死活起不来,但是和别人的是一模一样的,csdn都翻烂了,最后找到解决办法:

--- a/device/rockchip/rk3399/init.rk3399.rc
+++ b/device/rockchip/rk3399/init.rk3399.rc
@@ -33,7 +33,6 @@ on bootchown root shell /system/bin/myshell.shchmod 0777 /system/bin/myshell.sh
-    start myshellservice xone-agent /system/bin/xone-agentuser root
@@ -41,8 +40,12 @@ service xone-agent /system/bin/xone-agentdisabledoneshot-service myshell /system/bin/myshell.sh
-    user root
+service myshell /system/bin/sh /system/bin/myshell.sh
+       user rootgroup rootdisabledoneshot
+       seclabel u:r:shell:s0
+    
+on property:sys.boot_completed=1
+    start myshell

其实就是在service下面加上seclabel u:r:shell:s0就行了

http://www.lryc.cn/news/140614.html

相关文章:

  • [MyBatis系列④]核心配置文件
  • 系统架构设计高级技能 · 层次式架构设计理论与实践
  • Nuxt3打包部署到Linux(node+pm2安装和运行步骤+nginx代理)
  • 一维数组传参
  • 七层、四层和五层网络模型区别和联系
  • RH1288V3 - 初识物理服务器
  • excel中如果A列中某项有多条记录,针对A列中相同的项,将B列值进行相加合并统计
  • 开发智能应用的新范式:大数据、AI和云原生如何构建智能软件
  • 淘宝免费爬虫数据 商品详情数据 商品销售额销量API
  • Markdown初级使用指南
  • 国际版阿里云/腾讯云CDN装备运用教程:加快网站拜访速度
  • 面试之快速学习计算机网络-http
  • 2023水果编曲软件fl studio 21.1.0 .3713官方中文直装破解版
  • 【微信小程序】页面路由跳转函数之间的区别
  • Ubuntu inotify
  • 开始MySQL之路——MySQL的DataGrip图形化界面
  • C++ STL 标准模板库
  • C#-集合小例子
  • git保存删除的文件
  • 【golang】go语句执行规则(goroutine)(下)
  • websocket 接收消息无法获取用户id
  • springboot通过sharding-dbc按年、月分片
  • 基于静电放电算法优化的BP神经网络(预测应用) - 附代码
  • 开发者插件推荐FeHelper
  • 【MySQL】JSON 格式字段处理
  • 数据库选型<1>
  • 1.Flink源码编译
  • Linux内核数据结构 散列表
  • 数据库系统课设——基于python+pyqt5+mysql的酒店管理系统(可直接运行)--GUI编程
  • 《C和指针》笔记9: typedef