I'm trying to include the SuperUser application and su binary in my ROM (by AOSP method). I'm using android-6.0.1_r79 (Marshmallow)
as my base AOSP code.
[[Similar question(s) has been answered earlier, but all previous discussions were prior to Android KitKat and does not solve current AOSP/Superuser issues.]]
I followed the instructions here and after a few hiccups and with some help from Google I was able to make a successful build. I'm using the su repositories listed here.
I was able to verify that su binary present in /system/xbin
was from wvengen/su.c by adding some logs. However, there was no Superuser application present in the ROM.
2nd problem I'm facing is that /system/xbin/su
is accessible only to adb shell and not to other apps.
By default su binary has the following permissions:
root@generic:/system/xbin # ls -l | grep su
-rwsr-x--- root shell 488692 2017-04-16 16:20 su
I changed it to:
root@generic:/system/xbin # chmod +rx su
root@generic:/system/xbin # chmod +s su
root@generic:/system/xbin # ls -l | grep su
-rwsr-sr-x root shell 488692 2017-04-16 16:20 su
But still other applications do not get su access
root@generic:/system/xbin # run-as com.test
root@generic:/system/xbin $ ls -l | grep su
lstat './su' failed: Permission denied
whereas all other binaries are executable (eg. /system/xbin/sqlite3) under com.test.
I also tried to change the su permissions in fs_config.c but it did not work.
So please provide me some pointers to:
- Understand why Superuser.apk is absent from my ROM
- How to make su binary available to other Applications