Flash Sony Xperia Z2 D6503 For Russia

The content of the article

Most of the articles in the X-Mobile rubric are devoted to hacks and tweaks that require root privileges, firmware modifications, or their replacement with custom ones. However, not every reader is ready to expose their smartphone to such operations, fearing that they can turn the device into a brick or lead to instability in the work. 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 is all about “turning a smartphone into a brick” and what other pitfalls a user can wait on the way to change the system and install custom firmware. What kind of glitches can I catch at the same time, and is it possible to kill a smartphone by reflashing it incorrectly? Will you lose the guarantee forever or can the smartphone be returned to its previous state? Are custom firmware really able to let the smartphone owner at the most inopportune moment and are they worth it?

Myth 1. Incorrect flashing can kill a smartphone

A smartphone can be killed by a fall from the fifth floor, but not a flashing. The main problem that anyone who wants to reflash a smartphone is facing is a failure during the installation of the firmware, 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 is enough to understand how the process of flashing the smartphone works and what system components are used. To be able to install third-party firmware on your smartphone, you need to unlock the bootloader (not in all cases), get root, and install a custom recovery console (ClockworkMod or TWRP) that can install firmware with any digital signature.

Flash Sony Xperia Z2 D6503 For Russia

TWRP Recovery Console

Hacker # 187. Getting around Blizzard Warden

The recovery console is stored in a separate section of the internal NAND memory and is in no way associated 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 download it, however, the recovery console will remain in place, and all that needs to be done is to boot into recovery again and reinstall the firmware.

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

Before flashing, be sure to backup using the custom recovery console You can restore the backup using the Nandroid Manager Android application

You may ask: what will happen if a failure occurs during the installation of the recovery console itself? Nothing, in this case the opposite situation will turn out, when the operating system itself will remain in place, and the console will be lost. To deal with it, just re-flash recovery directly from Android.

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

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

Myth 2. Custom firmware is unreliable

Firmware firmware is different. On the expanses of the World Wide Web, you can find a huge number of Android assemblies for every taste and color, and most of them are really slag, which can lead to instabilities in the smartphone and loss of 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.

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

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

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

Myth 3. Software that requires root privileges can turn a smartphone on.

In theory, an application with root privileges can do anything with the smartphone’s firmware, including erasing it completely. Therefore, with such software you must be extremely careful. The software that we talk about on the pages of the magazine is completely safe and tested on our own skin. In addition, for the entire time using smartphones on Android (and this is starting from version 1.5), I never I did not encounter a situation where software with root support would kill a smartphone.

Myth 4. Root rights make a smartphone vulnerable to viruses

The smartphone is vulnerable to viruses not by root privileges, but by the bugs used to obtain them. Rooting tools and viruses can use the same Android vulnerabilities to gain root privileges, so the fact of having root on the device does not change anything. A well-written virus will not request rights in the standard way, giving out its presence; instead, it will use the same vulnerability to get them secretly.

over, 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

The software designed to get root does four simple things: it launches an exploit that allows you to obtain root privileges in the system, mounts the / system partition in write mode, copies the su binary required for obtaining root privileges to the / system / xbin directory, and installs the SuperSU or SuperUser application, which will receive control whenever an application asks for root privileges using su.

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

All root permissions can be tracked using SuperSU or the built-in custom firmware function

Myth 6. Having received root and installing custom firmware, I will lose the guarantee.

The warranty is lost not from the very fact of getting root, but because of its discovery by the service center. Most devices can be removed from root privileges 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, preinstalled on new Samsung smartphones and tablets, such as the Galaxy S4, S5, Note 3 and Note 10.1. Knox provides enhanced Android security by responding to any firmware modifications and installing third-party kernels and firmware. In the event that the user performs these actions, the system sets a trigger that confirms the fact of modification. The trigger is implemented in hardware (eFuse chip), so resetting it to its original position will not work. On the other hand, it is not clear whether the service center will refuse to repair the device on this basis. Second: the eFuse chip is also installed on some other devices (for example, smartphones from LG), and it also allows you to accurately determine whether the smartphone was rutted or reflash.

If we talk about custom firmware, everything is more complicated. Typically, a flashing operation requires unlocking the bootloader, and this can be done either using special exploits or using the web service of the smartphone manufacturer. In any case, the unlocked bootloader will accurately indicate that the smartphone did not belong to the 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 a newly locked bootloader will most likely receive the status of Re-locked, not Locked, as it was originally (this happens on HTC smartphones eg). The exception is only smartphones and tablets of the Nexus line, the bootloader of which can be locked and unlocked in three clicks without dancing with a tambourine, and no one will find fault with anything.

On Linux, ADB and Fastboot can be installed separately from the Android SDK. On Ubuntu: sudo apt-get install android-tools-fastboot. In 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

Obtaining root and flashing the 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 may work (if there is one in the smartphone) and block the ability to turn on the smartphone.

Fortunately, today, smartphone manufacturers either choose not to block the ability to turn on a smartphone with a hacked bootloader (by setting a trigger that indicates the fact of an action like Knox does), or they implement a special web service that allows you to painlessly unlock the bootloader with a loss of warranty on your smartphone, which eliminates the need for users to take risks, breaking the bootloader.

Problems that may occur 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 a failed flashing, the smartphone stopped loading

Unsuccessful flashing can be caused by several factors: the battery is dead, and the firmware is only half full, the firmware turned out to be malfunctioning or intended for another model of smartphone. In the end, the smartphone simply did not have enough space that could happen when trying to install the latest version of Android on a smartphone three or four years ago.

Outwardly, all these problems usually manifest themselves either in the endless reset of the smartphone to the initial logo of the manufacturer, or in the so-called boot-loop, when the loading animation spins on the screen for more than five to ten minutes. There may be problems with the screen (colorful ripples) and a broken touch screen, which also impede the use of the smartphone.

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

Scenario two: firmware works, but recovery is not available

This can happen after an unsuccessful installation or upgrade of the recovery console. The problem is that after rebooting the smartphone and turning it on with the volume down button held down, a black screen appears, after which the smartphone either resets or hangs.

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 model of the smartphone, download and flash the desired recovery, without requiring a reboot. If, with their help, it is not possible to restore the console, it is enough to find on the Web instructions for installing recovery on your device.

ROM Manager allows you to install recovery in two tapas

Scenario three: neither firmware nor recovery is available

Honestly, it’s hard 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 the tool from the manufacturer to install the stock firmware. We will consider the second method in more detail in the next section, but I will talk about fastboot here.

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

To access fastboot, you will need drivers and an 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 (both pressed) and connect it using the USB cable to the PC. Next, you need to find the recovery image in.img format for your device and run the command:

Or even make the smartphone boot recovery without actually installing it:

In the same way, you can flash official firmware update:

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

Returning the smartphone to its original state

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

Nexus 5 and other google phones

Returning Nexus devices to their original state is easier than any other smartphone or tablet. In fact, it is so simple that there’s nothing to talk about. In fact, all that needs to be done is to install the ADB / fastboot drivers (even they are not needed on Linux), download the archive with the firmware and run the script. Step by step the whole operation looks like this:

  1. Download and install the ADB Driver Installer from here.
  2. Download and install the Android SDK.
  3. Download the archive with firmware for the desired device from the Google site.
  4. Turn off the device, turn it on with the volume buttons held down (both) and connect using a USB cable.
  5. Unpack the archive with 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 who are interested in what the script does, here is a list of commands:

Galaxy S5

With the Galaxy S5 smartphone, everything is somewhat more complicated, but overall quite simple. This time, you will need the Samsung application Odin, with which the smartphone will be flashed. Sequencing:

  1. We reset the smartphone to the factory settings.
  2. Download and install the latest Samsung USB drivers from here.
  3. Download and install the latest version of Odin from here.
  4. We go to samfirmware.com, enter the model SM-G900F in the search, find the firmware marked Russia, download and unpack it.
  5. Turn off the smartphone and turn on with the volume down and Home buttons held down, wait five seconds until a warning message appears.
  6. Press the volume up button to put the smartphone in Odin mode.
  7. We connect the smartphone using a USB cable.
  8. Launch Odin, press the PDA button and select the file with the extension tar.md5 inside the directory with the unpacked firmware.
  9. Press 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.

Odin in person

Odin is even in the mobile version

LG G2

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

  1. Download and install the 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. We 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 are waiting for the end of the firmware, and then turn off and turn on the smartphone.

It’s all. But keep in mind that, as in the case of Samsung, the smartphone will still have the status of Rooted, and this can not be fixed.

Sony Xperia Z2

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

  1. Download and install the ADB Driver Installer from here.
  2. We reset the smartphone to the 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 on the volume down and Home keys with the keys held down.
  6. We connect the smartphone to the PC using the USB cable and run the Flash Tool.
  7. Press 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 you to perform an update over the air.

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

conclusions

Smartphone firmware, and even more so getting root access, are not at all as scary and dangerous operations as they might seem at first glance. If you do everything right and do not resort to tools that unlock the smartphone bootloader bypassing the manufacturer’s tools, you won’t be able to brick the smartphone. Yes, in some cases it will be necessary to tinker to get everything back in place, but what is better. to use a locked smartphone, which does not allow to do half of the things that it is capable of, or get full control over the device? After all, reinstalling Windows on a PC doesn’t scare anyone.

Evgeny Zobnin

X-Mobile Heading Editor. Concurrently, the system administrator. A big fan of Linux, Plan 9, gadgets and ancient games.