Adb for Raspberry pi

Search This thread

trevd

Inactive Recognized Developer
Jul 19, 2011
895
1,271
Hull
Samsung Galaxy Tab 4
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.
 
Last edited:

Foamyguy

Member
Nov 29, 2010
6
0
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
 

Foamyguy

Member
Nov 29, 2010
6
0
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 :D
 

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,826
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
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 :D

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.
 

TheLastSidekick

Recognized Contributor
Aug 4, 2012
3,782
2,536
Man the Raspberry Pi has some serious fighting ground now! Nice work!

Sent from my SAMSUNG-SGH-T989 using xda app-developers app
 

trevd

Inactive Recognized Developer
Jul 19, 2011
895
1,271
Hull
Samsung Galaxy Tab 4
Seems like my work is begining to proceed me :) I wasn't expect to see this on my weekly browse through hack-a-day :laugh:

Right I've had my quarter-hour of EFame, I'm off back into my android platform hole until my Pi arrives :D
 
Last edited:

Kuya Marc

New member
Oct 25, 2012
1
0
Pasig City
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!
 

cmoatoto

Member
Jun 20, 2012
8
7
Use Raspberry Pi to build Android Project (AOSP)

Hi all !

My current project is to use my Raspberry Pi as a Build Machine to build all Android sources (AOSP). In fact, I'll not build AOSP but the CyanogenMod (wich is mainly a fork from AOSP).

I know this may sound crazy, dumb or useless (according to Google, a 64-bit environment is required, and a lot (>> 4GB) of RAM if you're in a hurry), especially to use an ARM processor to build while all the Makefiles has been written to be used on x86...

But what I'm thinking about is a really cheap, silent, but working build machine, to sync the repo and build nightlies everyday. The first build will take some days but then, only the changes will be build so I think that only some hours per day will be required.

If I success, I'll create a big tutorial to explain what changes was required.

First of all, I had to add the Linux-armv61 arch as Host OS/ARCH :

Code:
pi@raspberrypi ~/buildspace/android/system/build $ git diff
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 862b7f0..34eb31a 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -77,6 +77,10 @@ ifneq (,$(findstring Power,$(UNAME)))
        HOST_ARCH := ppc
 endif

[COLOR="SeaGreen"]+ifneq (,$(findstring arm,$(UNAME)))
+        HOST_ARCH := armv61
+endif
+[/COLOR]
 BUILD_ARCH := $(HOST_ARCH)

 ifeq ($(HOST_ARCH),)

then, I did this (because the raspbian ld doesn't support --icf) :
so I did a
Code:
pi@raspberrypi ~/adb $ grep -r 'icf=safe' ./*
./build/core/combo/TARGET_linux-arm.mk:			-Wl,--icf=safe \
and I removed that icf parameter.
-->
Code:
pi@raspberrypi ~/buildspace/android/system/build $ git diff
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index b36111f..24e0d99 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -146,7 +146,6 @@ TARGET_GLOBAL_LDFLAGS += \
                        -Wl,-z,relro \
                        -Wl,-z,now \
                        -Wl,--warn-shared-textrel \
[COLOR="Red"]-                       -Wl,--icf=safe \[/COLOR]
                        $(arch_variant_ldflags)

 # We only need thumb interworking in cases where thumb support

but now I am stuck with this error :
Code:
make -C kernel/samsung/smdk4210 O=/media/totoext4part/cyanogenmod/system/out/target/product/n7000/obj/KERNEL_OBJ ARCH=arm CROSS_COMPILE=" /media/totoext4part/cyanogenmod/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-" headers_install
make[1]: Entering directory `/media/totoext4part/cyanogenmod/system/kernel/samsung/smdk4210'
/media/totoext4part/cyanogenmod/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: 1: /media/totoext4part/cyanogenmod/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: Syntax error: "(" unexpected
  CHK     include/linux/version.h
make[1]: Leaving directory `/media/totoext4part/cyanogenmod/system/kernel/samsung/smdk4210'
/bin/bash: r: command not found
make: [/media/totoext4part/cyanogenmod/system/out/target/product/n7000/obj/lib/crtbegin_static.o] Error 127 (ignored)
[COLOR="SeaGreen"]target SharedLib[/COLOR]: libdl (/media/totoext4part/cyanogenmod/system/out/target/product/n7000/obj/SHARED_LIBRARIES/libdl_intermediates/LINKED/libdl.so)
/usr/bin/ld: error: /media/totoext4part/cyanogenmod/system/out/target/product/n7000/obj/SHARED_LIBRARIES/libdl_intermediates/LINKED/libdl.so uses VFP register arguments, /media/totoext4part/cyanogenmod/system/out/target/product/n7000/obj/SHARED_LIBRARIES/libdl_intermediates/libdl.o does not
/usr/bin/ld: failed to merge target specific data of file /media/totoext4part/cyanogenmod/system/out/target/product/n7000/obj/SHARED_LIBRARIES/libdl_intermediates/libdl.o
/usr/bin/ld: warning: creating a DT_TEXTREL in a shared object.
collect2: ld returned 1 exit status
make: *** [/media/totoext4part/cyanogenmod/system/out/target/product/n7000/obj/SHARED_LIBRARIES/libdl_intermediates/LINKED/libdl.so] Error 1

I don't really know what I have to do and if it is because the HOST is an arm arch...

It have been a long time since I didn't put my hands in this kind of things and I need help to solve this problems... Thanks in advance !
 
  • Like
Reactions: rzoelcher

cdesai

Inactive Recognized Developer
Jan 16, 2011
2,296
4,088
IN YOUR HEAD
Building the full Android source code on a raspberry pi isn't a good idea.

Anyways, remove the slash from the end of the line above the line you modified in TARGET_linux-arm.mk
 

cmoatoto

Member
Jun 20, 2012
8
7
Building the full Android source code on a raspberry pi isn't a good idea.

Anyways, remove the slash from the end of the line above the line you modified in TARGET_linux-arm.mk

I know it's not the best idea but it's quite a challenge...

Why removing the "\" ? If I do so, TARGET_GLOBAL_LDFLAGS will not add $(arch_variant_ldflags) and there is no reason for that.

Can you explain? Thanks for your help !

BTW, the dedicated thread is now http://xdaforums.com/showthread.php?t=2125278
 

5959823882589924

New member
Feb 17, 2013
2
0
HI all,

I have been using the binary provided by AdamOutler on my pi for a while now with out a problem, though today I updated my nexus 4 to 4.2.2 and now I am not able to adb into my device.

I think that this is not working due to the USB Debug Whitelist now implemented in 4.2.2. Does anyone know away to get this to work as I am not receiving a pop up on my device asking me if i wish to add the pi to a white list ?

Thanks
 

io53

Senior Member
Oct 25, 2010
772
254
HI all,

I have been using the binary provided by AdamOutler on my pi for a while now with out a problem, though today I updated my nexus 4 to 4.2.2 and now I am not able to adb into my device.

I think that this is not working due to the USB Debug Whitelist now implemented in 4.2.2. Does anyone know away to get this to work as I am not receiving a pop up on my device asking me if i wish to add the pi to a white list ?

Thanks

You need a newer version of adb.


Sent from my iPad using Tapatalk HD
 

trevd

Inactive Recognized Developer
Jul 19, 2011
895
1,271
Hull
Samsung Galaxy Tab 4
HI all,

I have been using the binary provided by AdamOutler on my pi for a while now with out a problem, though today I updated my nexus 4 to 4.2.2 and now I am not able to adb into my device.

I think that this is not working due to the USB Debug Whitelist now implemented in 4.2.2. Does anyone know away to get this to work as I am not receiving a pop up on my device asking me if i wish to add the pi to a white list ?

Thanks

You want this one for the PI [ http://xdaforums.com/showthread.php?t=2047891 ] version 1.0.31 , it "should" work with 4.2.2 as the USB whitelisting was added to adb months ago. If it doesn't work let me know and I'll build a fresh one :D

Thanks
 

08BajaBoy

Senior Member
Aug 23, 2012
53
16
Downey
I know this thread is really old and there is probably a tutorial out there. But, I feel like I am close to completing this on my own. I have ZERO linux experience. I am running the latest Raspbian version. I am stuck at "make install". I think I have properly downloaded the zip and extracted. Since a Makefile was supplied I skipped the "$ ./configure" step and went straight to "$ make". It popped up a few errors, missing bison and libncurses5-dev. Installed those and ran "$ make" again and got "Install: /out/host/linux-armv6l/bin" Then I tried "$ make install" again and received an output of "make: *** No rule to make target 'install'. Stop."

What am I missing? I tried changing directories to /home/pi/mypart/out/host/linux-armv6l/bin. I tried running the "make install" as root. Looking for a little direction. Thanks in advance.
 

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: