Skip to content

Instantly share code, notes, and snippets.

@Jim-Bar
Last active November 13, 2024 03:46
Show Gist options
  • Save Jim-Bar/a74dc9f45d049340c2a8576f2bdef701 to your computer and use it in GitHub Desktop.
Save Jim-Bar/a74dc9f45d049340c2a8576f2bdef701 to your computer and use it in GitHub Desktop.
OnePlus 6 - Stock Firmware

Stock firmware

Download

Extract images

Usage: payload_dumper.py payload.bin. Some of the images could be Ext4 instead of Android sparse format. In this case: img2simg system.ext4.img system.img (the tool img2simg is part of the package android-tools-fsutils on Ubuntu).

Enter the boot loader

Enable the OEM unlock option (refer to the picture OnePlus_6_OEM_unlock.jpg). When the phone is (re)booting, press volume up until you end up in the boot loader (refer to the picture OnePlus_6_bootloader.jpg). The phone must not have a USB cable plugged in. If it does, it will just get stuck as if it were switched off, and you'll need to hard power off it by holding the power button (still unplugged).

Flash

Despite what those links say, there is no need to flash both slots (A/B) nor to flash boot.img:

  1. Flashing the current slot is enough, and I would even recommend not to flash the other slot. In case things go wrong, you'll still be able to switch to the untouched slot for booting the phone
  2. Flashing the boot.img image is required only when the device has been rooted, or it has boot-looped (more than 7 times in the case of the OnePlus 6). It's possible to look at the number of boot attempts left using fastboot getvar all. Flashing boot.img will reset this count. When flashing it, you should use the stock image.

However vbmeta.img must indeed be flashed: fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img. When flashing vbmeta.img you should use the stock image. For going back to stock, just reflash it without the options --disable-verity and --disable-verification.

The user data partition must also be erased: fastboot -w.

Finally, all those flashing operations must be done in a single fastboot session (avoid to reboot between each, as it will decrease the counter of attempts left in boot.img and you may need to reflash it in the end).

Useful links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment