mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 18:26:48 +00:00
:doc: multiboot2支持模块
This commit is contained in:
parent
da4867d662
commit
a5ce84c26e
@ -2,5 +2,7 @@
|
||||
====================================
|
||||
|
||||
开发者: fslongjin
|
||||
|
||||
工作邮箱: longjin@RinGoTek.cn
|
||||
|
||||
[内容待完善]
|
||||
|
@ -17,7 +17,7 @@
|
||||
:maxdepth: 1
|
||||
:caption: 内核层
|
||||
|
||||
kernel/bootloader/index
|
||||
kernel/boot/index
|
||||
kernel/process_management/index
|
||||
kernel/filesystem/index
|
||||
|
||||
|
19
docs/kernel/boot/bootloader.md
Normal file
19
docs/kernel/boot/bootloader.md
Normal file
@ -0,0 +1,19 @@
|
||||
# 引导加载程序
|
||||
|
||||
## 原理
|
||||
|
||||
  目前,DragonOS仅支持Legacy BIOS进行启动引导。
|
||||
|
||||
  在`head.S`的头部包含了Multiboot2引导头,里面标志了一些Multiboot2相关的特定信息,以及一些配置命令。
|
||||
|
||||
  在DragonOS的启动初期,会存储由GRUB2传来的magic number以及multiboot2_boot_info_addr。当系统进入`Start_Kernel`函数之后,将会把这两个信息保存到multiboot2驱动程序之中。信息的具体含义请参照Multiboot2 Specification进行理解,该部分难度不大,相信读者经过思考能理解其中的原理。
|
||||
|
||||
## 未来发展方向
|
||||
|
||||
- 增加对UEFI启动的支持
|
||||
|
||||
## 参考资料
|
||||
|
||||
- [Multiboot2 Specification](http://git.savannah.gnu.org/cgit/grub.git/tree/doc/multiboot.texi?h=multiboot2)
|
||||
|
||||
- [GNU GRUB Manual 2.06](https://www.gnu.org/software/grub/manual/grub/grub.html)
|
11
docs/kernel/boot/index.rst
Normal file
11
docs/kernel/boot/index.rst
Normal file
@ -0,0 +1,11 @@
|
||||
引导加载
|
||||
====================================
|
||||
|
||||
DragonOS采用GRUB2作为其引导加载程序,支持Multiboot2协议引导。目前仅支持GRUB2.06版本。
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: 目录
|
||||
|
||||
bootloader
|
||||
multiboot2
|
46
docs/kernel/boot/multiboot2.md
Normal file
46
docs/kernel/boot/multiboot2.md
Normal file
@ -0,0 +1,46 @@
|
||||
# Multiboot2支持模块
|
||||
|
||||
  Multiboot2支持模块提供对Multiboot2协议的支持。位于`kernel/driver/multiboot2`文件夹中。
|
||||
|
||||
  根据Multiboot2协议,操作系统能够从BootLoader处获得一些信息,比如基本的硬件信息以及ACPI表的起始地址等。
|
||||
|
||||
---
|
||||
|
||||
## 数据结构
|
||||
|
||||
  `kernel/driver/multiboot2/multiboot2.h`中按照Multiboot2协议的规定,定义了大部分的数据结构,具体细节可查看该文件: [DragonOS/multiboot2.h at master · fslongjin/DragonOS · GitHub](https://github.com/fslongjin/DragonOS/blob/master/kernel/driver/multiboot2/multiboot2.h)
|
||||
|
||||
---
|
||||
|
||||
## 迭代器
|
||||
|
||||
  由于Multiboot2的信息存储在自`multiboot2_boot_info_addr`开始的一段连续的内存空间之中,且不同类型的header的长度不同,因此设计了一迭代器`multiboot2_iter`。
|
||||
|
||||
### 函数原型
|
||||
|
||||
```c
|
||||
void multiboot2_iter(bool (*_fun)(const struct iter_data_t *, void *, unsigned int *),
|
||||
void *data, unsigned int *count)
|
||||
```
|
||||
|
||||
**_fun**
|
||||
|
||||
  指定的handler。当某个header的tag与该handler所处理的tag相同时,handler将处理该header,并返回true。
|
||||
|
||||
  其第一个参数为tag类型,第二个参数为返回的数据的指针,第三个值为计数(某些没有用到该值的地方,该值可以为空)
|
||||
|
||||
**data**
|
||||
|
||||
  传递给`_fun`的第二个参数,`_fun`函数将填充该指针所指向的内存区域,从而返回数据。
|
||||
|
||||
**count**
|
||||
|
||||
  当返回的**data**为一个列表时,通过该值来指示列表中有多少项。
|
||||
|
||||
---
|
||||
|
||||
## 迭代工作函数
|
||||
|
||||
  在模块中,按照我们需要获取不同类型的tag的需要,定义了一些迭代器工作函数。
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
引导加载程序
|
||||
====================================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: 目录
|
||||
|
||||
intro
|
@ -1 +0,0 @@
|
||||
# 简介
|
Loading…
x
Reference in New Issue
Block a user