Code Monkey home page Code Monkey logo

zcore's Introduction

zCore

CI Docs Coverage Status issue forks stars license

基于 zircon 并提供 Linux 兼容性的操作系统内核。

目录

构建项目

项目构建采用 xtask 模式,常用操作被封装成 cargo 命令,再通过 Makefile 提供 make 调用,以兼容一些旧脚本。

开发者和用户可以按以下步骤设置 zCore 项目。

  1. 先决条件

    目前已测试的开发环境包括 Ubuntu20.04、Ubuntu22.04 和 Debian11, Ubuntu22.04 不能正确编译 x86_64 的 libc 测试。 若不需要烧写到物理硬件,使用 WSL2 或其他虚拟机的操作与真机并无不同之处。

    在开始之前,确保你的计算机上安装了 git 和 rustup。要在虚拟环境开发或测试,需要 QEMU。

  2. 克隆项目

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

    NOTICE 此处不必递归,因为后续步骤会自动拉取子项目

  3. 初始化存储库

    cargo initialize
  4. 保持更新

    cargo update-all
  5. 探索更多操作

    cargo xtask

命令参考

如果下面的命令描述与行为不符,或怀疑此文档更新不及时,亦可直接查看内联文档。 如果发现 error: no such subcommand: ...,查看命令简写为哪些命令设置了别名。

NOTICE 内联文档也是中英双语

常用功能

  • dump

打印构建信息。

cargo dump

项目构建和管理

  • initialize

初始化项目。安装 zircon 模式所需的二进制文件,并更新子项目。

cargo initialize
  • update-all

更新工具链、依赖和子项目。

cargo update-all
  • check-style

静态检查。设置多种编译选项,检查代码能否编译。

cargo check-style

开发和调试

  • asm

反汇并保存编指定架构的内核。默认保存到 target/zcore.asm

cargo asm --arch riscv64 --output riscv64.asm
  • bin

生成内核 raw 镜像到指定位置。默认输出到 target/{arch}/release/zcore.bin

cargo bin --arch riscv64 --output zcore.bin
  • qemu

在 qemu 中启动 zCore。这需要 qemu 已经安装好了。

cargo qemu --arch riscv64 --smp 4

支持将 qemu 连接到 gdb:

cargo qemu --arch riscv64 --smp 4 --gdb 1234
  • gdb

启动 gdb 并连接到指定端口。

cargo gdb --arch riscv64 --port 1234

管理 linux rootfs

  • rootfs

重建 Linux rootfs。这个命令会清除已有的为此架构构造的 rootfs 目录,重建最小的 rootfs。

cargo rootfs --arch riscv64
  • musl-libs

将 musl 动态库拷贝到 rootfs 目录对应位置。

cargo musl-libs --arch riscv64
  • ffmpeg

将 ffmpeg 动态库拷贝到 rootfs 目录对应位置。

cargo ffmpeg --arch riscv64
  • opencv

将 opencv 动态库拷贝到 rootfs 目录对应位置。如果 ffmpeg 已经放好了,opencv 将会编译出包含 ffmepg 支持的版本。

cargo opencv --arch riscv64
  • libc-test

将 libc 测试集拷贝到 rootfs 目录对应位置。

cargo libc-test --arch riscv64
  • other-test

将其他测试集拷贝到 rootfs 目录对应位置。

cargo other-test --arch riscv64
  • image

构造 Linux rootfs 镜像文件。

cargo image --arch riscv64

Libos 模式

  • linux-libos

在 linux libos 模式下启动 zCore 并执行位于指定路径的应用程序。

NOTICE libos 模式只能执行单个应用程序,完成就会退出。

# 例如"/bin/busybox ls"
cargo linux-libos --args "/bin/busybox"

平台支持

Qemu/virt

参见命令参考/开发和调试/qemu

全志/哪吒

使用以下命令构造系统镜像:

cargo bin --arch riscv64 --features "linux board-d1 link-user-img" --output z.bin

然后使用 rustsbi-d1 将镜像部署到 Flash 或 DRAM。

zcore's People

Contributors

wangrunji0408 avatar ydrmaster avatar panql avatar elliott10 avatar benpigchu avatar equation314 avatar deathwish5 avatar chyyuu avatar xxchan avatar sunshine-lcc avatar yunwei37 avatar rzswh avatar heheda12345 avatar gcyyfun avatar pleasewhy avatar shzhxh avatar yuzc19 avatar yukiiiteru avatar yxl76 avatar workerwork avatar summervibes avatar ilfth avatar leo-frank avatar jiegec avatar yuoo655 avatar 0400h avatar burtonqin avatar vitalyankh avatar weixiao-huang avatar whfuyn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.