ADB & Fastboot
Android Debug Bridge, aka ADB, is a command line with which you can explore, perform actions and make changes to an Android or a KaiOS device. The adbd daemon runs on the device, and the adb client starts a background server to multiplex commands sent to devices.
Fastboot is a diagnostic protocol primarily used to modify the flash filesystem via USB connection from the host computer. It requires the device be booted into boot loader mode or fastboot mode or secondary program loader mode.
Install ADB and Fastboot on Windows 7 / 8 / 8.1 / 10
1. ADB and Fastboot are part of the Android SDK package. You can download the official release from the developer.android.com website, by selecting Android Studio > RELEASE NOTES > SDK platform tools:
2. Extract the contents of this ZIP file into an easily accessible folder);
3. Open Windows explorer and browse to where you extracted the contents of this ZIP file;
4. Open up a Command Prompt from the same directory as this ADB binary (hold Shift and Right-clicking within the folder then click the “open command prompt here” option, on Windows 10 users may see “PowerShell” instead of “command prompt”);
5. Connect your phone to your PC with a USB cable;
6. Dial the debug code *#*#33284#*#* or use a different way to enable ADB (take a look to the KaiOS devices);
7. In the Command Prompt window, enter the following command to launch the ADB daemon: adb devices
8. If everything was successful, you should now see your device’s serial number in the command prompt.
NOTE: from the Command Prompt you can normally use "adb", as in all the guides on this site. If you use PowerShell you must specify the path using "./". For example the adb devices command of the Command Prompt becomes ./adb devices in PowerShell.
Install ADB and Fastboot on macOS and Linux
1. ADB and Fastboot are part of the Android SDK package. Download the official release for your platform from the developer.android.com website, by selecting Android Studio > RELEASE NOTES > SDK platform tools:
2. Open the Terminal.
3. To browse to the folder you extracted ADB into, enter the following command: cd /path/to/extracted/folder/ or just drag and drop the folder on the terminal;
4. Connect your phone to your Mac/PC with a USB cable. On Mac, change the USB connection mode to “file transfer (MTP)” mode;
5. Dial the debug code *#*#33284#*#* or use a different way to enable ADB (take a look to the KaiOS devices);
6. Once the Terminal is in the same folder your ADB tools are in, you can execute the following command to launch the ADB daemon: adb devices
7. If everything was successful, you should now see your device’s serial number in the Terminal.
Install ADB and Fastboot on Linux from the main repositories
On Debian-based, users can type the following command to install ADB and (if needed) Fastboot:
sudo apt install adb fastboot
On Fedora-based, users can type the following command to install ADB:
sudo dnf install android-tools
On Arch-based, users can type the following command to install ADB:
sudo pacman -S android-tools or just sudo pacman -S adb
On Gentoo-based, users can type the following command to install ADB:
sudo emerge --ask dev-util/android-tools
For all Linux distributions it is possible (and not necessary if you're already using the repositories) to use the same steps indicated in the paragraph dedicated to macOS.
Setting up USB access (Linux only)
Since the USB drivers for these peripherals are in many cases not recognized on Linux, we can rely on this manual configuration (from developer.kaios.com):
Download and install the Android rules using this long command:
wget -S -O - https://raw.githubusercontent.com/cm-b2g/B2G/1230463/tools/51-android.rules | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
Plug the device to your computer using a USB cable and use the command lsusb to get the Vendor ID, from the terminal, in my case on Qualcomm (Nokia 8110 4G) the output is:
"Bus 001 Device 007: ID 05c6:f003 Qualcomm, Inc. Nokia 8110 4G"
so my vendor ID is 0506;
Check the new /etc/udev/rules.d/51-android.rules file, if the line for your ID vendor is not available, just add it as this:
#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0664", GROUP="plugdev"
obviously for Spreadtrum and Mediatek the value from the lsusb output will be different;
Run the command:
sudo chmod a+r /etc/udev/rules.d/51-android.rules
Create the file /.android/adb_usb.ini in your HOME directory (not as root) ant put the value of vendor ID on this file using hex format. In my example the value is 0x0506, where 0506 is the vendor ID that we got before, for Nokia 8110 4G. Here are some screenshots of what it must look like:
6. Use the command 'adb devices' on the terminal to list all devices connected on your PC. Your device should be listed and is ready to receive Gaia apps or use it on WebIDE.
Global options
-a (listens on all network interfaces, not just localhost) -d (uses USB device, error if multiple devices connected) -e (uses TCP/IP device, error if multiple TCP/IP devices available) -s SERIAL (uses device with given serial, overrides $ANDROID_SERIAL) -t ID (uses device with given transport id) -H (name of adb server host, default=localhost) -P (port of adb server) -L SOCKET (listens on the given socket for adb server)adb help
adb version
adb devices
adb reboot
adb forward
adb kill-server
adb connect
adb usb
adb install
adb uninstall
adb shell pm list packages
adb shell
adb shell start
adb shell stop
adb shell pm path
adb shell pm clear
adb pull
adb push
adb shell ls
adb shell cd
adb shell rm
adb shell mkdir
adb shell touch
adb shell pwd
adb shell cp
adb shell mv
adb shell netstat
adb shell ping
adb shell net cfg
adb shell ip
adb logcat
adb shell dumpsys
adb shell dumpstate
adb shell screencap
adb shell screenrecord
adb root
adb sideload
adb shell ps
adb shell top
adb shell getprop
adb shell setprop
BusyBox
BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides minimalist replacements for most of the utilities you usually find in GNU coreutils, util-linux, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts.
Learn more on the official website of the project, busybox.net
Global options
-w Erase userdata and cache (and format if supported by partition type).-u Do not erase partition before formatting.-s <specific device> Specify a device. For USB, provide either a serial number or path to device port. For ethernet, provide an address in the form <protocol>:<hostname>[:port] where <protocol> is either tcp or udp.-c <cmdline> Override kernel commandline.-i <vendor id> Specify a custom USB vendor id.-b, --base <base_addr> Specify a custom kernel base address (default: 0x10000000).--kernel-offset Specify a custom kernel offset (default: 0x00008000).--ramdisk-offset Specify a custom ramdisk offset (default: 0x01000000).--tags-offset Specify a custom tags offset (default: 0x00000100).-n, --page-size <page size> Specify the nand page size (default: 2048).-S <size>[K|M|G] Automatically sparse files greater than 'size'. 0 to disable.--slot <slot> Specify slot name to be used if the device supports slots. All operations on partitions that support slots will be done on the slot specified: 'all' can be given to refer to all slots, 'other' can be given to refer to a non-current slot. If this flag is not used, slotted partitions will default to the current active slot.-a, --set-active[=<slot>] Sets the active slot. If no slot is provided, this will default to the value given by --slot. If slots are not supported, this does nothing. This will run after all non-reboot commands.--skip-secondary Will not flash secondary slots when performing a flashall or update. This will preserve data on other slots.--skip-reboot Will not reboot the device when performing commands that normally trigger a reboot.--disable-verity Set the disable-verity flag in the the vbmeta image being flashed.--disable-verification Set the disable-verification flag in the vbmeta image being flashed.--wipe-and-use-fbe On devices which support it, erase userdata and cache, and enable file-based encryption.--unbuffered Do not buffer input or output.--version Display version.-h, --help show this message.fastboot devices
fastboot reboot
fastboot reboot recovery
fastboot oem unlock
fastboot oem lock
fastboot oem device-info
fastboot flash recovery
fastboot boot
fastboot flash
fastboot getvar cid