您的位置:首页 > 产品设计 > UI/UE

How to build Android adb for ARM .

2012-08-15 14:20 1781 查看
Thanks to Google I’ve just found searching in many Forum threads the way to build adb on ARM arch.

Just download sources with git (apt-get install git-core on debian-like system):

$ git clone git://android.git.kernel.org/platform/system/core.git system/core

$ git clone git://android.git.kernel.org/platform/build.git build

$ git clone git://android.git.kernel.org/platform/external/zlib.git external/zlib

$ git clone git://android.git.kernel.org/platform/bionic.git bionic

or you can go into Android source code and find the directory /system/core/adb/

Now edit build/core/main.mk and comment out the parts labelled
# Check for the correct version of java
and
# Check for the correct version of javac
Since adb doesn’t need Java, these checks are unnecessary.

Also edit build/target/product/sdk.mk and comment out the “include” lines after
# include available languages for TTS in the system image
This avoids having to download language files that aren’t needed for adb.

Save this Makefile as system/core/adb/Makefile : https://gist.github.com/958335

Then just run:
cd system/core/adb; make

Then you can copy and use your adb binary.

That’s all! If you have any problems search your distro’s packages repository to install needed packages!

:-)

Makefile:

SRCS+= utils.c

VPATH+= ../libcutils

SRCS+= abort_socket.c

SRCS+= socket_inaddr_any_server.c

SRCS+= socket_local_client.c

SRCS+= socket_local_server.c

SRCS+= socket_loopback_client.c

SRCS+= socket_loopback_server.c

SRCS+= socket_network_client.c

VPATH+= ../libzipfile

SRCS+= centraldir.c

SRCS+= zipfile.c

VPATH+= ../../../external/zlib

SRCS+= adler32.c

SRCS+= compress.c

SRCS+= crc32.c

SRCS+= deflate.c

SRCS+= infback.c

SRCS+= inffast.c

SRCS+= inflate.c

SRCS+= inftrees.c

SRCS+= trees.c

SRCS+= uncompr.c

SRCS+= zutil.c

CPPFLAGS+= -DADB_HOST=1

CPPFLAGS+= -DHAVE_FORKEXEC=1

CPPFLAGS+= -DHAVE_SYMLINKS

CPPFLAGS+= -DHAVE_TERMIO_H

CPPFLAGS+= -D_GNU_SOURCE

CPPFLAGS+= -D_XOPEN_SOURCE

CPPFLAGS+= -I.

CPPFLAGS+= -I../include

CPPFLAGS+= -I../../../external/zlib

CFLAGS+= -O2 -g -Wall -Wno-unused-parameter

LDFLAGS= -static

LIBS= -lrt -lpthread

TOOLCHAIN= arm-none-linux-gnueabi-

CC= $(TOOLCHAIN)gcc

LD= $(TOOLCHAIN)gcc

OBJS= $(SRCS:.c=.o)

all: adb

adb: $(OBJS)

$(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)

clean:

rm -rf $(OBJS)

/article/2860405.html

============================================================================================================================================================

pseudolocalize.cpp is not needed for adb. And NDK toolchain is intended to build with bionic(Android libc). adb requires glibc(GNU libc) to build.

I created a Makefile to compile adb for Linux/ARM. This Makefile makes statically linked adb executable binary for Linux/ARM, thus it works on Android/ARM as well.

standalone Makefile for adb

How to make.

Install Sourcery G++ Lite for ARM and GNU Make.
Download "Android source code".
Save Makefile as system/core/adb/Makefile.
cd system/core/adb; make.

Makefile
#

embed

raw

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

SRCS+= adb.cSRCS+= adb_client.cSRCS+= commandline.cSRCS+= console.cSRCS+= file_sync_client.cSRCS+= fdevent.cSRCS+= get_my_path_linux.cSRCS+= services.cSRCS+= sockets.cSRCS+= transport.cSRCS+= transport_local.cSRCS+= transport_usb.cSRCS+= usb_linux.cSRCS+= usb_vendors.cSRCS+= utils.c
VPATH+= ../libcutilsSRCS+= abort_socket.cSRCS+= socket_inaddr_any_server.cSRCS+= socket_local_client.cSRCS+= socket_local_server.cSRCS+= socket_loopback_client.cSRCS+= socket_loopback_server.cSRCS+= socket_network_client.c
VPATH+= ../libzipfileSRCS+= centraldir.cSRCS+= zipfile.c
VPATH+= ../../../external/zlibSRCS+= adler32.cSRCS+= compress.cSRCS+= crc32.cSRCS+= deflate.cSRCS+= infback.cSRCS+= inffast.cSRCS+= inflate.cSRCS+= inftrees.cSRCS+= trees.cSRCS+= uncompr.cSRCS+= zutil.c
CPPFLAGS+= -DADB_HOST=1CPPFLAGS+= -DHAVE_FORKEXEC=1CPPFLAGS+= -DHAVE_SYMLINKSCPPFLAGS+= -DHAVE_TERMIO_HCPPFLAGS+= -D_GNU_SOURCECPPFLAGS+= -D_XOPEN_SOURCECPPFLAGS+= -I.CPPFLAGS+= -I../includeCPPFLAGS+= -I../../../external/zlib
CFLAGS+= -O2 -g -Wall -Wno-unused-parameterLDFLAGS= -staticLIBS= -lrt -lpthread
TOOLCHAIN= arm-none-linux-gnueabi-CC= $(TOOLCHAIN)gccLD= $(TOOLCHAIN)gcc
OBJS= $(SRCS:.c=.o)
all: adb
adb: $(OBJS)	$(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
clean:	rm -rf $(OBJS)


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: