On many devices the bootloader is locked and you must unlock it before you can flash a custom ROM or recovery. Unlocking is therefore also required for installing postmarketOS.
If you have forgotten whether your device is unlocked or not, check to see if it displays "device unlocked" or something similar at the bottom in flash mode or during the boot.
Unlocking the bootloader
|WARNING: Unlocking the bootloader will result in a formatted userdata partition. Make sure that you have backed up your data.|
On some devices it is enough to enter:
fastboot oem unlock
Others will require you to enter a code:
fastboot oem unlock your-code-here
HMD Global no longer provides unlock codes.
There are several unofficial ways to unlock these devices. Some devices can be unlocked for free, while some are not.
Huawei no longer provides unlock codes.
Tutorials that tell you to go to some Huawei website, log in with your Huawei ID and sign the unlock agreement to get a code are NO LONGER working. Even contacting their support has no effect.
Some services claim to be able to unlock these devices, but they charge money for it (e.g. DC-Unlocker charges 4€). Be careful and try to do your research and make sure that you're not one some fishy website before giving any of these services your money!
If you do try, please run wireshark usb capture, so there's a chance to understand how it works and replicate that
Another option is to try brute forcing the code. This takes time and might not work.
There is also this Open Source Solution for devices on Kirin SoC called PotatoNV which can be used to unlock the bootloader of Kirin-based devices, but has the disadvantage that you have to open the device and short a "test point" (unique to each device) to ground. This will also change your bootloader unlock code to a new one instead of printing out the original code.
- WIP Experimental work around which involves replace the entire bootloader & 
- A bootrom exploit of Huawei Hisilicon Smartphones that could be used to unlock Huawei bootloaders
An exploit does exist, see here.
|This is your last chance to download the latest ROM via OTA update before unlocking the bootloader. Sony does not provide OTA updates for unlocked devices.|
Just enable OEM unlocking in the Developer options and then use
fastboot oem unlock in fastboot mode.
Use WPInternals. The tool contains the instructions for unlocking.
BootUnlocker for Google Galaxy Nexus (maguro) & (toro, toroplus), Google Nexus 4 (mako), Google Nexus 5 (hammerhead), Google Nexus 7 2013 (flo), Google Nexus 7 2013 (deb), Google Nexux 10 (manta), OnePlus One (bacon), OnePlus Two (oneplus2), OnePlus X (onyx), YU Yuphoria (lettuce), YU Yureka (tomato), Lenovo Zuk Z1 (ham), InFocus M810 (VNA), InFocus M812 (VN2), or Yota Phone 2 (yotaphone2).