Skip to content

Commit

Permalink
docs: 更新文档,介绍 zCore 硬件支持情况
Browse files Browse the repository at this point in the history
Signed-off-by: YdrMaster <[email protected]>
  • Loading branch information
YdrMaster committed Aug 2, 2022
1 parent f9959b4 commit 5d948f1
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 46 deletions.
45 changes: 23 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,27 @@
![stars](https://img.shields.io/github/stars/rcore-os/zCore)
![license](https://img.shields.io/github/license/rcore-os/zCore)

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

- [An English README](docs/README_EN.md)
- [原版 README](docs/README_LEGACY.md)
> 关于设置 docker、构建图形应用等操作可能需要查询原版 README,但其中很多脚本都废弃了
- [构建系统更新日志](xtask/CHANGELOG.md)
- [开发者注意事项(草案)](docs/for-developers.md)

## 目录

- [构建项目](#构建项目)
- [命令参考](#命令参考)
- [常用功能](#常用功能)
- [项目构建和管理](#项目构建和管理)
- [开发和调试](#开发和调试)
- [管理 linux rootfs](#管理-linux-rootfs)
- [libos 模式](#libos-模式)
- [平台支持](#平台支持)
- [Qemu/virt](#qemuvirt)
- [全志/哪吒](#全志哪吒)

## 构建项目

项目构建采用 [xtask 模式](https://github.com/matklad/cargo-xtask),常用操作被封装成 cargo 命令,再通过 [Makefile](Makefile) 提供 make 调用,以兼容一些旧脚本。
Expand Down Expand Up @@ -56,7 +69,7 @@
cargo xtask
```

## 命令参考指南
## 命令参考

如果下面的命令描述与行为不符,或怀疑此文档更新不及时,亦可直接查看[内联文档](xtask/src/main.rs#L48)
如果发现 `error: no such subcommand: ...`,查看[命令简写](.cargo/config.toml)为哪些命令设置了别名。
Expand Down Expand Up @@ -208,3 +221,19 @@ cargo image --arch riscv64
```bash
cargo linux-libos --args /bin/busybox
```

## 平台支持

### Qemu/virt

参见[命令参考/开发和调试/**qemu**](#开发和调试)

### 全志/哪吒

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

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

然后使用 [rustsbi-d1](https://github.com/rustsbi/rustsbi-d1) 将镜像部署到 Flash 或 DRAM。
33 changes: 31 additions & 2 deletions docs/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ An OS kernel based on zircon, provides Linux compatible mode.
- [legacy README](README_LEGACY.md)
> you may want to check the legacy for setting up docker, running graphical applications, etc. But many of these scripts are deprecated
## Table of contents

- [Build the project](#build-the-project)
- [Command reference](#command-reference)
- [Common functions](#common-functions)
- [Project and local repo](#project-and-local-repo)
- [Develop and debug](#develop-and-debug)
- [Linux rootfs management](#linux-rootfs-management)
- [Libos mode](#libos-mode)
- [Platform support](#platform-support)
- [Qemu/virt](#qemuvirt)
- [Allwinner/nezha](#allwinnernezha)

## Build the project

The project should be built with [xtask](https://github.com/matklad/cargo-xtask). The common operations are provided as cargo commands. An extra [Makefile](../Makefile) provides make calls for compatibility with some legacy scripts.
Expand Down Expand Up @@ -97,7 +110,7 @@ Checks code without running. Try to compile the project with various different f
cargo check-style
```

### Develop and Debug
### Develop and debug

- **asm**

Expand Down Expand Up @@ -139,7 +152,7 @@ Launches gdb and connects to a port.
cargo gdb --arch riscv64 --port 1234
```

### manage linux rootfs
### Linux rootfs management

- **rootfs**

Expand Down Expand Up @@ -211,3 +224,19 @@ Runs zCore in linux libos mode and runs an executable at the specified path.
```bash
cargo linux-libos --args /bin/busybox
```

## Platform support

### Qemu/virt

See [Command reference/Develop and debug/**qemu**](#develop-and-debug).

### Allwinner/nezha

Build kernel binary with the following command:

```bash
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](https://github.com/rustsbi/rustsbi-d1).
15 changes: 1 addition & 14 deletions xtask/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,10 @@ pub(crate) fn wget(url: impl AsRef<OsStr>, dst: impl AsRef<Path>) {
return;
}

println!("wget {} from {:?}", dst.display(), url.as_ref());
fetch_online!(dst, |tmp| {
let mut wget = Ext::new("wget");
wget.arg(&url).arg("-O").arg(tmp);
wget
});
}

// pub(crate) fn git_clone(repo: impl AsRef<OsStr>, dst: impl AsRef<Path>, pull: bool) {
// let dst = dst.as_ref();
// if dst.is_dir() {
// if pull {
// let _ = Git::pull().current_dir(dst).status();
// } else {
// println!("{dst:?} already exist. You can delete it manually to re-clone.");
// }
// return;
// }

// fetch_online!(dst, |tmp| Git::clone(repo, Some(tmp)));
// }
12 changes: 6 additions & 6 deletions zCore/src/platform/riscv/boot_page_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
use core::arch::asm;
use page_table::{MmuFlags, PageTable, Sv39, OFFSET_BITS, PPN};

/// 启动页表。
pub(super) struct BootPageTable {
root: PageTable<Sv39>,
sub: PageTable<Sv39>,
}

/// 内核页属性
const KERNEL_PAGE: MmuFlags<Sv39> = MmuFlags::new(0xef); // DAG_'XWRV

/// 子页表属性
const SUBTABLE: MmuFlags<Sv39> = MmuFlags::new(0x21); // __G_'___V

/// 启动页表。
pub(super) struct BootPageTable {
root: PageTable<Sv39>,
sub: PageTable<Sv39>,
}

impl BootPageTable {
/// 初始化为全零的启动页表。
pub const ZERO: Self = Self {
Expand Down

0 comments on commit 5d948f1

Please sign in to comment.