Skip to content

Instantly share code, notes, and snippets.

@splhack
Created May 6, 2011 02:17
Show Gist options
  • Save splhack/958335 to your computer and use it in GitHub Desktop.
Save splhack/958335 to your computer and use it in GitHub Desktop.
Makefile for adb
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+= -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)
@wuzhenda
Copy link

did you update for android adb RSA?

@cstratton
Copy link

I've modified this to build a more recent version of ADB which supports the security features. Doesn't seem to work with the latest, but works with a "recent enough" version identified within.

https://gist.github.com/cstratton/2d3be0682f3c5312a5cd

@cantren
Copy link

cantren commented Feb 20, 2015

I had to change "TOOLCHAIN= arm-none-linux-gnueabi-" to "TOOLCHAIN= arm-linux-gnueabihf-" to get the "make" command to run.

I ended up downloading the Makefile to /system/core/adb/ and running "make" from there.

Device: Acer CB5-311-T7NN
Crouton Install: sh -e ~/Downloads/crouton -r kali -t xfce

@gutschke
Copy link

I needed ARM binaries for version 1.0.32+ of adb and for fastboot. Turns out, nobody has them; at least I came up empty-handed when searching the web.

So, I used your Makefile as a basic inspiration to figure out how to build version 1.0.35. If anybody else needs these files, I put as snapshot at https://github.com/gutschke/adb-fastboot

I hope this will be useful to others, too. I make no promise as to maintaining these binaries, but they filled my needs.

If you use these files in order to flash an Android device using a Chromebook, please note the information given in https://www.reddit.com/r/Android/comments/49lcfb/psa_when_updating_nexus_devices_via_fastboot_make/ Chromebooks have limited amounts of RAM and because of that don't always run "fastboot update ..." to completion.

@andrewleo
Copy link

Does anyone have build adb-ar, version 1.0.39?

@parkerlreed
Copy link

Or now 1.0.40. I hate all these 2-3 year old outdated adb/fastboot binaries (ARM).

@EugenNY
Copy link

EugenNY commented Aug 17, 2022

I wrote this years ago: https://raspberrypi.stackexchange.com/a/70288/70770
and just updated it, summary:

Raspbian 10/buster which offers gcc 8.3.0. It also comes with adb v1.0.39, 1:8.1.0+r23-5. And to my surprise, Raspbian 11/bullseye actually includes adb v1.0.41, 28.0.2-debian. Even better, bullseye is also available for arm64 now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment