Fastboot , like ADB, is a tool that allows us to communicate with an Android device directly from the PC. It consists of a series of commands with which we can send orders to the phone or tablet , and they can be used both to root a terminal and to flash a new firmware or try to repair it from a brick .
Unlike ADB, which we can use without having access to the recovery or the operating system, in the case of fastboot, we can make use of it directly from the bootloader mode or when the ADB commands do not even work. A true lifesaver and a supreme tool, folks!
First of all, make sure you have installed the device drivers on your PC
If we want to operate using fastboot it is important that we install all the Android terminal drivers on the PC, as well as the corresponding fastboot package. You can get more information about it in this other post.
List of commands and structure for fastboot
The number of fastboot commands is quite large, and although many times we will only use a couple of them, it is interesting to know the ecosystem of functions that the tool offers.
How to use fastboot
The fastboot commands follow the following structure:
fastboot [<option>] <command>
Fastboot command list
|update <filename>||flash device from update.zip|
|flashall||flash boot + recovery + system|
|flash <partition> [<filename>]||write a file to a flash partition|
|erase <partition>||delete a flash partition|
|format <partition>||format a flash partition|
|getvar <variable>||show a variable from the bootloader|
|boot <kernel> [<ramdisk>]||download and boot the kernel|
|flash: raw boot <kernel> [<ramdisk>]||create a boot image and flash it|
|devices||list of connected devices|
|continue||continue with autostart|
|reboot||reboot the device normally|
|reboot-bootloader||reboot device in bootloader|
|help||show help message|
|-w||delete user data, cache and format|
|if the partition type supports it.|
|-or||don’t delete partition before formatting|
|-s <specific device>||specify device serial number|
|or path to device port|
|-l||with «devices» it shows the path of the devices.|
|-p <product>||specify product number|
|-c <cmdline>||override kernel command line|
|-i <vendor id>||specify the vendor id of a custom USB|
|-b <base_addr>||specifies the base address of a custom kernel|
|-n <page size>||specifies nand page size. Default: 2048|
|-S <size> [K | M | G]||automatically discards files larger than|
|indicated size. 0 to disable.|
In addition to these we also have other commands, such as:
fastboot oem unlock (to unlock the bootloader)
fastboot oem lock (to lock the bootloader)
User guide: a couple of practical examples to familiarize ourselves with fastboot
Before starting to launch commands, the first thing we must do is make sure that the fastboot has detected the Android phone that we just connected to the PC. To do this, we launch the following command:
If everything has gone correctly, we will see the identification number of our connected device on the screen. If it does not show anything, it means that something has not gone well (check drivers etc.).
If we are going to flash files and images, it is important that all files are located in the same path from where we execute the commands in ms-dos.
From here we can do whatever we want. For example, we can install a custom recovery with the following commands:
fastboot erase recovery – – we delete the current recovery
fastboot flash recovery recovery.img – – where “recovery.img” corresponds to the new recovery that we want to flash
Now that we have a custom recovery, we can install a custom ROM or an official firmware. We could do it from the new recovery that we just installed (TWRP or any other) or from the same fastboot.
fastboot erase system –w – – delete the system partition
fastboot erase boot – – we delete the boot
fastboot update romcustomizado.zip – – we flash the new ROM, where “romcustomizado.zip” corresponds to the ROM we want to install
fastboot reboot – – we reboot the device
If instead of installing a ROM we want to do a previous complete deletion (this way we make sure that the terminal is clean as the whistle), we can also do it from the fastboot:
fastboot erase system
fastboot erase data
fastboot erase cache
We can also flash only some parts or images of the firmware of our Android. We can go one by one or install only the one that interests us:
fastboot flash userdata data.img
fastboot flash system system.img
fastboot flash boot boot.img
Next, I also leave you a practical example. The other day I was flashing a Yotaphone, and finally I ended up installing all the files that make up the firmware by hand.
All the files were stored in the “firmware” folder inside the folder where I have all the adb drivers. The commands to execute were the following (you can mold this example to the files that make up the firmware of your Android):
fastboot flash aboot firmware / emmc_appsboot.mbn
fastboot flash boot firmware / boot.img
fastboot flash cache firmware / cache.img
fastboot flash modem firmware / radio / NON-HLOS.bin
fastboot flash sbl1 firmware / radio / sbl1.mbn
fastboot flash rpm firmware / radio / rpm.mbn
fastboot flash tz firmware / radio / tz.mbn
fastboot flash userdata firmware / userdata.img
fastboot flash -S 512M system firmware / system.img
I hope that this little tutorial has helped you to learn more about this interesting platform that is Android, and as always, you hesitate to leave your impressions and ideas in the comments area.