Reimplement Zircon microkernel in safe Rust as a userspace program!
🚧 Working In Progress
- 2020.04.16: Zircon console is working on zCore! 🎉
make riscv-image
cd zCore
make run ARCH=riscv64 LINUX=1
Environments:
- current rustc -- rustc 1.56.0-nightly (08095fc1f 2021-07-26)
- current rust-toolchain -- nightly-2021-07-27
- current qemu -- 5.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.saobby.my.eu.org.cnpmjs.org/rcore-os/zCore --recursive
-
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 oferror
,warn
,info
,debug
,trace
.
-
step 1: Compile and Run Zircon shell
cargo run --release --features "zircon libos" -- prebuilt/zircon/x64/bringup.zbi
The
graphic
andLOG
options are the same as Linux.
-
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]
-
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]
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.
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 use scripts/baremetal-libc-test-ones-riscv64.py
& scripts/linux/baremetal-test-ones-rv64.txt
to test
specified apps.
scripts/linux/baremetal-test-fail-riscv64.txt
includes all failed riscv-64 apps (We need YOUR HELP to fix bugs!)
snake game: https://github.com/rcore-os/rcore-user/blob/master/app/src/snake.c
We can use musl-gcc compile it in x86_64 mode
change zCore/zCore/main.rs L176 vec!["/bin/busybox".into(), "sh".into()] TO vec!["/bin/snake".into(), "sh".into()]
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
: MoveR
: RestartESC
: End
- Mouse
Left
: Speed upRight
: Slow downMiddle
: Pause/Resume
make doc
Bare Metal | Linux / macOS | |
---|---|---|
Virtual Memory Management | Page Table | Mmap |
Thread Management | executor |
async-std::task |
Exception Handling | Interrupt | Signal |