Have you ever used the Fastboot commands? If not, you might at least be familiar with the Fastboot mode on Android devices. ADB and Fastboot are protocols for Android meant to be used by developers and enthusiasts. They can be used to perform different command-line operations using a computer. ADB and Fastboot are part of the SDK Platform tools that facilitate debugging and modifying Android devices using the command terminal on a computer.
What is Fastboot?
Just like ADB (Android Debug Bridge), Fastboot is a command-line tool as well as a protocol on Android devices. It works as a communication bridge between your computer and Android device. Fastboot commands work only when your device is booted into the Fastboot or bootloader mode. Using these commands, you can reboot the bootloader, enable or disable OEM unlock, and flash factory images or modify partitions on your device.
Whether you want to flash a custom recovery or the stock firmware images on your Android device manually, you must execute specific Fastboot commands for the purpose. However, before you can execute ADB and Fastboot commands, there are certain preparations that you must make beforehand.
Prerequisites
Download the Android SDK Platform tools that include ADB and Fastboot files and install them. The next thing you need to do is to install the Android USB driver from your device’s OEM. The last prerequisite is enabling USB Debugging on your Android phone or tablet.
USB Debugging is located under Developer Options on your Android device. Since the Developer options are not meant for average users as they contain sensitive settings, they remain hidden by default. To enable it, go to Settings> About phone and tap the Build number 7 times. You’ll see a toast message telling ” You are now a developer!” Now, return to the Settings menu page and you’ll find Developer options at the bottom of the page.
Fastboot Mode
ADB commands just require an Android device or emulated connected via USB. However, Fastboot commands require a connected Android device that is booted in the Fastboot or Bootloader Mode. You can boot Android phones or tablets into the Fastboot mode by pressing the Volume Down + Power buttons simultaneously for 2-3 seconds. On some devices, you might need to use the Volume Up key instead.
Alternatively, you can reboot your Android device into the Fastboot or Bootloader mode using an ADB command. Connect your phone to a Windows, Mac, or Linux computer and execute the following commands one after another. Make sure your phone’s screen is unlocked.
Added:
adb devices
When you hit the Enter key after issuing the above command, you’ll see the connected device on the command window.
Having ensured a proper connection, you can execute the following command:
adb reboot bootloader
Your Android device will reboot into the Fastboot mode and you are all set to use the Fastboot commands listed below.
Fastboot Commands List
Warning: Please note that Fastboot commands can brick or damage your device. Please use them carefully. If you are new to such things, please refer to a reliable tutorial. Also, Fastboot commands do not necessarily work on all Android devices. Their compatibility differs from OEM to OEM.
Check Fastboot Connection Status
fastboot devices fastboot devices [-l] (with the path of the device/s)
Using this Fastboot command, you can check if your device has been detected and recognized by your computer or not. It shows the list of device/s connected to your computer as shown below.
Find Device Information via Fastboot
fastboot oem
There are some interesting variations of the ‘fastboot oem’ command that work with different parameters as described below:
fastboot oem device-info
The above command, for instance, will display a detailed list of information about your Android device. Similarly, you can add the following parameters after fastboot oem
to perform certain tasks and get more info.
setbrightness get_config set_config rm_config esim_erase esim_atp uart HALT sha1sum ddrtest ramdump dmesg rma ramdump_sahara dump-chipid check-hw-security get_platform_info set_platform_info select-display-panel off-mode-charge set_display_power_mode enable-factory-lock factory-lock continue-factory
Display Miscellaneous Info about Your Device
fastboot getvar [NAME] fastboot getvar battery-status fastboot getvar battery-voltage fastboot getvar boot-mode fastboot getvar build-mode fastboot getvar cidnum fastboot getvar gencheckpt fastboot getvar imei fastboot getvar meid fastboot getvar modelid fastboot getvar partition-layout fastboot getvar platform fastboot getvar product fastboot getvar security fastboot getvar serialno fastboot getvar version fastboot getvar version-baseband fastboot getvar version-bootloader fastboot getvar version-cpld fastboot getvar version-main fastboot getvar version-microp fastboot getvar version-misc
To get even more information about your Android phone or tablet using the Fastboot commands listed above.
Fastboot Command to Unlock the Bootloader
fastboot oem unlock
This command can unlock the bootloader on Android devices from OEMs like Google (Nexus/Pixel), OnePlus, Motorola, Nokia, etc. You may also need an unlock key from your device manufacturer to unlock the bootloader. Alternatively, you can also use the following Fastboot command to unlock the bootloader.
fastboot flashing unlock
Read Also: How to Unlock Android PIN and Pattern using ADB Commands
Relock the Bootloader
fastboot oem lock
or
fastboot flashing lock
Once unlocked the bootloader, you can relock it later by using the above command.
Reboot Android Device
fastboot reboot
Reboots your device into the ROM.
Reboot the Device into the Recovery Mode
fastboot reboot recovery
Reboots Android devices into Recovery mode.
Reboot the Device into the Bootloader Mode
fastboot reboot bootloader
Sometimes, you may need to reboot the Fastboot or Bootloader mode while flashing images. This command will do that for you.
Fastboot Commands to Flash TWRP and System Image
fastboot flash
This command can be used to flash zip files, factory images, recovery, boot, radio, system, and other images to your Android device. Check out these examples:
fastboot flash boot boot.img fastboot flash system system.img fastboot flash recovery recovery.img fastboot flash cache cache.img fastboot flash modem NON-HLOS.bin fastboot flash sbl1 sbl1.mbn fastboot flash dbi sdi.mbn fastboot flash aboot emmc_appsboot.mbn fastboot flash rpm rpm.mbn fastboot flash tz tz.mbn fastboot flash LOGO logo.bin
Similarly, you can use the following command to flash TWRP recovery.
fastboot flash recovery twrp.img
If the TWRP recovery file you have is a flashable ZIP, you can use the following command.
fastboot flash recovery TWRP-recovery.zip
Boot into TWRP via Fastboot
fastboot boot recovery twrp.img
Use the above command if you need to just boot your Android device into a custom recovery mode temporarily without flashing it.
Format the Userdata Partition
fastboot erase userdata
You can use this command to erase your phone’s data.
Flash All Partitions at Once
fastboot -w flashall
If you want to flash all partitions on your Android device at once, you can use the above Fastboot command.
Restore from Backed-up Images
If you have backed up the system, data, and cache image files from your phone and want to restore them, you can do that by erasing the current partitions followed by flashing the backed-up images saved on your computer. Make sure to issue the commands given below in the same sequence.
fastboot erase system fastboot erase data fastboot erase cache
Once you have erased the above partitions, use these commands to restore your backup:
fastboot flash system system.img fastboot flash data data.img fastboot flash cache cache.img
Should you have any questions to ask about ADB and Fastboot commands, feel free to drop us a comment. Before you go, don’t forget to check out our huge list of ADB Shell commands with a detailed explanation.
Flash Update.zip via Fastboot
fastboot update ZIP
You can use this command to flash all partitions from an update.zip package.
You can download the Fastboot commands list as a PDF file as well.
what is the cammond when it show “FAILED (remote: Error flashing partition : Volume Full)” please help for cleaning the volume
Hi Rakesh!
I got so far, this worked:
1) Unlock Bootloader via Fastboot Method on Android:
.\fastboot flashing unlock
2) Flash TWRP recovery:
.\fastboot flash recovery recovery.img
Now both booting recovery mode and booting normal mode give that “your device has been unlocked and can’t be trusted” nonsense, lol.
Nonsense, because for me there’s nothing that must be LESS trusted than having google crap on my device. 🙂
Booting fastboot mode still shows up fine.
I got the Cubot Kingkong Mini2 with the sole purpose to “degoogle” it from the start. If I can’t, I not shed a tear over the phone.
I don’t give up easily though. I am now trying to find someone with experience how to get this phone to the state that I guess 98% of Android users quietly long for: A phone without google sniffing.
Apps aren’t a problem: Everything I could ever want or need is available is apk on sites that I trust. Thus not google “play”. 😉
Do you happen to know? 🙂
Pingback: Coder
Great detailed guide. I must, however, point out one major error. Fastboot mode is used for flashing only files which are structured as images (.img, .fex, .mbn, .bin, etc.). You cannot flash TWRP. zip files via fastboot command (or any other zips). The TWRP flashable installers you mentioned are actually written in Edify, a UTF-8 encoded instruction set for Android recovery. Fastboot mode does not interpret Edify, nor does it permit the flashing of compressed zip files.