An OS kernel based on zircon, provides Linux compatible mode.
- 中文自述文档
- legacy README
you may want to check the legacy for setting up docker, running graphical applications, etc. But many of these scripts are deprecated
The project should be built with xtask. The common operations are provided as cargo commands. An extra Makefile provides make calls for compatibility with some legacy scripts.
Developers and users may set up the project by following the steps below:
-
Environment
Currently tested development environments include Ubuntu 20.04, Ubuntu 22.04 and Debian 11. The libc tests for x86_64 cannot compile on Ubuntu22.04. If you do not need to flash to physical hardware, using WSL2 or other virtual machines does not operate any differently from the real machine.
Make sure you have git, git lfs, and rustup installed on your computer before you start. Qemu is required to develop or test in a virtual environment.
-
clone the repo
git clone https://github.com/rcore-os/zCore.git
NOTICE It's not necessary to recurse here, as it will will automatically pull the submodules at the next step
-
initialize the local repo
cargo initialize
-
keep up to date
cargo update-all
-
need help?
cargo xtask
If the following command description does not match its behavior, or if you suspect that this documentation is not up to date, you can check the inline documentation as well.
If you find error: no such subcommand: ...
, check command alias to see which commands have aliases set for them.
NOTICE inline documentation is also bilingual
- dump
Dumps build config.
cargo dump
- initialize
Initializes the project. Git lfs install and pull. Submodules will be updated.
cargo initialize
- update-all
Updates toolchain、dependencies and submodules.
cargo update-all
- check-style
Checks code without running. Try to compile the project with various different features.
cargo check-style
- asm
Dumps the asm of kernel for specific architecture.
The default output is target/zcore.asm
.
cargo asm --arch riscv64 --output riscv64.asm
- bin
Strips kernel binary for specific architecture.
The default output is target/{arch}/release/zcore.bin
.
cargo bin --arch riscv64 --output zcore.bin
- qemu
Runs zCore in qemu.
cargo qemu --arch riscv64 --smp 4
Connects qemu to gdb:
cargo qemu --arch riscv64 --smp 4 --gdb 1234
- gdb
Launches gdb and connects to a port.
cargo gdb --arch riscv64 --port 1234
- rootfs
Rebuilds the linux rootfs. This command will remove the existing rootfs directory for this architecture, and rebuild a minimum rootfs.
cargo rootfs --arch riscv64
- musl-libs
Copies musl so files to rootfs directory.
cargo musl-libs --arch riscv64
- ffmpeg
Copies ffmpeg so files to rootfs directory.
cargo ffmpeg --arch riscv64
- opencv
Copies opencv so files to rootfs directory. If ffmpeg is already there, this opencv will build with ffmpeg support.
cargo opencv --arch riscv64
- libc-test
Copies libc test files to rootfs directory.
cargo libc-test --arch riscv64
- other-test
Copies other test files to rootfs directory.
cargo other-test --arch riscv64
- image
Builds the linux rootfs image file.
cargo image --arch riscv64
- linux-libos
Runs zCore in linux libos mode and runs an executable at the specified path.
NOTICE zCore can only run a single executable in libos mode, and it will exit after finishing.
cargo linux-libos --args /bin/busybox
See Command reference/Develop and debug/qemu.
Build kernel binary with the following command:
cargo bin --arch riscv64 --features "linux board-d1 link-user-img" --output z.bin
Then deploy the binary to Flash or DRAM with rustsbi-d1.