Skip to main content
update on the current state of adb on raspberry pi
Source Link
Eugen
  • 488
  • 3
  • 12

UPDATE: Sorry for the broken tabs/spaces in the Makefile above. I don't know how to fix this here, you'll have to fix it in the editor of your choice.

I was not able to compile any recent adb for arm on a Raspberry Pi so far, even after upgrading to Raspbian 10/buster which offers gcc 8.3.0. It also comes with adb v1.0.39, 1:8.1.0+r23-5. And to my surprise, Raspbian 11/bullseye actually includes adb v1.0.41, 28.0.2-debian Even better, bullseye is also available for arm64 now!

UPDATE: Sorry for the broken tabs/spaces in the Makefile above. I don't know how to fix this here, you'll have to fix it in the editor of your choice.

I was not able to compile any recent adb for arm on a Raspberry Pi so far, even after upgrading to Raspbian 10/buster which offers gcc 8.3.0. It also comes with adb v1.0.39, 1:8.1.0+r23-5. And to my surprise, Raspbian 11/bullseye actually includes adb v1.0.41, 28.0.2-debian Even better, bullseye is also available for arm64 now!

  1. adb-compile-env-setup.sh

     #!/bin/bash
    
     # some steps found here: http://android.serverbox.ch/?p=1217
    
     sudo apt-get install libssl-dev
    
     mkdir -p ~/adb-dev/5.1.1
     cd ~/adb-dev/5.1.1
    
     mkdir system
     mkdir external
    
     cd system/                
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/system/core
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/system/extras
    
     cd ../external/                 
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/external/zlib
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/external/openssl
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/external/libselinux
    
     cd ../system/core/adb
    
     cp ~/adb-dev/Makefile .
    
     echo "Ready to hit *make* now and pray?"
     read -rsp $'Press any key to continue...\n' -n1 key
    
  2. Makefile (place into ~/adb-dev/Makefile before running other script)

     # standalone Makefile for adb
     # found on: http://android.serverbox.ch/?p=1217
     # this works with android-5.1.1_r1
    
     SRCS+= adb.c
     SRCS+= fdevent.c
     SRCS+= adb_client.c
     SRCS+= commandline.c
     SRCS+= console.c
     SRCS+= file_sync_client.c
     SRCS+= get_my_path_linux.c
     SRCS+= services.c
     SRCS+= sockets.c
     SRCS+= transport.c
     SRCS+= transport_local.c
     SRCS+= transport_usb.c
     SRCS+= usb_linux.c
     SRCS+= usb_vendors.c
     SRCS+= adb_auth_host.c
    
     VPATH+= ../libcutils
     SRCS+= socket_inaddr_any_server.c
     SRCS+= socket_local_client.c
     SRCS+= socket_local_server.c
     SRCS+= socket_loopback_client.c
     SRCS+= socket_loopback_server.c
     SRCS+= socket_network_client.c
     SRCS+= load_file.c
    
     VPATH+= ../libzipfile
     SRCS+= centraldir.c
     SRCS+= zipfile.c
    
     VPATH+= ../../../external/zlib/src
     SRCS+= adler32.c
     SRCS+= compress.c
     SRCS+= crc32.c
     SRCS+= deflate.c
     SRCS+= infback.c
     SRCS+= inffast.c
     SRCS+= inflate.c
     SRCS+= inftrees.c
     SRCS+= trees.c
     SRCS+= uncompr.c
     SRCS+= zutil.c
    
     CPPFLAGS+= -DADB_HOST=1
     CPPFLAGS+= -DHAVE_FORKEXEC=1
     CPPFLAGS+= -DHAVE_SYMLINKS
     CPPFLAGS+= -DHAVE_TERMIO_H
     CPPFLAGS+= -DHAVE_SYS_SOCKET_H
     CPPFLAGS+= -D_GNU_SOURCE
     CPPFLAGS+= -D_XOPEN_SOURCE
     CPPFLAGS+= -I.
     CPPFLAGS+= -I../include
     CPPFLAGS+= -I../../../external/zlib
     CPPFLAGS+= -I../../../external/openssl/include
    
     # so well, let's fake HAVE_OFF64_T, because Raspbian does not.
     # just stay away from files larger than 2GB, ok?
     CFLAGS+= -O2 -g -Wno-unused-parameter -DHAVE_OFF64_T
    
     LIBS= -lcrypto -lpthread -lrt
    
     # old cross-compiler stuff 
     #TOOLCHAIN= /opt/poky/1.5/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-
     #CC= $(TOOLCHAIN)gcc
     #LD= $(TOOLCHAIN)gcc
    
     TOOLCHAIN= /usr/bin/
     CC= $(TOOLCHAIN)gcc
     LD= $(TOOLCHAIN)gcc
    
     OBJS= $(SRCS:.c=.o)
    
     all: adb
    
     adb: $(OBJS)
         $(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
    
     clean:
         rm -rf $(OBJS)
    
  1. adb-compile-env-setup.sh

     #!/bin/bash
    
     # some steps found here: http://android.serverbox.ch/?p=1217
    
     sudo apt-get install libssl-dev
    
     mkdir ~/adb-dev/5.1.1
     cd ~/adb-dev/5.1.1
    
     mkdir system
     mkdir external
    
     cd system/                
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/system/core
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/system/extras
    
     cd ../external/                 
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/external/zlib
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/external/openssl
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/external/libselinux
    
     cd ../system/core/adb
    
     cp ~/adb-dev/Makefile .
    
     echo "Ready to hit *make* now and pray?"
     read -rsp $'Press any key to continue...\n' -n1 key
    
  2. Makefile (place into ~/adb-dev/Makefile)

     # standalone Makefile for adb
     # found on: http://android.serverbox.ch/?p=1217
     # this works with android-5.1.1_r1
    
     SRCS+= adb.c
     SRCS+= fdevent.c
     SRCS+= adb_client.c
     SRCS+= commandline.c
     SRCS+= console.c
     SRCS+= file_sync_client.c
     SRCS+= get_my_path_linux.c
     SRCS+= services.c
     SRCS+= sockets.c
     SRCS+= transport.c
     SRCS+= transport_local.c
     SRCS+= transport_usb.c
     SRCS+= usb_linux.c
     SRCS+= usb_vendors.c
     SRCS+= adb_auth_host.c
    
     VPATH+= ../libcutils
     SRCS+= socket_inaddr_any_server.c
     SRCS+= socket_local_client.c
     SRCS+= socket_local_server.c
     SRCS+= socket_loopback_client.c
     SRCS+= socket_loopback_server.c
     SRCS+= socket_network_client.c
     SRCS+= load_file.c
    
     VPATH+= ../libzipfile
     SRCS+= centraldir.c
     SRCS+= zipfile.c
    
     VPATH+= ../../../external/zlib/src
     SRCS+= adler32.c
     SRCS+= compress.c
     SRCS+= crc32.c
     SRCS+= deflate.c
     SRCS+= infback.c
     SRCS+= inffast.c
     SRCS+= inflate.c
     SRCS+= inftrees.c
     SRCS+= trees.c
     SRCS+= uncompr.c
     SRCS+= zutil.c
    
     CPPFLAGS+= -DADB_HOST=1
     CPPFLAGS+= -DHAVE_FORKEXEC=1
     CPPFLAGS+= -DHAVE_SYMLINKS
     CPPFLAGS+= -DHAVE_TERMIO_H
     CPPFLAGS+= -DHAVE_SYS_SOCKET_H
     CPPFLAGS+= -D_GNU_SOURCE
     CPPFLAGS+= -D_XOPEN_SOURCE
     CPPFLAGS+= -I.
     CPPFLAGS+= -I../include
     CPPFLAGS+= -I../../../external/zlib
     CPPFLAGS+= -I../../../external/openssl/include
    
     # so well, let's fake HAVE_OFF64_T, because Raspbian does not.
     # just stay away from files larger than 2GB, ok?
     CFLAGS+= -O2 -g -Wno-unused-parameter -DHAVE_OFF64_T
    
     LIBS= -lcrypto -lpthread -lrt
    
     # old cross-compiler stuff 
     #TOOLCHAIN= /opt/poky/1.5/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-
     #CC= $(TOOLCHAIN)gcc
     #LD= $(TOOLCHAIN)gcc
    
     TOOLCHAIN= /usr/bin/
     CC= $(TOOLCHAIN)gcc
     LD= $(TOOLCHAIN)gcc
    
     OBJS= $(SRCS:.c=.o)
    
     all: adb
    
     adb: $(OBJS)
         $(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
    
     clean:
         rm -rf $(OBJS)
    
  1. adb-compile-env-setup.sh

     #!/bin/bash
    
     # some steps found here: http://android.serverbox.ch/?p=1217
    
     sudo apt-get install libssl-dev
    
     mkdir -p ~/adb-dev/5.1.1
     cd ~/adb-dev/5.1.1
    
     mkdir system
     mkdir external
    
     cd system/                
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/system/core
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/system/extras
    
     cd ../external/                 
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/external/zlib
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/external/openssl
     git clone -b android-5.1.1_r1 https://android.googlesource.com/platform/external/libselinux
    
     cd ../system/core/adb
    
     cp ~/adb-dev/Makefile .
    
     echo "Ready to hit *make* now and pray?"
     read -rsp $'Press any key to continue...\n' -n1 key
    
  2. Makefile (place into ~/adb-dev/Makefile before running other script)

     # standalone Makefile for adb
     # found on: http://android.serverbox.ch/?p=1217
     # this works with android-5.1.1_r1
    
     SRCS+= adb.c
     SRCS+= fdevent.c
     SRCS+= adb_client.c
     SRCS+= commandline.c
     SRCS+= console.c
     SRCS+= file_sync_client.c
     SRCS+= get_my_path_linux.c
     SRCS+= services.c
     SRCS+= sockets.c
     SRCS+= transport.c
     SRCS+= transport_local.c
     SRCS+= transport_usb.c
     SRCS+= usb_linux.c
     SRCS+= usb_vendors.c
     SRCS+= adb_auth_host.c
    
     VPATH+= ../libcutils
     SRCS+= socket_inaddr_any_server.c
     SRCS+= socket_local_client.c
     SRCS+= socket_local_server.c
     SRCS+= socket_loopback_client.c
     SRCS+= socket_loopback_server.c
     SRCS+= socket_network_client.c
     SRCS+= load_file.c
    
     VPATH+= ../libzipfile
     SRCS+= centraldir.c
     SRCS+= zipfile.c
    
     VPATH+= ../../../external/zlib/src
     SRCS+= adler32.c
     SRCS+= compress.c
     SRCS+= crc32.c
     SRCS+= deflate.c
     SRCS+= infback.c
     SRCS+= inffast.c
     SRCS+= inflate.c
     SRCS+= inftrees.c
     SRCS+= trees.c
     SRCS+= uncompr.c
     SRCS+= zutil.c
    
     CPPFLAGS+= -DADB_HOST=1
     CPPFLAGS+= -DHAVE_FORKEXEC=1
     CPPFLAGS+= -DHAVE_SYMLINKS
     CPPFLAGS+= -DHAVE_TERMIO_H
     CPPFLAGS+= -DHAVE_SYS_SOCKET_H
     CPPFLAGS+= -D_GNU_SOURCE
     CPPFLAGS+= -D_XOPEN_SOURCE
     CPPFLAGS+= -I.
     CPPFLAGS+= -I../include
     CPPFLAGS+= -I../../../external/zlib
     CPPFLAGS+= -I../../../external/openssl/include
    
     # so well, let's fake HAVE_OFF64_T, because Raspbian does not.
     # just stay away from files larger than 2GB, ok?
     CFLAGS+= -O2 -g -Wno-unused-parameter -DHAVE_OFF64_T
    
     LIBS= -lcrypto -lpthread -lrt
    
     # old cross-compiler stuff 
     #TOOLCHAIN= /opt/poky/1.5/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-
     #CC= $(TOOLCHAIN)gcc
     #LD= $(TOOLCHAIN)gcc
    
     TOOLCHAIN= /usr/bin/
     CC= $(TOOLCHAIN)gcc
     LD= $(TOOLCHAIN)gcc
    
     OBJS= $(SRCS:.c=.o)
    
     all: adb
    
     adb: $(OBJS)
         $(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
    
     clean:
         rm -rf $(OBJS)
    
typo
Source Link
Eugen
  • 488
  • 3
  • 12

SpSo lets compile adb on the Raspberry Pi itself - without any cross-compiling madness. It was actually easier than you'd think. All you should need is git and gcc (and the package libssl-dev, which is installed by the bash script).

Sp lets compile adb on the Raspberry Pi itself - without any cross-compiling madness. It was actually easier than you'd think. All you should need is git and gcc (and the package libssl-dev, which is installed by the bash script).

So lets compile adb on the Raspberry Pi itself - without any cross-compiling madness. It was actually easier than you'd think. All you should need is git and gcc (and the package libssl-dev, which is installed by the bash script).

example of how i use the adb binary, requirements for the build, a bit more text here and there
Source Link
Eugen
  • 488
  • 3
  • 12
Loading
added 433 characters in body
Source Link
Eugen
  • 488
  • 3
  • 12
Loading
Source Link
Eugen
  • 488
  • 3
  • 12
Loading