Download and install ADB, drivers and Fastboot. How to unlock the Bootloader and install custom Recovery (instructions) Android firmware using the fastboot utility

The ADB and Fastboot utilities are included in the Android SDK development kit (do not confuse it with Android Studio, much less download its cumbersome installation file, unless, of course, you intend to develop for Android). ADB is a debugging tool that allows you to access the Android console from a computer (by connecting the gadget to a PC via USB. At the same time there should be . Fastboot is designed to work with the device when it is loaded in the mode of the same name (if your device has one).

Using ADB, you can manage your smartphone/tablet from your computer: make a backup of applications, record a screencast, put your smartphone in Recovery mode, and much more. In addition, you can work with ADB via Wi-Fi. To do this, your device must have root rights, and you will also need a special application that connects to your computer over the network. For example, ADB Wireless or WiFi ADB. But this is material for a separate article.

Using Fastboot, you can, custom Recovery (or), unlock Bootloader (on HTC, Motorola, Sony, Nexus, Huawei, the latest LG devices it is blocked), clean system partitions.

How to install ADB and Fastboot: instructions

1. Go to the official website where you can download the Android SDK: https://developer.android.com/studio/index.html. Scroll down to the “Command line tools only” section and select the archive for Windows.

2. Check the “I have read and agree with the above terms and conditions” checkbox and click the “Download Android Command Line Tools for Windows” button. The archive will begin downloading.

3. Download it and unzip it to the root of Drive “C:”.

4. You also need to download the Java Development Kit from the official page. Go to the website, agree to the terms of the license agreement by checking the “Accept License Agreement” box, and download the JDK version that matches the bit size of your system.

First way

Go back to the Android SDK folder, open “tools” and run “android”.

Check "Android SDK Platform-tools" (and also "Google USB driver" if you have a Nexus device) and click "Install Packages".

Read below about installing drivers for other devices.

Select "Accept License" and click "Install".

My log showed that there was an error. But in the end everything ended successfully.

After completing the above steps, in the “sdk-tools-windows-” folder version“platform-tools” will appear, and it will contain the “ADB” and “Fastboot” that we are interested in.

Second way

Go to the folder "sdk-tools-windows- version» → “tools” → “bin” and, holding down the “Shift” key, right-click on an empty area. Select "Open a command window" or "Open a PowerShell window here" if you have one of the latest builds of Windows 10 installed on your PC or laptop.

Paste the command into PowerShell or Command Prompt (in PowerShell add ./ at the beginning):

Click "Enter" to execute the command. The files will download and you will be asked to install:

To enable, type y, that is, “yes”, and press “Enter”, after which the installation of “platform-tools” will begin.

At the end, a message will be displayed on the command line that the procedure completed successfully. And the “platform-tools” folder with ADB and Fastboot inside will appear in “sdk-tools-windows- version».

(!) If for some reason you cannot install ADB and Fastboot using the previous methods, use the third option - simply download the “platform-tools” archive and unzip it to the “C:” drive.

Installing ADB and Fastboot drivers for Windows

For a computer, smartphone or tablet, you need to download the USB driver:

  • Samsung - the driver is included in the Kies utility: http://www.samsung.com/ru/support/usefulsoftware/KIES/ or you can download it separately by selecting the desired model: http://www.samsung.com/us/ support/downloads
  • HTC – as part of HTC Sync Manager: http://www.htc.com/ru/software/htc-sync-manager/
  • Nexus - Android driver is installed along with the Android SDK, as described above.
  • Huawei - together with the HiSuite utility: http://consumer.huawei.com/minisite/HiSuite_en/index.html
  • LG – install LG PC Suite: http://www.lg.com/ru/support/software-firmware
  • Motorola - see this page: https://motorola-global-portal.custhelp.com/app/answers/detail/a_id/88481
  • Sony Xperia - FastBoot drivers for all models are here: http://developer.sonymobile.com/downloads/drivers/
  • Xiaomi – Mi PC Suite: http://pcsuite.mi.com
  • MTK – for Chinese devices on MediaTek chips: http://online.mediatek.com/Public%20Documents/MTK_Android_USB_Driver.zip
  • Lenovo - select your smartphone or tablet model and download the ADB driver: http://support.lenovo.com/us/en/GlobalProductSelector
  • Look for solutions for devices from other manufacturers on their official websites.

There are various universal ADB driver installers (for example, this one: http://adbdriver.com/downloads/) - they can also be used, for example, when for some reason it was not possible to install the official solution.

If your model comes with a driver without an installer, you will have to do the following:

1. Go to “Control Panel” → “Device Manager”. In Windows 10, just right-click on the Start menu and select Device Manager.

2. Find in the list the device for which you need to install drivers. Right-click and click Update Drivers.

As you can see, the computer correctly recognizes my Nexus 7 tablet. If your PC detects the smartphone incorrectly or there is a yellow triangle with an exclamation mark inside next to the device, “manual” installation of Android drivers is required for you.

3. Select “Browse this computer for driver software.”

4. Specify the path to the driver folder on your PC.

Wait until the installation is complete and then reconnect the gadget to your computer via USB.

How to get started with Fastboot and ADB

Working with ADB or Fastboot is done from the command line; the utilities are launched in two ways:

1: Right-click on “Start” and select “Command Prompt (Admin)” or “Windows PowerShell (Admin)”. Next, using the commands, specify the path to the folder with ADB and Fastboot (after entering each, press “Enter”).

To return to the root of the "C:\" drive, use:

Thanks to this command we open the desired folder:

In my case it turned out like this:

cd\tools_ version-windows\platform-tools

You will get (Google developers changed the name of the archive after writing the original version of this instruction):

cd\sdk-tools-windows- version\platform-tools

The path to Fastboot and ADB is indicated, now we work with them from the console.

To avoid having to do this every time, add the path to "platform-tools" to the "Path" variable. First, go to the folder, in the navigation bar, right-click on “platform-tools” and select “Copy Address”.

Go to "Control Panel". To do this, press “Win” + “R” and in the “Open:” field, paste control . Click OK.

Select System → Advanced System Settings → Environment Variables....

Find the "Path" variable, highlight it and select "Edit...".

Click New, paste the path to the "platform-tools" folder and click OK.

A bootloader (Hboot) is a program that controls the kernel of your device’s operating system so that it boots normally. Moreover, this applies not only to Android, but also to other devices with an OS, such as a PC, laptop, and even an old push-button phone. In addition, it is the bootloader that gives permission to install any programs and firmware. For this reason, users are interested in factory unlocking the bootloader on an Android phone.

Hboot is activated when the device is turned on, and is an analogue of Bios in a computer. It prepares all the data for the kernel, loads it into memory, after which the system starts directly. If its integrity is damaged or something interferes, thanks to the bootloader you can get into recovery mode to clear the data, or perform a reset to factory settings. To do this, before turning on the device, hold down the power and volume down keys and do not release them until booting (in some cases, the combination of buttons may differ).

Why is the bootloader locked?

Manufacturers block for two reasons:

1. Oblige the owner to use the operating system that was developed for his device.

2. Security. Many smartphones and tablets are sold online or in retail stores. In both cases, the seller or intermediary may, at its discretion, add advertising or malicious software that should not exist. For the same reason, Xiaomi began to block the bootloader of devices released after 2016, due to numerous complaints about the presence of viruses in their firmware (which were not initially present).

Benefits of an unlocked bootloader

An unlocked bootloader opens up exactly the same possibilities for the user as on a PC, namely:

  1. Flash any operating system (available for your device).
  2. Installation of individual modules, OS kernels, applications, patches.
  3. Freely migrate between stock firmwares, especially if they are based on different versions of Android.
  4. Easily create backup copies of the current OS and/or applications, as well as restore them without using a PC.
  5. Use Dual-Boot and install two or more operating systems, both in internal memory and on an external SD card.
  6. Wider recovery options in case of unsuccessful firmware.

And this is not the entire list of possibilities after factory unlocking Android.

How to unblock

Each device has its own version of the bootloader, which means the unlocking method will differ depending on the model and manufacturer. When submitting an application, the block can be removed by the company itself (especially if you are an Android developer), but most often, this happens by hacking previously found vulnerabilities in the system.

Risks and consequences

Unauthorized unlocking of the bootloader will void your warranty service. In addition, your device becomes less secure and vulnerable to hacker attacks. An open bootloader allows you to bypass set passwords, gain access to personal information, or erase everything and install different firmware.


Conclusion

There is no need to worry too much about problems with the bootloader, especially when it comes to personal information. Found or stolen devices most often have their data erased, and rarely will anyone restore anything. An open bootloader is more needed by advanced users who know what to do with it, regularly flash something and experiment.

Leave your questions in the comments to the article below - we will try to answer.

Was the article useful to you?

Rate it and support the project!

Android firmware, i.e. writing certain file images to the corresponding sections of the device’s memory using special Windows software that almost completely automates the process is today not the most difficult procedure from the user’s point of view. If using such tools is impossible or does not give the desired result, Fastboot saves the situation.

In order to flash an Android device via Fastboot, you will need knowledge of the console commands of the same mode of operation of the device, as well as certain preparation of the smartphone or tablet and the PC used for operations.

Due to the fact that in fastboot mode, manipulations with the device’s memory sections are performed virtually directly, when using the firmware method described below, some caution and attentiveness are required. Additionally, the following steps should probably only be recommended if you are unable to flash the firmware using other methods.

The user carries out every action with his own Android devices at his own peril and risk. The site administration is not responsible for possible negative consequences of using the methods described on this resource!

Strict implementation of the preparatory procedures determines the success of the entire process of flashing the device, so the implementation of the steps described below can be considered a prerequisite before carrying out operations.

Installing drivers

You can learn how to install a special driver for fastboot mode from the article:

System backup

If there is the slightest possibility, before flashing the firmware, a full backup copy of the existing partitions of the device’s memory must be created. The steps necessary to create a backup are described in the article:

Downloading and preparing the necessary files

Fastboot and ADB are complementary tools from the Android SDK. We download the entire toolkit or download a separate package containing only ADB and Fastboot. Then unpack the resulting archive into a separate folder on drive C.

Through Fastboot it is possible to record both individual sections of the memory of an Android device and firmware updates as a whole package. In the first case, you will need image files in the format *.img, in the second – package(s) *.zip. All files that are planned for use must be copied to the folder containing unpacked Fastboot and ADB.

Packages *.zip do not unpack, you just need to rename the downloaded file(s). In principle, the name can be anything, but should not contain spaces or Russian letters. For convenience, you should use short names, for example update.zip. Among other things, it is necessary to take into account the fact that Fastboot is case-sensitive in sent commands and file names. Those. “Update.zip” and “update.zip” for fastboot are different files.

Launching Fastboot

Since Fastboot is a console application, working with the tool is done by entering commands of a specific syntax into the Windows command line (cmd). To launch Fastboot, the easiest way is to use the following method.


This add-on allows you to perform all the operations from the examples described below in a semi-automatic mode and without having to resort to manually entering commands into the console.


Unlocking the bootloader

Manufacturers of a certain number of Android devices block the ability to manage device memory sections by locking the bootloader. If a device has a locked bootloader, in most cases flashing its firmware via fastboot is not possible.

To check the status of the bootloader, you can send the following command to the device, which is in fastboot mode and connected to the PC:

fastboot oem device-info

But again we have to admit that this method of determining the blocking status is not universal and differs for devices from different manufacturers. This statement also applies to unlocking the bootloader - the methodology for carrying out the procedure differs for different devices and even for different models of the same brand.

Writing files to device memory sections

Having completed the preparatory procedures, you can proceed to the procedure for writing data to the device’s memory sections. Once again, we double-check that the image files and/or zip packages are loaded correctly and that they correspond to the device being flashed.

Attention! Flashing incorrect and damaged file images, as well as images from another device into the device leads in most cases to the inability to load Android and/or other negative consequences for the device!

Installing zip packages

To write to the device, for example, OTA updates, or a complete set of software components distributed in the format *.zip, the fastboot update command is used.


Writing img images to memory partitions

In many cases, searching for firmware in the format *.zip may be difficult to download. Device manufacturers are reluctant to post their solutions on the Internet. In addition, zip files can be flashed through recovery, so the advisability of using the method of writing zip files through fastboot is questionable.

But the ability to flash individual images into the appropriate sections, in particular "boot", "system", "userdata", "recovery" etc. via Fastboot when restoring the device after serious software problems, can save the situation in many cases.

To flash a separate img image, use the command:

fastboot flash partition_name file_name.img




In this way, the firmware is flashed using commands sent via the console. As you can see, the preparatory procedures take more time and effort, but if they are done correctly, writing sections of the device’s memory occurs very quickly and almost always without problems.

Not every owner of a mobile device in the form of a smartphone or tablet running an Android series operating system knows that any version of the OS has such a thing as Bootloader. What it is will now be discussed. Based on an understanding of the very essence of the issue, it will be possible to find out what operations can be performed when unlocking it.

Bootloader: what is it?

Let's start, so to speak, with the basics. The bootloader for Android systems is practically no different from what is available on any computer terminal, be it a PC or a Mac. In simple terms, Bootloader is a built-in boot tool.

If we take as an example computer terminals with several installed operating systems (say, Windows and Linux), the bootloader, after turning on the stationary unit or laptop, offers the user a choice of logging in, and after confirmation loads one or another OS.

OS Boot Principles

Just like in stationary systems, in mobile devices it accesses initialization files in the same way as, for example, Windows does when loading parameters from the boot.ini file.

If you pay attention to such data, it is not difficult to conclude that in Android systems you can easily change not only the boot method, but also the loaded OS, either manually or automatically. However, few people know that this tool itself only loads the system that is written for a specific model of smartphone or tablet.

Bootloader: how to unlock and why is it needed?

As for the possibilities that unlocking the bootloader suggests, the matter here is not limited to data recovery.

It is believed that in this case the user gains access to the system core, which is not possible by default. How to describe Bootloader in such a situation? What this is will become clear if you look at the lack of so-called superuser rights. It turns out that after the blocking is lifted they are not needed at any level at all. Otherwise, you often have to install special firmware and applications. If, to put it mildly, it is “clumsy”, then the whole system can fail.

Any manufacturer of mobile equipment provides for working with a component such as Bootloader. How to unlock it? This is usually done using special utilities installed on a PC when connected to a mobile device via a USB interface. Please note that superuser rights are not required in this case.

For most devices, including, for example, Sony and HTC gadgets, the use of the Adb Run utility is implied, and for Sony you will have to additionally use special Sony Fastboot drivers, and even refer to the special Unlocker section on the official website. As you can see, the procedure, although feasible, is quite complicated.

Data recovery

On the other hand, in its standard mode of operation, restoring Bootloader after resetting the settings to factory settings is quite simple. This doesn't even require a hard reset.

You just need to reset the settings on the gadget itself, and after rebooting, the system will offer to choose an option: either use new settings on the device, or restore settings, programs and files using a Google services account. In this case, you will have to enter your Gmail address with a password, and also connect to the Internet, for example, with an active Wi-Fi connection.

Installing another operating system

If we talk about the possibility of installing another OS, this issue is quite complicated, although we can solve it. The fact is that some manufacturers claim that after Android there will be no other system for the gadget. Purely a publicity stunt designed to advertise the installed system.

But the Chinese have already proven with their “left” HTC devices that both Android and Windows Phone can easily coexist on one device. Moreover, such models are supplied in most cases with an already unlocked Bootloader. What is it in this case? This is a tool that allows you not only to select a bootable OS, but also to install any other one by changing parameters at the system level.

In other words, the user can even do without any firmware or additional programs to optimize the operation of the installed operating system. Moreover! This does not even require specialized utilities such as optimizers, of which there are so many today that the user himself does not understand what to choose from this huge number of programs and applications.

What should you pay attention to separately?

But when it comes to custom firmware, which have become quite popular among many owners of mobile devices, you need to be very careful with them. Of course, smart firmware or an OS update will not do any harm; on the contrary, it will only improve the operation of the device, but when you install something unofficial and not yet tested (like computer beta versions), expect trouble. Then certainly no bootloader will help.

By the way, few realize that such versions can put too much stress on the hardware components, which, in turn, can lead to their complete inoperability. But changing the processor in the same smartphone is far from the easiest thing.

In addition, unlocking the bootloader in officially released branded gadgets implies automatic loss of warranty and the possibility of free service. So you will have to think a hundred times before performing such actions and operations.

Finally, it remains to add that the issue of installing another OS on an Android device is also, in general, quite controversial. Yes, of course, the system will work, no matter what the manufacturer says. But how it will work is another question, especially since most users usually install some kind of lightweight version that has an unknown source of origin. But in vain. Here, as they say, you can screw up so much that you won’t end up with a sin. And in case of such changes, according to current international standards, the manufacturer itself does not bear any responsibility for the correct operation of the mobile device. Therefore, the decision on expediency must be made by the owner of the gadget himself. But it’s better not to joke with such things.

Most of the articles in the X-Mobile section are devoted to hacks and tweaks that require obtaining root rights, modifying the firmware, or replacing it with a custom one. However, not every reader is ready to subject their smartphone to such operations, fearing that they can turn the device into a brick or lead to instability in operation. Today I will debunk these myths and show that even in the most stalemate situation, bringing a smartphone back to life is not so difficult.

Destroying myths

Let's talk about what it really means to “turn a smartphone into a brick” and what other pitfalls a user can expect on the way to changing the system and installing custom firmware. What glitches can be caught in this case and is it possible to kill a smartphone by reflashing it incorrectly? Will you lose the warranty forever or can the smartphone be returned to its previous condition? Can custom firmware really fail a smartphone owner at the most inopportune moment and are they worth it?

Myth 1. Incorrect flashing can kill a smartphone

A fall from the fifth floor can kill a smartphone, but not flashing it. The main problem that anyone who wants to reflash a smartphone faces is that during the installation of the firmware, a failure may occur, which will lead to its inoperability, and the smartphone will actually turn into a brick.

All this is true, but only on paper. To understand why, it’s enough to understand how the process of flashing a smartphone works and what system components are used. To be able to install third-party firmware on a smartphone, you need to unlock the bootloader (not in all cases), get root and install a custom recovery console (ClockworkMod or TWRP), capable of installing firmware with any digital signature.

The recovery console is stored in a separate partition of the internal NAND memory and is in no way connected with the installed operating system. After installing a modified version of the console, it will be possible to flash custom firmware or even another OS (Firefox OS, for example). If a failure occurs during the installation of the firmware, the smartphone will not be able to boot it, but the recovery console will remain in place, and all you need to do is boot into recovery again and reinstall the firmware.

In addition, any custom recovery console contains a backup/restore function, which allows you to make a backup copy of the main firmware and restore it unchanged (with all applications, settings and data) in the event that something goes wrong. In fact, the smartphone can be returned to its original state.


You may ask: what happens if the installation of the Recovery Console itself fails? Nothing, in this case the situation will be the opposite, when the operating system itself will remain in place, and the console will be lost. To deal with it, you just need to re-flash recovery directly from Android.

Hypothetically, one can imagine a situation where both the firmware and the recovery console are killed (although this is quite difficult to do), but even in this case, the primary bootloader, flashed into the permanent memory of the smartphone, will always remain in place.

Conclusion: it is impossible to kill a smartphone by installing third-party firmware through a custom recovery console. Either the recovery or the primary bootloader will always remain in place.

Myth 2. Custom firmware is unreliable

Firmware is different from firmware. On the vastness of the World Wide Web you can find a huge number of Android builds for every taste and color, and most of them are really slag, which can lead to instability in the operation of the smartphone and loss of some functionality. Therefore, the first thing to remember is that you should only deal with serious custom firmware developed by large teams of experienced developers. First of all, these are CyanogenMod, Paranoid Android, AOKP, OmniROM and MIUI.

Second. There are two types of firmware: officially supported and ported by third-party developers. The same CyanogenMod, for example, has an official version for the Nexus 4 smartphone, but does not have one for the Motorola Defy. But for Defy there is an unofficial port of CyanogenMod 11 from a developer with the nickname Quarx. The difference between them is that the CyanogenMod team is responsible for the support and proper operation of the first, while the second is Quarx personally. Official firmware versions are usually fully functional, but the correct operation of the latter depends on the third-party developer.

Well, third. There are stable and development versions of the firmware. Stable versions of CyanogenMod have the index M (CyanogenMod 11.0 M7, for example). This firmware version usually does not contain bugs. Development versions (in the case of CyanogenMod these are daily nightly builds) may contain bugs and are therefore not recommended for everyday use.

Conclusion: if you install a stable official version of the “normal” firmware on your smartphone, the risk of encountering bugs is minimal. Everything else is for experimenters.

Myth 3. Software that requires root rights can brick a smartphone

In theory, an application with root rights can do anything with the smartphone's firmware, including erasing it completely. Therefore, you need to be extremely careful with such software. The software we talk about on the pages of the magazine is completely safe and tested in our own skin. In addition, for all the time I have been using smartphones on Android (and this is starting from version 1.5), I never I haven’t encountered a situation where software with root support killed a smartphone.

Software distributed through Google Play usually fully corresponds to the stated characteristics, and if it led to a brick or left a backdoor in the depths of the smartphone, it would not last even a week in the store. In any case, you need to follow the “trust but verify” rule and carefully read the instructions for using root applications.

Myth 4. Root rights make a smartphone vulnerable to viruses

What makes a smartphone vulnerable to viruses is not root rights, but the bugs used to obtain them. Rooting tools and viruses can exploit the same Android vulnerabilities to gain root privileges, so the fact that the device is rooted does not change anything. A well-written virus will not ask for permissions in the standard way, revealing its presence; instead, it will take advantage of the same vulnerability to obtain them covertly.

Moreover, having root, you get the opportunity to install the latest version of Android (in the form of custom firmware), in which these bugs are already fixed. Also, do not forget that most custom firmware allows you to disable root or create white lists of applications that can use these rights.

Myth 5. A rooted smartphone may fail

Software designed to obtain root does four simple things: launches an exploit that allows you to gain root rights in the system, mounts the /system partition in write mode, copies the su binary required to obtain root rights in the future to the /system/xbin directory, and installs the SuperSU or SuperUser application, which will take control whenever any application requests root privileges using su.

None of these steps can crash or kill the smartphone. The only thing that can happen is that the exploit will cause a segmentation fault and the smartphone will reboot, after which it will continue to work normally.


Myth 6. By getting root and installing custom firmware, I will lose the warranty

The guarantee is lost not from the fact of obtaining root, but due to its detection by the service center. Most devices can be unrooted using the Universal Unroot application or by reinstalling the stock firmware using the official application from the manufacturer.

There are, however, two exceptions to this rule. The first is the Knox system that comes pre-installed on new Samsung smartphones and tablets such as the Galaxy S4, S5, Note 3 and Note 10.1. Knox provides an increased level of Android security by responding to any firmware modifications and installation of third-party kernels and firmware. If the user performs these actions, the system sets a trigger that confirms the fact of the modification. The trigger is implemented in hardware (eFuse chip), so it cannot be reset to its initial position. On the other hand, it is not entirely clear whether the service center will refuse to repair the device on this basis. Second: the eFuse chip is installed on some other devices (for example, smartphones from LG), and it also allows you to accurately determine whether the smartphone has been rooted or flashed.

If we talk about custom firmware, everything is more complicated. Typically, the flashing operation requires unlocking the bootloader, and this can be done either using special exploits or using the smartphone manufacturer's web service. In any case, the unlocked bootloader will definitely indicate that the smartphone did not belong to a blonde.

On some smartphones, it is possible to lock the bootloader back, but you should learn about this separately, and also keep in mind that the newly locked bootloader will most likely receive the status Re-locked, and not Locked, as it was originally (this happens on HTC smartphones, For example). The only exceptions here are smartphones and tablets of the Nexus line, the bootloader of which can be locked and unlocked in three clicks without any dancing with a tambourine, and no one will find fault with anything.

INFO

On Linux, ADB and Fastboot can be installed separately from the Android SDK. On Ubuntu: sudo apt-get install android-tools-fastboot. On Fedora: sudo yum install android-tools.

To prevent Knox from interfering with root applications, you can disable it using the following command from the terminal: su pm disable com.sec.knox.seandroid.

conclusions

Getting root and flashing a smartphone are absolutely safe operations that cannot brick the smartphone for purely technical reasons. The only exception is an attempt to hack the bootloader in order to unlock it. In this case, the eFuse chip (if the smartphone has one) may work and block the ability to turn on the smartphone.

Fortunately, today smartphone manufacturers either prefer not to block the ability to turn on a smartphone with a hacked bootloader (by setting a trigger indicating the fact of such an action, as Knox does), or implement a special web service that allows you to painlessly unlock the bootloader with loss of warranty on the smartphone. which saves users from having to risk breaking the bootloader.

Problems that may arise during flashing

So, now let's talk about what problems can arise when getting root and flashing and how to deal with them.

Scenario one: after an unsuccessful flashing, the smartphone stopped booting

Unsuccessful flashing can be caused by several factors: the battery died and the firmware was only half filled; the firmware turned out to be faulty or intended for a different smartphone model. In the end, there was simply not enough space on the smartphone, which can happen when trying to install the latest version of Android on a smartphone that is three or four years old.

Outwardly, all these problems usually manifest themselves either in endless resets of the smartphone to the initial manufacturer logo, or in the so-called boot loop, when the boot animation plays on the screen for more than five to ten minutes. There may also be problems with the screen (multi-colored ripples) and a non-working touch screen, which also prevent the use of the smartphone.

In all these cases, it is enough to do one simple thing: turn off the smartphone by long pressing the power button, then turn it on while holding down the volume down button (some smartphones use a different combination), and after you get into recovery, reinstall the firmware (Install zip from sdcard - > Chooze zip from sdcard) or restore the backup (Backup and restore -> Restore). Everything is easy and simple.

Scenario two: the firmware works, but recovery is not available

This can happen after a failed installation or update of the Recovery Console. The problem is that after rebooting the smartphone and turning it on while holding down the volume down button, a black screen appears, after which the smartphone either resets or freezes.

Solving this problem is not easy, but very simple. You can install the recovery console on the vast majority of smartphones using the TWRP Manager, ROM Manager or ROM Installer applications. They themselves determine the smartphone model, download and flash the required recovery, without requiring a reboot. If you can’t restore the console with their help, just find instructions on the Internet for installing recovery on your device.

Scenario three: neither firmware nor recovery is available

To be honest, it is difficult for me to imagine such a scenario, but, as practice confirms, it is quite real. There are two ways to get out of this situation: use fastboot to upload recovery to your smartphone, or use a tool from the manufacturer to install stock firmware. We'll look at the second method in more detail in the next section, and I'll talk about fastboot here.

Fastboot is a tool that works directly with the device’s primary bootloader and allows you to upload firmware to your smartphone, recovery, and unlock the bootloader (in Nexus devices). Fastboot support is available in many smartphones and tablets, but some manufacturers block the ability to use it. So you will have to consult the Internet about its availability.

To access fastboot, you will need drivers and Android SDK. When they are installed, open the command line, go to the SDK installation directory, then to the platform-tools directory, turn off the smartphone, turn it on with the volume buttons pressed (both) and connect it using a USB cable to the PC. Next, you need to find the recovery image in .img format for your device and run the command:

$ fastboot flash recovery image.img

Or even force the smartphone to boot recovery without actually installing it:

$ fastboot boot image.img

In the same way you can flash official firmware update:

$ fastboot update update-file.zip

You can find a recovery suitable for your device either on the TWRP website or in the XDA-Developers and w3bsit3-dns.com forums.

We return the smartphone to its original state

In this section, I will talk about ways to return your smartphone to clean stock, no matter what state it is in. These instructions can be used both to unbrick your smartphone and to remove traces of rooting and flashing. Unfortunately, I can’t talk about all possible models, so I’ll focus on the four most popular flagships: Nexus 5 (I call this sample the control one), Galaxy S5, LG G2 and Sony Xperia Z2.

Nexus 5 and other Google phones

Restoring Nexus devices to their original state is easier than any other smartphone or tablet. In fact, it is so simple that there is not even anything to talk about. In fact, all you need to do is install the ADB/fastboot drivers (on Linux you don’t even need them), download the archive with the firmware and run the script. The whole operation looks like this step by step:

  1. from here.
  2. Download and install Android SDK.
  3. Download the archive with the firmware for the desired device from the Google website.
  4. Turn off the device, turn it on with the volume buttons pressed (both) and connect using a USB cable.
  5. Unpack the archive with the firmware and run the flash-all.bat (Windows) or flash-all.sh (Linux) script and wait for the operation to complete.
  6. We launch the command line, go to the directory with the Android SDK, then platfrom-tools and execute the fastboot oem lock command to lock the bootloader.

For those wondering what the script does, here is a list of commands:

Fastboot flash bootloader bootloader-DEVICE-NAME-VERSION.img fastboot reboot-bootloader fastboot flash radio radio-DEVICE-NAME-VERSION.img fastboot reboot-bootloader fastboot flash system system.img fastboot reboot-bootloader fastboot flash userdata userdata.img fastboot flash recovery recovery.img fastboot flash boot boot.img fastboot erase cache fastboot flash cache cache.img

Galaxy S5

With the Galaxy S5 smartphone everything is a little more complicated, but overall quite simple. This time you will need the Samsung Odin application, which will be used to flash the smartphone’s firmware. Sequencing:

  1. Download and install the latest version of Samsung USB drivers from here.
  2. Download and install the latest version of Odin from here.
  3. Go to the website samfirmware.com, enter the SM-G900F model in the search, find the firmware marked Russia, download and unpack.
  4. Turn off the smartphone and turn it on with the Volume Down and Home buttons pressed, wait five seconds until a warning message appears.
  5. Press the volume up button to put the smartphone into Odin mode.
  6. We connect the smartphone using a USB cable.
  7. Launch Odin, press the PDA button and select the file with the extension tar.md5 inside the directory with the unpacked firmware.
  8. Click the Start button in Odin and wait until the firmware process is completed.

As I already said, this operation will return the smartphone to its original state, but will not reset the trigger installed by the Knox system (if it was in the standard firmware). Therefore, the service center may refuse to repair.

LG G2

Restoring the LG G2 to its factory state will also not cause any problems. The number of steps in this process is somewhat larger, but they themselves do not require special preparation and knowledge. So, what to do to return the G2 to factory firmware:

  1. Download and install ADB Driver Installer from here.
  2. Download the official firmware (Europe Open 32G or Europe Open) from here.
  3. Download and install LG Mobile Support Tool, as well as FlashTool (goo.gl/NE26IQ).
  4. Turn off the smartphone, hold down the volume up button and insert the USB cable.
  5. Expand the FlashTool archive and run the UpTestEX.exe file.
  6. In the window that opens, select Select Type -> 3GQCT, Phone Mode -> DIAG, in the Select KDZ file option select the firmware downloaded in the second step.
  7. Click the CSE Flash button at the bottom of the screen.
  8. In the window that opens, click Start.
  9. In the next window, select the country and language and click Ok.
  10. We wait for the firmware to finish, and then turn off and turn on the smartphone.

This is all. But keep in mind that, as in the case of Samsung, the smartphone will still have Rooted status, and this cannot be fixed.

Sony Xperia Z2

Now about how to return the Sony Xperia Z2 smartphone to its factory state. As in the previous two cases, this will require stock firmware and the official firmware utility. You launch the utility on your PC, connect your smartphone using a USB cable and start the update process. Step by step it all looks like this:

  1. Download and install ADB Driver Installer from here.
  2. Reset your smartphone to factory settings.
  3. Download and install the Flash Tool from the official Sony website and the latest firmware from here.
  4. Copy the firmware file to the C:/Flashtool/Firmwares directory.
  5. Turn off the smartphone and turn it on while holding down the Volume Down and Home keys.
  6. We connect the smartphone to the PC using a USB cable and launch the Flash Tool.
  7. Click the button with the lightning icon in the Flash Tool. In the window that opens, select Flashmode, double-click on the firmware in the list that opens.

WARNING

In many smartphones, an unlocked bootloader will not allow an over-the-air update.

In 90% of cases, unlocking the bootloader will entail deleting all data from the smartphone, including the memory card.

conclusions

Flashing a smartphone, and even more so gaining root access, is not at all such a scary and dangerous operation as it may seem at first glance. If you do everything correctly and do not resort to tools that unlock the smartphone’s bootloader, bypassing the manufacturer’s tools, you will not be able to brick your smartphone. Yes, in some cases you will have to tinker to get everything back in place, but what is better - to use a locked smartphone that does not allow you to do even half of the things that it is capable of, or to gain complete control over the device? In the end, reinstalling Windows on a PC doesn't scare anyone.

mob_info