Flashing an Android device is a process that can either bring a โfermentedโ smartphone back to life, or finally turn it into a โbrickโ if you approach the matter without preparation. This instruction will help you figure out when flashing is really necessary, and when it is better to refuse it. We will look at all stages: from choosing the appropriate firmware to restoring data after installation.
It is important to understand that firmware is not just updating the system through the settings. This is a complete replacement of the device software, which may require unlocking the bootloader, installing a custom recovery, and even working with the command line. If you have never encountered ADB, Fastboot or TWRP, do not be alarmed: we will explain everything as clearly as possible, taking into account the typical mistakes of beginners.
But before you start, answer two questions for yourself: why you need firmware and Are you ready to possible consequences? If the goal is simply to speed up your smartphone, a factory reset or optimization via Settings โ System โ Resetmay be enough. Firmware is justified when:
- ๐ฑ The device does not turn on or only boots into bootloop (infinite reboot).
- ๐ Official updates are no longer released, and you need new Android functions.
- ๐ก๏ธ You want to remove the pre-installed operator software (bloater).
- ๐ง You need to restore functionality after unsuccessful rooting.
1. Preparing for the firmware: what needs to be done before you start
The first and most important step is backup data. The firmware erases all information from the internal memory, including photos, contacts and messages. Even if you plan to use the firmware without wipe, the risk of data loss remains. Here's what you need to save:
- ๐ Media files (photos, videos, music) - copy to PC or cloud.
- ๐ Contacts and SMS - synchronize with Google Account or export through applications like SMS Backup & Restore.
- ๐ฎ Application data โuse Titanium Backup (requires root) or built-in backup functions in games.
- ๐ Passwords and tokens โexport from a password manager or write it down manually.
Next check firmware compatibility with your device model. Installing firmware from a different model or version (for example Global instead of Chinese) may result in non-functioning modules (camera, sensors, mobile network). Check the exact model name in Settings โ About phone โ Model or through the command:
adb shell getprop ro.product.model
Also make sure that:
- ๐ Battery charge is not less 60% (better than 80%).
- ๐ You have an original USB cable (cheap cables can interrupt data transfer).
- ๐ป Drivers for your device are installed on the PC (for example, Samsung USB Drivers or Mi PC Suite).
Make backup of all data|
Check the device model and firmware version|
Charge the smartphone up to 80%|
Install drivers and ADB/Fastboot|
Download firmware and tools (TWRP, Platform Tools)-->
โ ๏ธ Attention: On some devices (for example, Samsung s Knox, Huawei s Bootloader Locks), unlocking the bootloader may void the warranty or block functions (for example, Samsung Pay or Widevine L1 for Netflix in HD).
2. Selection of firmware: official vs custom
Firmware for Android are divided into two types: official (from the manufacturer) and custom (from the community). The former are more stable, but often contain a blocker and are rarely updated. The latter offer more features, but may be less reliable.
| Firmware type | Pros | Cons | Examples |
|---|---|---|---|
| Official (Stock) | Maximum stability, support for all device functions | Bloater, slow updates, limited customization | MIUI for Xiaomi, One UI for Samsung, OxygenOS for OnePlus |
| Custom (AOSP) | Pure Android, regular updates, advanced settings | Camera, NFC or wireless charging may not work | LineageOS, Pixel Experience, Paranoid Android |
| Custom (based on Stock) | Keeps manufacturer's functions, but with optimizations | Fewer updates than AOSP firmware | Havoc-OS for Xiaomi, DerpFest for Realme |
| GSI (Generic System Image) | Universal firmware for devices with Project Treble | The camera, sensors, phone may not work network | Phhussonโs GSI, AndyYanโs GSI |
Where to download firmware:
- ๐ญ Official: on manufacturers' websites (Xiaomi โ
https://new.c.mi.com/global/miuidownload, Samsung โhttps://samfw.com). - ๐ Custom: on forums XDA Developers (
https://forum.xda-developers.com) or 4PDA (https://4pda.to). - ๐ GSI: in the repository
https://github.com/phhusson/treble_experimentations.
Critical: never download firmware from dubious sites or torrents. They may contain backdoors, miners or spyware. Before installation, check the file hash (MD5/SHA-256) using utilities like 7-Zip or HashMyFiles.
โ ๏ธ Attention: Firmware for devices with processors Mediatek often require special tools (SP Flash Tool), and for Qualcomm โ QFil or EDL mode. Please check this point before downloading!
3. Unlocking the bootloader
Most Android devices come with a locked bootloader - this is a protection measure against unauthorized changes. To install custom firmware or TWRPit needs to be unlocked. The process differs depending on the manufacturer:
- ๐ฑ Xiaomi: requires linking an account Mi and waiting 7 days (on some models). Use Mi Unlock Tool.
- ๐ค Google Pixel: unlocked with one command
fastboot flashing unlock. - ๐ Samsung: needed Odin and enabled mode
OEM Unlockin the developer settings. - ๐ OnePlus: unlocked via
fastboot oem unlock, but resets all data.
General unlocking algorithm:
- Enable
USB debuggingiOEM UnlockinSettings โ System โ For Developers. - Connect the device to the PC and confirm permission for debugging.
- Reboot into Fastboot mode (usually
Power + Vol Down). - Execute the unlock command (for example,
fastboot oem unlock). - Confirm the action on the device screen (with volume buttons).
After unlocking, the bootloader will reset the device to factory settings. On some devices (for example, Huawei) you may need an unlock code, which is issued on the official website after entering the IMEI.
What is OEM Unlock and why is it not in the settings?
On some devices (especially carrier versions), the option OEM Unlock may be hidden. To enable it, you sometimes need to enter it. command:
adb shell pm uninstall -k --user 0 com.android.phone
or use applications like OEM Unlock Toggle. However, this can lead to loss of mobile communication, so it is better to check the method for your model on the relevant forums.
4. Installing custom recovery (TWRP)
TWRP (Team Win Recovery Project) is an alternative recovery that allows you to install firmware, do backups and restore data. Without it, installation of most custom firmware is impossible.
Installation instructions:
- Download the image TWRP for your model from the official website (
https://twrp.me) or a trusted source. - Rename the file to
twrp.imgand place it in the folder with Platform Tools. - Reboot the device to Fastboot mode.
- Run the command:
fastboot flash recovery twrp.img - Immediately after that, reboot to TWRP (not into the system!), holding
Power + Vol Up.
If after a reboot TWRP is replaced with stock recovery, then the manufacturer uses A/B sections (for example, Google Pixel, OnePlusIn this case you need:
- Install TWRP in both slots:
fastboot flash recovery twrp.imgfastboot flash boot twrp.img - Or use special scripts (for example, TWRP Installer for Pixel).
โ ๏ธ Attention: On devices with Dynamic Partitions (for example, Xiaomi on Android 10+) you may need a patched image TWRP or manually changing the markup via fastboot resize-logical-partition.
5. instructions
Now that everything is ready, you can start flashing the firmware. Let's consider two main methods: through TWRP and through Fastboot.
Method 1: Firmware via TWRP
This method is suitable for most custom ones. firmware.
- Copy the firmware file (usually
.zip) to internal memory or SD card. - Reboot into TWRP (
Power + Vol Up). - Do backup of current firmware (optional, but recommended): select
Backupโ markBoot,System,Dataโ swipe to confirm. - Select
WipeโAdvanced Wipeโ markDalvik, Cache, System, Dataโ swipe. - Click
Installโ select the firmware file โ swipe to install. - After completion, click
Reboot System.
Method 2: Firmware via Fastboot
This method is more often used for official firmware (for example, Xiaomi, Google).
- Unpack the archive with the firmware (usually
.tgzor.zip) to the folder with Platform Tools. - Reboot the device in Fastboot mode.
- Run a script file (for example,
flash_all.batfor Xiaomi orflash-all.shfor Pixel). - If there is no script, flash it one by one:
fastboot flash boot boot.imgfastboot flash system system.img
fastboot flash vendor vendor.img
fastboot flash dtbo dtbo.img - Run
fastboot reboot.
For devices Samsung the app is being used Odin:
- Run Odin in administrator mode.
- Connect the device in mode Download Mode (
Power + Vol Down + Bixby). - Add firmware files to the appropriate fields (
BL,AP,CP,CSC). - Press
Startand wait for completion.
If the firmware via Fastboot is interrupted with an error FAILED (remote: 'Not allowed in Lock State'), then the bootloader is not unlocked. Return to step 3 and repeat the unlocking.
6. Typical errors and their solutions
Even if you follow the instructions exactly, errors may occur. Here are the most common ones and how to correct them:
| Error | Cause | Solution |
|---|---|---|
Error 7 c. TWRP |
The firmware is not compatible with the device or version of Android | Check the device model and firmware version. Try the firmware for a different version of Android |
FAILED (remote: 'unknown command') |
Unsupported Fastboot command or outdated version of the utility | Update Platform Tools or use fastboot -w for forced cleaning |
| The device boots into bootloop | Incompatibility of the kernel or modules in the firmware | Install another firmware or flash the stock kernel (boot.img) |
| TWRP asks for a password after installation | Data encryption (FBE) is not supported by the firmware | Make a full Format Data v TWRP (attention: it will delete everything!) or use supported firmware FBE |
| Mobile network or Wi-Fi does not work | There are no drivers for your region or model | Install a patch for the modem or flash the stock one vendor.img |
If the device does not turn on after flashing the firmware:
- Try booting into Fastboot or Recovery.
- If available Fastboot, flash the stock firmware through official utilities (Odin, Mi Flash).
- If the device does not respond, try EDL mode (for Qualcomm) or Test Point (for Mediatek).
What to do if the device is not detected by the PC?
If the PC does not see the device in Fastboot or Download Mode, try:
1. Change the USB port (better use USB 2.0 on the back panel of the PC).
2. Disable driver signing in Windows (Run โ bcdedit /set nointegritychecks on).
3. Use another cable (original or with transfer support data).
4. Reinstall the drivers manually via Device Manager (select Android Bootloader Interface).
7. Data recovery and configuration after flashing
After successful flashing, the device will be in the โas afterโ state purchases". You will need:
- Restore data from backup (if you have one). To do this:
- ๐ Copy files from the PC back to the device.
- ๐ Restore contacts and SMS via Google Account or SMS Backup & Restore.
- ๐ฎ Install applications again (game data can be restored via Google Play Games or Titanium Backupif you were root).
- ๐ Enable
USB debuggingiOEM Unlock(if you plan further manipulations). - ๐ Update all applications via Google Play.
- ๐ก๏ธ Check the status SafetyNet (via Magisk or SafetyNet Test). If it does not pass, some applications (for example, banking) may not work.
If you installed custom firmware, you may need to:
- ๐ Customize ViPER4Android to improve the sound.
- ๐จ Install a theme or launcher (for example, Nova Launcher).
- ๐ Optimize autonomy through Battery Guru or AccA.
โ ๏ธ Attention: After flashing custom firmware, some functions may not work correctly. For example, LineageOS sometimes does not work Always On Display or gestures navigation. Check the list of known bugs (bugs) on the firmware page on XDA.
8. How to return the stock firmware
If the custom firmware does not suit you or critical errors occur, you can return the official software. this:
- Download the stock firmware for your model (see section 2).
- If you have TWRP, try flashing the stock
boot.imgandsystem.imgvia recovery. - If the device does not boot, use Fastboot or proprietary utilities:
- For Samsung: Odin + firmware file in the format
.tar.md5. - For Xiaomi: Mi Flash Tool in
clean all. - For Google Pixel: script
flash-all.shfrom the firmware archive.
- For Samsung: Odin + firmware file in the format
Recovery โ Wipe Data/Factory Reset.On some devices (for example, Huawei) to return to stock firmware may require an official service center, since the manufacturer blocks self-flashing.
Returning stock firmware is usually easier than installing custom one, but this does not always reset the bootloader unlock counter (Knox, Bootloader StatusThis may affect the warranty or operation of some functions (for example, Samsung Pay).
FAQ: Answers to frequently asked questions
Is it possible to flash Android without unlocking the bootloader?
No, to install custom firmware or TWRP unlocking is required. However, some official firmware (for example, for Samsung) can be installed via Odin without unlocking, but this will not make it possible to install custom software.
Will I lose root after the firmware?
Yes, the firmware removes root. To get it back, after installing the firmware you need to patch it again boot.img via Magisk and flash it via Fastboot or TWRP.
How to check if the bootloader is unlocked?
Turn off the device and boot in Fastboot mode (Power + Vol Down). If there is an inscription Unlocked or Device State: Unlockedat the bottom of the screen, then the bootloader is unlocked. You can also check with the command:
fastboot oem device-info
and find the line Device unlocked: true.
Is it possible to flash Android through a computer without TWRP?
Yes, many official firmwares are installed through Fastboot or proprietary utilities (Odin, Mi Flash). However, for custom firmware TWRP or another custom recovery is usually necessary.
What is GSI firmware and who is it suitable for?
GSI (Generic System Image) is a universal firmware compatible with devices that support Project Treble (Android 8.0+). It is suitable for those who do not have special custom firmware, but want to try pure Android. However, GSI often lacks support for specific hardware (camera, sensors).