Android修改源码实现root

  1. userdebug和user版本
  2. 关闭selinux

	cd system/core
	diff --git a/init/selinux.cpp b/init/selinux.cpp
	index 5a0255acd..787917274 100644
	--- a/init/selinux.cpp
	+++ b/init/selinux.cpp
	@@ -104,6 +104,8 @@ EnforcingStatus StatusFromCmdline() {
	}
	
	bool IsEnforcing() {
	+    return false;
	+
	    if (ALLOW_PERMISSIVE_SELINUX) {
	        return StatusFromCmdline() == SELINUX_ENFORCING;
	    }


  1. 修改su.cpp,注释用户组权限检测

	cd system/extras/
	diff --git a/su/su.cpp b/su/su.cpp
	index 1a1ab6bf..af3d2a68 100644
	--- a/su/su.cpp
	+++ b/su/su.cpp
	@@ -80,8 +80,8 @@ void extract_uidgids(const char* uidgids, uid_t* uid, gid_t* gid, gid_t* gids, i
	 }
	 
	 int main(int argc, char** argv) {
	-    uid_t current_uid = getuid();
	-    if (current_uid != AID_ROOT && current_uid != AID_SHELL) error(1, 0, "not allow

你可能感兴趣的:(Android,ROM,Android,android,elasticsearch,大数据)