FORUMS
Remove All Ads from XDA
Honor 7x
Win an Honor 7X!

Adb for Raspberry pi

5,226 posts
Thanks Meter: 9,880
 
Post Reply Email Thread
24th September 2014, 02:27 AM |#71  
Quote:
Originally Posted by jogco

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. 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

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 .

Thanks
trevd

Welcome to XDA BTW! - If only more folks Post #1 were like this.
The Following 3 Users Say Thank You to trevd For This Useful Post: [ View ] Gift trevd Ad-Free
 
 
24th September 2014, 09:32 AM |#72  
Junior Member
Thanks Meter: 1
 
More
Thanks!

This is a gem! Now I don't have to worry about what was going to be my next step - it 's already there.
21st October 2014, 01:53 AM |#73  
Senior Member
Thanks Meter: 6
 
More
Monkeyrunner too?
I was just curious since I know ADB can do monkeyrunner has anyone tired getting the raspberry pi to run a monkeyrunner script too? Maybe even with multiple devices?


Side Question: For multiple device do they need to be the same device, ie screen size? How do you tackle different screen sizes?
2nd November 2014, 04:53 PM |#74  
Junior Member
Thanks Meter: 5
 
More
Quote:
Originally Posted by jogco

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.
...
I have used these sources, to which I attribute my success
http://forum.xda-developers.com/show....php?t=2047891
https://source.android.com/source/building.html
http://stackoverflow.com/questions/5...-arm-processor
http://lackingrhoticity.blogspot.se/...-debugger.html

Thank you!
Worked for me on Raspbian, i just had to change one line:
Code:
LIBS= -lrt -lpthread -lssl
to
Code:
LIBS= -lrt -lpthread -lcrypto -lssl

Quote:
Originally Posted by trevd


...
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
...
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 .

This script did not work for me on Raspbian (ARM), but i do not have the exact errors on this computer
7th November 2014, 10:42 PM |#75  
Junior Member
Thanks Meter: 0
 
More
Hi all of you. I am sorry for this question but can anybody tell me in simple easy steps that how i can download adb on raspberry . Thank you
in advance.
14th November 2014, 10:41 PM |#76  
Senior Member
Thanks Meter: 6
 
More
Quote:
Originally Posted by tm05504n

Hi all of you. I am sorry for this question but can anybody tell me in simple easy steps that how i can download adb on raspberry . Thank you
in advance.

I have been looking for this answer too. I haven't been able to find an answer yet either. I've tried some of the terminal commands but nothing seems to be working right now. Have you had better luck?
15th November 2014, 03:08 PM |#77  
Senior Member
Thanks Meter: 9
 
More
Quote:
Originally Posted by Icon000

I have been looking for this answer too. I haven't been able to find an answer yet either. I've tried some of the terminal commands but nothing seems to be working right now. Have you had better luck?

Download binary of adb for pi, give '+x ' permission to that file .
Now use it.
e.g > ./adb --help
> ./adb shell
> ./adb devices


Sent from my GT-S5360 using XDA Free mobile app
25th November 2014, 07:54 PM |#78  
Senior Member
Thanks Meter: 6
 
More
When you say download the binary you are talking about the adbarmv6.7z file correct?
I have been able to get that on to the pi but then I don't what to do with it. Am I giving the file '+x', which I assume means write permission via the terminal or can I use the gui? As far as the use it part I'm assume the lack of file directory means that I should use cd to get to the location of adbarmv6.7z? I know .7z is compressed file. Do I need to decompress it or anything?

Sorry for the late replay, work and life, and thanks for the help. After this wave of question I feel like I should be able to get this up and running on my own.


Quote:
Originally Posted by jonny789

Download binary of adb for pi, give '+x ' permission to that file .
Now use it.
e.g > ./adb --help
> ./adb shell
> ./adb devices


Sent from my GT-S5360 using XDA Free mobile app

11th March 2015, 02:58 AM |#79  
Member
Thanks Meter: 1
 
More
Can someone please give me a step-by-step that 'nix n00b could follow on how to get the latest ADB working on the Pi?

The "adbarmv6.7z" version appears to be old, and just tells me that the device is offline.
9th April 2015, 06:18 PM |#80  
Junior Member
Thanks Meter: 0
 
More
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.
11th April 2015, 08:20 PM |#81  
Junior Member
Thanks Meter: 1
 
More
Quote:
Originally Posted by A1AV8R

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.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes