Step 1: Clone source code from git repos
git clone https://android.googlesource.com/platform/system/core.git
Step 2: Write a standalone Makefile
vim core/fastboot/Makefile
# Makefile for fastboot
SRCS+=protocol.c
SRCS+=engine.c
SRCS+=bootimg.c
SRCS+=fastboot.c
SRCS+=usb_linux.c
SRCS+=util_linux.c
VPATH+= ../libzipfile
SRCS+= centraldir.c
SRCS+= zipfile.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../mkbootimg
CPPFLAGS+= -I../../../external/zlib
CFLAGS+= -O2 -Wno-unused-parameter
LDFLAGS=
LIBS= -lrt -lpthread -lz
TOOLCHAIN= mipsel-unknown-linux-gnu-
CC= $(TOOLCHAIN)gcc
LD= $(TOOLCHAIN)gcc
OBJS= $(SRCS:.c=.o)
all: fastboot
fastboot: $(OBJS)
$(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
clean:
rm -rf $(OBJS)
Step 3: Build
cd core/fastboot
make
Over!