diff --git a/.travis.yml b/.travis.yml index dda93734..229a2059 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ sudo: false -dist: xenial +dist: bionic language: rust -rust: nightly-2019-09-01 +rust: nightly-2019-07-15 os: - linux @@ -18,8 +18,11 @@ cache: addons: homebrew: + update: true + brewfile: true packages: - qemu + - dtc env: matrix: @@ -35,26 +38,11 @@ env: install: - if [ $TRAVIS_OS_NAME = linux ]; then - wget https://download.qemu.org/qemu-4.1.0.tar.xz && tar xJf qemu-4.1.0.tar.xz > /dev/null && cd qemu-4.1.0 && ./configure --target-list=$ARCH-softmmu && make && cd ..; + [ ! -d qemu-4.1.0/$ARCH-softmmu ] && wget https://download.qemu.org/qemu-4.1.0.tar.xz && tar xJf qemu-4.1.0.tar.xz > /dev/null && cd qemu-4.1.0 && ./configure --target-list=$ARCH-softmmu && make && cd ..; export PATH=$PATH:$PWD/qemu-4.1.0/$ARCH-softmmu:$PWD/qemu-4.1.0; sudo apt update; sudo apt install device-tree-compiler -y; fi - - if [ 1 ]; then - [ $ARCH = riscv32 ] && export FILE="riscv32-linux-musl-cross"; - [ $ARCH = riscv64 ] && export FILE="riscv64-linux-musl-cross"; - [ $ARCH = mipsel ] && export FILE="mipsel-linux-musln32-cross"; - [ $ARCH = aarch64 ] && export FILE="aarch64-linux-musl-cross"; - [ $ARCH = x86_64 ] && export FILE="x86_64-linux-musl-cross"; - if [ $TRAVIS_OS_NAME = linux ]; then - wget https://musl.cc/$FILE.tgz; - elif [ $TRAVIS_OS_NAME = osx ]; then - wget https://mac.musl.cc/$FILE.tgz; - fi; - tar -xf $FILE.tgz; - export PATH=$PATH:$PWD/$FILE/bin; - fi - before_script: - rustup component add rust-src llvm-tools-preview @@ -62,8 +50,9 @@ before_script: - (test -x $HOME/.cargo/bin/cargo-xbuild || cargo install cargo-xbuild) script: - - cd user && make sfsimg arch=$ARCH && cd .. + - cd user && make sfsimg arch=$ARCH prebuilt=1 && cd .. - cd kernel && make build arch=$ARCH $OPTS && cd .. - - if [ $ARCH = riscv32 ]; then - cd tests && ./test.sh && cd ..; - fi + - cd kernel && make test arch=$ARCH $OPTS && cd .. + +before_cache: + - if [ $TRAVIS_OS_NAME = osx ]; then brew cleanup; fi diff --git a/README.md b/README.md index 646dacb4..155fc08a 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Supported architectures and boards: ### Environment -* [Rust](https://www.rust-lang.org) toolchain at nightly-2019-09-01 +* [Rust](https://www.rust-lang.org) toolchain * Cargo tools: [cargo-xbuild](https://github.com/rust-osdev/cargo-xbuild) * [QEMU](https://www.qemu.org) >= 3.1.0 * [musl-based GCC toolchains](https://musl.cc/) diff --git a/kernel/Makefile b/kernel/Makefile index 5b3f1fb3..998c94c4 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -2,10 +2,8 @@ # make build Build # make run Build and run in QEMU # make justrun Run the last build -# make runnet Build and run in QEMU with nic -# make justrunnet Run the last build with nic -# make runtest Build and run in QEMU with specified program -# make justruntest Run the last build with specified program +# make test Build and run in QEMU with specified program +# make justtest Run the last build with specified program # make doc Generate docs # make asm Open the deassemble file of the last build # make header Open 'objdump -h' of the last build @@ -26,6 +24,7 @@ # | k210 Only available on riscv64, run on K210, use Sv39 # | rocket_chip Only available on riscv64, run on Rocket Chip, use Sv39 # | raspi3 Only available on aarch64, run on Raspberry Pi 3 Model B/B+ +# net = on | off Only available on x86_64, enable NIC # pci_passthru = 0000:00:00.1 Only available on x86_64, passthrough the specified PCI device # init = /bin/ls Only available on riscv64, run specified program instead of user shell # extra_nic = on | off Only available on x86_64, add an additional e1000 nic @@ -41,6 +40,7 @@ pci_passthru ?= init ?= extra_nic ?= off +qemu := qemu-system-$(arch) target := $(arch) build_path := target/$(target)/$(mode) kernel := $(build_path)/rcore @@ -182,6 +182,11 @@ ifeq ($(graphic), off) qemu_opts += -nographic endif +ifeq ($(net), on) +qemu_opts += $(qemu_net_opts) +qemu := sudo $(qemu) +endif + ### build args ### ifeq ($(graphic), off) features += nographic @@ -238,7 +243,7 @@ strip := cargo strip -- dtc := dtc hostcc := gcc -.PHONY: all clean build asm doc debug kernel sfsimg install run justrun runnet justrunnet runtest justruntest +.PHONY: all clean build asm doc debug kernel sfsimg install run justrun test justtest all: kernel @@ -251,20 +256,17 @@ doc: @cargo rustdoc -- --document-private-items run: build justrun -runnet: build justrunnet -runtest: build justruntest +test: build justtest justrun: - @qemu-system-$(arch) $(qemu_opts) + @$(qemu) $(qemu_opts) -justrunnet: build - @sudo qemu-system-$(arch) $(qemu_opts) $(qemu_net_opts) - -justruntest: build - @qemu-system-$(arch) $(filter-out -serial mon:stdio, $(qemu_opts)) --append $(init) -serial file:../tests/stdout -monitor null +justtest: + # unavailable now + @#$(qemu) $(filter-out -serial mon:stdio, $(qemu_opts)) --append $(init) -serial file:../tests/stdout -monitor null debug: $(kernel) $(kernel_img) - @qemu-system-$(arch) $(qemu_opts) -s -S & + @$(qemu) $(qemu_opts) -s -S & @sleep 1 @$(gdb) $(kernel) -x ../tools/gdbinit @@ -293,8 +295,6 @@ ifeq ($(arch), x86_64) @cd ../rboot && make build endif ifeq ($(arch), aarch64) - @echo "Patching symbols into kernel." - @../tools/fill_symbols/aarch64.sh target/aarch64/$(mode)/rcore $(prefix) @echo Building $(arch) bootloader @$(strip) $(kernel) -o $(kernel)_stripped @cd $(bootloader_dir) && make arch=$(arch) mode=$(mode) payload=../kernel/$(kernel)_stripped @@ -320,8 +320,6 @@ kernel: $(dtb) @echo Building $(arch) kernel ifeq ($(arch), x86_64) @cargo xbuild $(build_args) - @echo "Now patching kernel symbols onto kernel." - @../tools/fill_symbols/x86_64.sh target/x86_64/$(mode)/rcore else ifeq ($(arch), $(filter $(arch), riscv32 riscv64)) ifeq ($(board), k210) @cp src/arch/riscv32/board/k210/linker.ld src/arch/riscv32/boot/linker64.ld diff --git a/kernel/src/arch/mipsel/board/malta/mod.rs b/kernel/src/arch/mipsel/board/malta/mod.rs index 9363e85a..94ca1bb5 100644 --- a/kernel/src/arch/mipsel/board/malta/mod.rs +++ b/kernel/src/arch/mipsel/board/malta/mod.rs @@ -36,7 +36,7 @@ pub fn init_driver() { yres_virtual: 600, xoffset: 0, yoffset: 0, - depth: fb::ColorDepth::try_from(8)?, + depth: fb::ColorDepth::ColorDepth8, format: fb::ColorFormat::VgaPalette, paddr: 0xb0000000, vaddr: 0xb0000000, diff --git a/kernel/src/arch/mipsel/board/thinpad/mod.rs b/kernel/src/arch/mipsel/board/thinpad/mod.rs index 6ff5101f..4c600185 100644 --- a/kernel/src/arch/mipsel/board/thinpad/mod.rs +++ b/kernel/src/arch/mipsel/board/thinpad/mod.rs @@ -25,7 +25,7 @@ pub fn init_driver() { yres_virtual: 600, xoffset: 0, yoffset: 0, - depth: fb::ColorDepth::try_from(8)?, + depth: fb::ColorDepth::ColorDepth8, format: fb::ColorFormat::RGB332, paddr: 0xa2000000, vaddr: 0xa2000000, diff --git a/rust-toolchain b/rust-toolchain index 7c5822d4..cd609032 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2019-09-01 +nightly-2019-07-15 diff --git a/user b/user index 496a65e1..10ac61f9 160000 --- a/user +++ b/user @@ -1 +1 @@ -Subproject commit 496a65e1d52c112c568f004144900d09e1d008c5 +Subproject commit 10ac61f9ee5f64f2884b54719203be189ecb189d