{"id":1720,"date":"2017-09-16T23:27:41","date_gmt":"2017-09-16T15:27:41","guid":{"rendered":"http:\/\/kaoru.tech:7000\/wordpress\/?p=1720"},"modified":"2017-09-16T23:27:41","modified_gmt":"2017-09-16T15:27:41","slug":"cross-compile-android-adb-tool","status":"publish","type":"post","link":"http:\/\/kaoru.tech:7000\/wordpress\/?p=1720","title":{"rendered":"Cross Compile Android ADB tool"},"content":{"rendered":"<p>\u73b0\u5728\u5f88\u591aARM\u8bbe\u5907\u652f\u6301ADB\uff0c\u6bd4\u59824G\u6a21\u5757\u3002<\/p>\n<p>\u7ecf\u8fc7\u6d4b\u8bd5\uff0candroid-4.4_r1.2\u5206\u652f\u53ef\u4ee5\u7f16\u8bd1\u6210\u529f\u3002<\/p>\n<pre class=\"lang:sh decode:true\">$ git clone https:\/\/android.googlesource.com\/platform\/system\/core system.core.git\r\n$ cd system.core.git\/adb\r\n$ git checkout android-4.4_r1.2<\/pre>\n<p>\u5efa\u7acb\u4e00\u4e2aMakefile\uff0c\u5e76\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre class=\"lang:vim decode:true\"># standalone Makefile for adb\r\nSRCS+= adb.c\r\nSRCS+= fdevent.c\r\nSRCS+= adb_client.c\r\nSRCS+= commandline.c\r\nSRCS+= console.c\r\nSRCS+= file_sync_client.c\r\nSRCS+= get_my_path_linux.c\r\nSRCS+= services.c\r\nSRCS+= sockets.c\r\nSRCS+= transport.c\r\nSRCS+= transport_local.c\r\nSRCS+= transport_usb.c\r\nSRCS+= usb_linux.c\r\nSRCS+= usb_vendors.c\r\nSRCS+= adb_auth_host.c\r\n \r\nVPATH+= ..\/libcutils\r\nSRCS+= list.c\r\nSRCS+= socket_inaddr_any_server.c\r\nSRCS+= socket_local_client.c\r\nSRCS+= socket_local_server.c\r\nSRCS+= socket_loopback_client.c\r\nSRCS+= socket_loopback_server.c\r\nSRCS+= socket_network_client.c\r\nSRCS+= load_file.c\r\n \r\nVPATH+= ..\/libzipfile\r\nSRCS+= centraldir.c\r\nSRCS+= zipfile.c\r\n \r\n#VPATH+= ..\/..\/..\/external\/zlib\/src\r\n#VPATH+= ..\/..\/..\/..\/utils\/zlib.git\r\n#SRCS+= adler32.c\r\n#SRCS+= compress.c\r\n#SRCS+= crc32.c\r\n#SRCS+= deflate.c\r\n#SRCS+= infback.c\r\n#SRCS+= inffast.c\r\n#SRCS+= inflate.c\r\n#SRCS+= inftrees.c\r\n#SRCS+= trees.c\r\n#SRCS+= uncompr.c\r\n#SRCS+= zutil.c\r\n\r\nCFLAGS+= -DADB_HOST=1\r\nCFLAGS+= -DHAVE_FORKEXEC=1\r\nCFLAGS+= -DHAVE_SYMLINKS\r\nCFLAGS+= -DHAVE_TERMIO_H\r\nCFLAGS+= -DHAVE_SYS_SOCKET_H\r\nCFLAGS+= -D_GNU_SOURCE\r\nCFLAGS+= -D_XOPEN_SOURCE\r\nCFLAGS+= -I.\r\nCFLAGS+= -I..\/include\r\nCFLAGS+= -I..\/..\/..\/external\/zlib\r\nCFLAGS+= -I\/data\/utils\/openssl.git\/include\r\nCFLAGS+= -I\/data\/utils\/zlib.git\r\nCFLAGS+= -lrt\r\n \r\nCFLAGS+= -O2 -g -Wall -Wno-unused-parameter\r\n\r\nLDFLAGS=-L\/data\/utils\/openssl.git\r\nLDFLAGS+=-L\/data\/utils\/zlib.git\r\n\r\nLIBS= -lcrypto -lz -lpthread\r\n \r\nCC?= $(TOOLCHAIN)gcc\r\nLD?= $(CROSS_COMPILE)gcc\r\n\r\nOBJS= $(SRCS:.c=.o)\r\n\t \r\nall: adb\r\n \r\nadb: $(OBJS)\r\n\t$(CC) -o $@ $(LDFLAGS) $(LIBS) $(OBJS)\r\n \r\nclean:\r\n\trm -rf $(OBJS)<\/pre>\n<p>\u5176\u4e2dzlib\u548copenssl\u91c7\u7528\u6e90\u7801\u7f16\u8bd1\uff0c\u52a8\u6001\u94fe\u63a5<\/p>\n<p>\u7136\u540e\u7f16\u8bd1<\/p>\n<pre class=\"lang:sh decode:true\">$ file adb\r\nadb: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter \/lib\/ld-linux-armhf.so.3, for GNU\/Linux 2.6.32, BuildID[sha1]=831867194c1727b026972e4291d5020eb26966dc, not stripped<\/pre>\n<h1>\u53c2\u8003<\/h1>\n<p><a href=\"http:\/\/android.serverbox.ch\/?p=1217\">http:\/\/android.serverbox.ch\/?p=1217<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73b0\u5728\u5f88\u591aARM\u8bbe\u5907\u652f\u6301ADB\uff0c\u6bd4\u59824G\u6a21\u5757\u3002 \u7ecf\u8fc7\u6d4b\u8bd5\uff0candroid-4.4_r1.2\u5206\u652f\u53ef\u4ee5\u7f16\u8bd1\u6210\u529f\u3002 $ git clone https:\/\/android.googlesource.com\/platform\/system\/core system.core.git $ cd system.core.git\/adb $ git checkout android-4.4_r1.2 \u5efa\u7acb\u4e00\u4e2aMakefile\uff0c\u5e76\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a # standalone Makefile for adb SRCS+= adb.c SRCS+= fdevent.c SRCS+= adb_client.c SRCS+= commandline.c SRCS+= console.c&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[16],"tags":[],"class_list":["post-1720","post","type-post","status-publish","format-standard","hentry","category-crosscompile"],"_links":{"self":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1720"}],"version-history":[{"count":3,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1720\/revisions"}],"predecessor-version":[{"id":1723,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1720\/revisions\/1723"}],"wp:attachment":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1720"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}