[Android General] CarvedArt:
Quick and concise how to for obtaining a Stock Boot Image from your Oneplus 8, 8T or 8 Pro device and patching with Magisk to create a fastboot flashable patched boot.img.

DISCLAIMER:

#include <std_disclaimer.h>
/*
*
* We are not responsible for bricked, broken or dead devices. This is a high-level
* how to for users with a basic knowledge of ADB and Fastboot. YOU alone are
* choosing to make these modifications, and you are solely responsible for your
* device's fit for use and wellbeing.
*
* Backup your data!
*
*/

PREREQUISITS:

An unpatched Stock Boot.img running on your device

General knowledge and understanding of ADB and Fastboot

Download latest op8, op8p, or op8t Horizon Kernel img from [e.g., op8p_7.img]:

https://dl.akr-developers.com/?dir=oneplus/horizon_kernel/R/images

Download latest Magisk Canary build from Github [e.g., app-debug.apk]:

https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/app-debug.apk

DEVICE/PC OPERATIONS:

→ ADB

Enumerate devices

adb devices

Boot into Fastboot

reboot bootloader

→ FASTBOOT

Enumerate devices

fastboot devices

Determine the current slot (A/B), whichever slot you're on should be the "good" img

fastboot getvar current-slot

Boot with the custom kernel downloaded from Horizon to use root [NOTE: Include the full path of the img if not in the same directory]

e.g., fastboot boot "C:\Users\User\Downloads\op8p_R7.img"​

fastboot boot xxxxxxx.img

→ ADB

Copy the boot.img from each slot to the root of the device

adb shell

su

dd if=/dev/block/sde11 of=/sdcard/boot_a.img

dd if=/dev/block/sde35 of=/sdcard/boot_b.img

→ Android Device [NOTE: Some Android 11 devices experience patching issues on the Beta Channel like bootloop] [NOTE: Some users experience issues on Canary like no SIM detected; if so switch to Beta]

Install Magisk app-debug.apk (Canary)

Go to Settings → Update Channel → Canary

Go to Home → Install → Install → Select and Patch A File

Navigate to internal storage and select the stock boot.img [choose the img from whichever slot you're on]

When it’s done patching copy the file, named magisk_patched.img, from the root → Downloads of your device to PC

→ ADB

reboot bootloader

→ FASTBOOT

Test to ensure it boots before flashing; if not you'll need to patch the other img

fastboot boot magisk_patched.img

→ Android Device

If the device boots and you have root in the Magisk Manager app, reboot the device into Fastboot then flash the active slot [NOTE: Both slots do not need to be flashed; just the current active slot]

→ FASTBOOT

Flash the patched image file [NOTE: Include the full path of the img if not in the same directory]

e.g., fastboot flash boot_b "C:\Users\User\Downloads\magisk_patched.img"

fastboot flash boot magisk_patched.img

fastboot reboot

- OR -​

fastboot flash boot_a magisk_patched.img

fastboot reboot

- OR -​

fastboot flash boot_b magisk_patched.img

fastboot reboot

ADDITIONAL RESOURSES:

→ FASTBOOT

If you need to set the other slot to be the active slot use:

fastboot --set-active=a

- OR -​

fastboot --set-active=b

→ ADB

ADB Magisk Bootloop Fix

adb shell

magisk --remove-modules

→ OTA Help

Magisk stock boot.img missing fix [NOTE: Android 11 onwards, the /sbin folder might not exist, so Magisk will randomly create a folder under /dev and use it as the base folder]

Rename to: stock_boot_0.img

Compress with gzip = stock_boot_0.img.gz

Copy stock_boot_0.img.gz file to the root of: /data

Edit the config file: /dev/xxxxxxx/.magisk/config → Change SHA1= to 0

Magisk Manager → Uninstall Magisk → Restore Images

→ ADB

Determine the random folder name generated by Magisk on Android 11+

ls -laR /dev | grep '.magisk/rootdir'

→ ADB

Determine the Boot Image partition location [NOTE: Will list all partitions; look for boot_a and boot_b]

ls /dev/block/bootdevice/by-name/ -all