FORUMS
Remove All Ads from XDA

Adb for Raspberry pi

5,225 posts
Thanks Meter: 9,876
 
Post Reply Email Thread
9th October 2012, 03:26 PM |#31  
Junior Member
Thanks Meter: 0
 
More
Little help
From what I can gather you've got an older version of ADB that is working correctly on the RasPi but you are trying to compile a newer version.

I have thus far been unable to make any version of it work on my raspberry pi.

Is there any chance that you could post a link to the older (working) adb binary that runs on Raspberry pi?

Also (sorry, still a bit of a noob in this space) once I've got a binary what would I need to do to make it run? I've tried 3 different ones that I've found linked in threads on this topic(including the one that trevd posted at the top of page 3) and have had no success yet.

I've been pasting them in /usr/local/bin/ I also added a 99-android.rules file to /etc/udev/rules.d/ Once I do those if I try to run an adb command I get either "Segmentation Fault" or "Illegal Instruction". The latter is what I get from the binary that trevd posted.

Is there something else I need to do to get this set up? I am not looking to do anything fancy yet, just want to be able to get an adb command to execute properly on the Raspberry Pi.
 
 
9th October 2012, 05:38 PM |#32  
I'm at work so I SFTP'd into my raspi to grab this file. It should be the old one which is not what I am after. This is 1.0.26 and I need 1.0.28 or higher. http://d-h.st/myfiles
9th October 2012, 06:43 PM |#33  
Junior Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by AdamOutler

I'm at work so I SFTP'd into my raspi to grab this file. It should be the old one which is not what I am after. This is 1.0.26

The link takes me to dev-host home page.
9th October 2012, 07:40 PM |#35  
Junior Member
Thanks Meter: 0
 
More
No worries, Thank you for posting
9th October 2012, 08:46 PM |#38  
Quote:
Originally Posted by AdamOutler

https://plus.google.com/104711040110...ts/JHX9sNCDyrn

I will post the binary later.

Thanks TrevD!

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

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.
Attached Files
File Type: 7z adbarmv6.7z - [Click for QR Code] (1.32 MB, 19583 views)
The Following 5 Users Say Thank You to trevd For This Useful Post: [ View ] Gift trevd Ad-Free
10th October 2012, 06:04 PM |#39  
Junior Member
Thanks Meter: 0
 
More
Thanks for posting that binary.

aside from running as root is there anything else that would need to be done to get that running on the Raspberry pi? Is it built for a specific raspberry pi image? should it work with the first one from the pi quickstart page?

Whenever I try to run any adb commands the only output I get is "Segmentation Fault"
10th October 2012, 06:48 PM |#40  
It should work for raspian. You have something wrong with your system. I think you need libusb and that's about it.

However, this binary is incomplete. It should not need sudo to run and even with sudo it's reporting ??????? for certain devices and refusing to do anything. But, this problem will not cause a segmentation fault. Try the default raspian.
10th October 2012, 08:05 PM |#41  
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 )

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 

# 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

# 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
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_STATIC_LIBRARIES := libzipfile libunz libcutils, libc

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.
The Following 6 Users Say Thank You to trevd For This Useful Post: [ View ] Gift trevd Ad-Free
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