如何修改AOSP允许特定的应用程序获得root权限? [英] How to modify AOSP to allow specific apps to get root access?

查看:2291
本文介绍了如何修改AOSP允许特定的应用程序获得root权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的 AOSP 。我已经成功地将我的APK建设。现在我想给我的应用程序root权限。我不希望提供给其他应用程序的根访问或在我的编译安装超级用户的应用程序。我只想补充我的应用程序获得root权限。我怎样才能做到这一点?

I'm working on AOSP. I've successfully added my apk to build. Now I want to give root access to my app. I don't want to provide root access to other apps or to install the Superuser app in my build. I just want to add my app to get root access. How can I achieve that?

我经历了在 su.c 文件路径的系统/演员/苏,但我无法了解整个code。

I went through the su.c file in path system/extras/su but I'm unable to understand the whole code.

当我通过code去了,我想如果我能修改 su.c 以提供根可以实现我的目标获得我的应用程序,编译并添加二进制来构建。我说得对不对?

When I went through the code, I think my objective can be achieved if I could modify su.c to provide root access to my app,compile it and add the binary to the build. Am I right?

推荐答案

您正在朝着正确的方向前进。你需要检查的源 su.c ,你可以面对的唯一问题是如何运行你的程序的根目录。要做到这一点,你需要设置SUID粘着位为应用程序的可执行文件。要做到这一点,你需要修改系统/核心/有/私营/ android_filesystem_config.h 文件(结构 android_files [] ),例如用于苏程序,你可以看到该位是如何设置的:

You're moving in the right direction. You need to check the sources for su.c The only problem that you can face is how to run your program as root. To do this you need to set SUID sticky bit for the executable of your application. To do this you need to modify system/core/include/private/android_filesystem_config.h file (structure android_files[]), for instance for su program you can see how this bit is set:

{ 06755, AID_ROOT,      AID_ROOT,      "system/xbin/su" },

这篇关于如何修改AOSP允许特定的应用程序获得root权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆