diff --git a/README.md b/README.md index 155fc08a..773cecad 100644 --- a/README.md +++ b/README.md @@ -20,27 +20,31 @@ Supported architectures and boards: ### Environment * [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 -* [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 -```bash -$ rustup component add rust-src llvm-tools-preview -$ cargo install cargo-binutils -$ cargo install cargo-xbuild -``` - ```bash $ git clone https://github.com/rcore-os/rCore.git --recursive $ 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 -$ make run arch={riscv32,riscv64,x86_64,aarch64,mipsel} mode=release -$ make run arch=x86_64 mode=release pci_passthru=0000:00:00.1 # for ixgbe real nic, find its pci (bus, dev, func) first +$ make run arch={riscv32,riscv64,x86_64,aarch64,mipsel} ``` ## Maintainers diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile new file mode 100644 index 00000000..4fa008db --- /dev/null +++ b/tools/docker/Dockerfile @@ -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 diff --git a/tools/docker/build.sh b/tools/docker/build.sh new file mode 100644 index 00000000..45899c7b --- /dev/null +++ b/tools/docker/build.sh @@ -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 .