[OnePlus 7T Guides, News, & Discussion] jaynammodi:
Spoiler content hidden.

Prerequisites : ​

Platform Tools : Android Debug Bridge version 1.0.41 - 31.0.2-7242960 recommended. [DOWNLOAD HERE]

Your device's drivers for the corresponding Operating System, here, OnePlus' USB Drivers. [DOWNLOAD HERE AFH][DOWNLOAD HERE EXTERNAL]

A little information about adb, fastboot, recoveries and partitions.

FOR UNROOTED USERS ONLY : to *DUMP* the partition, you will need superuser access, in order to emulate root access we will temporarily boot in a custom recovery. [DOWNLOAD HERE FOR 1+7T] [DOWNLOAD FOR OTHER DEVICES]

WARNING : I AM NOT RESPONSIBLE FOR YOUR ACTIONS. FOLLOW THIS GUIDE AT YOUR OWN RISK. JUST BECAUSE IT WORKS FOR ME DOESNT MEAN IT WORKS FOR YOU. USE YOUR HEAD.

Procedure & Explanation : ​

Setting up ADB​

Go to Settings > About Phone & Tap on Build Number Repeatedly 5-7 times. A toast message should pop up informing you about the developer status unlock on your phone.

Find Developer Options > USB Debugging in the settings app and Enable it by turning on the switch next to it.

Extract platform-tools to any desired location on your computer, open the directory containing the binaries and start a PRIVILEGED (run as admin/root) Terminal/CMD/Powershell in this location. OR. Alternatively, you can also navigate to the directory using CLI commands if you see fit.

Connect your Android device to your workstation using a USB cable.

Run ./adb[.exe] devices. (.exe is for windows only, please check the executable's name for this command). A popup should open on your device asking you to allow USB Debugging, tick "Always Allow" and allow the USB Debugging request. A device should popup on your workstation terminal thus indicating that ADB has connected to your device successsfully. [REFER SCREENSHOTS]

View attachment 5323329View attachment 5323943

Finding the Corresponding Partition to dump.​

In order to extract any or all of the above partitions, we must first discover the corresponding memory addresses symlinked to the partitions. This, is usually the most difficult part, "Finding the partitions", as different devices tend to have different file structures and can also be updated via OTA updates. The OnePlus 7T, being an A/B Device launching with Android 10, Dynamic Partitions have been implemented.

​

Thus, the following partitions are included in the OnePlus 7T :​

For the sake of convenience, I will illustrate how to dump the boot_a/boot_b partition, any other partitions can be dumped similarly following the same procedure.

The system partition table on Android 11 is a plethora of Symbolic Links that can be found in the by-name directory generally under \dev\block. Since the placement of this directory might change according to the subject device, a generalized method to discover the location is using the find command. Enter the following commands to find the partition.

./adb[.exe] shell

find /dev -name 'by-name' 2>/dev/null

View attachment 5323369

You may or may not get multiple results, in theory, any of these directories should contain what we're looking for, I prefer /dev/block/by-name since it is the exact container that defines the symbolic links to these partitions. Next, you will have to list the files in the directory in order to get each and every symlink sorted by its name. To do so, use ls -a <path_to_by-name>. In this case :

ls -a /dev/block/by-name

View attachment 5323911

This lists all the partitions in the file-system ranging from modem drivers to kernel specific partitions, hopefully, this contains what you're looking for, as shown in the screenshot above, the A/B device OnePlus 7T has boot_a and boot_b boot partitions. For a widespread explanation, I'll be dumping them both. To do so, we must find the actual memory addresses these symbolic links lead to, to do this, ls -l <path_to_symlink> is to be used. In this case :

ls -l /dev/block/by-name/boot_*

View attachment 5323923

As shown in the screenshot, this will list the corresponding directories these symlinks lead to, boot_a is stored under /dev/block/sde11 and boot_b is stored under /dev/block/sde38. Now that we've discovered the location of the data we need to dump, we can proceed to dumping the contents of these directories.

Dumping the required partitions as .img files​

For ROOTED users :​

You're in luck, its wayy easier for you. Firstly, to gain superuser access in adb shell, type su, hit enter and grant superuser access on whatever root provider you're using, probably Magisk. The shell echo character should change to a # thus indicating superuser access.

View attachment 5323929

To dump the partitions, the dd if=<path_to_input_block> of=</sdcard/partition_name.img> is to be used, in this case :

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

View attachment 5323937

As shown, this dumped the boot images in my phone's internal storage. Now these files can be used as intended. Cheers.

For UNrooted users :​

In order to gain elevated privileges to access the partitions, we will use the fastboot binary to temporarily boot to a custom recovery and have privilege escalation. So first, download the recovery for your device, unzip any archives and find an img file, copy/move this file to the same directory as the adb binaries and then restart the command line shell window as you did before, keep in mind to be in the same directory on your shell.

To boot to the downloaded recovery, the phone must be put on fastboot mode, ensure OEM/Bootloader Unlocking is turned on in Developer Options and then use ./adb[.exe] reboot fastboot to boot into fastboot mode.

Once in fastboot, type ./fastboot[.exe] devices and your device should show up in a list similar to the one showed before.

Next, use ./fastboot[.exe] boot <your_recovery.img> to boot into the desired recovery, in my case :

./fastboot.exe boot twrp-3.4.0-2-hotdog-unified-mauronofrio.img

Once in recovery mode, start an adb shell using ./adb[.exe] shell and follow the same steps as mentioned for rooted users, once you exit recovery mode, your phone will restore it's stock recovery.

That was your cue to read the section just above this one, Cheers.

I'll edit the guide as necessary. Based on the feedback received.