FORUMS
Remove All Ads from XDA

Adb for Raspberry pi

5,225 posts
Thanks Meter: 9,876
 
Post Reply Email Thread
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
 
 
10th October 2012, 10:35 PM |#42  
Junior Member
Thanks Meter: 0
 
More
Smile
Ok, turns out the adb binaries were not getting copied to my raspberry pi correctly. They were showing up with 3 less bytes than they should've

I was using python pyftpdlib server running on the raspberry pi and FileZilla client running on my PC to transfer the files.
In FileZilla Transfer->Transfer Type was set to auto. I changed it to binary and uploaded the adb binary again. This time it had all of its bytes, and it works properly.

Thanks again for the binaries
11th October 2012, 05:44 AM |#43  
I've updated post #38 with a proper build of adb for the PI which runs with out root and seems to be working correctly
The Following User Says Thank You to trevd For This Useful Post: [ View ] Gift trevd Ad-Free
12th October 2012, 04:47 PM |#45  
Junior Member
Thanks Meter: 0
 
More
Quote:

I've updated post #38 with a proper build of adb for the PI which runs with out root and seems to be working correctly

Awesome work, thanks a ton.

I still have to run
Code:
adb start-server
as root otherwise I get "??????????????????" in the list when I run
Code:
adb devices
Works like a charm for everything I need though
12th October 2012, 07:30 PM |#46  
Quote:
Originally Posted by Foamyguy

Awesome work, thanks a ton.

I still have to run

Code:
adb start-server
as root otherwise I get "??????????????????" in the list when I run
Code:
adb devices
Works like a charm for everything I need though

That's normal. When your device does not have a udev rule then your system assigns it non-readable permissions to the standard user. You need to configure the system for the device or run as root.
12th October 2012, 09:00 PM |#47  
bhundven's Avatar
Recognized Developer
Flag Seattle, WA
Thanks Meter: 4,535
 
Donate to Me
More
Good job trevd!

Sent from my SAMSUNG-SGH-I717 using Tapatalk 2
The Following User Says Thank You to bhundven For This Useful Post: [ View ]
17th October 2012, 04:20 AM |#48  
lseidman's Avatar
Senior Member
Flag Las Vegas
Thanks Meter: 104
 
Donate to Me
More
Looks good!
18th October 2012, 03:10 AM |#49  
TheLastSidekick's Avatar
Recognized Contributor
Flag Springfield, Massachusetts
Thanks Meter: 2,461
 
Donate to Me
More
Man the Raspberry Pi has some serious fighting ground now! Nice work!

Sent from my SAMSUNG-SGH-T989 using xda app-developers app
25th October 2012, 11:36 PM |#50  
Seems like my work is begining to proceed me I wasn't expect to see this on my weekly browse through hack-a-day

Right I've had my quarter-hour of EFame, I'm off back into my android platform hole until my Pi arrives
26th October 2012, 12:54 AM |#51  
Kuya Marc's Avatar
Junior Member
Flag Pasig City
Thanks Meter: 0
 
Donate to Me
More
Good Morning from The Philippines!

Hello everyone in this forum. Though I'm just a NOOB in this forum, I typically patronize only my blog. This specific XDA Developers Forum, however, strikes one of my projected interests. I received my Raspberry Pi (Model B, 512MB) on Wednesday, and one of my upcoming projects is to have it be the Controller of my Android Fleet.

Android Debug Bridge (ADB) is what I will be needing, but no schedule until November. The actual project is... Running DDMS for 3-10 Android Devices at the same time (average 3 Androids at once), all using ADBwireless. The secondary project is, downloading Google Play updates on one Android and the Raspberry Pi to disburse updates to my Android Fleet.

Though I'm a veteran C/C++ programmer, I'm still too lazy in learning JAVA for Android development, as I've been involved with Linux for 15+ years. (If I had my wish, all of my Android devices would be converted to embedded Linux devices, but I'm still new to the ARM platform.)

As for ADB on Raspberry Pi... What difficulties, if any, should I expect? I've downloaded the compiled ADB files from this forum thread, but not sure when I'm going to 'test' out.

For those that don't know me, I rarely ask for technical support. Traditionally, if I ask for technical support, then something terrible has gone wrong (like a 5-alarm fire, etc.).

Have a nice day, everybody!
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