diff options
authorJason A. Donenfeld <Jason@zx2c4.com>2017-12-18 22:10:36 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-12-18 22:10:36 +0100
commit3b6ade940d7db3650a63d5efa65c3fecfc7f9ab2 (patch)
parentwg-quick: get proper command output status (diff)
standalone-tools: add make push
2 files changed, 18 insertions, 3 deletions
diff --git a/README.md b/README.md
index c7a0406..e43a2fd 100644
--- a/README.md
+++ b/README.md
@@ -35,10 +35,17 @@ If your kernel already has WireGuard, perhaps via a standalone kernel module, bu
$ cd standalone-tools
-$ make -j$(nproc)
+$ make -j$(nproc) zip
$ adb sideload wireguard-tools.zip
+Or, if you have your phone plugged in and booted up into the normal OS and have root access, you can build and push directly with:
+$ cd standalone-tools
+$ make push
## `wg-quick(8)` for Android
All of the above approaches include [`wg-quick(8)`](https://git.zx2c4.com/WireGuard/about/src/tools/wg-quick.8) for Android, which works via calls to Android's `ndc` command. Compared to the ordinary wg-quick, this one does not support `SaveConfig` and `{Pre,Post}{Up,Down}`. Put your configuration files into `/data/misc/wireguard/`. After that, the normal `wg-quick up|down` commands will work as usual. This is used automatically via the [the WireGuard Android GUI app](https://play.google.com/apps/testing/com.wireguard.android).
diff --git a/standalone-tools/Makefile b/standalone-tools/Makefile
index 1e49b07..340233a 100644
--- a/standalone-tools/Makefile
+++ b/standalone-tools/Makefile
@@ -4,7 +4,8 @@
ARCHS := $(shell ndk-build NDK_PROJECT_PATH=$(PWD)/build APP_BUILD_SCRIPT=$(PWD)/../Android.mk APP_PLATFORM=21 DUMP_NDK_KNOWN_DEVICE_ABIS 2>/dev/null)
-all: wireguard-tools.zip
+ @echo "Type \`make zip' to create a flashable zip, or type \`make push' to push tools to a running device using adb."
rm -rf build wireguard-tools.zip
@@ -27,5 +28,12 @@ wireguard-tools.zip: $(foreach ARCH,$(ARCHS),build/libs/$(ARCH)/wg-quick build/l
$(ANDROID_HOME)/build-tools/27.0.1/zipalign -v -p 4 build/unaligned-$@ build/aligned-$@
$(ANDROID_HOME)/build-tools/27.0.1/apksigner sign --key build/key.pk8 --cert build/cert.pem --min-sdk-version 21 --out $@ build/aligned-$@
-.PHONY: clean all
+zip: wireguard-tools.zip
+push: $(foreach ARCH,$(ARCHS),build/libs/$(ARCH)/wg-quick build/libs/$(ARCH)/wg)
+ ARCH="$$(adb shell 'su -c "mount -o rw,remount /system" && getprop ro.product.cpu.abi')" && \
+ adb push "build/libs/$$ARCH/wg-quick" "build/libs/$$ARCH/wg" /sdcard && \
+ adb shell 'su -c "mv /sdcard/wg /sdcard/wg-quick /system/xbin/ && chmod 755 /system/xbin/wg /system/xbin/wg-quick"'
+.PHONY: clean zip push