How to build Android adb for ARM

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)



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值