Skip to content

Instantly share code, notes, and snippets.

@azizbekian
Forked from aldur/README.md
Created November 26, 2017 06:02
Show Gist options
  • Save azizbekian/0c9f37590fceb7914d5172f7028a1231 to your computer and use it in GitHub Desktop.
Save azizbekian/0c9f37590fceb7914d5172f7028a1231 to your computer and use it in GitHub Desktop.
OnePlusRoot

Root OnePlus5 without unlocking the bootloader

Gain adb root.

$ adb shell am start -n com.android.engineeringmode/.qualcomm.DiagEnabled --es "code" "angela"

Download Magisk-v14.0 and extract it somewhere. Download MagiskManager.

Now, open a shell (adb shell).

OnePlus5:/ # mkdir /data/magisk
OnePlus5:/ #

Push the required file to the device:

adb push {arm64/*,common/*} /data/magisk/
arm64/magisk: 1 file pushed. 6.7 MB/s (192736 bytes in 0.027s)
arm64/magiskboot: 1 file pushed. 20.2 MB/s (316536 bytes in 0.015s)
common/boot_patch.sh: 1 file pushed. 3.1 MB/s (7732 bytes in 0.002s)
common/init.magisk.rc: 1 file pushed. 0.3 MB/s (675 bytes in 0.003s)
common/magisk.apk: 1 file pushed. 21.6 MB/s (3311368 bytes in 0.147s)
common/util_functions.sh: 1 file pushed. 2.5 MB/s (6688 bytes in 0.003s)
6 files pushed. 17.9 MB/s (3835735 bytes in 0.205s)

Download busybox for arm. Extract it and push it to the device:

adb push busybox-armv6l/system/xbin/busybox /data/magisk/

Install MagiskManager:

adb install ../MagiskManager-v5.4.0.apk

Back on the ADB shell (adb shell):

OnePlus5:/ # cd /data/magisk/
OnePlus5:/data/magisk # ls
boot_patch.sh busybox init.magisk.rc magisk magisk.apk magiskboot util_functions.sh
OnePlus5:/data/magisk # ./magisk --createimg magisk.img 64
Creating filesystem with parameters:
    Size: 67108864
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 4096
    Inode size: 256
    Journal blocks: 1024
    Label:
    Blocks: 16384
    Block groups: 1
    Reserved block group size: 7
Created filesystem with 11/4096 inodes and 1294/16384 blocks
OnePlus5:/data/magisk # mv magisk.img ..
OnePlus5:/data/magisk # ./magisk --createimg xbin.img 64
Creating filesystem with parameters:
    Size: 67108864
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 4096
    Inode size: 256
    Journal blocks: 1024
    Label:
    Blocks: 16384
    Block groups: 1
    Reserved block group size: 7
Created filesystem with 11/4096 inodes and 1294/16384 blocks
OnePlus5:/data/magisk # ./magisk --mountimg xbin.img xbin
/dev/block/loop0
OnePlus5:/data/magisk # cp /system/xbin/* xbin/
OnePlus5:/data/magisk # cp magisk xbin
OnePlus5:/data/magisk # umount xbin
OnePlus5:/data/magisk # rmdir xbin
OnePlus5:/data/magisk # ./magisk --mountimg xbin.img /system/xbin
/dev/block/loop0
OnePlus5:/data/magisk # magisk --post-fs
OnePlus5:/data/magisk # magisk --post-fs-data
OnePlus5:/data/magisk # magisk  --service

That's it, your phone is now rooted and Magisk modules should work too. After a reboot you'll need to repeat the last steps:

$ adb shell
OnePlus5:/ # cd /data/magisk/
OnePlus5:/data/magisk # ./magisk --mountimg xbin.img /system/xbin
/dev/block/loop0
OnePlus5:/data/magisk # magisk --post-fs
OnePlus5:/data/magisk # magisk --post-fs-data
OnePlus5:/data/magisk # magisk  --service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment