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

Docker toolchain #11

Merged
merged 3 commits into from
Sep 11, 2018
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ hlua = "0.4.1"
aabb-quadtree = "0.1.0"
zstd = "0.4.14"
stopwatch = "0.0.7"
atomic = {version = "0.4", features = ["nightly"]}
atomic = {version = "= 0.4.0", features = ["nightly"]}
canselcik marked this conversation as resolved.
Show resolved Hide resolved

[features]
enable-runtime-benchmarking = []
Expand Down
25 changes: 24 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ examples:
bench:
cargo build --examples --release --target=armv7-unknown-linux-gnueabihf --features "enable-runtime-benchmarking"

.PHONY: docker-env
docker-env:
cd docker-toolchain && docker build \
--build-arg UNAME=builder \
--build-arg UID=$(shell id -u) \
--build-arg GID=$(shell id -g) \
--tag rust-build-remarkable:latest .

examples-docker: docker-env
docker volume create cargo-registry
docker run \
--rm \
--user builder \
-v $(shell pwd):/home/builder/libremarkable:rw \
-v cargo-registry:/home/builder/.cargo/registry \
-w /home/builder/libremarkable \
rust-build-remarkable:latest \
cargo build --examples --release --target=armv7-unknown-linux-gnueabihf

library:
cargo build --release --target=armv7-unknown-linux-gnueabihf

Expand All @@ -15,11 +34,15 @@ test:
cargo test

DEVICE_IP ?= "10.11.99.1"
run: examples
deploy-demo:
ssh root@$(DEVICE_IP) 'kill -9 `pidof demo` || true; systemctl stop xochitl || true'
scp ./target/armv7-unknown-linux-gnueabihf/release/examples/demo root@$(DEVICE_IP):~/
ssh root@$(DEVICE_IP) './demo'

run: examples deploy-demo

run-docker: examples-docker deploy-demo

live: examples
ssh root@$(DEVICE_IP) 'kill -9 `pidof live` || true'
scp ./target/armv7-unknown-linux-gnueabihf/release/examples/live root@$(DEVICE_IP):~/
Expand Down
2 changes: 2 additions & 0 deletions docker-toolchain/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
canselcik marked this conversation as resolved.
Show resolved Hide resolved
25 changes: 25 additions & 0 deletions docker-toolchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM ubuntu:16.04
LABEL maintainer='Charlton Rodda'

# Need to specify UID and GID so they match the external user.
# UNAME has no significance.
ARG UNAME=builder
ARG UID=1000
ARG GID=1000

RUN apt-get -qq update
RUN apt-get -qq install curl build-essential gcc-arm-linux-gnueabihf vim

RUN groupadd -g $GID $UNAME
RUN useradd -u $UID -g $GID -m $UNAME
USER $UNAME

RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
ENV PATH="${PATH}:/home/$UNAME/.cargo/bin"

RUN rustup target add armv7-unknown-linux-gnueabihf

# make the registry folder to ensure correct permissions
RUN mkdir -p "/home/$UNAME/.cargo/registry"

ADD ./.cargo/config /home/$UNAME/.cargo/config
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(integer_atomics)]
#![feature(const_size_of)]
#![feature(box_syntax)]
#![feature(nll)]

Expand Down