53 Zeilen
1.7 KiB
Makefile
53 Zeilen
1.7 KiB
Makefile
# Must be configured by the user
|
|
ANDROID_NDK := /opt/android-ndk
|
|
|
|
# Constants and makefile shit used in build
|
|
mkfile_path = $(abspath $(lastword $(MAKEFILE_LIST)))
|
|
current_dir = $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
|
|
|
|
## NDK configuration.
|
|
PLATFORM_VERSION = 19
|
|
NDK_ARCH = arm
|
|
NDK_ABI = linux-androideabi
|
|
NDK = $(ANDROID_NDK)
|
|
NDK_COMP_VER = 4.9
|
|
NDK_HOSTARCH = linux-x86_64
|
|
NDK_TOOLS = $(NDK)/toolchains/$(NDK_ARCH)-$(NDK_ABI)-$(NDK_COMP_VER)/prebuilt/$(NDK_HOSTARCH)/bin
|
|
NDK_SYSROOT = $(NDK)/platforms/android-$(PLATFORM_VERSION)/arch-$(NDK_ARCH)
|
|
NDK_INC = $(NDK)/platforms/android-$(PLATFORM_VERSION)/arch-$(NDK_ARCH)/usr/include
|
|
NDK_LIB = $(NDK)/platforms/android-$(PLATFORM_VERSION)/arch-$(NDK_ARCH)/usr/lib
|
|
|
|
## Compiler and compilation flags
|
|
CC = $(NDK_TOOLS)/$(NDK_ARCH)-$(NDK_ABI)-gcc
|
|
CFLAGS = --sysroot=$(NDK_SYSROOT) -fPIE -pie -mthumb -O3 -DNO_SECCOMP -I$(NDK_INC) \
|
|
-std=gnu99 -Wall -Werror
|
|
LDFLAGS = --sysroot=$(NDK_SYSROOT) -fPIE -pie
|
|
|
|
# Exploit
|
|
OUT = $(current_dir)/Out/Bin
|
|
RADAMSA_SRC = src
|
|
|
|
all: clone bin
|
|
.PHONY: all radamsa.c
|
|
|
|
clone:
|
|
git clone https://github.com/aoh/radamsa.git $(RADAMSA_SRC)
|
|
#Checkout revision to make sure whole solution compiles
|
|
cd src && git checkout 1a9cc03fda47dd3706ef69f4ad971f66b273a324
|
|
|
|
radamsa.c:
|
|
$(MAKE) -C $(RADAMSA_SRC) radamsa.c
|
|
patch -p1 < android.patch
|
|
|
|
bin: radamsa.c
|
|
mkdir -p $(OUT)
|
|
$(CC) $(CFLAGS) -o $(OUT)/radamsa.o -c $(RADAMSA_SRC)/radamsa.c
|
|
$(CC) $(LDFLAGS) -o $(OUT)/radamsa $(OUT)/radamsa.o -ldl
|
|
|
|
clean:
|
|
rm -rf $(OUT)
|
|
rm -rf $(RADAMSA_SRC)
|
|
|
|
push:
|
|
adb push $(OUT)/radamsa /data/app/
|