User Tools

Site Tools


adb_and_fastboot

If you want to send us your comments, please do so. Thanks
More on comments


adb and fastboot

Copied from the LineageOS adb fastboot guide page and updated with our experiences and use on Debian
For installation on Windows 10 have a look on this page

This subject is licensed under CC BY-SA 3.0

If you did not came here from the LineageOS page please have a look there first
Where “device” is mentioned, most of the time a smartphone is ment. In our case a Xiaomi Pocophone F1

About ADB and fastboot

What is ADB (Android Debug Bridge)?

The Android Debug Bridge (adb) is a development tool that facilitates communication between an Android device and a personal computer. This communication is most often done over a USB cable, but Wi-Fi connections are also supported

adb is like a “Swiss-army knife” of Android development. It provides numerous functions that are described in detail by the command adb --help. Some of the more commonly used commands are listed in the “popular adb commands” section below

Installing adb and fastboot on Debian

With aptitude

  1. Open a terminal
  2. Login as root
  3. Run aptitude install android-tools-adb
  4. Run aptitude install android-tools-fastboot
  5. Run adb --version
    1. On Debian 10.9 Buster this yields
      Android Debug Bridge version 1.0.39
      Version 1:8.1.0+r23-5
      Installed as /usr/lib/android-sdk/platform-tools/adb
  6. Run fastboot --version
    1. On Debian 10.9 Buster this yields
      fastboot version 1:8.1.0+r23-5
      Installed as /usr/lib/android-sdk/platform-tools/fastboot

From Google zip files

Google hosts zips which include only adb and fastboot. You can set adb and fastboot up for use with the instructions below

  1. Open a terminal
  2. Login as root
  3. Download the Linux zip from Google to /opt
  4. cd /opt
  5. unzip platform-tools_r31.0.2-linux.zip
  6. mv platform-tools Android-ADB-platform-tools
  7. Add the following to /root/.profile
        if [ -d "/opt/Android-ADB-platform-tools" ] ; then
          export PATH="/opt/Android-ADB-platform-tools:$PATH"
        fi
  8. Log out and back in
  9. You may also need to set up udev rules: see this repository for more info
    1. Open a terminal
    2. Log in as root in the terminal
      1. cd /opt
    3. Clone this repository: git clone https://github.com/M0Rf30/android-udev-rules.git
      • If git is not on your computer install git with aptitude install git
    4. cd android-udev-rules
    5. Copy rules file: cp -v 51-android.rules /etc/udev/rules.d/51-android.rules
      1. OR create a sym-link to the rules file - choose this option if you'd like to update your udev rules using git. ln -sf “$PWD”/51-android.rules /etc/udev/rules.d/51-android.rules
    6. Change file permissions: chmod a+r /etc/udev/rules.d/51-android.rules
    7. Add the adbusers group if it's doesn't already exist: groupadd adbusers
    8. cp android-udev.conf /usr/lib/sysusers.d/
    9. systemd-sysusers
    10. Add your user to the adbusers group: gpasswd -a $(whoami) adbusers
    11. Restart udev:
      1. udevadm control --reload-rules
      2. systemctl restart systemd-udevd.service
    12. Start the ADB server adb start-server
      1. To stop, not needed here, the ADB server (back to Debian again): adb kill-server
  10. Do /opt/adb --version. We got
    Android Debug Bridge version 1.0.41
    Version 31.0.2-7242960
    Installed as /opt/Android-ADB-platform-tools/adb
  11. Run /opt/fastboot --version
    1. The result should be something like
      fastboot version 31.0.2-7242960
      Installed as /opt/Android-ADB-platform-tools/fastboot

If flashing the LineageOS recovery does not seem to work

Make sure you booted the device this way

  • You are in the FASTBOOT screen
  • Press Volume up + Power buttons
  • Wait until POCO appears on the screen
  • Now the LineageOS recovery should be started
  • If that does still boot into the device's stock recovery, for the Pocophone F1 “Main Menu MI-Recovery 3.0
    • An older version of platform-tools might solve the issue. A full list can be found here. Alternative websites are: thisone, thisone and thisone
    • Try installing adb and fastboot via the Debian repository: android-tools-adb and android-tools-fastboot
    • This might help

Setting up berryllium for use with adb

To use adb with your device, you’ll need to enable developer options and USB debugging. The original USB debugging page can be found here. How developer options and USB debugging are enabled is described in this sequence:

  1. Open Settings, and select “About”
    1. We could not find about. We found “About phone”
  2. Tap on “Build number” seven times
    1. We could not find “Build number” not in “About phone” nor anywhere else in the device
    2. In “About phone” we got, by tapping 4 times on “Kernel version” the CIT menu with a lot of system test features
    3. Tapping 7 (we think, because when doing it again we got the message “No need, you are already a developer”. So we must have done it right while searching for and trying the right item but did not notice it) times on the “MIUI version(For POCO)” we could enable developer mode
  3. Go back to the Settings screen
  4. Go to ”… Additional settings“
    1. Select “Developer options”
      1. “Developer options” should be turned on already
      2. We also turned on “OEM unlocking”
      3. Scroll down until the chapter “DEBUGGING”
        1. Turn “USB debugging” on
  5. Connect your Android device to an USB port on the computer
    1. You get a slide-up on the bottom of the screen asking to “Use USB for” with
      1. “No data transfer” (pre-selected)
      2. “File Transfer”
      3. “Transfer photo's”
      4. A “Cancel” button
    2. Tap on “No data transfer”
  6. Verify that USB debugging is enabled in developer options. See step 4.
    1. Open a terminal/command prompt
    2. Login as root
    3. Type adb devices and do ENTER
    4. The output is something like
        # adb devices
        * daemon not running; starting now at tcp:5037
        * daemon started successfully
        List of devices attached
        abcdef12	unauthorized
  7. On the device you get a slide-up mentioning:
    1. “Allow USB debugging?”
    2. The computers RSA fingerprint
    3. “Always allow from this computer”
    4. This is turned on. If not, turn this on
    5. “Cancel” and “OK” (blue) button
    6. Tap on the “OK” button
  8. Type adb devices and do ENTER
  9. You should now see your device in the terminal. Something like
      # adb devices
      List of devices attached
      abcdef12	device
  10. Congratulations! adb is now ready to use with your device

Old version

  • Enable developer options on your device so you are able to use adb with your device
    • Open Settings
    • Select “About”
    • Tap on “Build number” seven times
    • Go back
    • Select “Developer options”
  • Enable USB debugging
    • Scroll down, and check the “Android debugging” entry under “Debugging”
  • Plug your device into your computer
  • On the computer, open up a terminal/command prompt and type adb devices
  • A dialog should show on your device, asking you to allow usb debugging. Check “always allow”, and choose “OK”
  • Congratulations! adb is now ready to use with your device

Setting up Fastboot

  • With the device powered off, press the Volume Down and Power buttons
  • Keep holding both buttons until the word “FASTBOOT” appears on the screen, then release
  • Now the device boots into Fastboot (this is also valid for the Bootloader Download)
  • While in fastboot mode, you can type fastboot devices in the terminal to verify that your device is being detected. The result should be something like
    aa5e1b5e	fastboot
CommandExplanation
adb shellLaunches a shell on the device
adb push <local> <remote>Pushes the file <local> to <remote> . Example: adb push /home/user/hello.txt /sdcard/Downloads
adb pull <remote> [<local>]Pulls the file <remote> to <local>. If <local> isn’t specified, it will pull to the current folder
adb logcatAllows you to view the device log in real-time. You can use adb logcat -b radio to view radio logs, and adb logcat -C to view logs in colour
adb install <file>Installs the given .apk file to your device

Unlock bootloader
Unlock bootloader


Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy

RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2024 Webevaluation.nl and the authors
Changes reserved.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
adb_and_fastboot.txt · Last modified: 21-09-2021 18:19 by wim