Update README

This commit is contained in:
Yuekai Jia 2021-10-26 02:13:57 +08:00
parent 9b6c1f5928
commit 67a0468df0
1 changed files with 83 additions and 60 deletions

143
README.md
View File

@ -1,7 +1,7 @@
# zCore # zCore
[![CI](https://github.com/rcore-os/zCore/workflows/CI/badge.svg?branch=master)](https://github.com/rcore-os/zCore/actions) [![CI](https://github.com/rcore-os/zCore/workflows/CI/badge.svg?branch=master)](https://github.com/rcore-os/zCore/actions)
[![Docs](https://img.shields.io/badge/docs-alpha-blue)](https://rcore-os.github.io/zCore/zircon_object/) [![Docs](https://img.shields.io/badge/docs-alpha-blue)](https://rcore-os.github.io/zCore/)
[![Coverage Status](https://coveralls.io/repos/github/rcore-os/zCore/badge.svg?branch=master)](https://coveralls.io/github/rcore-os/zCore?branch=master) [![Coverage Status](https://coveralls.io/repos/github/rcore-os/zCore/badge.svg?branch=master)](https://coveralls.io/github/rcore-os/zCore?branch=master)
Reimplement [Zircon][zircon] microkernel in safe Rust as a userspace program! Reimplement [Zircon][zircon] microkernel in safe Rust as a userspace program!
@ -13,7 +13,8 @@ Reimplement [Zircon][zircon] microkernel in safe Rust as a userspace program!
- 2020.04.16: Zircon console is working on zCore! 🎉 - 2020.04.16: Zircon console is working on zCore! 🎉
## Quick start for RISCV64 ## Quick start for RISCV64
```
```sh
make riscv-image make riscv-image
cd zCore cd zCore
make run ARCH=riscv64 LINUX=1 make run ARCH=riscv64 LINUX=1
@ -27,7 +28,6 @@ Environments
* [QEMU](https://www.qemu.org) * [QEMU](https://www.qemu.org)
* [Git LFS](https://git-lfs.github.com) * [Git LFS](https://git-lfs.github.com)
### Developing environment info ### Developing environment info
- current rustc -- rustc 1.56.0-nightly (08095fc1f 2021-07-26) - current rustc -- rustc 1.56.0-nightly (08095fc1f 2021-07-26)
- current rust-toolchain -- nightly-2021-07-27 - current rust-toolchain -- nightly-2021-07-27
@ -49,75 +49,108 @@ git clone https://github.com.cnpmjs.org/rcore-os/zCore --recursive
``` ```
### Run zcore in libos mode ### Run zcore in libos mode
#### Run zcore in linux-libos mode #### Run zcore in linux-libos mode
##### step1: Prepare Alpine Linux rootfs: * step 1: Prepare Alpine Linux rootfs:
```sh ```sh
make rootfs make rootfs
``` ```
##### step2: Compile&Run native Linux program (Busybox) in libos mode: * step 2: Compile & Run native Linux program (Busybox) in libos mode:
```sh ```sh
cargo run --release --features "linux libos" -- /bin/busybox [args] cargo run --release --features "linux libos" -- /bin/busybox [args]
``` ```
You can also add the feature `graphic` to show the graphical output (with [sdl2](https://www.libsdl.org) installed). You can also add the feature `graphic` to show the graphical output (with [sdl2](https://www.libsdl.org) installed).
To debug, set `LOG` environment variable to one of `error`, `warn`, `info`, `debug`, `trace`. To debug, set the `LOG` environment variable to one of `error`, `warn`, `info`, `debug`, `trace`.
#### Run native Zircon program (shell) in zircon-libos mode: #### Run native Zircon program (shell) in zircon-libos mode:
#### step1: Compile and Run Zircon shell * step 1: Compile and Run Zircon shell
```sh ```sh
cargo run --release --features "zircon libos" -- prebuilt/zircon/x64 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 zcore in bare-metal mode
#### Run Linux shell in linux-bare-metal mode: #### Run Linux shell in linux-bare-metal mode:
##### step1: Prepare Alpine Linux rootfs:
```sh * step 1: Prepare Alpine Linux rootfs:
make rootfs
```
##### step2: Create Linux rootfs image:
Note: Before below step, you can add some special apps in zCore/rootfs
```sh ```sh
make image make rootfs
``` ```
##### step3: build and run zcore in linux-bare-metal mode:
```sh * step 2: Create Linux rootfs image:
cd zCore && make run MODE=release LINUX=1 [GRAPHIC=on] [ACCEL=1]
``` Note: Before below step, you can add some special apps in zCore/rootfs
```sh
make image
```
* step 3: Build and run zcore in linux-bare-metal mode:
```sh
cd zCore && make run MODE=release LINUX=1 [LOG=warn] [GRAPHIC=on] [ACCEL=1]
```
#### Run Zircon shell in zircon-bare-metal mode: #### Run Zircon shell in zircon-bare-metal mode:
##### step1.1 : build and run zcore in zircon-bare-metal mode:
```sh * step 1: Build and run zcore in zircon-bare-metal mode:
cd zCore && make run MODE=release [GRAPHIC=on] [ACCEL=1]
```
##### step1.2 : Build and run your own Zircon user programs: ```sh
cd zCore && make run MODE=release [LOG=warn] [GRAPHIC=on] [ACCEL=1]
```
```sh * 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 ```sh
cd zCore && make run MODE=release USER=1 # See template in zircon-user
``` cd zircon-user && make zbi MODE=release
To debug, set `LOG` environment variable to one of `error`, `warn`, `info`, `debug`, `trace`.
# Run your programs in zCore
cd zCore && make run MODE=release USER=1 [LOG=warn] [GRAPHIC=on] [ACCEL=1]
```
## Testing ## Testing
### LibOS Mode Testing ### LibOS Mode Testing
#### Zircon related #### Zircon related
Run Zircon official core-tests: Run Zircon official core-tests:
```sh
pip3 install pexpect
cd scripts && python3 unix-core-testone.py 'Channel.*'
```
Run all (non-panicked) core-tests for CI:
```sh
pip3 install pexpect
cd scripts && python3 unix-core-tests.py
# Check `zircon/test-result.txt` for results.
```
#### Linux related
Run Linux musl libc-tests for CI:
```sh
make rootfs && make libc-test
cd scripts && python3 libos-libc-tests.py
# Check `linux/test-result.txt` for results.
```
### Bare-metal Mode Testing
#### Zircon related
Run Zircon official core-tests on bare-metal:
```sh ```sh
cd zCore && make test MODE=release [ACCEL=1] TEST_FILTER='Channel.*' cd zCore && make test MODE=release [ACCEL=1] TEST_FILTER='Channel.*'
``` ```
@ -129,28 +162,17 @@ pip3 install pexpect
cd scripts && python3 core-tests.py cd scripts && python3 core-tests.py
# Check `zircon/test-result.txt` for results. # Check `zircon/test-result.txt` for results.
``` ```
#### Linux related
Run Linux musl libc-tests for CI:
```sh
make rootfs && make libc-test
cd scripts && python3 libc-tests.py
# Check `linux/test-result.txt` for results.
```
### Baremetal Mode Testing
#### x86-64 Linux related #### x86-64 Linux related
Run Linux musl libc-tests for CI: Run Linux musl libc-tests for CI:
``` ```sh
## Prepare rootfs with libc-test apps ## Prepare rootfs with libc-test apps
make baremetal-test-img make baremetal-test-img
## Build zCore kernel ## Build zCore kernel
cd zCore && make build MODE=release LINUX=1 ARCH=x86_64 cd zCore && make build MODE=release LINUX=1 ARCH=x86_64
## Testing ## Testing
cd ../scripts && python3 ./baremetal-libc-test.py cd scripts && python3 baremetal-libc-test.py
## ##
``` ```
@ -161,11 +183,11 @@ You can use [`scripts/baremetal-libc-test-ones.py`](./scripts/baremetal-libc-tes
#### riscv-64 Linux related #### riscv-64 Linux related
Run Linux musl libc-tests for CI: Run Linux musl libc-tests for CI:
``` ```sh
## Prepare rootfs with libc-test & oscomp apps ## Prepare rootfs with libc-test & oscomp apps
make riscv-image make riscv-image
## Build zCore kernel & Testing ## Build zCore kernel & Testing
cd ../scripts && python3 baremetal-test-riscv64.py cd scripts && python3 baremetal-test-riscv64.py
## ##
``` ```
@ -190,7 +212,7 @@ vec!["/bin/snake".into(), "sh".into()]
### Step3: prepare root fs image, run zcore in linux-bare-metal mode ### Step3: prepare root fs image, run zcore in linux-bare-metal mode
exec: exec:
``` ```sh
cd zCore #zCore ROOT DIR cd zCore #zCore ROOT DIR
make rootfs make rootfs
cp ../rcore-user/app/snake rootfs/bin #copy snake ELF file to rootfs/bin cp ../rcore-user/app/snake rootfs/bin #copy snake ELF file to rootfs/bin
@ -215,7 +237,8 @@ Operation
``` ```
make doc make doc
``` ```
### riscv64 porting info ### RISC-V 64 porting info
- [porting riscv64 doc](./docs/porting-rv64.md) - [porting riscv64 doc](./docs/porting-rv64.md)
## Components ## Components