Go to file
Luoyuan Xiao d74dfad991
Merge pull request #302 from elliott10/master
Enable PCI scan and e1000 driver in RISCV
2022-05-30 16:29:30 +08:00
.cargo bug fix: unknown syscall may happened. log: add some debug log 2022-05-18 17:13:13 +08:00
.github feat(ci): 重新打开依赖 lfs 的测例 2022-05-21 12:47:42 +08:00
.vscode feat(ci): 适用于 libos 的 musl libc so 不再依赖 git lfs 2022-05-21 12:27:40 +08:00
docs feat(xtask): cargo check-style 现在和 CI/build 一致 2022-05-12 17:01:37 +08:00
drivers To meet test CI conditions 2022-05-27 14:21:33 +08:00
kernel-hal To meet test CI conditions 2022-05-27 14:21:33 +08:00
libc-test@1426bea9f3 feat(xtask): 统一 rootfs 存放,libc-test 成为子模块 2022-05-11 09:36:50 +08:00
linux-object Add e1000 driver, and some test cases 2022-05-20 14:33:30 +08:00
linux-syscall Enable PCI scan in RISCV and x86_64 2022-05-27 13:33:14 +08:00
loader cargo fmt and clippy 2022-05-20 20:45:35 +08:00
prebuilt feat(ci): 适用于 libos 的 musl libc so 不再依赖 git lfs 2022-05-21 12:27:40 +08:00
rboot@97e48ba1bd update lock of buddy_system_allocator 2022-04-09 15:59:54 +08:00
scripts merge master 2022-03-22 22:26:25 +08:00
tests@0915ffe995 According to the result of CI test, change the status of some testcases from OK to PARTIAL 2022-05-30 16:19:19 +08:00
xtask feat(ci): 适用于 libos 的 musl libc so 不再依赖 git lfs 2022-05-21 12:27:40 +08:00
zCore Enable PCI scan in RISCV and x86_64 2022-05-27 13:33:14 +08:00
zircon-object To accommodate large user programs 2022-05-12 16:35:35 +08:00
zircon-syscall style 2022-05-12 16:56:55 +08:00
zircon-user Rewrite zCore/Makefile, use uppercase input args for `make` 2021-10-26 01:31:22 +08:00
.gitattributes refine prebuilt and update README 2020-03-02 21:01:37 +08:00
.gitignore refactor(xtask): miniroofs.tar.* 撤离 prebuilt 目录 2022-05-11 10:24:09 +08:00
.gitmodules feat(xtask): 统一 rootfs 存放,libc-test 成为子模块 2022-05-11 09:36:50 +08:00
Cargo.toml Update tests subdir 2022-05-26 16:31:09 +08:00
LICENSE update README and LICENSE 2020-01-23 11:33:25 +08:00
Makefile refactor(xtask): 选择架构改用参数 2022-05-13 13:34:25 +08:00
README.md feat(xtask): 下载文件先放到临时位置 2022-05-09 20:16:07 +08:00
rust-toolchain.toml build: update deps 2022-05-10 14:07:40 +08:00

README.md

zCore

CI Docs Coverage Status

Reimplement Zircon microkernel in safe Rust as a userspace program!

Manual

This is a new simple chinese manual.

Dev Status

🚧 Working In Progress

  • 2020.04.16: Zircon console is working on zCore! 🎉

Quick start for RISCV64

make riscv-image
cd zCore
make run ARCH=riscv64 LINUX=1

Getting started

Environments

Developing environment info

  • current rustc -- rustc 1.60.0-nightly (5e57faa78 2022-01-19)
  • current rust-toolchain -- nightly-2022-01-20
  • current qemu -- 5.2.0 -> 6.2.0

Clone repo and pull prebuilt fuchsia images:

git clone https://github.com/rcore-os/zCore --recursive
cd zCore
git lfs install
git lfs pull

For users in China, there's a mirror you can try:

git clone https://github.com.cnpmjs.org/rcore-os/zCore --recursive

Run zcore in libos mode

Run zcore in linux-libos mode

  • step 1: Prepare Alpine Linux rootfs:

    make rootfs
    
  • step 2: Compile & Run native Linux program (Busybox) in libos mode:

    cargo run --release --features "linux libos" -- /bin/busybox [args]
    

    You can also add the feature graphic to show the graphical output (with sdl2 installed).

    To debug, set the LOG environment variable to one of error, warn, info, debug, trace.

Run native Zircon program (shell) in zircon-libos mode:

  • step 1: Compile and Run Zircon shell

    cargo run --release --features "zircon libos" -- prebuilt/zircon/x64/bringup.zbi
    

    The graphic and LOG options are the same as Linux.

Run zcore in bare-metal mode

Run Linux shell in linux-bare-metal mode:

  • step 1: Prepare Alpine Linux rootfs:

    make rootfs
    
  • step 2: Create Linux rootfs image:

    Note: Before below step, you can add some special apps in zCore/rootfs

    make image
    
  • step 3: Build and run zcore in linux-bare-metal mode:

    cd zCore && make run MODE=release LINUX=1 [LOG=warn] [GRAPHIC=on] [ACCEL=1]
    

Run Zircon shell in zircon-bare-metal mode:

  • step 1: Build and run zcore in zircon-bare-metal mode:

    cd zCore && make run MODE=release [LOG=warn] [GRAPHIC=on] [ACCEL=1]
    
  • step 2: Build and run your own Zircon user programs:

    # See template in zircon-user
    cd zircon-user && make zbi MODE=release
    
    # Run your programs in zCore
    cd zCore && make run MODE=release USER=1 [LOG=warn] [GRAPHIC=on] [ACCEL=1]
    

Testing

LibOS Mode Testing

Run Zircon official core-tests:

pip3 install pexpect
cd scripts && python3 unix-core-testone.py 'Channel.*'

Run all (non-panicked) core-tests for CI:

pip3 install pexpect
cd scripts && python3 unix-core-tests.py
# Check `zircon/test-result.txt` for results.

Run Linux musl libc-tests for CI:

make rootfs && make libc-test
cd scripts && python3 libos-libc-tests.py
# Check `linux/test-result.txt` for results.

Bare-metal Mode Testing

Run Zircon official core-tests on bare-metal:

cd zCore && make test MODE=release [ACCEL=1] TEST_FILTER='Channel.*'

Run all (non-panicked) core-tests for CI:

pip3 install pexpect
cd scripts && python3 core-tests.py
# Check `zircon/test-result.txt` for results.

Run Linux musl libc-tests for CI:

##  Prepare rootfs with libc-test apps
make baremetal-test-img
## Build zCore kernel
cd zCore && make build MODE=release LINUX=1 ARCH=x86_64
## Testing
cd scripts && python3 baremetal-libc-test.py
##

You can use scripts/baremetal-libc-test-ones.py & scripts/linux/baremetal-test-ones.txt to test specified apps.

scripts/linux/baremetal-test-fail.txt includes all failed x86-64 apps (We need YOUR HELP to fix bugs!)

Run Linux musl libc-tests for CI:

##  Prepare rootfs with libc-test & oscomp apps
make riscv-image
## Build zCore kernel & Testing
cd scripts && python3 baremetal-test-riscv64.py
##

You can usescripts/baremetal-libc-test-ones-riscv64.py & scripts/linux/baremetal-test-ones-rv64.txtto test specified apps.

scripts/linux/baremetal-test-fail-riscv64.txtincludes all failed riscv-64 apps (We need YOUR HELP to fix bugs!)

Graph/Game

snake game: https://github.com/rcore-os/rcore-user/blob/master/app/src/snake.c

Step1: compile usr app

We can use musl-gcc compile it in x86_64 mode

Step2: change zcore for run snake app first.

change zCore/zCore/main.rs L176 vec!["/bin/busybox".into(), "sh".into()] TO vec!["/bin/snake".into(), "sh".into()]

Step3: prepare root fs image, run zcore in linux-bare-metal mode

exec:

cd zCore #zCore ROOT DIR
make rootfs
cp ../rcore-user/app/snake rootfs/bin #copy snake ELF file to rootfs/bin
make image # build rootfs image
cd zCore #zCore kernel dir
make run MODE=release LINUX=1 GRAPHIC=on

Then you can play the game. Operation

  • Keyboard
    • W/A/S/D: Move
    • R: Restart
    • ESC: End
  • Mouse
    • Left: Speed up
    • Right: Slow down
    • Middle: Pause/Resume

Doc

make doc

RISC-V 64 porting info

Components

Overview

Hardware Abstraction Layer

Bare Metal Linux / macOS
Virtual Memory Management Page Table Mmap
Thread Management executor async-std::task
Exception Handling Interrupt Signal

Small Goal & Little Plans