[OnePlus 11] shootind5nukes:
The purpose of this guide is to give you the Magisk Restore Images option. As many of you know KernelSu does not work for the OnePlus 11 with Android 14. When you use the init_boot method to root you lose the Magisk Restore Images option and therefore you lose Install to Inactive Slot After OTA. Most of us were using the KernelSU method to gain temp root, which didn't actually modify the device at all, then used Magisk to preform a Direct Install. Before Magisk preforms the Direct Install it makes a backup of some files. Later on when you wanted to update you could easily have Magisk Restore Images then take the update, then Install to Inactive Slot. After reboot you'd have the new OTA update and root still. When we use the patched init_boot method and flash via Fastboot Magisk doesn't have a chance to make the backup before the install. Because of this we are unable to restore images, which makes updating alot harder and requires a computer and your stock init_boot. This guide will walk you through what to do after you use the init_boot method to root to get your stock files back and let Magisk make the backups it needs to have the Restore Images Option working. Hope this clarifies why I wrote this guide.

I have been trying various ways to get KernelSU working with Android 14 so I could use the Restore Images option in Magisk to make updating easier. I was not successful in finding a way to get KernelSU to boot. A member by the name of MrSteelX told me I could use dd to flash stock init_boot in terminal and keep root. Below are the commands I used to do this.

This was tested on my CPH2451 running 14.0.0.114(EX01) rooted with Magisk patched init_boot.img

Disclaimer

If you brick your device that's on you. Don't just use my commands, follow the entire guide. Even then if you brick your device that's the risk you took.

Prerequisites

OnePlus 11

Have your bootloader unlocked

Be rooted with init_boot from Magisk and have Magisk installed

Have your stock init_boot.img

Have Android 14 installed(Probably works on other versions)

Have ADB installed on your computer and know how to use it(Makes typing commands and viewing easier)

Guide

Connect your phone to your computer with debugging activated

Open command prompt and navigate to your ADB directory

Check to make sure adb is working. Note you may have to unlock your phone and authorize ADB

adb devices

You should see an output similar to the following, if you don't check to make sure ADB is working

C:\adb>adb devices
List of devices attached
556ff688 device

We will use ADB to open a shell account for us so we can type commands and see output easier

adb shell

Output should look like the following. Notice after you ran adb shell you have an $ shell

C:\adb> adb shell
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
OP594DL1:/ $

Now we will get root privileges. Note you may have to grant superuser permission on your phone after you type this

su

Output should look like the following. You should now have a # shell

OP594DL1:/ $ su
OP594DL1:/ #

Now let's see the partition table

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

You should see alot of output. We are only concerned about these two lines

lrwxrwxrwx 1 root root 16 1970-09-21 21:40 init_boot_a -> /dev/block/sde32
lrwxrwxrwx 1 root root 16 1970-09-21 21:40 init_boot_b -> /dev/block/sde63

Note the lines that have init_boot_a and init_boot_b. /dev/block/sde32 is init_boot_a and /dev/block/sde63 is init_boot_b. Keep in mind these lines are from my partition table. Verify your partition table with the above command before you move on. You will use your output below.

Transfer your stock init_boot.img to your phone, take note of the directory you put it.

Now using the file path for where you trasfered init_boot.img and the above /dev/block for init_boot_a and init_boot_b we will write the following command. It's best to write this in a text editor of some kind before you write it in the adb shell you have open. Writting this command wrong, even one letter, may brick your device. Use extreme caution with the following steps

This is the syntax for this command, do not run this command

dd if=/path/to/init_boot.img of=/path/to/init_boot_block_from_above

( Write this command with the path where you transfered your init_boot in the "if" and your /dev/block from above in the "of". )

(Write this in a text editor and check it twice. Go to your adb shell window and run the command you wrote. This command below flashed my stock init_boot to slot a)

dd if=/sdcard/init_boot.img of=/dev/block/sde32

And this command flashed my stock init_boot to slot b

dd if=/sdcard/init_boot.img of=/dev/block/sde63

The output should look similar to the following

OP594DL1:/ # dd if=/sdcard/init_boot.img of=/dev/block/sde32
12288+0 records in
12288+0 records out
6291456 bytes (6.0 M) copied, 0.112 s, 54 M/s
OP594DL1:/ # dd if=/sdcard/init_boot.img of=/dev/block/sde63
12288+0 records in
12288+0 records out
6291456 bytes (6.0 M) copied, 0.111 s, 54 M/s
OP594DL1:/ #

Now that you have successfully flashed init_boot to both slots go into Magisk and use the "Direct Install" option. Reboot after it completes.

Upon reboot you should still be rooted and have stock init_boot installed. You can test this by opening Magisk and verifying you still have root.

Now when an update comes you can use Magisk to restore images to get the update then do Install to Inactive after the OTA. I put this guide together fast so if I missed something just letme know.