Adb for Raspberry pi

Search This thread

yashrs

New member
Jan 6, 2015
4
1
I'm having the same issues. The old binary tells me all my devices are offline. I have tried the various compilation methods and none of them succeed. I'm not good enough with makefiles and building from source to work out the errors.

Same here bro. It would be great if someone in this community could compile the latest adb version for all. :)
 

shusain93

Member
Jan 25, 2013
26
3
I think I've found an issue.

So my current setup has three android devices hooked up to a Pi which executes ADB automation for hours on end. However, multiple times a day the Pi randomly freezes up and all the lights on the board go out except the power LED. I would suspect that it was the board having issues, EXCEPT I found that if I unplug a certain device it reboots automatically. I've tried looking in the system and kernel logs and there's nothing interesting up to the crash. I can not for the life of me figure out what's causing this. Right now I'm just running a programmable outlet that reboots it every hour which is stupid that I need to do it.
 

Icon000

Senior Member
Aug 29, 2012
156
6
I've tried downloading the jdk directly to the raspberry pi but I don't know if it is downloading it in the correct place in for monkeyrunner to find it. Any suggestions?
 

1619415

Senior Member
Mar 16, 2014
2,029
1,276
23
I am currently TRYING to make a full dev computer with the following:

Pi 2 (B+)
Monitor
Keyboard + Mouse
Ubuntu Mate 15.04
A .sh script (to install all of the files needed for this too work, Java and a few programs that Google recommend)
Some files I found here on XDA

My goal is to have a cheap computer that you can package ROMs, Modify build.prop & installer scripts, use the latest ADB and Fastboot (10.0.32). If you would like to help, please send me a message on hangouts (chrislevine24@gmail.com). I'm currently still testing but REALLY need help making this proccess as SIMPLE as possible rather then having to do a TON of stuff

-1619415
 

Mikaël Restoux

New member
Feb 17, 2016
1
0
In case someone needs it, here is a build of adb 5.1.1 on ARMv7 (RPi 2B) : https://github.com/DeepSilence/adb-arm
I have not really tested it, the 'reverse' function is the only one I need..
 

Megadave123

Member
Feb 10, 2012
37
3
I couldnt find any clean info so i finally compiled one for arm6 (rpi1) available here https://dl.dropboxusercontent.com/u/736461/adb
Enjoy :)
<s>Any chance you have (or can build) adb 1.0.32 for rPi? (The new one that supports the "reverse" command)

I've been trying to cross-compile one but getting nothing but headaches and brick walls.</s>

Actually, cancel that. I just found a newer post here that links to one.
 
Last edited:

josby

Member
Oct 21, 2006
11
2
Richmond, VA
Anyone have thoughts on compiling adb from the 6.0 branch of android? That is, there seems to be an adb 1.0.32 from the 5.1 branch but also a 1.0.32 from the 6.0 branch. The only visual difference seems to be that when you run "adb version", the 5.1 just gives "Android Debug Bridge version 1.0.32" but the 6.0 one gives "Android Debug Bridge version 1.0.32 / Revision d15680a64678-android"

I ask because I have Windows binaries of both and my phone (Blackberry Priv) is only recognized by the one from the 6.0 branch. So I can't use my phone with my Pi because the only adb binaries I can find for Pi are from the 5.1 branch.

I even found a download/build script at https://github.com/bonnyfone/adb-arm and was able to build adb myself from the latest 5.1.1 r36 but it still doesn't see my Priv.

I hoped I could just adapt that build script to do the 6.0 branch, but it looks like they switched from C to C++ so it's totally different and I'm way over my head on figuring out how to create my own make files for this. Any help would be appreciated
 
Mar 23, 2016
22
1
Seabrook
Hello All, I'm sort of a Noob :) , I have Andorid 4.4.2 KitKat loaded onto my Raspberry pi Model B, I think soon I'm going to get the Pi 3 since the GPU drivers are working to some deggree, Anyway, I want to be able to connect an android accessory to the raspberry Pis USB port so the pi can debug the USB and I can use the proprietary APP with the hardware accessory. normally USB debugging option within android has to be enabled under developer options for the accessory to get recognized / added the the white list? https://drive.google.com/open?id=0B2pMsf1J3UOzOGNVXzQ1UmZjNmc Thanks Hope this helps you help

Clancey Aggen
 

Top Liked Posts

  • There are no posts matching your filters.
  • 20
    Update: trevd has managed to make a proper adb 1.0.29 frm source. For those who wish to simply use the binary, you can download it here http://xdaforums.com/attachment.php?attachmentid=1392336&d=1349930509


    From trevd:
    If anyone wants to hack on this I've setup an armv6 device tree on github to use the with AOSP source you can clone it to <aosp_sources>/device/generic/armv6 then do
    Code:
    lunch mini_armv6-userdebug && make -j4
    ......
    more here http://xdaforums.com/showpost.php?p=32632468&postcount=41






    --- OLD ----
    I'm trying to build ADB 1.0.28 or higher for the Raspberry Pi. I found a guide here: http://lackingrhoticity.blogspot.com/2010/02/how-to-build-adb-android-debugger.html but it's out of date since we can no longer access kernel.org directly. So, I'm trying to find a new way.

    I spoke to Entropy512 and he suggested using the Cyanogenmod repository. So, here's what I have so far.

    Code:
    sudo apt-get install build-essential libncurses5-dev openjdk-7-jre openjdk-7-jdk bison
    mkdir adb
    cd adb
    git clone git://github.com/CyanogenMod/android_system_core.git system/core
    git clone git://github.com/CyanogenMod/android_build.git build
    git clone git://github.com/CyanogenMod/android_external_zlib.git external/zlib
    git clone git://github.com/CyanogenMod/android_bionic.git bionic
    echo "include build/core/main.mk" >Makefile


    I edited the adb/build/core/main.mk to reflect the version of JDK and JRE I have on my system. I'm not sure if they are even required at this point... Anyway, I modified the grep statements to find OpenJDK IcedTea instead of Oracle's version. Here's some snippits from the build/core/main.mk file.. make these match the values for your system's "java -version" and "javac -version"

    build/core/main.mk
    Code:
    .
    .
    .
    # Check for the correct version of java
    java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.7[\. "$$]')
    #Removed the next 3 lines
    
    
    .
    
    # Check for the correct version of javac
    javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.7[\. "$$]')

    So this puts me here:
    Code:
    pi@raspberrypi ~/adb $ make out/host/linux-x86/bin/adb
    ^[[A^[[B============================================
    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=4.0.4
    TARGET_PRODUCT=full
    TARGET_BUILD_VARIANT=eng
    TARGET_BUILD_TYPE=release
    TARGET_BUILD_APPS=
    TARGET_ARCH=arm
    TARGET_ARCH_VARIANT=armv7-a
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_BUILD_TYPE=release
    BUILD_ID=IMM76L
    ============================================
    build/core/tasks/kernel.mk:68: **********************************************************
    build/core/tasks/kernel.mk:69: * Kernel source found, but no configuration was defined  *
    build/core/tasks/kernel.mk:70: * Please add the TARGET_KERNEL_CONFIG variable to your   *
    build/core/tasks/kernel.mk:71: * BoardConfig.mk file                                    *
    build/core/tasks/kernel.mk:72: **********************************************************
    host C: adb <= system/core/adb/adb.c
    cc1: error: unrecognized command line option ‘-m32’
    make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb.o] Error 1
    pi@raspberrypi ~/adb $

    I'm still working on the rest. help would be appreciated. I can't get it to build on my desktop either. I really need help with this.
    6
    Hi Folks

    If anyone wants to hack on this I've setup an armv6 device tree on github to use the with AOSP source you can clone it to <aosp_sources>/device/generic/armv6 then do
    Code:
    lunch mini_armv6-userdebug && make -j4

    It's currently setup to compile to armv5te as adding true armv6 support require modification of build/core/combo/TARGET_linux-arm.mk
    It also sets BUILD_TINY_ANDROID := true automatically to only build do a minimal build, what you will end up with is Android image that is bootable on the PI, it will only start /sbin/adbd. ( see below ) :D

    Tiny android build time takes about 1 minute on my AMD FX8120 with make -j16 set

    I've left what is describe below as a reference. Although It looked like it worked in the end It simply didn't do the job. I'm not fully sure of the reasons why but It's not something I'll be investigating further as It's not the correct way of doing making an adb for a host

    A modification has to be made to the the <aosp_sources>/system/core/adb/Android.mk in the aosp tree, this forces the device-as-host version to use port 5037 instead of 5038

    Code:
    # adb host tool for device-as-host
    # =========================================================
    ifneq ($(SDK_ONLY),true)
    include $(CLEAR_VARS)
    
    LOCAL_LDLIBS := -lrt -lncurses -lpthread
    
    LOCAL_SRC_FILES := \
    	adb.c \
    	console.c \
    	transport.c \
    	transport_local.c \
    	transport_usb.c \
    	commandline.c \
    	adb_client.c \
    	sockets.c \
    	services.c \
    	file_sync_client.c \
    	get_my_path_linux.c \
    	usb_linux.c \
    	utils.c \
    	usb_vendors.c \
    	fdevent.c
    
    LOCAL_CFLAGS := \
    	-g \
    	-DADB_HOST=1 \
    	-Wall \
    	-Wno-unused-parameter \
    	-D_XOPEN_SOURCE \
    	-D_GNU_SOURCE 
    
    [B]# LOCAL_CFLAGS += -DADB_HOST_ON_TARGET=1 
    # Removed Adb host on target to for the binary to use the host port 5037 instead of the target host port 5038[/B]
    
    # adb can't be built without optimizations, so we enforce -O2 if no
    # other optimization flag is set - but we don't override what the global
    # flags are saying if something else is given (-Os or -O3 are useful)
    ifeq ($(findstring -O, $(TARGET_GLOBAL_CFLAGS)),)
    LOCAL_CFLAGS += -O2
    endif
    ifneq ($(findstring -O0, $(TARGET_GLOBAL_CFLAGS)),)
    LOCAL_CFLAGS += -O2
    endif
    
    LOCAL_MODULE := adb
    [B]LOCAL_FORCE_STATIC_EXECUTABLE := true[/B]
    LOCAL_STATIC_LIBRARIES := libzipfile libunz libcutils, [B]libc[/B]
    
    include $(BUILD_EXECUTABLE)
    endif


    The highlights are in bold, It's statically linked against aosp libc ( bionic ). You may want to make sure you have ncurses installed on the PI using apt or something similar.
    which should make it alright on any distro but as Adam has already noted there are still issues. It really is bit of a dirty hack!

    The binary can be found at target/product/armv6/system/bin/adb in the directory you compile android too ( which is normally a directory call "out" in the android source tree )

    I am currently running this [ Linaro Tiny Android Script ] on my Pi Emulator, I see how long it take, From what I gather it only grabs a subset of the sources and it should build a real adb host version using the toolchain on the pi.
    6
    Hi Adam.


    I've built you a adb, version 1.0.29 which is based off the linaro Jellybean 4.1.1 JRO03R sources, It is a totally self contained statically linked binary which has a target arch of armv5te, which should be just fine. I don't have a PI to test it on but I did the next best thing [ link: qemu-emulating-raspberry-pi-the-easy-way ] It seems to function OK but the proof will be in the testing. If it has trouble listing devices or making connection then run the following command line to give an idea of what's going wrong.
    Code:
    ADB_TRACE=all ./adb

    Hope That Helps!
    Trev
    5

    Not a problem! ( in the end ). It's all part of the android fun and a great little learning experience!

    I'm just setting up a git repo for armv6 now, Gotta get me some of that PI.

    EDIT: I attached the built binary and here's a hotfile link [adb-129-armv6-static.7z] of the same file for good measure.

    Now I can sleep easy :D

    EDIT2: Needs to be run as root at the moment, I'm confident I'll be able to remove this requirement with a little more investigation.

    EDIT3: After some hacking around with the android build system, I compiled a real adb host using the native toolchain on the pi, I've attached a zip which contain said binary aswell as the makefiles used.
    3
    Hi,

    After trolling all these "adb on RPi" threads on this and other forums, I thought I'd share what I found works for me (first post btw! ).

    It's really simple in fact: You can obtain a subset of the Android source tree and build only adb (and necessary libs), the subset is about 25 MB and builds in minutes on a RPi rev B.

    Before anyone ask why: trust me, I needed to have the latest stock (no changes) adb running on RPi. The other versions just didn't fit the bill.

    ....
    Now, just:

    Code:
    cd system/core/adb
    make adb

    That's it. The rest is testing.


    @jogco Nice one dude!

    AFAIK @AdamOutler does actively maintain an armv6 adb host in his Casual project.

    Regardless building from source whether necessary or not is something you should ever have to defend, especially not on XDA ain't the RPI Forums where I'm sure some folks would question you breathe if I wasn't endorsed by the Foundation. I do hope the whole thing wasn't to much of a Pain in the ass to figure out however because I'm gonna be that guy which shows you a much simpler way to do what you've just done. :eek: Personally I hate it when it happens to me, so sorry dude!

    So "no-oping" static_library.mk shared_library.mk and executable.mk in the build/core directory disables $(TARGET_BUILD_EXECUTABLE), TARGET_BUILD_SHARED_LIBRARY and TARGET_BUILD_SHARED_LIBRARY found in the various Android.mk fragments. which negates the need to create your own makefile as we just use the host side of the build system. It's also what I effectively did a few years back ( earlier in the thread ) .. but I was young, naive and eager to please... It was a bit hacky to say the least :eek:

    Anyway here's my 2014 version! - Well it's not adb specific although I did use it as an example ( #2 ) It "should" build any host binary as long as you give it all the dependencies


    Code:
    #!/bin/bash
    #
    # Namee : build-aosp-host-binaries 
    # Description : A Convient script to build android aosp host binaries
    #               without syncing the full platform sources
    #
    # Copyright (C) 2014 Trevor Drake
    #
    # This program is free software; you can redistribute it and/or
    # modify it under the terms of the GNU General Public License
    # as published by the Free Software Foundation; either version 2
    # of the License, or (at your option) any later version.
    # 
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    # 
    # You should have received a copy of the GNU General Public License
    # along with this program; if not, write to the Free Software
    # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    # 
    # Assumes you know what dependencies a specific modules has.
    # If you are missing some dependencies the build will fail
    # You can generally figure it out from the error out
    # http://androidxref.com is also an handy resource :)
    #
    #
    # usage : build-aosp-host-binaries <module> <branch> <source repositories>
    #
    # examples 
    # #1 Sqlite - sqlite3 has a dependency on liblog so need both the
    #             external/sqlite source repo as well as system/core for liblog
    #
    # ./build-aosp-host-binaries sqlite3 master external/sqlite system/core
    #
    # #2 adb - adb is located in the system/core repository and depends on 
    #	   libunz libcrytpo_static, which can be found in external/zlib 
    #          and external/openssl repectively
    #
    # ./build-aosp-host-binaries adb master external/openssl external/zlib system/core
    #
    # #3 mkbootfs - mkbootfs doesn't have any external dependencies.
    #               so we only need the source repository which is system/core
    #
    #
    # /build-aosp-host-binaries mkbootfs master system/core
    
    # use the first argument as the module name
    # e.g adb mkbootfs or whatever 
    LOCAL_MODULE=$1
    # Select a branch 
    LOCAL_BRANCH=$2
    # discard the first argument
    shift 2
    # Glob the rest of the arguments as local Dependencies
    # Also add build external/stlport and external/libcxx 
    # as they seem to be required by most projects
    LOCAL_DEPENDS="$* build external/stlport external/libcxx"
    
    # Make a temporary build directory
    TMPDIR=`mktemp -dt quick.XXXXXXXXXX`
    echo $TMPDIR
    
    # Shallow clone the repos  into the temp directory 
    # --depth 1 automatically set --single-branch on
    for gr in $LOCAL_DEPENDS; 
        do 
    	git clone --depth 1 --branch $LOCAL_BRANCH https://android.googlesource.com/platform/$gr $TMPDIR/$gr; 
        done 
    
    # A Cheap trick to disable any target builds which may exist for the modules Android.mk
    cat /dev/null > $TMPDIR/build/core/static_library.mk > $TMPDIR/build/core/shared_library.mk > $TMPDIR/build/core/executable.mk
    
    # Usual android build system envsetup nonsense
    # We don't need to do lunch as we are not building for a target
    . $TMPDIR/build/envsetup.sh
    
    
    # use the build systems m command as we don't have a top level Makefile
    time m -C$TMPDIR  -j16 $LOCAL_MODULE

    The script lives here https://github.com/trevd/building-android with some other android compiling fun. I've not tried it on an arm host ( it should work ) , So Let me know how you get on if you do use it. Obviously you got your own solution already... it's there anyway :silly:.

    Thanks
    trevd

    Welcome to XDA BTW! - If only more folks Post #1 were like this. :good: