Skip to content

Commit

Permalink
Distribution CI for RISC-V GNU/Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
msizanoen1 committed Jan 11, 2020
1 parent 72b2bd5 commit 451c97b
Show file tree
Hide file tree
Showing 4 changed files with 977 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/ci/docker/dist-various-1/Dockerfile
Expand Up @@ -2,11 +2,24 @@ FROM ubuntu:16.04

RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
automake \
bison \
bzip2 \
flex \
help2man \
libtool-bin \
texinfo \
unzip \
wget \
xz-utils \
libncurses-dev \
gawk \
make \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
sudo \
Expand Down Expand Up @@ -35,6 +48,18 @@ RUN add-apt-repository ppa:team-gcc-arm-embedded/ppa && \
apt-get update && \
apt-get install -y --no-install-recommends gcc-arm-embedded

COPY scripts/rustbuild-setup.sh dist-various-1/build-riscv-toolchain.sh dist-various-1/riscv64-unknown-linux-gnu.config dist-various-1/crosstool-ng.sh /build/
RUN ./crosstool-ng.sh

# Crosstool-ng will refuse to build as root
RUN sh ./rustbuild-setup.sh
USER rustbuild

RUN ./build-riscv-toolchain.sh

USER root
ENV PATH=/x-tools/riscv64-unknown-linux-gnu/bin:$PATH

COPY dist-various-1/build-rumprun.sh /build
RUN ./build-rumprun.sh

Expand Down Expand Up @@ -129,6 +154,7 @@ ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf
ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf
ENV TARGETS=$TARGETS,riscv64imac-unknown-none-elf
ENV TARGETS=$TARGETS,riscv64gc-unknown-none-elf
ENV TARGETS=$TARGETS,riscv64gc-unknown-linux-gnu
ENV TARGETS=$TARGETS,armebv7r-none-eabi
ENV TARGETS=$TARGETS,armebv7r-none-eabihf
ENV TARGETS=$TARGETS,armv7r-none-eabi
Expand All @@ -147,6 +173,9 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \
AR_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar \
CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ \
CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \
AR_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-ar \
CXX_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-g++ \
CC_riscv32i_unknown_none_elf=false \
CC_riscv32imc_unknown_none_elf=false \
CC_riscv32imac_unknown_none_elf=false \
Expand Down
27 changes: 27 additions & 0 deletions src/ci/docker/dist-various-1/build-riscv-toolchain.sh
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -ex

hide_output() {
set +x
on_err="
echo ERROR: An error was encountered with the build.
cat /tmp/build.log
exit 1
"
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
}

mkdir -p /tmp/build-riscv
cp riscv64-unknown-linux-gnu.config /tmp/build-riscv/.config
cd /tmp/build-riscv
hide_output ct-ng build
cd ..
rm -rf build-riscv
13 changes: 13 additions & 0 deletions src/ci/docker/dist-various-1/crosstool-ng.sh
@@ -0,0 +1,13 @@
#!/bin/bash
set -ex

# Mirrored from https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.24.0.tar.gz
url="https://ci-mirrors.rust-lang.org/rustc/crosstool-ng-1.24.0.tar.gz"
curl -Lf $url | tar xzf -
cd crosstool-ng-crosstool-ng-1.24.0
./bootstrap
./configure --prefix=/usr/local
make -j$(nproc)
make install
cd ..
rm -rf crosstool-ng-crosstool-ng-1.24.0

0 comments on commit 451c97b

Please sign in to comment.