歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> 讓Android adb運行在ARM平台上

讓Android adb運行在ARM平台上

日期:2017/3/1 10:23:39   编辑:Linux編程

對Android/system/core中的adb打上如下補丁:

  1. From e8853dc01a99fddd57b375c29489cd817ddebc2d Mon Sep 17 00:00:00 2001
  2. From: Barry Song <[email protected]>
  3. Date: Wed, 2 May 2012 09:57:02 +0800
  4. Subject: [PATCH] adb: make adb support arm as the host and adbd/host co-exist
  5. The Makefile is copied from https://gist.github.com/958335
  6. with added DEFAULT_ADB_PORT=8888 to avoid the tcp port confliction
  7. between adbd in client and cloned usb thread in host adb
  8. adbd uses 5037 port, thread in host adb uses 8888
  9. Signed-off-by: Barry Song <[email protected]>
  10. Change-Id: I70f178230a78f84ad464479abc2bba1fe6d2c372
  11. ---
  12. adb/Makefile | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  13. adb/adb.h | 2 +
  14. 2 files changed, 73 insertions(+), 0 deletions(-)
  15. create mode 100644 adb/Makefile
  16. diff --git a/adb/Makefile b/adb/Makefile
  17. new file mode 100644
  18. index 0000000..d5317ee
  19. --- /dev/null
  20. +++ b/adb/Makefile
  21. @@ -0,0 +1,71 @@
  22. +SRCS+= adb.c
  23. +SRCS+= adb_client.c
  24. +SRCS+= commandline.c
  25. +SRCS+= console.c
  26. +SRCS+= file_sync_client.c
  27. +SRCS+= fdevent.c
  28. +SRCS+= get_my_path_linux.c
  29. +SRCS+= services.c
  30. +SRCS+= sockets.c
  31. +SRCS+= transport.c
  32. +SRCS+= transport_local.c
  33. +SRCS+= transport_usb.c
  34. +SRCS+= usb_linux.c
  35. +SRCS+= usb_vendors.c
  36. +SRCS+= utils.c
  37. +
  38. +VPATH+= ../libcutils
  39. +SRCS+= abort_socket.c
  40. +SRCS+= socket_inaddr_any_server.c
  41. +SRCS+= socket_local_client.c
  42. +SRCS+= socket_local_server.c
  43. +SRCS+= socket_loopback_client.c
  44. +SRCS+= socket_loopback_server.c
  45. +SRCS+= socket_network_client.c
  46. +
  47. +VPATH+= ../libzipfile
  48. +SRCS+= centraldir.c
  49. +SRCS+= zipfile.c
  50. +
  51. +VPATH+= ../../../external/zlib
  52. +SRCS+= adler32.c
  53. +SRCS+= compress.c
  54. +SRCS+= crc32.c
  55. +SRCS+= deflate.c
  56. +SRCS+= infback.c
  57. +SRCS+= inffast.c
  58. +SRCS+= inflate.c
  59. +SRCS+= inftrees.c
  60. +SRCS+= trees.c
  61. +SRCS+= uncompr.c
  62. +SRCS+= zutil.c
  63. +
  64. +CPPFLAGS+= -DADB_HOST=1
  65. +CPPFLAGS+= -DHAVE_FORKEXEC=1
  66. +CPPFLAGS+= -DHAVE_SYMLINKS
  67. +CPPFLAGS+= -DHAVE_TERMIO_H
  68. +CPPFLAGS+= -D_GNU_SOURCE
  69. +CPPFLAGS+= -D_XOPEN_SOURCE
  70. +CPPFLAGS+= -DPATH_MAX=256
  71. +CPPFLAGS+= -DDEFAULT_ADB_PORT=8888
  72. +CPPFLAGS+= -I.
  73. +CPPFLAGS+= -I../include
  74. +CPPFLAGS+= -I../../../external/zlib
  75. +
  76. +CFLAGS+= -O2 -g -Wall -Wno-unused-parameter -DDEFAULT_ADB_PORT=8888
  77. +LDFLAGS= -static
  78. +LIBS= -lrt -lpthread
  79. +
  80. +TOOLCHAIN= arm-none-linux-gnueabi-
  81. +CC= $(TOOLCHAIN)gcc
  82. +LD= $(TOOLCHAIN)gcc
  83. +
  84. +OBJS= $(SRCS:.c=.o)
  85. +
  86. +all: adb
  87. +
  88. +adb: $(OBJS)
  89. + $(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
  90. +
  91. +clean:
  92. + rm -rf $(OBJS)
  93. diff --git a/adb/adb.h b/adb/adb.h
  94. index f52c8b7..51b4c2f 100644
  95. --- a/adb/adb.h
  96. +++ b/adb/adb.h
  97. @@ -365,7 +365,9 @@ typedef enum {
  98. #define print_packet(tag,p) do {} while (0)
  99. #endif
  100. +#ifndef DEFAULT_ADB_PORT
  101. #define DEFAULT_ADB_PORT 5037
  102. +#endif
  103. #define DEFAULT_ADB_LOCAL_TRANSPORT_PORT 5555
  104. #define ADB_CLASS 0xff
  105. --
  106. 1.7.0.4

在adb所在目錄運行make,使用arm linux toolchain得到了adb。即可以在運行ARM Linux平台的電路板或Android手機上作為adb的host了。

Copyright © Linux教程網 All Rights Reserved