From 7ab26d9ba012d2fe81e2facf9900ece34632782e Mon Sep 17 00:00:00 2001 From: Yifan Wu Date: Sun, 28 Feb 2021 05:59:36 +0800 Subject: [PATCH] Add Ubuntu18.04 docker --- .dockerignore | 1 + Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ Makefile | 8 ++++++++ README.md | 2 +- 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..df3359dd --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +*/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ac784bc2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM ubuntu:18.04 +LABEL maintainer="dinghao188" \ + version="1.1" \ + description="ubuntu 18.04 with tools for tsinghua's rCore-Tutorial-V3" + +#install some deps +RUN set -x \ + && apt-get update \ + && apt-get install -y curl wget autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \ + gawk build-essential bison flex texinfo gperf libtool patchutils bc xz-utils \ + zlib1g-dev libexpat-dev pkg-config libglib2.0-dev libpixman-1-dev git tmux python3 + +#install rust and qemu +RUN set -x; \ + RUSTUP='/root/rustup.sh' \ + && cd $HOME \ + #install rust + && curl https://sh.rustup.rs -sSf > $RUSTUP && chmod +x $RUSTUP \ + && $RUSTUP -y --default-toolchain nightly --profile minimal \ + + #compile qemu + && wget https://ftp.osuosl.org/pub/blfs/conglomeration/qemu/qemu-5.0.0.tar.xz \ + && tar xvJf qemu-5.0.0.tar.xz \ + && cd qemu-5.0.0 \ + && ./configure --target-list=riscv64-softmmu,riscv64-linux-user \ + && make -j$(nproc) install \ + && cd $HOME && rm -rf qemu-5.0.0 qemu-5.0.0.tar.xz + +#for chinese network +RUN set -x; \ + APT_CONF='/etc/apt/sources.list'; \ + CARGO_CONF='/root/.cargo/config'; \ + BASHRC='/root/.bashrc' \ + && echo 'export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static' >> $BASHRC \ + && echo 'export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup' >> $BASHRC \ + && touch $CARGO_CONF \ + && echo '[source.crates-io]' > $CARGO_CONF \ + && echo "replace-with = 'ustc'" >> $CARGO_CONF \ + && echo '[source.ustc]' >> $CARGO_CONF \ + && echo 'registry = "git://mirrors.ustc.edu.cn/crates.io-index"' >> $CARGO_CONF \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..2e339762 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +DOCKER_NAME ?= dinghao188/rcore-tutorial +.PHONY: docker build_docker + +docker: + docker run --rm -it --mount type=bind,source=$(shell pwd),destination=/mnt ${DOCKER_NAME} + +build_docker: + docker build -t ${DOCKER_NAME} . diff --git a/README.md b/README.md index 50834482..dd356b5f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # rCore-Tutorial-v3 -rCore-Tutorial version 3. +rCore-Tutorial version 3. \ No newline at end of file