Boot with locked bootloader
Following the next points, you will be able to boot this ROM with the locked bootloader on OnePlus 5. This will grant the security of your own data, as no one will be able to flash any new image without first deleting everything from the data partition: this is because unlocking the bootloader again requires to format the data partition.
If the data are encrypted (if you are using a PIN or the fingerprint to unlock your device), your data are safe.
Also, no more wait time or 'you have unlocked the bootloader' screen at boot
Be aware that in this 'beta' version, I'm still using AOSP keys, that are actually publicly available.
ATTENTION: ALL THE DATA ON THE DEVICE WILL BE LOST FOLLOWING THIS PROCEDURE
The following link contains different useful files:
- a signed twrp image: signed_twrp.zip Thanks @codeworkx for the actual TWRP recovery!
- a signed boot image with Magisk preinstalled: signed_magisk_boot_[date].img
- a 'persist twrp' recovery zip: persist_twrp.zip
- Download the signed TWRP image signed_twrp.zip
- Enter in fastboot mode. There are two ways, select the one you prefer:
- from adb, run the command 'adb reboot bootloader'
- or power on the device pressing the power up button and the power button at the same time
- Run the following command to flash the signed recovery:
- fastboot flash recovery signed_twrp.img
- Using the volume buttons, select 'RECOVERY' and using the power button boot into recovery.
- This TWRP version does not support decrypting data if a numeric PIN is used, but this is not an issue. If asked for a PIN, just 'cancel' the dialog to get into the TWRP main screen.
- From adb, push the OTA file and the GAPPS file:
- adb push aosp_cheeseburger-ota-user-20201121.zip /data/update.zip
- adb push FlameGApps-11.0-basic-arm64-20201024-ALPHA-10.zip /data/gapps.zip
(any gapps package should work, but I've only tested this)
- adb push signed_magisk_boot_[date].img /data/magisk.img (only if you need Magisk)
- adb push persist_twrp.zip /data/persist_twrp.zip (only if you want to persist the TWRP recovery after boot)
- From the TWRP interface, select 'Install' and flash first the 'update.zip' file and secondly the 'gapps.zip' file.
- If you want to persist the TWRP recovery, flash also the 'persist_twrp.zip' file.
- If you need magisk, from the TWRP interface select 'Install Image' and install also the magisk.img file in the boot partition.
- From the TWRP interface, reboot into fastboot (bootloader) mode again.
- Run the command (ATTENTION: ALL THE DATA ON THE DEVICE WILL BE DELETED):
- fastboot oem lock
- Confirm the lock operation on the device's screen.
- After the reboot, the device will probably boot again into the TWRP recovery: in this case, clear all the data from /data and restart the device (Wipe -> Format Data). Android will boot with the locked bootloader.
Important note: the device will now boot only signed image. DO NOT change boot.img without first check if it is signed. The images provided in this thread all are signed using AOSP keys.
If you are using Magisk, DO NOT UPDATE MAGISK after this installation. You can only update the Magisk Manager. At first boot, open the Magisk Manager and follow the instructions on screen.
If you don't flash the persist_twrp.zip
archive, Android will replace the recovery at every boot with the stock signed recovery. This stock recovery only flashes signed images (the OTAs from this thread are all signed), so if you need the TWRP, you have to use ADB sideload to flash the signed TWRP.
I've uploaded here a signed zip that can flash the signed TWRP while using the locked bootloader:
- enter into recovery (with the physical buttons or with 'adb reboot recovery')
- Press and hold the Power button. While holding the Power button press the Volume Up button then release the Volume Up button then the Power button to get into the Recovery UI
- select 'apply update from ADB'
- connect the phone and the pc, and from the pc run:
- adb sideload twrp_signed.zip
- reboot the phone selecting the 'reboot system now' from the recovery. Immediately after confirming the reboot, press the volume up button and keep it pressed until the boot mode is requested: select 'Recovery mode' and the phone will boot into the signed TWRP recovery. If the phone does not reboot, press the power button and after one second press the volume button keeping both buttons pressed until the device boots again.
Remember that, if you boot Android, you will lose the TWRP again.
How to update via TWRP
TWRP cannot decrypt the data partition using this ROM if you are using a PIN (it works fine using a pattern, for example).
To update the ROM:
- enter into TWRP recovery
- push the .zip update via adb:
$ adb push update.zip /data/
- from the TWRP recovery, select 'Install' e select the zip as /data/update.zip
If you need the TWRP recovery to be persisted, flash also the persis_twrp.zip archive again.
If you have a locked bootloader and you are using Magisk, flash the boot image with Magisk preinstalled again.