[OnePlus 6 ROMs, Kernels, Recoveries, & Other Devel] egandt:
Instructions to flash, backup ...

WARNING: With 5.1.8 I had no WIFI, so I suggest sticking to 5.1.6 to 5.1.7 FOR THE MOMENT

Instructions to flash, backup ...

Total time required about 90 minutes

Pre-Reqs:

First and foremost:

Start with at least 5.1.6 (or greater, as of writing 5.1.7 was the lastest), there are Treble fixes in 5.1.6 we need.

Second

verify you have a good USB cable (the Red one shipped with the phone is best)

Three

download the oneplus drivers and abd

- USB Drivers: OnePlus 6 USB Drivers for Windows

- ADB/Fastboot: ADB/Fastboot latest mini

Install both to your local system

Four

Download the latest TWRP (get both the img and zip files)

TWRP for OnePlus 6

Five

Download the files(Treble OP6 Files 5.1.6) from:

GUIDE] How to flash Treble roms on OnePlus 6

Extract and keep: vbmeta.img (if you are on 5.1.X where is the boot version you can keep the boot.img as well, if not discard).

Six

Download the lastest Oxygen OS ZIP and bootloader from:

[OnePlus 6][ROM][OTA][Oxygen OS] Mirrors for official Oxygen OS ROMs and OTA updates

As of writing this is:

5.1.6 full image: OnePlus6Oxygen_22_OTA_010_all_1806070151_ad8b19ed516e78.zip

5.1.6 boot: OnePlus6Oxygen_22_OTA_010_all_1806070151_boot.img

Seven

Download Device ID:

Device+ID APK

Eight

Download Magisk for Treble:

Magisk modified for treble

Since as of 6/2018 the default magisk does not support Treble we need a special version I suggest: Magisk-v16.3-factory-faizauthar12-20180406.zip as teh latest I could find with support.

Nine

Recommended download fastboot installable 5.1.6 (or latest build):

[ROM][STOCK][FASTBOOT][OP6] Stock Fastboot ROMs for OnePlus 6

Ten

Include Overlay/Ambient Display.

Download APK at: [Overlay] Enable Night Light, Auto-Brightness, Ambient Display & more on Treble ROM

Eleven

OnePlus Camera:

OnePlus Camera APK's

Finally

Download RR 6.0 for Treble compiled after 7/08/2018:

Either download the gapps or go version (gapps is still a work in progress when I wrote this)

ROMs Google Drive

Getting Ready:

WARNING: you will loss all data on your phone, backup anything you want or need, first.

Make sure you can get to fastboot (enable "Advanced Reboot" in developers options and make sure that you can enter on a reboot by pressing volume-down and power at the same time)

Make sure you are on 5.1.6+ (5.1.6 was the latest firmware upon writing this)

Remove Any security you have set (just to be safe)

Reboot to fastboot (bootloader)

run:

fastboot oem unlock

"You will be greeted with a Unlock Bootloader Warning page, Hit the Vol button to select Yes and turn it Blue and Hit the Power Button to Execute the selection, allow your device to reboot"

Backup EFS

If you have not already I'd recommend backing up EFS (to do so you need to be rooted, or else use TWRP):

Preferred, if rooted simply open a terminal and run:

su
dd if=/dev/block/sdf2 of=/sdcard/modemst1.bin bs=2048
dd if=/dev/block/sdf3 of=/sdcard/modemst2.bin bs=2048

Copy these files someplace safe!

If not rooted reboot to fastboot (bootloader):

Ensure that the latest twrp is in the same directory as fastboot (C:\Program Files (x86)\Minimal ADB and Fastboot) and run (3.2.1 was the lastest as of writing this):

fastboot.exe boot twrp-3.2.1-0-enchilada.img

This will boot the phone into twrp

Allow modification

Select backup

select only EFS and Modem

enter a meaningful name

swipe to backup

click "Reboot System" -> "Do not Install" for TWRP if asked.

You can now locate the backup under /storage/TWRP/BACKUPS and move it to a safe location off the phone.

Backup the Phone

Recommended if you care: Backup your entire phone using TWRP as well:

Ensure that the latest twrp is in the same directory as fastboot (C:\Program Files (x86)\Minimal ADB and Fastboot) and run (3.2.1 was the lastest as of writing this):

- fastboot.exe boot twrp-3.2.1-0-enchilada.img

This will boot the phone into twrp

Allow modification

Select backup

Select Everything except EFS and Modem

enter a meaningful name

swipe to backup

click "Reboot System" -> "Do not Install" for TWRP if asked.

You can now locate the backup under /storage/TWRP/BACKUPS and move it to a safe location off the phone.

Installing RR:

Finally we are ready to install RR (or any other Treble ROM), on the OnePlus 6. You will need a build from 6/7/2018 or later to have the required Vender-Hal to be present.

You will need to locate and install the AB version for the OnePlus 6.

Note: I'm using RR from 6/13 as the base for the guide: system-arm64-ab-gapps.img

SEE FIRST POST FOR CURRENT DOWNLOAD LOCATION I compiled this using phhusson's (Orginial Build Scripts)

instructions and a bit of setup on Linux. However most Treble base ROM's should work so long as they are from after 6/7/2018 in a similar manor.

* Remember this will wipe your device and you will loss all data *

First

boot in to fastboot (bootloader):

We need to go back to TRWRP and wipe internal storage and data to be safe, as the -w option to do so when flashing is not working for me.

- fastboot.exe boot twrp-3.2.1-0-enchilada.img

This will boot the phone into twrp

Allow modification

Select Wipe

Advanced Wipe

Select Cache, Data and "Internal Storage"

Swipe to Wipe

Click back until you are at the main menu

Click on Reboot

Click on Bootloader -> "Do not Install" for TWRP if asked.

Second

Flash the new ROM:

Flash vbmeta.img to remove validation

fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img

To be safe flash a default boot image (5.1.6 in this case)

fastboot flash boot_a boot.img
fastboot flash boot_b boot.img

Next reboot into recovery (you need to do this with volume down +Power, or selecting from bootload):

In stock recovery select English

Select Wipe Data and Cache

Reset system settings->yes->done

Wipe Cache->Yes->done

Erase everything->Thiscan not be undone, continue->done

back

Advanced

Reboot to fastboot->Reboot to fastboot

Now flash a the new ROM:

- fastboot flash system_a system-arm64-ab-gapps.img

- fastboot flash system_b system-arm64-ab-gapps.img

Three

reboot:

fastboot reboot

You will see the "andorid" boot screen (this is different that the Oxygen one) and being the first boot it could take a while. If you see no boot screen or it does not boot (give 10 minutes), then you likely need to repeat these steps again. If you boot into RR then continue.

You may get a Vender image mistake error ignore it it only appewars on boot.

Skip the Setup by clicking all four corners top left->top right->bottom right->bottom left (it my take more than one try), at this point you have no networking, that is what we want.

Suggestion make backup here as you have a working OS! -- Instructions to follow

Four

Move over required files: You now have RR installed and working:

Enable developer mode and then enable Advanced Reboot

Then copy over gapps-nano, Device+ ID.apk, magisk-manager apk and magisk installer zip to the phone

To get the magisk manager you need to extract it from the zip as I cloud not get the normal one to install. Extract the zip: Magisk-v16.3-factory-faizauthar12-20180406.zip copy common\magisk.apk to the phone

Five

Deal with: "Play Services not Certified by Google":

Install Device+ID (APK downloaed above) and Open

Once done open the second line shows the GSF ID for this device

Android Register GSF

Login using a gmail account (I suggest the one you use for the playstore)

Enter the GSF in the field, now we wait about 5 to 10 minutes for it to propigate

Reboot the phone as we want paly services to start fresh

First add a wIFI network.

Critical do not let any apps update until you have registered playstore, so if you see a notification saying downloading, select and click pause. Doing so with the updated 6/17 paystore resulted in a black screen where you would enter your password, no know work around other than reset if this happens.

click on playstore it should now start

Now login to your account and you should be go (it may take more than one attempt no idea why).

Now enable the update if previously paused

Update all Apps from the playstore before continuing, this may take a while give it 10 minutes

Optional: If you want remove Device+ID now (but I leave it as it is an easy way to get information).

You now have a working Playstore, if you have hung downloads then you may need to clear the cache for play services and the playstore I assume the unregistered might be the cause of them getting messed up.

Five

Install magisk:

Ensure you copied magisk zip and also the magisk manager apk to your phone, do not open, but click Done

Install the magisk manager, by locating the file in filemanager and selecting it.Reboot into fastbboot (bootloader) mode

Load TWRP:

fastboot.exe boot twrp-3.2.1-0-enchilada.img

Install

Select the magisk zip from the filesystem and flash

clear cache

Reboot->System (If asked about installing TWRP swipe to install)

Allow the phone to fully boot

Suggested: Reboot the phone

Suggested: disable checks for updates as 5.7 does not work with this build.

Root is now setup.

Six

Installer th onPlus camera:

Many people want the one plus camera, copy the apk downloaed above to the phone.

Open and install via a file manager

Seven

resize Data (as it will be only 11GB), the partitioon will be larger, depending on your devide se we will use TWRP and resize2fs to grow it.

Reboot into fastbboot (bootloader) mode

Load TWRP:

fastboot.exe boot twrp-3.2.1-0-enchilada.img

Advanced->Terminal

resize2fs /dev/block/sda17

Reboot System

Eight

Recommended, make a backup of your hard work:

Reboot into fastbboot (bootloader) mode

Load TWRP:

fastboot.exe boot twrp-3.2.1-0-enchilada.img

Select backup

Select Everything except EFS and Modem (as I'm unsure exactly which you need)

enter a meaningful name

swipe to backup

click "Reboot System" -> Swipe to reboot

Once back in RR copy the backup off the phone

Eight

Start using your OnePlus 6 with RR 6.0, rooted and with GAPPS

Nine

Upgrading:

Upgrading is simply replacing the system partitions and only these paritions (tested going from 6/13->6/16->6/17 builds)

Boot into fastboot (advanced reboot options)

Now flash the new system files:

- fastboot flash system_a new_system-arm64-ab-gapps.img

- fastboot flash system_b new_system-arm64-ab-gapps.img

Load TWRP:

fastboot.exe boot twrp-3.2.1-0-enchilada.img

Select Wipe

Advanced Wipe

Select Cache (and only Cache)

Swipe to Wipe

Reboot System

Ten

Restoring a Backup from TWRP

*This is a work in progress I can not work out how to do so safely*

fastboot.exe boot twrp-3.2.1-0-enchilada.img

Select Restore

Select the backup

Select Everything (other than EFS and Modem!)

Got to the main menu

Select Wipe

Advanced Wipe

Select Cache (and only Cache)

Swipe to Wipe

Reboot Fastboot

Eleven

Night Light, Ambient Display, requires Root:

My suggestion is not to do this if you care abut battery as I've seen major drain (even with Ambient display disabled, testing this).

Copy the apk downloaded framework-res__auto_generated_rro.apk to /vendor/overlays

mount -o rw,remount -t ext4 /vendor
cp <location of file> /vendor/overlay
chcon u:object_r:vendor_overlay_file:s0 /vendor/overlay;chcon u:object_r:vendor_overlay_file:s0 /vendor/overlay/framework-res__auto_generated_rro.apk

Reboot

Comments:

TWRP does not boot if flashed onto RR (the TWRP logo appears but it will not boot), this is currently only go to protect you from using the OnePlus Recovery and messing up RR. Flashing TWRP does not affect booting into RR.

TWRP DOES handle encryption without an issue, even a wrong first pin is not an issue

TWRP making a backup of Treble ROM, backup everything for now: Data, Boot, System, System Image, Vendor, Vendor Image.

If you have problems with hung downloads from the Playstore: Pending hung PlayStore

Wifi can be flaky (appearently this is a more general issue as even stock had some issues, I fixed them by only using either 2.4 or 5Mhz wireless, if I had both active I had constant disconnects.

Worst case, to recovery, back to Oxygen 5.1.6 if you end up in a boot loop stuck booting to rtecovery, etc:

- flash-all.bat

Reboot into recovery (you need to do this with volume down +Power, or selecting from bootload):

In stock recovery select English

Select Wipe Data and Cache

Reset system settings->yes->done

Wipe Cache->Yes->done

Erase everything->This can not be undone, continue->done

back

Advanced

Reboot to fastboot->Reboot

Load TWRP:

fastboot.exe boot twrp-3.2.1-0-enchilada.img

Copy the Oxygen full ROM back to the phone

adb push OnePlus6Oxygen_22_OTA_010_all_1806070151_ad8b19ed516e78.zip /sdcard

In TWRP

Install

Select OnePlus6Oxygen_22_OTA_010_all_1806070151_ad8b19ed516e78.zip

Go back to the root and select Advanced Wipe

Select Wipe

Advanced Wipe

Select Cache, Data and "Internal Storage"

Click on Reboot->Recovery (select Do not Install)

English

Wipe Cach and Data

Wipe Everything

Reboot

The phone will reboot same as the day it was made

If it does not then please refer to:

Mega Unbrick Guide for A Hard Bricked OnePlus 6

Note: Always boot fully at least once (I suggest twice and the first one is configuring android) before trying any steps above again.

Best of Luck, see a typo let me know

ERIC