gnirehtet icon indicating copy to clipboard operation
gnirehtet copied to clipboard

Rasberry PI 2W

Open structdjm79 opened this issue 1 year ago • 2 comments

I have the latest 64 bit Raspbian bookworm Lite OS installed on my raspberry pi 2w, I cannot find any clear instructions on how to compile gnirehtet on my raspberry or any already made binaries for my OS, could someone provide me a binary or clear step by step instructions on compiling gnirehtet on Raspbian 64 bit bookworm Lite OS, thanks

structdjm79 avatar Nov 10 '24 20:11 structdjm79

Its java so it should work if java/open-jdk is installed. Worked for me on a RISC-V system.

Nislaco avatar Mar 25 '25 18:03 Nislaco

Option A: Compile directly on Pi (simplest) Install dependencies

sudo apt update sudo apt install git clang curl build-essential pkg-config libssl-dev Install Rust toolchain

curl https://sh.rustup.rs -sSf | sh source ~/.cargo/env Clone gnirehtet repo

git clone https://github.com/Genymobile/gnirehtet.git cd gnirehtet/relay-rust Build release binary

cargo build --release Find your binary The executable will be here:

target/aarch64-unknown-linux-gnu/release/gnirehtet 🛠️ Option B: Cross-compile on another machine Use this if your Pi is slow or you prefer cross-compiling:

Install cross-tools

sudo apt install gcc-aarch64-linux-gnu Install Rust cross-target

rustup target add aarch64-unknown-linux-gnu Add linker config (in ~/.cargo/config.toml):

[target.aarch64-unknown-linux-gnu] linker = "aarch64-linux-gnu-gcc" ar = "aarch64-linux-gnu-gcc-ar" Compile

cd gnirehtet/relay-rust cargo build --release --target=aarch64-unknown-linux-gnu Retrieve binary It appears under:

target/aarch64-unknown-linux-gnu/release/gnirehtet 📋 Notes & Additional Tips Rust v2.x supports ARM64. Use the Rust edition (relay-rust) for best CPU/speed efficiency forums.raspberrypi.com +15 github.com +15 forums.raspberrypi.com +15 github.com forums.raspberrypi.com +5 github.com +5 forums.raspberrypi.com +5 github.com +8 github.com +8 forums.raspberrypi.com +8 forums.raspberrypi.com .

Executable issues? If you accidentally download prebuilt Linux binaries, they'll be incompatible (Exec format error). Always build from source github.com +1 stackoverflow.com +1 .

Pi 2W uses 64-bit ARM (aarch64), so ensure binary matches aarch64-unknown-linux-gnu.

Once built, copy the binary to /usr/local/bin/gnirehtet (or similar) and make executable:

sudo cp path/to/gnirehtet /usr/local/bin/ sudo chmod +x /usr/local/bin/gnirehtet 🚀 Running gnirehtet On your Pi (relay server):

gnirehtet relay On your Android device: Use the gnirehtet Android client (Java or Rust). Pair over USB to establish reverse-tethering.

TL;DR Clone the repo

Install Rust (and cross-tools if needed)

Build with cargo build --release (optionally using cross-compilation)

Grab the ARM64 binary and deploy

Let me know if you'd like the full client+server setup steps, including USB pairing or init scripts!

VaradGupta23 avatar Jul 07 '25 11:07 VaradGupta23