如何使用 Magisk Manager 和 boot.img 来 root Android
如何使用 Magisk Manager 和 boot.img 来 root Android
如何使用 Magisk Manager 和 boot.img 来 root Android
在本教程中,我们将演示如何使用 Magisk Manager 为 Android 设备打补丁,使其能够 root 系统。这种方法对于使用 Lollipop 及以上版本系统的用户尤其有用,因为像 Kingroot 这样的一键 root apk 无法使用,因此需要自定义 Recovery 才能 root。使用此方法,您无需一键 root apk 或自定义 Recovery(例如 Philz、CWM、TWRP 等)即可 root 您的设备。
要求
-
为您的手机型号准备一个原装 boot.img(最好与您的版本号/版本号对应)。您可以从设备的原装 rom/固件中提取(您可以访问我们的https://www.hovatek.com/forum/forum-89.html查看我们的收藏),或者使用硬件盒(例如 Miracle Box、CM2、Nck Box Pro 等)从您的设备备份。
-
下载最新的Magisk 管理器 apk
-
您的 Android 设备上的有效互联网连接
使用 Magisk Manager 和已修补的 boot.img 获取 Android 设备 root 权限的步骤
步骤 1:修补库存 boot.img
在你的安卓设备上安装 MagiskManager apk 将设备的原装 boot.img 复制到手机的内部存储或 SD 卡 启动 Magisk Manager 应用 如果你没有使用最新版本,则必须先更新应用才能继续 如果你打算修补 recovery.img,请在高级设置中手动勾选“恢复模式” 选择安装 > 安装 > 选择并修补文件 > 导航到你之前复制的原装 boot.img 的位置,然后选择它。请注意,如果你使用的是三星设备,则应该选择 .tar 格式的设备固件而不是 boot.img Magisk Manager 应该开始下载用于修补的 magisk zip 文件 下载完成后,MagiskManager 将自动修补文件并将其存储在 SDcard/Download/magisk_patched.img[.tar] 下
步骤 2:烧写修补后的 boot.img
根据您的芯片组(例如联发科 MTK、展讯 SPD、高通 QLM 等)、您拥有的资源和技能,您有多种选项来刷新修补后的 boot.img。请注意,某些刷新方法可能要求您将文件重命名为 boot.img。对于使用 MTK 设备并拥有其设备特定分散文件的用户,您可以使用 SP 刷新工具或 Miracle Box 刷新修补后的 boot.img。对于使用 SPD 设备并拥有其设备的 PAC 文件的用户,您可以使用研究下载工具刷新修补后的 boot.img,方法是将库存 boot.img 替换为修补后的 boot.img。对于使用高通设备的用户,您可以使用 Miracle box 自定义刷新器刷新修补后的 boot.img;请参阅https://www.hovatek.com/forum/thread-26213.html对于那些使用三星设备并希望使用 Odin 刷新修补的 boot.img.tar 的用户,请参阅一般来说,您还可以使用 Fastboot 来刷新 patched_boot.img 或 boot.img(如果您已重命名,则命令必须反映文件名),如下所述
如何使用 Fastboot 烧写 patched_boot.img
-
使用指南在电脑上设置 adb 和 fastboot
-
使用以下方法解锁手机的 Bootloader(如果未解锁)
-
使用]( https://www.hovatek.com/forum/thread-10109.html )在手机上重新启用 USB 调试
-
通过 USB 线将手机连接到电脑
-
使用指南启动到快速启动模式
-
通过在 adb CMD 提示窗口中输入以下命令并在每行后按 Enter 键来刷新 patched_boot 并重新启动
代码:
fastboot devices
fastboot flash boot patched_boot.img
fastboot reboot
您的命令历史记录应该类似于
使用 Root Checker 验证 root
In this video tutorial, I'll be explaining how to root an Android device using magisk manager and a boot.img. Now you need to get the boot.img for your phone either from the firmware which you downloaded online or from a rom which you backed up or extracted from your phone. You can backup your phone using a variety of tools depending on your chipset but anyway you either get the boot.img from the firmware or extracted from your phone.
Now, once you have your boot.img, you need to copy to your phone storage because you're going to be working on that on the device. Now I have my magisk installed and I'm also going to check my root status to show that the phone is not rooted okay? so I'm starting from the very beginning, from scratch. So you can see I do not have root access on this phone so I will be rooting the phone using magisk and my boot.img. Now, its very important you get a boot.img for your variant. You know, when it comes to Android, there are number of variants so you just can't use any boot.img on your device. You need to get one that is for your variant or close to your build number even for your build number okay?
So once you have that in place, you're going to launch magisk manager. On this screen, you just select NO THANKS. Now, if you're using a Samsung device you might want to change your settings. You come under Patch Boot Output Format. Now, you'll want to change yours to .img.tar that is for Samsung users who want to flash their patched boot.img using Odin okay? but I want to use in .img format so I'll just leave it as it is ok? Samsung users just take note of that alright? So now at this screen, you're going to tap Install then you tap Install again.
Now you're going to select Patch Boot Image File. Now, I'm going to locate my stock boot.img, I saved that to the Hovatek folder on my internal storage. Okay, I have it here. I'm going to select it now so I'm going to allow. So now you'll notice that magisk is going to download the zip file and then begin patching alright? So I'll just wait a couple of seconds for okay it's almost done, I think I can just slide off so you can see. So now what is happening right now is that magisk is now patching the boot image which I just loaded and then it's going to produce the patched boot.img for me, its going to save it to the phone storage for me alright?
So once that is done, I'll just head over to flashing the patched boot.img to my device okay? packing boot image. You might be wondering why I have adb opened here. Its because I want to flash using fastboot. Alright! so it says patched boot image is placed here so I'm going to actually verify that by launching my file manager. Internal storage. I'm looking for Magisk Manager. As you can see, I have my patched boot.img, its 11.43 MB. So now, I'm going to copy this file to my PC from which I'm going to flash. Now, at this point, you now need to flash your boot.img .There's a lot of ways you can flash your boot image depending on your kind of chipset and what you have. You might decide to flash using a tool, maybe like Odin, SP Flash tool, Research Download tool, Miracle box, depending on what you have at the moment or for most devices, you can flash using fastboot.
Now, I'm going to be demonstrating how to flash using fastboot okay because that's quite general for devices alright? So first off, I need to copy this patched boot image to my device and that would take a couple of seconds so let me just do that quickly. Alright so I've copied the patched boot.img to my adb folder and that is what I have over here as you can see so now I'm going to be flashing this using fastboot. Don't forget, you can flash your boot image using a variety of methods, it depends on your chipset but I'm using fastboot because that's actually quite general alright? So now, before you can use fastboot on your device, you need to have unlocked your bootloader.
We have a guide on how to unlock your bootloader. Just check our forum, search for how to unlock the bootloader of an Android device, we have a guide on that. Follow the guide unlock your bootloader. Don't forget that unlocking your bootloader wipes your data so ensure you have your stuff backed up alright? Now, once your bootloader is unlocked , you're going to boot up the device again and setup your ADB. So I'm going to be testing ADB connection to my phone by typing adb devices .So you can see I have a detection. So now, I'm going to be booting my phone into fastboot which is bootloader so I'm going to type in adb reboot-bootloader .
Now, you're going to see that the screen is going to go off. The Android emulator is closed already since I don't have adb connection to my device anymore. so now you will be able to see my screen because it's no longer an ADB mood so I can't broadcast the screen to you but my phone is in fastboot mode so I'm going to test connection in fastboot by typing fastboot devices . Okay so I have a connection in fastboot. So now I'm going to be flashing the patched. Now, some tools require you to rename your patched boot, that's patched_boot to just boot like when you're flashing with SP flash tool, Research Download tool and some other tools, you need to actually rename your boot but I don't have to rename it in fastboot.
I just have to make sure I type the name correctly. So to flash the boot in fastboot, don't forget you need to have your bootloader unlocked so if your bootloader is not unlocked, make sure you unlock it. Now, just to verify my bootloader status, I will type fastboot getvar unlocked My bootloader is unlocked so now I'm going to flash the boot image by typing fastboot flash boot patched_boot.img which is the file name so whatever you name it, make sure you type that correctly. Alright! so that is done. Now, I'm going to reboot the device to the normal Android screen so fastboot reboot
Alright! so my phone is restarting. I'll just give it a couple of seconds to come up. Once it boots up now. I'm going to be testing root status using the root checker application Alright! booted up and should be coming up any moment Alright! So I'm going to come back to my root checker and check my root status so I'm going to be verifying root. Alright! so I can see I already have a sign of root access. By an app asking for root permission, that means I have root on my device
Alright! so my device is rooted That's how to root an Android device using magisk manager and stock boot.img