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
enforcingtopermissiveindevice/intel/project-celadon/celadon/mixins.spec. Now, we can at least see thesubinary in/system/xbinfrom a devloper mode Terminal app in Android. However, we still cannot execute thesubinary for other users through the Terminal app because of file permissions (execute access is not available forotherusers). - To enable execute access for
otherusers, we need to change thesystem/core/libcutils/fs_config.cppfile. Find and change the line to{ 04755, AID_ROOT, AID_SHELL, 0, "system/xbin/su" }to enable execute permission of thesubinary. - Finally, we need to change the
suprogram itself insystem/extras/su/su.cpp. I commented out the following line in themainfunction: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.