几乎万能的安卓root方法,需adb能获取root权限(小白教小白)

此文章部分摘自 bingoCoder2013的博客
最近闲着没事,平常也喜欢搞搞机,搞机过程中遇到需要root权限是很麻烦的,各大root软件没有适配就无法root,现在有了一点收获,也是整理网上各大论坛出来的,用adb安装SuperSU。
我的环境: 瑞芯微RK3368 / Android 7.1.2 / SuperSU-v2.82-201705271822

1.必要前提

  • adb驱动,adb工具包(推荐到adbshell.com下载)
  • adb可以临时获取root权限(也可利用RageAgainstTheCage漏洞,本人没有太多了解,在这不予介绍)
  • SELinux可关闭(没有具体试过不关闭的后果,具体方法请看 坛内博客 bingoCoder2013
  • SuperSU Recovery刷机包

2.步骤

  • a.安装adb
    • Step 1 下载adb驱动,并安装
    • Step 2 下载adb工具包,是一个压缩格式。解压到任意目录即可
  • b.准备安装
    • Step 3 解压SuperSU文件到任意目录
    • Step 4 在SuperSU根目录(含有common等目录)下新建文本文档,并重命名为root.bat(只要是批处理文件即可,点号前的文件名随意)
    • Step 5 右键root.bat,选择编辑,并将脚本复制进去,需注意复制后会有多出来的文字,请自行删除
  • c.准备手机硬件
    • Step 6 打开手机USB调试(在设置开发者选项里,打开USB调试。没有开发者选项需在关于手机里多次点击版本号,回到主界面就有了。这里的操作不一定一样,每种手机会有一定差异)
    • Step 7 用数据线连接电脑(尽量采用USB2.0和主机背板插口)
  • d.电脑开始安装
    • 运行root.bat脚本即可

3.脚本

由于我也还是小白,没什么说的,直接上脚本
注意: 脚本变量需安照自己机型来修改,如

set CPU_TYPE=arm64
set LIB_FORDER=lib64

这两行CPU_TYPE变量和LIB_FORDER变量需要自行修改
例如我是arm64的CPU架构,系统lib文件夹是lib64,则我CPU_TYPE=arm64,LIB_FORDER=lib64
不了解自己架构的可以在百度上找搜索自己的机型

set CPU_TYPE=arm64
set LIB_FORDER=lib64

adb wait-for-device
adb root
adb remount
adb shell setenforce 0
adb push common/Superuser.apk /system/app/SuperSU/SuperSU.apk 
adb shell chmod 0644 /system/app/SuperSU/SuperSU.apk 
adb shell chcon u:object_r:system_file:s0 /system/app/SuperSU/SuperSU.apk 

adb shell "echo >> /system/bin/install-recovery.sh"
adb shell "echo '# Disable SELINUX & Run SuperSU deamon' >> /system/bin/install-recovery.sh"
adb shell "echo '/system/xbin/daemonsu --auto-daemon &' >> /system/bin/install-recovery.sh"
adb shell chmod 0755 /system/bin/install-recovery.sh

adb push %CPU_TYPE%/su /system/xbin/su 
adb shell chmod 0755 /system/xbin/su 
adb shell chcon u:object_r:system_file:s0 /system/xbin/su 

adb push %CPU_TYPE%/su /system/bin/.ext/.su 
adb shell chmod 0755 /system/bin/.ext/.su 
adb shell chcon u:object_r:system_file:s0 /system/bin/.ext/.su 

adb push %CPU_TYPE%/su /system/xbin/daemonsu 
adb shell chmod 0755 /system/xbin/daemonsu 
adb shell chcon u:object_r:system_file:s0 /system/xbin/daemonsu 

adb push %CPU_TYPE%/supolicy /system/xbin/supolicy 
adb shell chmod 0755 /system/xbin/supolicy 
adb shell chcon u:object_r:system_file:s0 /system/xbin/supolicy 

adb push %CPU_TYPE%/libsupol.so /system/%LIB_FORDER%/libsupol.so 
adb shell chmod 0755 /system/%LIB_FORDER%/libsupol.so 
adb shell chcon u:object_r:system_file:s0 /system/%LIB_FORDER%/libsupol.so 

如需深入了解SuperSU的原理,可在网上自行查找,或去SuperSU的官网找说明

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值