Skip to content

Commit 4668911

Browse files
authored
Merge pull request #6 from ZhangHanDong/main
为实验环境增加 Dockerfile 支持
2 parents 1346fb1 + 9196963 commit 4668911

File tree

4 files changed

+50
-1
lines changed

4 files changed

+50
-1
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*/*

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM ubuntu:18.04
2+
LABEL maintainer="dinghao188" \
3+
version="1.1" \
4+
description="ubuntu 18.04 with tools for tsinghua's rCore-Tutorial-V3"
5+
6+
#install some deps
7+
RUN set -x \
8+
&& apt-get update \
9+
&& apt-get install -y curl wget autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
10+
gawk build-essential bison flex texinfo gperf libtool patchutils bc xz-utils \
11+
zlib1g-dev libexpat-dev pkg-config libglib2.0-dev libpixman-1-dev git tmux python3
12+
13+
#install rust and qemu
14+
RUN set -x; \
15+
RUSTUP='/root/rustup.sh' \
16+
&& cd $HOME \
17+
#install rust
18+
&& curl https://sh.rustup.rs -sSf > $RUSTUP && chmod +x $RUSTUP \
19+
&& $RUSTUP -y --default-toolchain nightly --profile minimal \
20+
21+
#compile qemu
22+
&& wget https://ftp.osuosl.org/pub/blfs/conglomeration/qemu/qemu-5.0.0.tar.xz \
23+
&& tar xvJf qemu-5.0.0.tar.xz \
24+
&& cd qemu-5.0.0 \
25+
&& ./configure --target-list=riscv64-softmmu,riscv64-linux-user \
26+
&& make -j$(nproc) install \
27+
&& cd $HOME && rm -rf qemu-5.0.0 qemu-5.0.0.tar.xz
28+
29+
#for chinese network
30+
RUN set -x; \
31+
APT_CONF='/etc/apt/sources.list'; \
32+
CARGO_CONF='/root/.cargo/config'; \
33+
BASHRC='/root/.bashrc' \
34+
&& echo 'export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static' >> $BASHRC \
35+
&& echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup' >> $BASHRC \
36+
&& touch $CARGO_CONF \
37+
&& echo '[source.crates-io]' > $CARGO_CONF \
38+
&& echo "replace-with = 'ustc'" >> $CARGO_CONF \
39+
&& echo '[source.ustc]' >> $CARGO_CONF \
40+
&& echo 'registry = "git://mirrors.ustc.edu.cn/crates.io-index"' >> $CARGO_CONF

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DOCKER_NAME ?= dinghao188/rcore-tutorial
2+
.PHONY: docker build_docker
3+
4+
docker:
5+
docker run --rm -it --mount type=bind,source=$(shell pwd),destination=/mnt ${DOCKER_NAME}
6+
7+
build_docker:
8+
docker build -t ${DOCKER_NAME} .

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# rCore-Tutorial-v3
2-
rCore-Tutorial version 3.
2+
rCore-Tutorial version 3.

0 commit comments

Comments
 (0)