Nexus 5X 上的 AOSP:如何获取 root

AOSP on Nexus 5X: How to get root

我正在为 nexus 5X 构建 AOSP。代码构建、安装和运行,

但是在尝试访问 adb shell 时,我无法访问 su。

我检查了一下 /system/xbin/su 现在在 su_exec 标签中,所以我修改了 file_contexts 以将 su 放在系统标签中

shell@bullhead:/ $ which su
/system/xbin/su
shell@bullhead:/ $ ls -Z /system/xbin/su
-rwsr-x--- root     shell             u:object_r:system_file:s0 su

但仍然:

shell@bullhead:/ $ su
su: setgid failed: Operation not permitted

我也试过禁用 selinux 但是:

shell@bullhead:/ $ setenforce 0                                                
setenforce: Couldn't set enforcing status to '0': Permission denied

我现在没主意了。请帮忙。

adb root with userdebug build 对我不起作用。

要获得 root,我必须制作一个 eng bui。在此构建中,adb 始终位于根 shell.

感谢@Chris 的回答。