onion2s-build/README.md

44 lines
1.6 KiB
Markdown
Raw Normal View History

2024-07-26 06:34:07 +00:00
# onion2s-build
2024-11-21 07:25:56 +00:00
Docker image for cross to build Rust packages for the Onion Omega 2S(+)
2024-07-26 06:34:07 +00:00
2024-07-26 15:37:34 +00:00
## Prerequisites
You will need to have the rustup version of cargo installed, for more information look at the official Rust documentation. You need Docker (or Podman) up and running, and you need to install cross with:
```sh
2024-11-21 07:25:56 +00:00
cargo install cross
2024-07-26 15:37:34 +00:00
```
2024-11-21 07:25:56 +00:00
You will also need to install the nightly toolchain of Rust for your platform:
2024-07-26 15:37:34 +00:00
2024-11-21 07:25:56 +00:00
```sh
rustup install nightly
2024-07-26 15:37:34 +00:00
```
2024-11-21 07:25:56 +00:00
On the first run of cross, cross will also install a nightly toolchain that is able to run in the Docker image (amd64).
### A note on ARM Macs
When trying to run cross on an ARM based Mac, docker will try to download the image for the ARM arch. Since cross doesn't provide ARM base images, this will fail. However, utilizing Rosetta, it is possible to run AMD64 images. To use those, pull the image manually using docker:
```sh
docker pull --platform linux/amd64 git.merp.digital/zenermerps/onion2s-build:latest
```
This ensures docker will find an image with the correct name and tag, and doesn't try to download the non-existing ARM version.
## Configuration
To compile for the Onion Omega 2S(+) you need to add the following configuration to your `Cargo.toml`:
2024-07-26 15:37:34 +00:00
```toml
2024-11-21 07:25:56 +00:00
[package.metadata.cross.target.mipsel-unknown-linux-musl]
image = "git.merp.digital/zenermerps/onion2s-build:latest"
build-std = true
2024-07-26 15:37:34 +00:00
```
## Build
2024-11-21 07:25:56 +00:00
You then can use `cross +nightly` as replacement for `cargo`. You need to specify the correct target with: `--target mipsel-unknown-linux-musl`, this is all you need to compile for the Onion Omega 2S(+).
2024-07-26 15:37:34 +00:00
For example:
```sh
2024-11-21 07:25:56 +00:00
cross +nightly build --release --target mipsel-unknown-linux-musl
```