So, after reading the article by Max Lubin, you decided to breathe new life into the old apparatus. Or even a new one, if the official firmware does not suit you. But you've never done that before. Where do you start? Let's consider the simplest way. Of course, it doesn't work for all phones. But, if you're lucky, then everything will work out.
Warning
Attention! Despite the fact that the article discusses a method that gives minimal risks to 'distort' the device, remember that you perform all actions at your own peril and risk.
Sourse of information
The main source of information on the topic of firmware in runet is, of course, w3bsit3-dns.com. Therefore, we go to the forum, open the topic of our device and see what is in the header. There may be more than one topic, for example, separate official and unofficial firmware. Or separately firmware based on AOSP and / or Cyanogen. There are also instructions. They are not always as simple as possible, but always working.
If you are fluent in English, the xda-developers forum is a great resource for you. For example, only there I was able to find a suitable firmware for MotoX 1st gen (it was not on w3bsit3-dns.com).
When looking for firmware for your device, make sure that it is intended for recovery, and not for fastboot (or for specialized software that is an add-on over it – MiFlash, RSD, etc.). It is the firmware for recovery that allows you to minimize the number of complex operations, and, therefore, errors.
Unlocking the bootloader
At the moment, many phones come with a locked bootloader. Including the most popular both among ordinary users – Samsung, and among those who are looking for maximum opportunities for the lowest price – Xiaomi. Therefore, the first step to installing an unofficial firmware may be to unlock the bootloader. We carefully read the instructions on how to do this, and follow it. For some devices it is simple and fast, for others it is more difficult and longer. But you will not be able to avoid unlocking for using unofficial firmware (in fact, sometimes it will, but this is already the specificity of individual devices, based on a too weak locking system).
Preparing the PC
A number of utilities should be installed on your PC to work with your smartphone. You can find various specialized packages for download, but these utilities are all included in the Android SDK. So the most reliable way to install (especially if you have Windows and you are afraid of viruses or Trojans on your PC) is to download the SDK (we are interested in the 'Get just the command line tools' section) and unpack it.
The good thing about this method is that it works on all three major desktop operating systems (Windows, Mac, Linux). True, there are some nuances everywhere: in Windows you may need to install drivers for the device, and in Linux some commands may require root (unless, of course, you are fine-tuning access rights).
Installing TWRP
TWRP (Team Win Recovery Project) is probably the most convenient of the massively widespread custom recovery (you can read about what recovery is in the corresponding article of the Great Kukuruzo). TWRP uses a traditional smartphone touch interface, allows you to mount memory cards and USB-OTG devices, and even connect to a computer using the MTP interface.
In the firmware theme for your device, we find a link to download the correct version of TWRP and download it. Please note that some TWRP versions may be officially supported by the developers for your device and some may not.
We reboot the device to fastboot. As a rule, to do this, you need to turn it off, and when you turn it on, press and hold the volume up key before pressing the power key (on some devices, on the contrary, you need to press the volume down key, and on some you only need to press one of the volume keys).
Boot into fastboot and flash TWRP:
fastboot flash recovery twrp.img
where twrp.img is the unpacked TWRP image.
Sometimes a trick is possible that allows you to download TWRP without even flashing it:
fastboot boot twrp.img
Unfortunately, this trick does not work on all devices. Then you have to flash TWRP and load it in a regular way.
Flashing process
Now you can copy the archive with the firmware to the device (if you have not already done this) and select the Install item in TWRP.
Select the file with the firmware and confirm the installation. In the process, pay attention to whether there are any error messages. If not, then everything went well.
Note that TWRP can either automatically get root by installing SuperSU or ask about it.
If the rooting happened automatically, but you do not need it (for example, you want to use the Sberbank application), then after downloading you will need to launch SuperSU and remove root access.
As a rule, after installation you need to clear the cache (wipe cache). Then you can reboot. After rebooting, we get a device with a new firmware.