-
-
Save cstratton/2d3be0682f3c5312a5cd to your computer and use it in GitHub Desktop.
| #ADB tool for the Raspberry Pi and similar environments not supported by the Android SDK. | |
| #based on https://gist.github.com/splhack/958335 | |
| #This is a very simple hack for building adb on its own, using a lot of stock Linux libraries (libssl, libcrypt) | |
| #in place of the versions shipped with AOSP, in order to avoid having to pull down a lot of code. | |
| #git clone https://android.googlesource.com/platform/system/core system/core | |
| #The method below does not work with the most recent version (you will see const char* conversion errors | |
| #as a C file has been changed to a CPP one where that is more strict). However, it _can_ be made to work | |
| #with an adb version new enough to support security, if we revert the tree | |
| #The following state of the tree was not chosen with care; it just happened to be what was on the machine | |
| #where I first tried this, and it worked. Other versions may or may not work | |
| #cd system/core/adb | |
| #git reset caed3d9fae1fd372dfa01cb60fbf157233c9052e | |
| #copy this Makefile into that directory, ie, system/core/adb/Makefile | |
| #make | |
| SRCS+= adb.c | |
| SRCS+= console.c | |
| SRCS+= transport.c | |
| SRCS+= transport_local.c | |
| SRCS+= transport_usb.c | |
| SRCS+= commandline.c | |
| SRCS+= adb_client.c | |
| SRCS+= adb_auth_host.c | |
| SRCS+= sockets.c | |
| SRCS+= services.c | |
| SRCS+= file_sync_client.c | |
| SRCS+= fdevent.c | |
| SRCS+= get_my_path_linux.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 | |
| VPATH+=../libcutils | |
| SRCS+=load_file.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 -lcrypto -lssl -lz | |
| TOOLCHAIN= | |
| CC= $(TOOLCHAIN)gcc | |
| LD= $(TOOLCHAIN)gcc | |
| OBJS= $(SRCS:.c=.o) | |
| all: adb | |
| adb: $(OBJS) | |
| $(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) | |
| clean: | |
| rm -rf $(OBJS) |
im trying to compile this in my raspberry pi and gettng allot of errors:
g++ -DADB_HOST=1 -DHAVE_FORKEXEC=1 -DHAVE_SYMLINKS -DHAVE_TERMIO_H -D_GNU_SOURCE -D_XOPEN_SOURCE -I. -I../include -c -o adb.o adb.cpp
In file included from adb.cpp:30:0:
sysdeps.h: In function ‘char* adb_dirstart(const char_)’:
sysdeps.h:517:28: error: invalid conversion from ‘const char_’ to ‘char_’ [-fpermissive]
sysdeps.h: In function ‘char_ adb_dirstop(const char_)’:
sysdeps.h:522:29: error: invalid conversion from ‘const char_’ to ‘char_’ [-fpermissive]
adb.cpp: In function ‘apacket_ get_apacket()’:
adb.cpp:146:14: error: ‘nullptr’ was not declared in this scope
adb.cpp: In function ‘int handle_forward_request(const char_, transport_type, char_, int)’:
adb.cpp:720:23: error: ‘nullptr’ was not declared in this scope
adb.cpp:753:40: error: invalid conversion from ‘const char_’ to ‘char_’ [-fpermissive]
: recipe for target 'adb.o' failed
make: *** [adb.o] Error 1
how i can fix this?
Hi, I download the adb source code and your Makefile, it's OK to build to the end.
But then I changed TOOLCHAIN= /opt/buildroot-gcc342/bin/mipsel-linux-, wanna do a cross-compile.
it failed.
Report:
In file included from adb.c:30:
sysdeps.h: In function
adb_shutdown': sysdeps.h:363: warning: implicit declaration of functionshutdown'sysdeps.h:363: error: `SHUT_RDWR' undeclared (first use in this function)
sysdeps.h:363: error: (Each undeclared identifier is reported only once
sysdeps.h:363: error: for each function it appears in.)
Anybody knows how to fix this?