1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-21 23:56:18 +04:00

add Dockerfile and update README

This commit is contained in:
Runji Wang 2019-10-05 14:38:43 +08:00
parent fa4a7ea8af
commit 2cc56b56b5
3 changed files with 50 additions and 12 deletions

View File

@ -20,27 +20,31 @@ Supported architectures and boards:
### Environment ### Environment
* [Rust](https://www.rust-lang.org) toolchain * [Rust](https://www.rust-lang.org) toolchain
* Cargo tools: [cargo-xbuild](https://github.com/rust-osdev/cargo-xbuild) * Cargo tools: [cargo-xbuild](https://github.com/rust-osdev/cargo-xbuild), [cargo-binutils](https://github.com/rust-embedded/cargo-binutils)
* [QEMU](https://www.qemu.org) >= 3.1.0 * [QEMU](https://www.qemu.org) >= 3.1.0
* [musl-based GCC toolchains](https://musl.cc/) * [musl-based GCC toolchains](https://musl.cc/) (only for building [user programs](https://github.com/rcore-os/rcore-user))
See [Travis script](./.travis.yml) for details. Setup on Linux or macOS:
```bash
$ rustup component add rust-src llvm-tools-preview
$ cargo install cargo-binutils cargo-xbuild
```
Or use Docker container:
```bash
$ docker run -it -v $PWD:$PWD -w $PWD wangrunji0408/rcore
```
### How to run ### How to run
```bash
$ rustup component add rust-src llvm-tools-preview
$ cargo install cargo-binutils
$ cargo install cargo-xbuild
```
```bash ```bash
$ git clone https://github.com/rcore-os/rCore.git --recursive $ git clone https://github.com/rcore-os/rCore.git --recursive
$ cd rCore/user $ cd rCore/user
$ make sfsimg arch={riscv32,riscv64,x86_64,aarch64,mipsel} # requires $(arch)-linux-musl-gcc $ make sfsimg prebuilt=1 arch={riscv32,riscv64,x86_64,aarch64,mipsel}
$ cd ../kernel $ cd ../kernel
$ make run arch={riscv32,riscv64,x86_64,aarch64,mipsel} mode=release $ make run arch={riscv32,riscv64,x86_64,aarch64,mipsel}
$ make run arch=x86_64 mode=release pci_passthru=0000:00:00.1 # for ixgbe real nic, find its pci (bus, dev, func) first
``` ```
## Maintainers ## Maintainers

27
tools/docker/Dockerfile Normal file
View File

@ -0,0 +1,27 @@
FROM rust:latest
# install QEMU
ADD qemu-4.1.0.tar.xz .
RUN cd qemu-4.1.0 \
&& ./configure --target-list=riscv32-softmmu,riscv64-softmmu,mipsel-softmmu,aarch64-softmmu,x86_64-softmmu \
&& make -j
ENV PATH=$PWD/qemu-4.1.0/riscv32-softmmu:$PWD/qemu-4.1.0/riscv64-softmmu:$PWD/qemu-4.1.0/mipsel-softmmu:$PWD/qemu-4.1.0/aarch64-softmmu:$PWD/qemu-4.1.0/x86_64-softmmu:$PWD/qemu-4.1.0:$PATH
# install musl-gcc toolchain
ADD aarch64-linux-musl-cross.tgz .
ADD riscv32-linux-musl-cross.tgz .
ADD riscv64-linux-musl-cross.tgz .
ADD mipsel-linux-musln32-cross.tgz .
ADD x86_64-linux-musl-cross.tgz .
ENV PATH=$PWD/aarch64-linux-musl-cross/bin:$PWD/riscv32-linux-musl-cross/bin:$PWD/riscv64-linux-musl-cross/bin:$PWD/mipsel-linux-musln32-cross/bin:$PWD/x86_64-linux-musl-cross/bin:$PATH
# install others
RUN apt update \
&& apt install less device-tree-compiler -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# install Rust tools
RUN cargo install cargo-binutils cargo-xbuild
RUN rustup toolchain add nightly-2019-07-15
RUN rustup component add rust-src llvm-tools-preview --toolchain nightly-2019-07-15

7
tools/docker/build.sh Normal file
View File

@ -0,0 +1,7 @@
wget https://download.qemu.org/qemu-4.1.0.tar.xz
wget https://musl.cc/aarch64-linux-musl-cross.tgz
wget https://more.musl.cc/8/x86_64-linux-musl/riscv32-linux-musl-cross.tgz
wget https://musl.cc/riscv64-linux-musl-cross.tgz
wget https://musl.cc/mipsel-linux-musln32-cross.tgz
wget https://musl.cc/x86_64-linux-musl-cross.tgz
docker build -t rcore .