Skip to content

Commit c2a80c5

Browse files
committed
x86_64: switch from legacy BIOS to UEFI. use rboot as new bootloader
- remove dependencies: rust-osdev/{bootloader, bootimage} - remove kernel stack segment - find a bug: IDT should be initialized after GDT
1 parent 977c0ba commit c2a80c5

File tree

14 files changed

+187
-265
lines changed

14 files changed

+187
-265
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "user"]
22
path = user
33
url = https://github.com/rcore-os/rcore-user.git
4+
[submodule "rboot"]
5+
path = rboot
6+
url = https://github.com/rcore-os/rboot.git

Cargo.toml

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

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ Tested boards: QEMU, HiFive Unleashed, x86_64 PC (i5/i7), Raspberry Pi 3B+, Kend
1616

1717
### Environment
1818

19-
* [Rust](https://www.rust-lang.org) toolchain at nightly-2019-03-05
19+
* [Rust](https://www.rust-lang.org) toolchain at nightly-2019-06-15
2020
* Cargo tools: [cargo-xbuild](https://github.com/rust-osdev/cargo-xbuild)
2121
* [QEMU](https://www.qemu.org) >= 3.1.0
22-
* [bootimage](https://github.com/rust-osdev/bootimage) (for x86_64)
2322
* [RISCV64 GNU toolchain](https://www.sifive.com/boards) (for riscv32/64)
2423
* [AArch64 GNU toolchain](https://cs140e.sergio.bz/assignments/0-blinky/) (for aarch64)
2524
* [musl-cross-make](https://github.com/richfelker/musl-cross-make) (for userland musl, or download prebuilt toolchain from [musl.cc](https://musl.cc/))
26-
* [libfuse-dev](https://github.com/libfuse/libfuse) (for userland image generation)
2725

2826
See [Travis script](./.travis.yml) for details.
2927

@@ -33,7 +31,6 @@ See [Travis script](./.travis.yml) for details.
3331
$ rustup component add rust-src llvm-tools-preview
3432
$ cargo install cargo-binutils
3533
$ cargo install cargo-xbuild
36-
$ cargo install bootimage --version 0.6.6
3734
```
3835

3936
```bash

docs/x86_64.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# x86_64
2+
3+
## 运行
4+
5+
### QEMU
6+
7+
```
8+
make run arch=x86_64 LOG=info
9+
```
10+
11+
使用开源 UEFI 固件实现 [OVMF](https://github.com/tianocore/tianocore.github.io/wiki/OVMF),预编译镜像已包含在 rboot 项目中。
12+
13+
### 真机
14+
15+
```
16+
make build arch=x86_64 LOG=error board=pc graphic=console
17+
```
18+
19+
需要一个支持 UEFI 的启动 U 盘,可使用“老毛桃”“大白菜”等工具制作。
20+
21+
完成后将 `target/release/esp/EFI `文件夹复制到启动 U盘 的 EFI 系统分区(ESP)中。(注意备份)
22+
23+
将 U 盘插入电脑,进入 BIOS 设置,关闭安全启动,从 U 盘启动即可。
24+
25+
注:目前真机模式与 QEMU 的区别:
26+
27+
* 文本输出到图形显示,而不是串口
28+
* 用户程序镜像直接链接在内核中,而不是从 AHCI 磁盘读取
29+
30+
## Boot
31+
32+
rCore x86_64 基于 UEFI 标准,使用自己编写的 rBoot 作为 Bootloader。
33+
34+
[rBoot](https://github.com/rcore-os/rboot) 是一个标准的 UEFI OS Loader 程序。它完成以下主要工作:
35+
36+
* 加载 kernel ELF 文件到内存,建立虚拟内存映射。
37+
* 设置图形显示模式
38+
* 启动多核处理器
39+
* 跳转到 ELF 入口点,并传递 BootInfo 信息
40+
41+
更多参考:[uefi-rs 文档](https://github.com/rust-osdev/uefi-rs/blob/master/BUILDING.md)

0 commit comments

Comments
 (0)