Adb for Raspberry pi

Search This thread

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,809
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
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://forum.xda-developers.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://forum.xda-developers.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:
[email protected] ~/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
[email protected] ~/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.
 
Last edited:

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,809
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
I found a build of Android4.0 for the Raspberry pi. I know that Android ICS and higher come with adb installed on the device for use with USB Host Mode on the device. So I yanked a copy and installed to an sdcard. Then I pulled the binary from /system/bin/adb. however when run it acts like it's not there even though it is.

Code:
[email protected] ~ $ sudo chmod 777 /usr/bin/adb
[email protected] ~ $ /usr/bin/adb
bash: /usr/bin/adb: No such file or directory
[email protected] ~ $ file /usr/bin/adb
/usr/bin/adb: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
[email protected] ~ $ readelf -d /usr/bin/adb

Dynamic section at offset 0x1708c contains 24 entries:
  Tag        Type                         Name/Value
 0x00000003 (PLTGOT)                     0x1f198
 0x00000002 (PLTRELSZ)                   768 (bytes)
 0x00000017 (JMPREL)                     0x9048
 0x00000014 (PLTREL)                     REL
 0x00000011 (REL)                        0x9348
 0x00000012 (RELSZ)                      16 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000006 (SYMTAB)                     0x8488
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000005 (STRTAB)                     0x8bd8
 0x0000000a (STRSZ)                      1135 (bytes)
 0x00000004 (HASH)                       0x8128
 0x00000001 (NEEDED)                     Shared library: [libc.so]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so]
 0x00000001 (NEEDED)                     Shared library: [libm.so]
 0x00000020 (PREINIT_ARRAY)              0x1f000
 0x00000021 (PREINIT_ARRAYSZ)            0x8
 0x00000019 (INIT_ARRAY)                 0x1f008
 0x0000001b (INIT_ARRAYSZ)               8 (bytes)
 0x0000001a (FINI_ARRAY)                 0x1f010
 0x0000001c (FINI_ARRAYSZ)               8 (bytes)
 0x0000001e (FLAGS)                      
 0x00000000 (NULL)                       0x0

I can see there are shared libraries required (libc.so, libstdc++.so and libm.so) , so I added those to /usr/lib/ chmod'd 777 and still nothing changed. What is required for a non-statically compiled binary to run? Did I install those libs properly? Why is that file saying it's not found?

I usually deal with hardware and java. these system binaries are like greek to me.
 

bhundven

Inactive Recognized Developer
Aug 8, 2009
2,076
4,495
Seattle, WA
bhundven.github.io
I find dynamic dependencies this way (sgh-i717 rild for instance):
Code:
[email protected]:~/build/vendor/samsung/quincyatt/proprietary/bin$ ~/arm-2009q3/bin/arm-none-linux-gnueabi-objdump -x rild | grep NEEDED
  NEEDED               liblog.so
  NEEDED               libcutils.so
  NEEDED               libril.so
  NEEDED               libdl.so
  NEEDED               libc.so
  NEEDED               libstdc++.so
  NEEDED               libm.so

EDIT: I just re-read about you finding NEEDED. At that point you have to do the same thing to each of those libraries, and find out what they depend on.

EDIT2: Do you have prebuilt/ ?
 
Last edited:
  • Like
Reactions: AdamOutler

cdesai

Inactive Recognized Developer
Jan 16, 2011
2,296
4,088
IN YOUR HEAD
You can try compiling it statically, sync the AOSP master to get the latest code, then you'll have to edit system/core/*something*(probably adb)/Android.mk and tell it to link the target binary statically.

I'll link the exact file when on a pc.

Sent from my GT-P1000
 
  • Like
Reactions: AdamOutler

bhundven

Inactive Recognized Developer
Aug 8, 2009
2,076
4,495
Seattle, WA
bhundven.github.io
You can try compiling it statically, sync the AOSP master to get the latest code, then you'll have to edit system/core/*something*(probably adb)/Android.mk and tell it to link the target binary statically.

I'll link the exact file when on a pc.

Sent from my GT-P1000

Right:
Code:
LOCAL_FORCE_STATIC_EXECUTABLE := true

where host adb is defined in system/core/adb/Android.mk
 
  • Like
Reactions: AdamOutler

bhundven

Inactive Recognized Developer
Aug 8, 2009
2,076
4,495
Seattle, WA
bhundven.github.io
That would be great! How do you compile statically for arm? I put in about 12 hours trying to do this today.

It was my assumption from the original link you posted that this was being built on the r-pi.

Without the prebuilts being part of the environment, linux-x86 directory would be the host gcc. In this case on r-pi debian, arm gcc.

Edit: From the original build you had a problem with -m32 not being a valid argument.
You could comment out lines 48 and 49 of: build/core/combo/HOST_linux-x86.mk
and see what happens.

irc?
 
Last edited:
  • Like
Reactions: AdamOutler

trevd

Inactive Recognized Developer
Jul 19, 2011
895
1,269
Hull
I put in about 12 hours trying to do this today.

Seems like your fighting a losing battle there, for that length of time you might as well have sync'd the full lot and done a full build to begin with, It really is the path of least resistance when It comes to android. Otherwise you end up chasing shadows as you get deeper into the build system.

What are you trying to achieve with this? do you want to connect to other devices from the RaspPi or is the Rasp meant to be on the receiving end?
because obviously you'll need to build the daemonized version if the Rasp is your target, that lives in /sbin/adbd normally on the device.

I had a quick look at that guide. Googles sources now live at android.googlesource.com which can be used instead of the old kernel.org address
i.e
Code:
[B]git clone git://android.git.kernel.org/platform/system/core.git system/core[/B]

becomes

Code:
 [B]git clone https://android.googlesource.com/platform/system/core.git system/core[/B]
 
  • Like
Reactions: AdamOutler

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,809
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Seems like your fighting a losing battle there, for that length of time you might as well have sync'd the full lot and done a full build to begin with, It really is the path of least resistance when It comes to android. Otherwise you end up chasing shadows as you get deeper into the build system.

What are you trying to achieve with this? do you want to connect to other devices from the RaspPi or is the Rasp meant to be on the receiving end?
because obviously you'll need to build the daemonized version if the Rasp is your target, that lives in /sbin/adbd normally on the device.

I had a quick look at that guide. Googles sources now live at android.googlesource.com which can be used instead of the old kernel.org address
i.e
Code:
[B]git clone git://android.git.kernel.org/platform/system/core.git system/core[/B]

becomes

Code:
 [B]git clone https://android.googlesource.com/platform/system/core.git system/core[/B]
Are you sure that will compile on ARM host? I don't want to spend 24 hours downloading and compiling on a 700 MHz processor. The resulting adb binary must run on an arm linux host.
 
  • Like
Reactions: djkidy123

E:V:A

Inactive Recognized Developer
Dec 6, 2011
1,449
2,213
-∇ϕ
... Then I pulled the binary from /system/bin/adb. however when run it acts like it's not there even though it is.

Code:
[email protected] ~ $ /usr/bin/adb
bash: /usr/bin/adb: No such file or directory

Looks to me as you forgot to add your /usr/bin to your PATH variable (which also need to be exported to shell.)
Until you do that you need to use the source operator ".":
Code:
$ [B].[/B]/usr/bin/adb
 
  • Like
Reactions: AdamOutler

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,809
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Looks to me as you forgot to add your /usr/bin to your PATH variable (which also need to be exported to shell.)
Until you do that you need to use the source operator ".":
Code:
$ [B].[/B]/usr/bin/adb

good thinking.. but it didn't work.. cannot execute binary file.
Code:
[email protected] ~ $ export PATH=/usr/bin:$PATH
[email protected] ~ $ adb
bash: /usr/bin/adb: No such file or directory
[email protected] ~ $ /usr/bin/adb
bash: /usr/bin/adb: No such file or directory
[email protected] ~ $ . /usr/bin/adb
bash: .: /usr/bin/adb: cannot execute binary file
[email protected] ~ $

I have an older copy of ADB 1.0.26, but I need 1.0.28. What is the difference here aside from the shared objects which I've already put into /usr/lib.
Code:
[email protected] ~ $ file /usr/bin/adb #new version
/usr/bin/adb: setuid setgid ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
[email protected] ~ $ file /bin/adb  #old version
/bin/adb: setuid setgid ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.26, BuildID[sha1]=0x8ffd8c80a0705dc113149612e3067931208bfd70, not stripped
 
  • Like
Reactions: djkidy123

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,809
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
It was my assumption from the original link you posted that this was being built on the r-pi.

Without the prebuilts being part of the environment, linux-x86 directory would be the host gcc. In this case on r-pi debian, arm gcc.

Edit: From the original build you had a problem with -m32 not being a valid argument.
You could comment out lines 48 and 49 of: build/core/combo/HOST_linux-x86.mk
and see what happens.

irc?

I did this. I got most of the way through compiling.

Code:
[email protected] ~/adb $ make out/host/linux-x86/bin/adb
============================================
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
system/core/adb/adb.c: In function ‘connect_device’:
system/core/adb/adb.c:998:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
host C: adb <= system/core/adb/console.c
host C: adb <= system/core/adb/transport.c
host C: adb <= system/core/adb/transport_local.c
system/core/adb/transport_local.c: In function ‘local_init’:
system/core/adb/transport_local.c:321:8: warning: extra tokens at end of #endif directive [enabled by default]
host C: adb <= system/core/adb/transport_usb.c
host C: adb <= system/core/adb/commandline.c
host C: adb <= system/core/adb/adb_client.c
host C: adb <= system/core/adb/sockets.c
host C: adb <= system/core/adb/services.c
host C: adb <= system/core/adb/file_sync_client.c
host C: adb <= system/core/adb/get_my_path_linux.c
host C: adb <= system/core/adb/usb_linux.c
host C: adb <= system/core/adb/utils.c
host C: adb <= system/core/adb/usb_vendors.c
host C: adb <= system/core/adb/fdevent.c
host C: libzipfile <= system/core/libzipfile/centraldir.c
host C: libzipfile <= system/core/libzipfile/zipfile.c
host StaticLib: libzipfile (out/host/linux-x86/obj/STATIC_LIBRARIES/libzipfile_intermediates/libzipfile.a)
host C: libunz <= external/zlib/adler32.c
host C: libunz <= external/zlib/crc32.c
host C: libunz <= external/zlib/zutil.c
host C: libunz <= external/zlib/inflate.c
host C: libunz <= external/zlib/inftrees.c
host C: libunz <= external/zlib/inffast.c
host StaticLib: libunz (out/host/linux-x86/obj/STATIC_LIBRARIES/libunz_intermediates/libunz.a)
host C: liblog <= system/core/liblog/logd_write.c
system/core/liblog/logd_write.c: In function ‘__write_to_log_kernel’:
system/core/liblog/logd_write.c:90:9: warning: implicit declaration of function ‘fakeLogWritev’ [-Wimplicit-function-declaration]
system/core/liblog/logd_write.c: In function ‘__write_to_log_init’:
system/core/liblog/logd_write.c:103:9: warning: implicit declaration of function ‘fakeLogOpen’ [-Wimplicit-function-declaration]
system/core/liblog/logd_write.c:112:13: warning: implicit declaration of function ‘fakeLogClose’ [-Wimplicit-function-declaration]
host C: liblog <= system/core/liblog/logprint.c
host C: liblog <= system/core/liblog/event_tag_map.c
host C: liblog <= system/core/liblog/fake_log_device.c
host StaticLib: liblog (out/host/linux-x86/obj/STATIC_LIBRARIES/liblog_intermediates/liblog.a)
host C: libcutils <= system/core/libcutils/atomic.c
In file included from system/core/include/cutils/atomic-inline.h:47:0,
                 from system/core/libcutils/atomic.c:19:
system/core/include/cutils/atomic-arm.h:21:34: fatal error: machine/cpu-features.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/atomic.o] Error 1
[email protected] ~/adb $

Not sure what I need to do to fix system/core/libcutils/atomic.c Maybe I need to get the machine/ repo.
 
  • Like
Reactions: djkidy123

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,809
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
I was able to link some libraries around and ended up here..
Code:
[email protected] ~/adb $ make out/host/linux-x86/bin/adb
============================================
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: libcutils <= system/core/libcutils/atomic.c
host C: libcutils <= system/core/libcutils/array.c
host C: libcutils <= system/core/libcutils/hashmap.c
host C: libcutils <= system/core/libcutils/native_handle.c
host C: libcutils <= system/core/libcutils/buffer.c
host C: libcutils <= system/core/libcutils/socket_inaddr_any_server.c
host C: libcutils <= system/core/libcutils/socket_local_client.c
host C: libcutils <= system/core/libcutils/socket_local_server.c
host C: libcutils <= system/core/libcutils/socket_loopback_client.c
host C: libcutils <= system/core/libcutils/socket_loopback_server.c
host C: libcutils <= system/core/libcutils/socket_network_client.c
host C: libcutils <= system/core/libcutils/sockets.c
host C: libcutils <= system/core/libcutils/config_utils.c
host C: libcutils <= system/core/libcutils/cpu_info.c
host C: libcutils <= system/core/libcutils/load_file.c
host C: libcutils <= system/core/libcutils/list.c
host C: libcutils <= system/core/libcutils/open_memstream.c
host C: libcutils <= system/core/libcutils/strdup16to8.c
host C: libcutils <= system/core/libcutils/strdup8to16.c
host C: libcutils <= system/core/libcutils/record_stream.c
host C: libcutils <= system/core/libcutils/process_name.c
host C: libcutils <= system/core/libcutils/properties.c
host C: libcutils <= system/core/libcutils/threads.c
host C: libcutils <= system/core/libcutils/sched_policy.c
host C: libcutils <= system/core/libcutils/iosched_policy.c
host C: libcutils <= system/core/libcutils/str_parms.c
host C: libcutils <= system/core/libcutils/abort_socket.c
host C: libcutils <= system/core/libcutils/mspace.c
host C: libcutils <= system/core/libcutils/selector.c
host C: libcutils <= system/core/libcutils/tztime.c
system/core/libcutils/tztime.c: In function ‘differ_by_repeat’:
system/core/libcutils/tztime.c:303:2: warning: comparison is always false due to limited range of data type [-Wtype-limits]
system/core/libcutils/tztime.c: In function ‘localsub’:
system/core/libcutils/tztime.c:1267:24: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
host C: libcutils <= system/core/libcutils/zygote.c
host C: libcutils <= system/core/libcutils/ashmem-host.c
host C: libcutils <= system/core/libcutils/tzstrftime.c
system/core/libcutils/tzstrftime.c: In function ‘_fmt’:
system/core/libcutils/tzstrftime.c:360:7: warning: implicit declaration of function ‘sprintf’ [-Wimplicit-function-declaration]
system/core/libcutils/tzstrftime.c:360:14: warning: incompatible implicit declaration of built-in function ‘sprintf’ [enabled by default]
system/core/libcutils/tzstrftime.c: In function ‘_conv’:
system/core/libcutils/tzstrftime.c:628:9: warning: incompatible implicit declaration of built-in function ‘sprintf’ [enabled by default]
host C: libcutils <= system/core/libcutils/dlmalloc_stubs.c
host StaticLib: libcutils (out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a)
host Executable: adb (out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb)
true
host C: acp <= build/tools/acp/acp.c
host C++: libhost <= build/libs/host/pseudolocalize.cpp
host C: libhost <= build/libs/host/CopyFile.c
host StaticLib: libhost (out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a)
host Executable: acp (out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp)
true
Install: out/host/linux-x86/bin/acp
Notice file: system/core/adb/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//bin/adb.txt
Notice file: system/core/libzipfile/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libzipfile.a.txt
Notice file: system/core/liblog/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/liblog.a.txt
Notice file: system/core/libcutils/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libcutils.a.txt
target arm C: libc <= bionic/libc/bionic/pthread.c
target thumb C: libc <= bionic/libc/arch-arm/bionic/exidx_dynamic.c
target thumb C: libc <= bionic/libc/unistd/sysconf.c
target thumb C: libc <= bionic/libc/bionic/__errno.c
target thumb C: libc <= bionic/libc/bionic/dlmalloc.c
target thumb C: libc <= bionic/libc/bionic/malloc_debug_common.c
target thumb C: libc <= bionic/libc/bionic/libc_init_dynamic.c
target thumb C: libdl <= bionic/libdl/libdl.c
cc -mthumb-interwork -Ibionic/libc/private -DCRT_LEGACY_WORKAROUND -o out/target/product/generic/obj/lib/crtbegin_so.o -c bionic/libc/arch-arm/bionic/crtbegin_so.S
cc -mthumb-interwork -Ibionic/libc/private -DCRT_LEGACY_WORKAROUND -o out/target/product/generic/obj/lib/crtend_so.o -c bionic/libc/arch-arm/bionic/crtend_so.S
target SharedLib: libdl (out/target/product/generic/obj/SHARED_LIBRARIES/libdl_intermediates/LINKED/libdl.so)
/usr/bin/ld: unrecognized option '--icf=safe'
/usr/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libdl_intermediates/LINKED/libdl.so] Error 1
so I did a
Code:
[email protected] ~/adb $ grep -r 'icf=safe' ./*
./build/core/combo/TARGET_linux-arm.mk:			-Wl,--icf=safe \
and I removed that icf parameter.
 
Last edited:
  • Like
Reactions: djkidy123

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,809
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
ok, so i've been hacking around on this quite a bit... I don't know how to work through this final linking part. here's a pastebin...

http://pastebin.com/pb8F7raB


how do i fix undefined references? I've been hacking it up by linking files where they should be linkd. I don't know how to fix this. Like I said before... I don't work at this level usually. I work on Java, shell, and hardware. C and middle-ware is not my thing.
 
  • Like
Reactions: djkidy123

bhundven

Inactive Recognized Developer
Aug 8, 2009
2,076
4,495
Seattle, WA
bhundven.github.io
ok, so i've been hacking around on this quite a bit... I don't know how to work through this final linking part. here's a pastebin...

http://pastebin.com/pb8F7raB


how do i fix undefined references? I've been hacking it up by linking files where they should be linkd. I don't know how to fix this. Like I said before... I don't work at this level usually. I work on Java, shell, and hardware. C and middle-ware is not my thing.

Try adding:
Code:
--with-float=soft

to LOCAL_CFLAGS

EDIT: You might also need to add
Code:
-lgcc

to the LOCAL_LDFLAGS
 
Last edited:

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,809
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Try adding:
Code:
--with-float=soft

to LOCAL_CFLAGS

EDIT: You might also need to add
Code:
-lgcc

to the LOCAL_LDFLAGS

Thanks. I'm not sure where to add it though
Code:
[email protected] ~/adb $ grep -R  LOCAL_CFLAGS ./*
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags)
./bionic/libc/Android.mk:LOCAL_CFLAGS+= \
./bionic/libc/Android.mk:LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags) \
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags) \
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags)
./bionic/libc/Android.mk:LOCAL_CFLAGS := \
./bionic/libc/Android.mk:LOCAL_CFLAGS := \
./bionic/libc/Jamfile:        local LOCAL_CFLAGS LOCAL_DEFINES LOCAL_INCLUDES LOCAL_SRC NO_LOCAL_SRC ;
./bionic/libc/Jamfile:        CFLAGS   += $(LOCAL_CFLAGS) ;
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DVM_SPLIT_2G
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DPRELINK
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_TEXT_BASE=$(LINKER_TEXT_BASE)
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_AREA_SIZE=$(LINKER_AREA_SIZE)
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_DEBUG=0
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
./bionic/linker/Android.mk:LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/private
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DANDROID_ARM_LINKER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DANDROID_X86_LINKER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/arch-x86/bionic
./bionic/linker/Android.mk:      LOCAL_CFLAGS += -DANDROID_SH_LINKER
./bionic/linker/README.TXT:    LOCAL_CFLAGS += -DLINKER_DEBUG=0
./bionic/linker/README.TXT:    LOCAL_CFLAGS += -DLINKER_DEBUG=1
./bionic/libstdc++/Android.mk:LOCAL_CFLAGS := $(libstdc++_cflags)
./bionic/libstdc++/Android.mk:LOCAL_CFLAGS := $(libstdc++_cflags)
./build/tools/acp/Android.mk:LOCAL_CFLAGS += -DWIN32_EXE
./build/tools/acp/Android.mk:LOCAL_CFLAGS += -DMACOSX_RSRC
./build/tools/rgb2565/Android.mk:LOCAL_CFLAGS += -O2 -Wall -Wno-unused-parameter
./build/buildspec.mk.default:# will be added to LOCAL_CFLAGS when building the module.
./build/core/clear_vars.mk:LOCAL_CFLAGS:=
./build/core/build-system.html:LOCAL_CFLAGS += -DNDEBUG=1
./build/core/build-system.html:<h4>LOCAL_CFLAGS</h4>
./build/core/build-system.html:<p><code>LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1</code></p>
./build/core/build-system.html:<code>LOCAL_CPPFLAGS</code> is guaranteed to be after <code>LOCAL_CFLAGS</code>
./build/core/build-system.html:<code>LOCAL_CFLAGS</code>.
./build/core/build-system.html:<code>LOCAL_C_INCLUDES</code>, <code>LOCAL_CFLAGS</code>, and
./build/core/native_test.mk:LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING
./build/core/host_native_test.mk:LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g
./build/core/binary.mk:  LOCAL_CFLAGS += $(TARGET_FDO_CFLAGS)
./build/core/binary.mk:LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
./build/core/binary.mk:$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
./build/libs/host/Android.mk:LOCAL_CFLAGS += -DWIN32_EXE
./build/libs/host/Android.mk:LOCAL_CFLAGS += -DMACOSX_RSRC
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP $(zlib_arm_flags)
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP $(zlib_arm_flags)
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP
./system/core/libsysutils/Android.mk:LOCAL_CFLAGS := 
./system/core/charger/Android.mk:LOCAL_CFLAGS += -DBATTERY_DEVICE_NAME=\"$(BOARD_BATTERY_DEVICE_NAME)\"
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(hostSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
./system/core/libcutils/Android.mk:    LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND='$(TARGET_RECOVERY_PRE_COMMAND)'
./system/core/libcutils/Android.mk:    LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND_CLEAR_REASON
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(targetSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(targetSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += -DTEST_STR_PARMS
./system/core/libusbhost/Android.mk:LOCAL_CFLAGS := -g -DUSE_LIBLOG
./system/core/sh/Android.mk:LOCAL_CFLAGS += -DSHELL -DWITH_LINENOISE
./system/core/sh/Android.mk:make_ash_files: PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
./system/core/libdiskconfig/Android.mk:LOCAL_CFLAGS := -O2 -g -W -Wall -Werror -D_LARGEFILE64_SOURCE
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS := -Wall
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP_D32
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP_D32
./system/core/adb/Android.mk:LOCAL_CFLAGS += -g -DADB_HOST=1  -Wall -Wno-unused-parameter
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
./system/core/adb/Android.mk:LOCAL_CFLAGS := -g -DADB_HOST=0 -Wall -Wno-unused-parameter
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
./system/core/adb/Android.mk:LOCAL_CFLAGS += -DANDROID_GADGET=1
./system/core/adb/Android.mk:	LOCAL_CFLAGS += -DBOARD_ALWAYS_INSECURE
./system/core/adb/Android.mk:LOCAL_CFLAGS := \
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/nexus/Android.mk:LOCAL_CFLAGS := 
./system/core/nexus/Android.mk:LOCAL_CFLAGS := 
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS)
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS += -DWITH_LIB_HARDWARE
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS) 
./system/core/liblog/Android.mk:LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1
./system/core/init/Android.mk:LOCAL_CFLAGS    += -DBOOTCHART=1
./system/core/init/Android.mk:LOCAL_CFLAGS += -DNO_INITLOGO
./system/core/init/Android.mk:    $(eval LOCAL_CFLAGS += -D$(system_core_init_define)=\"$($(system_core_init_define))\") \
[email protected] ~/adb $

This is all very confusing.

I pushed my source to dev host for anyone interested. http://d-h.st/wmN

I will make sure to hit that thanks button once I get to a desktop. This RPI takes too long to scroll and I'm using the web from it.
 
  • Like
Reactions: djkidy123

bhundven

Inactive Recognized Developer
Aug 8, 2009
2,076
4,495
Seattle, WA
bhundven.github.io
Thanks. I'm not sure where to add it though
Code:
[email protected] ~/adb $ grep -R  LOCAL_CFLAGS ./*
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags)
./bionic/libc/Android.mk:LOCAL_CFLAGS+= \
./bionic/libc/Android.mk:LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags) \
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags) \
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags)
./bionic/libc/Android.mk:LOCAL_CFLAGS := \
./bionic/libc/Android.mk:LOCAL_CFLAGS := \
./bionic/libc/Jamfile:        local LOCAL_CFLAGS LOCAL_DEFINES LOCAL_INCLUDES LOCAL_SRC NO_LOCAL_SRC ;
./bionic/libc/Jamfile:        CFLAGS   += $(LOCAL_CFLAGS) ;
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DVM_SPLIT_2G
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DPRELINK
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_TEXT_BASE=$(LINKER_TEXT_BASE)
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_AREA_SIZE=$(LINKER_AREA_SIZE)
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_DEBUG=0
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
./bionic/linker/Android.mk:LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/private
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DANDROID_ARM_LINKER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DANDROID_X86_LINKER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/arch-x86/bionic
./bionic/linker/Android.mk:      LOCAL_CFLAGS += -DANDROID_SH_LINKER
./bionic/linker/README.TXT:    LOCAL_CFLAGS += -DLINKER_DEBUG=0
./bionic/linker/README.TXT:    LOCAL_CFLAGS += -DLINKER_DEBUG=1
./bionic/libstdc++/Android.mk:LOCAL_CFLAGS := $(libstdc++_cflags)
./bionic/libstdc++/Android.mk:LOCAL_CFLAGS := $(libstdc++_cflags)
./build/tools/acp/Android.mk:LOCAL_CFLAGS += -DWIN32_EXE
./build/tools/acp/Android.mk:LOCAL_CFLAGS += -DMACOSX_RSRC
./build/tools/rgb2565/Android.mk:LOCAL_CFLAGS += -O2 -Wall -Wno-unused-parameter
./build/buildspec.mk.default:# will be added to LOCAL_CFLAGS when building the module.
./build/core/clear_vars.mk:LOCAL_CFLAGS:=
./build/core/build-system.html:LOCAL_CFLAGS += -DNDEBUG=1
./build/core/build-system.html:<h4>LOCAL_CFLAGS</h4>
./build/core/build-system.html:<p><code>LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1</code></p>
./build/core/build-system.html:<code>LOCAL_CPPFLAGS</code> is guaranteed to be after <code>LOCAL_CFLAGS</code>
./build/core/build-system.html:<code>LOCAL_CFLAGS</code>.
./build/core/build-system.html:<code>LOCAL_C_INCLUDES</code>, <code>LOCAL_CFLAGS</code>, and
./build/core/native_test.mk:LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING
./build/core/host_native_test.mk:LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g
./build/core/binary.mk:  LOCAL_CFLAGS += $(TARGET_FDO_CFLAGS)
./build/core/binary.mk:LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
./build/core/binary.mk:$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
./build/libs/host/Android.mk:LOCAL_CFLAGS += -DWIN32_EXE
./build/libs/host/Android.mk:LOCAL_CFLAGS += -DMACOSX_RSRC
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP $(zlib_arm_flags)
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP $(zlib_arm_flags)
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP
./system/core/libsysutils/Android.mk:LOCAL_CFLAGS := 
./system/core/charger/Android.mk:LOCAL_CFLAGS += -DBATTERY_DEVICE_NAME=\"$(BOARD_BATTERY_DEVICE_NAME)\"
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(hostSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
./system/core/libcutils/Android.mk:    LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND='$(TARGET_RECOVERY_PRE_COMMAND)'
./system/core/libcutils/Android.mk:    LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND_CLEAR_REASON
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(targetSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(targetSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += -DTEST_STR_PARMS
./system/core/libusbhost/Android.mk:LOCAL_CFLAGS := -g -DUSE_LIBLOG
./system/core/sh/Android.mk:LOCAL_CFLAGS += -DSHELL -DWITH_LINENOISE
./system/core/sh/Android.mk:make_ash_files: PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
./system/core/libdiskconfig/Android.mk:LOCAL_CFLAGS := -O2 -g -W -Wall -Werror -D_LARGEFILE64_SOURCE
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS := -Wall
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP_D32
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP_D32
./system/core/adb/Android.mk:LOCAL_CFLAGS += -g -DADB_HOST=1  -Wall -Wno-unused-parameter
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
./system/core/adb/Android.mk:LOCAL_CFLAGS := -g -DADB_HOST=0 -Wall -Wno-unused-parameter
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
./system/core/adb/Android.mk:LOCAL_CFLAGS += -DANDROID_GADGET=1
./system/core/adb/Android.mk:	LOCAL_CFLAGS += -DBOARD_ALWAYS_INSECURE
./system/core/adb/Android.mk:LOCAL_CFLAGS := \
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/nexus/Android.mk:LOCAL_CFLAGS := 
./system/core/nexus/Android.mk:LOCAL_CFLAGS := 
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS)
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS += -DWITH_LIB_HARDWARE
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS) 
./system/core/liblog/Android.mk:LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1
./system/core/init/Android.mk:LOCAL_CFLAGS    += -DBOOTCHART=1
./system/core/init/Android.mk:LOCAL_CFLAGS += -DNO_INITLOGO
./system/core/init/Android.mk:    $(eval LOCAL_CFLAGS += -D$(system_core_init_define)=\"$($(system_core_init_define))\") \
[email protected] ~/adb $

This is all very confusing.

I pushed my source to dev host for anyone interested. http://d-h.st/wmN

I will make sure to hit that thanks button once I get to a desktop. This RPI takes too long to scroll and I'm using the web from it.

Try build/core/combo/TARGET_linux-arm.mk
 
  • Like
Reactions: AdamOutler

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,809
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Try build/core/combo/TARGET_linux-arm.mk
I added
Code:
LOCAL_CFLAGS += --with-float=soft
LOCAL_LDFLAGS += -lgcc
to both the TARGET you suggested and HOST_linux_x86. I got the same error.

I'm compiling this on the Raspberry Pi itself because i need the statically linked host binary. I'm using the x86 host because there is no arm host available. this should be irrelevant because i'm using the native build tools. Anyway.. I convinced it to use x86 and now the linking seems to be the final challenge.
 
Last edited:

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://forum.xda-developers.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://forum.xda-developers.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:
    [email protected] ~/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
    [email protected] ~/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:
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone