From 507dcdfb0069166242ad38e3137ce0d3352ba963 Mon Sep 17 00:00:00 2001 From: Philip Papurt Date: Sat, 10 Jul 2021 23:07:29 -0400 Subject: [PATCH 1/3] feat: add arm64 builds --- .github/workflows/ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9d151a..802b590 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,9 +11,19 @@ jobs: - uses: actions/setup-go@v2 with: go-version: 1.16.5 + - run: | + sudo dpkg --add-architecture arm64 + echo ' + deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe multiverse + deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe multiverse + ' | sudo tee /etc/apt/sources.list.d/arm64.list + sudo apt-get update || true + sudo apt-get install -y gcc-aarch64-linux-gnu libgmp-dev:arm64 - uses: actions/checkout@v2 - name: go build - run: go build -v -ldflags '-w -s -extldflags -static' -o redpwnpow-linux-amd64 ./cmd/redpwnpow + run: | + go build -v -ldflags '-w -s -extldflags -static' -o redpwnpow-linux-amd64 ./cmd/redpwnpow + CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOARCH=arm64 go build -v -ldflags '-w -s -extldflags -static' -o redpwnpow-linux-arm64 ./cmd/redpwnpow - uses: actions/upload-artifact@v2 with: name: linux From 909660c9f728db57ea66504eda8d761ac4cb9256 Mon Sep 17 00:00:00 2001 From: Philip Papurt Date: Sun, 11 Jul 2021 04:39:04 -0400 Subject: [PATCH 2/3] feat: add armv6l builds --- .github/workflows/ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 802b590..3cde1a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,18 +12,21 @@ jobs: with: go-version: 1.16.5 - run: | + sudo apt-get install -y gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf sudo dpkg --add-architecture arm64 + sudo dpkg --add-architecture armhf echo ' - deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe multiverse - deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe multiverse - ' | sudo tee /etc/apt/sources.list.d/arm64.list + deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe multiverse + deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe multiverse + ' | sudo tee /etc/apt/sources.list.d/arm.list sudo apt-get update || true - sudo apt-get install -y gcc-aarch64-linux-gnu libgmp-dev:arm64 + sudo apt-get install libgmp-dev:arm64 libgmp-dev:armhf - uses: actions/checkout@v2 - name: go build run: | go build -v -ldflags '-w -s -extldflags -static' -o redpwnpow-linux-amd64 ./cmd/redpwnpow CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOARCH=arm64 go build -v -ldflags '-w -s -extldflags -static' -o redpwnpow-linux-arm64 ./cmd/redpwnpow + CC=arm-linux-gnueabihf-gcc CGO_ENABLED=1 GOARCH=arm go build -v -ldflags '-w -s -extldflags -static' -o redpwnpow-linux-armv6l ./cmd/redpwnpow - uses: actions/upload-artifact@v2 with: name: linux From a25d0480d58d6ce94f8f952935da8d43dbc43c3a Mon Sep 17 00:00:00 2001 From: Philip Papurt Date: Sun, 11 Jul 2021 04:39:19 -0400 Subject: [PATCH 3/3] feat: use arm builds in run.sh --- cmd/redpwnpow/run.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/redpwnpow/run.sh b/cmd/redpwnpow/run.sh index 1087508..78a834b 100755 --- a/cmd/redpwnpow/run.sh +++ b/cmd/redpwnpow/run.sh @@ -4,10 +4,15 @@ set -e version=VERSION -challenge=$1 run() { case $(uname | tr '[:upper:]' '[:lower:]') in - linux*) release=linux-amd64;; + linux*) + case $(uname -m) in + x86_64) release=linux-amd64;; + aarch64) release=linux-arm64;; + arm*) release=linux-armv6l;; + *) echo unknown linux architecture >&2; exit 1 + esac;; darwin*) release=darwin-amd64;; msys*|mingw*|cygwin*) release=windows-amd64.exe;; *) echo unknown operating system >&2; exit 1 @@ -16,6 +21,6 @@ run() { mkdir -p "$cache_root" cache_path=$cache_root/redpwnpow-$version-$release [ -e "$cache_path" ] || curl -sSfLo "$cache_path" "https://github.com/redpwn/pow/releases/download/$version/redpwnpow-$release" && chmod u+x "$cache_path" - "$cache_path" "$challenge" + "$cache_path" "$@" } -run +run "$@"