Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Adb for Raspberry pi

OP AdamOutler

7th October 2012, 04:03 AM   |  #1  
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/atta...6&d=1349930509


From trevd:
Quote:
Originally Posted by 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/show...8&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...-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.
Last edited by AdamOutler; 12th October 2012 at 08:36 PM.
The Following 15 Users Say Thank You to AdamOutler For This Useful Post: [ View ]
7th October 2012, 07:29 AM   |  #2  
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:
pi@raspberrypi ~ $ sudo chmod 777 /usr/bin/adb
pi@raspberrypi ~ $ /usr/bin/adb
bash: /usr/bin/adb: No such file or directory
pi@raspberrypi ~ $ file /usr/bin/adb
/usr/bin/adb: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
pi@raspberrypi ~ $ 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.
The Following User Says Thank You to AdamOutler For This Useful Post: [ View ]
7th October 2012, 08:06 AM   |  #3  
bhundven's Avatar
Recognized Developer
Flag Seattle, WA
Thanks Meter: 4,493
 
2,040 posts
Join Date:Joined: Aug 2009
Donate to Me
More
I find dynamic dependencies this way (sgh-i717 rild for instance):
Code:
bryan@minime:~/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 by bhundven; 7th October 2012 at 08:12 AM.
The Following User Says Thank You to bhundven For This Useful Post: [ View ]
7th October 2012, 08:14 AM   |  #4  
cdesai's Avatar
Recognized Developer
Flag IN YOUR HEAD
Thanks Meter: 4,012
 
2,283 posts
Join Date:Joined: Jan 2011
Donate to Me
More
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
The Following User Says Thank You to cdesai For This Useful Post: [ View ]
7th October 2012, 08:30 AM   |  #5  
bhundven's Avatar
Recognized Developer
Flag Seattle, WA
Thanks Meter: 4,493
 
2,040 posts
Join Date:Joined: Aug 2009
Donate to Me
More
Quote:
Originally Posted by cdesai

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
The Following User Says Thank You to bhundven For This Useful Post: [ View ]
7th October 2012, 08:48 AM   |  #7  
bhundven's Avatar
Recognized Developer
Flag Seattle, WA
Thanks Meter: 4,493
 
2,040 posts
Join Date:Joined: Aug 2009
Donate to Me
More
Quote:
Originally Posted by AdamOutler

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 by bhundven; 7th October 2012 at 08:55 AM.
The Following User Says Thank You to bhundven For This Useful Post: [ View ]
7th October 2012, 09:10 AM   |  #8  
Recognized Developer
Flag Hull
Thanks Meter: 1,193
 
876 posts
Join Date:Joined: Jul 2011
Donate to Me
More
Quote:
Originally Posted by AdamOutler

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:
git clone git://android.git.kernel.org/platform/system/core.git system/core
becomes

Code:
 git clone https://android.googlesource.com/platform/system/core.git system/core
The Following User Says Thank You to trevd For This Useful Post: [ View ]
7th October 2012, 10:01 AM   |  #9  
Quote:
Originally Posted by trevd

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:
git clone git://android.git.kernel.org/platform/system/core.git system/core
becomes

Code:
 git clone https://android.googlesource.com/platform/system/core.git system/core

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.
The Following User Says Thank You to AdamOutler For This Useful Post: [ View ]
7th October 2012, 12:04 PM   |  #10  
E:V:A's Avatar
Recognized Developer
Flag -∇ϕ
Thanks Meter: 1,900
 
1,381 posts
Join Date:Joined: Dec 2011
Quote:
Originally Posted by AdamOutler

... Then I pulled the binary from /system/bin/adb. however when run it acts like it's not there even though it is.

Code:
pi@raspberrypi ~ $ /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:
$ ./usr/bin/adb

The Following User Says Thank You to E:V:A For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes