嵌入式系统移植 - Kernel : 添加后门脚本

添加后门脚本

说明

给自己留个后门, 这非常重要, 已经出货的固件, 可以通过OTA升级, 有一些指令可以通过后门的方式执行, 另外这个后门也可以做调试作用, 比如里面执行:

logcat >> /data/logcat.log &
cat proc/kmsg >> /data/dmesg.log &

就可以不接入串口的情况下, 保存log信息.

修改源码

diff --git a/system/core/rootdir/init.rc b/system/core/rootdir/init.rc
index 317207c..cca43b3 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -281,6 +281,9 @@ on post-fs
     # create the lost+found directories, so as to enforce our permissions
     mkdir /cache/lost+found 0770 root root

+    # Modify Tower 20190425
+    exec /system/bin/sh  /system/bin/postern.sh
+
 on post-fs-data
     # We chown/chmod /data again so because mount is run as root + defaults
     chown system system /data
# postern.sh
#!/system/bin/sh
echo "Hello World!"
发布了53 篇原创文章 · 获赞 19 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/qq_33443989/article/details/103014467