These steps will elaborate how to enable root access for Android in
x86-based machine from a terminal in the host Android itself(Not through adb
). I am using
Intel's Celadon
branch
for Android 8.1-x86_64.
This is not a permanent solution to enable root. However, it still works in a straightforward way.
- Change the sepolicy from
enforcing
topermissive
indevice/intel/project-celadon/celadon/mixins.spec
. Now, we can at least see thesu
binary in/system/xbin
from a devloper mode Terminal app in Android. However, we still cannot execute thesu
binary for other users through the Terminal app because of file permissions (execute access is not available forother
users). - To enable execute access for
other
users, we need to change thesystem/core/libcutils/fs_config.cpp
file. Find and change the line to{ 04755, AID_ROOT, AID_SHELL, 0, "system/xbin/su" }
to enable execute permission of thesu
binary. - Finally, we need to change the
su
program itself insystem/extras/su/su.cpp
. I commented out the following line in themain
function:if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "not allowed");
This is because we want to enable access to any program (in our case the Terminal app) so that it can change the user toroot
.
The Terminal app is available by enabling the developer mode in Android settings.