Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-compile for armhf #5

Merged
merged 5 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/build-raspberry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build for Raspberry Pi

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Download ARM Toolchain
run: |
pushd /tmp
wget "https://developer.arm.com/-/media/Files/downloads/gnu-a/10.2-2020.11/binrel/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf.tar.xz?revision=d0b90559-3960-4e4b-9297-7ddbc3e52783&la=en&hash=985078B758BC782BC338DB947347107FBCF8EF6B" \
-O gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf.tar.xz
tar xf gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf.tar.xz

- name: Install Standard Rust library for Raspberry Pi 2/3/4
run: |
rustup target add armv7-unknown-linux-gnueabihf

- name: Perform build
run: |
./cross-compile-armv7.sh
env:
ARMHF_TOOLCHAIN_PATH: "/tmp/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/"

- name: Upload application
uses: actions/upload-artifact@v2
if: github.ref == 'refs/heads/main'
with:
name: dsmr-rs
path: target/armv7-unknown-linux-gnueabihf/release/dsmr-rs
5 changes: 5 additions & 0 deletions cross-compile-armv7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -euo pipefail

PATH=$ARMHF_TOOLCHAIN_PATH/bin:$PATH \
cargo build --target armv7-unknown-linux-gnueabihf --release --features ""