与AOSP工作工作、AOSP

由网友(秒爆⊕高手℡)分享简介:我正在 AOSP 。我已经成功地将我的APK建设。现在,我想给root访问我的应用程序。我不想提供root访问其他应用程序,或者在我的体型安装超级用户的应用程序。我只想补充我的应用程序,以获得root权限。我怎样才能做到这一点?I'm working on AOSP. I've successfully added...

我正在 AOSP 。我已经成功地将我的APK建设。现在,我想给root访问我的应用程序。我不想提供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" },
阅读全文

相关推荐

最新文章