fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.6 KiB107 linesraw
1# based on armhf-gnu/Dockerfile
2FROM ubuntu:20.04
3
4RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
5RUN apt-get update -y && apt-get install -y --no-install-recommends \
6    bc \
7    bison \
8    ca-certificates \
9    cmake \
10    cpio \
11    curl \
12    debian-ports-archive-keyring \
13    debootstrap \
14    flex \
15    gcc \
16    gcc-riscv64-linux-gnu \
17    git \
18    g++-riscv64-linux-gnu \
19    g++ \
20    libc6-dev \
21    libc6-dev-riscv64-cross \
22    libssl-dev \
23    make \
24    ninja-build \
25    patch \
26    python3 \
27    qemu-system-misc \
28    xz-utils
29
30ENV ARCH=riscv
31ENV CROSS_COMPILE=riscv64-linux-gnu-
32
33WORKDIR /build
34
35# From https://github.com/michaeljclark/busybear-linux/blob/master/conf/linux.config
36COPY host-x86_64/riscv64gc-linux/linux.config /build
37
38# Compile the kernel that we're going to be emulating with. This is
39# basically just done to be compatible with the QEMU target that we're going
40# to be using when running tests.
41RUN curl https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.16.tar.xz | tar xJf - && \
42    cp linux.config linux-5.6.16/.config && \
43    cd /build/linux-5.6.16 && \
44    make olddefconfig && \
45    make -j$(nproc) vmlinux && \
46    cp vmlinux /tmp && \
47    rm -rf linux-5.6.16
48
49# Compile an instance of busybox as this provides a lightweight system and init
50# binary which we will boot into. Only trick here is configuring busybox to
51# build static binaries.
52RUN curl https://busybox.net/downloads/busybox-1.31.1.tar.bz2 | tar xjf -
53COPY host-x86_64/riscv64gc-linux/0001-Remove-stime-function-calls.patch /build/busybox-1.31.1/
54RUN cd /build/busybox-1.31.1 && \
55    patch -p1 -i 0001-Remove-stime-function-calls.patch && \
56    make defconfig && \
57    sed -i 's/.*CONFIG_STATIC.*/CONFIG_STATIC=y/' .config && \
58    make -j$(nproc) && \
59    make install && \
60    mv _install /tmp/rootfs && \
61    cd /build && \
62    rm -rf busybox-1.31.1
63
64# Download the ubuntu rootfs, which we'll use as a chroot for all our tests
65# This is only needed to provide /lib/* and /usr/lib/*
66WORKDIR /tmp
67RUN debootstrap --variant=minbase --arch=riscv64 --foreign focal /tmp/rootfs/ubuntu
68RUN cd rootfs && mkdir proc sys dev etc etc/init.d
69# rootfs/ubuntu/proc is in a weird state (access fails with ELOOP) until
70# rootfs/ubuntu/debootstrap/debootstrap --second-stage is run (under emulation),
71# but this takes ages. Instead hack it into a good enough state.
72# /proc is used by std::env::current_exe() (which is roughly
73# `readlink /proc/self/exe`)
74RUN cd rootfs/ubuntu && rm -rf proc && mkdir proc
75
76# Copy over our init script, which starts up our test server and also a few other
77# misc tasks
78COPY scripts/qemu-bare-bones-rcS rootfs/etc/init.d/rcS
79RUN chmod +x rootfs/etc/init.d/rcS
80
81# Helper to quickly fill the entropy pool in the kernel
82COPY scripts/qemu-bare-bones-addentropy.c /tmp/addentropy.c
83RUN riscv64-linux-gnu-gcc addentropy.c -o rootfs/addentropy -static
84
85# download and build the riscv bootloader
86RUN git clone https://github.com/riscv/riscv-pk
87WORKDIR /tmp/riscv-pk
88# This revision fixes a fault in recent QEMU from 64-bit accesses to the PLIC
89# commits later than this one should work too
90RUN git checkout 7d8b7c0dab72108e3ea7bb7744d3f6cc907c7ef4
91RUN mkdir build && cd build && \
92    ../configure --with-payload=/tmp/vmlinux --host=riscv64-linux-gnu && \
93    make -j$(nproc) && \
94    cp bbl /tmp
95WORKDIR /tmp
96RUN rm -rf /tmp/riscv-pk
97
98COPY scripts/cmake.sh /scripts/
99RUN /scripts/cmake.sh
100
101COPY scripts/sccache.sh /scripts/
102RUN sh /scripts/sccache.sh
103
104ENV RUST_CONFIGURE_ARGS --qemu-riscv64-rootfs=/tmp/rootfs
105ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target riscv64gc-unknown-linux-gnu
106
107ENV NO_CHANGE_USER=1