Compare commits
No commits in common. "cc3ebba1f9177424df25acbd0ffe0771e77b57c2" and "3c614f48bd10116cc8230ab41089e031e02e23c2" have entirely different histories.
cc3ebba1f9
...
3c614f48bd
|
@ -7,7 +7,7 @@ steps:
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
registry: git.merp.digital
|
registry: git.merp.digital
|
||||||
when:
|
when:
|
||||||
- event: [push, manual]
|
- event: push
|
||||||
branch:
|
branch:
|
||||||
exclude: [develop, master]
|
exclude: [develop, master]
|
||||||
|
|
||||||
|
|
|
@ -6,5 +6,4 @@ RUN git clone https://github.com/OnionIoT/source.git
|
||||||
COPY openwrt-build-config source/.config
|
COPY openwrt-build-config source/.config
|
||||||
|
|
||||||
ENV FORCE_UNSAFE_CONFIGURE=1
|
ENV FORCE_UNSAFE_CONFIGURE=1
|
||||||
ENV CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-musl-gcc
|
|
||||||
RUN cd source && make -j12
|
RUN cd source && make -j12
|
40
README.md
40
README.md
|
@ -1,43 +1,35 @@
|
||||||
# onion2s-build
|
# onion2s-build
|
||||||
Docker image for cross to build Rust packages for the Onion Omega 2S(+)
|
Docker image for cross to build rust packages for the Onion Omega 2S(+)
|
||||||
|
|
||||||
## Prerequisites
|
## 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:
|
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
|
```sh
|
||||||
cargo install cross
|
cargo install cross --git https://github.com/cross-rs/cross
|
||||||
```
|
```
|
||||||
|
|
||||||
You will also need to install the nightly toolchain of Rust for your platform:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
rustup install nightly
|
|
||||||
```
|
|
||||||
|
|
||||||
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
|
## Configuration
|
||||||
To compile for the Onion Omega 2S(+) you need to add the following configuration to your `Cargo.toml`:
|
To compile for the Onion Omega 2S(+) you need to add the following configuration:
|
||||||
|
|
||||||
|
Cargo.toml:
|
||||||
```toml
|
```toml
|
||||||
[package.metadata.cross.target.mipsel-unknown-linux-musl]
|
[workspace.metadata.cross.target.mipsel-unknown-linux-musl]
|
||||||
image = "git.merp.digital/zenermerps/onion2s-build:latest"
|
image = "git.merp.digital/zenermerps/onion2s-build:latest"
|
||||||
build-std = true
|
build-std = ["std"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
.cargo/config:
|
||||||
|
```toml
|
||||||
|
[target.mipsel-unknown-linux-musl]
|
||||||
|
linker = "/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-musl-gcc"
|
||||||
|
```
|
||||||
|
_Note_: cargo will complain that this location is deprecated, however (at least on macOS) moving the file to the suggested location results in an error about `Cargo.toml` not being found (while a `cargo.toml` exists). I assume this is due to some discrepancy between macOS's case-insensitive vs Linux's case-sensistive file system.
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
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(+).
|
You then can use `cross` as replacement for `cargo`, you need to specify the target with: `--target mipsel-unknown-linux-musl`, this is all you need to compile for the Onion Omega 2S(+).
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cross +nightly build --release --target mipsel-unknown-linux-musl
|
cross build --release --target mipsel-unknown-linux-musl
|
||||||
```
|
```
|
Loading…
Reference in a new issue