From 5fa3d53372b058ffd696b5cafe3f3b2b04e7fdca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pascal=20Eng=C3=A9libert?= <tuxmain@zettascript.org>
Date: Tue, 28 Nov 2023 11:10:42 +0100
Subject: [PATCH] doc: cross-compile for aarch64 (nodes/rust/duniter-v2s!198)

* doc: cross-compile for aarch64
---
 docs/user/build-for-arm.md | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/docs/user/build-for-arm.md b/docs/user/build-for-arm.md
index 90ab18f38..708373231 100644
--- a/docs/user/build-for-arm.md
+++ b/docs/user/build-for-arm.md
@@ -1,5 +1,9 @@
 # How to build duniter-v2s for arm
 
+Cross-compile Duniter to arm (e.g. Raspberry Pi).
+
+## With Docker
+
 1. Create a docker image that contains the build environment
 
 ```bash
@@ -13,3 +17,20 @@ docker build -t duniter-v2s-arm-builder -f docker/cross-arm.Dockerfile .
 ```
 
 then, get the final binary at `target/armv7-unknown-linux-gnueabihf/release/duniter`.
+
+## Without Docker
+
+**Warning**: armv7 (default for Raspberry Pi) is **not** supported. Linux on RPi can be easily switched to aarch64, please search how to do so on the Internet.
+
+This produces a musl build: the resulting executable is static, hence more portable than a dynamic one. It will be compatible with systems older than the compilation host.
+
+```bash
+# Install the tools
+rustup target add aarch64-unknown-linux-musl --toolchain nightly-2023-08-23-x86_64-unknown-linux-musl
+sudo dpkg --add-architecture arm64
+sudo apt update
+sudo apt install musl-dev:arm64 musl-tools g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
+
+# Cross-compile
+CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc cargo build --target=aarch64-unknown-linux-musl --release
+```
-- 
GitLab