diff options
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | standalone-tools/Makefile | 12 |
2 files changed, 18 insertions, 3 deletions
@@ -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 +help: + @echo "Type \`make zip' to create a flashable zip, or type \`make push' to push tools to a running device using adb." clean: 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 .SECONDARY: |