Rename .cargo/config files to .cargo/config.toml

The latter makes it more clear what kind of file it is.
This commit is contained in:
Philipp Oppermann
2020-07-17 11:57:17 +02:00
parent b7eb093b42
commit 6f1f872158
3 changed files with 7 additions and 7 deletions

View File

@@ -423,10 +423,10 @@ Now our program should build successfully on macOS.
#### Unifying the Build Commands #### Unifying the Build Commands
Right now we have different build commands depending on the host platform, which is not ideal. To avoid this, we can create a file named `.cargo/config` that contains the platform specific arguments: Right now we have different build commands depending on the host platform, which is not ideal. To avoid this, we can create a file named `.cargo/config.toml` that contains the platform specific arguments:
```toml ```toml
# in .cargo/config # in .cargo/config.toml
[target.'cfg(target_os = "linux")'] [target.'cfg(target_os = "linux")']
rustflags = ["-C", "link-arg=-nostartfiles"] rustflags = ["-C", "link-arg=-nostartfiles"]
@@ -438,7 +438,7 @@ rustflags = ["-C", "link-args=/ENTRY:_start /SUBSYSTEM:console"]
rustflags = ["-C", "link-args=-e __start -static -nostartfiles"] rustflags = ["-C", "link-args=-e __start -static -nostartfiles"]
``` ```
The `rustflags` key contains arguments that are automatically added to every invocation of `rustc`. For more information on the `.cargo/config` file check out the [official documentation](https://doc.rust-lang.org/cargo/reference/config.html). The `rustflags` key contains arguments that are automatically added to every invocation of `rustc`. For more information on the `.cargo/config.toml` file check out the [official documentation](https://doc.rust-lang.org/cargo/reference/config.html).
Now our program should be buildable on all three platforms with a simple `cargo build`. Now our program should be buildable on all three platforms with a simple `cargo build`.

View File

@@ -283,12 +283,12 @@ Now we are able to build our kernel for a bare metal target. However, our `_star
### Set a Default Target ### Set a Default Target
To avoid passing the `--target` parameter on every invocation of `cargo xbuild`, we can override the default target. To do this, we create a [cargo configuration] file at `.cargo/config` with the following content: To avoid passing the `--target` parameter on every invocation of `cargo xbuild`, we can override the default target. To do this, we create a [cargo configuration] file at `.cargo/config.toml` with the following content:
[cargo configuration]: https://doc.rust-lang.org/cargo/reference/config.html [cargo configuration]: https://doc.rust-lang.org/cargo/reference/config.html
```toml ```toml
# in .cargo/config # in .cargo/config.toml
[build] [build]
target = "x86_64-blog_os.json" target = "x86_64-blog_os.json"
@@ -434,7 +434,7 @@ After writing the image to the USB stick, you can run it on real hardware by boo
To make it easier to run our kernel in QEMU, we can set the `runner` configuration key for cargo: To make it easier to run our kernel in QEMU, we can set the `runner` configuration key for cargo:
```toml ```toml
# in .cargo/config # in .cargo/config.toml
[target.'cfg(target_os = "none")'] [target.'cfg(target_os = "none")']
runner = "bootimage runner" runner = "bootimage runner"

View File

@@ -22,7 +22,7 @@ This blog is openly developed on [GitHub]. If you have any problems or questions
## Requirements ## Requirements
This post replaces the (now deprecated) [_Unit Testing_] and [_Integration Tests_] posts. It assumes that you have followed the [_A Minimal Rust Kernel_] post after 2019-04-27. Mainly, it requires that you have a `.cargo/config` file that [sets a default target] and [defines a runner executable]. This post replaces the (now deprecated) [_Unit Testing_] and [_Integration Tests_] posts. It assumes that you have followed the [_A Minimal Rust Kernel_] post after 2019-04-27. Mainly, it requires that you have a `.cargo/config.toml` file that [sets a default target] and [defines a runner executable].
[_Unit Testing_]: @/second-edition/posts/deprecated/04-unit-testing/index.md [_Unit Testing_]: @/second-edition/posts/deprecated/04-unit-testing/index.md
[_Integration Tests_]: @/second-edition/posts/deprecated/05-integration-tests/index.md [_Integration Tests_]: @/second-edition/posts/deprecated/05-integration-tests/index.md