* 内核编译配置

* 将kernel.config的解析代码搬入crate

* 将设置feature函数放入CargoHandler中
This commit is contained in:
Jomo
2023-11-17 21:23:01 +08:00
committed by GitHub
parent 11f78b73e7
commit e4600f7f7d
9 changed files with 331 additions and 2 deletions

View File

@ -30,6 +30,7 @@
kernel/ktest/index
kernel/cpu_arch/index
kernel/libs/index
kernel/configuration/index
.. toctree::

View File

@ -0,0 +1,105 @@
# 内核编译配置说明
## 原理
  在内核目录下用kernel.config来设置内核编译配置信息以类似解析toml文件的方式去解析该文件然后接着去解析各模块下的d.config以获取feature的启用情况
## 示例
**kernel.config**
```toml
[[module.include]]
name = "init"
path = "src/init/"
enable = "y"
description = ""
[[module.include]]
name = "mm"
path = "src/mm/"
enable = "y"
description = ""
```
- **[[module.include]]:** 将模块加入到include列表中
- **name:** 模块名
- **path:** 模块路径存放着d.config
- **enable:**
- **y:** 启用解析模块下的d.config
- **n:** 不启用,不解析
- **description:** 模块的描述信息
**src/mm/d.config**
```toml
[module]
name = "mm"
description = ""
[[module.include]]
name = "allocator"
path = "src/mm/allocator/"
enable = "y"
description = ""
[[module.features]]
name = "mm_debug"
enable = "y"
description = ""
```
- **\[module\]:** 当前模块
- **name:** 当前模块名称
- **description:** 模块的描述信息
- **[[module.include]]:** 当前模块下所包含的模块与kernel.config下的相同
- **[[module.features]]:** 当前模块下的feature
- **name:** feature名
- **enable:** 是否开启
- **y:** 开启
- **n:** 不开启
- **description:** feature的描述信息
*以下是其它模块下的d.config*
**src/mm/allocator/d.config**
```toml
[module]
name = "allocator"
description = ""
[[module.features]]
name = "allocator_debug"
enable = "y"
description = ""
```
**src/init/d.config**
```toml
[module]
name = "init"
description = ""
[[module.features]]
name = "init_debug"
enable = "y"
description = ""
```
上面所有已开启模块的d.config中的feature会最终生成到内核目录下的D.config文件即D.config是最终内核编译的配置如下
**D.config**
```
init_debug = y
allocator_debug = y
mm_debug = y
```

View File

@ -0,0 +1,9 @@
内核编译配置
====================================
.. toctree::
:maxdepth: 1
:caption: 目录
config