Guide: Relock bootloader with custom rom on oneplus 5/5t

Chiku7

Member
Feb 14, 2018
36
6
0
no OEM unlock option in Developer setting

In case i want to unlock bootloader after sometime how i can unlock boot loader.? there is no "oem unlock" switch in custom ROM? please post link any tutorial if available.
 

arvindgr

Senior Member
Nov 8, 2013
900
322
93
Tamilan
Thanks for the guide, I will try this when a new open beta comes out.
This might be really useful for those who have upgraded their devices from Widevine L3 to L1 by OnePlus, only to be disappointed that after unlocking the bootloader, L1 breaks.
Thanks a lot for the guide! @optimumpro Does it mean once I have DRM Widewine L1 enabled in my phone, installing custom ROM and locking the phone, will still have L1 enabled?
 

gee one

Senior Member
Jul 29, 2010
1,979
865
0
linux command line
Considering the LineageOS public key is available now, Can we use that in the recovery(for flashing official lineageOS builds) and lock the bootloader?


LineageOS public key: https://github.com/LineageOS/update_verifier/blob/master/lineageos_pubkey
I think that's the public key and not the private key.

It's used to verify that the private key that was used to sign the image is correct. If your recovery has that public key as part of the allowed keys, the official zips or anything that is signed with the private key will pass signature verification.
 

optimumpro

Senior Member
Jan 18, 2013
6,267
13,596
253
Considering the LineageOS public key is available now, Can we use that in the recovery(for flashing official lineageOS builds) and lock the bootloader?

LineageOS public key: https://github.com/LineageOS/update_verifier/blob/master/lineageos_pubkey
First, you can never sign anything without the private key. Second, that public key is to verify that their rom update comes from them, as opposed to someone else. Their public key has nothing to do with recovery and/or kernel, but rather with the rom itself.

Yes, I think official recovery from LineageOS will allow images signed with LineageOS private key.
For the purposes of locking bootloader, it is irrelevant what Lineage's recovery can allow. You need recovery and boot image (not rom) signed to lock. And I am pretty sure Lineage's recovery/kernel are NOT signed.
 
Last edited:

PokemonTotalWar

Senior Member
Jan 29, 2014
746
202
0
21
I would like to do this, but I have two questions: What is the build.prop edit to enable/disable the OEM Unlock option in custom ROMs, and does this cause any issues when switching Firmware versions?
 

Zocker1304

Senior Member
Feb 15, 2016
785
281
73
@optimumpro If I follow this procedure and if I DON'T install Magisk afterwards, will my phone behave like full stock?
My plan was using this to only have TWRP just in case, to do backups and restore them.
So I have TWRP installed, but otherwise full stock, no root and bootloader locked. Will this fix safetynet issues(Google Pay, etc.) or will it still trigger safetynet since the phone isn't full stock?
 

optimumpro

Senior Member
Jan 18, 2013
6,267
13,596
253
@optimumpro If I follow this procedure and if I DON'T install Magisk afterwards, will my phone behave like full stock?
My plan was using this to only have TWRP just in case, to do backups and restore them.
So I have TWRP installed, but otherwise full stock, no root and bootloader locked. Will this fix safetynet issues(Google Pay, etc.) or will it still trigger safetynet since the phone isn't full stock?
At this point, Safetynet doesn't care whether your bootloader is locked or not. So, it doesn't matter, as long as you stay on stock and don't root.
 

optimumpro

Senior Member
Jan 18, 2013
6,267
13,596
253
For anyone interested in re-locking bootloader on any custom rom and having absolutely no warning messages (such as 'your phone has loaded a custom OS), contact me via PM. You can have a custom rom with locked bootloader and zero warnings, just like on OEM rom.
 

strongst

Forum Moderator
Staff member
Sep 18, 2007
11,592
8,425
253
prolific location
prolific-page.com

koltun

New member
Jun 13, 2019
4
1
0
Good guide!

I've used it for OnePlus 3. Some notes:
- 9.0.3 firmware
- Official TWRP 3.3.1.0
- LOS 16.0 with "Enable OEM unlock and bootable image signing" changeset from March 28
- used AOSP verity keys

End result: secure phone with locked bootloader, encrypted storage TWRP recovery, running LOS 16 with no warning messages at boot.
 

xda_wall

New member
Jun 18, 2019
1
0
0
I followed the instructions and everything worked. So I decided to encrypt the phone. I left it do it's thing and when I returned I got "Your device is corrupt. It can't be trusted and will not boot."
I can't get into recovery and in fastboot flashing fails with "flashing is not allowed in Lock State"
Any help with this?

edit: I followed this guide and started fresh.
 
Last edited: