對Android/system/core中的adb打上如下補丁:
- From e8853dc01a99fddd57b375c29489cd817ddebc2d Mon Sep 17 00:00:00 2001
- From: Barry Song <[email protected]>
- Date: Wed, 2 May 2012 09:57:02 +0800
- Subject: [PATCH] adb: make adb support arm as the host and adbd/host co-exist
-
- The Makefile is copied from https://gist.github.com/958335
- with added DEFAULT_ADB_PORT=8888 to avoid the tcp port confliction
- between adbd in client and cloned usb thread in host adb
-
- adbd uses 5037 port, thread in host adb uses 8888
-
- Signed-off-by: Barry Song <[email protected]>
-
- Change-Id: I70f178230a78f84ad464479abc2bba1fe6d2c372
- ---
- adb/Makefile | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- adb/adb.h | 2 +
- 2 files changed, 73 insertions(+), 0 deletions(-)
- create mode 100644 adb/Makefile
-
- diff --git a/adb/Makefile b/adb/Makefile
- new file mode 100644
- index 0000000..d5317ee
- --- /dev/null
- +++ b/adb/Makefile
- @@ -0,0 +1,71 @@
- +SRCS+= adb.c
- +SRCS+= adb_client.c
- +SRCS+= commandline.c
- +SRCS+= console.c
- +SRCS+= file_sync_client.c
- +SRCS+= fdevent.c
- +SRCS+= get_my_path_linux.c
- +SRCS+= services.c
- +SRCS+= sockets.c
- +SRCS+= transport.c
- +SRCS+= transport_local.c
- +SRCS+= transport_usb.c
- +SRCS+= usb_linux.c
- +SRCS+= usb_vendors.c
- +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+= -DPATH_MAX=256
- +CPPFLAGS+= -DDEFAULT_ADB_PORT=8888
- +CPPFLAGS+= -I.
- +CPPFLAGS+= -I../include
- +CPPFLAGS+= -I../../../external/zlib
- +
- +CFLAGS+= -O2 -g -Wall -Wno-unused-parameter -DDEFAULT_ADB_PORT=8888
- +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)
- diff --git a/adb/adb.h b/adb/adb.h
- index f52c8b7..51b4c2f 100644
- --- a/adb/adb.h
- +++ b/adb/adb.h
- @@ -365,7 +365,9 @@ typedef enum {
- #define print_packet(tag,p) do {} while (0)
- #endif
-
- +#ifndef DEFAULT_ADB_PORT
- #define DEFAULT_ADB_PORT 5037
- +#endif
- #define DEFAULT_ADB_LOCAL_TRANSPORT_PORT 5555
-
- #define ADB_CLASS 0xff
- --
- 1.7.0.4
在adb所在目錄運行make,使用arm linux toolchain得到了adb。即可以在運行ARM Linux平台的電路板或Android手機上作為adb的host了。