Compare commits

..

11 Commits

Author SHA1 Message Date
seewishnew
919b57d197 Merge 128d456923 into 4d7b78069f 2024-05-02 08:57:37 +03:00
Philipp Oppermann
4d7b78069f Merge pull request #1312 from squirrel532/patch-zh-tw
Fix some minor error in zh-tw
2024-04-16 17:48:03 +02:00
Squirrel
56d66b6b24 Update wording, make it fluent 2024-04-13 23:36:50 +08:00
Squirrel
ed38ea1aa0 Update translation of name mangling
Translate "name mangling" to "名稱重整"
https://rust-lang.tw/book-tw/ch19-01-unsafe-rust.html
2024-04-13 22:27:42 +08:00
Squirrel
d8204b05cc Fix wording convention 2024-04-13 22:20:46 +08:00
Squirrel
5f00ca206d Fix typo 2024-04-13 22:09:48 +08:00
Philipp Oppermann
52856ea30e Merge pull request #1311 from phil-opp/cleanup
Remove old bors.toml config file
2024-04-10 18:38:54 +02:00
Philipp Oppermann
a611ca7bfe Remove old bors.toml config file 2024-04-10 18:37:39 +02:00
Philipp Oppermann
9b0a0a3fbb Add bootloader v0.9 note to Chinese translation 2024-04-10 12:46:02 +02:00
Philipp Oppermann
54010c3653 Merge pull request #1309 from phil-opp/bootloader-version-note
Add a note that only `bootloader v0.9` is compatible
2024-04-09 11:29:01 +02:00
Philipp Oppermann
b8be0c5a5d Add a note that only bootloader v0.9 is compatible 2024-04-09 11:27:15 +02:00
4 changed files with 8 additions and 8 deletions

View File

@@ -119,7 +119,7 @@ error: `#[panic_handler]` function required, but not found
error: language item required, but not found: `eh_personality` error: language item required, but not found: `eh_personality`
``` ```
現在編譯告訴我們缺少 `#[panic_handler]` 函式以及 _language item_ 現在編譯告訴我們缺少 `#[panic_handler]` 函式以及 _language item_
## 實作 panic 處理函式 ## 實作 panic 處理函式
@@ -220,9 +220,9 @@ pub extern "C" fn _start() -> ! {
} }
``` ```
我們使用 `no_mangle` 屬性來停用[名字修飾][name mangling],確保 Rust 編譯器輸出的函式名稱會是 `_start`。沒有這個屬性的話,編譯器會產生符號像是 `_ZN3blog_os4_start7hb173fedf945531caE` 來讓每個函式的名稱都是獨一無二的。我們會需要這項屬性的原因是因為我們接下來希望連結器能夠呼叫入口點函式的名稱。 我們使用 `no_mangle` 屬性來停用[名稱重整][name mangling],確保 Rust 編譯器輸出的函式名稱會是 `_start`。沒有這個屬性的話,編譯器會產生符號像是 `_ZN3blog_os4_start7hb173fedf945531caE` 來讓每個函式的名稱都是獨一無二的。我們會需要這項屬性的原因是因為我們接下來希望連結器能夠呼叫入口點函式的名稱。
我們還將函式標記為 `extern "C"` 來告訴編譯器這個函式應當使用 [C 的調用約定][C calling convention],而不是 Rust 的調用約定。而函式名稱選用 `_start` 的原因是因為這是大多數系統的預設入口點名稱。 我們還將函式標記為 `extern "C"` 來告訴編譯器這個函式應當使用 [C 的呼叫慣例][C calling convention],而不是 Rust 的呼叫慣例。而函式名稱選用 `_start` 的原因是因為這是大多數系統的預設入口點名稱。
[name mangling]: https://en.wikipedia.org/wiki/Name_mangling [name mangling]: https://en.wikipedia.org/wiki/Name_mangling
[C calling convention]: https://en.wikipedia.org/wiki/Calling_convention [C calling convention]: https://en.wikipedia.org/wiki/Calling_convention
@@ -511,7 +511,7 @@ cargo rustc -- -C link-args="/ENTRY:_start /SUBSYSTEM:console"
cargo rustc -- -C link-args="-e __start -static -nostartfiles" cargo rustc -- -C link-args="-e __start -static -nostartfiles"
``` ```
注意這只是最小的 Rust 獨立執行檔範例,它還是會賴一些事情發生,像是當 `_start` 函式呼叫時堆疊已經初始化完畢。**所以如果想真的使用這樣的執行檔的話還需要更多步驟。** 注意這只是最小的 Rust 獨立執行檔範例,它還是會賴一些事情,像是當 `_start` 函式呼叫時堆疊已經初始化完畢。**所以如果想真的使用這樣的執行檔的話還需要更多步驟。**
## 接下來呢? ## 接下來呢?

View File

@@ -406,6 +406,8 @@ Instead of writing our own bootloader, which is a project on its own, we use the
bootloader = "0.9" bootloader = "0.9"
``` ```
**Note:** This post is only compatible with `bootloader v0.9`. Newer versions use a different build system and will result in build errors when following this post.
Adding the bootloader as a dependency is not enough to actually create a bootable disk image. The problem is that we need to link our kernel with the bootloader after compilation, but cargo has no support for [post-build scripts]. Adding the bootloader as a dependency is not enough to actually create a bootable disk image. The problem is that we need to link our kernel with the bootloader after compilation, but cargo has no support for [post-build scripts].
[post-build scripts]: https://github.com/rust-lang/cargo/issues/545 [post-build scripts]: https://github.com/rust-lang/cargo/issues/545

View File

@@ -368,6 +368,8 @@ pub extern "C" fn _start() -> ! {
bootloader = "0.9" bootloader = "0.9"
``` ```
** 注意:** 当前环境仅兼容 `bootloader v0.9` 版本。较新的版本需考虑使用其他的构建工具,否则会导致构建出现未知错误。
只添加引导程序为依赖项,并不足以创建一个可引导的磁盘映像;我们还需要内核编译完成之后,将内核和引导程序组合在一起。然而,截至目前,原生的 cargo 并不支持在编译完成后添加其它步骤(详见[这个 issue](https://github.com/rust-lang/cargo/issues/545))。 只添加引导程序为依赖项,并不足以创建一个可引导的磁盘映像;我们还需要内核编译完成之后,将内核和引导程序组合在一起。然而,截至目前,原生的 cargo 并不支持在编译完成后添加其它步骤(详见[这个 issue](https://github.com/rust-lang/cargo/issues/545))。
为了解决这个问题,我们建议使用 `bootimage` 工具——它将会在内核编译完毕后,将它和引导程序组合在一起,最终创建一个能够引导的磁盘映像。我们可以使用下面的命令来安装这款工具: 为了解决这个问题,我们建议使用 `bootimage` 工具——它将会在内核编译完毕后,将它和引导程序组合在一起,最终创建一个能够引导的磁盘映像。我们可以使用下面的命令来安装这款工具:

View File

@@ -1,4 +0,0 @@
status = [
"Zola Build", "Check Spelling"
]
delete_merged_branches = true