Skip to content

Commit 5d948f1

Browse files
committed
docs: 更新文档,介绍 zCore 硬件支持情况
Signed-off-by: YdrMaster <ydrml@hotmail.com>
1 parent f9959b4 commit 5d948f1

File tree

5 files changed

+92
-46
lines changed

5 files changed

+92
-46
lines changed

Cargo.lock

Lines changed: 23 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,27 @@
88
![stars](https://img.shields.io/github/stars/rcore-os/zCore)
99
![license](https://img.shields.io/github/license/rcore-os/zCore)
1010

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

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

19+
## 目录
20+
21+
- [构建项目](#构建项目)
22+
- [命令参考](#命令参考)
23+
- [常用功能](#常用功能)
24+
- [项目构建和管理](#项目构建和管理)
25+
- [开发和调试](#开发和调试)
26+
- [管理 linux rootfs](#管理-linux-rootfs)
27+
- [libos 模式](#libos-模式)
28+
- [平台支持](#平台支持)
29+
- [Qemu/virt](#qemuvirt)
30+
- [全志/哪吒](#全志哪吒)
31+
1932
## 构建项目
2033

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

59-
## 命令参考指南
72+
## 命令参考
6073

6174
如果下面的命令描述与行为不符,或怀疑此文档更新不及时,亦可直接查看[内联文档](xtask/src/main.rs#L48)
6275
如果发现 `error: no such subcommand: ...`,查看[命令简写](.cargo/config.toml)为哪些命令设置了别名。
@@ -208,3 +221,19 @@ cargo image --arch riscv64
208221
```bash
209222
cargo linux-libos --args /bin/busybox
210223
```
224+
225+
## 平台支持
226+
227+
### Qemu/virt
228+
229+
参见[命令参考/开发和调试/**qemu**](#开发和调试)
230+
231+
### 全志/哪吒
232+
233+
使用以下命令构造系统镜像:
234+
235+
```bash
236+
cargo bin --arch riscv64 --features "linux board-d1 link-user-img" --output z.bin
237+
```
238+
239+
然后使用 [rustsbi-d1](https://github.com/rustsbi/rustsbi-d1) 将镜像部署到 Flash 或 DRAM。

docs/README_EN.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ An OS kernel based on zircon, provides Linux compatible mode.
1414
- [legacy README](README_LEGACY.md)
1515
> you may want to check the legacy for setting up docker, running graphical applications, etc. But many of these scripts are deprecated
1616
17+
## Table of contents
18+
19+
- [Build the project](#build-the-project)
20+
- [Command reference](#command-reference)
21+
- [Common functions](#common-functions)
22+
- [Project and local repo](#project-and-local-repo)
23+
- [Develop and debug](#develop-and-debug)
24+
- [Linux rootfs management](#linux-rootfs-management)
25+
- [Libos mode](#libos-mode)
26+
- [Platform support](#platform-support)
27+
- [Qemu/virt](#qemuvirt)
28+
- [Allwinner/nezha](#allwinnernezha)
29+
1730
## Build the project
1831

1932
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.
@@ -97,7 +110,7 @@ Checks code without running. Try to compile the project with various different f
97110
cargo check-style
98111
```
99112

100-
### Develop and Debug
113+
### Develop and debug
101114

102115
- **asm**
103116

@@ -139,7 +152,7 @@ Launches gdb and connects to a port.
139152
cargo gdb --arch riscv64 --port 1234
140153
```
141154

142-
### manage linux rootfs
155+
### Linux rootfs management
143156

144157
- **rootfs**
145158

@@ -211,3 +224,19 @@ Runs zCore in linux libos mode and runs an executable at the specified path.
211224
```bash
212225
cargo linux-libos --args /bin/busybox
213226
```
227+
228+
## Platform support
229+
230+
### Qemu/virt
231+
232+
See [Command reference/Develop and debug/**qemu**](#develop-and-debug).
233+
234+
### Allwinner/nezha
235+
236+
Build kernel binary with the following command:
237+
238+
```bash
239+
cargo bin --arch riscv64 --features "linux board-d1 link-user-img" --output z.bin
240+
```
241+
242+
Then deploy the binary to Flash or DRAM with [rustsbi-d1](https://github.com/rustsbi/rustsbi-d1).

xtask/src/commands.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,10 @@ pub(crate) fn wget(url: impl AsRef<OsStr>, dst: impl AsRef<Path>) {
4040
return;
4141
}
4242

43+
println!("wget {} from {:?}", dst.display(), url.as_ref());
4344
fetch_online!(dst, |tmp| {
4445
let mut wget = Ext::new("wget");
4546
wget.arg(&url).arg("-O").arg(tmp);
4647
wget
4748
});
4849
}
49-
50-
// pub(crate) fn git_clone(repo: impl AsRef<OsStr>, dst: impl AsRef<Path>, pull: bool) {
51-
// let dst = dst.as_ref();
52-
// if dst.is_dir() {
53-
// if pull {
54-
// let _ = Git::pull().current_dir(dst).status();
55-
// } else {
56-
// println!("{dst:?} already exist. You can delete it manually to re-clone.");
57-
// }
58-
// return;
59-
// }
60-
61-
// fetch_online!(dst, |tmp| Git::clone(repo, Some(tmp)));
62-
// }

zCore/src/platform/riscv/boot_page_table.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
use core::arch::asm;
33
use page_table::{MmuFlags, PageTable, Sv39, OFFSET_BITS, PPN};
44

5-
/// 启动页表。
6-
pub(super) struct BootPageTable {
7-
root: PageTable<Sv39>,
8-
sub: PageTable<Sv39>,
9-
}
10-
115
/// 内核页属性
126
const KERNEL_PAGE: MmuFlags<Sv39> = MmuFlags::new(0xef); // DAG_'XWRV
137

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

11+
/// 启动页表。
12+
pub(super) struct BootPageTable {
13+
root: PageTable<Sv39>,
14+
sub: PageTable<Sv39>,
15+
}
16+
1717
impl BootPageTable {
1818
/// 初始化为全零的启动页表。
1919
pub const ZERO: Self = Self {

0 commit comments

Comments
 (0)