FORUMS
Remove All Ads from XDA

Adb for Raspberry pi

5,225 posts
Thanks Meter: 9,875
 
Post Reply Email Thread
8th October 2012, 06:40 AM |#21  
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
Attached Files
File Type: 7z adb-armv5te-static.7z - [Click for QR Code] (151.6 KB, 239 views)
The Following 6 Users Say Thank You to trevd For This Useful Post: [ View ]
 
 
8th October 2012, 07:18 AM |#22  
Quote:
Originally Posted by trevd

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

It's way more than i've seen before on this version! It's not connecting to the server though. Here's the output you requested. I have to elevate sudo on my device because I do not have permissions assinged to open my Nexus7 from adb.

Code:
pi@raspberrypi ~/adb $ ADB_TRACE=all ./adb kill-server
system/core/adb/adb.c::main():Handling commandline()
system/core/adb/adb_client.c::_adb_connect():_adb_connect: host:kill
pi@raspberrypi ~/adb $ sudo ADB_TRACE=all ./adb devices
system/core/adb/adb.c::main():Handling commandline()
system/core/adb/adb_client.c::adb_query():adb_query: host:devices
system/core/adb/adb_client.c::_adb_connect():_adb_connect: host:version
system/core/adb/adb_client.c::adb_connect():adb_connect: service host:devices
* daemon not running. starting it now on port 5038 *
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
pi@raspberrypi ~/adb $ sudo ADB_TRACE=all ./adb reboot
system/core/adb/adb.c::main():Handling commandline()
system/core/adb/adb_client.c::_adb_connect():_adb_connect: host:version
system/core/adb/adb_client.c::adb_connect():adb_connect: service reboot:
* daemon not running. starting it now on port 5038 *
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
pi@raspberrypi ~/adb $
here's an strace ./adb reboot
Code:
pi@raspberrypi ~/adb $ strace ./adb reboot
execve("./adb", ["./adb", "reboot"], [/* 28 vars */]) = 0
gettid()                                = 3012
set_tls(0x5b0a0, 0x5b1a0, 0x5b19c, 0x40, 0x5b0a0) = 0
open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 3
read(3, "\237`\271\264", 4)             = 4
close(3)                                = 0
clock_gettime(CLOCK_MONOTONIC, {805, 485324377}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400aa000
madvise(0x400aa000, 4096, 0xc /* MADV_??? */) = -1 EINVAL (Invalid argument)
mprotect(0x400aa000, 4096, PROT_READ)   = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(5038), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 ECONNREFUSED (Connection refused)
close(3)                                = 0
mprotect(0x400aa000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0x400aa000, 4096, PROT_READ)   = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
brk(0)                                  = 0x69000
brk(0x69000)                            = 0x69000
brk(0x6a000)                            = 0x6a000
mprotect(0x400aa000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0x400aa000, 4096, PROT_READ)   = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
write(1, "* daemon not running. starting i"..., 53* daemon not running. starting it now on port 5038 *
) = 53
pipe([3, 4])                            = 0
getpid()                                = 3012
readlink("/proc/3012/exe", "/home/pi/adb/adb", 4095) = 16
fork()                                  = 3013
close(4)                                = 0
read(3, "Inv", 3)                       = 3
close(3)                                = 0
write(2, "ADB server didn't ACK\n", 22ADB server didn't ACK
) = 22
write(2, "* failed to start daemon *\n", 27* failed to start daemon *
) = 27
write(2, "error: cannot connect to daemon\n", 32error: cannot connect to daemon
) = 32
mprotect(0x400aa000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0x400aa000, 4096, PROT_READ)   = 0
mprotect(0x400aa000, 4096, PROT_READ|PROT_WRITE) = 0
mprotect(0x400aa000, 4096, PROT_READ)   = 0
munmap(0x400aa000, 4096)                = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
exit_group(1)                           = ?
pi@raspberrypi ~/adb $
8th October 2012, 12:28 PM |#23  
cdesai's Avatar
Recognized Developer
Flag IN YOUR HEAD
Thanks Meter: 4,122
 
Donate to Me
More
An adb binary is built for the device already by default, it lives under /system/bin/adb.
So, just grab one from your device and use it (if you get around the linking problems), or compile it.

Setup your pc for building android (source.android.pc), and get AOSP master.
Once done, select any suitable target (type lunch to get a list).

make $OUT/system/bin/adb will do the job.

[ /home/cdesai/android/cm/10/out/target/product/p1/system/bin/adb: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped ] - so you'll need to force it to be static, do that at system/core/adb/Android.mk (https://android.googlesource.com/pla...adb/Android.mk - line 134)
8th October 2012, 07:15 PM |#24  
Quote:
Originally Posted by cdesai

An adb binary is built for the device already by default, it lives under /system/bin/adb.
So, just grab one from your device and use it (if you get around the linking problems), or compile it.

Setup your pc for building android (source.android.pc), and get AOSP master.
Once done, select any suitable target (type lunch to get a list).

make $OUT/system/bin/adb will do the job.

[ /home/cdesai/android/cm/10/out/target/product/p1/system/bin/adb: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped ] - so you'll need to force it to be static, do that at system/core/adb/Android.mk (https://android.googlesource.com/pla...adb/Android.mk - line 134)

That looks like what I need, and I tried to grab the binary, then link in the dependencies to debian, but it didn't work.

here is "file /bin/adb" which is a working, but older copy of adb for raspi.
Code:
/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
Unfortunately, I don't really understand what is required to bend that Makefile. My knowledge limits end at specifying build folders, adding CC flags, and adding/removing tags... you know, the standard build-it-yourself stuff. I only really understand C Headers.
8th October 2012, 09:49 PM |#25  
I found this command bugreport

Code:
pi@raspberrypi ~/adb $ ./adb bugreport
system/core/adb/adb.c::main():Handling commandline()
system/core/adb/commandline.c::adb_commandline():interactive shell loop. buff=shell:bugreport
system/core/adb/adb_client.c::_adb_connect():_adb_connect: host:version
system/core/adb/adb_client.c::adb_connect():adb_connect: service shell:bugreport
* daemon not running. starting it now on port 5038 *
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
system/core/adb/commandline.c::adb_commandline():interactive shell loop. return r=-1
Looks like it is having a problem instantiating a new shell process?
8th October 2012, 10:45 PM |#26  
E:V:A's Avatar
Recognized Developer
Flag -∇ϕ
Thanks Meter: 2,146
 
More
A couple of things:
  • Make sure you don't have a firewall blocking adb
  • If you're on windows make sure you don't have a defunct adb already running. (Check with task-manager and kill it.) And make sure you run it as administrator.
  • Make sure USB Debugging is enabled in the device (if available)
  • If you are using Ubuntu, add your USB vendor ID (VID) to the file 51-android.rules. See here for more details. Then do this:
    Code:
    sudo ./adb kill-server
    sudo ./adb start-server
Not sure if any of this helps, since I have no idea of what you're doing or how your setup looks...
9th October 2012, 01:45 AM |#27  
Quote:
Originally Posted by E:V:A

A couple of things:

  • Make sure you don't have a firewall blocking adb
  • If you're on windows make sure you don't have a defunct adb already running. (Check with task-manager and kill it.) And make sure you run it as administrator.
  • Make sure USB Debugging is enabled in the device (if available)
  • If you are using Ubuntu, add your USB vendor ID (VID) to the file 51-android.rules. See here for more details. Then do this:
    Code:
    sudo ./adb kill-server
    sudo ./adb start-server
Not sure if any of this helps, since I have no idea of what you're doing or how your setup looks...

I have a working copy on my system but it's old. I need a new copy of adb for the adb restore command. it has to be built for arm and statically linked
9th October 2012, 02:38 AM |#28  
I asked JBQ on G+ and he offered this..
Quote:


Assuming that you can't pretend that your host environment is Pi (which probably wouldn't work in practice anyway), my best guess would be to either run "make adb showcommands" and see what gets built, or to look at the makefiles, figure out the list of relevant source files, and write a script that simply compiles all that with the Pi cross-compiler and links them against the Pi libraries.

9th October 2012, 02:40 AM |#29  
bhundven's Avatar
Recognized Developer
Flag Seattle, WA
Thanks Meter: 4,534
 
Donate to Me
More
Quote:
Originally Posted by AdamOutler

I asked JBQ on G+ and he offered this..

Good idea. I don't have a pi (although I really want one), or I would offer more help.
9th October 2012, 03:24 AM |#30  
ok.. by playing around with some of Rebellos's source from above and the compilier flags, I was able to make this output
Code:
pi@raspberrypi ~/Desktop/adbcompile/adb $ make adb
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o adb.o adb.c
In file included from sysdeps.h:260:0,
                 from adb.c:30:
/home/pi/adb/system/core/include/cutils/sockets.h: In function 'android_get_control_socket':
/home/pi/adb/system/core/include/cutils/sockets.h:55:2: warning: implicit declaration of function 'strlcpy' [-Wimplicit-function-declaration]
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o adb_client.o adb_client.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o commandline.o commandline.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o console.o console.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o fdevent.o fdevent.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o file_sync_client.o file_sync_client.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o file_sync_service.o file_sync_service.c
file_sync_service.c: In function 'do_send':
file_sync_service.c:280:9: warning: variable 'is_link' set but not used [-Wunused-but-set-variable]
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o framebuffer_service.o framebuffer_service.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o get_my_path_linux.o get_my_path_linux.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o jdwp_service.o jdwp_service.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o log_service.o log_service.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o services.o services.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o sockets.o sockets.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o transport.o transport.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o transport_local.o transport_local.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o transport_usb.o transport_usb.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o usb_linux.o usb_linux.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o usb_vendors.o usb_vendors.c
gcc -I/home/pi/adb/system/core/include -g -DADB_HOST=1 -DADB_HOST_ON_TARGET=1 -Wall -Wno-unused-parameter -D_XOPEN_SOURCE -D_GNU_SOURCE -fno-short-enums -mfloat-abi=softfp -march=armv6  -O2 -c -fmessage-length=0 -o utils.o utils.c
gcc -march=armv6 -print-multi-lib -mfloat-abi=softfp  -o adb adb.o adb_client.o commandline.o console.o fdevent.o file_sync_client.o file_sync_service.o framebuffer_service.o get_my_path_linux.o jdwp_service.o log_service.o services.o sockets.o transport.o transport_local.o transport_usb.o usb_linux.o usb_vendors.o utils.o  -L ../lib_armv6/ -lpthread -lcutils -lzipfile -lz 
.;
pi@raspberrypi ~/Desktop/adbcompile/adb $ ls
MODULE_LICENSE_APACHE2  adb.h               commandline.c  fdevent.o            framebuffer_service.c  log_service.c  sockets.dia  transport_local.c  usb_vendors.c
Makefile                adb.o               commandline.o  file_sync_client.c   framebuffer_service.o  log_service.o  sockets.o    transport_local.o  usb_vendors.h
NOTICE                  adb_client.c        console.c      file_sync_client.o   get_my_path_linux.c    mutex_list.h   sysdeps.h    transport_usb.c    usb_vendors.o
OVERVIEW.TXT            adb_client.h        console.o      file_sync_service.c  get_my_path_linux.o    services.c     transport.c  transport_usb.o    utils.c
SERVICES.TXT            adb_client.o        fdevent.c      file_sync_service.h  jdwp_service.c         services.o     transport.h  usb_linux.c        utils.h
adb.c                   adb_host_armv6.zip  fdevent.h      file_sync_service.o  jdwp_service.o         sockets.c      transport.o  usb_linux.o        utils.o
but there was no binary.. odd.
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.
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