xiongyihui / notes

Notes
https://xiongyihui.github.io/notes/
3 stars 0 forks source link

Setup ADBD on BeagleBone Green #24

Open xiongyihui opened 5 years ago

xiongyihui commented 5 years ago

Install ADBD

When I tried to get adbd work on BeagleBone Green. adbd is not available on debian 9 repository yet, while the good news is that it is on the next release (the testing branch) repository.

The adbd is built from the source package android-tools.

  1. download source packages including .orig.tar.xz and .debian.tar.xz
  2. extract packages
  3. install dependencies
  4. build
  5. check the output deb packages
# 1. download source packages including *.orig.tar.xz and *.debian.tar.xz
wget http://deb.debian.org/debian/pool/main/a/android-tools/android-tools_5.1.1.r38.orig.tar.xz
wget http://deb.debian.org/debian/pool/main/a/android-tools/android-tools_5.1.1.r38-1.1.debian.tar.xz

# 2. extract packages
tar xvf android-tools_5.1.1.r38.orig.tar.xz 
cd android-tools_5.1.1_r38/
tar xvf ../android-tools_5.1.1.r38-1.1.debian.tar.xz 

# 3. install dependencies
sudo apt install debhelper libbsd-dev libcap-dev libpcre3-dev libssl-dev zlib1g-dev

# 4. build
dpkg-buildpackage -us -uc

# 5. 
cd .. && ls
sudo dpkg -i android-tools-adbd_*deb

Setup USB

As we need to reconfigure the USB, we should use SSH instead of USB virtual serial to access the device.

  1. disable USB device function
  2. add usb ffs.adb function, remove usb ethernet function (optional)
  3. setup adbd
sudo su
cd /sys/kernel/config/usb_gadget/g_multi/
echo '' > UDC

rm configs/c.1/rndis.usb0
rm configs/c.1/ecm.usb0
mkdir functions/ffs.adb
ln -s functions/ffs.adb configs/c.1/

mkdir -p /dev/usb-ffs/adb
mount -o uid=2000,gid=2000 -t functionfs adb /dev/usb-ffs/adb
adbd &

ls /sys/class/udc/ > UDC

Reference

[1] https://github.com/tonyho/adbd-linux/blob/master/adb.sh