Difference between revisions of "ADB"

From The Linux Source
Jump to: navigation, search
m
Line 1: Line 1:
 
=== Some Useful Docs ===
 
=== Some Useful Docs ===
 
ADB is part of the Platform Tools software - https://developer.android.com/studio/releases/platform-tools.html<br>
 
ADB is part of the Platform Tools software - https://developer.android.com/studio/releases/platform-tools.html<br>
Images/Manual update steps/commands - https://developers.google.com/android/ota<br>
+
Update Images/Manual update steps/commands - https://developers.google.com/android/ota<br>
 +
Factory Images/Manual update steps/commands - https://developers.google.com/android/images<br>
 
USB Vendor Device ID List - https://developer.android.com/studio/run/device.html#VendorIds
 
USB Vendor Device ID List - https://developer.android.com/studio/run/device.html#VendorIds
  
=== Manual Update Steps ===
+
=== Update Image Steps ===
 
Note: requires adb tool, download an appropriate image, and verify checksum<br>
 
Note: requires adb tool, download an appropriate image, and verify checksum<br>
 
1. With the device powered on and USB debugging enabled (in Developer mode/menu on the phone), reboot into recovery mode
 
1. With the device powered on and USB debugging enabled (in Developer mode/menu on the phone), reboot into recovery mode
Line 16: Line 17:
 
5. Once the update finishes, reboot the device by choosing: Reboot system now
 
5. Once the update finishes, reboot the device by choosing: Reboot system now
 
6. Disable USB debugging on the Developer menu, for security, it should not be active when the device is not being updated
 
6. Disable USB debugging on the Developer menu, for security, it should not be active when the device is not being updated
 +
 +
=== Factory Image Steps ===
 +
Note: requires adb tool, unlock the bootloader, download an appropriate image, verify checksum, and unzip the image<br>
 +
1. Run the flash-all script. This script installs the necessary bootloader, baseband firmware(s), and operating system
 +
# ./flash-all.sh
 +
2. Lock your bootloader
 +
 +
=== Unlock Bootloader ===
 +
1. With the device powered on and USB debugging and OEM unlocking enabled (in Developer mode/menu on the phone), reboot into fastboot mode
 +
# adb reboot bootloader
 +
2. Unlock the bootloader. The target device will show you a confirmation screen. (This erases all data on the target device.)
 +
2a. If you are updating a newer device (2015 and later devices, like Nexus 5X or Nexus 6P using hammerhead or angler builds)
 +
# fastboot flashing unlock
 +
2b. OR, If you are updating an older device (2014 and earlier)
 +
# fastboot oem unlock
 +
 +
=== Lock Bootloader ===
 +
1. With the device powered on and USB debugging and OEM unlocking enabled (in Developer mode/menu on the phone), reboot into fastboot mode
 +
# adb reboot bootloader
 +
2. Lock the bootloader. This will wipe the data (not the OS) on some devices.
 +
2a. If you are updating a newer device (2015 and later devices, like Nexus 5X or Nexus 6P using hammerhead or angler builds)
 +
# fastboot flashing lock
 +
2b. OR, If you are updating an older device (2014 and earlier)
 +
# fastboot oem lock
 +
3. Disable OEM unlocking (in Developer mode/menu on the phone)
 +
 +
=== Adding ADB To Path ===
 +
Temporary
 +
# export PATH=$PATH:/path/to/adb/dir
 +
Permanent<br>
 +
add the Temporary line to the end of the .bashrc for the user
 +
# vi ~/.bashrc
  
 
=== Linux udev Rules ===
 
=== Linux udev Rules ===

Revision as of 15:59, 31 May 2017

Some Useful Docs

ADB is part of the Platform Tools software - https://developer.android.com/studio/releases/platform-tools.html
Update Images/Manual update steps/commands - https://developers.google.com/android/ota
Factory Images/Manual update steps/commands - https://developers.google.com/android/images
USB Vendor Device ID List - https://developer.android.com/studio/run/device.html#VendorIds

Update Image Steps

Note: requires adb tool, download an appropriate image, and verify checksum
1. With the device powered on and USB debugging enabled (in Developer mode/menu on the phone), reboot into recovery mode

# adb reboot recovery

2. Ready the device to accept an update
Hold the Power button and press Volume Up once, and a menu will appear. Select: Apply update from ADB.
3. Check if you system see the device and that it is ready, should show up with "sideload" next to its name

# adb devices

4. Update the device

# adb sideload ota_file.zip

5. Once the update finishes, reboot the device by choosing: Reboot system now 6. Disable USB debugging on the Developer menu, for security, it should not be active when the device is not being updated

Factory Image Steps

Note: requires adb tool, unlock the bootloader, download an appropriate image, verify checksum, and unzip the image
1. Run the flash-all script. This script installs the necessary bootloader, baseband firmware(s), and operating system

# ./flash-all.sh

2. Lock your bootloader

Unlock Bootloader

1. With the device powered on and USB debugging and OEM unlocking enabled (in Developer mode/menu on the phone), reboot into fastboot mode

# adb reboot bootloader

2. Unlock the bootloader. The target device will show you a confirmation screen. (This erases all data on the target device.) 2a. If you are updating a newer device (2015 and later devices, like Nexus 5X or Nexus 6P using hammerhead or angler builds)

# fastboot flashing unlock

2b. OR, If you are updating an older device (2014 and earlier)

# fastboot oem unlock

Lock Bootloader

1. With the device powered on and USB debugging and OEM unlocking enabled (in Developer mode/menu on the phone), reboot into fastboot mode

# adb reboot bootloader

2. Lock the bootloader. This will wipe the data (not the OS) on some devices. 2a. If you are updating a newer device (2015 and later devices, like Nexus 5X or Nexus 6P using hammerhead or angler builds)

# fastboot flashing lock

2b. OR, If you are updating an older device (2014 and earlier)

# fastboot oem lock

3. Disable OEM unlocking (in Developer mode/menu on the phone)

Adding ADB To Path

Temporary

# export PATH=$PATH:/path/to/adb/dir

Permanent
add the Temporary line to the end of the .bashrc for the user

# vi ~/.bashrc

Linux udev Rules

If running adb on Linux, you may need to setup udev to allow access to your android device over USB
Add a udev rules file that contains a USB configuration for each device you want to use for adb/development (you may want to view files in /etc/udev/rules.d/ to check syntax for your specific udev version). Each device manufacturer is identified by a unique vendor ID, as specified by the ATTR{idVendor} property. There is a list of these ID's available, but you can get this information from dmesg (dmesg|tail) after plugging in your device via USB.
As root, create /etc/udev/rules.d/51-android.rules with contents similar to this

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"

Note: MODE specifies read/write permissions, GROUP defines which Unix group owns the device node.