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
lunch mini_armv6-userdebug && make -j4
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
# 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.