Skip to content

Commit aef6f5a

Browse files
committed
add quickstart documentation
1 parent 805e17c commit aef6f5a

27 files changed

+207
-151
lines changed

docs/design/_category_.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"label": "Design",
3-
"position": 2,
3+
"position": 3,
44
"link": {
55
"type": "generated-index"
66
}

docs/examples/_category_.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/examples/arm/_category_.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/examples/arm/phytiumpi.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/examples/arm/raspberrypi.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/examples/riscv/_category_.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/examples/riscv/xxpi.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/examples/x86_64/_category_.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/examples/x86_64/x86_64.md

Lines changed: 0 additions & 16 deletions
This file was deleted.
31 KB
Loading
25.2 KB
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
26.5 KB
Loading
69.4 KB
Loading

docs/quickstart/quickstart.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# QuickStart
6+
7+
[infisecos-images](https://github.com/qclic/infisecos-images) 这个仓库中,我们提供了预编译的适用于飞腾派和树莓派 4B 开发版的镜像文件,可以快速体验 InfisecOS 的运行效果。
8+
9+
## 文件介绍
10+
11+
目录文件介绍如下:
12+
```c
13+
infisecos-images
14+
├── README.md
15+
├── README_CN.md
16+
├── arceos # 不再需要,已经直接集成到了对应的开发板镜像中
17+
│ ├── phytiumpi.bin
18+
│ └── raspberrypi.bin
19+
├── phytiumpi
20+
│ └── infisecos-image-phytiumpi.img # 飞腾派开发板镜像
21+
└── raspberrypi4
22+
└── infisecos-image-raspberrypi4-64.img # 树莓派 4B 开发板镜像
23+
```
24+
25+
## 烧写
26+
27+
首先使用 `git clone [email protected]:qclic/infisecos-images.git` 命令下载镜像文件,[infisecos-images](https://github.com/qclic/infisecos-images) 中提供的是 SD 卡镜像文件,因此,需要准备一张 SD 卡,将镜像烧写到 SD 卡来进行启动
28+
29+
### Linux
30+
在 Linux 系统中,可以直接使用命令 `sudo dd iflag=sync oflag=sync bs=4M if=infisecos-image-phytiumpi.img of=/dev/sdb status=progress` 来进行烧写
31+
32+
- `if=` 指定输入文件,即我们要烧写的镜像文件。飞腾派对应 infisecos-image-phytiumpi.img,树莓派对应 infisecos-image-raspberrypi4-64.img
33+
34+
- `of=` 指定输出设备,即我们的 SD 卡盘符。
35+
36+
- `bs=4M` 设置块大小为 4MB,这对于大型文件来说可以提高写入效率。
37+
38+
- `status=progress` 显示写入过程中的进度信息。
39+
40+
- `oflag=sync` 确保写入操作同步进行,数据更改立即被写入设备。
41+
42+
### Windows
43+
44+
在 Windows 系统中,有很多 GUI 程序可以用来烧写 SD 卡。对于飞腾派,可以使用 `Win32DiskImager2.0.1.8.exe`,对于树莓派,官方提供了一个名为 `Raspberry Pi Imager` 烧写工具
45+
46+
![write_sd_windows](./images/write_sd_windows.png)
47+
48+
## 启动验证
49+
50+
将烧写好的 SD 卡插入到开发板中,然后上电启动。默认的用户为 root,没有密码。
51+
52+
### 处理终端输入太长后返回行头
53+
54+
  默认生成的 InfisecOS 系统中,如果在终端输入内容太长时就会返回行开头,非常影响使用!这通常是由于 Buildroot 构建的 Linux 系统终端的缓冲区大小不足以处理太长的输入导致的。
55+
1. 解决方法一:直接 `nano /etc/profile` 或其他用户配置文件,然后在其中添加 `export COLUMNS=200``export LINES=200`,重启后生效!
56+
2. 解决方法二:每次登陆终端后,使用命令 `stty rows [number_of_rows] cols [number_of_columns]` 动态修改
57+
58+
### 找不到 jailhouse 命令
59+
60+
  此时如果直接运行 `jailhouse` 命令会提示找不到该命令,这是因为 `jailhouse` 编译后默认的安装路径并不在我们构建的 InfisecOS 环境变量里面。直接 `nano /etc/profile` 并在其中的 `export PATH=` 内容的最后面输入 `:/usr/local/sbin`,保存后 `source /etc/profile` 即可
61+
62+
![load_jailhouse](./images/load_jailhouse.png)
63+
64+
### 加载 Jailhouse 驱动
65+
66+
  Jailhouse 的驱动 `jailhouse.ko` 位于 `/lib/modules/5.10.0-openeuler/jailhouse/driver/` 目录中,默认是没有被加载进内核的。我们需要手动执行 `insmod /lib/modules/$(uname -r)/jailhouse/driver/jailhouse.ko` 或者 `modprobe jailhouse` 来进行加载,否则会报错 `opening /dev/jailhouse: No such file or directory`
67+
68+
![load_driver](./images/load_driver.png)
69+
70+
  也可以配置一下开机自动加载,不过,虽然 Linux 在启动时加载 ko 的方式有很多,但是针对嵌入式的 Linux,很多方式都是不支持的。最简单有效的方法就通过修改启动过程的 rc 脚本。直接 `nano /etc/init.d/rcS`,然后在文件最后添加 `modprobe jailhouse` 即可
71+
72+
![load_jailhouse_driver_auto](./images/load_jailhouse_driver_auto.png)
73+
74+
  修改后重启,就会在启动 LOG 中看到 `jailhouse: loading out-of-tree module taints kernel.` 这条记录。关于污染内核的这个描述,并不影响功能,Linux 官方文档 https://docs.kernel.org/admin-guide/tainted-kernels.html 有详细说明 。
75+
76+
### 飞腾派
77+
78+
#### 启动 Jailhouse
79+
80+
  首先直接 `jailhouse enable /etc/jailhouse/phytiumpi.cell` 就可以启动 Jailhouse。启动后,当前 Linux 系统就会称为 Root Cell。
81+
82+
![phytium_jailhouse_enable](./images/phytium_jailhouse_enable.png)
83+
84+
#### 启动 ArceOS
85+
86+
1. 首先创建 ArceOS 对应的 Cell:`jailhouse cell create /etc/jailhouse/phytiumpi-arceos.cell`。执行后一个 Non-root Cell 就创建好了
87+
![phytium_jailhouse_cell_arceos](./images/phytium_jailhouse_cell_arceos.png)
88+
89+
2. 然后加载 ArceOS 的 Loader 程序以及 ArceOS 镜像:`jailhouse cell load 1 /usr/local/libexec/jailhouse/arceos-loader-phytiumpi.bin /usr/local/libexec/jailhouse/demos/arceos.bin -a 0xb2000000`。这里的 1 是指的我们上面创建的 Non-root Cell 的 ID,也可以使用 Cell 的名字(注意是 Cell 中定义的 name,不是文件名)。
90+
![phytium_jailhouse_cell_loader_arceos](./images/phytium_jailhouse_cell_loader_arceos.png)
91+
92+
3. 最后启动 ArceOS:`jailhouse cell start 1`
93+
![phytium_jailhouse_cell_start_arceos](./images/phytium_jailhouse_cell_start_arceos.png)
94+
95+
#### 关闭 Jailhouse
96+
97+
  直接使用命令 `jailhouse disable` 就可以关闭 Jailhouse。
98+
99+
![phytium_jailhouse_disable](./images/phytium_jailhouse_disable.png)
100+
101+
### 树莓派
102+
103+
#### 启动 Jailhouse
104+
105+
  首先直接 `jailhouse enable /etc/jailhouse/rpi4.cell` 就可以启动 Jailhouse。启动后,当前 Linux 系统就会称为 Root Cell。
106+
107+
![rpi4_jailhouse_enable](./images/rpi4_jailhouse_enable.png)
108+
109+
#### 启动 ArceOS
110+
111+
1. 首先创建 ArceOS 对应的 Cell:`jailhouse cell create /etc/jailhouse/rpi4-arceos.cell`。执行后一个 Non-root Cell 就创建好了
112+
![rpi4_jailhouse_cell_arceos](./images/rpi4_jailhouse_cell_arceos.png)
113+
114+
2. 加载 ArceOS 的 Loader 程序以及 ArceOS 镜像:`jailhouse cell load 1 /usr/local/libexec/jailhouse/arceos-loader-rpi4.bin /usr/local/libexec/jailhouse/demos/arceos.bin -a 0x42000000`。这里的 1 是指的我们上面创建的 Non-root Cell 的 ID,也可以使用 Cell 的名字(注意是 Cell 中定义的 name,不是文件名)。
115+
![rpi4_jailhouse_cell_loader_arceos](./images/rpi4_jailhouse_cell_loader_arceos.png)
116+
117+
3. 启动:`jailhouse cell start 1`
118+
![rpi4_jailhouse_cell_start_arceos](./images/rpi4_jailhouse_cell_start_arceos.png)
119+
120+
#### 关闭 Jailhouse
121+
122+
  直接使用命令 `jailhouse disable` 就可以关闭 Jailhouse。
123+
124+
![rpi4_jailhouse_disable](./images/rpi4_jailhouse_disable.png)

i18n/zh/code.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@
66
"message": "一个专注于 AIoT 领域的安全操作系统"
77
},
88
"Component-based design": {
9-
"message": "Component-based design"
9+
"message": "组件化设计"
1010
},
1111
"Features multiple kernel architecture forms": {
12-
"message": "Features multiple kernel architecture forms"
12+
"message": "多内核架构形态支持"
1313
},
1414
"Support for multiple application scenarios": {
15-
"message": "Support for multiple application scenarios"
15+
"message": "多应用场景支持"
1616
},
1717
"Developed using the Rust programming language": {
18-
"message": "Developed using the Rust programming language"
18+
"message": "采用 Rust 语言开发"
1919
},
2020
"Supports RTOS, BareMetal, and Linux as subsystems": {
21-
"message": "Supports RTOS, BareMetal, and Linux as subsystems"
21+
"message": "支持 RTOS, BareMetal Linux 作为子系统"
2222
},
2323
"Adopted the MIT permissive open-source license": {
24-
"message": "Adopted the MIT permissive open-source license"
24+
"message": "MIT 宽松协议"
2525
},
2626
"Multi-architecture support, verified on the following architectures": {
27-
"message": "Multi-architecture support, verified on the following architectures"
27+
"message": "多种 CPU 架构支持,已验证的架构有:"
2828
},
29-
"Getting Started Guide": {
30-
"message": "阅读指南"
29+
"Quick Start": {
30+
"message": "快速上手"
3131
},
32-
"Download and Experience": {
33-
"message": "下载体验"
32+
"Get Started": {
33+
"message": "阅读指南"
3434
},
3535
"Multiple kernel architecture forms": {
3636
"message": "Multiple kernel architecture forms"

0 commit comments

Comments
 (0)