MTK Android(安卓)N 源码Rom Root
N平台root步骤:
1,集成相关文件 device/mediatek/common/device.mk
PRODUCT_COPY_FILES += device/mediatek/common/x64/daemonsu:system/xbin/daemonsu
PRODUCT_COPY_FILES += device/mediatek/common/x64/supersu.sh:system/bin/supersu.sh
PRODUCT_COPY_FILES += device/mediatek/common/x64/libsupol.so:system/lib64/libsupol.so
PRODUCT_COPY_FILES += device/mediatek/common/x64/su:system/xbin/su
PRODUCT_COPY_FILES += device/mediatek/common/x64/suinit:system/bin/suinit
PRODUCT_COPY_FILES += device/mediatek/common/x64/sukernel:system/bin/sukernel
PRODUCT_COPY_FILES += device/mediatek/common/x64/supolicy:system/xbin/supolicy
2, 在同目录下新建一个supersu.sh,因为执行root的话需要开机执行这些脚本
#!/system/bin/sh
echo "aaa" > /sdcard/a0.txt
/system/xbin/su --install > /sdcard/a1.txt
/system/xbin/su --daemon& > /sdcard/a2.txt
/system/xbin/su --install > /sdcard/a3.txt
/system/xbin/su --daemon& > /sdcard/a4.txt
3,N平台即使关闭了selinux,还是需要配置te权限
device/mediatek/common/sepolicy/full/file_contexts
最后+/system/bin/supersu.sh u:object_r:supersu_exec:s0
在同目录下,增加一个 supersu.te 文件内容如下,注意写法
type supersu, domain;
type supersu_exec,exec_type, file_type;
init_daemon_domain(supersu)
allow supersu system_file:file { read open getattr };
allow supersu self:capability{ chown fowner fsetid setuid setgid dac_override };
allow supersu toolbox_exec:file { read open getattr execute execute_no_trans };
allow supersu shell_exec:file { read open getattr };
在同目录下shell.te修改
增加+allow shell supersu_exec:file rx_file_perms;
4,system/core/rootdir/init.rc
on boot,都加吧
+chmod 0777 /system/bin/supersu.sh
+chown root shell /system/bin/supersu.sh
+exec /system/bin/sh /system/bin/supersu.sh
+setprop persist.sys.supersu launch
+service supersu /system/bin/supersu.sh
+ class main
+ user root
+ oneshot
+ seclabel u:r:supersu:s0
+on property:persist.sys.supersu=launch
+ start supersu
5,system/core/libcutils/fs_config.c,改或者加
+{ 07777, AID_ROOT, AID_ROOT, 0, "system/xbin/su" },
+{ 07777, AID_ROOT, AID_ROOT, 0, "system/xbin/daemonsu" },
+{ 07777, AID_ROOT, AID_ROOT, 0, "system/vendor/bin/supersu.sh" },
+{ 07777, AID_ROOT, AID_ROOT, 0, "system/xbin/supolicy" },
6,\build\core\main.mk
ro.secure=0
ro.debuggable=0
7,\device\eastaeon\aeon6737m_65_n\ProjectConfig.mk
MTK_ALLOW_ADBD_ROOT=yes
ALLOW_ADBD_ROOT = yes
MTK_BUILD_ROOT=yes
8,\packages\apps\Provision\src\com\android\provision\DefaultActivity.java
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 1);
Settings.System.putInt(getContentResolver(), "screen_off_timeout", 1800000);
9,\system\core\adb\Android.mk
filter user userdebug eng,$(TARGET_BUILD_VARIANT))
10,\system\core\init\Android.mk
filter user userdebug eng,$(TARGET_BUILD_VARIANT)))
11,\system\extras\su\Android.mk
注释掉所有配置,不需要系统的su
12,\vendor\mediatek\proprietary\bootable\bootloader\lk\platform\mt6735\rules.mk
SELINUX_STATUS := 2 关闭selinux
13,\vendor\mediatek\proprietary\system\core\multi_init\Android.mk
ifneq (,$(filter user userdebug eng,$(TARGET_BUILD_VARIANT)))
14,然后再用root精灵检测,--- 不ok,sh文件没有被执行
参考网址 https://www.jianshu.com/p/1d3bb2c897f3
1,user 版本,开启开发者模式,
2,开启debug模式,开启自动授权弹窗验证
更多相关文章
- Android(安卓)SDK 源码下载,eclipse关联代码
- android如何读取assets目录下的资源
- 关于Android的prelink
- 断网使用RycyclerView的jar包,运行时报错
- android openssl 编译+demo
- Android(安卓)环境搭建,Helloworld以及常见错误处理,最新版哦
- Android(安卓)Studio 工程.GitIgnore应该忽略的文件
- 2013年01月小记
- 如何使用Android(安卓)Studio把自己的Android(安卓)library分享