Skip to content

Commit

Permalink
refactor: arm64 default
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrpdev committed Sep 8, 2024
1 parent 8c910e7 commit 119b623
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
rustflags = ["-C", "target-feature=+crt-static"]

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
21 changes: 14 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,27 @@ jobs:
- name: Restore Apt packages
uses: awalsh128/[email protected]
with:
packages: libclang1 gcc-arm-linux-gnueabihf
packages: libclang1 gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
version: "1.0"

- name: Install Rust toolchain
uses: dtolnay/[email protected]
with:
targets: armv7-unknown-linux-gnueabihf
targets: "armv7-unknown-linux-gnueabihf,aarch64-unknown-linux-gnu"

- name: Restore Rust cache
uses: Swatinem/[email protected]

- name: Build
run: cargo build --locked --release --target=armv7-unknown-linux-gnueabihf
- name: Static build (ARM64)
run: RUSTFLAGS='-C target-feature=+crt-static' cargo build --locked --release --target=aarch64-unknown-linux-gnu

- name: Rename binary
run: cp target/armv7-unknown-linux-gnueabihf/release/rspi-bios ./rspi-bios-armv7-unknown-linux-gnu
- name: Static build (ARMv7)
run: RUSTFLAGS='-C target-feature=+crt-static' cargo build --locked --release --target=armv7-unknown-linux-gnueabihf

- name: Rename binaries
run: |
cp target/aarch64-unknown-linux-gnu/release/rspi-bios ./rspi-bios-aarch64-unknown-linux-gnu
cp target/armv7-unknown-linux-gnueabihf/release/rspi-bios ./rspi-bios-armv7-unknown-linux-gnueabihf
- name: Tag
id: tag
Expand All @@ -51,5 +56,7 @@ jobs:
uses: softprops/[email protected]
with:
tag_name: ${{ steps.tag.outputs.new_tag }}
files: "rspi-bios-armv7-unknown-linux-gnu"
fail_on_unmatched_files: true
files: |
"rspi-bios-aarch64-unknown-linux-gnu"
"rspi-bios-armv7-unknown-linux-gnueabihf"
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@
# Install dependencies (Ubuntu 24.04 LTS)
# You may need some or all of these
# See https://aws.github.io/aws-lc-rs/requirements/linux.html
sudo apt-get install -y clang libclang1 cmake gcc-arm-linux-gnueabihf
sudo apt-get install -y clang libclang1 cmake gcc-aarch64-linux-gnu
# (32-bit ARMv7) sudo apt-get install -y gcc-arm-linux-gnueabihf
cargo install --force --locked bindgen-cli

# Add target (linker already configured for you in ./.cargo/config.toml)
rustup target add armv7-unknown-linux-gnueabihf
rustup target add aarch64-unknown-linux-gnu
# (32-bit ARMv7) rustup target add armv7-unknown-linux-gnueabihf

# Build
cargo build --release --target=armv7-unknown-linux-gnueabihf
cargo build --release --target=aarch64-unknown-linux-gnu
# (32-bit ARMv7) cargo build --release --target=armv7-unknown-linux-gnueabihf
# Set RUSTFLAGS='-C target-feature=+crt-static' if target uses older version of glibc
```

You can then copy and run the outputted binary like this:
Expand Down

0 comments on commit 119b623

Please sign in to comment.