Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92
需求:
新增一个可执行文件放在system/bin/下,并且只有root和system权限才可以使用.
调试:
一开始在init.rc中修改发现失败,以为是放在开机挂载文件系统前了,
所以又放在了init.rc的on post-fs-data 阶段, 测试了还是失败.
后来发现是因为编译release版本的system文件系统是只读的,需要重新挂载才行.
解决方法:
找到默认编译system/bin/可执行程序赋予权限的地方,在
system/core/libcutiles/fs_config.c中.
[kris@:~/rk3288/system/core]$ g df
diff --git a/libcutils/fs_config.c b/libcutils/fs_config.c
index c72cb29..5224b79 100644
--- a/libcutils/fs_config.c
+++ b/libcutils/fs_config.c
@@ -135,6 +135,8 @@ static const struct fs_path_config android_files[] = {
{ 00700, AID_SYSTEM, AID_SHELL, (1ULL << CAP_BLOCK_SUSPEND), "system/bin/inputflinger" },
{ 00750, AID_ROOT, AID_ROOT, 0, "system/bin/uncrypt" },
+ /*Kris, 170426, only system or root can use socat.*/
+ { 00755, AID_ROOT, AID_SYSTEM, 0, "system/bin/socat" },
{ 00750, AID_ROOT, AID_ROOT, 0, "system/bin/install-recovery.sh" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/bin/*" },
{ 00755, AID_ROOT, AID_ROOT, 0, "system/lib/valgrind/*" },